Author: cazfi
Date: Sun Jan 31 17:47:45 2016
New Revision: 31689

URL: http://svn.gna.org/viewcvs/freeciv?rev=31689&view=rev
Log:
Be stricter about at_quick_exit() found by configure. For example builds where 
compiler is
not in C11 compatible mode in msys2 will not use at_quick_exit().

See bug #24301

Modified:
    trunk/m4/c11.m4

Modified: trunk/m4/c11.m4
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/m4/c11.m4?rev=31689&r1=31688&r2=31689&view=diff
==============================================================================
--- trunk/m4/c11.m4     (original)
+++ trunk/m4/c11.m4     Sun Jan 31 17:47:45 2016
@@ -15,12 +15,20 @@
 
 AC_DEFUN([FC_C11_AT_QUICK_EXIT],
 [
-  AC_CACHE_CHECK([for C11 at_quick_exit()], [ac_cv_c11_at_quick_exit],
-    [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
+  AC_CACHE_CHECK([for C11 at_quick_exit()], [ac_cv_c11_at_quick_exit], [
+    dnl Add -Werror to detect cases where the header does not declare
+    dnl at_quick_exit() but linking still work. This situation can happen
+    dnl when the header is strict about the fact that at_quick_exit() is
+    dnl a C11 feature and the compiler is not in C11 mode.
+    dnl $EXTRA_DEBUG_CFLAGS contains -Wmissing-declarations if it's supported.
+    fc_save_CPPFLAGS="$CPPFLAGS"
+    CPPFLAGS="$CPPFLAGS -Werror $EXTRA_DEBUG_CFLAGS"
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
 static void func(void)
 {}
 ]], [[ at_quick_exit(func); ]])],
-[ac_cv_c11_at_quick_exit=yes], [ac_cv_c11_at_quick_exit=no])])
+[ac_cv_c11_at_quick_exit=yes], [ac_cv_c11_at_quick_exit=no])
+    CPPFLAGS="$fc_save_CPPFLAGS"])
   if test "x${ac_cv_c11_at_quick_exit}" = "xyes" ; then
     AC_DEFINE([HAVE_AT_QUICK_EXIT], [1], [C11 at_quick_exit() available])
   fi


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to