check g++'s version automally for supporting c++11

This commit is contained in:
zhengshuxin 2017-08-09 11:25:10 +08:00
parent 0a1c077f0d
commit 024eab9a4a

View File

@ -15,7 +15,17 @@ OSTYPE = $(shell uname -p)
RPATH = linux64
ifeq ($(CC),)
CC = gcc
CC = g++
endif
ifeq ($(findstring g++, $(CC)), g++)
GCC_VERSION:=$(shell echo `gcc --version|grep ^gcc|cut -d' ' -f3`)
GCC_MAJOR:=$(shell echo "$(GCC_VERSION)" | cut -d'.' -f1)
GCC_MINOR:=$(shell echo "$(GCC_VERSION)" | cut -d'.' -f2)
GCC_VER:=$(shell [ $(GCC_MAJOR) -gt 4 -o \( $(GCC_MAJOR) -eq 4 -a $(GCC_MINOR) -ge 7 \) ] && echo true)
ifeq ($(GCC_VER), true)
CFLAGS += -std=c++11 -DACL_USE_CPP11
endif
endif
# For FreeBSD