Defining build options based on available compiler version

Richard Shaw hobbes1069 at gmail.com
Sat Jul 30 16:50:51 UTC 2011


On Sat, Jul 30, 2011 at 11:44 AM, Jussi Lehtola
<jussilehtola at fedoraproject.org> wrote:
> Hi,
>
>
> I tried using
>  %global gccver %(gcc -dumpversion)
>  %if %{gccver} >= 4.6.0
>  foo here
>  %endif
>
> to conditionalize usage of quadruple precision support in a spec file
> that ships on multiple distros, but the comparison gives the error
>
>  parseExpressionBoolean returns -1

I'm just guessing here, but I think because of the dots it's returning
a string instead of a number which makes the >= comparison invalid. Is
there another gcc option that will give you a "dotless" version
number?

I would try something like:

%global gccver %(gcc -dumpversion | sed "s/\.//g")
%if %{gccver} >= 460
foo here
%endif

Richard


More information about the devel mailing list