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:18:36 +0100 |
commit | 85ab71011214a66f274626caa3b09e588e620aae (patch) | |
tree | 91aa8185c56ccecf080b37d955294b73013bdaa1 /infrastructure/m4/boxbackup_tests.m4 | |
parent | 4ea58036a39c529a10cd69ee92390c10b61473ba (diff) |
Detect whether -Werror=return-type is supported by compiler.
Fixes compilation on CentOS 5.
Diffstat (limited to 'infrastructure/m4/boxbackup_tests.m4')
-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 0c1e2107..c7838a7f 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. |