Make warning CXXFLAGS configurable

This turns off -Werror by default except in the Debian package.
-Werror is inherently unportable and breaks things on OS X.  While it
can cause problems in Debian too, this is at least a little better.

It also turns off -pedantic in src/protobufs, because apparently
protoc output doesn’t compile with -pedantic on all platforms.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg
2012-02-28 05:17:12 -05:00
committed by Keith Winstein
parent 8fa8bac35e
commit aad760e7d6
11 changed files with 40 additions and 9 deletions
+27
View File
@@ -12,6 +12,33 @@ AC_CONFIG_HEADERS([config.h])
AC_PROG_CXX
AC_PROG_RANLIB
WARNING_CXXFLAGS=""
PICKY_CXXFLAGS=""
AC_ARG_ENABLE([compile-warnings],
[AS_HELP_STRING([--enable-compile-warnings@<:@=no/yes/maximum/error],
[Turn on compiler warnings])],
[case "$enableval" in
no)
;;
'' | yes)
WARNING_CXXFLAGS="-Wall"
;;
maximum)
WARNING_CXXFLAGS="-Wall"
PICKY_CXXFLAGS="-Wextra -pedantic -Wno-long-long -Weffc++"
;;
error)
WARNING_CXXFLAGS="-Wall -Werror"
PICKY_CXXFLAGS="-Wextra -pedantic -Wno-long-long -Weffc++"
;;
*)
AC_MSG_ERROR([Unknown argument '$enableval' to --enable-compile-warnings])
;;
esac],
[WARNING_CXXFLAGS="-Wall"])
AC_SUBST([WARNING_CXXFLAGS])
AC_SUBST([PICKY_CXXFLAGS])
# Checks for libraries.
AC_SEARCH_LIBS([utempter_remove_added_record], [utempter], , [AC_MSG_ERROR([Unable to find libutempter.])])
AC_SEARCH_LIBS([compress], [z], , [AC_MSG_ERROR([Unable to find zlib.])])