From: Todd C. Miller <Todd.Miller@courtesan.com>
Date: Mon, 29 Aug 2011 18:49:10 +0000 (-0400)
Subject: Add -Wall and -Werror after all tests so they don't cause failures.
X-Git-Tag: SUDO_1_8_3~54^2
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3e0e0fc385819f4dc3837f47c544a68c04f3e952;p=sudo

Add -Wall and -Werror after all tests so they don't cause failures.
---

diff --git a/configure b/configure
index 1c159548e..bf25d637a 100755
--- a/configure
+++ b/configure
@@ -5494,10 +5494,7 @@ fi
 # Check whether --enable-warnings was given.
 if test "${enable_warnings+set}" = set; then :
   enableval=$enable_warnings;  case "$enableval" in
-    yes)    if test X"$with_devel" != X"yes" -a -n "$GCC"; then
-		CFLAGS="${CFLAGS} -Wall"
-	    fi
-	    ;;
+    yes)    ;;
     no)	    ;;
     *)	    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring unknown argument to --enable-warnings: $enableval" >&5
 $as_echo "$as_me: WARNING: Ignoring unknown argument to --enable-warnings: $enableval" >&2;}
@@ -5510,10 +5507,7 @@ fi
 # Check whether --enable-werror was given.
 if test "${enable_werror+set}" = set; then :
   enableval=$enable_werror;  case "$enableval" in
-    yes)    if test X"$with_devel" != X"yes" -a -n "$GCC"; then
-		CFLAGS="${CFLAGS} -Werror"
-	    fi
-	    ;;
+    yes)    ;;
     no)	    ;;
     *)	    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring unknown argument to --enable-werror: $enableval" >&5
 $as_echo "$as_me: WARNING: Ignoring unknown argument to --enable-werror: $enableval" >&2;}
@@ -13496,10 +13490,6 @@ $as_echo "$with_noexec" >&6; }
 NOEXECFILE="sudo_noexec$_shrext"
 NOEXECDIR="`echo $with_noexec|sed 's:^\(.*\)/[^/]*:\1:'`"
 
-if test X"$with_devel" = X"yes" -a -n "$GCC"; then
-    CFLAGS="${CFLAGS} -Wall"
-fi
-
 # Extract the first word of "uname", so it can be a program name with args.
 set dummy uname; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -20011,6 +20001,15 @@ if test -n "$LIBS"; then
     done
 fi
 
+if test -n "$GCC"; then
+    if test X"$enable_warnings" = X"yes" -o X"$with_devel" = X"yes"; then
+	CFLAGS="${CFLAGS} -Wall"
+    fi
+    if test X"$enable_werror" = X"yes"; then
+	CFLAGS="${CFLAGS} -Werror"
+    fi
+fi
+
 test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)'
 
 if test X"$with_noexec" != X"no" -o X"$with_selinux" != X"no"; then
diff --git a/configure.in b/configure.in
index bfd8505a9..f7ca72132 100644
--- a/configure.in
+++ b/configure.in
@@ -1294,10 +1294,7 @@ fi
 AC_ARG_ENABLE(warnings,
 [AS_HELP_STRING([--enable-warnings], [Whether to enable compiler warnings])],
 [ case "$enableval" in
-    yes)    if test X"$with_devel" != X"yes" -a -n "$GCC"; then
-		CFLAGS="${CFLAGS} -Wall"
-	    fi
-	    ;;
+    yes)    ;;
     no)	    ;;
     *)	    AC_MSG_WARN([Ignoring unknown argument to --enable-warnings: $enableval])
 	    ;;
@@ -1307,10 +1304,7 @@ AC_ARG_ENABLE(warnings,
 AC_ARG_ENABLE(werror,
 [AS_HELP_STRING([--enable-werror], [Whether to enable the -Werror compiler option])],
 [ case "$enableval" in
-    yes)    if test X"$with_devel" != X"yes" -a -n "$GCC"; then
-		CFLAGS="${CFLAGS} -Werror"
-	    fi
-	    ;;
+    yes)    ;;
     no)	    ;;
     *)	    AC_MSG_WARN([Ignoring unknown argument to --enable-werror: $enableval])
 	    ;;
@@ -1407,13 +1401,6 @@ AC_MSG_RESULT($with_noexec)
 NOEXECFILE="sudo_noexec$_shrext"
 NOEXECDIR="`echo $with_noexec|sed 's:^\(.*\)/[[^/]]*:\1:'`"
 
-dnl
-dnl It is now safe to modify CFLAGS and CPPFLAGS
-dnl
-if test X"$with_devel" = X"yes" -a -n "$GCC"; then
-    CFLAGS="${CFLAGS} -Wall"
-fi
-
 dnl
 dnl Find programs we use
 dnl
@@ -3029,6 +3016,18 @@ if test -n "$LIBS"; then
     done
 fi
 
+dnl
+dnl We add -Wall and -Werror after all tests so they don't cause failures
+dnl
+if test -n "$GCC"; then
+    if test X"$enable_warnings" = X"yes" -o X"$with_devel" = X"yes"; then
+	CFLAGS="${CFLAGS} -Wall"
+    fi
+    if test X"$enable_werror" = X"yes"; then
+	CFLAGS="${CFLAGS} -Werror"
+    fi
+fi
+
 dnl
 dnl Set exec_prefix
 dnl