autoconf
[Top][All Lists]
Advanced

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

Re: detection of gcc version


From: Eric Blake
Subject: Re: detection of gcc version
Date: Tue, 13 Jan 2009 06:15:57 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.19) Gecko/20081209 Thunderbird/2.0.0.19 Mnenhy/0.7.5.666

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

According to Vincent Torri on 1/10/2009 11:09 PM:
> 
> Hey,
> 
> I would like to detect the major version of gcc in configure.ac. A guy
> told me to use sed like that:
> 
> GCC_MAJOR_VERSION=`$CC -dumpversion | sed "s/\..*//"`
> 
> Is there a better way to do that with autoconf macros ?

What about using preprocessor macros and AC_COMPILE_IFELSE?  For example,

#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)
 int dummy;
#else
 not gcc, or gcc is too old
#endif

But in general, version number checks tend to be counterproductive; the
autoconf philosophy favors feature checks over version number checks.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAklslAwACgkQ84KuGfSFAYCzygCeNPNvQ3D3bZGXp5EttWg9Nu0t
kRcAnj9PcFMGvkC4/af0MRpuKptyhG14
=MKSK
-----END PGP SIGNATURE-----




reply via email to

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