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