Re: How to get autoconf to respect CC="gcc -std=c89"?

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

 



"Zack Weinberg" <zack@xxxxxxxxxxxx> writes:

> This is currently not possible, but you are not the only person who has
> asked for it to be made possible, and it's on our near-future list.
> However, none of the core Autoconf developers currently have time to work
> on it.  Might you be willing to put some time into it? 

I can have a look; I would hope it's not too difficult (I'm familiar
with m4 and sh programming, but not with autoconf-specifics, like how
AC_REQUIRE/AC_PROVIDE really works). I think this is the right piece of
code that needs a bit of configurability, in lib/autoconf/c.m4:

  AC_DEFUN([_AC_PROG_CC_STDC_EDITION],
  [ac_prog_cc_stdc=no
  m4_map([_AC_PROG_CC_STDC_EDITION_TRY], [[11], [99], [89]])])

It's that list that should be modified by AC_C_STANDARD_VERSION, right?
We "only" need replace that fix list by a variable. Questions:

1. Should that variable be an m4 macro or a shell variable? I guess it
   should be m4 (unless it should be overridable at configure time, and
   then the m4_map has to be replaced by a shell loop?).

2. What should be the name of that variable?

3. What's the right way to assign a default value, when
   AC_C_STANDARD_VERSION isn't used? Assign it early in some way? Or
   check for empty/undefined where it is used, and replace with the
   default?

> I think something like this in configure.ac
>
> AC_C_STANDARD_VERSION([c89])
> AC_PROG_CC
>
> would probably fit best with what we have now.

I agree that looks reasonable. Should AC_C_STANDARD_VERSION imply that
support for the given version is required for this package, i.e.,
configure fails if it can't find a compiler that supports that version?
(Which means that the list should collaps to a single entry)? 

Perhaps AC_C_STANDARD_VERSION should take a list of acceptable versions,
in order of preference?

(For the time being, I'm going to use this wrapper script as CC,
https://git.lysator.liu.se/nettle/nettle/-/blob/master/misc/c89).

Regards,
/Niels

-- 
Niels Möller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF368C6677.
Internet email is subject to wholesale government surveillance.





[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux