From aece7605a2ecd9382796d4d89b95341c21c8d587 Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Tue, 30 Jul 2013 16:01:15 -0700 Subject: Slightly better gcc detection. --- common.mk | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'common.mk') diff --git a/common.mk b/common.mk index e3e084b..d43a010 100644 --- a/common.mk +++ b/common.mk @@ -33,15 +33,26 @@ ifeq ($(SYSTEM),Linux) ASFLAGS = STRIP = strip --strip-unneeded - GCC_VERSION := $(shell g++ -dumpversion) - GCC_VERSION_4 := $(shell expr `g++ -dumpversion | cut -f1 -d.` \>= 4) - GCC_VERSION_x_8 := $(shell expr `g++ -dumpversion | cut -f2 -d.` \>= 8) + GCC_VERSION := $(shell g++ --version | head -1 | sed "s/.*\([0-9]\.[0-9]\.[0-9]\).*/\1/") + GCC_VERSION_4 := $(shell expr `echo $(GCC_VERSION) | cut -f1 -d.` \>= 4) + GCC_VERSION_x_7 := $(shell expr `echo $(GCC_VERSION) | cut -f2 -d.` \>= 7) + GCC_VERSION_x_8 := $(shell expr `echo $(GCC_VERSION) | cut -f2 -d.` \>= 8) + GCC_VERSION_x_x_2 := $(shell expr `echo $(GCC_VERSION) | cut -f3 -d.` \>= 2) + CLANG_VERSION := $(shell clang --version | head -1 | sed "s/.*\([0-9]\.[0-9]\).*/\1/") + CLANG_VERSION_3 := $(shell expr `echo $(CLANG_VERSION) | cut -f1 -d.` \>= 3) + CLANG_VERSION_x_1 := $(shell expr `echo $(CLANG_VERSION) | cut -f2 -d.` \>= 1) ifneq ($(GCC_VERSION_4),1) USE_CLANG = true else - ifneq ($(GCC_VERSION_x_8),1) + ifneq ($(GCC_VERSION_x_7),1) USE_CLANG = true + else + ifneq ($(GCC_VERSION_x_8),1) + ifneq ($(GCC_VERSION_x_x_2),1) + USE_CLANG = true + endif + endif endif endif -- cgit v1.2.3