[Top][All Lists]

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

[sr #110369] AC_PROG_CC_C99 is not recognized as empty macro

From: Zack Weinberg
Subject: [sr #110369] AC_PROG_CC_C99 is not recognized as empty macro
Date: Wed, 11 Nov 2020 09:21:12 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0

Update of sr #110369 (project autoconf):

                  Status:                    None => Confirmed              


Follow-up Comment #2:

I can't reproduce the bad error message, I get

configure.ac:31: warning: The macro `AC_PROG_CC_C99' is obsolete.
configure.ac:31: You should run autoupdate.
../lib/autoconf/c.m4:1493: AC_PROG_CC_C99 is expanded from...
../lib/m4sugar/m4sh.m4:673: AS_IF is expanded from...
configure.ac:11: AX_CHECK_COMPILE_FLAG is expanded from...
configure.ac:31: the top level

with both 2.69d and git trunk.  However, I *do* get a broken configure

$ ./configure
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether C compiler accepts -std=gnu11... yes
./configure: line 3176: syntax error near unexpected token `fi'
./configure: line 3176: `fi'

What appears to be going on is, in the betas, AC_PROG_CC_C99 is a stub that
does all its work at m4 expansion time (calling m4_warn and AC_REQUIRE) and
emits no shell code.  AS_VAR_IF does not recognize that its third argument is
going to expand to no shell code, so it emits an if-then-else-fi with an empty
else clause, which is a syntax error.  I'll make AS_VAR_IF more defensive.

The *reason* AC_PROG_CC_C99 is now a stub, is that in the betas, AC_PROG_CC
will automatically detect and enable C2011 mode if available, falling back to
C99 and then to C89 for older compilers.  So, with 2.70, what zeromq is doing
here becomes unnecessary.  Once 2.70-final is released, zeromq could either
bump their AC_PREREQ to [2.70] and remove the AX_CHECK_COMPILE_FLAG line
altogether, or, if they don't want to raise the minimum autoconf requirement,
they could change the AX_CHECK_COMPILE_FLAG line to

m4_version_prereq([2.70], [], [
  AX_CHECK_COMPILE_FLAG([-std=gnu11], [CFLAGS+=" -std=gnu11"],

which omits the line only when it's unnecessary.


Reply to this item at:


  Message sent via Savannah

reply via email to

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