From 1e5c08ca53f5d3251f93a21cda762a22f5a9bb34 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Wed, 30 Mar 2016 16:32:01 +0200
Subject: [PATCH] Build [Configure]: Strip arguments from REALCC et al.

Fixes compiler propagation to sub-configures when eg compiling
--with-abi.
---
 src/configure.in | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/configure.in b/src/configure.in
index 57e75c1790..1a11d46690 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -673,8 +673,8 @@ esac
 
 # Skip if user does not wish to use smartlink binary.
 if test "x$force_smartlink_script_only" = "x"; then
-# Strip smartlink from $CC
-REALCC="`echo $CC|sed -e 's/.*smartlink //'`"
+# Strip smartlink and arguments from $CC
+REALCC="`echo $CC|sed -e 's/.*smartlink *//' -e 's/ .*//g'`"
 
 
 # FIXME: Add proper tests
@@ -819,8 +819,8 @@ fi # force_smartlink_script_only
 CC="$SMARTLINK $REALCC"
 pike_cv_prog_CC="$CC"
 
-# Strip smartlink from $CXX
-REALCXX="`echo $CXX|sed -e 's/.*smartlink //'`"
+# Strip smartlink and arguments from $CXX
+REALCXX="`echo $CXX|sed -e 's/.*smartlink *//' -e 's/ .*//g'`"
 CXX="$SMARTLINK $REALCXX"
 pike_cv_prog_CXX="$CXX"
 
@@ -830,8 +830,8 @@ AC_SUBST(REALCXX)
 export CC CXX REALCC REALCXX SMARTLINK
 
 AC_MSG_CHECKING([for a fallback compiler])
-# Strip smartlink from $FALLBACK_CC
-FALLBACK_CC="`echo $FALLBACK_CC|sed -e 's/.*smartlink //'`"
+# Strip smartlink and arguments from $FALLBACK_CC
+FALLBACK_CC="`echo $FALLBACK_CC|sed -e 's/.*smartlink *//' -e 's/ .*//g'`"
 if test "x$FALLBACK_CC" = "x"; then
   AC_MSG_RESULT(no)
 else
@@ -8151,7 +8151,7 @@ echo
 
 #############################################################################
 
-export LDFLAGS CFLAGS CPPFLAGS LIBS
+export CC CPP LDFLAGS CFLAGS CPPFLAGS LIBS
 export prefix exec_prefix OTHERFLAGS
 export DEFINES INSTALL
 
-- 
GitLab