math: fix x86 asin, atan, exp, log1p to raise underflow
[musl] / configure
index 87207b6..7aae7d4 100755 (executable)
--- a/configure
+++ b/configure
@@ -104,6 +104,7 @@ fi
 
 CFLAGS_C99FSE=
 CFLAGS_AUTO=
+CFLAGS_MEMOPS=
 LDFLAGS_AUTO=
 OPTIMIZE_GLOBS=
 prefix=/usr/local/musl
@@ -236,6 +237,14 @@ tryflag CFLAGS_C99FSE -fexcess-precision=standard \
 || { test "$ARCH" = i386 && tryflag CFLAGS_C99FSE -ffloat-store ; }
 tryflag CFLAGS_C99FSE -frounding-math
 
+#
+# Check for options that may be needed to prevent the compiler from
+# generating self-referential versions of memcpy,, memmove, memcmp,
+# and memset. Really, we should add a check to determine if this
+# option is sufficient, and if not, add a macro to cripple these
+# functions with volatile...
+#
+tryflag CFLAGS_MEMOPS -fno-tree-loop-distribute-patterns
 
 #
 # If debugging is explicitly enabled, don't auto-enable optimizations
@@ -384,6 +393,32 @@ test "$ARCH" = "microblaze" && trycppif __MICROBLAZEEL__ "$t" \
 test "$SUBARCH" \
 && printf "configured for %s variant: %s\n" "$ARCH" "$ARCH$SUBARCH"
 
+case "$ARCH$SUBARCH" in
+arm) ASMSUBARCH=el ;;
+*) ASMSUBARCH=$SUBARCH ;;
+esac
+
+#
+# Some archs (powerpc) have different possible long double formats
+# that the compiler can be configured for. The logic for whether this
+# is supported is in bits/float.h; in general, it is not. We need to
+# check for mismatches here or code in printf, strotd, and scanf will
+# be dangerously incorrect because it depends on (1) the macros being
+# correct, and (2) IEEE semantics.
+#
+printf "checking whether compiler's long double definition matches float.h... "
+echo '#include <float.h>' > "$tmpc"
+echo '#if LDBL_MANT_DIG == 53' >> "$tmpc"
+echo 'typedef char ldcheck[9-(int)sizeof(long double)];' >> "$tmpc"
+echo '#endif' >> "$tmpc"
+if $CC $CFLAGS_C99FSE -I./arch/$ARCH -I./include $CPPFLAGS $CFLAGS \
+  -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then
+printf "yes\n"
+else
+printf "no\n"
+fail "$0: error: unsupported long double type"
+fi
+
 printf "creating config.mak... "
 
 exec 3>&1 1>config.mak
@@ -394,6 +429,7 @@ cat << EOF
 # Any changes made here will be lost if configure is re-run
 ARCH = $ARCH
 SUBARCH = $SUBARCH
+ASMSUBARCH = $ASMSUBARCH
 prefix = $prefix
 exec_prefix = $exec_prefix
 bindir = $bindir
@@ -403,6 +439,7 @@ syslibdir = $syslibdir
 CC = $CC
 CFLAGS= $CFLAGS_AUTO $CFLAGS
 CFLAGS_C99FSE = $CFLAGS_C99FSE
+CFLAGS_MEMOPS = $CFLAGS_MEMOPS
 CPPFLAGS = $CPPFLAGS
 LDFLAGS = $LDFLAGS_AUTO $LDFLAGS
 CROSS_COMPILE = $CROSS_COMPILE