]> granicus.if.org Git - sudo/commitdiff
Add --enable-werror configure option.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 30 Aug 2011 14:12:04 +0000 (10:12 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 30 Aug 2011 14:12:04 +0000 (10:12 -0400)
Add -Wall and -Werror after all tests so they don't cause failures.

--HG--
branch : 1.7

INSTALL
configure
configure.in

diff --git a/INSTALL b/INSTALL
index 5008f35c33a2490af21af1f78f5438ebf5656171..b8bb309c8a78dd241c2bc6e53b731c78f42667cd 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -636,6 +636,9 @@ The following options are also configurable at runtime:
   --enable-warnings
        Enable compiler warnings when building sudo with gcc.
 
+  --enable-werror
+       Enable the -Werror compiler option when building sudo with gcc.
+
   --enable-admin-flag
        Enable the creation of an Ubuntu-style admin flag file
        the first time sudo is run.
index 7f8bdfe1b276d78d22ab9edfe65533490a3efa6c..c4ef12bbb221c65ce589b33d12872aa7b78eb3dd 100755 (executable)
--- a/configure
+++ b/configure
@@ -862,6 +862,7 @@ enable_path_info
 enable_env_debug
 enable_env_reset
 enable_warnings
+enable_werror
 enable_admin_flag
 with_selinux
 enable_gss_krb5_ccache_name
@@ -1521,6 +1522,7 @@ Optional Features:
   --enable-env-debug      Whether to enable environment debugging.
   --enable-env-reset      Whether to enable environment resetting by default.
   --enable-warnings       Whether to enable compiler warnings
+  --enable-werror         Whether to enable the -Werror compiler option
   --enable-admin-flag     Whether to create a Ubuntu-style admin flag file
   --enable-gss-krb5-ccache-name
                           Use GSS-API to set the Kerberos V cred cache name
@@ -5522,10 +5524,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;}
@@ -5535,6 +5534,19 @@ $as_echo "$as_me: WARNING: Ignoring unknown argument to --enable-warnings: $enab
 fi
 
 
+# Check whether --enable-werror was given.
+if test "${enable_werror+set}" = set; then :
+  enableval=$enable_werror;  case "$enableval" in
+    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;}
+           ;;
+  esac
+
+fi
+
+
 # Check whether --enable-admin-flag was given.
 if test "${enable_admin_flag+set}" = set; then :
   enableval=$enable_admin_flag;  case "$enableval" in
@@ -13488,10 +13500,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
@@ -19833,6 +19841,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
index b24fc545405cc1efcfbf6256036743c00d250a46..9308210339c16a60695a1b3373d7468eb0ac6bcf 100644 (file)
@@ -1293,16 +1293,23 @@ 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])
            ;;
   esac
 ])
 
+AC_ARG_ENABLE(werror,
+[AS_HELP_STRING([--enable-werror], [Whether to enable the -Werror compiler option])],
+[ case "$enableval" in
+    yes)    ;;
+    no)            ;;
+    *)     AC_MSG_WARN([Ignoring unknown argument to --enable-werror: $enableval])
+           ;;
+  esac
+])
+
 AC_ARG_ENABLE(admin-flag,
 [AS_HELP_STRING([--enable-admin-flag], [Whether to create a Ubuntu-style admin flag file])],
 [ case "$enableval" in
@@ -1376,13 +1383,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
@@ -2894,6 +2894,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