autoconf
[Top][All Lists]
Advanced

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

Re: how to detect gcc version in configure.ac


From: Eric Blake
Subject: Re: how to detect gcc version in configure.ac
Date: Fri, 04 Jul 2014 06:59:22 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

On 07/03/2014 11:38 PM, Minxuan Zhuang wrote:
> a project needs to satisfy both gcc 4.1.2 and gcc 4.7.3, but some options
> in the latter one(like -Wno-narrowing and Wno-unused-result) cannot be used
> in the former one. So I need to test the cutrrent gcc version and decide
> what can of option can be assigned to CFLAGS, sth like:

No.  You _don't_ want to test the compiler version.  Instead, you want
to test the compiler feature (as features can be backported across
versions).

> 
> if gcc version == 4.1.2
> CFLAGS=....
> else
> CFLAGS =.....
> 
> how can I implement it in configure.ac?

Look at how gnulib does it:

http://git.savannah.gnu.org/cgit/gnulib.git/tree/m4/manywarnings.m4

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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