From: Emanuele Torre Date: Tue, 23 May 2023 09:59:59 +0000 (+0200) Subject: configure: fix build with arbitrary CC and LD_LIBRARY_PATH X-Git-Tag: curl-8_1_2~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c4a019603b82a08c3572591a9393df0818ee02f6;p=thirdparty%2Fcurl.git configure: fix build with arbitrary CC and LD_LIBRARY_PATH Since ./configure and processes that inherit its environment variables are the only callers of the run-compiler script, we can just save the current value of the LD_LIBRARY_PATH and CC variables to another pair of environment variables, and make run-compiler a static script that simply restores CC and LD_LIBRARY_PATH to the saved value, and before running the compiler. This avoids having to inject the values of the variables in the script, possibly causing problems if they contains spaces, quotes, and other special characters. Also add exports in the script just in case LD_LIBRARY_PATH and CC are not already in the environment. follow-up from 471dab2 Closes #11182 --- diff --git a/configure.ac b/configure.ac index 17dd05a94c..0f316d0bb8 100644 --- a/configure.ac +++ b/configure.ac @@ -193,9 +193,13 @@ dnl something different but only have that affect the execution of the results dnl of the compile, not change the libraries for the compiler itself. dnl compilersh="run-compiler" -echo "CC=\"$CC\"" > $compilersh -echo "LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH\"" >> $compilersh -echo 'exec $CC $@' >> $compilersh +export "CURL_SAVED_CC=$CC" +export "CURL_SAVED_LD_LIBRARY_PATH=$LD_LIBRARY_PATH" +cat <<\EOF > "$compilersh" +export "CC=$CURL_SAVED_CC" +export "LD_LIBRARY_PATH=$CURL_SAVED_LD_LIBRARY_PATH" +exec $CC "$@" +EOF dnl ********************************************************************** dnl See which TLS backend(s) that are requested. Just do all the