helpAutoconf - Support: sr #110451, autoconf 2.71 generated configure...

 
 

sr #110451: autoconf 2.71 generated configure file does not enable C compiler flag for C99 on Solaris 10

Submitter:  Bruno Haible <haible>
Submitted:  Sat 27 Feb 2021 08:05:03 PM UTC
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Need Info
Privacy:  Public Assigned to:  None
Open/Closed:  Open Operating System:  Solaris
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

Mon 01 Mar 2021 03:43:46 AM UTC, comment #5: 

> a  less picky test is better than a pickier one


Would you like to write a patch?  You're in a much better position to get it working to your satisfaction than I am.

Zack Weinberg <zackw>
Project Administrator
Sun 28 Feb 2021 08:33:39 PM UTC, comment #4: 

> AC_PROG_CC(_C99) intentionally doesn't use -xc99 with Sun's compilers. ... see the thread starting at: https://lists.gnu.org/archive/html/autoconf/2010-12/msg00059.html


Indeed, this option, together with the per-program flags __xpg4 and __xpg6 makes it impossible to build reliably working libraries. So, I withdraw this suggestion.

> The test for C99 compliance was made pickier in Autoconf 2.70, and -D_STDC_C99, which it does use, is no longer enough for Sun's compiler to pass the test.


I have now documented the use of -D_STDC_C99 in https://gitlab.com/ghwiki/gnow-how/-/wikis/Platforms/Configuration; nevertheless it was good that Autoconf 2.69 added -D_STDC_C99 automatically. Support for part of C99 is better than support for none of C99. Therefore a less picky test is better than a pickier one.

Bruno Haible <haible>
Sun 28 Feb 2021 07:22:25 PM UTC, comment #3: 

Although Autoconf used -D_STDC_C99 for good reason, portable software nowadays expects C99 rather than C89 behavior, so I'd favor switching to -xc99 despite its global implications (what was Sun thinking?).

I suppose I count as an "active user" of Solaris as our department still maintains and I still use a Solaris 10 SPARC server for various things, and Solaris 10 is still supported by Oracle. I can't say I use it every day though.

Paul Eggert <eggert>
Project Administrator
Sun 28 Feb 2021 06:57:23 PM UTC, comment #2: 

The root cause seems to be that AC_PROG_CC(_C99) intentionally doesn't use -xc99 with Sun's compilers.  The test for C99 compliance was made pickier in Autoconf 2.70, and -D_STDC_C99, which it does use, is no longer enough for Sun's compiler to pass the test.  Commentary in c.m4 says

# Solaris       -D_STDC_C99=
#   Note: acc's -xc99 option uses linker magic to define the external
#   symbol __xpg4 as if by "int __xpg4 = 1;", which enables C99
#   behavior for C library functions.  This is not wanted here,
#   because it means that a single module compiled with -xc99 alters
#   C runtime behavior for the entire program, not for just the
#   module.  Instead, define the (private) symbol _STDC_C99, which
#   suppresses a bogus failure in <stdbool.h>.  The resulting compiler
#   passes the test case here, and that's good enough.
#   For more, please see the thread starting at:
#   https://lists.gnu.org/archive/html/autoconf/2010-12/msg00059.html

It's possible that this decision should be revisited; current-generation C programs may well want the C99-compliant library.  On the other hand, the library compatibility issues raised in that old thread are serious.  I would prefer for you and other active users of Solaris to make the call.

Zack Weinberg <zackw>
Project Administrator
Sun 28 Feb 2021 05:30:17 PM UTC, comment #1: 

I'm attaching the config.cache and config.log files in each of the two tarballs.

(file #50942)

Bruno Haible <haible>
Sat 27 Feb 2021 08:05:03 PM UTC, original submission:  

This is a regression in autoconf 2.71, compared to autoconf 2.69.

Find attached two tarballs, hello-c-2.69.tar.gz (generated with autoconf 2.69) and hello-c-2.71.tar.gz (generated with autoconf 2.71). They contain the same source code, except for the version number in configure.ac. In particular, they contain
  - in configure.ac, an AC_PROG_CC_C99 invocation,
  - in hello.c: code that requires C99.

The commands to regenerate everything in these tarballs is:

aclocal -I m4
autoconf
autoheader
automake -a -c
rm -rf autom4te.cache

On Solaris 10, I'm using CC="cc -O". This compiler is not C99 compliant, but it accepts the option '-xc99' which makes it C99 compliant.

Both packages ought to exhibit the same behaviour, but they don't:

  • The hello-c-2.69 package compiles fine.

  ./configure prints:

checking whether we are using the GNU C compiler... no
checking whether cc -O accepts -g... yes
checking for cc -O option to accept ISO C89... none needed
checking whether cc -O understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of cc -O... none
checking for cc -O option to accept ISO C99... -D_STDC_C99=

The option '-D_STDC_C99=' is probably not entirely equivalent to '-xc99', but it is good enough: The compilation command

cc -O -D_STDC_C99= -DHAVE_CONFIG_H -I. -I..  -g -c -o hello.o ../hello.c

succeeds.

  • The hello-c-2.71 package does not build.

  ./configure prints:

checking whether the compiler supports GNU C... no
checking whether cc -O accepts -g... yes
checking for cc -O option to enable C11 features... unsupported
checking for cc -O option to enable C99 features... unsupported
checking for cc -O option to enable C89 features... none needed

Then the compilation command fails:

cc -O -DHAVE_CONFIG_H -I. -I..  -g -c -o hello.o ../hello.c
"/usr/include/sys/feature_tests.h", line 341: #error: "Compiler or options invalid; UNIX 03 and POSIX.1-2001 applications       require the use of c99"
cc: acomp failed for ../hello.c
*** Error code 2

When I set CC="cc -O -xc99", then ./configure prints

checking whether the compiler supports GNU C... no
checking whether cc -O -xc99 accepts -g... yes
checking for cc -O -xc99 option to enable C11 features... unsupported
checking for cc -O -xc99 option to enable C99 features... none needed

and the compilation command succeeds:

cc -O -xc99 -DHAVE_CONFIG_H -I. -I..     -g -c -o hello.o ../hello.c

So, that is a workaround. But the point of the AC_PROG_CC_C99 macro is that the autoconfiguration finds out about the '-xc99' by itself, isn't it?

Bruno Haible <haible>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #50942:  config-files.tar.gz added by haible (11KiB - application/gzip)
file #50939:  hello-c-2.69.tar.gz added by haible (75KiB - application/gzip)
file #50940:  hello-c-2.71.tar.gz added by haible (75KiB - application/gzip)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by eggert (Posted a comment)
  • -email is unavailable- added by zackw (Posted a comment)
  • -email is unavailable- added by haible (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-02-28 zackw StatusNone Need Info
    2021-02-28 haible Attached File- Added config-files.tar.gz, #50942
    2021-02-27 haible Attached File- Added hello-c-2.69.tar.gz, #50939
        Attached File- Added hello-c-2.71.tar.gz, #50940

    Back to the top


    Powered by Savane 3.9