Re: Defining build options based on available compiler version

2011-08-12 Thread Garrett Holmstrom
On 2011-07-30 9:44, Jussi Lehtola wrote: > 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 > > par

Re: Defining build options based on available compiler version

2011-07-30 Thread Thomas Spura
On Sat, 30 Jul 2011 21:39:24 +0100 Niels de Vos wrote: > Watch out, this is very dangerous! You are comparing strings, not > versions: > >>> print '4.6.2' >= '4.6.12' > True Thanks... I was testing with to low numbers... :( > The better way would be to use distutils.version: > >>> from distutils

Re: Defining build options based on available compiler version

2011-07-30 Thread Niels de Vos
On Sat, Jul 30, 2011 at 09:38:29PM +0200, Thomas Spura wrote: > On Sat, 30 Jul 2011 19:44:41 +0300 > Jussi Lehtola wrote: > > > Hi, > > > > > > I tried using > > %global gccver %(gcc -dumpversion) > > %if %{gccver} >= 4.6.0 > > foo here > > %endif > > > > to conditionalize usage of quadru

Re: Defining build options based on available compiler version

2011-07-30 Thread Thomas Spura
On Sat, 30 Jul 2011 19:44:41 +0300 Jussi Lehtola 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 compariso

Re: Defining build options based on available compiler version

2011-07-30 Thread Jussi Lehtola
On Sat, 30 Jul 2011 11:50:51 -0500 Richard Shaw wrote: > 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 some

Re: Defining build options based on available compiler version

2011-07-30 Thread Jussi Lehtola
On Sat, 30 Jul 2011 20:05:12 +0300 Ville Skyttä wrote: > On 07/30/2011 07:44 PM, Jussi Lehtola wrote: > > > Is there a way to check if the gcc version is sufficient with some > > rpm macro? > > Do you actually need to have it as a macro? Often cases like this can > be handled with plain shell

Re: Defining build options based on available compiler version

2011-07-30 Thread Ville Skyttä
On 07/30/2011 07:44 PM, Jussi Lehtola wrote: > Is there a way to check if the gcc version is sufficient with some rpm > macro? Do you actually need to have it as a macro? Often cases like this can be handled with plain shell code in %prep, %build, etc. Or by patching the build system to do the

Re: Defining build options based on available compiler version

2011-07-30 Thread Richard Shaw
On Sat, Jul 30, 2011 at 11:44 AM, Jussi Lehtola 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 give