Do not abuse the global ARCH variable as a local temporary

Setting it with a simple "uname -m" just to be able to decide whether to compile getarch.c with -march=native
may actually keep getarch from doing a proper probe. Fixes #2231, a regression caused by #2110
This commit is contained in:
Martin Kroeker 2019-08-27 22:52:17 +02:00 committed by GitHub
parent b6552b11eb
commit 3635fdbf2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -9,9 +9,11 @@ ifndef TOPDIR
TOPDIR = . TOPDIR = .
endif endif
# If ARCH is not set, we use the host system's architecture. # If ARCH is not set, we use the host system's architecture for getarch compile options.
ifndef ARCH ifndef ARCH
ARCH := $(shell uname -m) HOSTARCH := $(shell uname -m)
else
HOSTARCH = $(ARCH)
endif endif
# Catch conflicting usage of ARCH in some BSD environments # Catch conflicting usage of ARCH in some BSD environments
@ -143,7 +145,7 @@ endif
# On x86_64 build getarch with march=native unless the compiler is PGI. This is required to detect AVX512 support in getarch. # On x86_64 build getarch with march=native unless the compiler is PGI. This is required to detect AVX512 support in getarch.
ifeq ($(ARCH), x86_64) ifeq ($(HOSTARCH), x86_64)
ifeq ($(findstring pgcc,$(HOSTCC)),) ifeq ($(findstring pgcc,$(HOSTCC)),)
GETARCH_FLAGS += -march=native GETARCH_FLAGS += -march=native
endif endif