blob: 475a653f287dbdfae86b4ba9ab3dfee36dd5ea80 [file] [log] [blame]
Andrew Geissler9aee5002022-03-30 16:27:02 +00001From ab5df4826c4a532da78828b72a2751c899e27ef2 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 8 Mar 2022 22:31:21 -0800
4Subject: [PATCH] configure: Use CFLAGS and LDFLAGS when doing link tests
5
6Some case link flags contain important flags which are required during
7linking, link fails otherwise without them, which can result in
8configure detection go wrong, ensure these flags are used along with CC
9when tests involve linking
10
11Upstream-Status: Pending
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 unix/configure | 16 ++++++++--------
15 1 file changed, 8 insertions(+), 8 deletions(-)
16
17diff --git a/unix/configure b/unix/configure
18index 1bc698b..1d9a9bb 100644
19--- a/unix/configure
20+++ b/unix/configure
21@@ -517,14 +517,14 @@ for func in rmdir strchr strrchr rename mktemp mktime mkstemp
22 do
23 echo Check for $func
24 echo "int main(){ $func(); return 0; }" > conftest.c
25- $CC $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null
26+ $CC $CFLAGS $LDFLAGS $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null
27 [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_`echo $func | tr '[a-z]' '[A-Z]'`"
28 done
29
30
31 echo Check for memset
32 echo "int main(){ char k; memset(&k,0,0); return 0; }" > conftest.c
33-$CC -o conftest conftest.c >/dev/null 2>/dev/null
34+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
35 [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DZMEM"
36
37
38@@ -533,7 +533,7 @@ cat > conftest.c << _EOF_
39 #include <string.h>
40 int main() { int a; int b = 0; memmove( &a, &b, sizeof( a)); return a; }
41 _EOF_
42-$CC -o conftest conftest.c >/dev/null 2>/dev/null
43+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
44 [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNEED_MEMMOVE"
45
46
47@@ -542,7 +542,7 @@ cat > conftest.c << _EOF_
48 #include <string.h>
49 int main() { strerror( 0); return 0; }
50 _EOF_
51-$CC -o conftest conftest.c >/dev/null 2>/dev/null
52+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
53 [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNEED_STRERROR"
54
55 echo Check for errno declaration
56@@ -563,7 +563,7 @@ cat > conftest.c << _EOF_
57 int main() { return closedir(opendir(".")); }
58 _EOF_
59
60-$CC -o conftest conftest.c >/dev/null 2>/dev/null
61+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
62 if [ $? -ne 0 ]; then
63 OPT=""
64 for lib in ndir dir ucb bsd BSD PW x dirent
65@@ -583,9 +583,9 @@ fi
66
67 echo Check for readlink
68 echo "int main(){ return readlink(); }" > conftest.c
69-$CC -o conftest conftest.c >/dev/null 2>/dev/null
70+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
71 if [ $? -ne 0 ]; then
72- $CC -o conftest conftest.c -lseq >/dev/null 2>/dev/null
73+ $CC $CFLAGS $LDFLAGS -o conftest conftest.c -lseq >/dev/null 2>/dev/null
74 [ $? -eq 0 ] && LFLAGS2="${LFLAGS2} -lseq"
75 fi
76
77@@ -661,7 +661,7 @@ elif [ -f /xenix ]; then
78 elif uname -X >/dev/null 2>/dev/null; then
79 # SCO shared library check
80 echo "int main() { return 0;}" > conftest.c
81- $CC -o conftest conftest.c -lc_s -nointl >/dev/null 2> /dev/null
82+ $CC $CFLAGS $LDFLAGS -o conftest conftest.c -lc_s -nointl >/dev/null 2> /dev/null
83 [ $? -eq 0 ] && LFLAGS2="-lc_s -nointl"
84 else
85 SYSTEM=`uname -s 2>/dev/null` || SYSTEM="unknown"
86--
872.35.1
88