bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting AC_PROG_CC_C99


From: Bruno Haible
Subject: Re: Getting AC_PROG_CC_C99
Date: Fri, 30 Sep 2011 11:56:39 +0200
User-agent: KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; )

Gary V. Vaughan wrote:
> But why emit a warning when
> we can just fix-up the definition on the fly? ...
> This changeset fixes AC_PROG_CC_C99
> (and effectively AC_PROG_CC_STDC) whether it is called before or
> after gl_EARLY, directly or by AC_PROG_CC_STDC, or even not at all!
> ...
> +[AC_PROVIDE_IFELSE([AC_PROG_CC_C99],
> +        [AC_DEFUN([AC_PROG_CC_C99])],
> +  [AC_DEFUN([AC_PROG_CC_C99],
> +    m4_defn([AC_PROG_CC_C99])[AC_DEFUN([AC_PROG_CC_C99])])])])

We can't use this. AC_PROVIDE_IFELSE is undocumented.

> By putting the fix in gl_EARLY rather than autoconf itself, there's
> still the possibility of getting multiple expansions with something
> like:
> 
>   AC_PROG_CC
>   AC_PROG_CC_C99
>   AC_PROG_CC_STDC
>   gl_EARLY
> 
> But that seems pathological to me in any case, so I haven't tried to
> address that.

That's why I think it should be addressed in Autoconf.

> * m4/gnulib-common (gl_PROG_CC_C99_ONCE): New macro to automatically
> neuter AC_PROG_CC_C99 after first invocation.

We didn't say that we want to enable C99 for all programs. See
<http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00441.html>

> +2011-09-30  Gary V. Vaughan  <address@hidden>
> +
> +     stdarg: don't expand AC_PROG_CC_C99 multiple times.

If a change affects gnulib-tool, the ChangeLog entry shouldn't pretend that it
affects only the 'stdarg' module.

I'm applying this for now. Maybe you have a more acceptable workaround against
the "$CC gets augmented twice" problem?


2011-09-30  Bruno Haible  <address@hidden>

        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.

--- m4/gnulib-common.m4.orig    Fri Sep 30 11:46:01 2011
+++ m4/gnulib-common.m4 Fri Sep 30 11:43:50 2011
@@ -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
--- modules/stdarg.orig Fri Sep 30 11:46:01 2011
+++ modules/stdarg      Fri Sep 30 11:37:20 2011
@@ -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

-- 
In memoriam Kelsang Namtso 
<http://en.wikipedia.org/wiki/Nangpa_La_shooting_incident>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]