summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavoc Pennington <hp@src.gnome.org>1998-10-17 18:07:57 +0000
committerHavoc Pennington <hp@src.gnome.org>1998-10-17 18:07:57 +0000
commitac5b6b0931cc5829b1f96ffeaff1aa6277c4d701 (patch)
tree8d9c1cbd523ba38a0c81cbb1d0493e87a2f6dfa7
parentb388b91037ad4ef35f8385ac553e5abd95f0fe7f (diff)
downloadgnome-common-ac5b6b0931cc5829b1f96ffeaff1aa6277c4d701.tar.gz
Simple-minded copy of GNOME_COMPILE_WARNINGS that sets CXXFLAGS
(GNOME_CXX_WARNINGS) svn path=/trunk/; revision=447
-rw-r--r--macros/compiler-flags.m441
1 files changed, 41 insertions, 0 deletions
diff --git a/macros/compiler-flags.m4 b/macros/compiler-flags.m4
index 1a5cd8c..51ff70f 100644
--- a/macros/compiler-flags.m4
+++ b/macros/compiler-flags.m4
@@ -45,3 +45,44 @@ AC_DEFUN([GNOME_COMPILE_WARNINGS],[
AC_MSG_RESULT($complCFLAGS)
CFLAGS="$CFLAGS $warnCFLAGS $complCFLAGS"
])
+
+dnl For C++, do basically the same thing.
+
+AC_DEFUN([GNOME_CXX_WARNINGS],[
+ AC_ARG_ENABLE(cxx-warnings,
+ [ --enable-cxx-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_cxx_warnings=minimum)
+
+ AC_MSG_CHECKING(what warning flags to pass to the C++ compiler)
+ warnCXXFLAGS=
+ if test "x$enable_cxx_warnings" != "xno"; then
+ if test "x$GCC" = "xyes"; then
+ case " $CXXFLAGS " in
+ *[\ \ ]-Wall[\ \ ]*) ;;
+ *) warnCXXFLAGS="-Wall -Wno-unused" ;;
+ esac
+
+ ## -W is not all that useful. And it cannot be controlled
+ ## with individual -Wno-xxx flags, unlike -Wall
+ if test "x$enable_cxx_warnings" = "xyes"; then
+ warnCXXFLAGS="$warnCXXFLAGS -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith"
+ fi
+ fi
+ fi
+ AC_MSG_RESULT($warnCXXFLAGS)
+
+ AC_MSG_CHECKING(what language compliance flags to pass to the C compiler)
+ complCFLAGS=
+ if test "x$GCC" = "xyes"; then
+ case " $CXXFLAGS " in
+ *[\ \ ]-ansi[\ \ ]*) ;;
+ *) complCXXFLAGS="$complCXXFLAGS -ansi" ;;
+ esac
+
+ case " $CXXFLAGS " in
+ *[\ \ ]-pedantic[\ \ ]*) ;;
+ *) complCXXFLAGS="$complCXXFLAGS -pedantic" ;;
+ esac
+ fi
+ AC_MSG_RESULT($complCXXFLAGS)
+ CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS"
+])