diff --git a/configure.ac b/configure.ac index cf8d33cb..84998f1f 100644 --- a/configure.ac +++ b/configure.ac @@ -643,9 +643,13 @@ AM_CONDITIONAL([ENABLE_TINY_NGHTTPD], test "x${have_timerfd_create}" = "xyes"]) ac_save_CFLAGS=$CFLAGS +ac_save_CXXFLAGS=$CXXFLAGS + CFLAGS= +CXXFLAGS= if test "x$werror" != "xno"; then + # For C compiler AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"]) AX_CHECK_COMPILE_FLAG([-Wextra], [CFLAGS="$CFLAGS -Wextra"]) AX_CHECK_COMPILE_FLAG([-Werror], [CFLAGS="$CFLAGS -Werror"]) @@ -691,12 +695,23 @@ if test "x$werror" != "xno"; then AX_CHECK_COMPILE_FLAG([-Wredundant-decls], [CFLAGS="$CFLAGS -Wredundant-decls"]) # Only work with Clang for the moment AX_CHECK_COMPILE_FLAG([-Wheader-guard], [CFLAGS="$CFLAGS -Wheader-guard"]) + + # For C++ compiler + AC_LANG_PUSH(C++) + AX_CHECK_COMPILE_FLAG([-Wall], [CXXFLAGS="$CXXFLAGS -Wall"]) + AX_CHECK_COMPILE_FLAG([-Werror], [CXXFLAGS="$CXXFLAGS -Werror"]) + AX_CHECK_COMPILE_FLAG([-Wformat-security], [CXXFLAGS="$CXXFLAGS -Wformat-security"]) + AC_LANG_POP() fi WARNCFLAGS=$CFLAGS +WARNCXXFLAGS=$CXXFLAGS + CFLAGS=$ac_save_CFLAGS +CXXFLAGS=$ac_save_CXXFLAGS AC_SUBST([WARNCFLAGS]) +AC_SUBST([WARNCXXFLAGS]) EXTRACFLAG= AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [EXTRACFLAG="-fvisibility=hidden"]) diff --git a/examples/Makefile.am b/examples/Makefile.am index e2dad1d6..b9eb8e7b 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -24,8 +24,8 @@ if ENABLE_EXAMPLES AM_CFLAGS = $(WARNCFLAGS) +AM_CXXFLAGS = $(WARNCXXFLAGS) AM_CPPFLAGS = \ - -Wall \ -I$(top_srcdir)/lib/includes \ -I$(top_builddir)/lib/includes \ -I$(top_srcdir)/src/includes \ diff --git a/src/Makefile.am b/src/Makefile.am index 90fc5d21..ba5f12c9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -27,9 +27,9 @@ check_PROGRAMS = TESTS = AM_CFLAGS = $(WARNCFLAGS) +AM_CXXFLAGS = $(WARNCXXFLAGS) AM_CPPFLAGS = \ -DPKGDATADIR='"$(pkgdatadir)"' \ - -Wall \ -I$(top_srcdir)/lib/includes \ -I$(top_builddir)/lib/includes \ -I$(top_srcdir)/lib \ diff --git a/third-party/Makefile.am b/third-party/Makefile.am index 740f291a..6e9bcf27 100644 --- a/third-party/Makefile.am +++ b/third-party/Makefile.am @@ -21,7 +21,7 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -AM_CPPFLAGS = -Wall @DEFS@ +AM_CPPFLAGS = @DEFS@ if ENABLE_THIRD_PARTY