bug-gnulib
[Top][All Lists]
Advanced

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

Re: autoconf-2.69c released [beta]


From: Bruno Haible
Subject: Re: autoconf-2.69c released [beta]
Date: Sun, 27 Sep 2020 23:47:26 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-189-generic; KDE/5.18.0; x86_64; ; )

Gavin Smith wrote:
> AC_PROG_CC_STDC from stdarg.m4 (via gl_PROG_CC_C99 in gnulib-common.m4):
> 
> # 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 does not mix well with AC_PROG_CC_STDC
> #   <https://lists.gnu.org/r/bug-gnulib/2011-09/msg00367.html>,
> #   but many more packages use AC_PROG_CC_STDC than AC_PROG_CC_C99
> #   <https://lists.gnu.org/r/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
> #   <https://lists.gnu.org/r/bug-gnulib/2011-09/msg00431.html>.
> # - AC_PROG_CC_STDC is likely to change now that C11 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])])
> ])
> 
> I'll leave it to someone else to try to fix this.

1) We don't need to care about Autoconf versions any more that didn't have
   AC_PROG_CC_C99. Gnulib assumes Autoconf >= 2.64.

2) What does it mean that "AC_PROG_CC_C99 does not mix well with
   AC_PROG_CC_STDC", as stated in
   <https://lists.gnu.org/r/bug-gnulib/2011-09/msg00367.html>?

   I did a couple of tests with Autoconf 2.64; the results with 2.69 are the
   same.

   A configure script that contains
     AC_PROG_CC
     AC_PROG_CC_STDC
     AC_PROG_CC_C99
   produces
     - with CC="gcc-version 4.2.4":
       S["CC"]="gcc-version 4.2.4 -std=gnu99 -std=gnu99"
     - on AIX 7.1 with CC="xlc -qthreaded -qtls":
       S["CC"]="xlc -qthreaded -qtls"
     - on Solaris 10 with CC="cc -O":
       S["CC"]="cc -O -xc99=all -xc99=all"

   A configure script that contains
     AC_PROG_CC
     AC_PROG_CC_C99
     AC_PROG_CC_STDC
   produces
     - with CC="gcc-version 4.2.4":
       S["CC"]="gcc-version 4.2.4 -std=gnu99 -std=gnu99"
     - on AIX 7.1 with CC="xlc -qthreaded -qtls":
       S["CC"]="xlc -qthreaded -qtls"
     - on Solaris 10 with CC="cc -O":
       S["CC"]="cc -O -xc99=all -xc99=all"

   Typical configure output looks like this:
     checking whether we are using the GNU C compiler... yes
     checking whether gcc-version 4.2.4 accepts -g... yes
     checking for gcc-version 4.2.4 option to accept ISO C89... none needed
     checking for style of include used by make... GNU
     checking dependency style of gcc-version 4.2.4... none
     checking for gcc-version 4.2.4 option to accept ISO C99... -std=gnu99
     checking for gcc-version 4.2.4 -std=gnu99 option to accept ISO C99... 
(cached) -std=gnu99
     checking for gcc-version 4.2.4 -std=gnu99 -std=gnu99 option to accept ISO 
Standard C... (cached) -std=gnu99

   So, this works fine. Only a cosmetic problem.

   The doubling of the option does not occur in GCC versions that support C99
   by default, namely in GCC >= 5. So, few people will encounter this cosmetic
   problem.

So, AC_PROG_CC_C99 can be used in place of AC_PROG_CC_STDC always.
But with Autoconf 2.69c, this produces a warning:
  warning: The macro `AC_PROG_CC_C99' is obsolete.

I'm therefore committing this fix:


2020-09-27  Bruno Haible  <bruno@clisp.org>

        Avoid "warning: The macro `AC_PROG_CC_STDC' is obsolete".
        Reported by Gavin Smith <gavinsmith0123@gmail.com> in
        <https://lists.gnu.org/archive/html/bug-gnulib/2020-09/msg00151.html>.
        * m4/gnulib-common.m4 (gl_PROG_CC_C99): Use AC_PROG_CC_C99 or
        AC_PROG_CC, depending on the Autoconf version.

diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index a036454..ddf9e69 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 61
+# gnulib-common.m4 serial 62
 dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -483,23 +483,17 @@ AC_DEFUN([gl_FEATURES_H],
 # 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 does not mix well with AC_PROG_CC_STDC
-#   <https://lists.gnu.org/r/bug-gnulib/2011-09/msg00367.html>,
-#   but many more packages use AC_PROG_CC_STDC than AC_PROG_CC_C99
-#   <https://lists.gnu.org/r/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
-#   <https://lists.gnu.org/r/bug-gnulib/2011-09/msg00431.html>.
-# - AC_PROG_CC_STDC is likely to change now that C11 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])])
+  dnl Just use AC_PROG_CC_C99.
+  dnl When AC_PROG_CC_C99 and AC_PROG_CC_STDC are used together, the 
substituted
+  dnl value of CC will contain the C99 enabling options twice. But this is only
+  dnl a cosmetic problem.
+  dnl With Autoconf >= 2.69c, use AC_PROG_CC since it implies AC_PROG_CC_C99;
+  dnl this avoids a "warning: The macro `AC_PROG_CC_C99' is obsolete."
+  m4_version_prereq([2.69c],
+    [AC_REQUIRE([AC_PROG_CC])],
+    [AC_REQUIRE([AC_PROG_CC_C99])])
 ])
 
 # gl_PROG_AR_RANLIB




reply via email to

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