Skip to content

Commit d069780

Browse files
authored
Merge pull request #2626 from docularxu/working-gcc-version-detections
make GCC version detection OS-independent
2 parents f1a18d2 + 06387ac commit d069780

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Makefile.system

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,15 @@ NO_LAPACK = 1
277277
override FEXTRALIB =
278278
endif
279279

280+
ifeq ($(C_COMPILER), GCC)
281+
GCCVERSIONGTEQ4 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 4)
282+
GCCVERSIONGT4 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \> 4)
283+
GCCVERSIONGT5 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \> 5)
284+
GCCVERSIONGTEQ7 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 7)
285+
GCCVERSIONGTEQ9 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 9)
286+
GCCMINORVERSIONGTEQ7 := $(shell expr `$(CC) -dumpversion | cut -f2 -d.` \>= 7)
287+
endif
288+
280289
#
281290
# OS dependent settings
282291
#
@@ -323,13 +332,7 @@ ifeq ($(C_COMPILER), CLANG)
323332
CCOMMON_OPT += -DMS_ABI
324333
endif
325334

326-
ifeq ($(C_COMPILER), GCC)
327335
#Version tests for supporting specific features (MS_ABI, POWER9 intrinsics)
328-
GCCVERSIONGTEQ4 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 4)
329-
GCCVERSIONGT4 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \> 4)
330-
GCCVERSIONGTEQ7 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 7)
331-
GCCVERSIONGTEQ9 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 9)
332-
GCCMINORVERSIONGTEQ7 := $(shell expr `$(CC) -dumpversion | cut -f2 -d.` \>= 7)
333336
ifeq ($(GCCVERSIONGT4), 1)
334337
# GCC Major version > 4
335338
# It is compatible with MSVC ABI.
@@ -343,7 +346,6 @@ ifeq ($(GCCMINORVERSIONGTEQ7), 1)
343346
CCOMMON_OPT += -DMS_ABI
344347
endif
345348
endif
346-
endif
347349

348350
# Ensure the correct stack alignment on Win32
349351
# http://permalink.gmane.org/gmane.comp.lib.openblas.general/97

0 commit comments

Comments
 (0)