aboutsummaryrefslogtreecommitdiffstats
path: root/macros
diff options
context:
space:
mode:
authorHavoc Pennington <hp@src.gnome.org>1998-10-18 02:07:57 +0800
committerHavoc Pennington <hp@src.gnome.org>1998-10-18 02:07:57 +0800
commitb12b9818d596677a6f279e769494f5b7174849b0 (patch)
tree829bbf1c64c044c04dea11f38a159a0c6406e2d3 /macros
parent66701930a9995d48335f8cc28796bd36680d0e89 (diff)
downloadgsoc2013-evolution-b12b9818d596677a6f279e769494f5b7174849b0.tar.gz
gsoc2013-evolution-b12b9818d596677a6f279e769494f5b7174849b0.tar.zst
gsoc2013-evolution-b12b9818d596677a6f279e769494f5b7174849b0.zip
Simple-minded copy of GNOME_COMPILE_WARNINGS that sets CXXFLAGS
(GNOME_CXX_WARNINGS) svn path=/trunk/; revision=453
Diffstat (limited to 'macros')
-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 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"
+])