Skip to content

Commit 06387ac

Browse files
author
Guodong Xu
committed
make GCC version detection OS-independent
Previous design put GCC version detection inside of OSNAME 'WINNT'. However, such detections are required for 'Linux' and possibly other OS'es as well. For example, there is usage of the GCC versions in Makefile.arm64. When compiling on Linux machine, in the previous design, Markfile.arm64 will not know the correct GCC version. The fix is to move GCC version detection into common part, not wrapped by anything. Signed-off-by: Guodong Xu <[email protected]>
1 parent 729ac6b commit 06387ac

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)