autoconf-patches
[Top][All Lists]
Advanced

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

Re: AC_PROG_CC_C99


From: Roger Leigh
Subject: Re: AC_PROG_CC_C99
Date: Wed, 12 Jan 2005 20:30:33 +0000
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.3 (gnu/linux)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Noah Misch <address@hidden> writes:

> On Wed, Jan 05, 2005 at 10:11:45PM +0000, Roger Leigh wrote:
>> I think the intent of the patch is fine.  However, the use of sed is a
>> little dangerous IMHO, since it could break on odd CC environment
>> variables.  It might be a bit cleaner (and safer) to have two
>
> It should only break on odd values of $ac_cv_prog_cc_c89, no?  Since we 
> control
> those values, we will know if an option arises that might break that `sed' (I 
> do
> not suppose that list of options is likely to grow much, though).

My thought was if $CC contains odd characters, or space in the path.
We shouldn't break on spaces.  It's best if sed isn't required at all.

It also makes configure even slower on some platforms (e.g. Cygwin,
where fork() has an overhead measured in seconds of wall clock time,
and configure scripts already take at least 20 minutes to run!)  This
isn't a big deal, though.

>> variables that make up $CC (for example $CC_COMPILER and $CC_STANDARD,
>> where $CC_COMPILER will contain the compiler name e.g. gcc and
>> $CC_STANDARD will contain options to put it into a particular mode
>> e.g. -std=gnu99).  This will allow them to be changed separately.
>
> One would presumably set CC_COMPILER=$CC at the top of
> AC_PROG_CC_C89?

I thought at the start of the configure script.  This shouldn't need
to change at all--it's separate from the options.

> I thought about that, but I wanted this to work:
>
> AC_PROG_CC       # CC := cc -foo89
> CC="$CC -bar"    # CC := cc -foo89 -bar
> AC_PROG_CC_STDC  # CC := cc -bar -foo99
>
> Not a big deal, to be sure, but it worked with former definitions of 
> AC_PROG_CC
> and AC_PROG_CC_STDC, so we may as well not break it.

For the steps above, wouldn't the following work?  I've added an extra
$CC_EXTRA variable to accomodate what you want.

> AC_PROG_CC       # CC := cc -foo89

CC_EXTRA=""
CC_STANDARD="-foo89"
CC="$CC_COMPILER $CC_STANDARD $CC_EXTRA"

> CC="$CC -bar"    # CC := cc -foo89 -bar

CC_EXTRA="-bar"
[CC_STANDARD="-foo89"]
CC="$CC_COMPILER $CC_STANDARD $CC_EXTRA"

> AC_PROG_CC_STDC  # CC := cc -bar -foo99

[CC_EXTRA="-bar"]
CC_STANDARD="-foo99"
CC="$CC_COMPILER $CC_STANDARD $CC_EXTRA"


I don't think stripping out $ac_cv_prog_cc_c89 with sed is a good
plan, even though it should work "most of the time".  Depending on
what future macros are added, we might need to strip
$ac_cv_prog_cc_c99 within AC_PROG_CC_C89, and potentially others, so
using variables makes this reliable "for free".

In practice, I don't think this will be a big problem, but sed
wouldn't be what I would use personally.


Regards,
Roger

- -- 
Roger Leigh
                Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
                Debian GNU/Linux        http://www.debian.org/
                GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iD8DBQFB5YjnVcFcaSW/uEgRAu7HAKDBh6umQq5a54zYjRU/YbXiH+lDFQCgtmFS
BAJ3YabB+olTvhe0ogscMSE=
=jHu8
-----END PGP SIGNATURE-----




reply via email to

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