[Buildroot] GCC version detection in toolchain/gcc/Makefile.in

Zachary P. Landau kapheine at gmail.com
Fri Mar 30 13:16:03 PDT 2007


> >Inside of that file, it uses the line: "ifeq ($(findstring
> >3.4.,$(GCC_VERSION)),3.4.)" to detect gcc version 3.4.X.  But then a
> >few lines down, in a separate ifeq, it uses the line: "ifeq
> >($(findstring 4.,$(GCC_VERSION)),4.)".  I believe this is supposed to
> >detect version "4.X.X" of GCC.  But it also seems to match 3.4.X
> >(because that also has '4.' in it.
> >
> >Am I right that this is an issue, or am I missing something?
>
> That sounds plausible, yes.
> What do you suggest to distinguish between gcc version 4.4.9 and 3.4.6?

I don't particularly love this solution, we could parse the version
into its individual parts, and then match against those.  Something
like this:

  GCC_MAJOR:=$(shell echo $(GCC_VERSION) | cut -d'.' -f1)
  GCC_MINOR:=$(shell echo $(GCC_VERSION) | cut -d'.' -f2)
  GCC_SUB:=$(shell echo $(GCC_VERSION) | cut -d'.' -f3)

Then we could do the tests like this:

  ifeq ($(GCC_MAJOR).$(GCC_MINOR),3.4)
  SOFT_FLOAT_CONFIG_OPTION:=--with-float=soft
  else
  SOFT_FLOAT_CONFIG_OPTION:=--without-float
  endif

and so on, for the other GCC version tests.  That way we can make sure
we are testing the right part.  If you think this solution is okay, I
could make a patch for Makefile.in to use this scheme.

-- 
Zachary P. Landau <kapheine at gmail.com>


More information about the buildroot mailing list