Browse Source

configure.c: fix AX_GCC_FUNC_ATTRIBUTE detection on custom CFLAGS

AX_GCC_FUNC_ATTRIBUTE detect attribute feature by compiler warnings.
Custom or unrecognized CFLAGS can causes extra warnings so attribute
check failed.

Reset CFLAGS and restore after AX_GCC_FUNC_ATTRIBUTE call.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Andreas Mohr 6 years ago
parent
commit
ee013b383f
1 changed files with 6 additions and 0 deletions
  1. 6 0
      configure.ac

+ 6 - 0
configure.ac

@@ -45,7 +45,13 @@ if test "x$enable_werror" = xyes; then
     mc_CHECK_ONE_CFLAG([-Werror])
 fi
 
+dnl Compiler can generate warnings for unrecognized flags added to CFLAGS
+dnl which causes attribute checks to fail
+ax_gcc_func_attribute_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
+_AC_LANG_PREFIX[]FLAGS=
 AX_GCC_FUNC_ATTRIBUTE([fallthrough])
+_AC_LANG_PREFIX[]FLAGS=$ax_gcc_func_attribute_save_flags
+unset ax_gcc_func_attribute_save_flags
 
 LT_INIT