]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix no-unknown-warning-option check
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 13 Sep 2017 07:41:24 +0000 (14:41 +0700)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 13 Sep 2017 07:54:07 +0000 (14:54 +0700)
# Conflicts:
# configure

configure
m4/ax_cc.m4

index 83c8e00d8edcd813a927e04f759334840f9aef06..13537f462aa988f0b59dcd9f4eb479b86d084569 100755 (executable)
--- a/configure
+++ b/configure
@@ -2466,6 +2466,7 @@ ac_config_headers="$ac_config_headers src/include/autoconf.h"
 
 
 
+
 
 
 #
@@ -4523,47 +4524,45 @@ if test "x$GCC" = "xyes"; then
 fi
 
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the compiler flag \"-Wno-unknown-warning-option\"" >&5
-$as_echo_n "checking for the compiler flag \"-Wno-unknown-warning-option\"... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking or the compiler flag \"-Wno-unknown-warning-option\"" >&5
+$as_echo_n "checking or the compiler flag \"-Wno-unknown-warning-option\"... " >&6; }
 if ${ax_cv_cc_no_unknown_warning_option_flag+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
 
-    CFLAGS_SAVED=$CFLAGS
-    CFLAGS="$CFLAGS -Werror -Wno-unknown-warning-option"
-
-    ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+  CFLAGS_SAVED=$CFLAGS
+  CFLAGS="-Werror -Wno-unknown-warning-option"
 
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
-return 0;
+
+    /*
+     *  gcc will happily accept -Wno-unknown-warning-option
+     *  only emitting an error about it, if an error ocurrs in the source file.
+     */
+    #ifdef __GNUC__
+        gcc sucks
+    #endif
+
+    return 0;
+
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  ax_cv_cc_no_unknown_warning_option_flag="yes"
+  ax_cv_cc_no_unknown_warning_option_flag=yes
 else
-  ax_cv_cc_no_unknown_warning_option_flag="no"
+  ax_cv_cc_no_unknown_warning_option_flag=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-    ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-
-    CFLAGS="$CFLAGS_SAVED"
+  CFLAGS="$CFLAGS_SAVED"
 
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cc_no_unknown_warning_option_flag" >&5
index fcf168fd801d50045034addff438b7b5925be0c7..ffe83f44a052371daa4bdfdac6610a0f5396861e 100644 (file)
@@ -102,24 +102,32 @@ AC_DEFUN([AX_CC_QUNUSED_ARGUMENTS_FLAG],[
 ])
 
 AC_DEFUN([AX_CC_NO_UNKNOWN_WARNING_OPTION_FLAG],[
-  AC_CACHE_CHECK([for the compiler flag "-Wno-unknown-warning-option"], [ax_cv_cc_no_unknown_warning_option_flag],[
+  AC_CACHE_CHECK([or the compiler flag "-Wno-unknown-warning-option"], [ax_cv_cc_no_unknown_warning_option_flag],[
 
-    CFLAGS_SAVED=$CFLAGS
-    CFLAGS="$CFLAGS -Werror -Wno-unknown-warning-option"
-
-    AC_LANG_PUSH(C)
-    AC_TRY_COMPILE(
-      [],
-      [return 0;],
-      [ax_cv_cc_no_unknown_warning_option_flag="yes"],
-      [ax_cv_cc_no_unknown_warning_option_flag="no"])
-    AC_LANG_POP
+  CFLAGS_SAVED=$CFLAGS
+  CFLAGS="-Werror -Wno-unknown-warning-option"
+    
+  AC_COMPILE_IFELSE(
+    [AC_LANG_PROGRAM([], [[
+    /*
+     *  gcc will happily accept -Wno-unknown-warning-option
+     *  only emitting an error about it, if an error ocurrs in the source file.
+     */
+    #ifdef __GNUC__
+        gcc sucks
+    #endif    
+    
+    return 0;
+    ]])],
+    [ax_cv_cc_no_unknown_warning_option_flag=yes],
+    [ax_cv_cc_no_unknown_warning_option_flag=no])
 
-    CFLAGS="$CFLAGS_SAVED"
+  CFLAGS="$CFLAGS_SAVED"    
   ])
 ])
 
 
+
 AC_DEFUN([AX_CC_WEVERYTHING_FLAG],[
   AC_CACHE_CHECK([for the compiler flag "-Weverything"], [ax_cv_cc_weverything_flag],[