Skip to content

Commit 9eadab4

Browse files
krajmadler
authored andcommitted
Pass LDFLAGS to link tests in configure.
LDFLAGS may contain critical flags without which linking won't succeed. Ensure that all configure tests involving link-time checks use LDFLAGS along with CFLAGS so that the tests perform correctly. Without this some tests may fail, resulting in incorrect configure results.
1 parent d380a71 commit 9eadab4

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

configure

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ if test $shared -eq 1; then
495495
echo Checking for shared library support... | tee -a configure.log
496496
# we must test in two steps (cc then ld), required at least on SunOS 4.x
497497
if try $CC -c $SFLAGS $test.c &&
498-
try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then
498+
try $LDSHARED $SFLAGS $LDFLAGS -o $test$shared_ext $test.o; then
499499
echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log
500500
elif test -z "$old_cc" -a -z "$old_cflags"; then
501501
echo No shared library support. | tee -a configure.log
@@ -557,7 +557,7 @@ int main(void) {
557557
}
558558
EOF
559559
fi
560-
if try $CC $CFLAGS -o $test $test.c; then
560+
if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
561561
sizet=`./$test`
562562
echo "Checking for a pointer-size integer type..." $sizet"." | tee -a configure.log
563563
CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}"
@@ -591,7 +591,7 @@ int main(void) {
591591
return 0;
592592
}
593593
EOF
594-
if try $CC $CFLAGS -o $test $test.c; then
594+
if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
595595
echo "Checking for fseeko... Yes." | tee -a configure.log
596596
else
597597
CFLAGS="${CFLAGS} -DNO_FSEEKO"
@@ -608,7 +608,7 @@ cat > $test.c <<EOF
608608
#include <errno.h>
609609
int main() { return strlen(strerror(errno)); }
610610
EOF
611-
if try $CC $CFLAGS -o $test $test.c; then
611+
if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
612612
echo "Checking for strerror... Yes." | tee -a configure.log
613613
else
614614
CFLAGS="${CFLAGS} -DNO_STRERROR"
@@ -714,7 +714,7 @@ int main()
714714
return (mytest("Hello%d\n", 1));
715715
}
716716
EOF
717-
if try $CC $CFLAGS -o $test $test.c; then
717+
if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
718718
echo "Checking for vsnprintf() in stdio.h... Yes." | tee -a configure.log
719719

720720
echo >> configure.log
@@ -807,7 +807,7 @@ int main()
807807
}
808808
EOF
809809

810-
if try $CC $CFLAGS -o $test $test.c; then
810+
if try $CC $CFLAGS $LDFLAGS -o $test $test.c; then
811811
echo "Checking for snprintf() in stdio.h... Yes." | tee -a configure.log
812812

813813
echo >> configure.log

0 commit comments

Comments
 (0)