blob: e6cc915ba5bcbbf6da1a192de32b8f536dd38162 [file] [log] [blame]
Patrick Williams03907ee2022-05-01 06:28:52 -05001Upstream-Status: Submitted [https://github.com/madler/zlib/pull/599]
2Signed-off-by: Ross Burton <ross.burton@arm.com>
3
4From f15584918a7fbbe3cc794ad59100e5e8153ea9f6 Mon Sep 17 00:00:00 2001
Andrew Geissler9aee5002022-03-30 16:27:02 +00005From: 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
Andrew Geissler9aee5002022-03-30 16:27:02 +000015Signed-off-by: Khem Raj <raj.khem@gmail.com>
16---
17 configure | 12 ++++++------
18 1 file changed, 6 insertions(+), 6 deletions(-)
19
20diff --git a/configure b/configure
Patrick Williams03907ee2022-05-01 06:28:52 -050021index 52ff4a0..d04ee59 100755
Andrew Geissler9aee5002022-03-30 16:27:02 +000022--- a/configure
23+++ b/configure
Patrick Williams03907ee2022-05-01 06:28:52 -050024@@ -427,7 +427,7 @@ if test $shared -eq 1; then
Andrew Geissler9aee5002022-03-30 16:27:02 +000025 echo Checking for shared library support... | tee -a configure.log
26 # we must test in two steps (cc then ld), required at least on SunOS 4.x
27 if try $CC -w -c $SFLAGS $test.c &&
28- try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then
29+ try $LDSHARED $SFLAGS $LDFLAGS -o $test$shared_ext $test.o; then
30 echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log
31 elif test -z "$old_cc" -a -z "$old_cflags"; then
32 echo No shared library support. | tee -a configure.log
Patrick Williams03907ee2022-05-01 06:28:52 -050033@@ -503,7 +503,7 @@ int main(void) {
Andrew Geissler9aee5002022-03-30 16:27:02 +000034 }
35 EOF
36 fi
37- if try $CC $CFLAGS -o $test $test.c; then
38+ if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
39 sizet=`./$test`
40 echo "Checking for a pointer-size integer type..." $sizet"." | tee -a configure.log
Patrick Williams03907ee2022-05-01 06:28:52 -050041 CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}"
42@@ -537,7 +537,7 @@ int main(void) {
Andrew Geissler9aee5002022-03-30 16:27:02 +000043 return 0;
44 }
45 EOF
46- if try $CC $CFLAGS -o $test $test.c; then
47+ if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
48 echo "Checking for fseeko... Yes." | tee -a configure.log
49 else
50 CFLAGS="${CFLAGS} -DNO_FSEEKO"
Patrick Williams03907ee2022-05-01 06:28:52 -050051@@ -554,7 +554,7 @@ cat > $test.c <<EOF
Andrew Geissler9aee5002022-03-30 16:27:02 +000052 #include <errno.h>
53 int main() { return strlen(strerror(errno)); }
54 EOF
55-if try $CC $CFLAGS -o $test $test.c; then
56+if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
57 echo "Checking for strerror... Yes." | tee -a configure.log
58 else
59 CFLAGS="${CFLAGS} -DNO_STRERROR"
Patrick Williams03907ee2022-05-01 06:28:52 -050060@@ -661,7 +661,7 @@ int main()
Andrew Geissler9aee5002022-03-30 16:27:02 +000061 return (mytest("Hello%d\n", 1));
62 }
63 EOF
64- if try $CC $CFLAGS -o $test $test.c; then
65+ if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
66 echo "Checking for vsnprintf() in stdio.h... Yes." | tee -a configure.log
67
68 echo >> configure.log
Patrick Williams03907ee2022-05-01 06:28:52 -050069@@ -751,7 +751,7 @@ int main()
Andrew Geissler9aee5002022-03-30 16:27:02 +000070 }
71 EOF
72
73- if try $CC $CFLAGS -o $test $test.c; then
74+ if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
75 echo "Checking for snprintf() in stdio.h... Yes." | tee -a configure.log
76
77 echo >> configure.log
78--
Patrick Williams03907ee2022-05-01 06:28:52 -0500792.25.1
Andrew Geissler9aee5002022-03-30 16:27:02 +000080