]> git.ipfire.org Git - thirdparty/util-linux.git/blame - configure
Imported from util-linux-2.12o tarball.
[thirdparty/util-linux.git] / configure
CommitLineData
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
49rm -f make_include defines.h
50
51VERSION=`cat VERSION`
52echo
53echo configuring util-linux-$VERSION
54echo
55echo "VERSION=$VERSION" > make_include
56echo '#define UTIL_LINUX_VERSION "'$VERSION'"' > defines.h
57echo '#define util_linux_version "util-linux-'$VERSION'"' >> defines.h
58echo >> defines.h
7eda085c 59
7eda085c 60CC=${CC-cc}
df1dddf9 61CFLAGS=${CFLAGS-"-O2"}
66ee8158
KZ
62LDFLAGS=${LDFLAGS-"-s"}
63echo CC=$CC >> make_include
64echo CFLAGS=$CFLAGS >> make_include
65echo LDFLAGS=$LDFLAGS >> make_include
66
7eda085c
KZ
67DEFS=
68LIBS=
69compile='$CC $CFLAGS $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
63cccae4 70compile_with_warnings='$CC $CFLAGS $DEFS conftest.c -o conftest $LIBS 2>&1'
7eda085c 71static_compile='$CC -static $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
eb63b9b8
KZ
72eval COMPILE='"'$compile'"'
73export COMPILE
7eda085c 74
eb63b9b8 75rm -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#
92echo "
63cccae4 93int main(){ exit(0); }
e8f26419 94" > conftest.c
b22550fa 95gccout=`$CC $CFLAGS -mtune=i486 conftest.c -o conftest 2>&1 | grep "nvalid"`
e8f26419 96if test -z "$gccout"; then
b22550fa
KZ
97 echo "HAVE_NEW_GCC=yes" >> make_include
98else
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
103fi
104rm -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#
115echo "
116#define u_char unsigned char
117#include <scsi/scsi.h>
118#undef u_char
63cccae4 119int main(){ exit(0); }
66ee8158
KZ
120" > conftest.c
121eval $compile
63cccae4 122if test -s conftest; then
66ee8158
KZ
123 echo "#define HAVE_scsi_h" >> defines.h
124 echo "You have <scsi/scsi.h>"
125else
126 echo "You don't have <scsi/scsi.h>"
127fi
128rm -f conftest conftest.c
129
130#
131# H2. For fdisk/fdisk.c: is <linux/blkpg.h> available?
132#
133if ./testincl "linux/blkpg.h"; then
134 echo "#define HAVE_blkpg_h" >> defines.h
135fi
136
137#
138# H3. Does <linux/kd.h> exist?
139#
140if ./testincl "linux/kd.h"; then
141 echo "#define HAVE_kd_h" >> defines.h
142fi
143
144#
145# H4. For lib/nls.h: do we have <locale.h>?
146#
147if ./testincl "locale.h"; then
148 echo "#define HAVE_locale_h" >> defines.h
149fi
150
151#
152# H5. For cal.c: do we have <langinfo.h>?
153#
154if ./testincl "langinfo.h"; then
155 echo "#define HAVE_langinfo_h" >> defines.h
156fi
157
158#
c07ebfa1 159# H6. For mkswap.c: do we have <sys/user.h> or <asm/page.h>?
66ee8158 160#
c07ebfa1
KZ
161if ./testincl "sys/user.h"; then
162 echo "#define HAVE_sys_user_h" >> defines.h
163else if ./testincl "asm/page.h"; then
66ee8158 164 echo "#define HAVE_asm_page_h" >> defines.h
d162fcb5 165fi; fi
66ee8158 166
756bfd01
KZ
167#
168# H6a. For mkswap.c: do we have <uuid/uuid.h>?
169#
170if ./testincl "uuid/uuid.h"; then
171 echo "#define HAVE_uuid_uuid_h" >> defines.h
172 echo "HAVE_UUID=yes" >> make_include
173else
174 echo "HAVE_UUID=no" >> make_include
175fi
176
66ee8158 177#
1d4ad1de
KZ
178# H7. For nfsmount.c: do we have <rpcsvc/nfs_prot.h>?
179#
180if ./testincl "rpcsvc/nfs_prot.h"; then
181 echo "#define HAVE_rpcsvc_nfs_prot_h" >> defines.h
182fi
183
184#
185# H8. For nfsmount.h: do we have <asm/types.h>?
66ee8158
KZ
186#
187if ./testincl "asm/types.h"; then
188 echo "#define HAVE_asm_types_h" >> defines.h
189fi
190
ffc43748 191#
1d4ad1de 192# H9. For raw.c: do we have <linux/raw.h>?
ffc43748
KZ
193#
194if ./testincl "linux/raw.h"; then
195 echo "HAVE_RAW_H=yes" >> make_include
196fi
197
d03dd608
KZ
198#
199# H10. For md5.c: do we have <stdint.h>?
200if ./testincl "stdint.h"; then
201 echo "#define HAVE_stdint_h" >> defines.h
202fi
66ee8158 203
0b0bb920
KZ
204#
205# H11. For cmos.c: do we have <sys/io.h>?
206if ./testincl "sys/io.h"; then
207 echo "#define HAVE_sys_io_h" >> defines.h
208fi
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#
217echo "
218#include <sys/socket.h>
219#include <netinet/in.h>
220#include <arpa/inet.h>
63cccae4 221int 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
227eval $compile
63cccae4 228if test -s conftest; then
7eda085c
KZ
229 echo "#define HAVE_inet_aton" >> defines.h
230 echo "You have inet_aton()"
231else
232 echo "You don't have inet_aton()"
233fi
234rm -f conftest conftest.c
235
236#
66ee8158 237# F2. For mkswap.c: is fsync() available?
7eda085c
KZ
238#
239echo "
66ee8158 240#include <unistd.h>
63cccae4 241int main(int a, char **v){
66ee8158
KZ
242 if (a == -1) /* false */
243 fsync(0);
244 exit(0);
245}
7eda085c
KZ
246" > conftest.c
247eval $compile
63cccae4 248if test -s conftest; then
66ee8158
KZ
249 echo "#define HAVE_fsync" >> defines.h
250 echo "You have fsync()"
7eda085c 251else
66ee8158 252 echo "You don't have fsync()"
7eda085c
KZ
253fi
254rm -f conftest conftest.c
255
256#
66ee8158 257# F3. For agetty.c: is getdomainname() available?
7eda085c 258#
66ee8158
KZ
259echo "
260#include <unistd.h>
63cccae4 261int 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
268eval $compile
63cccae4 269if test -s conftest; then
66ee8158
KZ
270 echo "#define HAVE_getdomainname" >> defines.h
271 echo "You have getdomainname()"
272else
273 echo "You don't have getdomainname()"
7eda085c 274fi
66ee8158 275rm -f conftest conftest.c
7eda085c
KZ
276
277#
66ee8158
KZ
278# F4. For hwclock/kd.c: do we have nanosleep?
279#
280echo "
281#include <time.h>
282int main () {
283 struct timespec sleep = { 0, 1 };
284 nanosleep( &sleep, NULL );
285 exit(0);
286}
287" > conftest.c
288eval $compile
63cccae4 289if test -s conftest; then
66ee8158
KZ
290 echo "#define HAVE_nanosleep" >> defines.h
291 echo "You have nanosleep()"
292else
293 echo "You don't have nanosleep()"
294fi
295rm -f conftest conftest.c
296
297#
298# F5. For mkswap.c: do we have personality()?
299#
300echo "
301int main () {
302 extern int personality(unsigned long);
303 personality(0);
304 exit(0);
305}
306" > conftest.c
307eval $compile
63cccae4 308if test -s conftest; then
66ee8158
KZ
309 echo "#define HAVE_personality" >> defines.h
310 echo "You have personality()"
311else
312 echo "You don't have personality()"
313fi
314rm -f conftest conftest.c
315
c07ebfa1
KZ
316#
317# F6. For agetty.c: is updwtmp() available?
318#
319echo '
320#include <string.h>
321#include <utmp.h>
63cccae4 322int 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
330eval $compile
63cccae4 331if test -s conftest; then
c07ebfa1
KZ
332 echo "#define HAVE_updwtmp" >> defines.h
333 echo "You have updwtmp()"
334else
335 echo "You don't have updwtmp()"
336fi
337rm -f conftest conftest.c
338
63cccae4
KZ
339#
340# F7. For pg.c: are fseeko() and ftello() available?
341#
342echo '
343#include <stdio.h>
344int main(int a, char **v){
345 fseeko(stdout, 0, 0);
346 ftello(stdout);
347 exit(0);
348}
349' > conftest.c
350eval $compile
351if test -s conftest; then
352 echo "#define HAVE_fseeko" >> defines.h
353 echo "You have fseeko()"
354else
355 echo "You don't have fseeko()"
356fi
357rm -f conftest conftest.c
358
359#
360# F8. For fsck.cramfs.c: is lchown() available?
361#
362echo '
363#include <sys/types.h>
364#include <unistd.h>
365int main(int a, char **v){
366 lchown("nowhere",0,0);
367 exit(0);
368}
369' > conftest.c
370gccout=`eval $compile_with_warnings | grep "lchown is not implemented"`
371if test -s conftest -a -z "$gccout"; then
372 echo "#define HAVE_lchown" >> defines.h
373 echo "You have lchown()"
374else
375 echo "You don't have lchown()"
376fi
377rm -f conftest conftest.c
66ee8158 378
df1dddf9
KZ
379#
380# F9. For cfdisk.c: is rpmatch() available?
381#
382echo '
383#define _SVID_SOURCE
384#include <stdlib.h>
385int main(int a, char **v){
386 rpmatch("y");
387 exit(0);
388}
389' > conftest.c
390eval $compile
391if test -s conftest; then
392 echo "#define HAVE_rpmatch" >> defines.h
393 echo "You have rpmatch()"
394else
395 echo "You don't have rpmatch()"
396fi
397rm -f conftest conftest.c
398
7eda085c 399#
66ee8158 400# 2. How is [n]curses installed?
7eda085c
KZ
401#
402test_curses_h=0
403have_ncurses=1
eb63b9b8
KZ
404if ! ./testincl "term.h"; then
405 have_ncurses=0
406elif ./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 410elif ./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>."
414elif [ -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 418elif ./testincl -q "curses.h"; then
7eda085c
KZ
419 test_curses_h=1
420else
421 have_ncurses=0
422fi
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#
427if [ $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
441fi
442
443if [ $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."
446else
447 echo "LIBCURSES=-lncurses" >> make_include
d162fcb5 448 echo "#define HAVE_ncurses" >> defines.h
7eda085c
KZ
449fi
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#
456echo '
457#include <termcap.h>
63cccae4 458int main(){ exit(0); tgetnum("li"); }
7eda085c
KZ
459' > conftest.c
460LIBS=-ltermcap
461eval $compile
462LIBS=
63cccae4 463if 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"
468else
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
475fi
476rm -f conftest conftest.c
477
478#
66ee8158 479# 4. Do we need -lcrypt?
7eda085c
KZ
480#
481echo '
482#define _XOPEN_SOURCE
483#include <unistd.h>
63cccae4 484int main(){ char *c = crypt("abc","pw"); exit(0); }
7eda085c
KZ
485' > conftest.c
486eval $compile
63cccae4 487if test -s conftest; then
7eda085c
KZ
488 echo "NEED_LIBCRYPT=no" >> make_include
489 echo "You don't need -lcrypt"
490else
491 echo "NEED_LIBCRYPT=yes" >> make_include
492 echo "You need -lcrypt"
493fi
494rm -f conftest conftest.c
495
496#
66ee8158 497# 5. Does static compilation work?
7eda085c
KZ
498#
499echo "
63cccae4 500int main(){ return 0; }
7eda085c
KZ
501" > conftest.c
502eval $static_compile
63cccae4 503if test -s conftest; then
7eda085c
KZ
504 : OK, nothing special
505else
506 echo "CAN_DO_STATIC=no" >> make_include
507 echo "Strange... Static compilation fails here."
508fi
66ee8158 509rm -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#
514echo '
515#include <libintl.h>
63cccae4 516int 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
522eval $compile
63cccae4 523if 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 528else
63cccae4
KZ
529 echo "You don't have native language support"
530 MAY_ENABLE_NLS=no
7eda085c
KZ
531fi
532rm -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 543if (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
551else
552 echo "HAVE_XGETTEXT=no" >> make_include
553fi
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#
560echo "
561#include <stdio.h>
562extern char *__progname;
63cccae4 563int main(){ printf(__progname); exit(0); }
7eda085c
KZ
564" > conftest.c
565eval $compile
63cccae4 566if test -s conftest; then
7eda085c
KZ
567 echo "#define HAVE_progname" >> defines.h
568 echo "You have __progname"
569else
570 echo "You don't have __progname"
571fi
572rm -f conftest conftest.c
573
7eda085c 574#
66ee8158 575# 9. For script.c: do we have <pty.h> and openpty()?
7eda085c
KZ
576#
577echo "
578#include <pty.h>
63cccae4 579int main(){ exit(0); openpty(0, 0, 0, 0, 0); }
7eda085c 580" > conftest.c
22853e4a 581LIBS=-lutil
7eda085c 582eval $compile
22853e4a 583LIBS=
63cccae4 584if 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()"
588else
589 echo "You don't have <pty.h> and openpty()"
590fi
591rm -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#
598echo "
599#include <wchar.h>
600#include <wctype.h>
601#include <stdio.h>
602int 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
612eval $compile
b22550fa 613if test -s conftest; then
eb63b9b8
KZ
614 echo "#define ENABLE_WIDECHAR" >> defines.h
615 echo "You have wide character support"
616else
617 echo "You don't have wide character support"
618fi
619rm -f conftest conftest.c
620
621#
d03dd608 622# 11. For pivot_root.c: does <sys/syscall.h> define SYS_pivot_root?
22853e4a
KZ
623#
624echo "
d03dd608
KZ
625#include <sys/syscall.h>
626#include <unistd.h>
22853e4a
KZ
627int main(void)
628{
d03dd608 629 return SYS_pivot_root;
22853e4a
KZ
630}
631" >conftest.c
632eval $compile
633if test -s conftest; then
634 echo "HAVE_PIVOT_ROOT=yes" >> make_include
d03dd608 635 echo "You have SYS_pivot_root"
22853e4a 636else
d03dd608 637 echo "You don't have SYS_pivot_root"
22853e4a
KZ
638fi
639rm -f conftest conftest.c
640
641#
66ee8158 642# 12. For hwclock.c: does struct tm have a field tm_gmtoff?
22853e4a
KZ
643#
644echo "
645#include <time.h>
646#include <unistd.h>
647int 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
655eval $compile
656if test -s conftest; then
657 echo "#define HAVE_tm_gmtoff" >> defines.h
658 echo "You have a tm_gmtoff field in struct tm"
659else
660 echo "You don't have a tm_gmtoff field in struct tm"
661fi
662rm -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#
672rm -f conftest conftestx.c conftestl.c conftest.h conftest.x
66ee8158 673rm -f conftestx.o conftestl.o
22853e4a
KZ
674echo "
675#ifdef RPC_CLNT
676%#include <string.h> /* for memset() */
677#endif
678%#include <asm/types.h>
679typedef opaque fhandle[1];
680union fhstatus switch (unsigned fhs_status) {
681case 0:
682 fhandle fhs_fhandle;
683default:
684 void;
685};
686typedef string dirpath<1024>;
687struct ppathcnf {
688 short pc_mask[2];
689};
690
691program MOUNTPROG {
692 version MOUNTVERS {
693 fhstatus
694 MOUNTPROC_MNT(dirpath) = 1;
695 } = 2;
696} = 100005;
697" > conftest.x
2cccd0ff
KZ
698if 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
704then
705 echo "HAVE_GOOD_RPC=yes" >> make_include
706 echo "Your rpcgen seems to work"
707else
ffc43748 708 echo "Your rpcgen output does not compile - using pregenerated code"
22853e4a
KZ
709fi
710rm -f conftest conftestx.c conftestl.c conftest.h conftest.x conferrs
66ee8158 711rm -f conftestx.o conftestl.o
f0c8eda1
KZ
712
713#
714# 14. For fsck.cramfs, mkfs.cramfs: do we have libz?
715#
716echo '
717#include <zlib.h>
718int main(){ exit(0); crc32(0, 0, 0); }
719' > conftest.c
720LIBS=-lz
721eval $compile
722LIBS=
723if test -s conftest; then
724 echo "HAVE_ZLIB=yes" >> make_include
725 echo "You have zlib"
726else
727 echo "HAVE_ZLIB=no" >> make_include
728 echo "You don't have zlib"
729fi
730rm -f conftest conftest.c
731
c129767e
KZ
732#
733# 15. For mount, do we have blkid?
734#
735echo '
736#include <blkid/blkid.h>
737int main(){ exit(0); blkid_known_fstype("ext2"); }
738' > conftest.c
739LIBS="-lblkid -luuid"
740eval $compile
741LIBS=
742if test -s conftest; then
743 echo "HAVE_BLKID=yes" >> make_include
744 echo "You have blkid"
745else
746 echo "HAVE_BLKID=no" >> make_include
747 echo "You don't have blkid"
748fi
749rm -f conftest conftest.c