Only specify CFLAGS_NO* with --enable-checking
authorAndrew Deason <adeason@sinenomine.net>
Tue, 23 Nov 2010 03:54:32 +0000 (22:54 -0500)
committerDerrick Brashear <shadow@dementia.org>
Thu, 25 Nov 2010 21:19:40 +0000 (13:19 -0800)
Currently we are always specifying e.g. CFLAGS_NOUNUSED as -Wno-unused
when we think we are compiling with gcc. Since autoconf always tries
to use gcc when possible, this breaks the build if we have a gcc
available but we use another cc for building.

This should be fixed otherwise, but in the meantime at least make this
only happen if warnings are actually turned on, so the build is less
likely to break with a default ./configure invocation.

Change-Id: I65d859db1fc0bb0930092fa8cfd6a0577d1c6ce2
Reviewed-on: http://gerrit.openafs.org/3366
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

src/cf/osconf.m4

index 250a76d..cd25b99 100644 (file)
@@ -1047,6 +1047,9 @@ else
 fi
 
 CFLAGS_NOERROR=
+CFLAGS_NOSTRICT=
+CFLAGS_NOUNUSED=
+CFLAGS_NOOLDSTYLE=
 
 if test "x$GCC" = "xyes"; then
   if test "x$enable_warnings" = "xyes"; then
@@ -1056,29 +1059,14 @@ if test "x$GCC" = "xyes"; then
     XCFLAGS="${XCFLAGS} -Wall -Wstrict-prototypes -Wold-style-definition -Werror -fdiagnostics-show-option -Wpointer-arith"
     if test "x$enable_checking" != "xall"; then
       CFLAGS_NOERROR="-Wno-error"
+      CFLAGS_NOSTRICT="-fno-strict-aliasing"
+      CFLAGS_NOUNUSED="-Wno-unused"
+      CFLAGS_NOOLDSTYLE="-Wno-old-style-definition"
       AC_DEFINE(IGNORE_SOME_GCC_WARNINGS, 1, [define to disable some gcc warnings in warnings-as-errors mode])
     fi
   fi
 fi
 
-CFLAGS_NOSTRICT=
-
-if test "x$GCC" = "xyes"; then
-  CFLAGS_NOSTRICT="-fno-strict-aliasing"
-fi
-
-if test "x$GCC" = "xyes"; then
-  CFLAGS_NOUNUSED="-Wno-unused"
-else
-  CFLAGS_NOUNUSED=
-fi
-
-if test "x$GCC" = "xyes"; then
-  CFLAGS_NOOLDSTYLE="-Wno-old-style-definition"
-else
-  CFLAGS_NOOLDSTYLE=
-fi
-
 dnl horribly cheating, assuming double / is ok.
 case $INSTALL in
   ./* )