autoconf
[Top][All Lists]
Advanced

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

Re: Checking for GCC 4


From: Ralf Corsepius
Subject: Re: Checking for GCC 4
Date: Thu, 02 Feb 2006 16:44:10 +0100

On Thu, 2006-02-02 at 13:52 +0000, E. Rosten wrote:
> > How can I make sure user has at least gcc4 installed?
> 
> (after establishing that the compiler is gcc), and doing AC_PROG_AWK:
> 
> version=`$CXX -v 2>&1 | $AWK -F'[ .]' '/version/{print $3}'`
> 
> should do the job. There are some reasons for doing this
Nope, I can not imagine any reason justifying this approach.

This approach is broken (I prefer to call it naive), because 

a) version strings are subject to change at any time by vendors.
=> You will always find situations, where your version check will fail
somewhere.

b) version strings are not at all connected to a compiler providing a
feature, because vendors apply patches, enable/disable features. So even
if you believe to be using "GCC-4.0.2", it is very likely to behave
different from a vanilla FSF-GCC-4.0.2 and from other vendor
incarnations of "GCC-4.0.2". This becomes crucial, if you try to apply
version checks to work around bugs - The GCC-4.0.2 you are using might
be in trouble, but this doesn't mean other vendors' GCC-4.0.2 are having
the same issue.

>  (bigish changes
> in standards compliance in g++ 4 compared to g++ 3),
Then you should write an autoconf compile-check to check whether the
compiler is subject to such changes - better, write your code in such a
way that you won't have to resort to autoconf checks. 

>  but you should 
> probably check to see if you're not being overly restrictive before 
> implementing this test.
Consult google for KDE blacklisting certain versions of GCC-4.0.
They fell into the trap of applying the approach you are proposing.

Ralf






reply via email to

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