[PATCH] fix cc_ge and cc_le

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Mon Mar 13 19:39:23 UTC 2006


On Mon, 13 Mar 2006, Rob Landley wrote:

> On Monday 13 March 2006 12:13 pm, Cristian Ionescu-Idbohrn wrote:
> > On Mon, 13 Mar 2006, Rob Landley wrote:
> > > On Monday 13 March 2006 1:43 am, Denis Vlasenko wrote:
> > > > Without this fix, make thinks that
> > > >
> > > > gcc 3.4.3 <= gcc 4.0.0
> > >
> > > Um, gcc 3.4 _is_ less than gcc 4.0, isn't it?
> > >
> > > > is not true.
> > >
> > > I'm confused.
> >
> >   # Check if CC version is greater or equal than given MAJOR,MINOR
> >   define cc_ge
> >   $(shell [ $(CC_MAJOR) -ge $(1) -a $(CC_MINOR) -ge $(2) ] && echo y)
> >   endef
> >
> > The macro wants both CC_MAJOR _and_ CC_MINOR greater-or-equal.
>
> Ah, that makes sense.
>
> > If current gcc is 4.0 and $(call cc_ge,3,4), ...),
> > [ $(CC_MAJOR) -ge $(1) ] is true, but [ $(CC_MINOR) -ge $(2) ] is false.
> >
> > Maybe this is better:
> >
> > define cc_ge
> > $(shell [ `expr $(CC_MAJOR) \* 100 \+ $(CC_MINOR)` -ge \
> > 	  `expr $(1) \* 100 \+ $(2)` ] && echo y)
> > endef
>
> That dies with:
> /bin/sh: line 0: [:         : integer expression expected

Odd. If you add this target:

---
gcc-check:
	@echo CC=$(shell $(CC) -dumpversion)
	@echo CC_MAJOR=$(CC_MAJOR), CC_MINOR=$(CC_MINOR)
---

to your Makefile, and then run:

  # make gcc-check

what does it show?

How does your $(call cc_ge,<major>,<minor>) look like?
I tested this with $(call cc_ge,3,1) and:

CC	= i386-uclibc-linux-gcc
CC	= gcc-2.95
CC	= gcc-3.3
CC	= gcc-3.4
CC	= gcc-4.0

on my Debian sid box, and it didn't fail me once.


Cheers,
Cristian



More information about the busybox mailing list