summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2020-12-15 20:35:31 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2020-12-15 20:35:31 +0000
commit961d060510d3671457787d39fde3a0666bb69c79 (patch)
tree192af55d83af2f8efc5a9eeb1faa8ee2a8c9cfad /lib
parent2d9af353b517023057da600f7cb6e01f8d3f0e6d (diff)
Add -ftrapping-math to default cflags
This makes all tests pass with clang. -ftrapping-math is the default in gcc but not in clang. pixman-combine-float.c relies on the -ftrapping-math behaviour. ok kettenis@
Diffstat (limited to 'lib')
-rw-r--r--lib/pixman/configure48
-rw-r--r--lib/pixman/configure.ac4
2 files changed, 52 insertions, 0 deletions
diff --git a/lib/pixman/configure b/lib/pixman/configure
index 8d2533b20..2b0cc8308 100644
--- a/lib/pixman/configure
+++ b/lib/pixman/configure
@@ -12593,6 +12593,54 @@ $as_echo "#define USE_OPENMP 1" >>confdefs.h
fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -ftrapping-math" >&5
+$as_echo_n "checking whether the compiler supports -ftrapping-math... " >&6; }
+ save_CFLAGS="$CFLAGS"
+ save_LDFLAGS="$LDFLAGS"
+ save_LIBS="$LIBS"
+ CFLAGS=""
+ LDFLAGS=""
+ LIBS=""
+ CFLAGS="$WERROR -ftrapping-math"
+ CFLAGS="$save_CFLAGS $CFLAGS"
+ LDFLAGS="$save_LDFLAGS $LDFLAGS"
+ LIBS="$save_LIBS $LIBS"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ int main(int c, char **v) { (void)c; (void)v; return 0; }
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ pixman_cc_stderr=`test -f conftest.err && cat conftest.err`
+ pixman_cc_flag=yes
+else
+ pixman_cc_stderr=`test -f conftest.err && cat conftest.err`
+ pixman_cc_flag=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+ if test "x$pixman_cc_stderr" != "x"; then
+ pixman_cc_flag=no
+ fi
+
+ if test "x$pixman_cc_flag" = "xyes"; then
+ _yesno=yes
+ else
+ _yesno=no
+ fi
+ CFLAGS="$save_CFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+
+ if test "x$_yesno" = xyes; then
+ CFLAGS="$CFLAGS -ftrapping-math"
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_yesno" >&5
+$as_echo "$_yesno" >&6; }
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -fvisibility=hidden" >&5
$as_echo_n "checking whether the compiler supports -fvisibility=hidden... " >&6; }
diff --git a/lib/pixman/configure.ac b/lib/pixman/configure.ac
index 9a451c5dd..150023c9b 100644
--- a/lib/pixman/configure.ac
+++ b/lib/pixman/configure.ac
@@ -251,6 +251,10 @@ if test "x$ac_cv_prog_c_openmp" != "xunsupported" && test "x$ac_cv_prog_c_openmp
fi
AC_SUBST(OPENMP_CFLAGS)
+dnl ========================================================================
+dnl make the tests pass with clang
+PIXMAN_CHECK_CFLAG([-ftrapping-math])
+
dnl =========================================================================
dnl -fvisibility stuff