diff --git a/configure.ac b/configure.ac index 34689826c9..dd6a562e18 100644 --- a/configure.ac +++ b/configure.ac @@ -307,7 +307,12 @@ AX_CHECK_COMPILE_FLAG([-Werror=missing-prototypes], [CFLAGS="$CFLAGS AX_CHECK_COMPILE_FLAG([-Wmissing-prototypes], [CFLAGS="$CFLAGS -Wmissing-prototypes"]) dnl Dylan Baker: gcc and clang always accepr -Wno-*, hence check for the original warning, then set the no-* flag AX_CHECK_COMPILE_FLAG([-Wmissing-field-initializers], [CFLAGS="$CFLAGS -Wno-missing-field-initializers"]) -AX_CHECK_COMPILE_FLAG([-Wformat-truncation], [CFLAGS="$CFLAGS -Wno-format-truncation"]) + +if [[ $CC = "gcc" ]] +then + AX_CHECK_COMPILE_FLAG([-Wformat-truncation], [CFLAGS="$CFLAGS -Wno-format-truncation"]) +fi + AX_CHECK_COMPILE_FLAG([-fno-math-errno], [CFLAGS="$CFLAGS -fno-math-errno"]) AX_CHECK_COMPILE_FLAG([-fno-trapping-math], [CFLAGS="$CFLAGS -fno-trapping-math"]) @@ -322,7 +327,11 @@ AX_CHECK_COMPILE_FLAG([-fno-math-errno], [CXXFLAGS="$CXXFL AX_CHECK_COMPILE_FLAG([-fno-trapping-math], [CXXFLAGS="$CXXFLAGS -fno-trapping-math"]) AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [VISIBILITY_CXXFLAGS="-fvisibility=hidden"]) AX_CHECK_COMPILE_FLAG([-Wmissing-field-initializers], [CXXFLAGS="$CXXFLAGS -Wno-missing-field-initializers"]) -AX_CHECK_COMPILE_FLAG([-Wformat-truncation], [CXXFLAGS="$CXXFLAGS -Wno-format-truncation"]) + +if [[ $CXX = "g++" ]] +then + AX_CHECK_COMPILE_FLAG([-Wformat-truncation], [CXXFLAGS="$CXXFLAGS -Wno-format-truncation"]) +fi AC_LANG_POP([C++]) # Flags to help ensure that certain portions of the code -- and only those @@ -413,7 +422,11 @@ AC_SUBST([VISIBILITY_CXXFLAGS]) dnl For some reason, the test for -Wno-foo always succeeds with gcc, even if the dnl option is not supported. Hence, check for -Wfoo instead. -AX_CHECK_COMPILE_FLAG([-Woverride-init], [WNO_OVERRIDE_INIT="$WNO_OVERRIDE_INIT -Wno-override-init"]) # gcc +if [[ $CC = "gcc" ]] +then + AX_CHECK_COMPILE_FLAG([-Woverride-init], [WNO_OVERRIDE_INIT="$WNO_OVERRIDE_INIT -Wno-override-init"]) # gcc +fi + AX_CHECK_COMPILE_FLAG([-Winitializer-overrides], [WNO_OVERRIDE_INIT="$WNO_OVERRIDE_INIT -Wno-initializer-overrides"]) # clang AC_SUBST([WNO_OVERRIDE_INIT])