Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame^] | 1 | Upstream-Status: Submitted [https://github.com/madler/zlib/pull/599] |
| 2 | Signed-off-by: Ross Burton <ross.burton@arm.com> |
| 3 | |
| 4 | From f15584918a7fbbe3cc794ad59100e5e8153ea9f6 Mon Sep 17 00:00:00 2001 |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 5 | From: Khem Raj <raj.khem@gmail.com> |
| 6 | Date: Tue, 8 Mar 2022 22:38:47 -0800 |
| 7 | Subject: [PATCH] configure: Pass LDFLAGS to link tests |
| 8 | |
| 9 | LDFLAGS can contain critical flags without which linking wont succeed |
| 10 | therefore ensure that all configure tests involving link time checks are |
| 11 | using LDFLAGS on compiler commandline along with CFLAGS to ensure the |
| 12 | tests perform correctly. Without this some tests may fail resulting in |
| 13 | wrong confgure result, ending in miscompiling the package |
| 14 | |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 15 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 16 | --- |
| 17 | configure | 12 ++++++------ |
| 18 | 1 file changed, 6 insertions(+), 6 deletions(-) |
| 19 | |
| 20 | diff --git a/configure b/configure |
Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame^] | 21 | index 52ff4a0..d04ee59 100755 |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 22 | --- a/configure |
| 23 | +++ b/configure |
Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame^] | 24 | @@ -427,7 +427,7 @@ if test $shared -eq 1; then |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 25 | 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 Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame^] | 33 | @@ -503,7 +503,7 @@ int main(void) { |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 34 | } |
| 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 Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame^] | 41 | CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}" |
| 42 | @@ -537,7 +537,7 @@ int main(void) { |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 43 | 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 Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame^] | 51 | @@ -554,7 +554,7 @@ cat > $test.c <<EOF |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 52 | #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 Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame^] | 60 | @@ -661,7 +661,7 @@ int main() |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 61 | 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 Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame^] | 69 | @@ -751,7 +751,7 @@ int main() |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 70 | } |
| 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 Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame^] | 79 | 2.25.1 |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 80 | |