Skip to content

Commit 2b016ab

Browse files
authored
[build] Allow overriding cxx/ar/ranlib from environment (#4659)
1 parent f594ce3 commit 2b016ab

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/configure

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -586,12 +586,6 @@ OPENBLASROOT=
586586
# libraries will run. It is set by the configure script when cross compiling.
587587
HOST=
588588

589-
# These environment variables can be used to override the default toolchain.
590-
CXX=${CXX:-g++}
591-
AR=${AR:-ar}
592-
AS=${AS:-as}
593-
RANLIB=${RANLIB:-ranlib}
594-
595589
# These environment variables can be used to provide additional flags to the
596590
# compiler/linker. We want these flags to override the flags determined by the
597591
# configure script, so we append them to the appropriate variables (CXXFLAGS,
@@ -795,11 +789,6 @@ if is_set $HOST; then
795789
IFS='-' read -ra PARTS <<< "$HOST"
796790

797791
if [[ "$HOST" != WASM ]]; then
798-
CXX="$HOST-$CXX"
799-
AR="$HOST-$AR"
800-
AS="$HOST-$AS"
801-
RANLIB="$HOST-$RANLIB"
802-
803792
# The first field in the PARTS list is the target architecture.
804793
TARGET_ARCH="$PARTS"
805794
if [[ "$TARGET_ARCH" != aarch64* && "$TARGET_ARCH" != arm* && "$TARGET_ARCH" != ppc64le && \
@@ -812,10 +801,25 @@ if is_set $HOST; then
812801
else
813802
TARGET_ARCH="$HOST"
814803
fi
804+
805+
HOST_CXX="$HOST-c++"
806+
HOST_AR="$HOST-ar"
807+
HOST_AS="$HOST-as"
808+
HOST_RANLIB="$HOST-ranlib"
815809
else
816810
TARGET_ARCH="`uname -m`"
811+
HOST_CXX=c++
812+
HOST_AR=ar
813+
HOST_AS=as
814+
HOST_RANLIB=ranlib
817815
fi
818816

817+
# These environment variables can be used to override the default toolchain.
818+
CXX=${CXX:-$HOST_CXX}
819+
AR=${AR:-$HOST_AR}
820+
AS=${AS:-$HOST_AS}
821+
RANLIB=${RANLIB:-$HOST_RANLIB}
822+
819823
#------------------------------------------------------------------------------
820824
# Matrix algebra library selection and validation.
821825
#--------------

0 commit comments

Comments
 (0)