changeset 2688:193da3b84167 draft

Check that CC works after applying all our CPPFLAGS and CFLAGS as one of them might stop CC from working.
author Roy Marples <roy@marples.name>
date Sun, 21 Sep 2014 10:28:54 +0000
parents 5da6e32151d9
children e1437702aac5
files configure
diffstat 1 files changed, 19 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Thu Sep 18 20:33:46 2014 +0000
+++ b/configure	Sun Sep 21 10:28:54 2014 +0000
@@ -271,24 +271,6 @@
 	done
 fi
 
-echo "Using compiler .. $CC"
-cat <<EOF >_test.c
-int main(void) {
-	return 0;
-}
-EOF
-_CC=false
-if $CC _test.c -o _test >/dev/null 2>&1; then
-	[ -x _test ] && _CC=true
-fi
-rm -f _test.c _test
-if ! $_CC; then
-	echo "$CC does not create executables"
-	exit 1
-fi
-[ "$CC" != cc ] && echo "CC=	$CC" >>$CONFIG_MK
-$CC --version | $SED -e '1!d'
-
 # Set to blank, then append user config
 # We do this so our SED call to append to XCC remains portable
 if [ -n "$CFLAGS" ]; then
@@ -417,10 +399,29 @@
 	echo "DHCPCD_SRCS+=	ipv6.c ipv6nd.c dhcp6.c" >>$CONFIG_MK
 fi
 
+echo "Using compiler .. $CC"
 # Add CPPFLAGS and CFLAGS to CC for testing features
 XCC="$CC `$SED -n -e 's/CPPFLAGS+=*\(.*\)/\1/p' $CONFIG_MK`"
 XCC="$XCC `$SED -n -e 's/CFLAGS+=*\(.*\)/\1/p' $CONFIG_MK`"
 
+# Now test we can use the compiler with our CFLAGS
+cat <<EOF >_test.c
+int main(void) {
+	return 0;
+}
+EOF
+_CC=false
+if $CC _test.c -o _test >/dev/null 2>&1; then
+	[ -x _test ] && _CC=true
+fi
+rm -f _test.c _test
+if ! $_CC; then
+	echo "$CC does not create executables"
+	exit 1
+fi
+[ "$CC" != cc ] && echo "CC=	$CC" >>$CONFIG_MK
+$CC --version | $SED -e '1!d'
+
 if [ "$OS" = linux ]; then
 	printf "Testing for nl80211 ... "
 	cat <<EOF >_nl80211.c