summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Noble <pixel@nobis-crew.org>2013-07-30 16:01:15 -0700
committerNicolas Noble <pixel@nobis-crew.org>2013-07-30 16:05:20 -0700
commitaece7605a2ecd9382796d4d89b95341c21c8d587 (patch)
tree1d0bdf25936770596dacfe9146c69f40c86a8278
parent75261b5fa1767e8d46623a4a1013d30bb3cb2798 (diff)
Slightly better gcc detection.
-rw-r--r--common.mk19
1 files changed, 15 insertions, 4 deletions
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