Fix gcc version detection for zarch

Employ common variables for gcc version detection and fix the broken
check for gcc >= 5.2.
Fixes #2668

Signed-off-by: Marius Hillenbrand <mhillen@linux.ibm.com>
This commit is contained in:
Marius Hillenbrand 2020-06-16 14:40:50 +02:00
parent 1bd3cd66c2
commit a2d13ea611
1 changed files with 16 additions and 7 deletions

View File

@ -282,9 +282,11 @@ endif
ifeq ($(C_COMPILER), GCC) ifeq ($(C_COMPILER), GCC)
GCCVERSIONGTEQ4 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 4) GCCVERSIONGTEQ4 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 4)
GCCVERSIONGT4 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \> 4) GCCVERSIONGT4 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \> 4)
GCCVERSIONEQ5 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` = 5)
GCCVERSIONGT5 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \> 5) GCCVERSIONGT5 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \> 5)
GCCVERSIONGTEQ7 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 7) GCCVERSIONGTEQ7 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 7)
GCCVERSIONGTEQ9 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 9) GCCVERSIONGTEQ9 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 9)
GCCMINORVERSIONGTEQ2 := $(shell expr `$(CC) -dumpversion | cut -f2 -d.` \>= 2)
GCCMINORVERSIONGTEQ7 := $(shell expr `$(CC) -dumpversion | cut -f2 -d.` \>= 7) GCCMINORVERSIONGTEQ7 := $(shell expr `$(CC) -dumpversion | cut -f2 -d.` \>= 7)
endif endif
@ -570,20 +572,27 @@ ifeq ($(ARCH), zarch)
DYNAMIC_CORE = ZARCH_GENERIC DYNAMIC_CORE = ZARCH_GENERIC
# Z13 is supported since gcc-5.2, gcc-6, and in RHEL 7.3 and newer # Z13 is supported since gcc-5.2, gcc-6, and in RHEL 7.3 and newer
GCC_GE_52 := $(subst 0,,$(shell expr `$(CC) -dumpversion` \>= "5.2")) ifeq ($(GCCVERSIONGT5), 1)
ZARCH_SUPPORT_Z13 := 1
ifeq ($(wildcard /etc/redhat-release), /etc/redhat-release) else ifeq ($(GCCVERSIONEQ5), 1)
RHEL_WITH_Z13 := $(subst 0,,$(shell source /etc/os-release ; expr $$VERSION_ID \>= "7.3")) ifeq ($(GCCMINORVERSIONGTEQ2), 1)
ZARCH_SUPPORT_Z13 := 1
endif
endif endif
ifeq ($(or $(GCC_GE_52),$(RHEL_WITH_Z13)), 1) ifeq ($(wildcard /etc/redhat-release), /etc/redhat-release)
ifeq ($(shell source /etc/os-release ; expr $$VERSION_ID \>= "7.3"), 1)
ZARCH_SUPPORT_Z13 := 1
endif
endif
ifeq ($(ZARCH_SUPPORT_Z13), 1)
DYNAMIC_CORE += Z13 DYNAMIC_CORE += Z13
else else
$(info OpenBLAS: Not building Z13 kernels because gcc is older than 5.2 or 6.x) $(info OpenBLAS: Not building Z13 kernels because gcc is older than 5.2 or 6.x)
endif endif
GCC_MAJOR_GE_7 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 7) ifeq ($(GCCVERSIONGTEQ7), 1)
ifeq ($(GCC_MAJOR_GE_7), 1)
DYNAMIC_CORE += Z14 DYNAMIC_CORE += Z14
else else
$(info OpenBLAS: Not building Z14 kernels because gcc is older than 7.x) $(info OpenBLAS: Not building Z14 kernels because gcc is older than 7.x)