[mutter] Add --enable-compile-warnings option to configure script.



commit bb3d23f7f65404f000999f67039737aeb9c566d9
Author: Nickolas Lloyd <ultrageek lloyd gmail com>
Date:   Thu Jul 1 17:25:42 2010 +0000

    Add --enable-compile-warnings option to configure script.
    
    This patch adds the option to disable or enable compiler warnings
    to maintain compatibility with gnome standard configure options, and
    allow users to work around warnings from compiler incompatibility.
    
    --enable-compile-warnings=no disables compile warnings completely,
    while --enable-compile-warnings=yes turns on non-fatal warnings.
    The default --enable-compile-warnings=error gives the previous behavior.
    
    Dead code for enabling '-ansi -pendantic' is removed, and the
    default enabling of -ansi is removed as well. Blanket disabling
    GCC extensions and C99 features causes various problems; we're
    better off enforcing the dialect we want to use at code review
    time.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=616275

 configure.in |  110 ++++++++++++++++++++++++++++-----------------------------
 1 files changed, 54 insertions(+), 56 deletions(-)
---
diff --git a/configure.in b/configure.in
index 02d9035..d512c5c 100644
--- a/configure.in
+++ b/configure.in
@@ -63,63 +63,66 @@ AC_C_BIGENDIAN
 
 #### Warnings
 
+# Stay command-line compatible with the gnome-common configure option. Here
+# minimum/yes/maximum are the same, however.
+AC_ARG_ENABLE(compile_warnings,
+  AS_HELP_STRING([--enable-compile-warnings=@<:@no/minimum/yes/maximum/error@:>@],[Turn on compiler warnings]),,
+  enable_compile_warnings=error)
+
 changequote(,)dnl
-if test "x$GCC" = "xyes"; then
-  case " $CFLAGS " in
-  *[\ \	]-Wall[\ \	]*) ;;
-  *) CFLAGS="$CFLAGS -Wall" ;;
-  esac
-
-#  case " $CFLAGS " in
-#  *[\ \	]-Wshadow[\ \	]*) ;;
-#  *) CFLAGS="$CFLAGS -Wshadow" ;;
-#  esac
-
-  case " $CFLAGS " in
-  *[\ \	]-Wchar-subscripts[\ \	]*) ;;
-  *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
-  esac
-
-  case " $CFLAGS " in
-  *[\ \	]-Wmissing-declarations[\ \	]*) ;;
-  *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
-  esac
-
-  case " $CFLAGS " in
-  *[\ \	]-Wmissing-prototypes[\ \	]*) ;;
-  *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;;
-  esac
-
-  case " $CFLAGS " in
-  *[\ \	]-Wnested-externs[\ \	]*) ;;
-  *) CFLAGS="$CFLAGS -Wnested-externs" ;;
-  esac
-
-  case " $CFLAGS " in
-  *[\ \	]-Wpointer-arith[\ \	]*) ;;
-  *) CFLAGS="$CFLAGS -Wpointer-arith" ;;
-  esac
-
-  case " $CFLAGS " in
-  *[\ \	]-Wcast-align[\ \	]*) ;;
-  *) CFLAGS="$CFLAGS -Wcast-align" ;;
-  esac
-
-  case " $CFLAGS " in
-  *[\ \	]-Wsign-compare[\ \	]*) ;;
-  *) CFLAGS="$CFLAGS -Wsign-compare" ;;
-  esac
-
-  if test "x$enable_ansi" = "xyes"; then
+if test "$enable_compile_warnings" != no ; then
+  if test "x$GCC" = "xyes"; then
+    case " $CFLAGS " in
+    *[\ \	]-Wall[\ \	]*) ;;
+    *) CFLAGS="$CFLAGS -Wall" ;;
+    esac
+
+#   case " $CFLAGS " in
+#   *[\ \	]-Wshadow[\ \	]*) ;;
+#   *) CFLAGS="$CFLAGS -Wshadow" ;;
+#   esac
+
+    case " $CFLAGS " in
+    *[\ \	]-Wchar-subscripts[\ \	]*) ;;
+    *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
+    esac
+
+    case " $CFLAGS " in
+    *[\ \	]-Wmissing-declarations[\ \	]*) ;;
+    *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
+    esac
+
+    case " $CFLAGS " in
+    *[\ \	]-Wmissing-prototypes[\ \	]*) ;;
+    *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;;
+    esac
+
+    case " $CFLAGS " in
+    *[\ \	]-Wnested-externs[\ \	]*) ;;
+    *) CFLAGS="$CFLAGS -Wnested-externs" ;;
+    esac
+
+    case " $CFLAGS " in
+    *[\ \	]-Wpointer-arith[\ \	]*) ;;
+    *) CFLAGS="$CFLAGS -Wpointer-arith" ;;
+    esac
+
     case " $CFLAGS " in
-    *[\ \	]-ansi[\ \	]*) ;;
-    *) CFLAGS="$CFLAGS -ansi" ;;
+    *[\ \	]-Wcast-align[\ \	]*) ;;
+    *) CFLAGS="$CFLAGS -Wcast-align" ;;
     esac
 
     case " $CFLAGS " in
-    *[\ \	]-pedantic[\ \	]*) ;;
-    *) CFLAGS="$CFLAGS -pedantic" ;;
+    *[\ \	]-Wsign-compare[\ \	]*) ;;
+    *) CFLAGS="$CFLAGS -Wsign-compare" ;;
     esac
+
+    if test "$enable_compile_warnings" = error; then
+      case " $CFLAGS " in
+      *[\ \	]-Werror[\ \	]*) ;;
+      *) CFLAGS="$CFLAGS -Werror" ;;
+      esac
+    fi
   fi
 fi
 changequote([,])dnl
@@ -529,11 +532,6 @@ if test "x$enable_debug" = "xyes"; then
 	CFLAGS="$CFLAGS -g -O"
 fi
 
-# Warnings are there for a reason
-if test "x$GCC" = "xyes"; then
-  CFLAGS="$CFLAGS -Wall -Werror -ansi"
-fi
-
 # For fix-meta-rectangle.py
 AM_PATH_PYTHON([2.5])
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]