Skip to content

Commit 9646803

Browse files
committed
Use sort -V to compare GCC versions
The previous solution is hacky, as it does not handle the case where major version is missing (e.g. `7`).
1 parent 02b0003 commit 9646803

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

core/Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ $(shell mkdir -p $(DEPDIR)/hooks >/dev/null)
1818
# 'clang' or 'g++'
1919
CXXCOMPILER := $(shell expr $(word 1, $(shell $(CXX) --version)) : '\(clang\|g++\)')
2020

21-
# e.g., 4.9.3 -> 40903. For clang it is always 40201
22-
CXXVERSION := $(shell $(CXX) -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/')
21+
CXXVERSION := $(shell $(CXX) -dumpversion)
2322

24-
ifeq "$(shell expr $(CXXCOMPILER) = g++ \& $(CXXVERSION) \< 40800)" "1"
23+
ifeq "$(CXXCOMPILER)" "g++"
24+
ifneq "$(shell printf '$(CXXVERSION)\n4.7' | sort -V | head -n1)" "4.7"
2525
$(error g++ 4.8 or higher is required)
2626
endif
27+
endif
2728

2829
RTE_SDK ?= $(abspath ../deps/dpdk-17.05)
2930
RTE_TARGET ?= $(shell uname -m)-native-linuxapp-gcc

0 commit comments

Comments
 (0)