From b12b9818d596677a6f279e769494f5b7174849b0 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sat, 17 Oct 1998 18:07:57 +0000 Subject: Simple-minded copy of GNOME_COMPILE_WARNINGS that sets CXXFLAGS (GNOME_CXX_WARNINGS) svn path=/trunk/; revision=453 --- macros/compiler-flags.m4 | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'macros') diff --git a/macros/compiler-flags.m4 b/macros/compiler-flags.m4 index 1a5cd8c6b2..51ff70fc05 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" +]) -- cgit