1Upstream-Status: Submitted [https://github.com/madler/zlib/pull/599] 2Signed-off-by: Ross Burton <ross.burton@arm.com> 3 4From ea77f1f003a4d18b23cca703f3c824942863a1b4 Mon Sep 17 00:00:00 2001 5From: Khem Raj <raj.khem@gmail.com> 6Date: Tue, 8 Mar 2022 22:38:47 -0800 7Subject: [PATCH] configure: Pass LDFLAGS to link tests 8 9LDFLAGS can contain critical flags without which linking wont succeed 10therefore ensure that all configure tests involving link time checks are 11using LDFLAGS on compiler commandline along with CFLAGS to ensure the 12tests perform correctly. Without this some tests may fail resulting in 13wrong confgure result, ending in miscompiling the package 14 15Signed-off-by: Khem Raj <raj.khem@gmail.com> 16 17--- 18 configure | 12 ++++++------ 19 1 file changed, 6 insertions(+), 6 deletions(-) 20 21diff --git a/configure b/configure 22index c55098a..a7c6d72 100755 23--- a/configure 24+++ b/configure 25@@ -443,7 +443,7 @@ if test $shared -eq 1; then 26 echo Checking for shared library support... | tee -a configure.log 27 # we must test in two steps (cc then ld), required at least on SunOS 4.x 28 if try $CC -c $SFLAGS $test.c && 29- try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then 30+ try $LDSHARED $SFLAGS $LDFLAGS -o $test$shared_ext $test.o; then 31 echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log 32 elif test -z "$old_cc" -a -z "$old_cflags"; then 33 echo No shared library support. | tee -a configure.log 34@@ -505,7 +505,7 @@ int main(void) { 35 } 36 EOF 37 fi 38- if try $CC $CFLAGS -o $test $test.c; then 39+ if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then 40 sizet=`./$test` 41 echo "Checking for a pointer-size integer type..." $sizet"." | tee -a configure.log 42 CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}" 43@@ -539,7 +539,7 @@ int main(void) { 44 return 0; 45 } 46 EOF 47- if try $CC $CFLAGS -o $test $test.c; then 48+ if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then 49 echo "Checking for fseeko... Yes." | tee -a configure.log 50 else 51 CFLAGS="${CFLAGS} -DNO_FSEEKO" 52@@ -556,7 +556,7 @@ cat > $test.c <<EOF 53 #include <errno.h> 54 int main() { return strlen(strerror(errno)); } 55 EOF 56-if try $CC $CFLAGS -o $test $test.c; then 57+if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then 58 echo "Checking for strerror... Yes." | tee -a configure.log 59 else 60 CFLAGS="${CFLAGS} -DNO_STRERROR" 61@@ -663,7 +663,7 @@ int main() 62 return (mytest("Hello%d\n", 1)); 63 } 64 EOF 65- if try $CC $CFLAGS -o $test $test.c; then 66+ if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then 67 echo "Checking for vsnprintf() in stdio.h... Yes." | tee -a configure.log 68 69 echo >> configure.log 70@@ -753,7 +753,7 @@ int main() 71 } 72 EOF 73 74- if try $CC $CFLAGS -o $test $test.c; then 75+ if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then 76 echo "Checking for snprintf() in stdio.h... Yes." | tee -a configure.log 77 78 echo >> configure.log 79