diff options
author | Chris Wilson <chris+github@qwirx.com> | 2016-09-20 22:04:34 +0100 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2016-09-20 22:04:34 +0100 |
commit | 8718a10d3b457e80a922d0f2ee6b02e686fb452d (patch) | |
tree | 962e038c71762b5e0e714758ee5fc566a4d81c7d | |
parent | cf52058f32e54fe720abe51d8d5266b440180163 (diff) |
Detect whether -Werror=return-type is supported by compiler.
Fixes compilation on CentOS 5.
-rw-r--r-- | infrastructure/m4/boxbackup_tests.m4 | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/infrastructure/m4/boxbackup_tests.m4 b/infrastructure/m4/boxbackup_tests.m4 index 09d73e04..b18d77fd 100644 --- a/infrastructure/m4/boxbackup_tests.m4 +++ b/infrastructure/m4/boxbackup_tests.m4 @@ -12,7 +12,19 @@ esac if test "x$GXX" = "xyes"; then # Use -Wall if we have gcc. This gives better warnings - AC_SUBST([CXXFLAGS_STRICT], ['-Wall -Wundef -Werror=return-type']) + CXXFLAGS_STRICT='-Wall -Wundef' + + # Check whether gcc accepts -Werror=return-type, and if so add it to CXXFLAGS_STRICT + my_save_cflags="$CXXFLAGS" + CXXFLAGS="-Werror=return-type" + AC_MSG_CHECKING([whether $CXX accepts $CXXFLAGS]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], + [AC_MSG_RESULT([yes])] + [CXXFLAGS_STRICT="$CXXFLAGS_STRICT $CXXFLAGS"], + [AC_MSG_RESULT([no])] + ) + CXXFLAGS="$my_save_cflags" + AC_SUBST([CXXFLAGS_STRICT]) # Don't check for gcc -rdynamic on Solaris as it's broken, but returns 0. # On Cygwin it does nothing except cause gcc to emit a warning message. |