changeset 15800:d79b27b411b7

Centralize C99 requirement. * m4/gnulib-common.m4 (gl_PROG_CC_C99): New macro. * modules/stdarg (configure.ac-early): Invoke it instead of AC_PROG_CC_STDC. Reported by Gary V. Vaughan and Paul Eggert.
author Bruno Haible <bruno@clisp.org>
date Fri, 30 Sep 2011 11:54:58 +0200
parents f1d36de2d2bb
children 3002f394d1fe
files ChangeLog m4/gnulib-common.m4 modules/stdarg
diffstat 3 files changed, 34 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-09-30  Bruno Haible  <bruno@clisp.org>
+
+	Centralize C99 requirement.
+	* m4/gnulib-common.m4 (gl_PROG_CC_C99): New macro.
+	* modules/stdarg (configure.ac-early): Invoke it instead of
+	AC_PROG_CC_STDC.
+	Reported by Gary V. Vaughan and Paul Eggert.
+
 2011-09-29  Bruno Haible  <bruno@clisp.org>
 
 	float: Fix LDBL_MAX value on Linux/PowerPC.
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 30
+# gnulib-common.m4 serial 31
 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -211,6 +211,29 @@
 [m4_define([AS_VAR_IF],
 [AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])])
 
+# gl_PROG_CC_C99
+# Modifies the value of the shell variable CC in an attempt to make $CC
+# understand ISO C99 source code.
+# This is like AC_PROG_CC_C99, except that
+# - AC_PROG_CC_C99 did not exist in Autoconf versions < 2.60,
+# - AC_PROG_CC_C99 does not mix well with AC_PROG_CC_STDC
+#   <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00367.html>,
+#   but many more packages use AC_PROG_CC_STDC than AC_PROG_CC_C99
+#   <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00441.html>.
+# Remaining problems:
+# - When AC_PROG_CC_STDC is invoked twice, it adds the C99 enabling options
+#   to CC twice
+#   <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00431.html>.
+# - AC_PROG_CC_STDC is likely to change when C1X is an ISO standard.
+AC_DEFUN([gl_PROG_CC_C99],
+[
+  dnl Change that version number to the minimum Autoconf version that supports
+  dnl mixing AC_PROG_CC_C99 calls with AC_PROG_CC_STDC calls.
+  m4_version_prereq([9.0],
+    [AC_REQUIRE([AC_PROG_CC_C99])],
+    [AC_REQUIRE([AC_PROG_CC_STDC])])
+])
+
 # gl_PROG_AR_RANLIB
 # Determines the values for AR, ARFLAGS, RANLIB that fit with the compiler.
 # The user can set the variables AR, ARFLAGS, RANLIB if he wants to override
--- a/modules/stdarg
+++ b/modules/stdarg
@@ -11,9 +11,9 @@
 configure.ac-early:
 dnl Some compilers (e.g., AIX 5.3 cc) need to be in c99 mode
 dnl for the builtin va_copy to work.  With Autoconf 2.60 or later,
-dnl AC_PROG_CC_STDC arranges for this.  With older Autoconf AC_PROG_CC_STDC
+dnl gl_PROG_CC_C99 arranges for this.  With older Autoconf gl_PROG_CC_C99
 dnl shouldn't hurt, though installers are on their own to set c99 mode.
-AC_REQUIRE([AC_PROG_CC_STDC])
+gl_PROG_CC_C99
 
 configure.ac:
 gl_STDARG_H