declare incomplete type struct itimerspec in timerfd.h
[musl] / configure
index 5d95672..e80fdfb 100755 (executable)
--- a/configure
+++ b/configure
@@ -123,8 +123,9 @@ target=
 optimize=auto
 debug=no
 warnings=no
-shared=yes
+shared=auto
 static=yes
+wrapper=auto
 
 for arg ; do
 case "$arg" in
@@ -199,23 +200,33 @@ exit 1
 fi
 
 #
-# Only build musl-gcc wrapper if toolchain does not already target musl
+# Need to know if the compiler is gcc to decide whether to build the
+# musl-gcc wrapper, and for critical bug detection in some gcc versions.
 #
-if test -z "$wrapper" ; then
 printf "checking whether compiler is gcc... "
-if fnmatch '*gcc\ version*' "$($CC -v 2>&1)" ; then
-echo yes
+if fnmatch '*gcc\ version*' "$(LC_ALL=C $CC -v 2>&1)" ; then
+cc_is_gcc=yes
+else
+cc_is_gcc=no
+fi
+echo "$cc_is_gcc"
+
+#
+# Only build musl-gcc wrapper if toolchain does not already target musl
+#
+if test "$wrapper" = auto ; then
 printf "checking whether to build musl-gcc wrapper... "
+if test "$cc_is_gcc" = yes ; then
 wrapper=yes
 while read line ; do
 case "$line" in */ld-musl-*) wrapper=no ;; esac
 done <<EOF
 $($CC -dumpspecs)
 EOF
-echo $wrapper
 else
-echo no
+wrapper=no
 fi
+echo "$wrapper"
 fi
 
 
@@ -239,6 +250,7 @@ x86_64-x32*|x32*|x86_64*x32) ARCH=x32 ;;
 x86_64*) ARCH=x86_64 ;;
 mips*) ARCH=mips ;;
 microblaze*) ARCH=microblaze ;;
+or1k*) ARCH=or1k ;;
 powerpc*) ARCH=powerpc ;;
 sh[1-9bel-]*|sh|superh*) ARCH=sh ;;
 unknown) fail "$0: unable to detect target arch; try $0 --target=..." ;;
@@ -287,12 +299,9 @@ fi
 tryflag CFLAGS_MEMOPS -fno-tree-loop-distribute-patterns
 
 #
-# If debugging is explicitly enabled, don't auto-enable optimizations
+# Enable debugging if requessted.
 #
-if test "$debug" = yes ; then
-CFLAGS_AUTO=-g
-test "$optimize" = auto && optimize=no
-fi
+test "$debug" = yes && CFLAGS_AUTO=-g
 
 #
 # Possibly add a -O option to CFLAGS and select modules to optimize with
@@ -401,12 +410,15 @@ fi
 tryflag CFLAGS_AUTO -fno-stack-protector
 tryldflag LDFLAGS_AUTO -Wl,--hash-style=both
 
+test "$shared" = "no" || {
 # Disable dynamic linking if ld is broken and can't do -Bsymbolic-functions
 LDFLAGS_DUMMY=
 tryldflag LDFLAGS_DUMMY -Wl,-Bsymbolic-functions || {
+test "$shared" = "yes" && fail "$0: error: linker cannot build shared library"
 printf "warning: disabling dynamic linking support\n"
 shared=no
 }
+}
 
 # Find compiler runtime library
 test -z "$LIBCC" && tryldflag LIBCC -lgcc && tryldflag LIBCC -lgcc_eh
@@ -506,7 +518,7 @@ libdir = $libdir
 includedir = $includedir
 syslibdir = $syslibdir
 CC = $CC
-CFLAGS= $CFLAGS_AUTO $CFLAGS
+CFLAGS = $CFLAGS_AUTO $CFLAGS
 CFLAGS_C99FSE = $CFLAGS_C99FSE
 CFLAGS_MEMOPS = $CFLAGS_MEMOPS
 CPPFLAGS = $CPPFLAGS