]>
Commit | Line | Data |
---|---|---|
7eda085c KZ |
1 | #!/bin/sh |
2 | # Configure script for util-linux - aeb, 990205 | |
3 | # | |
4 | # We need to find out the following things: | |
5 | # | |
e8f26419 KZ |
6 | # Version of gcc |
7 | # | |
66ee8158 KZ |
8 | # Existence of header files: |
9 | # H1. For fdisksunlabel.c: is there a <scsi/scsi.h>? | |
10 | # H2. For fdisk.c: is there a <linux/blkpg.h>? | |
11 | # H3. For kbd_rate.c: does <linux/kd.h> exist? | |
12 | # H4. For nls.h: do we have <locale.h>? | |
13 | # H5. For cal.c: do we have <langinfo.h>? | |
c07ebfa1 | 14 | # H6. For mkswap.c: do we have <sys/user.h> or <asm/page.h>? |
756bfd01 | 15 | # H6a For mkswap.c: do we have <uuid/uuid.h>? |
1d4ad1de KZ |
16 | # H7. For nfsmount.c: do we have <rpcsvc/nfs_prot.h>? |
17 | # H8. For nfsmount.h (nfsmount_xdr.c: int32_t): do we have <asm/types.h>? | |
18 | # H9. For raw.c: do we have <linux/raw.h>? | |
d03dd608 | 19 | # H10. For md5.c: do we have <stdint.h>? |
0b0bb920 | 20 | # H11. For cmos.c: do we have <sys/io.h>? |
66ee8158 KZ |
21 | # |
22 | # Existence of functions: | |
23 | # F1. For nfsmount.c: is inet_aton() available? | |
24 | # F2. For mkswap.c: is fsync() available? | |
25 | # F3. For agetty.c: is getdomainname() available? | |
26 | # F4. For hwclock/kd.c: do we have nanosleep()? | |
27 | # F5. For mkswap.c: do we have personality()? | |
c07ebfa1 | 28 | # F6. For agetty.c: is updwtmp() available? |
63cccae4 KZ |
29 | # F7. For pg.c: are fseeko() and ftello() available? |
30 | # F8. For fsck.cramfs.c: is lchown() available? | |
df1dddf9 | 31 | # F9. For cfdisk.c: is rpmatch() available? |
66ee8158 | 32 | # |
0b0bb920 | 33 | # 1. Deleted. |
66ee8158 KZ |
34 | # 2. For cfdisk, setterm, more, ul: do we have ncurses? How installed? |
35 | # 3. For more: do we have libtermcap? | |
36 | # 4. For chfn, chsh, login, newgrp, passwd: do we need -lcrypt? | |
37 | # 5. For sln: does static compilation work? | |
38 | # 6. For lib/nls.h: do we have <libintl.h> and gettext()? | |
39 | # 7. For xgettext: does it take the option --foreign-user? | |
40 | # 8. For err.c: do we have __progname? | |
41 | # 9. For script.c: do we have <pty.h> and openpty()? | |
42 | # 10. For lib/widechar.h: do we have wide character support? | |
d03dd608 | 43 | # 11. For pivot_root.c: does <sys/syscall.h> define SYS_pivot_root? |
66ee8158 KZ |
44 | # 12. For hwclock.c: does struct tm have a field tm_gmtoff? |
45 | # 13. For nfsmount: does the output of rpcgen compile? | |
f0c8eda1 | 46 | # 14. For fsck.cramfs, mkfs.cramfs: do we have libz? |
c129767e | 47 | # 15. For mount, do we have blkid? |
eb63b9b8 KZ |
48 | |
49 | rm -f make_include defines.h | |
50 | ||
51 | VERSION=`cat VERSION` | |
52 | echo | |
53 | echo configuring util-linux-$VERSION | |
54 | echo | |
55 | echo "VERSION=$VERSION" > make_include | |
56 | echo '#define UTIL_LINUX_VERSION "'$VERSION'"' > defines.h | |
57 | echo '#define util_linux_version "util-linux-'$VERSION'"' >> defines.h | |
58 | echo >> defines.h | |
7eda085c | 59 | |
7eda085c | 60 | CC=${CC-cc} |
df1dddf9 | 61 | CFLAGS=${CFLAGS-"-O2"} |
66ee8158 KZ |
62 | LDFLAGS=${LDFLAGS-"-s"} |
63 | echo CC=$CC >> make_include | |
64 | echo CFLAGS=$CFLAGS >> make_include | |
65 | echo LDFLAGS=$LDFLAGS >> make_include | |
66 | ||
7eda085c KZ |
67 | DEFS= |
68 | LIBS= | |
69 | compile='$CC $CFLAGS $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1' | |
63cccae4 | 70 | compile_with_warnings='$CC $CFLAGS $DEFS conftest.c -o conftest $LIBS 2>&1' |
7eda085c | 71 | static_compile='$CC -static $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1' |
eb63b9b8 KZ |
72 | eval COMPILE='"'$compile'"' |
73 | export COMPILE | |
7eda085c | 74 | |
eb63b9b8 | 75 | rm -f conftest.c conftest |
7eda085c | 76 | |
e8f26419 | 77 | # |
b22550fa KZ |
78 | # Old gcc (e.g. 2.5.8 and 2.7.2.3) wants options like -m486, and these |
79 | # are still accepted by 2.95.3 and RedHat's 2.96, but gcc 3.0 says: | |
80 | # `-m486' is deprecated. Use `-march=i486' or `-mcpu=i486' instead. | |
81 | # | |
82 | # Later gcc (e.g. 2.95.3 and 3.3.4) wants options like -mcpu=i486 | |
83 | # and has never heard about -mtune=i486. | |
84 | # | |
85 | # I am told that gcc >= 3.4.0 wants options like -mtune=i486 | |
86 | # -mtune gives the CPU to optimize for | |
87 | # -march gives the architecture | |
88 | # | |
89 | # Various versions of gcc react to unknown options with strings | |
90 | # containing "Invalid option" or "invalid option". | |
e8f26419 KZ |
91 | # |
92 | echo " | |
63cccae4 | 93 | int main(){ exit(0); } |
e8f26419 | 94 | " > conftest.c |
b22550fa | 95 | gccout=`$CC $CFLAGS -mtune=i486 conftest.c -o conftest 2>&1 | grep "nvalid"` |
e8f26419 | 96 | if test -z "$gccout"; then |
b22550fa KZ |
97 | echo "HAVE_NEW_GCC=yes" >> make_include |
98 | else | |
99 | gccout=`$CC $CFLAGS -m386 conftest.c -o conftest 2>&1 | grep "march="` | |
100 | if test -z "$gccout"; then | |
101 | echo "HAVE_OLD_GCC=yes" >> make_include | |
102 | fi | |
e8f26419 KZ |
103 | fi |
104 | rm -f conftest conftest.c | |
66ee8158 KZ |
105 | |
106 | # | |
107 | # Find out about the existence of header files | |
108 | # | |
109 | ||
7eda085c | 110 | # |
66ee8158 KZ |
111 | # H1. For fdisk/fdisksunlabel.c: is <scsi/scsi.h> available? |
112 | # Some kernels have <scsi/scsi.h> that uses u_char | |
113 | # But maybe there is already a typedef. Let us use a #define | |
114 | # | |
115 | echo " | |
116 | #define u_char unsigned char | |
117 | #include <scsi/scsi.h> | |
118 | #undef u_char | |
63cccae4 | 119 | int main(){ exit(0); } |
66ee8158 KZ |
120 | " > conftest.c |
121 | eval $compile | |
63cccae4 | 122 | if test -s conftest; then |
66ee8158 KZ |
123 | echo "#define HAVE_scsi_h" >> defines.h |
124 | echo "You have <scsi/scsi.h>" | |
125 | else | |
126 | echo "You don't have <scsi/scsi.h>" | |
127 | fi | |
128 | rm -f conftest conftest.c | |
129 | ||
130 | # | |
131 | # H2. For fdisk/fdisk.c: is <linux/blkpg.h> available? | |
132 | # | |
133 | if ./testincl "linux/blkpg.h"; then | |
134 | echo "#define HAVE_blkpg_h" >> defines.h | |
135 | fi | |
136 | ||
137 | # | |
138 | # H3. Does <linux/kd.h> exist? | |
139 | # | |
140 | if ./testincl "linux/kd.h"; then | |
141 | echo "#define HAVE_kd_h" >> defines.h | |
142 | fi | |
143 | ||
144 | # | |
145 | # H4. For lib/nls.h: do we have <locale.h>? | |
146 | # | |
147 | if ./testincl "locale.h"; then | |
148 | echo "#define HAVE_locale_h" >> defines.h | |
149 | fi | |
150 | ||
151 | # | |
152 | # H5. For cal.c: do we have <langinfo.h>? | |
153 | # | |
154 | if ./testincl "langinfo.h"; then | |
155 | echo "#define HAVE_langinfo_h" >> defines.h | |
156 | fi | |
157 | ||
158 | # | |
c07ebfa1 | 159 | # H6. For mkswap.c: do we have <sys/user.h> or <asm/page.h>? |
66ee8158 | 160 | # |
c07ebfa1 KZ |
161 | if ./testincl "sys/user.h"; then |
162 | echo "#define HAVE_sys_user_h" >> defines.h | |
163 | else if ./testincl "asm/page.h"; then | |
66ee8158 | 164 | echo "#define HAVE_asm_page_h" >> defines.h |
d162fcb5 | 165 | fi; fi |
66ee8158 | 166 | |
756bfd01 KZ |
167 | # |
168 | # H6a. For mkswap.c: do we have <uuid/uuid.h>? | |
169 | # | |
170 | if ./testincl "uuid/uuid.h"; then | |
171 | echo "#define HAVE_uuid_uuid_h" >> defines.h | |
172 | echo "HAVE_UUID=yes" >> make_include | |
173 | else | |
174 | echo "HAVE_UUID=no" >> make_include | |
175 | fi | |
176 | ||
66ee8158 | 177 | # |
1d4ad1de KZ |
178 | # H7. For nfsmount.c: do we have <rpcsvc/nfs_prot.h>? |
179 | # | |
180 | if ./testincl "rpcsvc/nfs_prot.h"; then | |
181 | echo "#define HAVE_rpcsvc_nfs_prot_h" >> defines.h | |
182 | fi | |
183 | ||
184 | # | |
185 | # H8. For nfsmount.h: do we have <asm/types.h>? | |
66ee8158 KZ |
186 | # |
187 | if ./testincl "asm/types.h"; then | |
188 | echo "#define HAVE_asm_types_h" >> defines.h | |
189 | fi | |
190 | ||
ffc43748 | 191 | # |
1d4ad1de | 192 | # H9. For raw.c: do we have <linux/raw.h>? |
ffc43748 KZ |
193 | # |
194 | if ./testincl "linux/raw.h"; then | |
195 | echo "HAVE_RAW_H=yes" >> make_include | |
196 | fi | |
197 | ||
d03dd608 KZ |
198 | # |
199 | # H10. For md5.c: do we have <stdint.h>? | |
200 | if ./testincl "stdint.h"; then | |
201 | echo "#define HAVE_stdint_h" >> defines.h | |
202 | fi | |
66ee8158 | 203 | |
0b0bb920 KZ |
204 | # |
205 | # H11. For cmos.c: do we have <sys/io.h>? | |
206 | if ./testincl "sys/io.h"; then | |
207 | echo "#define HAVE_sys_io_h" >> defines.h | |
208 | fi | |
209 | ||
66ee8158 KZ |
210 | # |
211 | # Find out about the existence of functions | |
212 | # | |
213 | ||
214 | # | |
215 | # F1. For mount/nfsmount.c: is inet_aton() available? | |
7eda085c KZ |
216 | # |
217 | echo " | |
218 | #include <sys/socket.h> | |
219 | #include <netinet/in.h> | |
220 | #include <arpa/inet.h> | |
63cccae4 | 221 | int main(int a, char **v){ |
7eda085c KZ |
222 | if (a == -1) /* false */ |
223 | inet_aton((const char *) 0, (struct in_addr *) 0); | |
224 | exit(0); | |
225 | } | |
226 | " > conftest.c | |
227 | eval $compile | |
63cccae4 | 228 | if test -s conftest; then |
7eda085c KZ |
229 | echo "#define HAVE_inet_aton" >> defines.h |
230 | echo "You have inet_aton()" | |
231 | else | |
232 | echo "You don't have inet_aton()" | |
233 | fi | |
234 | rm -f conftest conftest.c | |
235 | ||
236 | # | |
66ee8158 | 237 | # F2. For mkswap.c: is fsync() available? |
7eda085c KZ |
238 | # |
239 | echo " | |
66ee8158 | 240 | #include <unistd.h> |
63cccae4 | 241 | int main(int a, char **v){ |
66ee8158 KZ |
242 | if (a == -1) /* false */ |
243 | fsync(0); | |
244 | exit(0); | |
245 | } | |
7eda085c KZ |
246 | " > conftest.c |
247 | eval $compile | |
63cccae4 | 248 | if test -s conftest; then |
66ee8158 KZ |
249 | echo "#define HAVE_fsync" >> defines.h |
250 | echo "You have fsync()" | |
7eda085c | 251 | else |
66ee8158 | 252 | echo "You don't have fsync()" |
7eda085c KZ |
253 | fi |
254 | rm -f conftest conftest.c | |
255 | ||
256 | # | |
66ee8158 | 257 | # F3. For agetty.c: is getdomainname() available? |
7eda085c | 258 | # |
66ee8158 KZ |
259 | echo " |
260 | #include <unistd.h> | |
63cccae4 | 261 | int main(int a, char **v){ |
66ee8158 KZ |
262 | char buf[1]; |
263 | if (a == -1) /* false */ | |
264 | getdomainname(buf, sizeof buf); | |
265 | exit(0); | |
266 | } | |
267 | " > conftest.c | |
268 | eval $compile | |
63cccae4 | 269 | if test -s conftest; then |
66ee8158 KZ |
270 | echo "#define HAVE_getdomainname" >> defines.h |
271 | echo "You have getdomainname()" | |
272 | else | |
273 | echo "You don't have getdomainname()" | |
7eda085c | 274 | fi |
66ee8158 | 275 | rm -f conftest conftest.c |
7eda085c KZ |
276 | |
277 | # | |
66ee8158 KZ |
278 | # F4. For hwclock/kd.c: do we have nanosleep? |
279 | # | |
280 | echo " | |
281 | #include <time.h> | |
282 | int main () { | |
283 | struct timespec sleep = { 0, 1 }; | |
284 | nanosleep( &sleep, NULL ); | |
285 | exit(0); | |
286 | } | |
287 | " > conftest.c | |
288 | eval $compile | |
63cccae4 | 289 | if test -s conftest; then |
66ee8158 KZ |
290 | echo "#define HAVE_nanosleep" >> defines.h |
291 | echo "You have nanosleep()" | |
292 | else | |
293 | echo "You don't have nanosleep()" | |
294 | fi | |
295 | rm -f conftest conftest.c | |
296 | ||
297 | # | |
298 | # F5. For mkswap.c: do we have personality()? | |
299 | # | |
300 | echo " | |
301 | int main () { | |
302 | extern int personality(unsigned long); | |
303 | personality(0); | |
304 | exit(0); | |
305 | } | |
306 | " > conftest.c | |
307 | eval $compile | |
63cccae4 | 308 | if test -s conftest; then |
66ee8158 KZ |
309 | echo "#define HAVE_personality" >> defines.h |
310 | echo "You have personality()" | |
311 | else | |
312 | echo "You don't have personality()" | |
313 | fi | |
314 | rm -f conftest conftest.c | |
315 | ||
c07ebfa1 KZ |
316 | # |
317 | # F6. For agetty.c: is updwtmp() available? | |
318 | # | |
319 | echo ' | |
320 | #include <string.h> | |
321 | #include <utmp.h> | |
63cccae4 | 322 | int main(int a, char **v){ |
c07ebfa1 KZ |
323 | struct utmp ut; |
324 | memset (&ut, 0, sizeof(ut)); | |
325 | if (a == -1) /* false */ | |
326 | updwtmp("/nowhere/wtmp", &ut); | |
327 | exit(0); | |
328 | } | |
329 | ' > conftest.c | |
330 | eval $compile | |
63cccae4 | 331 | if test -s conftest; then |
c07ebfa1 KZ |
332 | echo "#define HAVE_updwtmp" >> defines.h |
333 | echo "You have updwtmp()" | |
334 | else | |
335 | echo "You don't have updwtmp()" | |
336 | fi | |
337 | rm -f conftest conftest.c | |
338 | ||
63cccae4 KZ |
339 | # |
340 | # F7. For pg.c: are fseeko() and ftello() available? | |
341 | # | |
342 | echo ' | |
343 | #include <stdio.h> | |
344 | int main(int a, char **v){ | |
345 | fseeko(stdout, 0, 0); | |
346 | ftello(stdout); | |
347 | exit(0); | |
348 | } | |
349 | ' > conftest.c | |
350 | eval $compile | |
351 | if test -s conftest; then | |
352 | echo "#define HAVE_fseeko" >> defines.h | |
353 | echo "You have fseeko()" | |
354 | else | |
355 | echo "You don't have fseeko()" | |
356 | fi | |
357 | rm -f conftest conftest.c | |
358 | ||
359 | # | |
360 | # F8. For fsck.cramfs.c: is lchown() available? | |
361 | # | |
362 | echo ' | |
363 | #include <sys/types.h> | |
364 | #include <unistd.h> | |
365 | int main(int a, char **v){ | |
366 | lchown("nowhere",0,0); | |
367 | exit(0); | |
368 | } | |
369 | ' > conftest.c | |
370 | gccout=`eval $compile_with_warnings | grep "lchown is not implemented"` | |
371 | if test -s conftest -a -z "$gccout"; then | |
372 | echo "#define HAVE_lchown" >> defines.h | |
373 | echo "You have lchown()" | |
374 | else | |
375 | echo "You don't have lchown()" | |
376 | fi | |
377 | rm -f conftest conftest.c | |
66ee8158 | 378 | |
df1dddf9 KZ |
379 | # |
380 | # F9. For cfdisk.c: is rpmatch() available? | |
381 | # | |
382 | echo ' | |
383 | #define _SVID_SOURCE | |
384 | #include <stdlib.h> | |
385 | int main(int a, char **v){ | |
386 | rpmatch("y"); | |
387 | exit(0); | |
388 | } | |
389 | ' > conftest.c | |
390 | eval $compile | |
391 | if test -s conftest; then | |
392 | echo "#define HAVE_rpmatch" >> defines.h | |
393 | echo "You have rpmatch()" | |
394 | else | |
395 | echo "You don't have rpmatch()" | |
396 | fi | |
397 | rm -f conftest conftest.c | |
398 | ||
7eda085c | 399 | # |
66ee8158 | 400 | # 2. How is [n]curses installed? |
7eda085c KZ |
401 | # |
402 | test_curses_h=0 | |
403 | have_ncurses=1 | |
eb63b9b8 KZ |
404 | if ! ./testincl "term.h"; then |
405 | have_ncurses=0 | |
406 | elif ./testincl -q "ncurses/curses.h"; then | |
7eda085c KZ |
407 | echo "HAVE_NCURSES=yes" >> make_include |
408 | echo "CURSESFLAGS=-I/usr/include/ncurses -DNCH=0" >> make_include | |
409 | echo "You have ncurses. Using <ncurses/curses.h>." | |
eb63b9b8 | 410 | elif ./testincl -q "ncurses.h"; then |
7eda085c KZ |
411 | echo "HAVE_NCURSES=yes" >> make_include |
412 | echo "CURSESFLAGS=-DNCH=1" >> make_include | |
413 | echo "You have ncurses. Using <ncurses.h>." | |
414 | elif [ -f /usr/local/include/ncurses.h ]; then | |
415 | echo "HAVE_NCURSES=yes" >> make_include | |
416 | echo "CURSESFLAGS=-I/usr/local/include -DNCH=1" >> make_include | |
417 | echo "You have ncurses. Using /usr/local/include/ncurses.h." | |
eb63b9b8 | 418 | elif ./testincl -q "curses.h"; then |
7eda085c KZ |
419 | test_curses_h=1 |
420 | else | |
421 | have_ncurses=0 | |
422 | fi | |
423 | # | |
424 | # If we found a curses.h, test whether it is ncurses | |
425 | # (It should define __NCURSES_H and NCURSES_VERSION and NCURSES_CONST ...) | |
426 | # | |
427 | if [ $test_curses_h = 1 ]; then | |
428 | echo " | |
429 | #include <curses.h> | |
63cccae4 | 430 | int main(){ char *c = NCURSES_VERSION; exit(0); } |
7eda085c KZ |
431 | " > conftest.c |
432 | eval $compile | |
63cccae4 | 433 | if test -s conftest; then |
7eda085c KZ |
434 | echo "HAVE_NCURSES=yes" >> make_include |
435 | echo "CURSESFLAGS=-DNCH=0" >> make_include | |
436 | echo "You have ncurses. Using <curses.h>." | |
437 | else | |
438 | have_ncurses=0 | |
439 | fi | |
440 | rm -f conftest conftest.c | |
441 | fi | |
442 | ||
443 | if [ $have_ncurses = 0 ]; then | |
444 | echo "HAVE_NCURSES=no" >> make_include | |
445 | echo "You don't have ncurses - I will not make ul and setterm." | |
446 | else | |
447 | echo "LIBCURSES=-lncurses" >> make_include | |
d162fcb5 | 448 | echo "#define HAVE_ncurses" >> defines.h |
7eda085c KZ |
449 | fi |
450 | ||
451 | # | |
ffc43748 | 452 | # 3. Some systems have /usr/lib/termcap.so -> /usr/lib/termcap.so.2 |
7eda085c KZ |
453 | # where however the latter file does not exist. When termcap does |
454 | # not exist, we can try to compile more with curses instead. | |
455 | # | |
456 | echo ' | |
457 | #include <termcap.h> | |
63cccae4 | 458 | int main(){ exit(0); tgetnum("li"); } |
7eda085c KZ |
459 | ' > conftest.c |
460 | LIBS=-ltermcap | |
461 | eval $compile | |
462 | LIBS= | |
63cccae4 | 463 | if test -s conftest; then |
7eda085c | 464 | echo "#define HAVE_termcap" >> defines.h |
ffc43748 | 465 | echo "HAVE_TERMCAP=yes" >> make_include |
7eda085c KZ |
466 | echo "LIBTERMCAP=-ltermcap" >> make_include |
467 | echo "You have termcap" | |
468 | else | |
469 | echo "HAVE_TERMCAP=no" >> make_include | |
eb63b9b8 KZ |
470 | if [ $have_ncurses = 0 ]; then |
471 | echo "You don't have termcap - I will not make more." | |
472 | else | |
473 | echo "You don't have termcap" | |
474 | fi | |
7eda085c KZ |
475 | fi |
476 | rm -f conftest conftest.c | |
477 | ||
478 | # | |
66ee8158 | 479 | # 4. Do we need -lcrypt? |
7eda085c KZ |
480 | # |
481 | echo ' | |
482 | #define _XOPEN_SOURCE | |
483 | #include <unistd.h> | |
63cccae4 | 484 | int main(){ char *c = crypt("abc","pw"); exit(0); } |
7eda085c KZ |
485 | ' > conftest.c |
486 | eval $compile | |
63cccae4 | 487 | if test -s conftest; then |
7eda085c KZ |
488 | echo "NEED_LIBCRYPT=no" >> make_include |
489 | echo "You don't need -lcrypt" | |
490 | else | |
491 | echo "NEED_LIBCRYPT=yes" >> make_include | |
492 | echo "You need -lcrypt" | |
493 | fi | |
494 | rm -f conftest conftest.c | |
495 | ||
496 | # | |
66ee8158 | 497 | # 5. Does static compilation work? |
7eda085c KZ |
498 | # |
499 | echo " | |
63cccae4 | 500 | int main(){ return 0; } |
7eda085c KZ |
501 | " > conftest.c |
502 | eval $static_compile | |
63cccae4 | 503 | if test -s conftest; then |
7eda085c KZ |
504 | : OK, nothing special |
505 | else | |
506 | echo "CAN_DO_STATIC=no" >> make_include | |
507 | echo "Strange... Static compilation fails here." | |
508 | fi | |
66ee8158 | 509 | rm -f conftest.c conftest |
7eda085c KZ |
510 | |
511 | # | |
66ee8158 | 512 | # 6. For lib/nls.h: do we have <libintl.h> and gettext() ? |
7eda085c KZ |
513 | # |
514 | echo ' | |
515 | #include <libintl.h> | |
63cccae4 | 516 | int main(int a, char **v){ |
7eda085c KZ |
517 | if (a == -1) /* false */ |
518 | gettext("There is no gettext man page\n"); | |
519 | exit(0); | |
520 | } | |
521 | ' > conftest.c | |
522 | eval $compile | |
63cccae4 | 523 | if test -s conftest; then |
7eda085c KZ |
524 | echo '#define HAVE_libintl_h' >> defines.h |
525 | echo "You have <libintl.h> and gettext()" | |
63cccae4 KZ |
526 | echo '#define MAY_ENABLE_NLS' >> defines.h |
527 | MAY_ENABLE_NLS=yes | |
7eda085c | 528 | else |
63cccae4 KZ |
529 | echo "You don't have native language support" |
530 | MAY_ENABLE_NLS=no | |
7eda085c KZ |
531 | fi |
532 | rm -f conftest conftest.c | |
533 | ||
534 | ||
535 | # | |
66ee8158 | 536 | # 7. Does xgettext exist and take the option --foreign-user? |
7eda085c | 537 | # |
ffc43748 KZ |
538 | # We use the bash builtin "type" here. |
539 | # I don't see an easy way to avoid it. | |
540 | # Many Linux systems do not have "which". Maybe "env" can be used. | |
541 | # Writing /usr/bin/xgettext is no good: one may have xgettext elsewhere. | |
542 | # | |
63cccae4 | 543 | if (test $MAY_ENABLE_NLS = yes && type xgettext > /dev/null 2>&1); then |
7eda085c KZ |
544 | msg=`xgettext --foreign-user 2>&1 | grep unrecognized` |
545 | if test -n "$msg"; then | |
546 | echo "FOREIGN = " >> make_include | |
547 | else | |
548 | echo "FOREIGN = --foreign-user" >> make_include | |
549 | fi | |
550 | echo "HAVE_XGETTEXT=yes" >> make_include | |
551 | else | |
552 | echo "HAVE_XGETTEXT=no" >> make_include | |
553 | fi | |
554 | ||
7eda085c KZ |
555 | |
556 | # | |
66ee8158 | 557 | # 8. For err.c: do we have __progname? |
7eda085c KZ |
558 | # [make sure gcc -O does not optimize the access away] |
559 | # | |
560 | echo " | |
561 | #include <stdio.h> | |
562 | extern char *__progname; | |
63cccae4 | 563 | int main(){ printf(__progname); exit(0); } |
7eda085c KZ |
564 | " > conftest.c |
565 | eval $compile | |
63cccae4 | 566 | if test -s conftest; then |
7eda085c KZ |
567 | echo "#define HAVE_progname" >> defines.h |
568 | echo "You have __progname" | |
569 | else | |
570 | echo "You don't have __progname" | |
571 | fi | |
572 | rm -f conftest conftest.c | |
573 | ||
7eda085c | 574 | # |
66ee8158 | 575 | # 9. For script.c: do we have <pty.h> and openpty()? |
7eda085c KZ |
576 | # |
577 | echo " | |
578 | #include <pty.h> | |
63cccae4 | 579 | int main(){ exit(0); openpty(0, 0, 0, 0, 0); } |
7eda085c | 580 | " > conftest.c |
22853e4a | 581 | LIBS=-lutil |
7eda085c | 582 | eval $compile |
22853e4a | 583 | LIBS= |
63cccae4 | 584 | if test -s conftest; then |
7eda085c KZ |
585 | echo "HAVE_OPENPTY=yes" >> make_include |
586 | echo "#define HAVE_openpty" >> defines.h | |
587 | echo "You have <pty.h> and openpty()" | |
588 | else | |
589 | echo "You don't have <pty.h> and openpty()" | |
590 | fi | |
591 | rm -f conftest conftest.c | |
eb63b9b8 KZ |
592 | |
593 | # | |
66ee8158 | 594 | # 10. For lib/widechar.h: do we have wide character support? |
eb63b9b8 KZ |
595 | # [Do we have the headers <wchar.h>, <wctype.h>, the types wchar_t, wint_t |
596 | # and the fgetwc, fputwc, WEOF functions/macros?] | |
597 | # | |
598 | echo " | |
599 | #include <wchar.h> | |
600 | #include <wctype.h> | |
601 | #include <stdio.h> | |
602 | int main () { | |
603 | wchar_t wc; | |
604 | wint_t w; | |
605 | w = fgetwc(stdin); | |
606 | if (w == WEOF) exit(1); | |
607 | wc = w; | |
608 | fputwc(wc,stdout); | |
609 | exit(0); | |
610 | } | |
611 | " > conftest.c | |
612 | eval $compile | |
b22550fa | 613 | if test -s conftest; then |
eb63b9b8 KZ |
614 | echo "#define ENABLE_WIDECHAR" >> defines.h |
615 | echo "You have wide character support" | |
616 | else | |
617 | echo "You don't have wide character support" | |
618 | fi | |
619 | rm -f conftest conftest.c | |
620 | ||
621 | # | |
d03dd608 | 622 | # 11. For pivot_root.c: does <sys/syscall.h> define SYS_pivot_root? |
22853e4a KZ |
623 | # |
624 | echo " | |
d03dd608 KZ |
625 | #include <sys/syscall.h> |
626 | #include <unistd.h> | |
22853e4a KZ |
627 | int main(void) |
628 | { | |
d03dd608 | 629 | return SYS_pivot_root; |
22853e4a KZ |
630 | } |
631 | " >conftest.c | |
632 | eval $compile | |
633 | if test -s conftest; then | |
634 | echo "HAVE_PIVOT_ROOT=yes" >> make_include | |
d03dd608 | 635 | echo "You have SYS_pivot_root" |
22853e4a | 636 | else |
d03dd608 | 637 | echo "You don't have SYS_pivot_root" |
22853e4a KZ |
638 | fi |
639 | rm -f conftest conftest.c | |
640 | ||
641 | # | |
66ee8158 | 642 | # 12. For hwclock.c: does struct tm have a field tm_gmtoff? |
22853e4a KZ |
643 | # |
644 | echo " | |
645 | #include <time.h> | |
646 | #include <unistd.h> | |
647 | int main(int a, char **v) | |
648 | { | |
649 | struct tm *tm = localtime(0); | |
650 | if (a == -1) /* false */ | |
651 | sleep(tm->tm_gmtoff); | |
652 | exit(0); | |
653 | } | |
654 | " >conftest.c | |
655 | eval $compile | |
656 | if test -s conftest; then | |
657 | echo "#define HAVE_tm_gmtoff" >> defines.h | |
658 | echo "You have a tm_gmtoff field in struct tm" | |
659 | else | |
660 | echo "You don't have a tm_gmtoff field in struct tm" | |
661 | fi | |
662 | rm -f conftest conftest.c | |
663 | ||
664 | # | |
66ee8158 KZ |
665 | # 13. For nfsmount: does the output of rpcgen compile? |
666 | # | |
667 | # On some systems the output of rpcgen compiles with warnings | |
668 | # Here we conclude "Your rpcgen output does not compile" | |
669 | # and use pregenerated files. If one wishes to use rpcgen anyway, | |
670 | # just add the line "HAVE_GOOD_RPC=yes" to make_include. | |
22853e4a KZ |
671 | # |
672 | rm -f conftest conftestx.c conftestl.c conftest.h conftest.x | |
66ee8158 | 673 | rm -f conftestx.o conftestl.o |
22853e4a KZ |
674 | echo " |
675 | #ifdef RPC_CLNT | |
676 | %#include <string.h> /* for memset() */ | |
677 | #endif | |
678 | %#include <asm/types.h> | |
679 | typedef opaque fhandle[1]; | |
680 | union fhstatus switch (unsigned fhs_status) { | |
681 | case 0: | |
682 | fhandle fhs_fhandle; | |
683 | default: | |
684 | void; | |
685 | }; | |
686 | typedef string dirpath<1024>; | |
687 | struct ppathcnf { | |
688 | short pc_mask[2]; | |
689 | }; | |
690 | ||
691 | program MOUNTPROG { | |
692 | version MOUNTVERS { | |
693 | fhstatus | |
694 | MOUNTPROC_MNT(dirpath) = 1; | |
695 | } = 2; | |
696 | } = 100005; | |
697 | " > conftest.x | |
2cccd0ff KZ |
698 | if rpcgen -h -o conftest.h conftest.x 2> conferrs > /dev/null && \ |
699 | rpcgen -c -o conftestx.c conftest.x 2>> conferrs > /dev/null && \ | |
700 | rpcgen -l -o conftestl.c conftest.x 2>> conferrs > /dev/null && \ | |
701 | $CC $CFLAGS -c conftestx.c 2>> conferrs > /dev/null && \ | |
702 | $CC $CFLAGS -c conftestl.c 2>> conferrs > /dev/null && \ | |
22853e4a KZ |
703 | test ! -s conferrs |
704 | then | |
705 | echo "HAVE_GOOD_RPC=yes" >> make_include | |
706 | echo "Your rpcgen seems to work" | |
707 | else | |
ffc43748 | 708 | echo "Your rpcgen output does not compile - using pregenerated code" |
22853e4a KZ |
709 | fi |
710 | rm -f conftest conftestx.c conftestl.c conftest.h conftest.x conferrs | |
66ee8158 | 711 | rm -f conftestx.o conftestl.o |
f0c8eda1 KZ |
712 | |
713 | # | |
714 | # 14. For fsck.cramfs, mkfs.cramfs: do we have libz? | |
715 | # | |
716 | echo ' | |
717 | #include <zlib.h> | |
718 | int main(){ exit(0); crc32(0, 0, 0); } | |
719 | ' > conftest.c | |
720 | LIBS=-lz | |
721 | eval $compile | |
722 | LIBS= | |
723 | if test -s conftest; then | |
724 | echo "HAVE_ZLIB=yes" >> make_include | |
725 | echo "You have zlib" | |
726 | else | |
727 | echo "HAVE_ZLIB=no" >> make_include | |
728 | echo "You don't have zlib" | |
729 | fi | |
730 | rm -f conftest conftest.c | |
731 | ||
c129767e KZ |
732 | # |
733 | # 15. For mount, do we have blkid? | |
734 | # | |
735 | echo ' | |
736 | #include <blkid/blkid.h> | |
737 | int main(){ exit(0); blkid_known_fstype("ext2"); } | |
738 | ' > conftest.c | |
739 | LIBS="-lblkid -luuid" | |
740 | eval $compile | |
741 | LIBS= | |
742 | if test -s conftest; then | |
743 | echo "HAVE_BLKID=yes" >> make_include | |
744 | echo "You have blkid" | |
745 | else | |
746 | echo "HAVE_BLKID=no" >> make_include | |
747 | echo "You don't have blkid" | |
748 | fi | |
749 | rm -f conftest conftest.c |