blob: 716766de294ad2913e9b33886ce95e9abd652c98 [file] [log] [blame]
Andrew Geissler9aee5002022-03-30 16:27:02 +00001From da29ba6a27d8e78562052c79061476848915eb2a Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 9 Mar 2022 12:13:28 -0800
4Subject: [PATCH] configure: Pass LDFLAGS to tests doing link step
5
6Ensures that right flags from recipes are honored, otherwise tests fail
7which otherwise should not.
8
9Upstream-Status: Pending
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 unix/configure | 28 ++++++++++++++--------------
13 1 file changed, 14 insertions(+), 14 deletions(-)
14
15diff --git a/unix/configure b/unix/configure
16index d4b0a8e..49579f3 100755
17--- a/unix/configure
18+++ b/unix/configure
19@@ -116,7 +116,7 @@ _EOF_
20 # Special Mac OS X shared library "ld" option?
21 if test ` uname -s 2> /dev/null ` = 'Darwin'; then
22 lf='-Wl,-search_paths_first'
23- $CC $CFLAGS $lf conftest.c > /dev/null 2>/dev/null
24+ $CC $CFLAGS $LDFLAGS $lf conftest.c > /dev/null 2>/dev/null
25 if test $? -eq 0; then
26 BZLF=${lf}
27 fi
28@@ -276,7 +276,7 @@ int main()
29 }
30 _EOF_
31 # compile it
32-$CC -o conftest conftest.c >/dev/null 2>/dev/null
33+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
34 if [ $? -ne 0 ]; then
35 echo -- no Large File Support
36 else
37@@ -322,7 +322,7 @@ int main()
38 }
39 _EOF_
40 # compile it
41-$CC -o conftest conftest.c >/dev/null 2>/dev/null
42+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
43 if [ $? -ne 0 ]; then
44 echo "-- no Unicode (wchar_t) support"
45 else
46@@ -383,7 +383,7 @@ for func in fchmod fchown lchown nl_langinfo
47 do
48 echo Check for $func
49 echo "int main(){ $func(); return 0; }" > conftest.c
50- $CC $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null
51+ $CC $BFLAG $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
52 [ $? -ne 0 ] && CFLAGSR="${CFLAGSR} -DNO_`echo $func | tr '[a-z]' '[A-Z]'`"
53 done
54
55@@ -395,14 +395,14 @@ temp_link="link_$$"
56 echo "int main() { lchmod(\"${temp_file}\", 0666); }" \
57 ) > conftest.c
58 ln -s "${temp_link}" "${temp_file}" && \
59- $CC $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null && \
60+ $CC $BFLAG $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null && \
61 ./conftest
62 [ $? -ne 0 ] && CFLAGSR="${CFLAGSR} -DNO_LCHMOD"
63 rm -f "${temp_file}"
64
65 echo Check for memset
66 echo "int main(){ char k; memset(&k,0,0); return 0; }" > conftest.c
67-$CC -o conftest conftest.c >/dev/null 2>/dev/null
68+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
69 [ $? -ne 0 ] && CFLAGSR="${CFLAGSR} -DZMEM"
70
71 echo Check for errno declaration
72@@ -422,12 +422,12 @@ cat > conftest.c << _EOF_
73 int main() { return closedir(opendir(".")); }
74 _EOF_
75
76-$CC -o conftest conftest.c >/dev/null 2>/dev/null
77+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
78 if [ $? -ne 0 ]; then
79 OPT=""
80 for lib in ndir dir ucb bsd BSD PW x dirent
81 do
82- $CC -o conftest conftest.c -l$lib >/dev/null 2>/dev/null
83+ $CC $CLFAGS $LDFLAGS -o conftest conftest.c -l$lib >/dev/null 2>/dev/null
84 [ $? -eq 0 ] && OPT=-l$lib && break
85 done
86 if [ ${OPT} ]; then
87@@ -440,9 +440,9 @@ fi
88 # Dynix/ptx 1.3 needed this
89 echo Check for readlink
90 echo "int main(){ return readlink(); }" > conftest.c
91-$CC -o conftest conftest.c >/dev/null 2>/dev/null
92+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
93 if [ $? -ne 0 ]; then
94- $CC -o conftest conftest.c -lseq >/dev/null 2>/dev/null
95+ $CC $CFLAGS $LDFLAGS -o conftest conftest.c -lseq >/dev/null 2>/dev/null
96 [ $? -eq 0 ] && LFLAGS2="${LFLAGS2} -lseq"
97 fi
98
99@@ -501,7 +501,7 @@ int main()
100 }
101 _EOF_
102 # compile it
103-$CC ${CFLAGS} ${CFLAGSR} -o conftest conftest.c >/dev/null 2>/dev/null
104+$CC ${CFLAGS} ${CFLAGSR} $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
105 if [ $? -ne 0 ]; then
106 echo "-- no MBCS support"
107 CFLAGSR="${CFLAGSR} -DNO_MBCS"
108@@ -515,7 +515,7 @@ else
109 do
110 echo Check for MBCS $func
111 echo "int main() { $func(); return 0; }" > conftest.c
112- $CC $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null
113+ $CC $BFLAG $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
114 [ $? -eq 0 ] && CFLAGSR="${CFLAGSR} -D`echo $func | tr '[a-z]' '[A-Z]'`=$func"
115 done
116 fi
117@@ -557,7 +557,7 @@ elif [ -f /xenix ]; then
118 elif uname -X >/dev/null 2>/dev/null; then
119 # SCO shared library check
120 echo "int main() { return 0;}" > conftest.c
121- $CC -o conftest conftest.c -lc_s -nointl >/dev/null 2> /dev/null
122+ $CC $CFLAGS $LDFLAGS -o conftest conftest.c -lc_s -nointl >/dev/null 2> /dev/null
123 [ $? -eq 0 ] && LFLAGS2="-lc_s -nointl"
124 else
125 SYSTEM=`uname -s 2>/dev/null` || SYSTEM="unknown"
126@@ -565,7 +565,7 @@ else
127 case $SYSTEM in
128 OSF1|ULTRIX)
129 echo Check for -Olimit option
130- $CC ${CFLAGS} -Olimit 1000 -o conftest conftest.c >/dev/null 2>/dev/null
131+ $CC ${CFLAGS} ${LDFLAGS} -Olimit 1000 -o conftest conftest.c >/dev/null 2>/dev/null
132 [ $? -eq 0 ] && CFLAGSR="${CFLAGSR} -Olimit 1000"
133 ;;
134 ### HP-UX)
135--
1362.35.1
137