add support for BSD struct tcphdr in netinet/tcp.h
[musl] / configure
index 48465f7..aa3cb42 100755 (executable)
--- a/configure
+++ b/configure
@@ -45,6 +45,12 @@ exit 0
 
 # Helper functions
 
+quote () {
+tr '\n' ' ' <<EOF | grep '^[-[:alnum:]_=,./:]* $' >/dev/null 2>&1 && { echo "$1" ; return 0 ; }
+$1
+EOF
+printf %s\\n "$1" | sed -e "s/'/'\\\\''/g" -e "1s/^/'/" -e "\$s/\$/'/" -e "s#^'\([-[:alnum:]_,./:]*\)=\(.*\)\$#\1='\2#"
+}
 echo () { printf "%s\n" "$*" ; }
 fail () { echo "$*" ; exit 1 ; }
 fnmatch () { eval "case \"\$2\" in $1) return 0 ;; *) return 1 ;; esac" ; }
@@ -237,6 +243,27 @@ tryflag CFLAGS_C99FSE -fexcess-precision=standard \
 || { test "$ARCH" = i386 && tryflag CFLAGS_C99FSE -ffloat-store ; }
 tryflag CFLAGS_C99FSE -frounding-math
 
+#
+# We may use the may_alias attribute if __GNUC__ is defined, so
+# if the compiler defines __GNUC__ but does not provide it,
+# it must be defined away as part of the CFLAGS.
+#
+printf "checking whether compiler needs attribute((may_alias)) suppression... "
+cat > "$tmpc" <<EOF
+typedef int
+#ifdef __GNUC__
+__attribute__((__may_alias__))
+#endif
+x;
+EOF
+if $CC $CFLAGS_C99FSE -I./arch/$ARCH -I./include $CPPFLAGS $CFLAGS \
+  -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then
+printf "no\n"
+else
+printf "yes\n"
+CFLAGS_C99FSE="$CFLAGS_C99FSE -D__may_alias__="
+fi
+
 #
 # Check for options that may be needed to prevent the compiler from
 # generating self-referential versions of memcpy,, memmove, memcmp,
@@ -348,7 +375,6 @@ tryflag CFLAGS_AUTO -Werror=pointer-arith
 
 if test "x$warnings" = xyes ; then
 tryflag CFLAGS_AUTO -Wall
-tryflag CFLAGS_AUTO -Wcast-align
 tryflag CFLAGS_AUTO -Wno-parentheses
 tryflag CFLAGS_AUTO -Wno-uninitialized
 tryflag CFLAGS_AUTO -Wno-missing-braces
@@ -381,7 +407,7 @@ t="$CFLAGS_C99FSE $CPPFLAGS $CFLAGS_AUTO $CFLAGS"
 
 if test "$ARCH" = "arm" ; then
 trycppif __ARMEB__ "$t" && SUBARCH=${SUBARCH}eb
-trycppif __SOFTFP__ "$t" || SUBARCH=${SUBARCH}hf
+trycppif __ARM_PCS_VFP "$t" && SUBARCH=${SUBARCH}hf
 fi
 
 test "$ARCH" = "mips" && trycppif "_MIPSEL || __MIPSEL || __MIPSEL__" "$t" \
@@ -393,6 +419,11 @@ 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
@@ -416,14 +447,19 @@ fi
 
 printf "creating config.mak... "
 
+cmdline=$(quote "$0")
+for i ; do cmdline="$cmdline $(quote "$i")" ; done
+
 exec 3>&1 1>config.mak
 
 
 cat << EOF
-# This version of config.mak was generated by configure
+# This version of config.mak was generated by:
+# $cmdline
 # 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