aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Snover2017-10-20 11:47:43 -0500
committerBastien Bouclet2018-08-04 07:55:23 +0200
commit72791aaa23d5c947cb44ab1bb64a0b9295443282 (patch)
tree69b79e8748f8609098c6240cd93768b2b2e20d69
parentad3feae490f8ed8ac74e8c6597963807bf9e278e (diff)
downloadscummvm-rg350-72791aaa23d5c947cb44ab1bb64a0b9295443282.tar.gz
scummvm-rg350-72791aaa23d5c947cb44ab1bb64a0b9295443282.tar.bz2
scummvm-rg350-72791aaa23d5c947cb44ab1bb64a0b9295443282.zip
BUILD: Respect all build tool overrides from environment
Previously, only CXX could be overridden by the environment, which made it impossible to correctly set tools for cross-compiler toolchains which were not compatible with the default system tools.
-rw-r--r--Makefile10
-rwxr-xr-xconfigure67
2 files changed, 57 insertions, 20 deletions
diff --git a/Makefile b/Makefile
index 36b4592b20..1b2f35527f 100644
--- a/Makefile
+++ b/Makefile
@@ -88,10 +88,12 @@ config.h: $(srcdir)/configure $(ENGINE_SUBDIRS_CONFIGURE)
ifeq "$(findstring config.mk,$(MAKEFILE_LIST))" "config.mk"
@echo "Running $(srcdir)/configure with the last specified parameters"
@sleep 2
- LDFLAGS="$(SAVED_LDFLAGS)" CXX="$(SAVED_CXX)" \
- CXXFLAGS="$(SAVED_CXXFLAGS)" CPPFLAGS="$(SAVED_CPPFLAGS)" \
- ASFLAGS="$(SAVED_ASFLAGS)" WINDRESFLAGS="$(SAVED_WINDRESFLAGS)" \
- SDL_CONFIG="$(SAVED_SDL_CONFIG)" \
+ AR="$(SAVED_AR)" AS="$(SAVED_AS)" ASFLAGS="$(SAVED_ASFLAGS)" \
+ CPPFLAGS="$(SAVED_CPPFLAGS)" CXX="$(SAVED_CXX)" \
+ CXXFLAGS="$(SAVED_CXXFLAGS)" LD="$(SAVED_LD)" \
+ LDFLAGS="$(SAVED_LDFLAGS)" RANLIB="$(SAVED_RANLIB)" \
+ SDL_CONFIG="$(SAVED_SDL_CONFIG)" STRIP="$(SAVED_STRIP)" \
+ WINDRES="$(SAVED_WINDRES)" WINDRESFLAGS="$(SAVED_WINDRESFLAGS)" \
$(srcdir)/configure $(SAVED_CONFIGFLAGS)
else
$(error You need to run $(srcdir)/configure before you can run make. Check $(srcdir)/configure --help for a list of parameters)
diff --git a/configure b/configure
index 4c82580a21..2839e8708f 100755
--- a/configure
+++ b/configure
@@ -29,13 +29,19 @@ export LANGUAGE
# Save the current environment variables for next runs
SAVED_CONFIGFLAGS=$@
-SAVED_LDFLAGS=$LDFLAGS
+SAVED_AR=$AR
+SAVED_AS=$AS
+SAVED_ASFLAGS=$ASFLAGS
+SAVED_CPPFLAGS=$CPPFLAGS
SAVED_CXX=$CXX
SAVED_CXXFLAGS=$CXXFLAGS
-SAVED_CPPFLAGS=$CPPFLAGS
-SAVED_ASFLAGS=$ASFLAGS
-SAVED_WINDRESFLAGS=$WINDRESFLAGS
+SAVED_LD=$LD
+SAVED_LDFLAGS=$LDFLAGS
+SAVED_RANLIB=$RANLIB
SAVED_SDL_CONFIG=$SDL_CONFIG
+SAVED_STRIP=$STRIP
+SAVED_WINDRES=$WINDRES
+SAVED_WINDRESFLAGS=$WINDRESFLAGS
# Use environment vars if set
CXXFLAGS="$CXXFLAGS $CPPFLAGS"
@@ -1113,7 +1119,7 @@ cat >> $TMPLOG <<EOF
Invocation command line was:
$0 $@
Saved environment variables:
-LDFLAGS="$SAVED_LDFLAGS" CXX="$SAVED_CXX" CXXFLAGS="$SAVED_CXXFLAGS" CPPFLAGS="$SAVED_CPPFLAGS" ASFLAGS="$SAVED_ASFLAGS" WINDRESFLAGS="$SAVED_WINDRESFLAGS" SDL_CONFIG="$SAVED_SDL_CONFIG"
+AR="$SAVED_AR" AS="$SAVED_AS" ASFLAGS="$SAVED_ASFLAGS" CPPFLAGS="$SAVED_CPPFLAGS" CXX="$SAVED_CXX" CXXFLAGS="$SAVED_CXXFLAGS" LD="$SAVED_LD" LDFLAGS="$SAVED_LDFLAGS" RANLIB="$SAVED_RANLIB" SDL_CONFIG="$SAVED_SDL_CONFIG" STRIP="$SAVED_STRIP" WINDRES="$SAVED_WINDRES" WINDRESFLAGS="$SAVED_WINDRESFLAGS"
EOF
@@ -1883,7 +1889,26 @@ if test -z "$CXX"; then
exit 1
fi
-# By default, use the C++ compiler as linker
+if test -n "$RANLIB"; then
+ _ranlib=$RANLIB
+fi
+
+if test -n "$STRIP"; then
+ _strip=$STRIP
+fi
+
+if test -n "$AR"; then
+ _ar="$AR cru"
+fi
+
+if test -n "$AS"; then
+ _as=$AS
+fi
+
+if test -n "$WINDRES"; then
+ _windres=$WINDRES
+fi
+
LD=$CXX
#
@@ -2115,13 +2140,17 @@ cc_check -Wpragma-pack -Werror && _no_pragma_pack=yes
test "$_no_pragma_pack" = yes && append_var CXXFLAGS "-Wno-pragma-pack"
echo $_no_pragma_pack
-echo_n "Checking for $_host_alias-strings... " >> "$TMPLOG"
-if `which $_host_alias-strings >/dev/null 2>&1`; then
- _strings=$_host_alias-strings
- echo yes >> "$TMPLOG"
+if test -n "$STRINGS"; then
+ _strings=$STRINGS
else
- _strings=strings
- echo no >> "$TMPLOG"
+ echo_n "Checking for $_host_alias-strings... " >> "$TMPLOG"
+ if `which $_host_alias-strings >/dev/null 2>&1`; then
+ _strings=$_host_alias-strings
+ echo yes >> "$TMPLOG"
+ else
+ _strings=strings
+ echo no >> "$TMPLOG"
+ fi
fi
#
@@ -5398,13 +5427,19 @@ $_mak_plugins
port_mk = $_port_mk
SAVED_CONFIGFLAGS := $SAVED_CONFIGFLAGS
-SAVED_LDFLAGS := $SAVED_LDFLAGS
+SAVED_AR := $SAVED_AR
+SAVED_AS := $SAVED_AS
+SAVED_ASFLAGS := $SAVED_ASFLAGS
+SAVED_CPPFLAGS := $SAVED_CPPFLAGS
SAVED_CXX := $SAVED_CXX
SAVED_CXXFLAGS := $SAVED_CXXFLAGS
-SAVED_CPPFLAGS := $SAVED_CPPFLAGS
-SAVED_ASFLAGS := $SAVED_ASFLAGS
-SAVED_WINDRESFLAGS := $SAVED_WINDRESFLAGS
+SAVED_LD := $SAVED_LD
+SAVED_LDFLAGS := $SAVED_LDFLAGS
+SAVED_RANLIB := $SAVED_RANLIB
SAVED_SDL_CONFIG := $SAVED_SDL_CONFIG
+SAVED_STRIP := $SAVED_STRIP
+SAVED_WINDRES := $SAVED_WINDRES
+SAVED_WINDRESFLAGS := $SAVED_WINDRESFLAGS
EOF
#