commit ab406a9e6a0568bcb607ff737397bdc5b0cf533b
parent 4a4e93fb5a5243c2208a87cd3485bd2979dac2a5
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Mon, 10 Apr 2017 18:39:47 +0300
configure: better test for "-Werror=attributes"
Diffstat:
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
@@ -182,7 +182,21 @@ AS_VAR_IF([[mhd_cv_macro_true_false_valid]], [["yes"]], [[:]],
AX_CHECK_COMPILE_FLAG([[-Werror=attributes]],
- [[errattr_CFLAGS="-Werror=attributes"]],
+ [
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror=attributes"
+ AC_MSG_CHECKING([[whether -Werror=attributes actually works]])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+ [[__attribute__((non_existing_attrb_dummy)) int SimpleFunc(void) {return 3;}]], [[int r = SimpleFunc(); if (r) return r;]])],
+ [
+ AC_MSG_RESULT([[no]])
+ errattr_CFLAGS=""
+ ], [
+ AC_MSG_RESULT([[yes]])
+ errattr_CFLAGS="-Werror=attributes"
+ ])
+ CFLAGS="$save_CFLAGS"
+ ],
[[errattr_CFLAGS=""]], [], [])
AC_MSG_CHECKING([[for function inline keywords suppoted by $CC]])
save_CFLAGS="$CFLAGS"