autoconf
[Top][All Lists]
Advanced

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

Re: detection of gcc version


From: Vincent Torri
Subject: Re: detection of gcc version
Date: Tue, 13 Jan 2009 15:05:41 +0100 (CET)




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.

now that you mention it, i indeed prefer to check the feature

thank you

Vincent Torri




reply via email to

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