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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
|
--- zip-2.31/unix/configure.lhh 2005-11-10 13:25:26.000000000 +0100
+++ zip-2.31/unix/configure 2005-11-10 13:40:44.311641648 +0100
@@ -76,14 +76,20 @@
done
fi
-echo Check for prototypes
+echo -n Check for prototypes...
echo "int main(int argc, char *argv[]) { return 0; }" > conftest.c
$CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
-[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_PROTO"
+if [ $? -ne 0 ]; then
+ echo no
+ CFLAGS="${CFLAGS} -DNO_PROTO"
+else
+ echo yes
+fi
+
# const check currently handles mips cc and non ANSI compilers.
# does it need more ?
-echo Check the handling of const
+echo -n Check the handling of const...
cat > conftest.c << _EOF_
typedef int charset[2];
int main()
@@ -94,9 +100,15 @@
}
_EOF_
$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
-[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_CONST"
+if [ $? -ne 0 ]; then
+ echo no
+ CFLAGS="${CFLAGS} -DNO_CONST"
+else
+ echo yes
+fi
+
-echo Check for time_t
+echo -n Check for time_t...
cat > conftest.c << _EOF_
#include <sys/types.h>
#include <time.h>
@@ -107,9 +119,15 @@
}
_EOF_
$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
-[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_TIME_T"
+if [ $? -ne 0 ]; then
+ echo no
+ CFLAGS="${CFLAGS} -DNO_TIME_T"
+else
+ echo yes
+fi
+
-echo Check for size_t
+echo -n Check for size_t...
cat > conftest.c << _EOF_
#include <sys/types.h>
int main()
@@ -119,7 +137,13 @@
}
_EOF_
$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
-[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_SIZE_T"
+if [ $? -ne 0 ]; then
+ echo no
+ CFLAGS="${CFLAGS} -DNO_SIZE_T"
+else
+ echo yes
+fi
+
echo Check for gcc no-builtin flag
# -fno-builtin since version 2
@@ -140,18 +164,29 @@
# add NO_'function_name' to flags if missing
for func in rmdir strchr strrchr rename mktemp mktime mkstemp
do
- echo Check for $func
- echo "int main(){ $func(); return 0; }" > conftest.c
+ echo -n Check for $func...
+ echo "char $func(void); int main(){ $func(); return 0; }" > conftest.c
$CC $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null
- [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_`echo $func | tr '[a-z]' '[A-Z]'`"
+ if [ $? -ne 0 ]; then
+ echo no
+ CFLAGS="${CFLAGS} -DNO_`echo $func | tr '[a-z]' '[A-Z]'`"
+ else
+ echo yes
+ fi
done
-echo Check for memset
+echo -n 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
-[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DZMEM"
+if [ $? -ne 0 ]; then
+ echo no
+ CFLAGS="${CFLAGS} -DZMEM"
+else
+ echo yes
+fi
+
-echo Check for errno declaration
+echo -n Check for errno declaration...
cat > conftest.c << _EOF_
#include <errno.h>
main()
@@ -161,9 +196,14 @@
}
_EOF_
$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
-[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_ERRNO"
+if [ $? -ne 0 ]; then
+ echo no
+ CFLAGS="${CFLAGS} -DNO_ERRNO"
+else
+ echo yes
+fi
-echo Check for directory libraries
+echo -n Check for directory libraries...
cat > conftest.c << _EOF_
int main() { return closedir(opendir(".")); }
_EOF_
@@ -178,21 +218,30 @@
done
if [ ${OPT} ]; then
LFLAGS2="${LFLAGS2} ${OPT}"
+ echo yes, ${OPT}
else
CFLAGS="${CFLAGS} -DNO_DIR"
+ echo no
fi
fi
# Dynix/ptx 1.3 needed this
-echo Check for readlink
+echo -n Check for readlink...
echo "int main(){ return readlink(); }" > conftest.c
$CC -o conftest conftest.c >/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
$CC -o conftest conftest.c -lseq >/dev/null 2>/dev/null
- [ $? -eq 0 ] && LFLAGS2="${LFLAGS2} -lseq"
+ if [ $? -eq 0 ]; then
+ LFLAGS2="${LFLAGS2} -lseq"
+ echo yes, -lseq
+ else
+ echo no
+ fi
+else
+ echo yes
fi
-echo Check for directory include file
+echo -n Check for directory include file...
OPT=""
for inc in dirent.h sys/ndir.h ndir.h sys/dir.h
do
@@ -200,17 +249,19 @@
$CPP conftest.c > /dev/null 2>/dev/null
[ $? -eq 0 ] && OPT="-DHAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`" && break
done
+echo "${OPT}"
CFLAGS="${CFLAGS} ${OPT}"
-echo Check for non existent include files
+echo -n Check for non existent include files...
for inc in stdlib.h stddef.h unistd.h fcntl.h string.h
do
echo "#include <$inc>" > conftest.c
$CPP conftest.c >/dev/null 2>/dev/null
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_`echo $inc | tr '[a-z]./' '[A-Z]__'`"
done
+echo ok
-echo Check for terminal I/O include file
+echo -n Check for terminal I/O include file...
OPT=""
for inc in termios.h termio.h sgtty.h
do
@@ -219,9 +270,10 @@
[ $? -eq 0 ] && OPT="-DHAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`" && break
done
CFLAGS="${CFLAGS} ${OPT}"
+echo $OPT
# needed for AIX (and others ?) when mmap is used
-echo Check for valloc
+echo -n Check for valloc...
cat > conftest.c << _EOF_
main()
{
@@ -231,7 +283,13 @@
}
_EOF_
$CC ${CFLAGS} conftest.c > /dev/null 2>/dev/null
-[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_VALLOC"
+if [ $? -ne 0 ]; then
+ echo no
+ CFLAGS="${CFLAGS} -DNO_VALLOC"
+else
+ echo yes
+fi
+
echo Check for 64bit fseek
for func in fseeko fseek64
|