This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [PATCH] Detecting bad /dev/null's in Configure
[perl5.git] / Configure
CommitLineData
2304df62
AD
1#! /bin/sh
2#
3# If these # comments don't work, trim them. Don't worry about any other
4# shell scripts, Configure will trim # comments from them for you.
5#
6# (If you are trying to port this package to a machine without sh,
7# I would suggest you have a look at the prototypical config_h.SH file
8# and edit it to reflect your system. Some packages may include samples
9# of config.h for certain machines, so you might look for one of those.)
10#
11# Yes, you may rip this off to use in other distribution packages. This
12# script belongs to the public domain and cannot be copyrighted.
13#
14# (Note: this Configure script was generated automatically. Rather than
15# working with this copy of Configure, you may wish to get metaconfig.
16# The dist-3.0 package (which contains metaconfig) was posted in
dfe9444c
AD
17# comp.sources.misc and is available on CPAN under authors/id/RAM so
18# you may fetch it yourself from your nearest archive site.)
2304df62 19#
5cadb3f3
MB
20#
21# Though this script was generated by metaconfig, it is OK to send
22# patches against it. It's up to the Configure pumpkin to backport
23# the patch to the metaunits if it is accepted.
24# See Porting/pumpkin.pod for more information on metaconfig.
25#
2304df62 26
dfe9444c 27# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
2304df62 28#
f8e2af1d 29# Generated on Mon Nov 6 16:18:02 CET 2006 [metaconfig 3.0 PL70]
7f2de2d2 30# (with additional metaconfig patches by perlbug@perl.org)
2304df62 31
283fdd21 32cat >c1$$ <<EOF
2304df62
AD
33ARGGGHHHH!!!!!
34
35SCO csh still thinks true is false. Write to SCO today and tell them that next
36year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
39we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41[End of diatribe. We now return you to your regularly scheduled programming...]
42EOF
283fdd21 43cat >c2$$ <<EOF
2304df62
AD
44
45OOPS! You naughty creature! You didn't run Configure with sh!
46I will attempt to remedy the situation by running sh for you...
47EOF
48
283fdd21 49true || cat c1$$ c2$$
2304df62
AD
50true || exec sh $0 $argv:q
51
283fdd21 52(exit $?0) || cat c2$$
2304df62 53(exit $?0) || exec sh $0 $argv:q
283fdd21 54rm -f c1$$ c2$$
2304df62 55
f6538904 56if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
cbee2ce6
JH
57 cat >&4 <<EOF
58***
59*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60*** Configure that well. (Plan 9 is close to UNIX but not close enough.)
61*** Please read the README.plan9 for further instructions.
62*** Cannot continue, aborting.
63***
64EOF
65 exit 1
66fi
67
f8e2af1d
MC
68if test ! -c /dev/null ; then
69 cat >&4 <<EOF
70***
71*** I'm sorry, but /dev/null appears to be a file rather than a device.
72*** Please consult your operating sytem's notes for making a device
73*** in /dev.
74*** Cannot continue, aborting.
75***
76EOF
77 exit 1
78fi
79
a0d0e21e
LW
80: compute my invocation name
81me=$0
82case "$0" in
83*/*)
84 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
85 test "$me" || me=$0
86 ;;
87esac
88
dfe9444c 89: Proper separator for the PATH environment variable
8e07c86e
AD
90p_=:
91: On OS/2 this directory should exist if this is not floppy only system :-]
5c728af0 92if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
dfe9444c
AD
93 if test -n "$OS2_SHELL"; then
94 p_=\;
95 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
96 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
5c728af0 97 is_os2=yes
c4f23d77 98 elif test -n "$DJGPP"; then
495e2cbe
MB
99 case "X${MACHTYPE:-nonesuchmach}" in
100 *cygwin) ;;
101 *) p_=\; ;;
102 esac
dfe9444c 103 fi
39e571d4 104fi
a0d0e21e
LW
105
106: Proper PATH setting
107paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 108paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 109paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 110paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e 111paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
87bdd940 112paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
232e078e
AD
113paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
114paths="$paths /sbin /usr/sbin /usr/libexec"
3c728e00 115paths="$paths /system/gnu_library/bin"
a0d0e21e
LW
116
117for p in $paths
118do
8e07c86e
AD
119 case "$p_$PATH$p_" in
120 *$p_$p$p_*) ;;
121 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
122 esac
123done
124
8e07c86e 125PATH=.$p_$PATH
2304df62
AD
126export PATH
127
dfe9444c
AD
128: shall we be using ksh?
129inksh=''
130needksh=''
131avoidksh=''
132newsh=/bin/ksh
133changesh=''
ff0cee69 134if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
135 inksh=true
136fi
137if test -f /hp-ux -a -f /bin/ksh; then
138 needksh='to avoid sh bug in "here document" expansion'
139fi
140if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
141 if test X`/usr/bin/uname -v` = X4; then
142 avoidksh="to avoid AIX 4's /bin/sh"
143 newsh=/usr/bin/bsh
2304df62 144 fi
dfe9444c 145fi
cf04f91f
JH
146if test -f /osf_boot -a -f /usr/sbin/setld; then
147 if test X`/usr/bin/uname -s` = XOSF1; then
148 avoidksh="to avoid Digital UNIX' ksh"
149 newsh=/bin/sh
150 unset BIN_SH # if this is 'xpg4' sh will start up ksh
151 fi
152fi
dfe9444c
AD
153case "$inksh/$needksh" in
154/[a-z]*)
c4f23d77 155 ENV=''
dfe9444c
AD
156 changesh=true
157 reason="$needksh"
158 ;;
159esac
160case "$inksh/$avoidksh" in
161true/[a-z]*)
162 changesh=true
163 reason="$avoidksh"
164 ;;
165esac
166case "$inksh/$needksh-$avoidksh-" in
167true/--)
a0d0e21e
LW
168 cat <<EOM
169(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 170mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 171EOM
dfe9444c
AD
172 ;;
173esac
174case "$changesh" in
175true)
2e2a97a6 176 export newsh
dfe9444c
AD
177 echo "(Feeding myself to $newsh $reason.)"
178 case "$0" in
179 Configure|*/Configure) exec $newsh $0 "$@";;
180 *) exec $newsh Configure "$@";;
181 esac
182 ;;
183esac
2304df62 184
bfb7748a
AD
185: if needed set CDPATH to a harmless value that is not chatty
186: avoid bash 2.02 problems with empty CDPATH.
187case "$CDPATH" in
188'') ;;
189*) case "$SHELL" in
190 *bash*) CDPATH='.' ;;
191 *) CDPATH='' ;;
192 esac
193 ;;
194esac
2304df62
AD
195: Configure runs within the UU subdirectory
196test -d UU || mkdir UU
8e07c86e 197cd UU && rm -f ./*
2304df62 198
6b356c8e
JH
199ccname=''
200ccversion=''
b4eb6b3d
JH
201ccsymbols=''
202cppccsymbols=''
203cppsymbols=''
5440bc8e
JH
204from=''
205run=''
206targetarch=''
207to=''
208usecrosscompile=''
6b34ded5 209mistrustnm=''
9c839522 210perllibs=''
b4eb6b3d
JH
211dynamic_ext=''
212extensions=''
213known_extensions=''
214nonxs_ext=''
215static_ext=''
216useopcode=''
217useposix=''
6fcddf3b 218extras=''
ecfc5424 219d_bsd=''
40a7a20a 220d_eunice=''
2304df62
AD
221d_xenix=''
222eunicefix=''
223Mcc=''
dfe9444c 224ar=''
2304df62
AD
225awk=''
226bash=''
227bison=''
228byacc=''
229cat=''
230chgrp=''
231chmod=''
232chown=''
ecfc5424 233comm=''
2304df62
AD
234compress=''
235cp=''
236cpio=''
237cpp=''
238csh=''
239date=''
240echo=''
241egrep=''
242emacs=''
243expr=''
244find=''
245flex=''
3c728e00 246gmake=''
2304df62 247grep=''
8ff267be 248gzip=''
2304df62
AD
249inews=''
250ksh=''
251less=''
252line=''
253lint=''
254ln=''
255lp=''
256lpr=''
257ls=''
258mail=''
259mailx=''
dfe9444c 260make=''
2304df62
AD
261mkdir=''
262more=''
263mv=''
693762b4 264nm=''
2304df62
AD
265nroff=''
266perl=''
267pg=''
268pmake=''
269pr=''
270rm=''
271rmail=''
272sed=''
273sendmail=''
2304df62
AD
274shar=''
275sleep=''
276smail=''
277sort=''
278submit=''
279tail=''
280tar=''
281tbl=''
693762b4 282tee=''
2304df62
AD
283test=''
284touch=''
285tr=''
286troff=''
287uname=''
288uniq=''
289uuname=''
290vi=''
291zcat=''
8ff267be 292zip=''
b4eb6b3d
JH
293full_ar=''
294full_sed=''
a0d0e21e 295libswanted=''
2304df62
AD
296hint=''
297myuname=''
85e6fe83
LW
298osname=''
299osvers=''
2304df62
AD
300Author=''
301Date=''
302Header=''
303Id=''
304Locker=''
305Log=''
306RCSfile=''
307Revision=''
308Source=''
309State=''
dfe9444c
AD
310_a=''
311_exe=''
312_o=''
4633a7c4
LW
313archobjs=''
314exe_ext=''
315firstmakefile=''
316lib_ext=''
317obj_ext=''
318path_sep=''
b4eb6b3d 319afs=''
a6d26a0d 320afsroot=''
b4eb6b3d
JH
321alignbytes=''
322ansi2knr=''
323archlib=''
324archlibexp=''
325d_archlib=''
326installarchlib=''
327archname=''
328myarchname=''
329d_atolf=''
330d_atoll=''
331baserev=''
332bin=''
333binexp=''
f3f1a2d8 334initialinstalllocation=''
b4eb6b3d 335installbin=''
f3f1a2d8 336userelocatableinc=''
b4eb6b3d 337byteorder=''
2304df62 338cc=''
2304df62
AD
339ccflags=''
340cppflags=''
341ldflags=''
342lkflags=''
8e07c86e 343locincpth=''
2304df62 344optimize=''
b4eb6b3d 345cf_email=''
2304df62
AD
346cf_by=''
347cf_time=''
b4eb6b3d 348charsize=''
2304df62 349contains=''
b4eb6b3d 350cpp_stuff=''
2304df62
AD
351cpplast=''
352cppminus=''
353cpprun=''
354cppstdin=''
74cac757 355d__fwalk=''
b4eb6b3d
JH
356d_access=''
357d_accessx=''
55954f19 358d_aintl=''
b4eb6b3d 359d_alarm=''
10bc17b6
JH
360asctime_r_proto=''
361d_asctime_r=''
0dbb1585
AL
362d_attribute_format=''
363d_attribute_malloc=''
364d_attribute_nonnull=''
365d_attribute_noreturn=''
366d_attribute_pure=''
367d_attribute_unused=''
368d_attribute_warn_unused_result=''
b4eb6b3d
JH
369d_bcmp=''
370d_bcopy=''
635aebb7
AL
371d_builtin_choose_expr=''
372d_builtin_expect=''
b4eb6b3d 373d_bzero=''
a2d23ec2 374d_c99_variadic_macros=''
b4eb6b3d
JH
375d_casti32=''
376castflags=''
377d_castneg=''
378d_chown=''
379d_chroot=''
380d_chsize=''
758a5d79 381d_class=''
b0a2e8e6 382d_clearenv=''
b4eb6b3d
JH
383d_closedir=''
384d_void_closedir=''
4e0554ec 385d_cmsghdr_s=''
b4eb6b3d 386d_const=''
36adc09b 387d_copysignl=''
666ea192 388d_cplusplus=''
b4eb6b3d
JH
389cryptlib=''
390d_crypt=''
10bc17b6
JH
391crypt_r_proto=''
392d_crypt_r=''
b4eb6b3d
JH
393d_csh=''
394full_csh=''
13cfc98d 395d_ctermid=''
10bc17b6
JH
396ctermid_r_proto=''
397d_ctermid_r=''
398ctime_r_proto=''
399d_ctime_r=''
b4eb6b3d
JH
400d_cuserid=''
401d_dbl_dig=''
2ef53570 402d_dbminitproto=''
b4eb6b3d 403d_difftime=''
ae0e3d3b 404d_dirfd=''
b4eb6b3d 405d_dlerror=''
a0d0e21e 406d_dlopen=''
b4eb6b3d
JH
407d_dlsymun=''
408d_dosuid=''
409d_suidsafe=''
10bc17b6
JH
410d_drand48_r=''
411drand48_r_proto=''
b4eb6b3d
JH
412d_drand48proto=''
413d_dup2=''
414d_eaccess=''
415d_endgrent=''
10bc17b6
JH
416d_endgrent_r=''
417endgrent_r_proto=''
b4eb6b3d 418d_endhent=''
10bc17b6
JH
419d_endhostent_r=''
420endhostent_r_proto=''
b4eb6b3d 421d_endnent=''
10bc17b6
JH
422d_endnetent_r=''
423endnetent_r_proto=''
b4eb6b3d 424d_endpent=''
10bc17b6
JH
425d_endprotoent_r=''
426endprotoent_r_proto=''
b4eb6b3d 427d_endpwent=''
10bc17b6
JH
428d_endpwent_r=''
429endpwent_r_proto=''
b4eb6b3d 430d_endsent=''
10bc17b6
JH
431d_endservent_r=''
432endservent_r_proto=''
15b61c98 433d_faststdio=''
b363b713 434d_fchdir=''
b4eb6b3d
JH
435d_fchmod=''
436d_fchown=''
437d_fcntl=''
9d9004a9 438d_fcntl_can_lock=''
b4eb6b3d
JH
439d_fd_macros=''
440d_fd_set=''
441d_fds_bits=''
442d_fgetpos=''
758a5d79
JH
443d_finite=''
444d_finitel=''
b4eb6b3d
JH
445d_flexfnam=''
446d_flock=''
2ef53570 447d_flockproto=''
b4eb6b3d 448d_fork=''
758a5d79
JH
449d_fp_class=''
450d_fpclass=''
451d_fpclassify=''
452d_fpclassl=''
b4eb6b3d
JH
453d_fpos64_t=''
454d_frexpl=''
455d_fs_data_s=''
456d_fseeko=''
457d_fsetpos=''
458d_fstatfs=''
411ab01c 459d_fsync=''
b4eb6b3d
JH
460d_ftello=''
461d_ftime=''
462d_gettimeod=''
dc814df1 463d_futimes=''
b4eb6b3d
JH
464d_Gconvert=''
465d_getcwd=''
466d_getespwnam=''
467d_getfsstat=''
468d_getgrent=''
10bc17b6
JH
469d_getgrent_r=''
470getgrent_r_proto=''
471d_getgrgid_r=''
472getgrgid_r_proto=''
473d_getgrnam_r=''
474getgrnam_r_proto=''
b4eb6b3d
JH
475d_getgrps=''
476d_gethbyaddr=''
477d_gethbyname=''
478d_gethent=''
479aphostname=''
480d_gethname=''
481d_phostname=''
482d_uname=''
10bc17b6
JH
483d_gethostbyaddr_r=''
484gethostbyaddr_r_proto=''
485d_gethostbyname_r=''
486gethostbyname_r_proto=''
487d_gethostent_r=''
488gethostent_r_proto=''
b4eb6b3d 489d_gethostprotos=''
4e0554ec 490d_getitimer=''
b4eb6b3d 491d_getlogin=''
10bc17b6
JH
492d_getlogin_r=''
493getlogin_r_proto=''
b4eb6b3d
JH
494d_getmnt=''
495d_getmntent=''
496d_getnbyaddr=''
497d_getnbyname=''
498d_getnent=''
10bc17b6
JH
499d_getnetbyaddr_r=''
500getnetbyaddr_r_proto=''
501d_getnetbyname_r=''
502getnetbyname_r_proto=''
503d_getnetent_r=''
504getnetent_r_proto=''
b4eb6b3d 505d_getnetprotos=''
0c0643d0 506d_getpagsz=''
b4eb6b3d
JH
507d_getpent=''
508d_getpgid=''
509d_getpgrp2=''
510d_bsdgetpgrp=''
511d_getpgrp=''
512d_getppid=''
513d_getprior=''
514d_getpbyname=''
515d_getpbynumber=''
10bc17b6
JH
516d_getprotobyname_r=''
517getprotobyname_r_proto=''
518d_getprotobynumber_r=''
519getprotobynumber_r_proto=''
520d_getprotoent_r=''
521getprotoent_r_proto=''
b4eb6b3d
JH
522d_getprotoprotos=''
523d_getprpwnam=''
524d_getpwent=''
10bc17b6
JH
525d_getpwent_r=''
526getpwent_r_proto=''
527d_getpwnam_r=''
528getpwnam_r_proto=''
529d_getpwuid_r=''
530getpwuid_r_proto=''
b4eb6b3d 531d_getsent=''
10bc17b6
JH
532d_getservbyname_r=''
533getservbyname_r_proto=''
534d_getservbyport_r=''
535getservbyport_r_proto=''
536d_getservent_r=''
537getservent_r_proto=''
b4eb6b3d
JH
538d_getservprotos=''
539d_getspnam=''
10bc17b6
JH
540d_getspnam_r=''
541getspnam_r_proto=''
b4eb6b3d
JH
542d_getsbyname=''
543d_getsbyport=''
10bc17b6
JH
544d_gmtime_r=''
545gmtime_r_proto=''
a4f3eea9 546d_gnulibc=''
5f6e0ee4 547gnulibc_version=''
b4eb6b3d
JH
548d_hasmntopt=''
549d_htonl=''
55954f19 550d_ilogbl=''
b4eb6b3d
JH
551d_inetaton=''
552d_int64_t=''
553d_isascii=''
758a5d79
JH
554d_isfinite=''
555d_isinf=''
b4eb6b3d
JH
556d_isnan=''
557d_isnanl=''
558d_killpg=''
559d_lchown=''
560d_ldbl_dig=''
0a0abfba 561d_libm_lib_version=''
b4eb6b3d 562d_link=''
10bc17b6 563d_localtime_r=''
8572b25d 564d_localtime_r_needs_tzset=''
10bc17b6 565localtime_r_proto=''
b4eb6b3d
JH
566d_locconv=''
567d_lockf=''
568d_longdbl=''
569longdblsize=''
570d_longlong=''
571longlongsize=''
572d_lseekproto=''
573d_lstat=''
574d_madvise=''
7dd121ae
MB
575d_malloc_good_size=''
576d_malloc_size=''
b4eb6b3d
JH
577d_mblen=''
578d_mbstowcs=''
579d_mbtowc=''
580d_memchr=''
581d_memcmp=''
582d_memcpy=''
583d_memmove=''
584d_memset=''
585d_mkdir=''
586d_mkdtemp=''
587d_mkfifo=''
588d_mkstemp=''
589d_mkstemps=''
590d_mktime=''
591d_mmap=''
592mmaptype=''
593d_modfl=''
e67aeab1 594d_modfl_pow32_bug=''
bc9a1b2c 595d_modflproto=''
b4eb6b3d
JH
596d_mprotect=''
597d_msg=''
598d_msgctl=''
599d_msgget=''
4e0554ec 600d_msghdr_s=''
b4eb6b3d
JH
601d_msgrcv=''
602d_msgsnd=''
603d_msync=''
604d_munmap=''
605d_nice=''
2765b840 606d_nl_langinfo=''
b4eb6b3d
JH
607d_off64_t=''
608d_open3=''
609d_fpathconf=''
610d_pathconf=''
611d_pause=''
612d_pipe=''
613d_poll=''
2304df62 614d_portable=''
a33c94aa 615d_procselfexe=''
f24dbf84 616procselfexe=''
b4eb6b3d
JH
617d_old_pthread_create_joinable=''
618old_pthread_create_joinable=''
d6483fcc 619d_pthread_atfork=''
58d975c3 620d_pthread_attr_setscope=''
b4eb6b3d
JH
621d_pthread_yield=''
622d_sched_yield=''
623sched_yield=''
624d_qgcvt=''
10bc17b6
JH
625d_random_r=''
626random_r_proto=''
627d_readdir64_r=''
628readdir64_r_proto=''
b4eb6b3d
JH
629d_readdir=''
630d_rewinddir=''
631d_seekdir=''
632d_telldir=''
10bc17b6
JH
633d_readdir_r=''
634readdir_r_proto=''
b4eb6b3d 635d_readlink=''
4e0554ec
JH
636d_readv=''
637d_recvmsg=''
b4eb6b3d
JH
638d_rename=''
639d_rmdir=''
640d_safebcpy=''
641d_safemcpy=''
642d_sanemcmp=''
ef9f17be 643d_sbrkproto=''
55954f19 644d_scalbnl=''
b4eb6b3d
JH
645d_select=''
646d_sem=''
647d_semctl=''
648d_semget=''
649d_semop=''
4e0554ec 650d_sendmsg=''
b4eb6b3d
JH
651d_setegid=''
652d_seteuid=''
653d_setgrent=''
10bc17b6
JH
654d_setgrent_r=''
655setgrent_r_proto=''
b4eb6b3d
JH
656d_setgrps=''
657d_sethent=''
10bc17b6
JH
658d_sethostent_r=''
659sethostent_r_proto=''
4e0554ec 660d_setitimer=''
b4eb6b3d
JH
661d_setlinebuf=''
662d_setlocale=''
10bc17b6
JH
663d_setlocale_r=''
664setlocale_r_proto=''
b4eb6b3d 665d_setnent=''
10bc17b6
JH
666d_setnetent_r=''
667setnetent_r_proto=''
b4eb6b3d
JH
668d_setpent=''
669d_setpgid=''
670d_setpgrp2=''
671d_bsdsetpgrp=''
672d_setpgrp=''
673d_setprior=''
674d_setproctitle=''
10bc17b6
JH
675d_setprotoent_r=''
676setprotoent_r_proto=''
b4eb6b3d 677d_setpwent=''
10bc17b6
JH
678d_setpwent_r=''
679setpwent_r_proto=''
b4eb6b3d
JH
680d_setregid=''
681d_setresgid=''
682d_setresuid=''
683d_setreuid=''
684d_setrgid=''
685d_setruid=''
686d_setsent=''
10bc17b6
JH
687d_setservent_r=''
688setservent_r_proto=''
b4eb6b3d
JH
689d_setsid=''
690d_setvbuf=''
691d_sfio=''
692usesfio=''
693d_shm=''
694d_shmat=''
695d_shmatprototype=''
696shmattype=''
697d_shmctl=''
698d_shmdt=''
699d_shmget=''
700d_sigaction=''
983dbef6 701d_sigprocmask=''
b4eb6b3d 702d_sigsetjmp=''
5f106f9c 703usesitecustomize=''
4f5da3e9
SP
704d_snprintf=''
705d_vsnprintf=''
49a78c82 706d_sockatmark=''
2ef53570 707d_sockatmarkproto=''
b4eb6b3d
JH
708d_msg_ctrunc=''
709d_msg_dontroute=''
710d_msg_oob=''
711d_msg_peek=''
712d_msg_proxy=''
713d_oldsock=''
714d_scm_rights=''
715d_socket=''
716d_sockpair=''
717sockethdr=''
718socketlib=''
719d_socklen_t=''
720d_socks5_init=''
360321b3 721d_sprintf_returns_strlen=''
b4eb6b3d 722d_sqrtl=''
10bc17b6
JH
723d_srand48_r=''
724srand48_r_proto=''
725d_srandom_r=''
726srandom_r_proto=''
eef837ea 727d_sresgproto=''
640374d0 728d_sresuproto=''
b4eb6b3d
JH
729d_statblks=''
730d_statfs_f_flags=''
731d_statfs_s=''
732d_fstatvfs=''
733d_statvfs=''
734d_stdio_cnt_lval=''
735d_stdio_ptr_lval=''
a7ffa9b9
NC
736d_stdio_ptr_lval_nochange_cnt=''
737d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
738d_stdiobase=''
739d_stdstdio=''
740stdio_base=''
741stdio_bufsiz=''
742stdio_cnt=''
743stdio_filbuf=''
744stdio_ptr=''
745d_index=''
746d_strchr=''
747d_strcoll=''
748d_strctcpy=''
749d_strerrm=''
750d_strerror=''
751d_sysernlst=''
752d_syserrlst=''
10bc17b6
JH
753d_strerror_r=''
754strerror_r_proto=''
b3c85772 755d_strftime=''
08c92000
MB
756d_strlcat=''
757d_strlcpy=''
b4eb6b3d
JH
758d_strtod=''
759d_strtol=''
760d_strtold=''
761d_strtoll=''
28e5dec8 762d_strtoq=''
b4eb6b3d
JH
763d_strtoul=''
764d_strtoull=''
765d_strtouq=''
766d_strxfrm=''
767d_symlink=''
768d_syscall=''
2ef53570 769d_syscallproto=''
b4eb6b3d
JH
770d_sysconf=''
771d_system=''
772d_tcgetpgrp=''
773d_tcsetpgrp=''
774d_telldirproto=''
775d_time=''
776timetype=''
777clocktype=''
778d_times=''
10bc17b6
JH
779d_tmpnam_r=''
780tmpnam_r_proto=''
b4eb6b3d 781d_truncate=''
10bc17b6
JH
782d_ttyname_r=''
783ttyname_r_proto=''
b4eb6b3d 784d_tzname=''
4e0554ec
JH
785d_u32align=''
786d_ualarm=''
b4eb6b3d
JH
787d_umask=''
788d_semctl_semid_ds=''
789d_semctl_semun=''
790d_union_semun=''
758a5d79 791d_unordered=''
bdf33aa7 792d_unsetenv=''
4e0554ec 793d_usleep=''
2ef53570 794d_usleepproto=''
b4eb6b3d
JH
795d_ustat=''
796d_vfork=''
797usevfork=''
798d_voidsig=''
799signal_t=''
800d_volatile=''
801d_charvspr=''
802d_vprintf=''
803d_wait4=''
804d_waitpid=''
805d_wcstombs=''
806d_wctomb=''
4e0554ec 807d_writev=''
b4eb6b3d 808dlext=''
85e6fe83
LW
809cccdlflags=''
810ccdlflags=''
2304df62 811dlsrc=''
232e078e 812ld=''
85e6fe83 813lddlflags=''
2304df62 814usedl=''
b4eb6b3d
JH
815doublesize=''
816ebcdic=''
817fflushNULL=''
818fflushall=''
819fpossize=''
820fpostype=''
2d736872 821gccansipedantic=''
5b463ca7 822gccosandvers=''
8a27cf78 823gccversion=''
b4eb6b3d
JH
824gidformat=''
825gidsign=''
826gidsize=''
827gidtype=''
828groupstype=''
829h_fcntl=''
830h_sysfile=''
6e1038e0
MB
831html1dir=''
832html1direxp=''
833installhtml1dir=''
834html3dir=''
835html3direxp=''
836installhtml3dir=''
b4eb6b3d 837i_arpainet=''
10bc17b6 838i_crypt=''
b4eb6b3d
JH
839db_hashtype=''
840db_prefixtype=''
640374d0
JH
841db_version_major=''
842db_version_minor=''
843db_version_patch=''
b4eb6b3d
JH
844i_db=''
845i_dbm=''
846i_rpcsvcdbm=''
847d_dirnamlen=''
848direntrytype=''
849i_dirent=''
a0d0e21e 850i_dld=''
b4eb6b3d
JH
851i_dlfcn=''
852i_fcntl=''
853i_float=''
758a5d79
JH
854i_fp=''
855i_fp_class=''
b4eb6b3d
JH
856i_gdbm=''
857d_grpasswd=''
858i_grp=''
b4eb6b3d
JH
859i_ieeefp=''
860i_inttypes=''
2765b840 861i_langinfo=''
b4eb6b3d
JH
862i_libutil=''
863i_limits=''
864i_locale=''
865i_machcthr=''
866i_malloc=''
867i_math=''
868i_memory=''
869i_mntent=''
870i_ndbm=''
871i_netdb=''
872i_neterrno=''
873i_netinettcp=''
874i_niin=''
875i_sysin=''
876i_poll=''
877i_prot=''
878i_pthread=''
879d_pwage=''
880d_pwchange=''
881d_pwclass=''
882d_pwcomment=''
883d_pwexpire=''
884d_pwgecos=''
885d_pwpasswd=''
886d_pwquota=''
887i_pwd=''
888i_sfio=''
889i_shadow=''
890i_socks=''
891i_stddef=''
892i_stdlib=''
893i_string=''
894strings=''
895i_sunmath=''
896i_sysaccess=''
897i_sysdir=''
898i_sysfile=''
899d_voidtty=''
900i_bsdioctl=''
901i_sysfilio=''
902i_sysioctl=''
903i_syssockio=''
904i_syslog=''
905i_sysmman=''
906i_sysmode=''
907i_sysmount=''
908i_sysndir=''
909i_sysparam=''
910i_sysresrc=''
911i_syssecrt=''
912i_sysselct=''
913i_sysstat=''
914i_sysstatfs=''
915i_sysstatvfs=''
916i_systimes=''
917i_systypes=''
918i_sysuio=''
919i_sysun=''
920i_sysutsname=''
921i_sysvfs=''
922i_syswait=''
923i_sgtty=''
924i_termio=''
925i_termios=''
14b90194
JH
926d_tm_tm_gmtoff=''
927d_tm_tm_zone=''
b4eb6b3d
JH
928i_systime=''
929i_systimek=''
930i_time=''
931timeincl=''
932i_unistd=''
933i_ustat=''
934i_utime=''
935i_values=''
936i_stdarg=''
937i_varargs=''
938i_varhdr=''
939i_vfork=''
f3f1a2d8 940d_inc_version_list=''
b4eb6b3d
JH
941inc_version_list=''
942inc_version_list_init=''
943installprefix=''
944installprefixexp=''
945installstyle=''
946installusrbinperl=''
947intsize=''
948longsize=''
949shortsize=''
4b661809 950issymlink=''
2304df62 951libc=''
b4eb6b3d
JH
952ldlibpthname=''
953libperl=''
954shrpenv=''
955useshrplib=''
a0d0e21e 956glibpth=''
2304df62 957libpth=''
8e07c86e 958loclibpth=''
2304df62
AD
959plibpth=''
960xlibpth=''
1cfa4ec7 961ignore_versioned_solibs=''
2304df62 962libs=''
43999f95
JH
963libsdirs=''
964libsfiles=''
965libsfound=''
13b3f787 966libspath=''
85e6fe83 967lns=''
b4eb6b3d
JH
968d_PRIEUldbl=''
969d_PRIFUldbl=''
970d_PRIGUldbl=''
971d_PRIeldbl=''
972d_PRIfldbl=''
973d_PRIgldbl=''
974d_SCNfldbl=''
975sPRIEUldbl=''
976sPRIFUldbl=''
977sPRIGUldbl=''
978sPRIeldbl=''
979sPRIfldbl=''
980sPRIgldbl=''
981sSCNfldbl=''
982lseeksize=''
983lseektype=''
d620c7b3 984mad=''
00e74f14
NC
985madlyh=''
986madlyobj=''
987madlysrc=''
f3f1a2d8
MB
988make_set_make=''
989d_mymalloc=''
990freetype=''
b4eb6b3d
JH
991mallocobj=''
992mallocsrc=''
993malloctype=''
9df442c2 994usemallocwrap=''
b4eb6b3d
JH
995usemymalloc=''
996installman1dir=''
997man1dir=''
998man1direxp=''
999man1ext=''
1000installman3dir=''
1001man3dir=''
1002man3direxp=''
1003man3ext=''
1004modetype=''
1005multiarch=''
1006mydomain=''
1007myhostname=''
1008phostname=''
2304df62
AD
1009c=''
1010n=''
b4eb6b3d
JH
1011d_eofnblk=''
1012eagain=''
1013o_nonblock=''
1014rd_nodata=''
2cc61e15 1015need_va_copy=''
b4eb6b3d
JH
1016netdb_hlen_type=''
1017netdb_host_type=''
1018netdb_name_type=''
1019netdb_net_type=''
1020groupcat=''
1021hostcat=''
1022passcat=''
1023orderlib=''
1024ranlib=''
1025d_perl_otherlibdirs=''
1026otherlibdirs=''
2304df62
AD
1027package=''
1028spackage=''
b4eb6b3d
JH
1029pager=''
1030api_revision=''
1031api_subversion=''
1032api_version=''
1033api_versionstring=''
1034patchlevel=''
151e6568 1035perl_patchlevel=''
b4eb6b3d
JH
1036revision=''
1037subversion=''
1038version=''
861eb78d 1039version_patchlevel_string=''
b4eb6b3d
JH
1040perl5=''
1041perladmin=''
1042perlpath=''
1043d_nv_preserves_uv=''
f607920a 1044d_nv_zero_is_allbits_zero=''
b4eb6b3d
JH
1045i16size=''
1046i16type=''
1047i32size=''
1048i32type=''
1049i64size=''
1050i64type=''
1051i8size=''
1052i8type=''
1053ivsize=''
1054ivtype=''
53133ed1 1055nv_preserves_uv_bits=''
b4eb6b3d
JH
1056nvsize=''
1057nvtype=''
1058u16size=''
1059u16type=''
1060u32size=''
1061u32type=''
1062u64size=''
1063u64type=''
1064u8size=''
1065u8type=''
1066uvsize=''
1067uvtype=''
1068ivdformat=''
1069nvEUformat=''
1070nvFUformat=''
1071nvGUformat=''
1072nveformat=''
1073nvfformat=''
1074nvgformat=''
1075uvXUformat=''
1076uvoformat=''
1077uvuformat=''
1078uvxformat=''
1079pidtype=''
1080prefix=''
1081prefixexp=''
1082installprivlib=''
1083privlib=''
1084privlibexp=''
1085prototype=''
1086ptrsize=''
1087d_PRIXU64=''
1088d_PRId64=''
1089d_PRIi64=''
1090d_PRIo64=''
1091d_PRIu64=''
1092d_PRIx64=''
1093sPRIXU64=''
1094sPRId64=''
1095sPRIi64=''
1096sPRIo64=''
1097sPRIu64=''
1098sPRIx64=''
1099d_quad=''
1100quadkind=''
1101quadtype=''
1102uquadtype=''
1103drand01=''
1104randbits=''
1105randfunc=''
1106randseedtype=''
1107seedfunc=''
1108installscript=''
1109scriptdir=''
1110scriptdirexp=''
1111selectminbits=''
1112selecttype=''
8ff267be 1113sh=''
b4eb6b3d
JH
1114sig_count=''
1115sig_name=''
1116sig_name_init=''
1117sig_num=''
1118sig_num_init=''
76d3c696 1119sig_size=''
f3f1a2d8 1120d_sitearch=''
b4eb6b3d
JH
1121installsitearch=''
1122sitearch=''
1123sitearchexp=''
1124installsitebin=''
1125sitebin=''
1126sitebinexp=''
8d2cbf27
JH
1127installsitehtml1dir=''
1128sitehtml1dir=''
1129sitehtml1direxp=''
1130installsitehtml3dir=''
1131sitehtml3dir=''
1132sitehtml3direxp=''
b4eb6b3d
JH
1133installsitelib=''
1134sitelib=''
1135sitelib_stem=''
1136sitelibexp=''
91e123a8
JH
1137installsiteman1dir=''
1138siteman1dir=''
1139siteman1direxp=''
1140installsiteman3dir=''
1141siteman3dir=''
1142siteman3direxp=''
b4eb6b3d
JH
1143siteprefix=''
1144siteprefixexp=''
6e1038e0
MB
1145installsitescript=''
1146sitescript=''
1147sitescriptexp=''
b4eb6b3d
JH
1148sizesize=''
1149sizetype=''
a0d0e21e 1150so=''
b4eb6b3d 1151socksizetype=''
2304df62
AD
1152sharpbang=''
1153shsharp=''
1154spitshell=''
dfe9444c 1155src=''
b4eb6b3d
JH
1156ssizetype=''
1157startperl=''
2304df62 1158startsh=''
b4eb6b3d
JH
1159stdchar=''
1160d_stdio_stream_array=''
1161stdio_stream_array=''
1162sysman=''
5ff3f7a4 1163trnl=''
b4eb6b3d
JH
1164uidformat=''
1165uidsign=''
1166uidsize=''
1167uidtype=''
1168archname64=''
1169use64bitall=''
1170use64bitint=''
15b61c98 1171usefaststdio=''
b4eb6b3d
JH
1172ccflags_uselargefiles=''
1173ldflags_uselargefiles=''
1174libswanted_uselargefiles=''
1175uselargefiles=''
1176uselongdouble=''
1177usemorebits=''
1178usemultiplicity=''
2304df62 1179nm_opt=''
40a7a20a 1180nm_so_opt=''
2304df62
AD
1181runnm=''
1182usenm=''
b4eb6b3d 1183useperlio=''
29209bc5 1184usesocks=''
b4eb6b3d
JH
1185d_oldpthreads=''
1186use5005threads=''
1187useithreads=''
9514c62b 1188usereentrant=''
b4eb6b3d 1189usethreads=''
2304df62 1190incpath=''
2304df62
AD
1191mips_type=''
1192usrinc=''
b4eb6b3d
JH
1193d_vendorarch=''
1194installvendorarch=''
1195vendorarch=''
1196vendorarchexp=''
1197d_vendorbin=''
1198installvendorbin=''
1199vendorbin=''
1200vendorbinexp=''
8d2cbf27
JH
1201installvendorhtml1dir=''
1202vendorhtml1dir=''
1203vendorhtml1direxp=''
1204installvendorhtml3dir=''
1205vendorhtml3dir=''
1206vendorhtml3direxp=''
b4eb6b3d
JH
1207d_vendorlib=''
1208installvendorlib=''
1209vendorlib=''
1210vendorlib_stem=''
1211vendorlibexp=''
91e123a8
JH
1212installvendorman1dir=''
1213vendorman1dir=''
1214vendorman1direxp=''
1215installvendorman3dir=''
1216vendorman3dir=''
1217vendorman3direxp=''
b4eb6b3d
JH
1218usevendorprefix=''
1219vendorprefix=''
1220vendorprefixexp=''
6e1038e0
MB
1221d_vendorscript=''
1222installvendorscript=''
1223vendorscript=''
1224vendorscriptexp=''
d56c5707 1225versiononly=''
b4eb6b3d
JH
1226defvoidused=''
1227voidflags=''
3659ebf1
JH
1228yacc=''
1229yaccflags=''
2304df62
AD
1230CONFIG=''
1231
ecfc5424
AD
1232define='define'
1233undef='undef'
1234smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1235rmlist=''
1236
1237: We must find out about Eunice early
1238eunicefix=':'
1239if test -f /etc/unixtovms; then
1240 eunicefix=/etc/unixtovms
1241fi
1242if test -f /etc/unixtovms.exe; then
1243 eunicefix=/etc/unixtovms.exe
1244fi
1245
cfb04860 1246: Set executable suffix now -- needed before hints available
6153ba32
PG
1247if test -f "/libs/version.library"; then
1248: Amiga OS
1249 _exe=""
1250elif test -f "/system/gnu_library/bin/ar.pm"; then
1251: Stratus VOS
cfb04860 1252 _exe=".pm"
6153ba32
PG
1253elif test -n "$DJGPP"; then
1254: DOS DJGPP
cfb04860 1255 _exe=".exe"
5c728af0 1256elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1257: OS/2 or cygwin
ba863942
JH
1258 _exe=".exe"
1259fi
868439a2 1260
b4eb6b3d 1261i_whoami=''
9da7673b
MB
1262ccname=''
1263ccversion=''
1264perllibs=''
1265: set useposix=false in your hint file to disable the POSIX extension.
1266useposix=true
1267: set useopcode=false in your hint file to disable the Opcode extension.
1268useopcode=true
1269: Trailing extension. Override this in a hint file, if needed.
1270: Extra object files, if any, needed on this platform.
1271archobjs=''
1272archname=''
ff935051
JH
1273: Possible local include directories to search.
1274: Set locincpth to "" in a hint file to defeat local include searches.
1275locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1276locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1277:
1278: no include file wanted by default
1279inclwanted=''
1280
eaf812ae
MB
1281: Enable -DEBUGGING and -DDEBUGGING from the command line
1282EBUGGING=''
1283DEBUGGING=old
1284
b4eb6b3d 1285groupstype=''
64615a5e 1286libnames=''
732c9516
JH
1287: change the next line if compiling for Xenix/286 on Xenix/386
1288xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1289: Possible local library directories to search.
1290loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1291loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1292
1293: general looking path for locating libraries
5869b1f1 1294glibpth="/lib /usr/lib $xlibpth"
732c9516 1295glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1296test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1297test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1298
1299: Private path used by Configure to find libraries. Its value
1300: is prepended to libpth. This variable takes care of special
1301: machines, like the mips. Usually, it should be empty.
1302plibpth=''
1303
1cfa4ec7
GS
1304: default library list
1305libswanted=''
921b2963 1306: some systems want to use only the non-versioned libso:s
1cfa4ec7 1307ignore_versioned_solibs=''
9da7673b
MB
1308siteman1dir=''
1309siteman3dir=''
1310sitescript=''
b4eb6b3d
JH
1311archname64=''
1312ccflags_uselargefiles=''
1313ldflags_uselargefiles=''
1314libswanted_uselargefiles=''
1315: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1316: set usesocks on the Configure command line to enable socks.
b4eb6b3d 1317: set usethreads on the Configure command line to enable threads.
cd040c5e 1318usereentrant='undef'
9da7673b
MB
1319: full support for void wanted by default
1320defvoidused=15
1321
ecfc5424 1322: List of libraries we want.
15431986 1323: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef
AB
1324libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1325libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1326: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1327: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1328glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1329glibpth="/usr/shlib $glibpth"
1330: Do not use vfork unless overridden by a hint file.
1331usevfork=false
1332
8ff267be 1333: Find the basic shell for Bourne shell scripts
1334case "$sh" in
1335'')
8ff267be 1336 case "$SYSTYPE" in
1337 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1338 *) xxx='/bin/sh';;
1339 esac
1340 if test -f "$xxx"; then
1341 sh="$xxx"
1342 else
1343 : Build up a list and do a single loop so we can 'break' out.
1344 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1345 for xxx in sh bash ksh pdksh ash; do
1346 for p in $pth; do
1347 try="$try ${p}/${xxx}"
1348 done
1349 done
1350 for xxx in $try; do
1351 if test -f "$xxx"; then
1352 sh="$xxx";
8ff267be 1353 break
a5a94ea5
JH
1354 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1355 sh="$xxx";
1356 break
8ff267be 1357 elif test -f "$xxx.exe"; then
1358 sh="$xxx";
8ff267be 1359 break
1360 fi
1361 done
1362 fi
1363 ;;
1364esac
1365
1366case "$sh" in
a33c94aa 1367'') cat >&2 <<EOM
8ff267be 1368$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1369
8ff267be 1370Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1371Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1372we'll try to straighten this all out.
8ff267be 1373EOM
1374 exit 1
1375 ;;
1376esac
1377
760ac839 1378: see if sh knows # comments
73614538 1379if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1380 shsharp=true
1381 spitshell=cat
760ac839 1382 xcat=/bin/cat
a931254c
JH
1383 test -f $xcat$_exe || xcat=/usr/bin/cat
1384 if test ! -f $xcat$_exe; then
4bdb8fb5 1385 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1386 if test -f $p/cat$_exe; then
1deb0a86 1387 xcat=$p/cat
3c728e00
JH
1388 break
1389 fi
1390 done
1deb0a86
JH
1391 if test ! -f $xcat$_exe; then
1392 echo "Can't find cat anywhere!"
3c728e00
JH
1393 exit 1
1394 fi
1395 fi
5440bc8e
JH
1396 echo "#!$xcat" >sharp
1397 $eunicefix sharp
1398 chmod +x sharp
1399 ./sharp > today
760ac839 1400 if test -s today; then
760ac839
LW
1401 sharpbang='#!'
1402 else
5440bc8e
JH
1403 echo "#! $xcat" > sharp
1404 $eunicefix sharp
1405 chmod +x sharp
1406 ./sharp > today
760ac839 1407 if test -s today; then
760ac839
LW
1408 sharpbang='#! '
1409 else
760ac839
LW
1410 sharpbang=': use '
1411 fi
1412 fi
1413else
dfe9444c 1414 echo " "
8ff267be 1415 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1416 shsharp=false
1417 cd ..
1418 echo "exec grep -v '^[ ]*#'" >spitshell
1419 chmod +x spitshell
1420 $eunicefix spitshell
1421 spitshell=`pwd`/spitshell
1422 cd UU
1423 echo "I presume that if # doesn't work, #! won't work either!"
1424 sharpbang=': use '
1425fi
5440bc8e 1426rm -f sharp today
760ac839
LW
1427
1428: figure out how to guarantee sh startup
8ff267be 1429case "$startsh" in
1430'') startsh=${sharpbang}${sh} ;;
1431*)
760ac839 1432esac
5440bc8e 1433cat >sharp <<EOSS
760ac839
LW
1434$startsh
1435set abc
1436test "$?abc" != 1
1437EOSS
1438
5440bc8e
JH
1439chmod +x sharp
1440$eunicefix sharp
1441if ./sharp; then
8ff267be 1442 : echo "Yup, it does."
760ac839 1443else
dfe9444c
AD
1444 echo "Hmm... '$startsh' does not guarantee sh startup..."
1445 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1446fi
5440bc8e 1447rm -f sharp
760ac839 1448
aebf16e7
AD
1449
1450: Save command line options in file UU/cmdline.opt for later use in
1451: generating config.sh.
1452cat > cmdline.opt <<EOSH
1453# Configure command line arguments.
1454config_arg0='$0'
1455config_args='$*'
1456config_argc=$#
1457EOSH
1458argn=1
ee45ea83
IZ
1459args_exp=''
1460args_sep=''
aebf16e7
AD
1461for arg in "$@"; do
1462 cat >>cmdline.opt <<EOSH
1463config_arg$argn='$arg'
1464EOSH
ee45ea83
IZ
1465 # Extreme backslashitis: replace each ' by '"'"'
1466 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1467$arg
1468EOC
1469 arg_exp=`cat cmdl.opt`
1470 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1471 argn=`expr $argn + 1`
ee45ea83 1472 args_sep=' '
aebf16e7 1473done
ee45ea83
IZ
1474# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1475# used by ./hints/os2.sh
1476rm -f cmdl.opt
aebf16e7 1477
2304df62
AD
1478: produce awk script to parse command line options
1479cat >options.awk <<'EOF'
1480BEGIN {
02e93a22 1481 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1482
1483 len = length(optstr);
1484 for (i = 1; i <= len; i++) {
1485 c = substr(optstr, i, 1);
1486 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1487 if (a == ":") {
1488 arg[c] = 1;
1489 i++;
1490 }
1491 opt[c] = 1;
1492 }
1493}
1494{
1495 expect = 0;
1496 str = $0;
1497 if (substr(str, 1, 1) != "-") {
1498 printf("'%s'\n", str);
1499 next;
1500 }
1501 len = length($0);
1502 for (i = 2; i <= len; i++) {
1503 c = substr(str, i, 1);
1504 if (!opt[c]) {
1505 printf("-%s\n", substr(str, i));
1506 next;
1507 }
1508 printf("-%s\n", c);
1509 if (arg[c]) {
1510 if (i < len)
1511 printf("'%s'\n", substr(str, i + 1));
1512 else
1513 expect = 1;
1514 next;
1515 }
1516 }
1517}
1518END {
1519 if (expect)
1520 print "?";
1521}
1522EOF
1523
1524: process the command line options
4633a7c4
LW
1525set X `for arg in "$@"; do echo "X$arg"; done |
1526 sed -e s/X// | awk -f options.awk`
2304df62
AD
1527eval "set $*"
1528shift
1529rm -f options.awk
1530
1531: set up default values
1532fastread=''
1533reuseval=false
1534config_sh=''
1535alldone=''
1536error=''
1537silent=''
1538extractsh=''
ecfc5424 1539override=''
16d20bd9 1540knowitall=''
02e93a22 1541rm -f optdef.sh posthint.sh
28757baa 1542cat >optdef.sh <<EOS
1543$startsh
1544EOS
2304df62 1545
dfe9444c 1546
2304df62
AD
1547: option parsing
1548while test $# -gt 0; do
1549 case "$1" in
1550 -d) shift; fastread=yes;;
1551 -e) shift; alldone=cont;;
1552 -f)
1553 shift
1554 cd ..
1555 if test -r "$1"; then
1556 config_sh="$1"
1557 else
a0d0e21e 1558 echo "$me: cannot read config file $1." >&2
2304df62
AD
1559 error=true
1560 fi
1561 cd UU
1562 shift;;
1563 -h) shift; error=true;;
1564 -r) shift; reuseval=true;;
dfe9444c 1565 -s) shift; silent=true; realsilent=true;;
2304df62 1566 -E) shift; alldone=exit;;
16d20bd9 1567 -K) shift; knowitall=true;;
ecfc5424 1568 -O) shift; override=true;;
dfe9444c 1569 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1570 -D)
1571 shift
1572 case "$1" in
1573 *=)
1574 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1575 echo "$me: ignoring -D $1" >&2
1576 ;;
ecfc5424 1577 *=*) echo "$1" | \
1aef975c
AD
1578 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1579 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1580 esac
1581 shift
1582 ;;
1583 -U)
1584 shift
1585 case "$1" in
1aef975c 1586 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1587 *=*)
1588 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1589 echo "$me: ignoring -U $1" >&2
1590 ;;
1aef975c 1591 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1592 esac
1593 shift
1594 ;;
02e93a22
JH
1595 -A)
1596 shift
1597 xxx=''
1598 yyy="$1"
02e93a22 1599 zzz=''
5f83a3e9 1600 uuu=undef
02e93a22 1601 case "$yyy" in
f7c31117 1602 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1603 case "$zzz" in
1604 *:*) zzz='' ;;
1605 *) xxx=append
f7c31117
JH
1606 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1607 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1608 esac
1609 ;;
1610 esac
1611 case "$xxx" in
1612 '') case "$yyy" in
f7c31117
JH
1613 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1614 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1615 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1616 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1617 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1618 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9
JH
1619 esac
1620 ;;
1621 esac
02e93a22
JH
1622 case "$xxx" in
1623 append)
5f83a3e9 1624 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1625 clear)
5f83a3e9 1626 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1627 define)
1628 case "$zzz" in
1629 '') zzz=define ;;
1630 esac
5f83a3e9 1631 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1632 eval)
5f83a3e9 1633 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1634 prepend)
5f83a3e9 1635 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1636 undef)
1637 case "$zzz" in
1638 '') zzz="$uuu" ;;
1639 esac
5f83a3e9
JH
1640 echo "$yyy=$zzz" >> posthint.sh ;;
1641 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1642 esac
bde6b06b 1643 shift
02e93a22 1644 ;;
dfe9444c 1645 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1646 exit 0;;
2304df62 1647 --) break;;
a0d0e21e 1648 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1649 *) break;;
1650 esac
1651done
1652
1653case "$error" in
1654true)
1655 cat >&2 <<EOM
2afac517 1656Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1657 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1658 -d : use defaults for all answers.
1659 -e : go on without questioning past the production of config.sh.
1660 -f : specify an alternate default configuration file.
1661 -h : print this help message and exit (with an error status).
1662 -r : reuse C symbols value if possible (skips costly nm extraction).
1663 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1664 -D : define symbol to have some value:
1665 -D symbol symbol gets the value 'define'
1666 -D symbol=value symbol gets the value 'value'
2304df62 1667 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1668 -K : do not use unless you know what you are doing.
ecfc5424 1669 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1670 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1671 -U : undefine symbol:
1672 -U symbol symbol gets the value 'undef'
1673 -U symbol= symbol gets completely empty
02e93a22 1674 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1675 -A symbol=value append " "value to symbol
02e93a22
JH
1676 -A append:symbol=value append value to symbol
1677 -A define:symbol=value define symbol to have value
02e93a22
JH
1678 -A clear:symbol define symbol to be ''
1679 -A define:symbol define symbol to be 'define'
1680 -A eval:symbol=value define symbol to be eval of value
1681 -A prepend:symbol=value prepend value to symbol
1682 -A undef:symbol define symbol to be 'undef'
1683 -A undef:symbol= define symbol to be ''
2304df62
AD
1684 -V : print version number and exit (with a zero status).
1685EOM
1686 exit 1
1687 ;;
1688esac
1689
dfe9444c
AD
1690: Sanity checks
1691case "$fastread$alldone" in
1692yescont|yesexit) ;;
1693*)
aaeb8e51
GS
1694 case "$extractsh" in
1695 true) ;;
1696 *)
1697 if test ! -t 0; then
1698 echo "Say 'sh Configure', not 'sh <Configure'"
1699 exit 1
1700 fi
1701 ;;
1702 esac
dfe9444c
AD
1703 ;;
1704esac
1705
2304df62
AD
1706exec 4>&1
1707case "$silent" in
1708true) exec 1>/dev/null;;
1709esac
1710
ecfc5424 1711: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1712touch optdef.sh
1713. ./optdef.sh
02e93a22
JH
1714: create the posthint manipulation script and leave the file out there...
1715touch posthint.sh
a0d0e21e 1716
2304df62 1717: set package name
85e6fe83 1718package=perl5
b4eb6b3d
JH
1719first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1720last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1721case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1722ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1723*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1724esac
2304df62 1725
2304df62
AD
1726: Some greps do not return status, grrr.
1727echo "grimblepritz" >grimble
1728if grep blurfldyick grimble >/dev/null 2>&1 ; then
1729 contains=contains
1730elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1731 contains=grep
1732else
1733 contains=contains
1734fi
1735rm -f grimble
1736: the following should work in any shell
1737case "$contains" in
1738contains*)
1739 echo " "
1740 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1741 cat >contains <<'EOSS'
1742grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1743EOSS
1744chmod +x contains
1745esac
1746
dfe9444c
AD
1747: Find the path to the source tree
1748case "$src" in
1749'') case "$0" in
b233458b
JH
1750 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1751 case "$src" in
1752 /*) ;;
8504afb7 1753 .) ;;
b233458b
JH
1754 *) src=`cd ../$src && pwd` ;;
1755 esac
1756 ;;
dfe9444c
AD
1757 *) src='.';;
1758 esac;;
1759esac
1760case "$src" in
1761'') src=/
1762 rsrc=/
1763 ;;
1764/*) rsrc="$src";;
1765*) rsrc="../$src";;
1766esac
1767if test -f $rsrc/Configure && \
1768 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1769then
1770 : found it, so we are ok.
1771else
1772 rsrc=''
1773 for src in . .. ../.. ../../.. ../../../..; do
1774 if test -f ../$src/Configure && \
1775 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1776 then
1777 rsrc=../$src
1778 break
1779 fi
1780 done
1781fi
1782case "$rsrc" in
1783'')
1784 cat <<EOM >&4
1785
1786Sorry, I can't seem to locate the source dir for $package. Please start
1787Configure with an explicit path -- i.e. /some/path/Configure.
1788
1789EOM
1790 exit 1
1791 ;;
1792../.) rsrc='..';;
1793*)
1794 echo " "
1795 echo "Sources for $package found in \"$src\"." >&4
1796 ;;
1797esac
1798
1799: script used to extract .SH files with variable substitutions
1800cat >extract <<'EOS'
a02608de 1801PERL_CONFIG_SH=true
dfe9444c 1802echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1803if test -f MANIFEST; then
1804 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1805else
1806 echo "(Looking for .SH files under the source directory.)"
6904989c 1807 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1808fi
1809shift
1810case $# in
6904989c 18110) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1812esac
6904989c 1813if test ! -f "$src/$1"; then
dfe9444c
AD
1814 shift
1815fi
1816mkdir_p='
1817name=$1;
1818create="";
1819while test $name; do
1820 if test ! -d "$name"; then
1821 create="$name $create";
1822 name=`echo $name | sed -e "s|^[^/]*$||"`;
1823 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1824 else
1825 name="";
1826 fi;
1827done;
1828for file in $create; do
1829 mkdir $file;
1830done
1831'
1832for file in $*; do
1833 case "$src" in
1834 ".")
1835 case "$file" in
1836 */*)
1837 dir=`expr X$file : 'X\(.*\)/'`
1838 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1839 (cd "$dir" && . ./$file)
dfe9444c
AD
1840 ;;
1841 *)
1842 . ./$file
1843 ;;
1844 esac
1845 ;;
1846 *)
1847 case "$file" in
1848 */*)
1849 dir=`expr X$file : 'X\(.*\)/'`
1850 file=`expr X$file : 'X.*/\(.*\)'`
1851 (set x $dir; shift; eval $mkdir_p)
6904989c 1852 sh <"$src/$dir/$file"
dfe9444c
AD
1853 ;;
1854 *)
6904989c 1855 sh <"$src/$file"
dfe9444c
AD
1856 ;;
1857 esac
1858 ;;
1859 esac
1860done
6904989c 1861if test -f "$src/config_h.SH"; then
dfe9444c
AD
1862 if test ! -f config.h; then
1863 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1864 . "$src/config_h.SH"
dfe9444c
AD
1865 fi
1866fi
1867EOS
1868
1869: extract files and exit if asked to do so
1870case "$extractsh" in
1871true)
1872 case "$realsilent" in
1873 true) ;;
1874 *) exec 1>&4;;
1875 esac
1876 case "$config_sh" in
1877 '') config_sh='config.sh';;
1878 esac
1879 echo " "
1880 echo "Fetching answers from $config_sh..."
1881 cd ..
1882 . $config_sh
1883 test "$override" && . ./optdef.sh
1884 echo " "
1885 . UU/extract
1886 rm -rf UU
24ccb310 1887 echo "Extraction done."
dfe9444c
AD
1888 exit 0
1889 ;;
1890esac
1891
1892: Eunice requires " " instead of "", can you believe it
1893echo " "
1894: Here we go...
1895echo "Beginning of configuration questions for $package."
1896
1897trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1898
2304df62
AD
1899: first determine how to suppress newline on echo command
1900echo " "
1901echo "Checking echo to see how to suppress newlines..."
1902(echo "hi there\c" ; echo " ") >.echotmp
1903if $contains c .echotmp >/dev/null 2>&1 ; then
1904 echo "...using -n."
1905 n='-n'
1906 c=''
1907else
1908 cat <<'EOM'
1909...using \c
1910EOM
1911 n=''
1912 c='\c'
1913fi
1914echo $n "The star should be here-->$c"
1915echo '*'
1916rm -f .echotmp
1917
1918: Now test for existence of everything in MANIFEST
1919echo " "
6904989c 1920if test -f "$rsrc/MANIFEST"; then
2304df62 1921 echo "First let's make sure your kit is complete. Checking..." >&4
4242830c 1922 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
2304df62 1923 rm -f missing
dfe9444c 1924 tmppwd=`pwd`
2304df62 1925 for filelist in x??; do
6904989c 1926 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1927 done
1928 if test -s missing; then
1929 cat missing >&4
1930 cat >&4 <<'EOM'
1931
1932THIS PACKAGE SEEMS TO BE INCOMPLETE.
1933
1934You have the option of continuing the configuration process, despite the
1935distinct possibility that your kit is damaged, by typing 'y'es. If you
1936do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1937and contact the author (perlbug@perl.org).
2304df62
AD
1938
1939EOM
1940 echo $n "Continue? [n] $c" >&4
1941 read ans
1942 case "$ans" in
1943 y*)
1944 echo "Continuing..." >&4
1945 rm -f missing
1946 ;;
1947 *)
1948 echo "ABORTING..." >&4
1949 kill $$
1950 ;;
1951 esac
1952 else
dfe9444c 1953 echo "Looks good..."
2304df62
AD
1954 fi
1955else
1956 echo "There is no MANIFEST file. I hope your kit is complete !"
1957fi
1958rm -f missing x??
1959
5ff3f7a4
GS
1960echo " "
1961: Find the appropriate value for a newline for tr
1962if test -n "$DJGPP"; then
1963 trnl='\012'
1964fi
1965if test X"$trnl" = X; then
1966 case "`echo foo|tr '\n' x 2>/dev/null`" in
1967 foox) trnl='\n' ;;
1968 esac
1969fi
1970if test X"$trnl" = X; then
1971 case "`echo foo|tr '\012' x 2>/dev/null`" in
1972 foox) trnl='\012' ;;
1973 esac
1974fi
1975if test X"$trnl" = X; then
8be2c24c
JH
1976 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1977 fooxy) trnl='\n\r' ;;
1978 esac
1979fi
1980if test X"$trnl" = X; then
5ff3f7a4
GS
1981 cat <<EOM >&2
1982
1983$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1984
1985EOM
1986 exit 1
1987fi
1988
2304df62
AD
1989: compute the number of columns on the terminal for proper question formatting
1990case "$COLUMNS" in
1991'') COLUMNS='80';;
1992esac
1993
1994: set up the echo used in my read
1995myecho="case \"\$xxxm\" in
1996'') echo $n \"\$rp $c\" >&4;;
1997*) case \"\$rp\" in
1998 '') echo $n \"[\$xxxm] $c\";;
1999 *)
2000 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
2001 echo \"\$rp\" >&4
2002 echo $n \"[\$xxxm] $c\" >&4
2003 else
2004 echo $n \"\$rp [\$xxxm] $c\" >&4
2005 fi
2006 ;;
2007 esac;;
2008esac"
2009
2010: now set up to do reads with possible shell escape and default assignment
2011cat <<EOSC >myread
28757baa 2012$startsh
2304df62
AD
2013xxxm=\$dflt
2014$myecho
2015ans='!'
2016case "\$fastread" in
2017yes) case "\$dflt" in
2018 '') ;;
2019 *) ans='';
2020 case "\$silent-\$rp" in
2021 true-) ;;
2022 *) echo " " >&4;;
2023 esac;;
2024 esac;;
2025*) case "\$silent" in
2026 true) case "\$rp" in
2027 '') ans='';;
2028 esac;;
2029 esac;;
2030esac
2031while expr "X\$ans" : "X!" >/dev/null; do
2032 read answ
2033 set x \$xxxm
2034 shift
dfe9444c 2035 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 2036 case "\$answ" in
dfe9444c
AD
2037 "!")
2038 sh 1>&4
2039 echo " "
2040 $myecho
2041 ;;
2042 !*)
2043 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2044 shift
2045 sh 1>&4 -c "\$*"
2046 echo " "
2047 $myecho
2048 ;;
2304df62
AD
2049 "\$ans")
2050 case "\$ans" in
ecfc5424
AD
2051 \\&*)
2052 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2053 shift
2054 case "\$1" in
2055 -d)
2056 fastread=yes
40a7a20a 2057 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2058 ;;
2059 -*)
40a7a20a 2060 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2061 ;;
2062 esac
2063 $myecho
2064 ans=!
2065 ;;
2304df62
AD
2066 esac;;
2067 *)
2068 case "\$aok" in
2069 y)
2070 echo "*** Substitution done -- please confirm."
2071 xxxm="\$ans"
c9795ab7 2072 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2073 xxxm="\$ans"
2074 ans=!
2075 ;;
2076 *)
2077 echo "*** Error -- try again."
2078 ans=!
2079 ;;
2080 esac
2081 $myecho
2082 ;;
2083 esac
2084 case "\$ans\$xxxm\$nostick" in
2085 '')
2086 ans=!
2087 $myecho
2088 ;;
2089 esac
2090done
2091case "\$ans" in
2092'') ans="\$xxxm";;
2093esac
2094EOSC
2095
2096: create .config dir to save info across Configure sessions
2097test -d ../.config || mkdir ../.config
2098cat >../.config/README <<EOF
2099This directory created by Configure to save information that should
dfe9444c 2100persist across sessions for $package.
2304df62
AD
2101
2102You may safely delete it if you wish.
2103EOF
2104
9507cadf 2105xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2106case "$usedevel" in
0107c034 2107$define|true|[yY]*) ;;
9507cadf 2108*) case "$xversion" in
0107c034
JH
2109 *[13579])
2110 cat >&4 <<EOH
2111*** WHOA THERE!!! ***
2112
2113 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2114 The version of this $package distribution is $xversion, that is, odd,
2115 (as opposed to even) and that signifies a development release.
3d5d58b1 2116 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2117
2118 Do ***NOT*** install this into production use.
2119 Data corruption and crashes are possible.
2120
2121 It is most seriously suggested that you do not continue any further
2122 unless you want to help in developing and debugging Perl.
2123
6adc6a45
JH
2124 If you *still* want to build perl, you can answer 'y' now,
2125 or pass -Dusedevel to Configure.
2126
0107c034
JH
2127EOH
2128 rp='Do you really want to continue?'
2129 dflt='n'
2130 . ./myread
2131 case "$ans" in
8feeef0e
JH
2132 [yY]) echo >&4 "Okay, continuing."
2133 usedevel="$define" ;;
0107c034
JH
2134 *) echo >&4 "Okay, bye."
2135 exit 1
2136 ;;
2137 esac
2138 ;;
2139 esac
2140 ;;
2141esac
8feeef0e
JH
2142case "$usedevel" in
2143$define|true|[yY]*)
2144 case "$versiononly" in
2145 '') versiononly="$define" ;;
2146 esac
2147 case "$installusrbinperl" in
2148 '') installusrbinperl="$undef" ;;
2149 esac
2150 ;;
2151esac
0107c034 2152
2304df62
AD
2153: general instructions
2154needman=true
2155firsttime=true
760ac839 2156user=`(logname) 2>/dev/null`
dfe9444c
AD
2157case "$user" in
2158'') user=`whoami 2>&1`;;
760ac839 2159esac
2304df62
AD
2160if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2161 firsttime=false
2162 echo " "
2163 rp='Would you like to see the instructions?'
2164 dflt=n
2165 . ./myread
2166 case "$ans" in
2167 [yY]*) ;;
2168 *) needman=false;;
2169 esac
2170fi
2171if $needman; then
2172 cat <<EOH
4e2a5f63 2173
2304df62 2174This installation shell script will examine your system and ask you questions
a0d0e21e 2175to determine how the perl5 package should be installed. If you get
2304df62
AD
2176stuck on a question, you may use a ! shell escape to start a subshell or
2177execute a command. Many of the questions will have default answers in square
2178brackets; typing carriage return will give you the default.
2179
2180On some of the questions which ask for file or directory names you are allowed
2181to use the ~name construct to specify the login directory belonging to "name",
2182even if you don't have a shell which knows about that. Questions where this is
2183allowed will be marked "(~name ok)".
2184
2185EOH
2186 rp=''
2187 dflt='Type carriage return to continue'
2188 . ./myread
2189 cat <<'EOH'
2190
2191The prompter used in this script allows you to use shell variables and
2192backticks in your answers. You may use $1, $2, etc... to refer to the words
2193in the default answer, as if the default line was a set of arguments given to a
2194script shell. This means you may also use $* to repeat the whole default line,
2195so you do not have to re-type everything to add something to the default.
2196
2197Everytime there is a substitution, you will have to confirm. If there is an
2198error (e.g. an unmatched backtick), the default answer will remain unchanged
2199and you will be prompted again.
2200
2201If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2202the questions and use the computed defaults (or the previous answers if there
2203was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2204You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2205on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2206
2207EOH
2208 . ./myread
2209 cat <<EOH
2210
2211Much effort has been expended to ensure that this shell script will run on any
2212Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2213Configure and run it again. If you can't run Configure for some reason,
2214you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2215have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2216
2217This installation script affects things in two ways:
2218
22191) it may do direct variable substitutions on some of the files included
2220 in this kit.
22212) it builds a config.h file for inclusion in C programs. You may edit
2222 any of these files as the need arises after running this script.
2223
2224If you make a mistake on a question, there is no easy way to back up to it
2225currently. The easiest thing to do is to edit config.sh and rerun all the SH
2226files. Configure will offer to let you do this before it runs the SH files.
2227
2228EOH
2229 dflt='Type carriage return to continue'
2230 . ./myread
2231 case "$firsttime" in
2232 true) echo $user >>../.config/instruct;;
2233 esac
2234fi
2235
2304df62
AD
2236: find out where common programs are
2237echo " "
2238echo "Locating common programs..." >&4
2239cat <<EOSC >loc
2240$startsh
2241case \$# in
22420) exit 1;;
2243esac
2244thing=\$1
2245shift
2246dflt=\$1
2247shift
2248for dir in \$*; do
2249 case "\$thing" in
2250 .)
2251 if test -d \$dir/\$thing; then
2252 echo \$dir
2253 exit 0
2254 fi
2255 ;;
2256 *)
a0d0e21e 2257 for thisthing in \$dir/\$thing; do
ecfc5424 2258 : just loop through to pick last item
a0d0e21e 2259 done
25f94b33 2260 if test -f \$thisthing; then
a0d0e21e 2261 echo \$thisthing
2304df62 2262 exit 0
a5a94ea5
JH
2263 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2264 echo \$thisthing
2265 exit 0
2304df62 2266 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2267 if test -n "$DJGPP"; then
2268 echo \$dir/\$thing.exe
b921d661 2269 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2270 : on Eunice apparently
2271 echo \$dir/\$thing
b921d661 2272 exit 0
c4f23d77 2273 fi
2d736872 2274 exit 0
2304df62
AD
2275 fi
2276 ;;
2277 esac
2278done
2279echo \$dflt
2280exit 1
2281EOSC
2282chmod +x loc
2283$eunicefix loc
2284loclist="
2285awk
2286cat
f8006fac 2287chmod
b4eb6b3d
JH
2288comm
2289cp
2304df62
AD
2290echo
2291expr
2292grep
a0d0e21e 2293ls
b4eb6b3d 2294mkdir
2304df62
AD
2295rm
2296sed
b4eb6b3d 2297sort
85e6fe83 2298touch
2304df62 2299tr
b4eb6b3d 2300uniq
2304df62
AD
2301"
2302trylist="
2303Mcc
dfe9444c 2304ar
3659ebf1 2305bison
b4eb6b3d 2306byacc
2304df62 2307cpp
b4eb6b3d 2308csh
2304df62
AD
2309date
2310egrep
1fef16b3 2311gmake
8ff267be 2312gzip
b4eb6b3d 2313less
8ff267be 2314ln
3c728e00 2315make
b4eb6b3d 2316more
693762b4 2317nm
b4eb6b3d
JH
2318nroff
2319pg
2304df62
AD
2320test
2321uname
8ff267be 2322zip
2304df62 2323"
8e07c86e 2324pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2325pth="$pth /lib /usr/lib"
2326for file in $loclist; do
dfe9444c
AD
2327 eval xxx=\$$file
2328 case "$xxx" in
2329 /*|?:[\\/]*)
2330 if test -f "$xxx"; then
2331 : ok
2332 else
2333 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2334 xxx=`./loc $file $file $pth`
2335 fi
2336 ;;
2337 '') xxx=`./loc $file $file $pth`;;
2338 *) xxx=`./loc $xxx $xxx $pth`;;
2339 esac
a5a94ea5 2340 eval $file=$xxx$_exe
2304df62
AD
2341 eval _$file=$xxx
2342 case "$xxx" in
2343 /*)
2344 echo $file is in $xxx.
2345 ;;
8e07c86e
AD
2346 ?:[\\/]*)
2347 echo $file is in $xxx.
2348 ;;
2304df62 2349 *)
25f94b33
AD
2350 echo "I don't know where '$file' is, and my life depends on it." >&4
2351 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2352 exit 1
2304df62
AD
2353 ;;
2354 esac
2355done
2356echo " "
2357echo "Don't worry if any of the following aren't found..."
2358say=offhand
2359for file in $trylist; do
dfe9444c
AD
2360 eval xxx=\$$file
2361 case "$xxx" in
2362 /*|?:[\\/]*)
2363 if test -f "$xxx"; then
2364 : ok
2365 else
2366 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2367 xxx=`./loc $file $file $pth`
2368 fi
2369 ;;
2370 '') xxx=`./loc $file $file $pth`;;
2371 *) xxx=`./loc $xxx $xxx $pth`;;
2372 esac
306a8474 2373 eval $file=$xxx$_exe
2304df62
AD
2374 eval _$file=$xxx
2375 case "$xxx" in
2376 /*)
2377 echo $file is in $xxx.
2378 ;;
8e07c86e
AD
2379 ?:[\\/]*)
2380 echo $file is in $xxx.
2381 ;;
2304df62
AD
2382 *)
2383 echo "I don't see $file out there, $say."
2384 say=either
2385 ;;
2386 esac
2387done
2388case "$egrep" in
1fef16b3 2389egrep)
2304df62
AD
2390 echo "Substituting grep for egrep."
2391 egrep=$grep
868439a2 2392 _egrep=$grep
2304df62
AD
2393 ;;
2394esac
8ff267be 2395case "$ln" in
1fef16b3 2396ln)
8ff267be 2397 echo "Substituting cp for ln."
2398 ln=$cp
868439a2 2399 _ln=$cp
8ff267be 2400 ;;
2401esac
2e26f1d5
JH
2402case "$make" in
2403make)
2404 case "$gmake" in
2405 gmake)
2406 echo "I can't find make or gmake, and my life depends on it." >&4
2407 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2408 exit 1
2409 ;;
2410 esac
2411 ;;
2412esac
2413case "$gmake" in
2414gmake) ;;
2415*) # We can't have osname yet.
1fef16b3
JH
2416 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2417 # Assume that gmake, if found, is definitely GNU make
2418 # and prefer it over the system make.
2419 echo "Substituting gmake for make."
2420 make=$gmake
868439a2 2421 _make=$gmake
1fef16b3
JH
2422 fi
2423 ;;
a5a94ea5 2424esac
2304df62
AD
2425case "$test" in
2426test)
2427 echo "Hopefully test is built into your sh."
2428 ;;
2429*)
73614538 2430 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2431 echo "Using the test built into your sh."
2304df62
AD
2432 test=test
2433 _test=test
2434 fi
2435 ;;
2436esac
2437case "$echo" in
2438echo)
2439 echo "Hopefully echo is built into your sh."
2440 ;;
2441'') ;;
2442*)
2443 echo " "
2444echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2445 $echo $n "hi there$c" >foo1
2446 echo $n "hi there$c" >foo2
2447 if cmp foo1 foo2 >/dev/null 2>&1; then
2448 echo "They are compatible. In fact, they may be identical."
2449 else
2450 case "$n" in
2451 '-n') n='' c='\c';;
2452 *) n='-n' c='';;
2453 esac
2454 cat <<FOO
2455They are not compatible! You are probably running ksh on a non-USG system.
2456I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2457have echo built in and we may have to run some Bourne shell scripts. That
2458means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2459
2460FOO
2461 $echo $n "The star should be here-->$c"
2462 $echo "*"
2463 fi
2464 $rm -f foo1 foo2
2465 ;;
2466esac
2467
6b769f8f 2468cat <<EOS >trygcc
2573c5f9
JH
2469$startsh
2470EOS
6b769f8f 2471cat <<'EOSC' >>trygcc
2573c5f9
JH
2472case "$cc" in
2473'') ;;
2474*) $rm -f try try.*
2475 $cat >try.c <<EOM
2476int main(int argc, char *argv[]) {
2477 return 0;
2478}
2479EOM
e4778687 2480 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2481 :
2482 else
2483 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2484 despair=yes
2485 trygcc=yes
2486 case "$cc" in
2487 *gcc*) trygcc=no ;;
2488 esac
2489 case "`$cc -v -c try.c 2>&1`" in
2490 *gcc*) trygcc=no ;;
2491 esac
2492 if $test X"$trygcc" = Xyes; then
2493 if gcc -o try -c try.c; then
2494 echo " "
2495 echo "You seem to have a working gcc, though." >&4
2496 rp="Would you like to use it?"
2497 dflt=y
2498 if $test -f myread; then
2499 . ./myread
2500 else
2501 if $test -f UU/myread; then
2502 . ./UU/myread
2503 else
2504 echo "Cannot find myread, sorry. Aborting." >&2
2505 exit 1
2506 fi
2507 fi
2508 case "$ans" in
6371411c
RB
2509 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2510 if $test -f usethreads.cbu; then
2511 $cat >&4 <<EOM
2512
2513*** However, any setting of the C compiler flags (e.g. for thread support)
2514*** has been lost. It may be necessary to pass -Dcc=gcc to Configure
2515*** (together with e.g. -Dusethreads).
2516
2517EOM
2518 fi;;
2573c5f9
JH
2519 esac
2520 fi
2521 fi
6b769f8f
RB
2522 fi
2523 $rm -f try try.*
2524 ;;
2525esac
2526EOSC
2527
2528cat <<EOS >checkcc
2529$startsh
2530EOS
2531cat <<'EOSC' >>checkcc
2532case "$cc" in
2533'') ;;
2534*) $rm -f try try.*
2535 $cat >try.c <<EOM
2536int main(int argc, char *argv[]) {
2537 return 0;
2538}
2539EOM
2540 if $cc -o try $ccflags $ldflags try.c; then
2541 :
2542 else
2573c5f9 2543 if $test X"$despair" = Xyes; then
6b769f8f
RB
2544 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2545 fi
2546 $cat >&4 <<EOM
5dd4fbdf
MB
2547You need to find a working C compiler.
2548Either (purchase and) install the C compiler supplied by your OS vendor,
2549or for a free C compiler try http://gcc.gnu.org/
2550I cannot continue any further, aborting.
2551EOM
6b769f8f 2552 exit 1
2573c5f9
JH
2553 fi
2554 $rm -f try try.*
2555 ;;
2556esac
2557EOSC
2558
a0d0e21e
LW
2559: determine whether symbolic links are supported
2560echo " "
2561$touch blurfl
2562if $ln -s blurfl sym > /dev/null 2>&1 ; then
2563 echo "Symbolic links are supported." >&4
818f00be 2564 lns="$ln -s"
a0d0e21e
LW
2565else
2566 echo "Symbolic links are NOT supported." >&4
2567 lns="$ln"
2568fi
2569$rm -f blurfl sym
2570
dafca956
JH
2571: determine whether symbolic links are supported
2572echo " "
2573case "$lns" in
18ea2752 2574*"ln"*" -s")
dafca956
JH
2575 echo "Checking how to test for symbolic links..." >&4
2576 $lns blurfl sym
4b661809 2577 if $test "X$issymlink" = X; then
2e2a97a6
JH
2578 case "$newsh" in
2579 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2580 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2581 esac
5d644a95
MB
2582 if test $? = 0; then
2583 issymlink="test -h"
2e2a97a6
JH
2584 else
2585 echo "Your builtin 'test -h' may be broken." >&4
2586 case "$test" in
2587 /*) ;;
2588 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2589 for p in $pth
2590 do
2591 if test -f "$p/$test"; then
2592 test="$p/$test"
2593 break
2594 fi
2595 done
2596 ;;
2597 esac
2598 case "$test" in
2599 /*)
2600 echo "Trying external '$test -h'." >&4
2601 issymlink="$test -h"
2602 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2603 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2604 issymlink=''
2605 fi
2606 ;;
2607 *) issymlink='' ;;
2608 esac
5d644a95
MB
2609 fi
2610 fi
4b661809 2611 if $test "X$issymlink" = X; then
dafca956 2612 if $test -L sym 2>/dev/null; then
5d644a95 2613 issymlink="$test -L"
2e2a97a6 2614 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2615 fi
2616 fi
4b661809 2617 if $test "X$issymlink" != X; then
5d644a95 2618 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2619 else
2620 echo "I do not know how you can test for symbolic links." >&4
2621 fi
2622 $rm -f blurfl sym
2623 ;;
2624*) echo "No symbolic links, so not testing for their testing..." >&4
2625 ;;
2626esac
2627echo " "
2628
2629
2630case "$mksymlinks" in
2631$define|true|[yY]*)
2632 case "$src" in
2633 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2634 exit 1
2635 ;;
4b661809 2636 *) case "$lns:$issymlink" in
f314eb9f 2637 *"ln"*" -s:"*"test -"?)
dafca956
JH
2638 echo "Creating the symbolic links..." >&4
2639 echo "(First creating the subdirectories...)" >&4
2640 cd ..
2641 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2642 read directory
2643 test -z "$directory" && break
2644 mkdir -p $directory
2645 done
2646 # Sanity check 1.
2647 if test ! -d t/base; then
2648 echo "Failed to create the subdirectories. Aborting." >&4
2649 exit 1
2650 fi
2651 echo "(Then creating the symlinks...)" >&4
2652 awk '{print $1}' $src/MANIFEST | while true; do
2653 read filename
2654 test -z "$filename" && break
2655 if test -f $filename; then
5d644a95 2656 if $issymlink $filename; then
dafca956
JH
2657 rm -f $filename
2658 fi
2659 fi
2660 if test -f $filename; then
2661 echo "$filename already exists, not symlinking."
2662 else
2663 ln -s $src/$filename $filename
2664 fi
2665 done
2666 # Sanity check 2.
a0d24b8a
JH
2667 if test ! -f t/base/lex.t; then
2668 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2669 exit 1
2670 fi
2671 cd UU
2672 ;;
2673 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2674 ;;
2675 esac
2676 ;;
2677 esac
2678 ;;
2679esac
2680
5440bc8e
JH
2681
2682case "$usecrosscompile" in
2683$define|true|[yY]*)
93bc48fa 2684 $echo "Cross-compiling..."
5440bc8e
JH
2685 croak=''
2686 case "$cc" in
2687 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2688 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2689 ar=$targetarch-ar
2690 # leave out ld, choosing it is more complex
2691 nm=$targetarch-nm
2692 ranlib=$targetarch-ranlib
93bc48fa 2693 $echo 'extern int foo;' > try.c
f8006fac 2694 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2695 shift
2696 if $test $# -gt 0; then
2697 incpth="$incpth $*"
f8006fac
JH
2698 incpth="`$echo $incpth|$sed 's/^ //'`"
2699 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2700 for i in $*; do
f8006fac 2701 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2702 if $test -d $j; then
2703 libpth="$libpth $j"
2704 fi
2705 done
f8006fac
JH
2706 libpth="`$echo $libpth|$sed 's/^ //'`"
2707 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2708 fi
2709 $rm -f try.c
5440bc8e
JH
2710 ;;
2711 esac
2712 case "$targetarch" in
93bc48fa
JH
2713 '') echo "Targetarch not defined." >&4; croak=y ;;
2714 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2715 esac
2716 case "$incpth" in
93bc48fa 2717 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2718 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2719 esac
2720 case "$libpth" in
93bc48fa 2721 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2722 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2723 esac
93bc48fa
JH
2724 case "$usrinc" in
2725 '') for i in $incpth; do
2726 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2727 usrinc=$i
2728 echo "Guessing usrinc $usrinc." >&4
2729 break
2730 fi
2731 done
2732 case "$usrinc" in
2733 '') echo "Usrinc not defined." >&4; croak=y ;;
2734 esac
2735 ;;
2736 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2737 esac
93bc48fa
JH
2738 case "$targethost" in
2739 '') echo "Targethost not defined." >&4; croak=y ;;
2740 *) echo "Using targethost $targethost." >&4
5440bc8e 2741 esac
93bc48fa
JH
2742 locincpth=' '
2743 loclibpth=' '
5440bc8e 2744 case "$croak" in
93bc48fa 2745 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2746 esac
2747 case "$src" in
2748 /*) run=$src/Cross/run
93c0359c 2749 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2750 to=$src/Cross/to
2751 from=$src/Cross/from
2752 ;;
93bc48fa 2753 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2754 run=$pwd/Cross/run
f8006fac 2755 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2756 to=$pwd/Cross/to
2757 from=$pwd/Cross/from
2758 ;;
2759 esac
2760 case "$targetrun" in
2761 '') targetrun=ssh ;;
2762 esac
2763 case "$targetto" in
2764 '') targetto=scp ;;
2765 esac
2766 case "$targetfrom" in
2767 '') targetfrom=scp ;;
2768 esac
2769 run=$run-$targetrun
2770 to=$to-$targetto
2771 from=$from-$targetfrom
93bc48fa
JH
2772 case "$targetdir" in
2773 '') targetdir=/tmp
2774 echo "Guessing targetdir $targetdir." >&4
2775 ;;
2776 esac
5440bc8e 2777 case "$targetuser" in
93bc48fa
JH
2778 '') targetuser=root
2779 echo "Guessing targetuser $targetuser." >&4
2780 ;;
5440bc8e
JH
2781 esac
2782 case "$targetfrom" in
2783 scp) q=-q ;;
2784 *) q='' ;;
2785 esac
2786 case "$targetrun" in
2787 ssh|rsh)
2788 cat >$run <<EOF
2789#!/bin/sh
93c0359c
JH
2790case "\$1" in
2791-cwd)
2792 shift
2793 cwd=\$1
2794 shift
2795 ;;
2796esac
2797case "\$cwd" in
2798'') cwd=$targetdir ;;
2799esac
5440bc8e
JH
2800exe=\$1
2801shift
93c0359c
JH
2802if $test ! -f \$exe.xok; then
2803 $to \$exe
2804 $touch \$exe.xok
2805fi
2806$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2807EOF
2808 ;;
93bc48fa 2809 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2810 exit 1
2811 ;;
2812 esac
93c0359c
JH
2813 case "$targetmkdir" in
2814 */Cross/mkdir)
2815 cat >$targetmkdir <<EOF
2816#!/bin/sh
2817$targetrun -l $targetuser $targethost "mkdir -p \$@"
2818EOF
f8006fac 2819 $chmod a+rx $targetmkdir
93c0359c
JH
2820 ;;
2821 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2822 exit 1
2823 ;;
2824 esac
5440bc8e
JH
2825 case "$targetto" in
2826 scp|rcp)
2827 cat >$to <<EOF
2828#!/bin/sh
2829for f in \$@
2830do
93c0359c
JH
2831 case "\$f" in
2832 /*)
2833 $targetmkdir \`dirname \$f\`
2834 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2835 ;;
2836 *)
2837 $targetmkdir $targetdir/\`dirname \$f\`
2838 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2839 ;;
2840 esac
5440bc8e
JH
2841done
2842exit 0
2843EOF
2844 ;;
2845 cp) cat >$to <<EOF
2846#!/bin/sh
93c0359c
JH
2847for f in \$@
2848do
2849 case "\$f" in
2850 /*)
2851 $mkdir -p $targetdir/\`dirname \$f\`
2852 $cp \$f $targetdir/\$f || exit 1
2853 ;;
2854 *)
2855 $targetmkdir $targetdir/\`dirname \$f\`
2856 $cp \$f $targetdir/\$f || exit 1
2857 ;;
2858 esac
2859done
2860exit 0
5440bc8e
JH
2861EOF
2862 ;;
93bc48fa 2863 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2864 exit 1
2865 ;;
2866 esac
2867 case "$targetfrom" in
2868 scp|rcp)
2869 cat >$from <<EOF
2870#!/bin/sh
2871for f in \$@
2872do
93c0359c 2873 $rm -f \$f
5440bc8e
JH
2874 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2875done
2876exit 0
2877EOF
2878 ;;
2879 cp) cat >$from <<EOF
2880#!/bin/sh
2881for f in \$@
2882do
93c0359c 2883 $rm -f \$f
5440bc8e
JH
2884 cp $targetdir/\$f . || exit 1
2885done
2886exit 0
2887EOF
2888 ;;
93bc48fa 2889 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2890 exit 1
2891 ;;
2892 esac
93bc48fa
JH
2893 if $test ! -f $run; then
2894 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2895 else
f8006fac 2896 $chmod a+rx $run
5440bc8e 2897 fi
93bc48fa
JH
2898 if $test ! -f $to; then
2899 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2900 else
f8006fac 2901 $chmod a+rx $to
5440bc8e 2902 fi
93bc48fa
JH
2903 if $test ! -f $from; then
2904 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2905 else
f8006fac 2906 $chmod a+rx $from
5440bc8e 2907 fi
93bc48fa 2908 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2909 exit 1
2910 fi
2911 cat >&4 <<EOF
f8006fac
JH
2912Using '$run' for remote execution,
2913and '$from' and '$to'
93bc48fa 2914for remote file transfer.
5440bc8e
JH
2915EOF
2916 ;;
2917*) run=''
2918 to=:
2919 from=:
2920 usecrosscompile='undef'
2921 targetarch=''
2922 ;;
2923esac
2924
ecfc5424
AD
2925: see whether [:lower:] and [:upper:] are supported character classes
2926echo " "
ecfc5424
AD
2927case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2928ABYZ)
2929 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2930 up='[:upper:]'
2931 low='[:lower:]'
2932 ;;
416d0bea
MB
2933*) # There is a discontinuity in EBCDIC between 'R' and 'S'
2934 # (0xd9 and 0xe2), therefore that is a nice testing point.
2935 if test "X$up" = X -o "X$low" = X; then
2936 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2937 rs) up='[A-Z]'
2938 low='[a-z]'
28e8609d
JH
2939 ;;
2940 esac
416d0bea 2941 fi
28e8609d 2942 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2943 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2944 rs) up='A-Z'
28e8609d
JH
2945 low='a-z'
2946 ;;
2947 esac
416d0bea 2948 fi
28e8609d 2949 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2950 case "`echo RS | od -x 2>/dev/null`" in
2951 *D9E2*|*d9e2*)
28e8609d
JH
2952 echo "Hey, this might be EBCDIC." >&4
2953 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2954 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2955 rs) up='[A-IJ-RS-Z]'
2956 low='[a-ij-rs-z]'
28e8609d
JH
2957 ;;
2958 esac
2959 fi
2960 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2961 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2962 rs) up='A-IJ-RS-Z'
2963 low='a-ij-rs-z'
28e8609d
JH
2964 ;;
2965 esac
2966 fi
2967 ;;
2968 esac
2969 fi
2970esac
416d0bea
MB
2971case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2972rs)
28e8609d
JH
2973 echo "Using $up and $low to convert case." >&4
2974 ;;
ecfc5424 2975*)
28e8609d
JH
2976 echo "I don't know how to translate letters from upper to lower case." >&4
2977 echo "Your tr is not acting any way I know of." >&4
2978 exit 1
2979 ;;
ecfc5424
AD
2980esac
2981: set up the translation script tr, must be called with ./tr of course
2982cat >tr <<EOSC
2983$startsh
2984case "\$1\$2" in
2985'[A-Z][a-z]') exec $tr '$up' '$low';;
2986'[a-z][A-Z]') exec $tr '$low' '$up';;
2987esac
2988exec $tr "\$@"
2989EOSC
2990chmod +x tr
2991$eunicefix tr
2992
2304df62
AD
2993: Try to determine whether config.sh was made on this system
2994case "$config_sh" in
2995'')
43999f95
JH
2996myuname=`$uname -a 2>/dev/null`
2997$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2998# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2999# because the A-Z/a-z are not consecutive.
a0d0e21e 3000myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 3001 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 3002newmyuname="$myuname"
2304df62 3003dflt=n
16d20bd9
AD
3004case "$knowitall" in
3005'')
3006 if test -f ../config.sh; then
3007 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3008 eval "`grep myuname= ../config.sh`"
3009 fi
3010 if test "X$myuname" = "X$newmyuname"; then
3011 dflt=y
3012 fi
2304df62 3013 fi
16d20bd9
AD
3014 ;;
3015*) dflt=y;;
3016esac
2304df62
AD
3017
3018: Get old answers from old config file if Configure was run on the
3019: same system, otherwise use the hints.
3020hint=default
3021cd ..
3022if test -f config.sh; then
16d20bd9
AD
3023 echo " "
3024 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
3025 . UU/myread
3026 case "$ans" in
f83701cd
AD
3027 n*|N*) echo "OK, I'll ignore it."
3028 mv config.sh config.sh.old
3029 myuname="$newmyuname"
3030 ;;
2304df62 3031 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
3032 tmp_n="$n"
3033 tmp_c="$c"
85cad39c 3034 tmp_sh="$sh"
2304df62
AD
3035 . ./config.sh
3036 cp config.sh UU
ecfc5424
AD
3037 n="$tmp_n"
3038 c="$tmp_c"
85cad39c 3039 : Older versions did not always set $sh. Catch re-use of such
3040 : an old config.sh.
3041 case "$sh" in
3042 '') sh="$tmp_sh" ;;
3043 esac
2304df62
AD
3044 hint=previous
3045 ;;
3046 esac
3047fi
2573c5f9 3048. ./UU/checkcc
2304df62
AD
3049if test ! -f config.sh; then
3050 $cat <<EOM
3051
4e2a5f63
AD
3052First time through, eh? I have some defaults handy for some systems
3053that need some extra help getting the Configure answers right:
2304df62
AD
3054
3055EOM
dfe9444c 3056 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3057 dflt=''
3058 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3059 : tests or hints, please send them to perlbug@perl.org
2304df62 3060 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3061 $test -f /irix && osname=irix
85e6fe83
LW
3062 $test -f /xenix && osname=sco_xenix
3063 $test -f /dynix && osname=dynix
3064 $test -f /dnix && osname=dnix
5f05dabc 3065 $test -f /lynx.os && osname=lynxos
3066 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3067 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3068 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3069 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3070 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3071 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3072 $test -d /usr/apollo/bin && osname=apollo
3073 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3074 $test -d /usr/include/minix && osname=minix
d54344fc 3075 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3076 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3077 osname=machten
4633a7c4 3078 if $test -x /sbin/version; then
dfe9444c 3079 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3080 $sed -e 's/[A-Za-z]$//'`
3081 elif $test -x /usr/etc/version; then
dfe9444c 3082 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3083 $sed -e 's/[A-Za-z]$//'`
3084 else
3085 osvers="$2.$3"
3086 fi
3087 fi
aaacdc8b
GS
3088
3089 $test -f /sys/posix.dll &&
3090 $test -f /usr/bin/what &&
3091 set X `/usr/bin/what /sys/posix.dll` &&
3092 $test "$3" = UWIN &&
3093 osname=uwin &&
3094 osvers="$5"
3095
2304df62
AD
3096 if $test -f $uname; then
3097 set X $myuname
3098 shift
3099
2304df62 3100 case "$5" in
85e6fe83 3101 fps*) osname=fps ;;
2304df62
AD
3102 mips*)
3103 case "$4" in
85e6fe83
LW
3104 umips) osname=umips ;;
3105 *) osname=mips ;;
2304df62 3106 esac;;
85e6fe83
LW
3107 [23]100) osname=mips ;;
3108 next*) osname=next ;;
ecfc5424 3109 i386*)
c6912327
JH
3110 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3111 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3112 osname='sco'
3113 osvers=$tmp
3114 elif $test -f /etc/kconfig; then
ecfc5424 3115 osname=isc
bd628c73 3116 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3117 osvers=4
3118 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3119 osvers=3
2304df62 3120 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3121 osvers=2
ecfc5424
AD
3122 fi
3123 fi
2000072c 3124 tmp=''
ecfc5424 3125 ;;
c4f23d77
AD
3126 pc*)
3127 if test -n "$DJGPP"; then
3128 osname=dos
3129 osvers=djgpp
3130 fi
3131 ;;
2304df62
AD
3132 esac
3133
3134 case "$1" in
a0d0e21e
LW
3135 aix) osname=aix
3136 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3137 case "$tmp" in
e81c5c2a
NC
3138 # oslevel can fail with:
3139 # oslevel: Unable to acquire lock.
3140 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3141 '<3240'|'<>3240') osvers=3.2.0 ;;
3142 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3143 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3144 *) osvers=$tmp;;
a0d0e21e
LW
3145 esac
3146 ;;
aaacdc8b
GS
3147 bsd386) osname=bsd386
3148 osvers=`$uname -r`
3149 ;;
3150 cygwin*) osname=cygwin
3151 osvers="$3"
3152 ;;
23f87696
SZ
3153 *dc.osx) osname=dcosx
3154 osvers="$3"
3155 ;;
a0d0e21e
LW
3156 dnix) osname=dnix
3157 osvers="$3"
3158 ;;
3159 domainos) osname=apollo
3160 osvers="$3"
3161 ;;
a774dfe6
RSG
3162 dgux) osname=dgux
3163 osvers="$3"
3164 ;;
3165 dragonfly) osname=dragonfly
a0d0e21e
LW
3166 osvers="$3"
3167 ;;
760ac839 3168 dynixptx*) osname=dynixptx
e58e581d 3169 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3170 ;;
a774dfe6 3171 freebsd) osname=freebsd
a0d0e21e 3172 osvers="$3" ;;
761ee4e8
BD
3173 genix) osname=genix ;;
3174 gnu) osname=gnu
3175 osvers="$3" ;;
a774dfe6 3176 hp*) osname=hpux
bfb7748a 3177 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3178 ;;
761ee4e8 3179 irix*) osname=irix
a0d0e21e
LW
3180 case "$3" in
3181 4*) osvers=4 ;;
3182 5*) osvers=5 ;;
ecfc5424 3183 *) osvers="$3" ;;
a0d0e21e
LW
3184 esac
3185 ;;
761ee4e8 3186 linux) osname=linux
a0d0e21e 3187 case "$3" in
a0d0e21e
LW
3188 *) osvers="$3" ;;
3189 esac
3190 ;;
761ee4e8 3191 MiNT) osname=mint
28e8609d
JH
3192 ;;
3193 netbsd*) osname=netbsd
ecfc5424
AD
3194 osvers="$3"
3195 ;;
4e81affe
MM
3196 news-os) osvers="$3"
3197 case "$3" in
3198 4*) osname=newsos4 ;;
3199 *) osname=newsos ;;
3200 esac
3201 ;;
aaacdc8b 3202 next*) osname=next ;;
28bb1e2c 3203 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3204 openbsd) osname=openbsd
3205 osvers="$3"
3206 ;;
5c728af0
IZ
3207 os2) osname=os2
3208 osvers="$4"
3209 ;;
aaacdc8b
GS
3210 POSIX-BC | posix-bc ) osname=posix-bc
3211 osvers="$3"
a0d0e21e 3212 ;;
ae3afa4e
TH
3213 powerux | power_ux | powermax_os | powermaxos | \
3214 powerunix | power_unix) osname=powerux
3215 osvers="$3"
3216 ;;
aaacdc8b
GS
3217 qnx) osname=qnx
3218 osvers="$4"
3219 ;;
a0d0e21e
LW
3220 solaris) osname=solaris
3221 case "$3" in
3222 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3223 *) osvers="$3" ;;
a0d0e21e
LW
3224 esac
3225 ;;
85e6fe83
LW
3226 sunos) osname=sunos
3227 case "$3" in
85e6fe83
LW
3228 5*) osname=solaris
3229 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3230 *) osvers="$3" ;;
2304df62
AD
3231 esac
3232 ;;
a0d0e21e 3233 titanos) osname=titanos
85e6fe83 3234 case "$3" in
a0d0e21e
LW
3235 1*) osvers=1 ;;
3236 2*) osvers=2 ;;
3237 3*) osvers=3 ;;
3238 4*) osvers=4 ;;
ecfc5424 3239 *) osvers="$3" ;;
2304df62
AD
3240 esac
3241 ;;
85e6fe83 3242 ultrix) osname=ultrix
ecfc5424 3243 osvers="$3"
2304df62 3244 ;;
28757baa 3245 osf1|mls+) case "$5" in
fed7345c
AD
3246 alpha)
3247 osname=dec_osf
fdd85a03 3248 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3249 case "$osvers" in
3250 [1-9].[0-9]*) ;;
3251 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3252 esac
ecfc5424
AD
3253 ;;
3254 hp*) osname=hp_osf1 ;;
3255 mips) osname=mips_osf1 ;;
85e6fe83
LW
3256 esac
3257 ;;
af1ff193 3258 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3259 openunix|unixware) osname=svr5
0337d152
BG
3260 osvers="$4"
3261 ;;
3c728e00 3262 uts) osname=uts
a0d0e21e
LW
3263 osvers="$3"
3264 ;;
3c728e00
JH
3265 vos) osvers="$3"
3266 ;;
85e6fe83 3267 $2) case "$osname" in
2304df62 3268 *isc*) ;;
a0d0e21e 3269 *freebsd*) ;;
5f05dabc 3270 svr*)
a0d0e21e 3271 : svr4.x or possibly later
a774dfe6 3272 case "svr$3" in
a0d0e21e
LW
3273 ${osname}*)
3274 osname=svr$3
3275 osvers=$4
3276 ;;
3277 esac
3278 case "$osname" in
3279 svr4.0)
3280 : Check for ESIX
3281 if test -f /stand/boot ; then
3282 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3283 if test -n "$INITPROG" -a -f "$INITPROG"; then
3284 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3285 if test -n "$isesix"; then
a0d0e21e
LW
3286 osname=esix4
3287 fi
3288 fi
3289 fi
3290 ;;
3291 esac
3292 ;;
2304df62 3293 *) if test -f /etc/systemid; then
a0d0e21e
LW
3294 osname=sco
3295 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3296 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3297 osvers=$1.$2.$3
c4f23d77 3298 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3299 osvers=$1.$2
c4f23d77 3300 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3301 osvers=$1
2304df62 3302 fi
a0d0e21e
LW
3303 else
3304 case "$osname" in
3305 '') : Still unknown. Probably a generic Sys V.
3306 osname="sysv"
3307 osvers="$3"
3308 ;;
3309 esac
2304df62
AD
3310 fi
3311 ;;
3312 esac
3313 ;;
a0d0e21e
LW
3314 *) case "$osname" in
3315 '') : Still unknown. Probably a generic BSD.
3316 osname="$1"
3317 osvers="$3"
3318 ;;
3319 esac
3320 ;;
2304df62
AD
3321 esac
3322 else
dfe9444c
AD
3323 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3324 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3325 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3326 osname=news_os
2304df62 3327 fi
dfe9444c 3328 $rm -f UU/kernel.what
5c728af0 3329 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3330 set X $myuname
3331 osname=os2
3332 osvers="$5"
2304df62
AD
3333 fi
3334 fi
a774dfe6 3335
5440bc8e
JH
3336 case "$targetarch" in
3337 '') ;;
3338 *) hostarch=$osname
3339 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3340 osvers=''
3341 ;;
3342 esac
3343
a0d0e21e
LW
3344 : Now look for a hint file osname_osvers, unless one has been
3345 : specified already.
3346 case "$hintfile" in
3347 ''|' ')
1e127011 3348 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3349 : Also try without trailing minor version numbers.
1e127011
DD
3350 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3351 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3352 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3353 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3354 case "$file" in
3355 '') dflt=none ;;
3356 *) case "$osvers" in
3357 '') dflt=$file
3358 ;;
dfe9444c 3359 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3360 dflt=$file
dfe9444c 3361 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3362 dflt=$xfile
dfe9444c 3363 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3364 dflt=$xxfile
dfe9444c 3365 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3366 dflt=$xxxfile
dfe9444c 3367 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3368 dflt=$xxxxfile
dfe9444c 3369 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3370 dflt="${osname}"
3371 else
3372 dflt=none
3373 fi
3374 ;;
3375 esac
85e6fe83
LW
3376 ;;
3377 esac
4e2a5f63
AD
3378 if $test -f Policy.sh ; then
3379 case "$dflt" in
3380 *Policy*) ;;
3381 none) dflt="Policy" ;;
3382 *) dflt="Policy $dflt" ;;
3383 esac
3384 fi
85e6fe83 3385 ;;
a0d0e21e 3386 *)
ecfc5424 3387 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3388 ;;
2304df62 3389 esac
1aef975c 3390
4e2a5f63
AD
3391 if $test -f Policy.sh ; then
3392 $cat <<EOM
3393
3394There's also a Policy hint file available, which should make the
3395site-specific (policy) questions easier to answer.
3396EOM
3397
3398 fi
3399
2304df62
AD
3400 $cat <<EOM
3401
3402You may give one or more space-separated answers, or "none" if appropriate.
a2d23ec2
MB
3403If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3404previous run of Configure, you may specify it as well as or instead of
3405OS-specific hints. If hints are provided for your OS, you should use them:
3406although Perl can probably be built without hints on many platforms, using
3407hints often improve performance and may enable features that Configure can't
3408set up on its own. If there are no hints that match your OS, specify "none";
3409DO NOT give a wrong version or a wrong OS.
2304df62
AD
3410
3411EOM
4e2a5f63 3412
2304df62 3413 rp="Which of these apply, if any?"
dfe9444c 3414 . UU/myread
85e6fe83
LW
3415 tans=$ans
3416 for file in $tans; do
4e2a5f63
AD
3417 if $test X$file = XPolicy -a -f Policy.sh; then
3418 . Policy.sh
3419 $cat Policy.sh >> UU/config.sh
3420 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3421 . $src/hints/$file.sh
3422 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3423 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3424 : nothing
3425 else
85e6fe83
LW
3426 : Give one chance to correct a possible typo.
3427 echo "$file.sh does not exist"
3428 dflt=$file
3429 rp="hint to use instead?"
dfe9444c 3430 . UU/myread
85e6fe83 3431 for file in $ans; do
dfe9444c
AD
3432 if $test -f "$src/hints/$file.sh"; then
3433 . $src/hints/$file.sh
3434 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3435 elif $test X$ans = X -o X$ans = Xnone ; then
3436 : nothing
3437 else
3438 echo "$file.sh does not exist -- ignored."
3439 fi
3440 done
2304df62
AD
3441 fi
3442 done
85e6fe83 3443
2304df62 3444 hint=recommended
85e6fe83 3445 : Remember our hint file for later.
dfe9444c 3446 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3447 hintfile="$file"
85e6fe83 3448 else
a0d0e21e 3449 hintfile=''
85e6fe83 3450 fi
2304df62
AD
3451fi
3452cd UU
3453;;
3454*)
3455 echo " "
3456 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3457 tmp_n="$n"
3458 tmp_c="$c"
2304df62
AD
3459 cd ..
3460 cp $config_sh config.sh 2>/dev/null
a78b0d02 3461 chmod +w config.sh
2304df62
AD
3462 . ./config.sh
3463 cd UU
3464 cp ../config.sh .
ecfc5424
AD
3465 n="$tmp_n"
3466 c="$tmp_c"
2304df62
AD
3467 hint=previous
3468 ;;
3469esac
1aef975c 3470test "$override" && . ./optdef.sh
2304df62
AD
3471
3472: Restore computed paths
3473for file in $loclist $trylist; do
3474 eval $file="\$_$file"
3475done
3476
85e6fe83 3477cat << EOM
a0d0e21e 3478
85e6fe83 3479Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3480The default value is probably right if the name rings a bell. Otherwise,
3481since spelling matters for me, either accept the default or answer "none"
3482to leave it blank.
a0d0e21e 3483
85e6fe83 3484EOM
85e6fe83 3485case "$osname" in
a0d0e21e 3486 ''|' ')
85e6fe83 3487 case "$hintfile" in
a0d0e21e 3488 ''|' '|none) dflt=none ;;
ecfc5424 3489 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3490 esac
3491 ;;
3492 *) dflt="$osname" ;;
3493esac
3494rp="Operating system name?"
3495. ./myread
3496case "$ans" in
ecfc5424
AD
3497none) osname='' ;;
3498*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3499esac
8ff267be 3500echo " "
3501case "$osvers" in
3502 ''|' ')
3503 case "$hintfile" in
3504 ''|' '|none) dflt=none ;;
3505 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3506 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3507 case "$dflt" in
3508 ''|' ') dflt=none ;;
3509 esac
3510 ;;
3511 esac
3512 ;;
3513 *) dflt="$osvers" ;;
3514esac
3515rp="Operating system version?"
3516. ./myread
3517case "$ans" in
3518none) osvers='' ;;
3519*) osvers="$ans" ;;
3520esac
3521
02e93a22
JH
3522
3523. ./posthint.sh
3524
2304df62 3525: who configured the system
59b83a6f 3526cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3527case "$cf_by" in
3528"")
7c04078e 3529 cf_by=`(logname) 2>/dev/null`
dfe9444c 3530 case "$cf_by" in
7c04078e
GA
3531 "")
3532 cf_by=`(whoami) 2>/dev/null`
3533 case "$cf_by" in
3534 "") cf_by=unknown ;;
3535 esac ;;
8ff267be 3536 esac ;;
3537esac
2304df62 3538
f3f1a2d8
MB
3539: decide how portable to be. Allow command line overrides.
3540case "$d_portable" in
3541"$undef") ;;
3542*) d_portable="$define" ;;
b4eb6b3d 3543esac
b4eb6b3d 3544
f3f1a2d8
MB
3545: set up shell script to do ~ expansion
3546cat >filexp <<EOSS
3547$startsh
3548: expand filename
3549case "\$1" in
3550 ~/*|~)
3551 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3552 ;;
3553 ~*)
3554 if $test -f /bin/csh; then
3555 /bin/csh -f -c "glob \$1"
3556 failed=\$?
3557 echo ""
3558 exit \$failed
3559 else
3560 name=\`$expr x\$1 : '..\([^/]*\)'\`
3561 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3562 if $test ! -d "\$dir"; then
3563 me=\`basename \$0\`
3564 echo "\$me: can't locate home directory for: \$name" >&2
3565 exit 1
3566 fi
3567 case "\$1" in
3568 */*)
3569 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3570 ;;
3571 *)
3572 echo \$dir
3573 ;;
3574 esac
3575 fi
3576 ;;
3577*)
3578 echo \$1
3579 ;;
b29b105d 3580esac
f3f1a2d8
MB
3581EOSS
3582chmod +x filexp
3583$eunicefix filexp
b29b105d 3584
f3f1a2d8
MB
3585: now set up to get a file name
3586cat <<EOS >getfile
3587$startsh
3588EOS
3589cat <<'EOSC' >>getfile
3590tilde=''
3591fullpath=''
3592already=''
3593skip=''
3594none_ok=''
3595exp_file=''
3596nopath_ok=''
3597orig_rp="$rp"
3598orig_dflt="$dflt"
3599case "$gfpth" in
3600'') gfpth='.' ;;
b29b105d 3601esac
b29b105d 3602
f3f1a2d8
MB
3603case "$fn" in
3604*\(*)
3605 : getfile will accept an answer from the comma-separated list
3606 : enclosed in parentheses even if it does not meet other criteria.
3607 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3608 fn=`echo $fn | sed 's/(.*)//'`
3609 ;;
b29b105d
JH
3610esac
3611
f3f1a2d8
MB
3612case "$fn" in
3613*:*)
3614 loc_file=`expr $fn : '.*:\(.*\)'`
3615 fn=`expr $fn : '\(.*\):.*'`
3616 ;;
b29b105d 3617esac
b29b105d 3618
f3f1a2d8
MB
3619case "$fn" in
3620*~*) tilde=true;;
3621esac
3622case "$fn" in
3623*/*) fullpath=true;;
3624esac
3625case "$fn" in
3626*+*) skip=true;;
3627esac
3628case "$fn" in
3629*n*) none_ok=true;;
3630esac
3631case "$fn" in
3632*e*) exp_file=true;;
3633esac
3634case "$fn" in
3635*p*) nopath_ok=true;;
b29b105d 3636esac
b29b105d 3637
f3f1a2d8
MB
3638case "$fn" in
3639*f*) type='File';;
3640*d*) type='Directory';;
3641*l*) type='Locate';;
3642esac
b29b105d 3643
f3f1a2d8
MB
3644what="$type"
3645case "$what" in
3646Locate) what='File';;
3647esac
b29b105d 3648
f3f1a2d8
MB
3649case "$exp_file" in
3650'')
3651 case "$d_portable" in
3652 "$define") ;;
3653 *) exp_file=true;;
b29b105d
JH
3654 esac
3655 ;;
3656esac
3657
f3f1a2d8
MB
3658cd ..
3659while test "$type"; do
3660 redo=''
3661 rp="$orig_rp"
3662 dflt="$orig_dflt"
3663 case "$tilde" in
3664 true) rp="$rp (~name ok)";;
3665 esac
3666 . UU/myread
3667 if test -f UU/getfile.ok && \
3668 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3669 then
3670 value="$ans"
3671 ansexp="$ans"
3672 break
3673 fi
3674 case "$ans" in
3675 none)
3676 value=''
3677 ansexp=''
3678 case "$none_ok" in
3679 true) type='';;
b29b105d
JH
3680 esac
3681 ;;
f3f1a2d8
MB
3682 *)
3683 case "$tilde" in
3684 '') value="$ans"
3685 ansexp="$ans";;
3686 *)
3687 value=`UU/filexp $ans`
3688 case $? in
3689 0)
3690 if test "$ans" != "$value"; then
3691 echo "(That expands to $value on this system.)"
3692 fi
3693 ;;
3694 *) value="$ans";;
3695 esac
3696 ansexp="$value"
3697 case "$exp_file" in
3698 '') value="$ans";;
3699 esac
3700 ;;
3701 esac
3702 case "$fullpath" in
3703 true)
3704 case "$ansexp" in
3705 /*) value="$ansexp" ;;
3706 [a-zA-Z]:/*) value="$ansexp" ;;
3707 *)
3708 redo=true
3709 case "$already" in
3710 true)
3711 echo "I shall only accept a full path name, as in /bin/ls." >&4
3712 echo "Use a ! shell escape if you wish to check pathnames." >&4
3713 ;;
3714 *)
3715 echo "Please give a full path name, starting with slash." >&4
3716 case "$tilde" in
3717 true)
3718 echo "Note that using ~name is ok provided it expands well." >&4
3719 already=true
3720 ;;
3721 esac
3722 esac
3723 ;;
3724 esac
3725 ;;
3726 esac
3727 case "$redo" in
3728 '')
3729 case "$type" in
3730 File)
3731 for fp in $gfpth; do
3732 if test "X$fp" = X.; then
3733 pf="$ansexp"
3734 else
3735 pf="$fp/$ansexp"
3736 fi
3737 if test -f "$pf"; then
3738 type=''
3739 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3740 then
3741 echo "($value is not a plain file, but that's ok.)"
3742 type=''
3743 fi
3744 if test X"$type" = X; then
3745 value="$pf"
3746 break
3747 fi
3748 done
3749 ;;
3750 Directory)
3751 for fp in $gfpth; do
3752 if test "X$fp" = X.; then
3753 dir="$ans"
3754 direxp="$ansexp"
3755 else
3756 dir="$fp/$ansexp"
3757 direxp="$fp/$ansexp"
3758 fi
3759 if test -d "$direxp"; then
3760 type=''
3761 value="$dir"
3762 break
3763 fi
3764 done
3765 ;;
3766 Locate)
3767 if test -d "$ansexp"; then
3768 echo "(Looking for $loc_file in directory $value.)"
3769 value="$value/$loc_file"
3770 ansexp="$ansexp/$loc_file"
3771 fi
3772 if test -f "$ansexp"; then
3773 type=''
3774 fi
3775 case "$nopath_ok" in
3776 true) case "$value" in
3777 */*) ;;
3778 *) echo "Assuming $value will be in people's path."
3779 type=''
3780 ;;
3781 esac
3782 ;;
3783 esac
3784 ;;
3785 esac
b4eb6b3d 3786
f3f1a2d8
MB
3787 case "$skip" in
3788 true) type='';
3789 esac
3790
3791 case "$type" in
3792 '') ;;
3793 *)
3794 if test "$fastread" = yes; then
3795 dflt=y
3796 else
3797 dflt=n
3798 fi
3799 rp="$what $value doesn't exist. Use that name anyway?"
3800 . UU/myread
3801 dflt=''
3802 case "$ans" in
3803 y*) type='';;
3804 *) echo " ";;
3805 esac
3806 ;;
3807 esac
3808 ;;
3809 esac
3810 ;;
b4eb6b3d 3811 esac
f3f1a2d8
MB
3812done
3813cd UU
3814ans="$value"
3815rp="$orig_rp"
3816dflt="$orig_dflt"
3817rm -f getfile.ok
3818test "X$gfpthkeep" != Xy && gfpth=""
3819EOSC
3820
3821: determine root of directory hierarchy where package will be installed.
3822case "$prefix" in
3823'')
3824 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3825 ;;
3826*?/)
3827 dflt=`echo "$prefix" | sed 's/.$//'`
b4eb6b3d
JH
3828 ;;
3829*)
f3f1a2d8 3830 dflt="$prefix"
b4eb6b3d
JH
3831 ;;
3832esac
f3f1a2d8 3833$cat <<EOM
b4eb6b3d 3834
f3f1a2d8
MB
3835By default, $package will be installed in $dflt/bin, manual pages
3836under $dflt/man, etc..., i.e. with $dflt as prefix for all
3837installation directories. Typically this is something like /usr/local.
3838If you wish to have binaries under /usr/bin but other parts of the
3839installation under /usr/local, that's ok: you will be prompted
3840separately for each of the installation directories, the prefix being
3841only used to set the defaults.
c915ce7f
JH
3842
3843EOM
f3f1a2d8
MB
3844fn=d~
3845rp='Installation prefix to use?'
3846. ./getfile
3847oldprefix=''
3848case "$prefix" in
3849'') ;;
3850*)
3851 case "$ans" in
3852 "$prefix") ;;
3853 *) oldprefix="$prefix";;
3854 esac
c915ce7f
JH
3855 ;;
3856esac
f3f1a2d8
MB
3857prefix="$ans"
3858prefixexp="$ansexp"
c915ce7f 3859
f3f1a2d8
MB
3860case "$afsroot" in
3861'') afsroot=/afs ;;
3862*) afsroot=$afsroot ;;
b4eb6b3d 3863esac
b4eb6b3d 3864
f3f1a2d8
MB
3865: is AFS running?
3866echo " "
3867case "$afs" in
3868$define|true) afs=true ;;
3869$undef|false) afs=false ;;
3870*) if test -d $afsroot; then
3871 afs=true
3872 else
3873 afs=false
3874 fi
b4eb6b3d 3875 ;;
f3f1a2d8
MB
3876esac
3877if $afs; then
3878 echo "AFS may be running... I'll be extra cautious then..." >&4
3879else
3880 echo "AFS does not seem to be running..." >&4
9da7673b 3881fi
b4eb6b3d 3882
f3f1a2d8
MB
3883: determine installation prefix for where package is to be installed.
3884if $afs; then
3885$cat <<EOM
3886
3887Since you are running AFS, I need to distinguish the directory in which
3888files will reside from the directory in which they are installed (and from
3889which they are presumably copied to the former directory by occult means).
b4eb6b3d 3890
b4eb6b3d 3891EOM
f3f1a2d8
MB
3892 case "$installprefix" in
3893 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3894 *) dflt="$installprefix";;
3895 esac
3896else
3897$cat <<EOM
b4eb6b3d 3898
f3f1a2d8
MB
3899In some special cases, particularly when building $package for distribution,
3900it is convenient to distinguish the directory in which files should be
3901installed from the directory ($prefix) in which they will
3902eventually reside. For most users, these two directories are the same.
3903
3904EOM
3905 case "$installprefix" in
3906 '') dflt=$prefix ;;
3907 *) dflt=$installprefix;;
3908 esac
3909fi
3910fn=d~
3911rp='What installation prefix should I use for installing files?'
3912. ./getfile
3913installprefix="$ans"
3914installprefixexp="$ansexp"
3915
3916: Perform the prefixexp/installprefixexp correction if necessary
3917cat <<EOS >installprefix
3918$startsh
3919EOS
3920cat <<'EOSC' >>installprefix
3921: Change installation prefix, if necessary.
3922if $test X"$prefix" != X"$installprefix"; then
3923 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3924else
3925 eval "install${prefixvar}=\"\$${prefixvar}exp\""
3926fi
3927EOSC
3928chmod +x installprefix
3929$eunicefix installprefix
3930
3931: Set variables such as privlib and privlibexp from the output of ./getfile
3932: performing the prefixexp/installprefixexp correction if necessary.
3933cat <<EOS >setprefixvar
3934$startsh
3935EOS
3936cat <<'EOSC' >>setprefixvar
3937eval "${prefixvar}=\"\$ans\""
3938eval "${prefixvar}exp=\"\$ansexp\""
3939. ./installprefix
3940EOSC
3941chmod +x setprefixvar
3942$eunicefix setprefixvar
3943
3944: set up the script used to warn in case of inconsistency
3945cat <<EOS >whoa
3946$startsh
3947EOS
3948cat <<'EOSC' >>whoa
3949dflt=y
3950echo " "
3951echo "*** WHOA THERE!!! ***" >&4
3952echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3953rp=" Keep the $hint value?"
3954. ./myread
3955case "$ans" in
3956y) td=$was; tu=$was;;
3957esac
3958EOSC
3959
3960: function used to set $1 to $val
3961setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3962case "$val$was" in
3963$define$undef) . ./whoa; eval "$var=\$td";;
3964$undef$define) . ./whoa; eval "$var=\$tu";;
3965*) eval "$var=$val";;
3966esac'
3967
3968case "$usesocks" in
3969$define|true|[yY]*) dflt='y';;
3970*) dflt='n';;
3971esac
3972cat <<EOM
3973
3974Perl can be built to use the SOCKS proxy protocol library. To do so,
3975Configure must be run with -Dusesocks. If you use SOCKS you also need
3976to use the PerlIO abstraction layer, this will be implicitly selected.
3977
3978If this doesn't make any sense to you, just accept the default '$dflt'.
3979EOM
3980rp='Build Perl for SOCKS?'
3981. ./myread
3982case "$ans" in
3983y|Y) val="$define" ;;
3984*) val="$undef" ;;
3985esac
3986set usesocks
3987eval $setvar
3988
3989case "$usesocks" in
3990$define|true|[yY]*) useperlio="$define";;
3991esac
3992
3993case "$useperlio" in
3994$define|true|[yY]*|'') dflt='y';;
3995*) dflt='n';;
3996esac
3997cat <<EOM
3998
3999Previous version of $package used the standard IO mechanisms as
4000defined in <stdio.h>. Versions 5.003_02 and later of $package allow
4001alternate IO mechanisms via the PerlIO abstraction layer, but the
4002stdio mechanism is still available if needed. The abstraction layer
4003can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4004Using PerlIO with sfio may cause problems with some extension modules.
4005
4006If this doesn't make any sense to you, just accept the default '$dflt'.
b4eb6b3d 4007EOM
f3f1a2d8
MB
4008rp='Use the PerlIO abstraction layer?'
4009. ./myread
4010case "$ans" in
4011y|Y)
b4eb6b3d
JH
4012 val="$define"
4013 ;;
f3f1a2d8
MB
4014*)
4015 echo "Ok, doing things the stdio way."
4016 val="$undef"
4017 ;;
4018esac
4019set useperlio
4020eval $setvar
4021
4022case "$usesocks" in
4023$define|true|[yY]*)
4024 case "$useperlio" in
4025 $define|true|[yY]*) ;;
4026 *) cat >&4 <<EOM
4027
4028You are using the SOCKS proxy protocol library which means that you
4029should also use the PerlIO layer. You may be headed for trouble.
4030
4031EOM
4032 ;;
b4eb6b3d 4033 esac
f3f1a2d8
MB
4034 ;;
4035esac
4036
4037
4038case "$usethreads" in
4039$define|true|[yY]*) dflt='y';;
4040*) # Catch case where user specified ithreads or 5005threads but
4041 # forgot -Dusethreads (A.D. 4/2002)
4042 case "$useithreads$use5005threads" in
4043 *$define*)
4044 case "$useperlio" in
4045 "$define") dflt='y' ;;
4046 *) dflt='n' ;;
4047 esac
4048 ;;
4049 *) dflt='n';;
4050 esac
4051 ;;
4052esac
4053cat <<EOM
4054
4055Perl can be built to take advantage of threads on some systems.
4056To do so, Configure can be run with -Dusethreads.
4057
4058Note that Perl built with threading support runs slightly slower
4059and uses more memory than plain Perl. The current implementation
4060is believed to be stable, but it is fairly new, and so should be
4061treated with caution.
4062
4063If this doesn't make any sense to you, just accept the default '$dflt'.
4064EOM
4065rp='Build a threading Perl?'
4066. ./myread
4067case "$ans" in
4068y|Y) val="$define" ;;
4069*) val="$undef" ;;
4070esac
4071set usethreads
4072eval $setvar
4073
4074case "$usethreads" in
4075$define)
4076 $cat <<EOM
4077
4078Since release 5.6, Perl has had two different threading implementations,
4079the newer interpreter-based version (ithreads) with one interpreter per
4080thread, and the older 5.005 version (5005threads).
4081The 5005threads version is effectively unmaintained and will probably be
4082removed in Perl 5.10, so there should be no need to build a Perl using it
4083unless needed for backwards compatibility with some existing 5.005threads
4084code.
4085
4086EOM
4087 : Default to ithreads unless overridden on command line or with
4088 : old config.sh
4089 dflt='y'
4090 case "$use5005threads" in
4091 $define|true|[yY]*) dflt='n';;
4092 esac
4093 case "$useithreads" in
4094 $undef|false|[nN]*) dflt='n';;
4095 esac
4096 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
4097 . ./myread
4098 case "$ans" in
f3f1a2d8 4099 y|Y) val="$define" ;;
b4eb6b3d
JH
4100 *) val="$undef" ;;
4101 esac
f3f1a2d8
MB
4102 set useithreads
4103 eval $setvar
4104 : Now set use5005threads to the opposite value.
4105 case "$useithreads" in
4106 $define) val="$undef" ;;
4107 *) val="$define" ;;
4108 esac
4109 set use5005threads
4110 eval $setvar
4111 ;;
4112*)
4113 useithreads="$undef"
4114 use5005threads="$undef"
b4eb6b3d
JH
4115 ;;
4116esac
b4eb6b3d 4117
f3f1a2d8
MB
4118case "$useithreads$use5005threads" in
4119"$define$define")
4120 $cat >&4 <<EOM
96056487 4121
f3f1a2d8
MB
4122You cannot have both the ithreads and the 5.005 threads enabled
4123at the same time. Disabling the 5.005 threads since they are
4124much less stable than the ithreads.
4125
4126EOM
4127 use5005threads="$undef"
96056487
JH
4128 ;;
4129esac
4130
f3f1a2d8
MB
4131if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4132 cat >&4 <<EOF
4133***
4134*** To build with ithreads you must also use the PerlIO layer.
4135*** Cannot continue, aborting.
4136***
4137EOF
4138 exit 1
4139fi
4140
4141case "$d_oldpthreads" in
4142'') : Configure tests would be welcome here. For now, assume undef.
4143 val="$undef" ;;
4144*) val="$d_oldpthreads" ;;
4145esac
4146set d_oldpthreads
4147eval $setvar
4148
4149
4150: Look for a hint-file generated 'call-back-unit'. If the
4151: user has specified that a threading perl is to be built,
4152: we may need to set or change some other defaults.
4153if $test -f usethreads.cbu; then
4154 echo "Your platform has some specific hints regarding threaded builds, using them..."
4155 . ./usethreads.cbu
4156else
4157 case "$usethreads" in
4158 "$define"|true|[yY]*)
4159 $cat <<EOM
4160(Your platform does not have any specific hints for threaded builds.
4161 Assuming POSIX threads, then.)
4162EOM
4163 ;;
4164 esac
4165fi
4166
4167cat <<EOM
4168
4169Perl can be built so that multiple Perl interpreters can coexist
4170within the same Perl executable.
4171EOM
4172
4173case "$useithreads" in
4174$define)
4175 cat <<EOM
4176This multiple interpreter support is required for interpreter-based threads.
4177EOM
4178 val="$define"
4179 ;;
4180*) case "$usemultiplicity" in
4181 $define|true|[yY]*) dflt='y';;
4182 *) dflt='n';;
4183 esac
4184 echo " "
4185 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4186 rp='Build Perl for multiplicity?'
4187 . ./myread
4188 case "$ans" in
4189 y|Y) val="$define" ;;
4190 *) val="$undef" ;;
4191 esac
4192 ;;
4193esac
4194set usemultiplicity
4195eval $setvar
4196
4197
4198case "$usemorebits" in
4199"$define"|true|[yY]*)
4200 use64bitint="$define"
4201 uselongdouble="$define"
4202 usemorebits="$define"
4203 ;;
4204*) usemorebits="$undef"
4205 ;;
4206esac
4207
4208: make some quick guesses about what we are up against
4209echo " "
4210$echo $n "Hmm... $c"
4211echo exit 1 >bsd
4212echo exit 1 >usg
4213echo exit 1 >v7
4214echo exit 1 >osf1
4215echo exit 1 >eunice
4216echo exit 1 >xenix
4217echo exit 1 >venix
4218echo exit 1 >os2
4219d_bsd="$undef"
4220$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4221if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
e5e20432
JH
4222then
4223 echo "Looks kind of like an OSF/1 system, but we'll see..."
4224 echo exit 0 >osf1
381aa1ff 4225elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
4226 xxx=`./loc addbib blurfl $pth`
4227 if $test -f $xxx; then
4228 echo "Looks kind of like a USG system with BSD features, but we'll see..."
4229 echo exit 0 >bsd
4230 echo exit 0 >usg
4231 else
4232 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4233 echo "Looks kind of like an extended USG system, but we'll see..."
4234 else
4235 echo "Looks kind of like a USG system, but we'll see..."
4236 fi
4237 echo exit 0 >usg
4238 fi
4239elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4240 echo "Looks kind of like a BSD system, but we'll see..."
4241 d_bsd="$define"
4242 echo exit 0 >bsd
4243else
4244 echo "Looks kind of like a Version 7 system, but we'll see..."
4245 echo exit 0 >v7
4246fi
4247case "$eunicefix" in
4248*unixtovms*)
4249 $cat <<'EOI'
4250There is, however, a strange, musty smell in the air that reminds me of
4251something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4252EOI
4253 echo exit 0 >eunice
4254 d_eunice="$define"
4255: it so happens the Eunice I know will not run shell scripts in Unix format
4256 ;;
4257*)
4258 echo " "
4259 echo "Congratulations. You aren't running Eunice."
4260 d_eunice="$undef"
4261 ;;
4262esac
4263: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
4264: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4265: semicolon as a patch separator
e5e20432
JH
4266case "$p_" in
4267:) ;;
4268*)
4269 $cat <<'EOI'
4270I have the feeling something is not exactly right, however...don't tell me...
4271lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 4272(Or you may be running DOS with DJGPP.)
e5e20432
JH
4273EOI
4274 echo exit 0 >os2
4275 ;;
4276esac
4277if test -f /xenix; then
4278 echo "Actually, this looks more like a XENIX system..."
4279 echo exit 0 >xenix
4280 d_xenix="$define"
4281else
4282 echo " "
4283 echo "It's not Xenix..."
4284 d_xenix="$undef"
4285fi
4286chmod +x xenix
4287$eunicefix xenix
4288if test -f /venix; then
4289 echo "Actually, this looks more like a VENIX system..."
4290 echo exit 0 >venix
4291else
4292 echo " "
4293 if ./xenix; then
4294 : null
4295 else
4296 echo "Nor is it Venix..."
4297 fi
4298fi
4299chmod +x bsd usg v7 osf1 eunice xenix venix os2
4300$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4301$rm -f foo
4302
5869b1f1
JH
4303case "$cc" in
4304'') dflt=cc;;
4305*) dflt="$cc";;
4306esac
4307rp="Use which C compiler?"
4308. ./myread
4309cc="$ans"
6b769f8f
RB
4310
4311: See if they have not cc but they do have gcc
4312. ./trygcc
e5e20432
JH
4313: Look for a hint-file generated 'call-back-unit'. Now that the
4314: user has specified the compiler, we may need to set or change some
4315: other defaults.
4316if $test -f cc.cbu; then
4317 . ./cc.cbu
4318fi
2573c5f9 4319. ./checkcc
8a27cf78 4320
e5e20432
JH
4321echo " "
4322echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 4323$cat >try.c <<EOM
e5e20432
JH
4324#include <stdio.h>
4325int main() {
7686528e 4326#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
e5e20432
JH
4327#ifdef __VERSION__
4328 printf("%s\n", __VERSION__);
4329#else
4330 printf("%s\n", "1");
4331#endif
4332#endif
073b6de5 4333 return(0);
e5e20432
JH
4334}
4335EOM
5440bc8e
JH
4336if $cc -o try $ccflags $ldflags try.c; then
4337 gccversion=`$run ./try`
f3f1a2d8
MB
4338 case "$gccversion" in
4339 '') echo "You are not using GNU cc." ;;
4340 *) echo "You are using GNU cc $gccversion."
4341 ccname=gcc
4342 ;;
4343 esac
4344else
4345 echo " "
4346 echo "*** WHOA THERE!!! ***" >&4
4347 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
4348 case "$knowitall" in
4349 '')
4350 echo " You'd better start hunting for one and let me know about it." >&4
4351 exit 1
2304df62
AD
4352 ;;
4353 esac
f3f1a2d8
MB
4354fi
4355$rm -f try try.*
4356case "$gccversion" in
43571*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4358esac
4359case "$gccversion" in
4360'') gccosandvers='' ;;
4361*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4362 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4363 gccshortvers=''
4364 case "$gccosandvers" in
4365 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4366 $osname$osvers) ;; # looking good
4367 $osname*) cat <<EOM >&4
4368
4369*** WHOA THERE!!! ***
4370
4371 Your gcc has not been compiled for the exact release of
4372 your operating system ($gccosandvers versus $osname$osvers).
4373
4374 In general it is a good idea to keep gcc synchronized with
4375 the operating system because otherwise serious problems
4376 may ensue when trying to compile software, like Perl.
4377
4378 I'm trying to be optimistic here, though, and will continue.
4379 If later during the configuration and build icky compilation
4380 problems appear (headerfile conflicts being the most common
4381 manifestation), I suggest reinstalling the gcc to match
4382 your operating system release.
4383
4384EOM
4385 ;;
4386 *) gccosandvers='' ;; # failed to parse, better be silent
4387 esac
4388 ;;
4389esac
4390case "$ccname" in
4391'') ccname="$cc" ;;
4392esac
4393
4394# gcc 3.* complain about adding -Idirectories that they already know about,
4395# so we will take those off from locincpth.
4396case "$gccversion" in
43973*)
4398 echo "main(){}">try.c
4399 for incdir in $locincpth; do
4400 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4401 grep '^c[cp]p*[01]: warning: changing search order '`
4402 if test "X$warn" != X; then
4403 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4404 fi
4405 done
4406 $rm -f try try.*
4407esac
2304df62 4408
bd9b35c9
JH
4409: What should the include directory be ?
4410echo " "
4411$echo $n "Hmm... $c"
4412dflt='/usr/include'
4413incpath=''
4414mips_type=''
4415if $test -f /bin/mips && /bin/mips; then
4416 echo "Looks like a MIPS system..."
4417 $cat >usr.c <<'EOCP'
4418#ifdef SYSTYPE_BSD43
4419/bsd43
4420#endif
4421EOCP
8a27cf78 4422 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4423 dflt='/bsd43/usr/include'
4424 incpath='/bsd43'
4425 mips_type='BSD 4.3'
4426 else
4427 mips_type='System V'
4428 fi
4429 $rm -f usr.c usr.out
4430 echo "and you're compiling with the $mips_type compiler and libraries."
4431 xxx_prompt=y
4432 echo "exit 0" >mips
4433else
4434 echo "Doesn't look like a MIPS system."
4435 xxx_prompt=n
4436 echo "exit 1" >mips
4437fi
4438chmod +x mips
4439$eunicefix mips
4440case "$usrinc" in
4441'') ;;
4442*) dflt="$usrinc";;
4443esac
4444case "$xxx_prompt" in
4445y) fn=d/
4446 echo " "
4447 rp='Where are the include files you want to use?'
4448 . ./getfile
4449 usrinc="$ans"
8e07c86e 4450 ;;
bd9b35c9 4451*) usrinc="$dflt"
8e07c86e
AD
4452 ;;
4453esac
2304df62 4454
96056487
JH
4455: see how we invoke the C preprocessor
4456echo " "
4457echo "Now, how can we feed standard input to your C preprocessor..." >&4
4458cat <<'EOT' >testcpp.c
4459#define ABC abc
4460#define XYZ xyz
4461ABC.XYZ
4462EOT
4463cd ..
4464if test ! -f cppstdin; then
4465 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4466 # AIX cc -E doesn't show the absolute headerfile
4467 # locations but we'll cheat by using the -M flag.
4468 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
4469 else
4470 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4471 fi
4472else
4473 echo "Keeping your $hint cppstdin wrapper."
4474fi
4475chmod 755 cppstdin
4476wrapper=`pwd`/cppstdin
4477ok='false'
4478cd UU
4479
4480if $test "X$cppstdin" != "X" && \
4481 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4482 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4483then
4484 echo "You used to use $cppstdin $cppminus so we'll use that again."
4485 case "$cpprun" in
4486 '') echo "But let's see if we can live without a wrapper..." ;;
4487 *)
4488 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4489 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4490 then
4491 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4492 ok='true'
4493 else
4494 echo "(However, $cpprun $cpplast does not work, let's see...)"
4495 fi
4496 ;;
4497 esac
4498else
4499 case "$cppstdin" in
4500 '') ;;
4501 *)
4502 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4503 ;;
4504 esac
4505fi
4506
4507if $ok; then
4508 : nothing
4509elif echo 'Maybe "'"$cc"' -E" will work...'; \
4510 $cc -E <testcpp.c >testcpp.out 2>&1; \
4511 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4512 echo "Yup, it does."
4513 x_cpp="$cc -E"
4514 x_minus='';
4515elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4516 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4517 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4518 echo "Yup, it does."
4519 x_cpp="$cc -E"
4520 x_minus='-';
4521elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4522 $cc -P <testcpp.c >testcpp.out 2>&1; \
4523 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4524 echo "Yipee, that works!"
4525 x_cpp="$cc -P"
4526 x_minus='';
4527elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4528 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4529 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4530 echo "At long last!"
4531 x_cpp="$cc -P"
4532 x_minus='-';
4533elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4534 $cpp <testcpp.c >testcpp.out 2>&1; \
4535 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4536 echo "It works!"
4537 x_cpp="$cpp"
4538 x_minus='';
4539elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4540 $cpp - <testcpp.c >testcpp.out 2>&1; \
4541 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4542 echo "Hooray, it works! I was beginning to wonder."
4543 x_cpp="$cpp"
4544 x_minus='-';
4545elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4546 $wrapper <testcpp.c >testcpp.out 2>&1; \
4547 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4548 x_cpp="$wrapper"
4549 x_minus=''
4550 echo "Eureka!"
4551else
4552 dflt=''
4553 rp="No dice. I can't find a C preprocessor. Name one:"
4554 . ./myread
4555 x_cpp="$ans"
4556 x_minus=''
4557 $x_cpp <testcpp.c >testcpp.out 2>&1
4558 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4559 echo "OK, that will do." >&4
4560 else
4561echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4562 exit 1
4563 fi
4564fi
4565
4566case "$ok" in
4567false)
4568 cppstdin="$x_cpp"
4569 cppminus="$x_minus"
4570 cpprun="$x_cpp"
4571 cpplast="$x_minus"
4572 set X $x_cpp
4573 shift
4574 case "$1" in
4575 "$cpp")
4576 echo "Perhaps can we force $cc -E using a wrapper..."
4577 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4578 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4579 then
4580 echo "Yup, we can."
4581 cppstdin="$wrapper"
4582 cppminus='';
4583 else
4584 echo "Nope, we'll have to live without it..."
4585 fi
4586 ;;
4587 esac
4588 case "$cpprun" in
4589 "$wrapper")
4590 cpprun=''
4591 cpplast=''
4592 ;;
4593 esac
4594 ;;
4595esac
4596
4597case "$cppstdin" in
4598"$wrapper"|'cppstdin') ;;
4599*) $rm -f $wrapper;;
4600esac
4601$rm -f testcpp.c testcpp.out
4602
bd9b35c9
JH
4603: Set private lib path
4604case "$plibpth" in
4605'') if ./mips; then
4606 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4607 fi;;
4608esac
4609case "$libpth" in
4610' ') dlist='';;
4611'') dlist="$loclibpth $plibpth $glibpth";;
4612*) dlist="$libpth";;
4613esac
4614
4615: Now check and see which directories actually exist, avoiding duplicates
4616libpth=''
4617for xxx in $dlist
4618do
4619 if $test -d $xxx; then
4620 case " $libpth " in
4621 *" $xxx "*) ;;
4622 *) libpth="$libpth $xxx";;
4623 esac
4624 fi
4625done
4626$cat <<'EOM'
4627
4628Some systems have incompatible or broken versions of libraries. Among
4629the directories listed in the question below, please remove any you
4630know not to be holding relevant libraries, and add any that are needed.
4631Say "none" for none.
8e07c86e
AD
4632
4633EOM
bd9b35c9
JH
4634case "$libpth" in
4635'') dflt='none';;
8e07c86e 4636*)
bd9b35c9
JH
4637 set X $libpth
4638 shift
4639 dflt=${1+"$@"}
8e07c86e 4640 ;;
a0d0e21e 4641esac
bd9b35c9
JH
4642rp="Directories to use for library searches?"
4643. ./myread
4644case "$ans" in
4645none) libpth=' ';;
4646*) libpth="$ans";;
4647esac
a0d0e21e 4648
bd9b35c9
JH
4649: compute shared library extension
4650case "$so" in
4651'')
4652 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4653 dflt='sl'
dd4e71fd 4654 else
bd9b35c9 4655 dflt='so'
dd4e71fd
JH
4656 fi
4657 ;;
bd9b35c9 4658*) dflt="$so";;
dd4e71fd 4659esac
dd4e71fd
JH
4660$cat <<EOM
4661
bd9b35c9 4662On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4663you want to suppress searching of shared libraries for the remainder
bd9b35c9 4664of this configuration.
dd4e71fd
JH
4665
4666EOM
bd9b35c9
JH
4667rp='What is the file extension used for shared libraries?'
4668. ./myread
4669so="$ans"
dd4e71fd 4670
bd9b35c9
JH
4671: Define several unixisms.
4672: Hints files or command line option can be used to override them.
4673: The convoluted testing is in case hints files set either the old
4674: or the new name.
4675case "$_exe" in
4676'') case "$exe_ext" in
1fef16b3 4677 '') ;;
bd9b35c9 4678 *) _exe="$exe_ext" ;;
dd4e71fd 4679 esac
bd9b35c9 4680 ;;
bfb7748a 4681esac
bd9b35c9
JH
4682case "$_a" in
4683'') case "$lib_ext" in
4684 '') _a='.a';;
4685 *) _a="$lib_ext" ;;
dd4e71fd
JH
4686 esac
4687 ;;
dd4e71fd 4688esac
bd9b35c9
JH
4689case "$_o" in
4690'') case "$obj_ext" in
4691 '') _o='.o';;
4692 *) _o="$obj_ext";;
4693 esac
4694 ;;
4695esac
4696case "$p_" in
4697'') case "$path_sep" in
4698 '') p_=':';;
4699 *) p_="$path_sep";;
4700 esac
4701 ;;
4702esac
4703exe_ext=$_exe
4704lib_ext=$_a
4705obj_ext=$_o
4706path_sep=$p_
dd4e71fd 4707
b4eb6b3d
JH
4708: Which makefile gets called first. This is used by make depend.
4709case "$firstmakefile" in
4710'') firstmakefile='makefile';;
4633a7c4 4711esac
4633a7c4 4712
1f603089
JH
4713case "$ccflags" in
4714*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4715esac
4716
4717case "$uselongdouble" in
4718$define|true|[yY]*) dflt='y';;
4719*) dflt='n';;
4720esac
4721cat <<EOM
4722
4723Perl can be built to take advantage of long doubles which
4724(if available) may give more accuracy and range for floating point numbers.
4725
4726If this doesn't make any sense to you, just accept the default '$dflt'.
4727EOM
4728rp='Try to use long doubles if available?'
4729. ./myread
4730case "$ans" in
4731y|Y) val="$define" ;;
4732*) val="$undef" ;;
4733esac
4734set uselongdouble
4735eval $setvar
4736
4737case "$uselongdouble" in
4738true|[yY]*) uselongdouble="$define" ;;
4739esac
4740
1f603089
JH
4741: Look for a hint-file generated 'call-back-unit'. If the
4742: user has specified that long doubles should be used,
4743: we may need to set or change some other defaults.
9da7673b
MB
4744if $test -f uselongdouble.cbu; then
4745 echo "Your platform has some specific hints regarding long doubles, using them..."
4746 . ./uselongdouble.cbu
4747else
4748 case "$uselongdouble" in
4749 $define)
1f603089 4750 $cat <<EOM
9da7673b 4751(Your platform does not have any specific hints for long doubles.)
1f603089 4752EOM
1f603089 4753 ;;
9da7673b
MB
4754 esac
4755fi
1f603089 4756
bd9b35c9
JH
4757: Looking for optional libraries
4758echo " "
4759echo "Checking for optional libraries..." >&4
4760case "$libs" in
4761' '|'') dflt='';;
4762*) dflt="$libs";;
4763esac
4764case "$libswanted" in
4765'') libswanted='c_s';;
4766esac
4767case "$usesocks" in
923fc586 4768"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4769esac
68435ea7
JH
4770libsfound=''
4771libsfiles=''
4772libsdirs=''
13b3f787
JH
4773libspath=''
4774for thisdir in $libpth $xlibpth; do
4775 test -d $thisdir && libspath="$libspath $thisdir"
4776done
bd9b35c9 4777for thislib in $libswanted; do
13b3f787 4778 for thisdir in $libspath; do
f7dd4e7f
JH
4779 xxx=''
4780 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4781 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4782 $test -f "$xxx" && eval $libscheck
4783 $test -f "$xxx" && libstyle=shared
4784 fi
4785 if test ! -f "$xxx"; then
4786 xxx=$thisdir/lib$thislib.$so
4787 $test -f "$xxx" && eval $libscheck
4788 $test -f "$xxx" && libstyle=shared
4789 fi
4790 if test ! -f "$xxx"; then
4791 xxx=$thisdir/lib$thislib$_a
4792 $test -f "$xxx" && eval $libscheck
4793 $test -f "$xxx" && libstyle=static
4794 fi
4795 if test ! -f "$xxx"; then
4796 xxx=$thisdir/$thislib$_a
4797 $test -f "$xxx" && eval $libscheck
4798 $test -f "$xxx" && libstyle=static
4799 fi
4800 if test ! -f "$xxx"; then
4801 xxx=$thisdir/lib${thislib}_s$_a
4802 $test -f "$xxx" && eval $libscheck
4803 $test -f "$xxx" && libstyle=static
09ea5ba9 4804 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4805 fi
4806 if test ! -f "$xxx"; then
4807 xxx=$thisdir/Slib$thislib$_a
4808 $test -f "$xxx" && eval $libscheck
4809 $test -f "$xxx" && libstyle=static
4810 fi
4811 if $test -f "$xxx"; then
43999f95 4812 case "$libstyle" in
f7dd4e7f
JH
4813 shared) echo "Found -l$thislib (shared)." ;;
4814 static) echo "Found -l$thislib." ;;
4815 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4816 esac
bd9b35c9
JH
4817 case " $dflt " in
4818 *"-l$thislib "*);;
f7dd4e7f 4819 *) dflt="$dflt -l$thislib"
43999f95
JH
4820 libsfound="$libsfound $xxx"
4821 yyy=`basename $xxx`
4822 libsfiles="$libsfiles $yyy"
1e127011 4823 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4824 case " $libsdirs " in
4825 *" $yyy "*) ;;
4826 *) libsdirs="$libsdirs $yyy" ;;
4827 esac
4828 ;;
bd9b35c9 4829 esac
f7dd4e7f
JH
4830 break
4831 fi
4832 done
4833 if $test ! -f "$xxx"; then
4834 echo "No -l$thislib."
bd9b35c9
JH
4835 fi
4836done
4837set X $dflt
4838shift
4839dflt="$*"
4840case "$libs" in
4841'') dflt="$dflt";;
4842*) dflt="$libs";;
4843esac
4844case "$dflt" in
4845' '|'') dflt='none';;
4846esac
4633a7c4 4847
bd9b35c9 4848$cat <<EOM
4633a7c4 4849
bd9b35c9
JH
4850In order to compile $package on your machine, a number of libraries
4851are usually needed. Include any other special libraries here as well.
4852Say "none" for none. The default list is almost always right.
8e07c86e 4853EOM
8e07c86e 4854
bd9b35c9
JH
4855echo " "
4856rp="What libraries to use?"
4857. ./myread
4858case "$ans" in
4859none) libs=' ';;
4860*) libs="$ans";;
4861esac
d71b2b6b 4862
bd9b35c9
JH
4863: determine optimization, if desired, or use for debug flag also
4864case "$optimize" in
4865' '|$undef) dflt='none';;
4866'') dflt='-O';;
4867*) dflt="$optimize";;
4868esac
4869$cat <<EOH
d71b2b6b 4870
bd9b35c9
JH
4871By default, $package compiles with the -O flag to use the optimizer.
4872Alternately, you might want to use the symbolic debugger, which uses
4873the -g flag (on traditional Unix systems). Either flag can be
4874specified here. To use neither flag, specify the word "none".
d71b2b6b 4875
bd9b35c9
JH
4876EOH
4877rp="What optimizer/debugger flag should be used?"
4878. ./myread
4879optimize="$ans"
4880case "$optimize" in
4881'none') optimize=" ";;
4882esac
4883
eaf812ae
MB
4884: Check what DEBUGGING is required from the command line
4885: -DEBUGGING or -DDEBUGGING or
4886: -DEBUGGING=both = -g + -DDEBUGGING
4887: -DEBUGGING=-g or -Doptimize=-g = -g
4888: -DEBUGGING=none or -UDEBUGGING =
4889: -DEBUGGING=old or -DEBUGGING=default = ? $optimize
4890case "$EBUGGING" in
4891'') ;;
4892*) DEBUGGING=$EBUGGING ;;
4893esac
4894
4895case "$DEBUGGING" in
4896-g|$define)
4897 case "$optimize" in
4898 *-g*) ;;
4899 *) optimize="$optimize -g" ;;
4900 esac ;;
4901none|$undef)
4902 case "$optimize" in
4903 *-g*) set `echo "X $optimize " | sed 's/ -g / /'`
4904 shift
4905 optimize="$*"
4906 ;;
4907 esac ;;
4908esac
4909
bd9b35c9 4910dflt=''
eaf812ae
MB
4911case "$DEBUGGING" in
4912both|$define) dflt='-DDEBUGGING'
4913esac
4914
bd9b35c9
JH
4915: We will not override a previous value, but we might want to
4916: augment a hint file
4917case "$hint" in
4918default|recommended)
4919 case "$gccversion" in
eaf812ae 4920 1*) dflt="$dflt -fpcc-struct-return" ;;
d71b2b6b 4921 esac
eaf812ae
MB
4922 case "$optimize:$DEBUGGING" in
4923 *-g*:old) dflt="$dflt -DDEBUGGING";;
d71b2b6b 4924 esac
bd9b35c9
JH
4925 case "$gccversion" in
4926 2*) if test -d /etc/conf/kconfig.d &&
4927 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4928 then
00e89ad4 4929 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
4930 dflt="$dflt -posix"
4931 fi
f0d04425 4932 ;;
bd9b35c9
JH
4933 esac
4934 case "$gccversion" in
4935 1*) ;;
4936 2.[0-8]*) ;;
4937 ?*) echo " "
4938 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4939 echo 'int main(void) { return 0; }' > gcctest.c
4940 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4941 echo "Yes, it does." 2>&1
4942 case "$ccflags" in
00e89ad4 4943 *strict-aliasing*)
bd9b35c9
JH
4944 echo "Leaving current flags $ccflags alone." 2>&1
4945 ;;
4946 *) dflt="$dflt -fno-strict-aliasing" ;;
4947 esac
4948 else
4949 echo "Nope, it doesn't, but that's ok." 2>&1
4950 fi
f0d04425 4951 ;;
e5e20432 4952 esac
00e89ad4
AD
4953 # For gcc, adding -pipe speeds up compilations for some, but apparently
4954 # some assemblers can't read from stdin. (It also slows down compilations
4955 # in other cases, but those are apparently rarer these days.) AD 5/2004.
4956 case "$gccversion" in
4957 ?*) echo " "
4958 echo "Checking if your compiler accepts -pipe" 2>&1
4959 echo 'int main(void) { return 0; }' > gcctest.c
6347b5be 4960 if $cc -pipe -o gcctest gcctest.c; then
00e89ad4
AD
4961 echo "Yes, it does." 2>&1
4962 case "$ccflags" in
4963 *-pipe*)
4964 echo "Leaving current flags $ccflags alone." 2>&1
4965 ;;
4966 *) dflt="$dflt -pipe" ;;
4967 esac
4968 else
4969 echo "Nope, it doesn't, but that's ok." 2>&1
4970 fi
4971 ;;
4972 esac
e5e20432
JH
4973 ;;
4974esac
4975
bd9b35c9
JH
4976case "$mips_type" in
4977*BSD*|'') inclwanted="$locincpth $usrinc";;
4978*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4979esac
4980for thisincl in $inclwanted; do
4981 if $test -d $thisincl; then
4982 if $test x$thisincl != x$usrinc; then
4983 case "$dflt" in
00e89ad4
AD
4984 *" -I$thisincl "*);;
4985 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
4986 esac
4987 fi
4988 fi
4989done
40a7a20a 4990
bd9b35c9
JH
4991inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4992 xxx=true;
4993elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4994 xxx=true;
4995else
4996 xxx=false;
4997fi;
4998if $xxx; then
4999 case "$dflt" in
5000 *$2*);;
5001 *) dflt="$dflt -D$2";;
5002 esac;
5003fi'
40a7a20a 5004
bd9b35c9 5005set signal.h LANGUAGE_C; eval $inctest
40a7a20a 5006
bd9b35c9
JH
5007case "$usesocks" in
5008$define)
5009 ccflags="$ccflags -DSOCKS"
5010 ;;
5011esac
40a7a20a 5012
bd9b35c9
JH
5013case "$hint" in
5014default|recommended) dflt="$ccflags $dflt" ;;
5015*) dflt="$ccflags";;
5016esac
40a7a20a 5017
bd9b35c9
JH
5018case "$dflt" in
5019''|' ') dflt=none;;
5020esac
422af00a 5021
bd9b35c9 5022$cat <<EOH
40a7a20a 5023
bd9b35c9
JH
5024Your C compiler may want other flags. For this question you should include
5025-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5026but you should NOT include libraries or ld flags like -lwhatever. If you
5027want $package to honor its debug switch, you should include -DDEBUGGING here.
5028Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 5029
bd9b35c9 5030To use no flags, specify the word "none".
40a7a20a 5031
bd9b35c9
JH
5032EOH
5033set X $dflt
5034shift
5035dflt=${1+"$@"}
5036rp="Any additional cc flags?"
5037. ./myread
5038case "$ans" in
5039none) ccflags='';;
5040*) ccflags="$ans";;
5041esac
8e07c86e 5042
bd9b35c9 5043: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
5044case "$cppflags" in
5045'') cppflags="$ccflags" ;;
5046*) cppflags="$cppflags $ccflags" ;;
5047esac
bd9b35c9
JH
5048case "$gccversion" in
50491*) cppflags="$cppflags -D__GNUC__"
4633a7c4 5050esac
bd9b35c9
JH
5051case "$mips_type" in
5052'');;
5053*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5054esac
5055case "$cppflags" in
5056'');;
5057*)
5058 echo " "
5059 echo "Let me guess what the preprocessor flags are..." >&4
5060 set X $cppflags
5061 shift
5062 cppflags=''
5063 $cat >cpp.c <<'EOM'
5064#define BLURFL foo
8e07c86e 5065
bd9b35c9
JH
5066BLURFL xx LFRULB
5067EOM
5068 previous=''
5069 for flag in $*
5070 do
5071 case "$flag" in
5072 -*) ftry="$flag";;
5073 *) ftry="$previous $flag";;
5074 esac
5075 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5076 >cpp1.out 2>/dev/null && \
5077 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5078 >cpp2.out 2>/dev/null && \
5079 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5080 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5081 then
5082 cppflags="$cppflags $ftry"
5083 previous=''
5084 else
5085 previous="$flag"
5086 fi
5087 done
5088 set X $cppflags
5089 shift
5090 cppflags=${1+"$@"}
5091 case "$cppflags" in
5092 *-*) echo "They appear to be: $cppflags";;
5093 esac
5094 $rm -f cpp.c cpp?.out
2afac517 5095 ;;
5096esac
8e07c86e 5097
bd9b35c9
JH
5098: flags used in final linking phase
5099case "$ldflags" in
5100'') if ./venix; then
5101 dflt='-i -z'
10a23457 5102 else
bd9b35c9 5103 dflt=''
10a23457 5104 fi
bd9b35c9
JH
5105 case "$ccflags" in
5106 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 5107 esac
bd9b35c9
JH
5108 ;;
5109*) dflt="$ldflags";;
5110esac
5111
5112: Try to guess additional flags to pick up local libraries.
5113for thislibdir in $libpth; do
5114 case " $loclibpth " in
5115 *" $thislibdir "*)
00e89ad4 5116 case "$dflt " in
bd9b35c9
JH
5117 *"-L$thislibdir "*) ;;
5118 *) dflt="$dflt -L$thislibdir" ;;
5119 esac
c4f23d77
AD
5120 ;;
5121 esac
bd9b35c9 5122done
c4f23d77 5123
bd9b35c9
JH
5124case "$dflt" in
5125'') dflt='none' ;;
5126esac
c4f23d77 5127
bd9b35c9
JH
5128$cat <<EOH
5129
5130Your C linker may need flags. For this question you should
5131include -L/whatever and any other flags used by the C linker, but you
5132should NOT include libraries like -lwhatever.
5133
5134Make sure you include the appropriate -L/path flags if your C linker
5135does not normally search all of the directories you specified above,
5136namely
5137 $libpth
5138To use no flags, specify the word "none".
5139
5140EOH
5141
5142rp="Any additional ld flags (NOT including libraries)?"
5143. ./myread
5144case "$ans" in
5145none) ldflags='';;
5146*) ldflags="$ans";;
5147esac
5148rmlist="$rmlist pdp11"
5149
5150: coherency check
5151echo " "
5152echo "Checking your choice of C compiler and flags for coherency..." >&4
5153$cat > try.c <<'EOF'
5154#include <stdio.h>
55954f19 5155int main() { printf("Ok\n"); return(0); }
bd9b35c9 5156EOF
7a282f6d 5157set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
5158shift
5159$cat >try.msg <<'EOM'
5160I've tried to compile and run the following simple program:
5161
5162EOM
5163$cat try.c >> try.msg
5164
5165$cat >> try.msg <<EOM
5166
5167I used the command:
5168
5169 $*
5440bc8e 5170 $run ./try
bd9b35c9
JH
5171
5172and I got the following output:
5173
5174EOM
5175dflt=y
73614538 5176if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5440bc8e
JH
5177 if $sh -c "$run ./try" >>try.msg 2>&1; then
5178 xxx=`$run ./try`
bd9b35c9
JH
5179 case "$xxx" in
5180 "Ok") dflt=n ;;
5181 *) echo 'The program compiled OK, but produced no output.' >> try.msg
5182 case " $libs " in
5183 *" -lsfio "*)
5184 cat >> try.msg <<'EOQS'
5185If $libs contains -lsfio, and sfio is mis-configured, then it
5186sometimes (apparently) runs and exits with a 0 status, but with no
5187output! It may have to do with sfio's use of _exit vs. exit.
5188
5189EOQS
5190 rp="You have a big problem. Shall I abort Configure"
5191 dflt=y
5192 ;;
5193 esac
5194 ;;
5195 esac
5196 else
5197 echo "The program compiled OK, but exited with status $?." >>try.msg
5198 rp="You have a problem. Shall I abort Configure"
5199 dflt=y
5200 fi
5201else
5202 echo "I can't compile the test program." >>try.msg
5203 rp="You have a BIG problem. Shall I abort Configure"
5204 dflt=y
5205fi
5206case "$dflt" in
5207y)
5208 $cat try.msg >&4
5209 case "$knowitall" in
5210 '')
5211 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5212 ;;
bd9b35c9 5213 *) dflt=n;;
c4f23d77 5214 esac
bd9b35c9
JH
5215 echo " "
5216 . ./myread
5217 case "$ans" in
5218 n*|N*) ;;
5219 *) echo "Ok. Stopping Configure." >&4
5220 exit 1
c4f23d77
AD
5221 ;;
5222 esac
5223 ;;
bd9b35c9 5224n) echo "OK, that should do.";;
c4f23d77 5225esac
bd9b35c9 5226$rm -f try try.* core
c4f23d77 5227
bd9b35c9
JH
5228: define a shorthand compile call
5229compile='
5230mc_file=$1;
5231shift;
08413ebc 5232$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5233: define a shorthand compile call for compilations that should be ok.
5234compile_ok='
5235mc_file=$1;
5236shift;
7a282f6d 5237$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5238
8dfa8df9
JH
5239: determine filename position in cpp output
5240echo " "
5241echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5242case "$osname" in
5243vos) testaccess=-e ;;
5244*) testaccess=-r ;;
5245esac
8dfa8df9
JH
5246echo '#include <stdio.h>' > foo.c
5247$cat >fieldn <<EOF
5248$startsh
5249$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5250$grep '^[ ]*#.*stdio\.h' | \
5251while read cline; do
5252 pos=1
5253 set \$cline
5254 while $test \$# -gt 0; do
a5a94ea5 5255 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5256 echo "\$pos"
5257 exit 0
5258 fi
5259 shift
5260 pos=\`expr \$pos + 1\`
5261 done
5262done
5263EOF
5264chmod +x fieldn
5265fieldn=`./fieldn`
5266$rm -f foo.c fieldn
5267case $fieldn in
5268'') pos='???';;
52691) pos=first;;
52702) pos=second;;
52713) pos=third;;
5272*) pos="${fieldn}th";;
5273esac
5274echo "Your cpp writes the filename in the $pos field of the line."
5275
3c728e00
JH
5276case "$osname" in
5277vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5c728af0 5278os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5279*) cppfilter='' ;;
5280esac
8dfa8df9
JH
5281: locate header file
5282$cat >findhdr <<EOF
5283$startsh
5284wanted=\$1
5285name=''
5286for usrincdir in $usrinc
5287do
5288 if test -f \$usrincdir/\$wanted; then
5289 echo "\$usrincdir/\$wanted"
5290 exit 0
5291 fi
5292done
5293awkprg='{ print \$$fieldn }'
5294echo "#include <\$wanted>" > foo\$\$.c
5295$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5296$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5297while read cline; do
5298 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5299 case "\$name" in
5300 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5301 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5302 *) exit 2;;
5303 esac;
5304done;
5305#
5306# status = 0: grep returned 0 lines, case statement not executed
5307# status = 1: headerfile found
5308# status = 2: while loop executed, no headerfile found
5309#
5310status=\$?
5311$rm -f foo\$\$.c;
5312if test \$status -eq 1; then
5313 exit 0;
5314fi
5315exit 1
5316EOF
5317chmod +x findhdr
5318
5319: define an alternate in-header-list? function
5320inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5321cont=true; xxf="echo \"<\$1> found.\" >&4";
5322case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5323*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5324esac;
5325case $# in 4) instead=instead;; *) instead="at last";; esac;
5326while $test "$cont"; do
5327 xxx=`./findhdr $1`
5328 var=$2; eval "was=\$$2";
5329 if $test "$xxx" && $test -r "$xxx";
5330 then eval $xxf;
5331 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5332 cont="";
5333 else eval $xxnf;
5334 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5335 set $yyy; shift; shift; yyy=$@;
5336 case $# in 0) cont="";;
5337 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5338 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5339 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5340 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5341 esac;
5342done;
5343while $test "$yyy";
5344do set $yyy; var=$2; eval "was=\$$2";
5345 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5346 set $yyy; shift; shift; yyy=$@;
5347done'
5348
d1daaddf
JH
5349: see if stdlib is available
5350set stdlib.h i_stdlib
5351eval $inhdr
5352
5353: check for lengths of integral types
5354echo " "
5355case "$intsize" in
5356'')
5357 echo "Checking to see how big your integers are..." >&4
c63dfae1 5358 $cat >try.c <<EOCP
d1daaddf
JH
5359#include <stdio.h>
5360#$i_stdlib I_STDLIB
5361#ifdef I_STDLIB
5362#include <stdlib.h>
5363#endif
5364int main()
5365{
5366 printf("intsize=%d;\n", (int)sizeof(int));
5367 printf("longsize=%d;\n", (int)sizeof(long));
5368 printf("shortsize=%d;\n", (int)sizeof(short));
5369 exit(0);
5370}
5371EOCP
5372 set try
5373 if eval $compile_ok && $run ./try > /dev/null; then
5374 eval `$run ./try`
5375 echo "Your integers are $intsize bytes long."
5376 echo "Your long integers are $longsize bytes long."
5377 echo "Your short integers are $shortsize bytes long."
5378 else
5379 $cat >&4 <<EOM
5380!
5381Help! I can't compile and run the intsize test program: please enlighten me!
5382(This is probably a misconfiguration in your system or libraries, and
5383you really ought to fix it. Still, I'll try anyway.)
5384!
5385EOM
5386 dflt=4
5387 rp="What is the size of an integer (in bytes)?"
5388 . ./myread
5389 intsize="$ans"
5390 dflt=$intsize
5391 rp="What is the size of a long integer (in bytes)?"
5392 . ./myread
5393 longsize="$ans"
5394 dflt=2
5395 rp="What is the size of a short integer (in bytes)?"
5396 . ./myread
5397 shortsize="$ans"
5398 fi
5399 ;;
5400esac
5401$rm -f try try.*
5402
5403: check for long long
5404echo " "
5405echo "Checking to see if you have long long..." >&4
5406echo 'int main() { long long x = 7; return 0; }' > try.c
5407set try
5408if eval $compile; then
5409 val="$define"
5410 echo "You have long long."
5411else
5412 val="$undef"
5413 echo "You do not have long long."
5414fi
5415$rm try.*
5416set d_longlong
5417eval $setvar
5418
5419: check for length of long long
5420case "${d_longlong}${longlongsize}" in
5421$define)
5422 echo " "
5423 echo "Checking to see how big your long longs are..." >&4
5424 $cat >try.c <<'EOCP'
5425#include <stdio.h>
5426int main()
5427{
5428 printf("%d\n", (int)sizeof(long long));
5429 return(0);
5430}
5431EOCP
5432 set try
5433 if eval $compile_ok; then
5434 longlongsize=`$run ./try`
5435 echo "Your long longs are $longlongsize bytes long."
5436 else
5437 dflt='8'
5438 echo " "
5439 echo "(I can't seem to compile the test program. Guessing...)"
5440 rp="What is the size of a long long (in bytes)?"
5441 . ./myread
5442 longlongsize="$ans"
5443 fi
5444 if $test "X$longsize" = "X$longlongsize"; then
5445 echo "(That isn't any different from an ordinary long.)"
5446 fi
5447 ;;
5448esac
5449$rm -f try.* try
5450
8dfa8df9
JH
5451: see if inttypes.h is available
5452: we want a real compile instead of Inhdr because some systems
5453: have an inttypes.h which includes non-existent headers
5454echo " "
5455$cat >try.c <<EOCP
5456#include <inttypes.h>
5457int main() {
5458 static int32_t foo32 = 0x12345678;
5459}
5460EOCP
5461set try
5462if eval $compile; then
5463 echo "<inttypes.h> found." >&4
5464 val="$define"
5465else
5466 echo "<inttypes.h> NOT found." >&4
5467 val="$undef"
5468fi
5469$rm -f try.c try
5470set i_inttypes
5471eval $setvar
5472
5473: check for int64_t
5474echo " "
5475echo "Checking to see if you have int64_t..." >&4
5476$cat >try.c <<EOCP
5477#include <sys/types.h>
5478#$i_inttypes I_INTTYPES
5479#ifdef I_INTTYPES
5480#include <inttypes.h>
5481#endif
5482int main() { int64_t x = 7; }
5483EOCP
5484set try
5485if eval $compile; then
5486 val="$define"
5487 echo "You have int64_t."
5488else
5489 val="$undef"
5490 echo "You do not have int64_t."
5491fi
5492$rm -f try try.*
5493set d_int64_t
5494eval $setvar
5495
5496
5497echo " "
5498echo "Checking which 64-bit integer type we could use..." >&4
5499
5500case "$intsize" in
55018) val=int
5502 set quadtype
5503 eval $setvar
5504 val='"unsigned int"'
5505 set uquadtype
5506 eval $setvar
5507 quadkind=1
5508 ;;
5509*) case "$longsize" in
5510 8) val=long
5511 set quadtype
5512 eval $setvar
5513 val='"unsigned long"'
5514 set uquadtype
5515 eval $setvar
5516 quadkind=2
5517 ;;
5518 *) case "$d_longlong:$longlongsize" in
5519 define:8)
5520 val='"long long"'
5521 set quadtype
5522 eval $setvar
5523 val='"unsigned long long"'
5524 set uquadtype
5525 eval $setvar
5526 quadkind=3
5527 ;;
5528 *) case "$d_int64_t" in
5529 define)
5530 val=int64_t
5531 set quadtype
5532 eval $setvar
5533 val=uint64_t
5534 set uquadtype
5535 eval $setvar
5536 quadkind=4
5537 ;;
5538 esac
5539 ;;
5540 esac
5541 ;;
5542 esac
5543 ;;
5544esac
5545
5546case "$quadtype" in
5547'') echo "Alas, no 64-bit integer types in sight." >&4
5548 d_quad="$undef"
5549 ;;
5550*) echo "We could use '$quadtype' for 64-bit integers." >&4
5551 d_quad="$define"
5552 ;;
5553esac
5554
b4eb6b3d
JH
5555
5556case "$uselonglong" in
5557"$define"|true|[yY]*)
5558 cat <<EOM >&4
5559
5560*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5561EOM
5562 use64bitint="$define"
5563 ;;
5564esac
5565case "$use64bits" in
5566"$define"|true|[yY]*)
5567 cat <<EOM >&4
5568
5569*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5570EOM
5571 use64bitint="$define"
5572 ;;
5573esac
5574case "$use64bitints" in
5575"$define"|true|[yY]*)
5576 cat <<EOM >&4
5577
5578*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5579EOM
5580 use64bitint="$define"
5581 ;;
5582esac
5583case "$use64bitsint" in
5584"$define"|true|[yY]*)
5585 cat <<EOM >&4
5586
5587*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5588EOM
5589 use64bitint="$define"
5590 ;;
5591esac
5592case "$uselonglongs" in
5593"$define"|true|[yY]*)
5594 cat <<EOM >&4
5595
5596*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5597EOM
5598 use64bitint="$define"
5599 ;;
5600esac
5601case "$use64bitsall" in
5602"$define"|true|[yY]*)
5603 cat <<EOM >&4
5604
5605*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5606EOM
5607 use64bitall="$define"
5608 ;;
5609esac
5610
5611case "$ccflags" in
5612*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5613esac
5614case "$use64bitall" in
5615"$define"|true|[yY]*) use64bitint="$define" ;;
5616esac
5617
5618case "$longsize" in
56198) cat <<EOM
5620
5621You have natively 64-bit long integers.
5622EOM
5623 val="$define"
5624 ;;
5625*) case "$use64bitint" in
5626 "$define"|true|[yY]*) dflt='y';;
5627 *) dflt='n';;
5628 esac
8dfa8df9
JH
5629 case "$d_quad" in
5630 "$define") ;;
5631 *) dflt='n' ;;
5632 esac
b4eb6b3d
JH
5633 cat <<EOM
5634
5635Perl can be built to take advantage of 64-bit integer types
5636on some systems. To do so, Configure can be run with -Duse64bitint.
5637Choosing this option will most probably introduce binary incompatibilities.
5638
5639If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5640(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5641EOM
5642 rp='Try to use 64-bit integers, if available?'
5643 . ./myread
5644 case "$ans" in
5645 [yY]*) val="$define" ;;
5646 *) val="$undef" ;;
5647 esac
5648 ;;
5649esac
5650set use64bitint
5651eval $setvar
5652
5653case "$use64bitall" in
5654"$define"|true|[yY]*) dflt='y' ;;
5655*) case "$longsize" in
5656 8) dflt='y' ;;
5657 *) dflt='n' ;;
5658 esac
5659 ;;
5660esac
5661cat <<EOM
5662
5663You may also choose to try maximal 64-bitness. It means using as much
566464-bitness as possible on the platform. This in turn means even more
5665binary incompatibilities. On the other hand, your platform may not
5666have any more 64-bitness available than what you already have chosen.
5667
5668If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5669(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5670EOM
5671rp='Try to use maximal 64-bit support, if available?'
5672. ./myread
5673case "$ans" in
5674[yY]*) val="$define" ;;
5675*) val="$undef" ;;
5676esac
5677set use64bitall
5678eval $setvar
5679case "$use64bitall" in
5680"$define")
5681 case "$use64bitint" in
5682 "$undef")
5683 cat <<EOM
5684
5685Since you have chosen a maximally 64-bit build, I'm also turning on
5686the use of 64-bit integers.
5687EOM
5688 use64bitint="$define" ;;
5689 esac
5690 ;;
5691esac
5692
b4eb6b3d
JH
5693: Look for a hint-file generated 'call-back-unit'. If the
5694: user has specified that a 64-bit perl is to be built,
5695: we may need to set or change some other defaults.
19a100ff 5696if $test -f use64bitint.cbu; then
9da7673b 5697 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
19a100ff
MB
5698 . ./use64bitint.cbu
5699fi
9da7673b
MB
5700case "$use64bitint" in
5701"$define"|true|[yY]*)
b4eb6b3d
JH
5702 case "$longsize" in
5703 4) case "$archname64" in
5704 '') archname64=64int ;;
5705 esac
5706 ;;
5707 esac
5708 ;;
5709esac
5710
b4eb6b3d
JH
5711: Look for a hint-file generated 'call-back-unit'. If the
5712: user has specified that a maximally 64-bit perl is to be built,
5713: we may need to set or change some other defaults.
19a100ff 5714if $test -f use64bitall.cbu; then
9da7673b 5715 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
19a100ff
MB
5716 . ./use64bitall.cbu
5717fi
9da7673b
MB
5718case "$use64bitall" in
5719"$define"|true|[yY]*)
b4eb6b3d
JH
5720 case "$longsize" in
5721 4) case "$archname64" in
5722 ''|64int) archname64=64all ;;
5723 esac
5724 ;;
5725 esac
5726 ;;
5727esac
5728
1911a026
JH
5729case "$d_quad:$use64bitint" in
5730$undef:$define)
5731 cat >&4 <<EOF
5732
5733*** You have chosen to use 64-bit integers,
19a100ff 5734*** but none can be found.
09b58c7b 5735*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
1911a026
JH
5736*** Cannot continue, aborting.
5737
5738EOF
5739 exit 1
5740 ;;
5741esac
5742
36adc09b
JH
5743: check for length of double
5744echo " "
5745case "$doublesize" in
5746'')
5747 echo "Checking to see how big your double precision numbers are..." >&4
5748 $cat >try.c <<EOCP
5749#include <stdio.h>
1911a026
JH
5750#$i_stdlib I_STDLIB
5751#ifdef I_STDLIB
5752#include <stdlib.h>
5753#endif
36adc09b
JH
5754int main()
5755{
5756 printf("%d\n", (int)sizeof(double));
1911a026 5757 exit(0);
36adc09b
JH
5758}
5759EOCP
5760 set try
5761 if eval $compile_ok; then
5762 doublesize=`$run ./try`
5763 echo "Your double is $doublesize bytes long."
5764 else
5765 dflt='8'
5766 echo "(I can't seem to compile the test program. Guessing...)"
5767 rp="What is the size of a double precision number (in bytes)?"
5768 . ./myread
5769 doublesize="$ans"
5770 fi
5771 ;;
5772esac
5773$rm -f try.c try
5774
5775: check for long doubles
5776echo " "
5777echo "Checking to see if you have long double..." >&4
5778echo 'int main() { long double x = 7.0; }' > try.c
5779set try
5780if eval $compile; then
5781 val="$define"
5782 echo "You have long double."
5783else
5784 val="$undef"
5785 echo "You do not have long double."
5786fi
5787$rm try.*
5788set d_longdbl
5789eval $setvar
5790
5791: check for length of long double
5792case "${d_longdbl}${longdblsize}" in
5793$define)
5794 echo " "
5795 echo "Checking to see how big your long doubles are..." >&4
5796 $cat >try.c <<'EOCP'
5797#include <stdio.h>
5798int main()
5799{
5800 printf("%d\n", sizeof(long double));
5801}
5802EOCP
5803 set try
5804 set try
5805 if eval $compile; then
5806 longdblsize=`$run ./try`
5807 echo "Your long doubles are $longdblsize bytes long."
5808 else
5809 dflt='8'
5810 echo " "
5811 echo "(I can't seem to compile the test program. Guessing...)" >&4
5812 rp="What is the size of a long double (in bytes)?"
5813 . ./myread
5814 longdblsize="$ans"
5815 fi
5816 if $test "X$doublesize" = "X$longdblsize"; then
7ad90562
AD
5817 echo "That isn't any different from an ordinary double."
5818 echo "I'll keep your setting anyway, but you may see some"
5819 echo "harmless compilation warnings."
36adc09b
JH
5820 fi
5821 ;;
5822esac
5823$rm -f try.* try
5824
89ce900e 5825: determine the architecture name
b4eb6b3d 5826echo " "
89ce900e
JH
5827if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5828 tarch=`arch`"-$osname"
5829elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5830 if uname -m > tmparch 2>&1 ; then
5831 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5832 -e 's/$/'"-$osname/" tmparch`
5833 else
5834 tarch="$osname"
5835 fi
5836 $rm -f tmparch
b4eb6b3d 5837else
89ce900e 5838 tarch="$osname"
b4eb6b3d 5839fi
89ce900e
JH
5840case "$myarchname" in
5841''|"$tarch") ;;
5842*)
5843 echo "(Your architecture name used to be $myarchname.)"
5844 archname=''
5845 ;;
5846esac
5847case "$targetarch" in
5848'') ;;
5849*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5850esac
5851myarchname="$tarch"
5852case "$archname" in
5853'') dflt="$tarch";;
5854*) dflt="$archname";;
5855esac
5856rp='What is your architecture name'
5857. ./myread
5858archname="$ans"
5859case "$usethreads" in
5860$define)
5861 echo "Threads selected." >&4
5862 case "$archname" in
5863 *-thread*) echo "...and architecture name already has -thread." >&4
5864 ;;
5865 *) archname="$archname-thread"
5866 echo "...setting architecture name to $archname." >&4
5867 ;;
5868 esac
5869 ;;
5870esac
5871case "$usemultiplicity" in
5872$define)
5873 echo "Multiplicity selected." >&4
5874 case "$archname" in
5875 *-multi*) echo "...and architecture name already has -multi." >&4
5876 ;;
5877 *) archname="$archname-multi"
5878 echo "...setting architecture name to $archname." >&4
5879 ;;
5880 esac
5881 ;;
5882esac
5883case "$use64bitint$use64bitall" in
5884*"$define"*)
5885 case "$archname64" in
5886 '')
5887 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
bd9b35c9 5888 ;;
89ce900e
JH
5889 *)
5890 case "$use64bitint" in
5891 "$define") echo "64 bit integers selected." >&4 ;;
5892 esac
5893 case "$use64bitall" in
5894 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5895 esac
5896 case "$archname" in
5897 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5898 ;;
5899 *) archname="$archname-$archname64"
5900 echo "...setting architecture name to $archname." >&4
5901 ;;
5902 esac
c1a7f87b
JH
5903 ;;
5904 esac
89ce900e
JH
5905esac
5906case "$uselongdouble" in
5907$define)
5908 echo "Long doubles selected." >&4
5909 case "$longdblsize" in
5910 $doublesize)
5911 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5912 ;;
5913 *)
5914 case "$archname" in
5915 *-ld*) echo "...and architecture name already has -ld." >&4
5916 ;;
5917 *) archname="$archname-ld"
5918 echo "...setting architecture name to $archname." >&4
5919 ;;
5920 esac
bd9b35c9
JH
5921 ;;
5922 esac
bd9b35c9 5923 ;;
89ce900e
JH
5924esac
5925case "$useperlio" in
5926$define)
5927 echo "Perlio selected." >&4
5928 ;;
bd9b35c9 5929*)
89ce900e
JH
5930 echo "Perlio not selected, using stdio." >&4
5931 case "$archname" in
5932 *-stdio*) echo "...and architecture name already has -stdio." >&4
5933 ;;
5934 *) archname="$archname-stdio"
5935 echo "...setting architecture name to $archname." >&4
5936 ;;
5937 esac
bd9b35c9
JH
5938 ;;
5939esac
d2e0c6f7
JH
5940if $test -f archname.cbu; then
5941 echo "Your platform has some specific hints for architecture name, using them..."
5942 . ./archname.cbu
5943fi
bd9b35c9 5944
b4eb6b3d
JH
5945: set the prefixit variable, to compute a suitable default value
5946prefixit='case "$3" in
5947""|none)
5948 case "$oldprefix" in
5949 "") eval "$1=\"\$$2\"";;
5950 *)
5951 case "$3" in
5952 "") eval "$1=";;
5953 none)
5954 eval "tp=\"\$$2\"";
5955 case "$tp" in
5956 ""|" ") eval "$1=\"\$$2\"";;
5957 *) eval "$1=";;
5958 esac;;
5959 esac;;
5960 esac;;
5961*)
5962 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5963 case "$tp" in
5964 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5965 /*-$oldprefix/*|\~*-$oldprefix/*)
5966 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5967 *) eval "$1=\"\$$2\"";;
5968 esac;;
5969esac'
5970
b4eb6b3d
JH
5971: get the patchlevel
5972echo " "
5973echo "Getting the current patchlevel..." >&4
5974if $test -r $rsrc/patchlevel.h;then
5975 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5976 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5977 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5978 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5979 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5980 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
35918792 5981 perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
b4eb6b3d
JH
5982else
5983 revision=0
5984 patchlevel=0
5985 subversion=0
5986 api_revision=0
5987 api_version=0
5988 api_subversion=0
151e6568
MB
5989 perl_patchlevel=0
5990 $echo "(You do not have patchlevel.h. Eek.)"
b4eb6b3d 5991fi
35918792
YST
5992if $test -r $rsrc/.patch ; then
5993 if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
151e6568
MB
5994 perl_patchlevel=`cat $rsrc/.patch`
5995 fi
5996fi
861eb78d 5997: Define a handy string here to avoid duplication in myconfig.SH and configpm.
f3f1a2d8
MB
5998version_patchlevel_string="version $patchlevel subversion $subversion"
5999case "$perl_patchlevel" in
60000|'') ;;
6001*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4d20abad 6002esac
4d20abad 6003
f3f1a2d8 6004$echo "(You have $package $version_patchlevel_string.)"
4d20abad 6005
f3f1a2d8
MB
6006case "$osname" in
6007dos|vms)
6008 : XXX Should be a Configure test for double-dots in filenames.
6009 version=`echo $revision $patchlevel $subversion | \
6010 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6011 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6012 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6013 ;;
6014*)
6015 version=`echo $revision $patchlevel $subversion | \
6016 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6017 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6018 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6019 ;;
4d20abad 6020esac
f3f1a2d8
MB
6021: Special case the 5.005_xx maintenance series, which used 5.005
6022: without any subversion label as a subdirectory in $sitelib
6023if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6024 api_versionstring='5.005'
6025fi
4d20abad 6026
f3f1a2d8
MB
6027: determine installation style
6028: For now, try to deduce it from prefix unless it is already set.
6029: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6030case "$installstyle" in
6031'') case "$prefix" in
6032 *perl*) dflt='lib';;
6033 *) dflt='lib/perl5' ;;
6034 esac
6035 ;;
6036*) dflt="$installstyle" ;;
4d20abad 6037esac
f3f1a2d8
MB
6038: Probably not worth prompting for this since we prompt for all
6039: the directories individually, and the prompt would be too long and
6040: confusing anyway.
6041installstyle=$dflt
4d20abad 6042
eaf812ae
MB
6043: determine where public executables go
6044echo " "
6045set dflt bin bin
6046eval $prefixit
6047fn=d~
6048rp='Pathname where the public executables will reside?'
6049. ./getfile
6050if $test "X$ansexp" != "X$binexp"; then
6051 installbin=''
6052fi
6053prefixvar=bin
6054: XXX Bug? -- ignores Configure -Dinstallprefix setting.
d0e36aa9 6055: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
a2d23ec2 6056: this via initialinstalllocation
eaf812ae
MB
6057. ./setprefixvar
6058
6059case "$userelocatableinc" in
6060$define|true|[yY]*) dflt='y' ;;
6061*) dflt='n' ;;
6062esac
6063cat <<EOM
6064
6065Would you like to build Perl so that the installation is relocatable, so that
6066library paths in @INC are determined relative to the path of the perl binary?
6067This is not advised for system Perl installs, or if you need to run setid
6068scripts or scripts under taint mode.
6069
6070If this doesn't make any sense to you, just accept the default '$dflt'.
6071EOM
6072rp='Use relocatable @INC?'
6073. ./myread
6074case "$ans" in
6075y|Y) val="$define" ;;
6076*) val="$undef" ;;
6077esac
6078set userelocatableinc
6079eval $setvar
6080
ea7d701d 6081initialinstalllocation="$binexp"
eaf812ae
MB
6082: Default prefix is now "up one level from where the binaries are"
6083case "$userelocatableinc" in
6084$define|true|[yY]*)
eaf812ae
MB
6085 bin=".../"
6086 binexp=".../"
6087 prefix=".../.."
6088 prefixexp=".../.."
6089 installprefixexp=".../.."
6090 ;;
6091esac
6092
b4eb6b3d
JH
6093: determine where private library files go
6094: Usual default is /usr/local/lib/perl5/$version.
f3f1a2d8 6095: Also allow things like /opt/perl/lib/$version, since
b4eb6b3d
JH
6096: /opt/perl/lib/perl5... would be redundant.
6097: The default "style" setting is made in installstyle.U
6098case "$installstyle" in
6099*lib/perl5*) set dflt privlib lib/$package/$version ;;
6100*) set dflt privlib lib/$version ;;
6101esac
6102eval $prefixit
6103$cat <<EOM
6104
6105There are some auxiliary files for $package that need to be put into a
6106private library directory that is accessible by everyone.
6107
6108EOM
eaf812ae 6109fn=$binexp
b4eb6b3d
JH
6110fn=d~+
6111rp='Pathname where the private library files will reside?'
6112. ./getfile
79522dd2
NC
6113prefixvar=privlib
6114. ./setprefixvar
b4eb6b3d
JH
6115
6116: set the prefixup variable, to restore leading tilda escape
6117prefixup='case "$prefixexp" in
6118"$prefix") ;;
6119*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6120esac'
6121
6122: determine where public architecture dependent libraries go
6123set archlib archlib
6124eval $prefixit
6125: privlib default is /usr/local/lib/$package/$version
6126: archlib default is /usr/local/lib/$package/$version/$archname
6127: privlib may have an optional trailing /share.
6128tdflt=`echo $privlib | $sed 's,/share$,,'`
6129tdflt=$tdflt/$archname
6130case "$archlib" in
6131'') dflt=$tdflt
6132 ;;
6133*) dflt="$archlib"
6134 ;;
6135esac
6136$cat <<EOM
6137
6138$spackage contains architecture-dependent library files. If you are
6139sharing libraries in a heterogeneous environment, you might store
6140these files in a separate location. Otherwise, you can just include
6141them with the rest of the public library files.
6142
6143EOM
eaf812ae 6144fn=$binexp
b4eb6b3d
JH
6145fn=d+~
6146rp='Where do you want to put the public architecture-dependent libraries?'
6147. ./getfile
79522dd2
NC
6148prefixvar=archlib
6149. ./setprefixvar
b4eb6b3d
JH
6150if $test X"$archlib" = X"$privlib"; then
6151 d_archlib="$undef"
6152else
6153 d_archlib="$define"
6154fi
b4eb6b3d 6155
b4eb6b3d
JH
6156: see if setuid scripts can be secure
6157$cat <<EOM
6158
6159Some kernels have a bug that prevents setuid #! scripts from being
6160secure. Some sites have disabled setuid #! scripts because of this.
6161
6162First let's decide if your kernel supports secure setuid #! scripts.
6163(If setuid #! scripts would be secure but have been disabled anyway,
6164don't say that they are secure if asked.)
6165
6166EOM
6167
6168val="$undef"
6169if $test -d /dev/fd; then
6170 echo "#!$ls" >reflect
6171 chmod +x,u+s reflect
6172 ./reflect >flect 2>&1
6173 if $contains "/dev/fd" flect >/dev/null; then
6174 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6175 val="$define"
6176 else
6177 $cat <<EOM
6178If you are not sure if they are secure, I can check but I'll need a
6179username and password different from the one you are using right now.
6180If you don't have such a username or don't want me to test, simply
6181enter 'none'.
6182
6183EOM
6184 rp='Other username to test security of setuid scripts with?'
6185 dflt='none'
6186 . ./myread
6187 case "$ans" in
6188 n|none)
6189 case "$d_suidsafe" in
6190 '') echo "I'll assume setuid scripts are *not* secure." >&4
6191 dflt=n;;
6192 "$undef")
6193 echo "Well, the $hint value is *not* secure." >&4
6194 dflt=n;;
6195 *) echo "Well, the $hint value *is* secure." >&4
6196 dflt=y;;
6197 esac
c1a7f87b 6198 ;;
b4eb6b3d
JH
6199 *)
6200 $rm -f reflect flect
6201 echo "#!$ls" >reflect
6202 chmod +x,u+s reflect
6203 echo >flect
6204 chmod a+w flect
6205 echo '"su" will (probably) prompt you for '"$ans's password."
6206 su $ans -c './reflect >flect'
6207 if $contains "/dev/fd" flect >/dev/null; then
6208 echo "Okay, it looks like setuid scripts are secure." >&4
6209 dflt=y
6210 else
6211 echo "I don't think setuid scripts are secure." >&4
6212 dflt=n
6213 fi
6214 ;;
6215 esac
6216 rp='Does your kernel have *secure* setuid scripts?'
6217 . ./myread
6218 case "$ans" in
6219 [yY]*) val="$define";;
6220 *) val="$undef";;
6221 esac
6222 fi
6223else
6224 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6225 echo "(That's for file descriptors, not floppy disks.)"
6226 val="$undef"
6227fi
6228set d_suidsafe
6229eval $setvar
6230
6231$rm -f reflect flect
6232
6233: now see if they want to do setuid emulation
6234echo " "
6235val="$undef"
6236case "$d_suidsafe" in
6237"$define")
6238 val="$undef"
3c728e00 6239 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d 6240 ;;
f3f1a2d8
MB
6241*)
6242 $cat <<EOM
6243Some systems have disabled setuid scripts, especially systems where
6244setuid scripts cannot be secure. On systems where setuid scripts have
6245been disabled, the setuid/setgid bits on scripts are currently
6246useless. It is possible for $package to detect those bits and emulate
6247setuid/setgid in a secure fashion. This emulation will only work if
6248setuid scripts have been disabled in your kernel.
6249
6250EOM
6251 case "$d_dosuid" in
6252 "$define") dflt=y ;;
6253 *) dflt=n ;;
6254 esac
6255 rp="Do you want to do setuid/setgid emulation?"
6256 . ./myread
6257 case "$ans" in
6258 [yY]*) val="$define";;
6259 *) val="$undef";;
6260 esac
6261 ;;
6262esac
6263set d_dosuid
6264eval $setvar
6265
f3f1a2d8
MB
6266: Find perl5.005 or later.
6267echo "Looking for a previously installed perl5.005 or later... "
6268case "$perl5" in
6269'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6270 : Check if this perl is recent and can load a simple module
6271 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6272 perl5=$tdir/perl
6273 break;
6274 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6275 perl5=$tdir/perl5
6276 break;
6277 fi
6278 done
6279 ;;
6280*) perl5="$perl5"
6281 ;;
6282esac
6283case "$perl5" in
6284'') echo "None found. That's ok.";;
6285*) echo "Using $perl5." ;;
6286esac
6287
6288$cat <<EOM
6289
6290After $package is installed, you may wish to install various
6291add-on modules and utilities. Typically, these add-ons will
6292be installed under $prefix with the rest
6293of this package. However, you may wish to install such add-ons
6294elsewhere under a different prefix.
6295
6296If you do not wish to put everything under a single prefix, that's
6297ok. You will be prompted for the individual locations; this siteprefix
6298is only used to suggest the defaults.
6299
6300The default should be fine for most people.
6301
6302EOM
6303fn=d~+
6304rp='Installation prefix to use for add-on modules and utilities?'
6305: XXX Here might be another good place for an installstyle setting.
6306case "$siteprefix" in
6307'') dflt=$prefix ;;
6308*) dflt=$siteprefix ;;
6309esac
6310. ./getfile
6311: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6312oldsiteprefix=''
6313case "$siteprefix" in
6314'') ;;
6315*) case "$ans" in
6316 "$prefix") ;;
6317 *) oldsiteprefix="$prefix";;
6318 esac
6319 ;;
6320esac
6321siteprefix="$ans"
6322siteprefixexp="$ansexp"
6323
6324: determine where site specific libraries go.
6325: Usual default is /usr/local/lib/perl5/site_perl/$version
6326: The default "style" setting is made in installstyle.U
6327: XXX No longer works with Prefixit stuff.
6328prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6329case "$sitelib" in
6330'') case "$installstyle" in
6331 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6332 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6333 esac
6334 ;;
6335*) dflt="$sitelib"
6336 ;;
6337esac
6338$cat <<EOM
6339
6340The installation process will create a directory for
6341site-specific extensions and modules. Most users find it convenient
6342to place all site-specific files in this directory rather than in the
6343main distribution directory.
6344
6345EOM
6346fn=d~+
6347rp='Pathname for the site-specific library files?'
6348. ./getfile
6349prefixvar=sitelib
6350. ./setprefixvar
6351sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6352
6353: Determine list of previous versions to include in @INC
6354$cat > getverlist <<EOPL
6355#!$perl5 -w
6356use File::Basename;
6357\$api_versionstring = "$api_versionstring";
6358\$version = "$version";
6359\$stem = "$sitelib_stem";
6360\$archname = "$archname";
6361EOPL
6362 $cat >> getverlist <<'EOPL'
13cfc98d
MB
6363# The list found is store twice for each entry: the original name, and
6364# the binary broken down version as pack "sss", so sorting is easy and
6365# unambiguous. This will work for all versions that have a maximum of
6366# three digit groups, separate by '.'s or '_'s. Names are extended with
6367# ".0.0" to ensure at least three elements for the pack.
6368# -- H.Merijn Brand (m)'06 23-10-2006
6369
f3f1a2d8
MB
6370# Can't have leading @ because metaconfig interprets it as a command!
6371;@inc_version_list=();
6372# XXX Redo to do opendir/readdir?
6373if (-d $stem) {
6374 chdir($stem);
13cfc98d
MB
6375 ;@candidates = map {
6376 [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
f3f1a2d8
MB
6377}
6378else {
6379 ;@candidates = ();
6380}
6381
13cfc98d
MB
6382($pversion, $aversion, $vsn5005) = map {
6383 pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
f3f1a2d8 6384foreach $d (@candidates) {
13cfc98d
MB
6385 if ($d->[1] lt $pversion) {
6386 if ($d->[1] ge $aversion) {
6387 unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
f3f1a2d8 6388 }
13cfc98d
MB
6389 elsif ($d->[1] ge $vsn5005) {
6390 unshift(@inc_version_list, grep { -d } $d->[0]);
f3f1a2d8
MB
6391 }
6392 }
6393 else {
6394 # Skip newer version. I.e. don't look in
6395 # 5.7.0 if we're installing 5.6.1.
6396 }
6397}
6398
6399if (@inc_version_list) {
6400 print join(' ', @inc_version_list);
6401}
6402else {
6403 # Blank space to preserve value for next Configure run.
6404 print " ";
6405}
6406EOPL
6407chmod +x getverlist
6408case "$inc_version_list" in
6409'') if test -x "$perl5$exe_ext"; then
6410 dflt=`$perl5 getverlist`
6411 else
6412 dflt='none'
6413 fi
6414 ;;
6415$undef) dflt='none' ;;
6416*) eval dflt=\"$inc_version_list\" ;;
6417esac
6418case "$dflt" in
6419''|' ') dflt=none ;;
6420esac
6421case "$dflt" in
64225.005) dflt=none ;;
6423esac
6424$cat <<EOM
6425
6426In order to ease the process of upgrading, this version of perl
6427can be configured to use modules built and installed with earlier
6428versions of perl that were installed under $prefix. Specify here
6429the list of earlier versions that this version of perl should check.
6430If Configure detected no earlier versions of perl installed under
6431$prefix, then the list will be empty. Answer 'none' to tell perl
6432to not search earlier versions.
b4eb6b3d 6433
f3f1a2d8
MB
6434The default should almost always be sensible, so if you're not sure,
6435just accept the default.
b4eb6b3d 6436EOM
f3f1a2d8
MB
6437
6438rp='List of earlier versions to include in @INC?'
6439. ./myread
6440case "$ans" in
6441[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6442*) inc_version_list="$ans" ;;
6443esac
6444case "$inc_version_list" in
6445''|' ')
6446 inc_version_list_init='0'
6447 d_inc_version_list="$undef"
6448 ;;
6449*) inc_version_list_init=`echo $inc_version_list |
6450 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6451 d_inc_version_list="$define"
b4eb6b3d
JH
6452 ;;
6453esac
f3f1a2d8 6454$rm -f getverlist
b4eb6b3d 6455
b4eb6b3d 6456: see if this is a malloc.h system
01d07975
YST
6457: we want a real compile instead of Inhdr because some systems have a
6458: malloc.h that just gives a compile error saying to use stdlib.h instead
6459echo " "
6460$cat >try.c <<EOCP
6461#include <stdlib.h>
6462#include <malloc.h>
6463int main () { return 0; }
6464EOCP
6465set try
6466if eval $compile; then
6467 echo "<malloc.h> found." >&4
6468 val="$define"
6469else
6470 echo "<malloc.h> NOT found." >&4
6471 val="$undef"
6472fi
6473$rm -f try.c try
6474set i_malloc
6475eval $setvar
b4eb6b3d 6476
c8b93cf9
JH
6477: check for void type
6478echo " "
6479echo "Checking to see how well your C compiler groks the void type..." >&4
6480case "$voidflags" in
6481'')
c727eafa 6482 $cat >try.c <<EOCP
d1daaddf
JH
6483#$i_stdlib I_STDLIB
6484#ifdef I_STDLIB
6485#include <stdlib.h>
6486#endif
c8b93cf9
JH
6487#if TRY & 1
6488void sub() {
6489#else
6490sub() {
6491#endif
6492 extern void moo(); /* function returning void */
6493 void (*goo)(); /* ptr to func returning void */
6494#if TRY & 8
6495 void *hue; /* generic ptr */
6496#endif
6497#if TRY & 2
6498 void (*foo[10])();
6499#endif
6500
6501#if TRY & 4
6502 if(goo == moo) {
6503 exit(0);
6504 }
6505#endif
6506 exit(0);
6507}
6508int main() { sub(); }
6509EOCP
6510 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6511 voidflags=$defvoidused
6512 echo "Good. It appears to support void to the level $package wants.">&4
6513 if $contains warning .out >/dev/null 2>&1; then
6514 echo "However, you might get some warnings that look like this:"
6515 $cat .out
6516 fi
6517 else
6518echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6519 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6520 echo "It supports 1..."
6521 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6522 echo "It also supports 2..."
6523 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6524 voidflags=7
6525 echo "And it supports 4 but not 8 definitely."
6526 else
6527 echo "It doesn't support 4..."
6528 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6529 voidflags=11
6530 echo "But it supports 8."
6531 else
6532 voidflags=3
6533 echo "Neither does it support 8."
6534 fi
6535 fi
6536 else
6537 echo "It does not support 2..."
6538 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6539 voidflags=13
6540 echo "But it supports 4 and 8."
6541 else
6542 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6543 voidflags=5
6544 echo "And it supports 4 but has not heard about 8."
6545 else
6546 echo "However it supports 8 but not 4."
6547 fi
6548 fi
6549 fi
6550 else
6551 echo "There is no support at all for void."
6552 voidflags=0
6553 fi
6554 fi
6555esac
6556case "$voidflags" in
6557"$defvoidused") ;;
6558*) $cat >&4 <<'EOM'
6559 Support flag bits are:
6560 1: basic void declarations.
6561 2: arrays of pointers to functions returning void.
6562 4: operations between pointers to and addresses of void functions.
6563 8: generic void pointers.
6564EOM
6565 dflt="$voidflags";
6566 rp="Your void support flags add up to what?"
6567 . ./myread
6568 voidflags="$ans"
6569 ;;
6570esac
6571$rm -f try.* .out
6572
6573: check for length of pointer
6574echo " "
6575case "$ptrsize" in
6576'')
6577 echo "Checking to see how big your pointers are..." >&4
6578 if test "$voidflags" -gt 7; then
6579 echo '#define VOID_PTR char *' > try.c
6580 else
6581 echo '#define VOID_PTR void *' > try.c
6582 fi
74d00865 6583 $cat >>try.c <<EOCP
c8b93cf9 6584#include <stdio.h>
d1daaddf
JH
6585#$i_stdlib I_STDLIB
6586#ifdef I_STDLIB
6587#include <stdlib.h>
6588#endif
c8b93cf9
JH
6589int main()
6590{
6591 printf("%d\n", (int)sizeof(VOID_PTR));
6592 exit(0);
6593}
6594EOCP
6595 set try
6596 if eval $compile_ok; then
6597 ptrsize=`$run ./try`
6598 echo "Your pointers are $ptrsize bytes long."
6599 else
6600 dflt='4'
6601 echo "(I can't seem to compile the test program. Guessing...)" >&4
6602 rp="What is the size of a pointer (in bytes)?"
6603 . ./myread
6604 ptrsize="$ans"
6605 fi
6606 ;;
6607esac
6608$rm -f try.c try
6609case "$use64bitall" in
6610"$define"|true|[yY]*)
6611 case "$ptrsize" in
6612 4) cat <<EOM >&4
6613
1911a026
JH
6614*** You have chosen a maximally 64-bit build,
6615*** but your pointers are only 4 bytes wide.
09b58c7b
JH
6616*** Please rerun Configure without -Duse64bitall.
6617EOM
6618 case "$d_quad" in
6619 define)
6620 cat <<EOM >&4
6621*** Since you have quads, you could possibly try with -Duse64bitint.
6622EOM
6623 ;;
6624 esac
6625 cat <<EOM >&4
1911a026 6626*** Cannot continue, aborting.
c8b93cf9
JH
6627
6628EOM
09b58c7b 6629
1911a026 6630 exit 1
c8b93cf9
JH
6631 ;;
6632 esac
6633 ;;
6634esac
6635
19a100ff 6636
9df442c2
NC
6637: determine whether to use malloc wrapping
6638echo " "
6639case "$usemallocwrap" in
6640[yY]*|true|$define) dflt='y' ;;
6641[nN]*|false|$undef) dflt='n' ;;
6642*) case "$usedevel" in
6643 [yY]*|true|$define) dflt='y' ;;
6644 *) dflt='n' ;;
6645 esac
6646 ;;
6647esac
6648rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6649. ./myread
6650usemallocwrap="$ans"
6651case "$ans" in
6652y*|true)
6653 usemallocwrap="$define" ;;
6654*)
6655 usemallocwrap="$undef" ;;
6656esac
c8b93cf9 6657
b4eb6b3d
JH
6658: determine which malloc to compile in
6659echo " "
6660case "$usemymalloc" in
c4163172
JH
6661[yY]*|true|$define) dflt='y' ;;
6662[nN]*|false|$undef) dflt='n' ;;
6663*) case "$ptrsize" in
6664 4) dflt='y' ;;
6665 *) dflt='n' ;;
6666 esac
6667 ;;
8dfa8df9 6668esac
b4eb6b3d
JH
6669rp="Do you wish to attempt to use the malloc that comes with $package?"
6670. ./myread
6671usemymalloc="$ans"
6672case "$ans" in
6673y*|true)
6674 usemymalloc='y'
6675 mallocsrc='malloc.c'
6676 mallocobj="malloc$_o"
6677 d_mymalloc="$define"
6678 case "$libs" in
6679 *-lmalloc*)
6680 : Remove malloc from list of libraries to use
6681 echo "Removing unneeded -lmalloc from library list" >&4
6682 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6683 shift
6684 libs="$*"
6685 echo "libs = $libs" >&4
6686 ;;
6687 esac
6688 ;;
6689*)
6690 usemymalloc='n'
6691 mallocsrc=''
6692 mallocobj=''
6693 d_mymalloc="$undef"
6694 ;;
6695esac
6696
6697: compute the return types of malloc and free
6698echo " "
6699$cat >malloc.c <<END
6700#$i_malloc I_MALLOC
6701#$i_stdlib I_STDLIB
6702#include <stdio.h>
6703#include <sys/types.h>
6704#ifdef I_MALLOC
6705#include <malloc.h>
6706#endif
6707#ifdef I_STDLIB
6708#include <stdlib.h>
6709#endif
6710#ifdef TRY_MALLOC
6711void *malloc();
6712#endif
6713#ifdef TRY_FREE
6714void free();
6715#endif
6716END
6717case "$malloctype" in
6718'')
6719 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6720 malloctype='void *'
6721 else
6722 malloctype='char *'
6723 fi
6724 ;;
6725esac
6726echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6727
6728case "$freetype" in
6729'')
6730 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6731 freetype='void'
6732 else
6733 freetype='int'
6734 fi
6735 ;;
6736esac
6737echo "Your system uses $freetype free(), it would seem." >&4
6738$rm -f malloc.[co]
b4eb6b3d
JH
6739: determine where site specific architecture-dependent libraries go.
6740: sitelib default is /usr/local/lib/perl5/site_perl/$version
6741: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6742: sitelib may have an optional trailing /share.
6743case "$sitearch" in
6744'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6745 dflt="$dflt/$archname"
6746 ;;
6747*) dflt="$sitearch"
6748 ;;
6749esac
6750set sitearch sitearch none
6751eval $prefixit
6752$cat <<EOM
6753
6754The installation process will also create a directory for
6755architecture-dependent site-specific extensions and modules.
6756
6757EOM
6758fn=d~+
6759rp='Pathname for the site-specific architecture-dependent library files?'
6760. ./getfile
79522dd2
NC
6761prefixvar=sitearch
6762. ./setprefixvar
c95d0e17
GA
6763if $test X"$sitearch" = X"$sitelib"; then
6764 d_sitearch="$undef"
6765else
6766 d_sitearch="$define"
6767fi
b4eb6b3d
JH
6768
6769$cat <<EOM
6770
6771The installation process will also create a directory for
6772vendor-supplied add-ons. Vendors who supply perl with their system
6773may find it convenient to place all vendor-supplied files in this
6774directory rather than in the main distribution directory. This will
6775ease upgrades between binary-compatible maintenance versions of perl.
6776
6777Of course you may also use these directories in whatever way you see
6778fit. For example, you might use them to access modules shared over a
6779company-wide network.
6780
6781The default answer should be fine for most people.
6782This causes further questions about vendor add-ons to be skipped
6783and no vendor-specific directories will be configured for perl.
6784
6785EOM
6786rp='Do you want to configure vendor-specific add-on directories?'
6787case "$usevendorprefix" in
6788define|true|[yY]*) dflt=y ;;
6789*) : User may have set vendorprefix directly on Configure command line.
6790 case "$vendorprefix" in
6791 ''|' ') dflt=n ;;
6792 *) dflt=y ;;
6793 esac
6794 ;;
6795esac
6796. ./myread
6797case "$ans" in
6798[yY]*) fn=d~+
6799 rp='Installation prefix to use for vendor-supplied add-ons?'
6800 case "$vendorprefix" in
6801 '') dflt='' ;;
6802 *) dflt=$vendorprefix ;;
6803 esac
6804 . ./getfile
6805 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6806 oldvendorprefix=''
6807 case "$vendorprefix" in
6808 '') ;;
6809 *) case "$ans" in
6810 "$prefix") ;;
6811 *) oldvendorprefix="$prefix";;
6812 esac
6813 ;;
6814 esac
6815 usevendorprefix="$define"
6816 vendorprefix="$ans"
6817 vendorprefixexp="$ansexp"
6818 ;;
6819*) usevendorprefix="$undef"
6820 vendorprefix=''
6821 vendorprefixexp=''
6822 ;;
6823esac
6824
6825case "$vendorprefix" in
6826'') d_vendorlib="$undef"
6827 vendorlib=''
6828 vendorlibexp=''
6829 ;;
6830*) d_vendorlib="$define"
6831 : determine where vendor-supplied modules go.
6832 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6833 case "$vendorlib" in
6834 '')
6835 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6836 case "$installstyle" in
6837 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6838 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6839 esac
6840 ;;
6841 *) dflt="$vendorlib"
6842 ;;
6843 esac
6844 fn=d~+
6845 rp='Pathname for the vendor-supplied library files?'
6846 . ./getfile
6847 vendorlib="$ans"
6848 vendorlibexp="$ansexp"
6849 ;;
6850esac
6851vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
a092d240
NC
6852prefixvar=vendorlib
6853. ./installprefix
b4eb6b3d
JH
6854
6855case "$vendorprefix" in
6856'') d_vendorarch="$undef"
6857 vendorarch=''
6858 vendorarchexp=''
6859 ;;
6860*) d_vendorarch="$define"
6861 : determine where vendor-supplied architecture-dependent libraries go.
6862 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6863 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6864 : vendorlib may have an optional trailing /share.
6865 case "$vendorarch" in
6866 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6867 dflt="$dflt/$archname"
6868 ;;
6869 *) dflt="$vendorarch" ;;
6870 esac
6871 fn=d~+
6872 rp='Pathname for vendor-supplied architecture-dependent files?'
6873 . ./getfile
6874 vendorarch="$ans"
6875 vendorarchexp="$ansexp"
6876 ;;
6877esac
a092d240
NC
6878prefixvar=vendorarch
6879. ./installprefix
b4eb6b3d
JH
6880
6881: Final catch-all directories to search
6882$cat <<EOM
6883
6884Lastly, you can have perl look in other directories for extensions and
6885modules in addition to those already specified.
6886These directories will be searched after
6887 $sitearch
6888 $sitelib
6889EOM
6890test X"$vendorlib" != "X" && echo ' ' $vendorlib
6891test X"$vendorarch" != "X" && echo ' ' $vendorarch
6892echo ' '
6893case "$otherlibdirs" in
6894''|' ') dflt='none' ;;
6895*) dflt="$otherlibdirs" ;;
6896esac
6897$cat <<EOM
6898Enter a colon-separated set of extra paths to include in perl's @INC
6899search path, or enter 'none' for no extra paths.
6900
6901EOM
6902
6903rp='Colon-separated list of additional directories for perl to search?'
6904. ./myread
6905case "$ans" in
6906' '|''|none) otherlibdirs=' ' ;;
6907*) otherlibdirs="$ans" ;;
6908esac
6909case "$otherlibdirs" in
6910' ') val=$undef ;;
6911*) val=$define ;;
6912esac
6913set d_perl_otherlibdirs
6914eval $setvar
6915
6916: Cruising for prototypes
6917echo " "
6918echo "Checking out function prototypes..." >&4
55954f19
JH
6919$cat >prototype.c <<EOCP
6920#$i_stdlib I_STDLIB
6921#ifdef I_STDLIB
6922#include <stdlib.h>
6923#endif
b4eb6b3d
JH
6924int main(int argc, char *argv[]) {
6925 exit(0);}
6926EOCP
6927if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6928 echo "Your C compiler appears to support function prototypes."
6929 val="$define"
6930else
6931 echo "Your C compiler doesn't seem to understand function prototypes."
6932 val="$undef"
6933fi
6934set prototype
6935eval $setvar
6936$rm -f prototype*
6937
6938case "$prototype" in
6939"$define") ;;
6940*) ansi2knr='ansi2knr'
6941 echo " "
6942 cat <<EOM >&4
6943
6944$me: FATAL ERROR:
6945This version of $package can only be compiled by a compiler that
6946understands function prototypes. Unfortunately, your C compiler
6947 $cc $ccflags
6948doesn't seem to understand them. Sorry about that.
6949
6950If GNU cc is available for your system, perhaps you could try that instead.
6951
6952Eventually, we hope to support building Perl with pre-ANSI compilers.
6953If you would like to help in that effort, please contact <perlbug@perl.org>.
6954
6955Aborting Configure now.
6956EOM
6957 exit 2
6958 ;;
6959esac
6960
6fcddf3b 6961echo " "
6fcddf3b 6962case "$extras" in
bf35c3f6
JH
6963'') dflt='n';;
6964*) dflt='y';;
6fcddf3b
JH
6965esac
6966cat <<EOM
6967Perl can be built with extra modules or bundles of modules which
6968will be fetched from the CPAN and installed alongside Perl.
6969
6970Notice that you will need access to the CPAN; either via the Internet,
6971or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
6972be asked later to configure the CPAN.pm module which will in turn do
6973the installation of the rest of the extra modules or bundles.)
6974
6975Notice also that if the modules require any external software such as
dd2de242
JH
6976libraries and headers (the libz library and the zlib.h header for the
6977Compress::Zlib module, for example) you MUST have any such software
6978already installed, this configuration process will NOT install such
6979things for you.
6fcddf3b
JH
6980
6981If this doesn't make any sense to you, just accept the default '$dflt'.
6982EOM
dd2de242 6983rp='Install any extra modules (y or n)?'
6fcddf3b
JH
6984. ./myread
6985case "$ans" in
6986y|Y)
6987 cat <<EOM
6988
6989Please list any extra modules or bundles to be installed from CPAN,
6990with spaces between the names. The names can be in any format the
dd2de242
JH
6991'install' command of CPAN.pm will understand. (Answer 'none',
6992without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
6993EOM
6994 rp='Extras?'
6995 dflt="$extras"
6996 . ./myread
6997 extras="$ans"
6998esac
6999case "$extras" in
7000''|'none')
7001 val=''
7002 $rm -f ../extras.lst
7003 ;;
7004*) echo "(Saving the list of extras for later...)"
dd2de242
JH
7005 echo "$extras" > ../extras.lst
7006 val="'$extras'"
6fcddf3b
JH
7007 ;;
7008esac
7009set extras
7010eval $setvar
7011echo " "
7012
6e1038e0
MB
7013: determine where html pages for programs go
7014set html1dir html1dir none
7015eval $prefixit
7016$cat <<EOM
7017
f3f1a2d8 7018If you wish to install html files for programs in $spackage, indicate
6e1038e0
MB
7019the appropriate directory here. To skip installing html files,
7020answer "none".
7021EOM
7022case "$html1dir" in
7023''|none|$undef|' ') dflt=none ;;
7024*) dflt=$html1dir ;;
7025esac
7026fn=dn+~
7027rp="Directory for the main $spackage html pages?"
7028. ./getfile
79522dd2
NC
7029prefixvar=html1dir
7030. ./setprefixvar
6e1038e0
MB
7031: Use ' ' for none so value is preserved next time through Configure
7032$test X"$html1dir" = "X" && html1dir=' '
6e1038e0
MB
7033
7034: determine where html pages for libraries and modules go
7035set html3dir html3dir none
7036eval $prefixit
7037$cat <<EOM
7038
7039If you wish to install html files for modules associated with $spackage,
7040indicate the appropriate directory here. To skip installing html files,
7041answer "none".
7042EOM
7043: There is no obvious default. If they have specified html1dir, then
7044: try to key off that, possibly changing .../html1 into .../html3.
7045case "$html3dir" in
7046'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7047*) dflt=$html3dir ;;
7048esac
7049fn=dn+~
7050rp="Directory for the $spackage module html pages?"
7051. ./getfile
79522dd2
NC
7052prefixvar=html3dir
7053. ./setprefixvar
6e1038e0
MB
7054: Use ' ' for none so value is preserved next time through Configure
7055$test X"$html3dir" = "X" && html3dir=' '
6e1038e0 7056
89ce900e
JH
7057: determine whether to install perl also as /usr/bin/perl
7058
7059echo " "
7060if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7061 $cat <<EOM
7062Many scripts expect perl to be installed as /usr/bin/perl.
7063
7064If you want to, I can install the perl you are about to compile
7065as /usr/bin/perl (in addition to $bin/perl).
7066EOM
7067 if test -f /usr/bin/perl; then
7068 $cat <<EOM
7069
7070However, please note that because you already have a /usr/bin/perl,
7071overwriting that with a new Perl would very probably cause problems.
7072Therefore I'm assuming you don't want to do that (unless you insist).
7073
7074EOM
7075 case "$installusrbinperl" in
7076 "$define"|[yY]*) dflt='y';;
7077 *) dflt='n';;
7078 esac
7079 else
7080 $cat <<EOM
7081
7082Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7083
7084EOM
7085 case "$installusrbinperl" in
7086 "$undef"|[nN]*) dflt='n';;
7087 *) dflt='y';;
7088 esac
7089 fi
7090 rp="Do you want to install perl as /usr/bin/perl?"
7091 . ./myread
7092 case "$ans" in
7093 [yY]*) val="$define";;
7094 *) val="$undef" ;;
7095 esac
7096else
7097 val="$undef"
7098fi
7099set installusrbinperl
7100eval $setvar
7101
7102echo " "
7103echo "Checking for GNU C Library..." >&4
7104cat >try.c <<'EOCP'
7105/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7106 alone are insufficient to distinguish different versions, such as
7107 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7108 libc version 2.1.0. A. Dougherty, June 3, 2002.
7109*/
7110#include <stdio.h>
7111int main(void)
7112{
7113#ifdef __GLIBC__
7114# ifdef __GLIBC_MINOR__
4fb7dc7d 7115# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
89ce900e
JH
7116# include <gnu/libc-version.h>
7117 printf("%s\n", gnu_get_libc_version());
7118# else
7119 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7120# endif
7121# else
7122 printf("%d\n", __GLIBC__);
7123# endif
7124 return 0;
7125#else
7126 return 1;
7127#endif
7128}
7129EOCP
7130set try
7131if eval $compile_ok && $run ./try > glibc.ver; then
7132 val="$define"
7133 gnulibc_version=`$cat glibc.ver`
7134 echo "You are using the GNU C Library version $gnulibc_version"
7135else
7136 val="$undef"
7137 gnulibc_version=''
7138 echo "You are not using the GNU C Library"
7139fi
7140$rm -f try try.* glibc.ver
7141set d_gnulibc
7142eval $setvar
7143
7144: see if nm is to be used to determine whether a symbol is defined or not
7145case "$usenm" in
7146'')
7147 dflt=''
7148 case "$d_gnulibc" in
7149 "$define")
7150 echo " "
7151 echo "nm probably won't work on the GNU C Library." >&4
7152 dflt=n
7153 ;;
7154 esac
7155 case "$dflt" in
7156 '')
7157 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7158 echo " "
7159 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7160 echo "'nm' won't be sufficient on this sytem." >&4
7161 dflt=n
7162 fi
7163 ;;
7164 esac
7165 case "$dflt" in
7166 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7167 if $test $dflt -gt 20; then
7168 dflt=y
7169 else
7170 dflt=n
7171 fi
7172 ;;
7173 esac
b4eb6b3d 7174 ;;
89ce900e
JH
7175*)
7176 case "$usenm" in
7177 true|$define) dflt=y;;
7178 *) dflt=n;;
7179 esac
b4eb6b3d
JH
7180 ;;
7181esac
89ce900e 7182$cat <<EOM
b4eb6b3d 7183
89ce900e
JH
7184I can use $nm to extract the symbols from your C libraries. This
7185is a time consuming task which may generate huge output on the disk (up
7186to 3 megabytes) but that should make the symbols extraction faster. The
7187alternative is to skip the 'nm' extraction part and to compile a small
7188test program instead to determine whether each symbol is present. If
7189you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7190this may be the best solution.
b4eb6b3d 7191
89ce900e 7192You probably shouldn't let me use 'nm' if you are using the GNU C Library.
b4eb6b3d 7193
89ce900e
JH
7194EOM
7195rp="Shall I use $nm to extract C symbols from the libraries?"
7196. ./myread
7197case "$ans" in
7198[Nn]*) usenm=false;;
7199*) usenm=true;;
b4eb6b3d 7200esac
89ce900e
JH
7201
7202runnm=$usenm
7203case "$reuseval" in
7204true) runnm=false;;
b4eb6b3d 7205esac
b4eb6b3d 7206
89ce900e
JH
7207: nm options which may be necessary
7208case "$nm_opt" in
7209'') if $test -f /mach_boot; then
7210 nm_opt='' # Mach
7211 elif $test -d /usr/ccs/lib; then
7212 nm_opt='-p' # Solaris (and SunOS?)
7213 elif $test -f /dgux; then
7214 nm_opt='-p' # DG-UX
7215 elif $test -f /lib64/rld; then
7216 nm_opt='-p' # 64-bit Irix
7217 else
7218 nm_opt=''
7219 fi;;
7220esac
b4eb6b3d 7221
89ce900e
JH
7222: nm options which may be necessary for shared libraries but illegal
7223: for archive libraries. Thank you, Linux.
7224case "$nm_so_opt" in
7225'') case "$myuname" in
fb2e1bc0 7226 *linux*|gnu*)
89ce900e
JH
7227 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7228 nm_so_opt='--dynamic'
7229 fi
7230 ;;
7231 esac
7232 ;;
7233esac
b4eb6b3d 7234
89ce900e
JH
7235case "$runnm" in
7236true)
7237: get list of predefined functions in a handy place
7238echo " "
7239case "$libc" in
7240'') libc=unknown
7241 case "$libs" in
7242 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7243 esac
7244 ;;
b4eb6b3d 7245esac
89ce900e
JH
7246case "$libs" in
7247'') ;;
7248*) for thislib in $libs; do
7249 case "$thislib" in
7250 -lc|-lc_s)
7251 : Handle C library specially below.
7252 ;;
7253 -l*)
7254 thislib=`echo $thislib | $sed -e 's/^-l//'`
7255 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7256 :
7257 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7258 :
7259 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7260 :
7261 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7262 :
7263 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7264 :
7265 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7266 :
7267 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7268 :
7269 else
7270 try=''
7271 fi
7272 libnames="$libnames $try"
7273 ;;
7274 *) libnames="$libnames $thislib" ;;
7275 esac
7276 done
b4eb6b3d
JH
7277 ;;
7278esac
89ce900e
JH
7279xxx=normal
7280case "$libc" in
7281unknown)
7282 set /lib/libc.$so
7283 for xxx in $libpth; do
7284 $test -r $1 || set $xxx/libc.$so
7285 : The messy sed command sorts on library version numbers.
7286 $test -r $1 || \
7287 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7288 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7289 h
7290 s/[0-9][0-9]*/0000&/g
7291 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7292 G
7293 s/\n/ /' | \
7294 $sort | $sed -e 's/^.* //'`
7295 eval set \$$#
7296 done
7297 $test -r $1 || set /usr/ccs/lib/libc.$so
7298 $test -r $1 || set /lib/libsys_s$_a
7299 ;;
7300*)
7301 set blurfl
7302 ;;
7303esac
7304if $test -r "$1"; then
7305 echo "Your (shared) C library seems to be in $1."
7306 libc="$1"
7307elif $test -r /lib/libc && $test -r /lib/clib; then
7308 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7309 xxx=apollo
7310 libc='/lib/clib /lib/libc'
7311 if $test -r /lib/syslib; then
7312 echo "(Your math library is in /lib/syslib.)"
7313 libc="$libc /lib/syslib"
7314 fi
7315elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7316 echo "Your C library seems to be in $libc, as you said before."
7317elif $test -r $incpath/usr/lib/libc$_a; then
7318 libc=$incpath/usr/lib/libc$_a;
7319 echo "Your C library seems to be in $libc. That's fine."
7320elif $test -r /lib/libc$_a; then
7321 libc=/lib/libc$_a;
7322 echo "Your C library seems to be in $libc. You're normal."
7323else
7324 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7325 :
7326 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7327 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7328 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7329 :
7330 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7331 :
7332 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7333 :
7334 else
7335 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7336 fi
7337 if $test -r "$tans"; then
7338 echo "Your C library seems to be in $tans, of all places."
7339 libc=$tans
7340 else
7341 libc='blurfl'
7342 fi
7343fi
7344if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7345 dflt="$libc"
7346 cat <<EOM
b4eb6b3d 7347
89ce900e
JH
7348If the guess above is wrong (which it might be if you're using a strange
7349compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7350
89ce900e
JH
7351EOM
7352else
7353 dflt=''
7354 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7355 cat >&4 <<EOM
7356I can't seem to find your C library. I've looked in the following places:
5e366f65 7357
b4eb6b3d 7358EOM
89ce900e
JH
7359 $sed 's/^/ /' libpath
7360 cat <<EOM
5e366f65 7361
89ce900e 7362None of these seems to contain your C library. I need to get its name...
5e366f65
JH
7363
7364EOM
89ce900e
JH
7365fi
7366fn=f
7367rp='Where is your C library?'
7368. ./getfile
7369libc="$ans"
5e366f65 7370
89ce900e
JH
7371echo " "
7372echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7373set X `cat libnames`
7374shift
7375xxx=files
7376case $# in 1) xxx=file; esac
7377echo "Extracting names from the following $xxx for later perusal:" >&4
7378echo " "
7379$sed 's/^/ /' libnames >&4
7380echo " "
7381$echo $n "This may take a while...$c" >&4
5e366f65 7382
89ce900e
JH
7383for file in $*; do
7384 case $file in
7385 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7386 *) $nm $nm_opt $file 2>/dev/null;;
b4eb6b3d 7387 esac
89ce900e
JH
7388done >libc.tmp
7389
7390$echo $n ".$c"
7391$grep fprintf libc.tmp > libc.ptf
7392xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7393xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7394xxx='[ADTSIW]'
ab900c53 7395if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
89ce900e
JH
7396 eval $xscan;\
7397 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7398 eval $xrun
7399elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7400 eval $xscan;\
7401 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7402 eval $xrun
7403elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7404 eval $xscan;\
7405 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7406 eval $xrun
7407elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7408 eval $xscan;\
7409 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7410 eval $xrun
7411elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7412 eval $xscan;\
7413 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7414 eval $xrun
7415elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7416 eval $xscan;\
7417 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7418 eval $xrun
7419elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7420 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7421 eval $xscan;\
7422 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7423 eval $xrun
7424elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7425 eval $xscan;\
7426 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7427 eval $xrun
7428elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7429 eval $xscan;\
7430 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7431 eval $xrun
7432elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7433 eval $xscan;\
7434 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7435 eval $xrun
7436elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7437 eval $xscan;\
7438 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7439 eval $xrun
7440elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7441 eval $xscan;\
7442 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7443 eval $xrun
7444elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7445 eval $xscan;\
7446 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7447 eval $xrun
7448elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7449 eval $xscan;\
7450 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7451 eval $xrun
b4eb6b3d 7452else
89ce900e
JH
7453 $nm -p $* 2>/dev/null >libc.tmp
7454 $grep fprintf libc.tmp > libc.ptf
7455 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7456 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7457 then
7458 nm_opt='-p'
7459 eval $xrun
7460 else
7461 echo " "
7462 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7463 com=''
7464 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7465 for thisname in $libnames $libc; do
7466 $ar t $thisname >>libc.tmp
7467 done
7468 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7469 echo "Ok." >&4
7470 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7471 # Repeat libc to extract forwarders to DLL entries too
7472 for thisname in $libnames $libc; do
7473 $ar tv $thisname >>libc.tmp
7474 # Revision 50 of EMX has bug in $ar.
7475 # it will not extract forwarders to DLL entries
7476 # Use emximp which will extract exactly them.
7477 emximp -o tmp.imp $thisname \
7478 2>/dev/null && \
7479 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7480 < tmp.imp >>libc.tmp
7481 $rm tmp.imp
7482 done
7483 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7484 echo "Ok." >&4
7485 else
7486 echo "$ar didn't seem to work right." >&4
7487 echo "Maybe this is a Cray...trying bld instead..." >&4
7488 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7489 then
7490 for thisname in $libnames; do
7491 bld t $libnames | \
7492 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7493 $ar t $thisname >>libc.tmp
7494 done
7495 echo "Ok." >&4
7496 else
7497 echo "That didn't work either. Giving up." >&4
7498 exit 1
7499 fi
7500 fi
7501 fi
b4eb6b3d 7502fi
89ce900e
JH
7503nm_extract="$com"
7504case "$PASE" in
7505define)
7506 echo " "
7507 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7508 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7509 ;;
7510*) if $test -f /lib/syscalls.exp; then
7511 echo " "
7512 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7513 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' /lib/syscalls.exp >>libc.list
7514 fi
7515 ;;
7516esac
7517;;
7518esac
7519$rm -f libnames libpath
b4eb6b3d
JH
7520
7521: see if dld is available
7522set dld.h i_dld
7523eval $inhdr
7524
89ce900e
JH
7525: is a C symbol defined?
7526csym='tlook=$1;
7527case "$3" in
373dfab3
JH
7528-v) tf=libc.tmp; tdc="";;
7529-a) tf=libc.tmp; tdc="[]";;
7530*) tlook="^$1\$"; tf=libc.list; tdc="()";;
89ce900e
JH
7531esac;
7532tx=yes;
7533case "$reuseval-$4" in
7534true-) ;;
7535true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7536esac;
7537case "$tx" in
7538yes)
ab900c53 7539 tval=false;
5129fff4
JH
7540 if $test "$runnm" = true; then
7541 if $contains $tlook $tf >/dev/null 2>&1; then
ab900c53 7542 tval=true;
5129fff4 7543 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
373dfab3 7544 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7545 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
373dfab3
JH
7546 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7547 $rm -f try$_exe try.c core core.* try.core;
89ce900e 7548 fi;
5129fff4 7549 else
373dfab3 7550 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7551 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
373dfab3 7552 $rm -f try$_exe try.c;
ab900c53
AB
7553 fi;
7554 ;;
89ce900e
JH
7555*)
7556 case "$tval" in
7557 $define) tval=true;;
7558 *) tval=false;;
ab900c53
AB
7559 esac;
7560 ;;
89ce900e
JH
7561esac;
7562eval "$2=$tval"'
7563
7564: define an is-in-libc? function
7565inlibc='echo " "; td=$define; tu=$undef;
7566sym=$1; var=$2; eval "was=\$$2";
7567tx=yes;
7568case "$reuseval$was" in
7569true) ;;
7570true*) tx=no;;
7571esac;
7572case "$tx" in
7573yes)
7574 set $sym tres -f;
7575 eval $csym;
7576 case "$tres" in
7577 true)
7578 echo "$sym() found." >&4;
7579 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7580 *)
7581 echo "$sym() NOT found." >&4;
7582 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7583 esac;;
7584*)
7585 case "$was" in
7586 $define) echo "$sym() found." >&4;;
7587 *) echo "$sym() NOT found." >&4;;
7588 esac;;
7589esac'
7590
f244a502
JH
7591
7592echo " "
7593echo "Checking for C++..." >&4
7594cat >try.c <<'EOCP'
7595#include <stdio.h>
7596int main(void)
7597{
7598#ifdef __cplusplus
7599 printf("define\n");
7600#else
7601 printf("undef\n");
7602#endif
7603 return 0;
7604}
7605EOCP
7606set try
7607if eval $compile_ok && $run ./try >cplusplus$$; then
7608 val=`$cat cplusplus$$`
7609 echo "You are using a C++ compiler."
7610else
7611 val="$undef"
7612 echo "You are not using a C++ compiler."
7613fi
7614$rm -f try try.* cplusplus$$
7615set d_cplusplus
7616eval $setvar
7617
b4eb6b3d
JH
7618: see if dlopen exists
7619xxx_runnm="$runnm"
666ea192 7620xxx_ccflags="$ccflags"
b4eb6b3d 7621runnm=false
666ea192
JH
7622: with g++ one needs -shared to get is-in-libc to work for dlopen
7623case "$gccversion" in
7624'') ;;
7625*) case "$d_cplusplus" in
7626 "$define") ccflags="$ccflags -shared" ;;
7627 esac
7628 ;;
7629esac
b4eb6b3d
JH
7630set dlopen d_dlopen
7631eval $inlibc
7632runnm="$xxx_runnm"
666ea192 7633ccflags="$xxx_ccflags"
b4eb6b3d 7634
4fb7dc7d
JH
7635: see if this is a unistd.h system
7636set unistd.h i_unistd
7637eval $inhdr
7638
b4eb6b3d
JH
7639: determine which dynamic loading, if any, to compile in
7640echo " "
7641dldir="ext/DynaLoader"
7642case "$usedl" in
7643$define|y|true)
7644 dflt='y'
7645 usedl="$define"
7646 ;;
7647$undef|n|false)
7648 dflt='n'
7649 usedl="$undef"
7650 ;;
7651*)
7652 dflt='n'
7653 case "$d_dlopen" in
7654 $define) dflt='y' ;;
7655 esac
7656 case "$i_dld" in
7657 $define) dflt='y' ;;
7658 esac
7659 : Does a dl_xxx.xs file exist for this operating system
7660 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7661 ;;
7662esac
7663rp="Do you wish to use dynamic loading?"
7664. ./myread
7665usedl="$ans"
7666case "$ans" in
7667y*) usedl="$define"
7668 case "$dlsrc" in
7669 '')
7670 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7671 dflt="$dldir/dl_${osname}.xs"
7672 elif $test "$d_dlopen" = "$define" ; then
7673 dflt="$dldir/dl_dlopen.xs"
7674 elif $test "$i_dld" = "$define" ; then
7675 dflt="$dldir/dl_dld.xs"
7676 else
7677 dflt=''
7678 fi
7679 ;;
7680 *) dflt="$dldir/$dlsrc"
7681 ;;
7682 esac
7683 echo "The following dynamic loading files are available:"
7684 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7685 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7686 rp="Source file to use for dynamic loading"
7687 fn="fne"
7688 gfpth="$src"
7689 . ./getfile
7690 usedl="$define"
7691 : emulate basename
7692 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7693
7694 $cat << EOM
7695
7696Some systems may require passing special flags to $cc -c to
7697compile modules that will be used to create a shared library.
7698To use no flags, say "none".
7699
7700EOM
7701 case "$cccdlflags" in
7702 '') case "$gccversion" in
7703 '') case "$osname" in
7704 hpux) dflt='+z' ;;
7705 next) dflt='none' ;;
7706 irix*) dflt='-KPIC' ;;
48bcfe03 7707 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7708 sunos) dflt='-pic' ;;
7709 *) dflt='none' ;;
7710 esac
7711 ;;
7712 *) case "$osname" in
b6cc0f4c 7713 darwin) dflt='none' ;;
48bcfe03 7714 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7715 *) dflt='-fpic' ;;
7716 esac ;;
7717 esac ;;
7718 ' ') dflt='none' ;;
7719 *) dflt="$cccdlflags" ;;
7720 esac
7721 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7722 . ./myread
7723 case "$ans" in
7724 none) cccdlflags=' ' ;;
7725 *) cccdlflags="$ans" ;;
7726 esac
7727
7728 cat << EOM
7729
7730Some systems use ld to create libraries that can be dynamically loaded,
7731while other systems (such as those using ELF) use $cc.
7732
7733EOM
7734 case "$ld" in
55954f19 7735 '') $cat >try.c <<EOM
b4eb6b3d
JH
7736/* Test for whether ELF binaries are produced */
7737#include <fcntl.h>
55954f19
JH
7738#$i_stdlib I_STDLIB
7739#ifdef I_STDLIB
b4eb6b3d 7740#include <stdlib.h>
55954f19 7741#endif
4fb7dc7d
JH
7742#$i_unistd I_UNISTD
7743#ifdef I_UNISTD
7744#include <unistd.h>
7745#endif
b4eb6b3d
JH
7746int main() {
7747 char b[4];
7748 int i = open("a.out",O_RDONLY);
7749 if(i == -1)
7750 exit(1); /* fail */
7751 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7752 exit(0); /* succeed (yes, it's ELF) */
7753 else
7754 exit(1); /* fail */
7755}
7756EOM
5440bc8e 7757 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7758 cat <<EOM
7759You appear to have ELF support. I'll use $cc to build dynamic libraries.
7760EOM
7761 dflt="$cc"
7762 else
7763 echo "I'll use ld to build dynamic libraries."
7764 dflt='ld'
7765 fi
7766 rm -f try.c a.out
7767 ;;
7768 *) dflt="$ld"
7769 ;;
7770 esac
7771
7772 rp="What command should be used to create dynamic libraries?"
7773 . ./myread
7774 ld="$ans"
7775
7776 cat << EOM
7777
7778Some systems may require passing special flags to $ld to create a
7779library that can be dynamically loaded. If your ld flags include
7780-L/other/path options to locate libraries outside your loader's normal
7781search path, you may need to specify those -L options here as well. To
7782use no flags, say "none".
7783
7784EOM
7785 case "$lddlflags" in
7786 '') case "$osname" in
7787 beos) dflt='-nostart' ;;
7788 hpux) dflt='-b';
7789 case "$gccversion" in
7790 '') dflt="$dflt +vnocompatwarnings" ;;
7791 esac
7792 ;;
fb2e1bc0 7793 linux|irix*|gnu*) dflt='-shared' ;;
b4eb6b3d
JH
7794 next) dflt='none' ;;
7795 solaris) dflt='-G' ;;
7796 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 7797 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
7798 *) dflt='none' ;;
7799 esac
7800 ;;
7801 *) dflt="$lddlflags" ;;
7802 esac
7803
7804 : Try to guess additional flags to pick up local libraries.
7805 : Be careful not to append to a plain 'none'
7806 case "$dflt" in
7807 none) dflt='' ;;
7808 esac
7809 for thisflag in $ldflags; do
7810 case "$thisflag" in
b5b9f165 7811 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
7812 case " $dflt " in
7813 *" $thisflag "*) ;;
7814 *) dflt="$dflt $thisflag" ;;
7815 esac
7816 ;;
7817 esac
7818 done
7819
7820 case "$dflt" in
7821 ''|' ') dflt='none' ;;
7822 esac
7823
7824 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7825 . ./myread
7826 case "$ans" in
7827 none) lddlflags=' ' ;;
7828 *) lddlflags="$ans" ;;
7829 esac
7830
7831 cat <<EOM
7832
7833Some systems may require passing special flags to $cc to indicate that
7834the resulting executable will use dynamic linking. To use no flags,
7835say "none".
7836
7837EOM
7838 case "$ccdlflags" in
7839 '') case "$osname" in
fb2e1bc0 7840 linux|hpux|gnu*) dflt='-Wl,-E' ;;
91fc0aa5
AH
7841 next|sunos) dflt='none' ;;
7842 *) dflt='none' ;;
b4eb6b3d
JH
7843 esac ;;
7844 ' ') dflt='none' ;;
7845 *) dflt="$ccdlflags" ;;
7846 esac
7847 rp="Any special flags to pass to $cc to use dynamic linking?"
7848 . ./myread
7849 case "$ans" in
7850 none) ccdlflags=' ' ;;
7851 *) ccdlflags="$ans" ;;
7852 esac
7853 ;;
7854*) usedl="$undef"
7855 ld='ld'
7856 dlsrc='dl_none.xs'
7857 lddlflags=''
7858 ccdlflags=''
7859 ;;
7860esac
7861
7862also=''
7863case "$usedl" in
7864$undef)
7865 # No dynamic loading being used, so don't bother even to prompt.
7866 useshrplib='false'
7867 ;;
7868*) case "$useshrplib" in
7869 '') case "$osname" in
48bcfe03 7870 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7871 dflt=y
7872 also='Building a shared libperl is required for dynamic loading to work on your system.'
7873 ;;
7874 next*)
7875 case "$osvers" in
7876 4*) dflt=y
7877 also='Building a shared libperl is needed for MAB support.'
7878 ;;
7879 *) dflt=n
7880 ;;
7881 esac
7882 ;;
7883 *) dflt=n
7884 ;;
7885 esac
7886 ;;
7887 $define|true|[Yy]*)
7888 dflt=y
7889 ;;
7890 *) dflt=n
7891 ;;
7892 esac
7893 $cat << EOM
7894
7895The perl executable is normally obtained by linking perlmain.c with
7896libperl${_a}, any static extensions (usually just DynaLoader), and
7897any other libraries needed on this system (such as -lm, etc.). Since
7898your system supports dynamic loading, it is probably possible to build
7899a shared libperl.$so. If you will have more than one executable linked
7900to libperl.$so, this will significantly reduce the size of each
5cadb3f3 7901executable, but it may have a noticeable effect on performance. The
b4eb6b3d
JH
7902default is probably sensible for your system.
7903$also
7904
7905EOM
7906 rp="Build a shared libperl.$so (y/n)"
7907 . ./myread
7908 case "$ans" in
7909 true|$define|[Yy]*)
7910 useshrplib='true' ;;
7911 *) useshrplib='false' ;;
7912 esac
7913 ;;
7914esac
7915
7916case "$useshrplib" in
7917true)
7918 case "$libperl" in
7919 '')
7920 # Figure out a good name for libperl.so. Since it gets stored in
7921 # a version-specific architecture-dependent library, the version
7922 # number isn't really that important, except for making cc/ld happy.
7923 #
7924 # A name such as libperl.so.3.1
7925 majmin="libperl.$so.$patchlevel.$subversion"
7926 # A name such as libperl.so.301
7927 majonly=`echo $patchlevel $subversion |
7928 $awk '{printf "%d%02d", $1, $2}'`
7929 majonly=libperl.$so.$majonly
7930 # I'd prefer to keep the os-specific stuff here to a minimum, and
7931 # rely on figuring it out from the naming of libc.
7932 case "${osname}${osvers}" in
7933 next4*)
7934 dflt=libperl.5.$so
7935 # XXX How handle the --version stuff for MAB?
7936 ;;
fb2e1bc0 7937 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
7938 dflt=libperl.$so
7939 ;;
b53432e4
GH
7940 cygwin*) # ld links against an importlib
7941 dflt=libperl$lib_ext
b4eb6b3d
JH
7942 ;;
7943 *) # Try to guess based on whether libc has major.minor.
7944 case "$libc" in
7945 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7946 *libc.$so.[0-9]*) dflt=$majonly ;;
7947 *) dflt=libperl.$so ;;
7948 esac
7949 ;;
7950 esac
7951 ;;
7952 *) dflt=$libperl
7953 ;;
7954 esac
7955 cat << EOM
7956
7957I need to select a good name for the shared libperl. If your system uses
7958library names with major and minor numbers, then you might want something
7959like $majmin. Alternatively, if your system uses a single version
7960number for shared libraries, then you might want to use $majonly.
7961Or, your system might be quite happy with a simple libperl.$so.
7962
7963Since the shared libperl will get installed into a version-specific
7964architecture-dependent directory, the version number of the shared perl
7965library probably isn't important, so the default should be o.k.
7966
7967EOM
7968 rp='What name do you want to give to the shared libperl?'
7969 . ./myread
7970 libperl=$ans
7971 echo "Ok, I'll use $libperl"
7972 ;;
7973*)
7974 libperl="libperl${_a}"
7975 ;;
7976esac
7977
7978# Detect old use of shrpdir via undocumented Configure -Dshrpdir
7979case "$shrpdir" in
7980'') ;;
7981*) $cat >&4 <<EOM
7982WARNING: Use of the shrpdir variable for the installation location of
7983the shared $libperl is not supported. It was never documented and
7984will not work in this version. Let me (perlbug@perl.org)
7985know of any problems this may cause.
7986
7987EOM
7988 case "$shrpdir" in
7989 "$archlibexp/CORE")
7990 $cat >&4 <<EOM
7991But your current setting of $shrpdir is
7992the default anyway, so it's harmless.
7993EOM
7994 ;;
7995 *)
7996 $cat >&4 <<EOM
7997Further, your current attempted setting of $shrpdir
7998conflicts with the value of $archlibexp/CORE
7999that installperl will use.
8000EOM
8001 ;;
8002 esac
8003 ;;
8004esac
8005
8006# How will the perl executable find the installed shared $libperl?
8007# Add $xxx to ccdlflags.
8008# If we can't figure out a command-line option, use $shrpenv to
8009# set env LD_RUN_PATH. The main perl makefile uses this.
8010shrpdir=$archlibexp/CORE
8011xxx=''
8012tmp_shrpenv=''
8013if "$useshrplib"; then
8014 case "$osname" in
8015 aix)
8016 # We'll set it in Makefile.SH...
8017 ;;
b5b9f165 8018 solaris)
b4eb6b3d
JH
8019 xxx="-R $shrpdir"
8020 ;;
a774dfe6 8021 freebsd|netbsd|openbsd|interix|dragonfly)
b4eb6b3d
JH
8022 xxx="-Wl,-R$shrpdir"
8023 ;;
fb2e1bc0 8024 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
8025 xxx="-Wl,-rpath,$shrpdir"
8026 ;;
8027 next)
8028 # next doesn't like the default...
8029 ;;
8030 beos)
8031 # beos doesn't like the default, either.
8032 ;;
8033 hpux*)
8034 # hpux doesn't like the default, either.
8035 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8036 ;;
8037 *)
8038 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8039 ;;
8040 esac
8041 case "$xxx" in
8042 '') ;;
8043 *)
8044 # Only add $xxx if it isn't already in ccdlflags.
8045 case " $ccdlflags " in
8046 *" $xxx "*) ;;
8047 *) ccdlflags="$ccdlflags $xxx"
8048 cat <<EOM >&4
8049
8050Adding $xxx to the flags
8051passed to $ld so that the perl executable will find the
8052installed shared $libperl.
8053
8054EOM
8055 ;;
8056 esac
8057 ;;
8058 esac
8059fi
8060# Fix ccdlflags in AIX for building external extensions.
8061# (For building Perl itself bare -bE:perl.exp is needed,
8062# Makefile.SH takes care of this.)
8063case "$osname" in
8064aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8065esac
8066# Respect a hint or command-line value.
8067case "$shrpenv" in
8068'') shrpenv="$tmp_shrpenv" ;;
8069esac
8070case "$ldlibpthname" in
8071'') ldlibpthname=LD_LIBRARY_PATH ;;
8072none) ldlibpthname='' ;;
8073esac
8074
8075: determine where manual pages are on this system
8076echo " "
8077case "$sysman" in
8078'')
4a0a3829
SD
8079 syspath='/usr/share/man/man1 /usr/man/man1'
8080 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8081 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
8082 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8083 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8084 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8085 sysman=`./loc . /usr/man/man1 $syspath`
8086 ;;
8087esac
8088if $test -d "$sysman"; then
8089 echo "System manual is in $sysman." >&4
8090else
8091 echo "Could not find manual pages in source form." >&4
8092fi
8093
8094: determine where manual pages go
8095set man1dir man1dir none
8096eval $prefixit
8097$cat <<EOM
8098
8099$spackage has manual pages available in source form.
8100EOM
8101case "$nroff" in
8102nroff)
8103 echo "However, you don't have nroff, so they're probably useless to you."
8104 case "$man1dir" in
8105 '') man1dir="none";;
8106 esac;;
8107esac
8108echo "If you don't want the manual sources installed, answer 'none'."
8109case "$man1dir" in
8110' ') dflt=none
8111 ;;
8112'')
4a0a3829
SD
8113 lookpath="$prefixexp/share/man/man1"
8114 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
8115 lookpath="$lookpath $prefixexp/man/p_man/man1"
8116 lookpath="$lookpath $prefixexp/man/u_man/man1"
8117 lookpath="$lookpath $prefixexp/man/man.1"
8118 case "$sysman" in
8119 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8120 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8121 esac
8122 set dflt
8123 eval $prefixup
8124 ;;
8125*) dflt="$man1dir"
8126 ;;
8127esac
8128echo " "
8129fn=dn+~
8130rp="Where do the main $spackage manual pages (source) go?"
8131. ./getfile
8132if $test "X$man1direxp" != "X$ansexp"; then
8133 installman1dir=''
8134fi
79522dd2
NC
8135prefixvar=man1dir
8136. ./setprefixvar
8137
477140ee
NC
8138case "$man1dir" in
8139'') man1dir=' '
8140 installman1dir='';;
8141esac
b4eb6b3d
JH
8142
8143: What suffix to use on installed man pages
8144
8145case "$man1dir" in
8146' ')
8147 man1ext='0'
8148 ;;
8149*)
8150 rp="What suffix should be used for the main $spackage man pages?"
8151 case "$man1ext" in
8152 '') case "$man1dir" in
8153 *1) dflt=1 ;;
8154 *1p) dflt=1p ;;
8155 *1pm) dflt=1pm ;;
8156 *l) dflt=l;;
8157 *n) dflt=n;;
8158 *o) dflt=o;;
8159 *p) dflt=p;;
8160 *C) dflt=C;;
8161 *L) dflt=L;;
8162 *L1) dflt=L1;;
8163 *) dflt=1;;
8164 esac
8165 ;;
8166 *) dflt="$man1ext";;
8167 esac
8168 . ./myread
8169 man1ext="$ans"
8170 ;;
8171esac
8172
8173: see if we can have long filenames
8174echo " "
8175first=123456789abcdef
8176$rm -f $first
8177if (echo hi >$first) 2>/dev/null; then
8178 if $test -f 123456789abcde; then
8179 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8180 val="$undef"
8181 else
8182 echo 'You can have filenames longer than 14 characters.'>&4
8183 val="$define"
8184 fi
8185else
8186 $cat <<'EOM'
8187You can't have filenames longer than 14 chars.
8188You can't even think about them!
8189EOM
8190 val="$undef"
8191fi
8192set d_flexfnam
8193eval $setvar
8194$rm -rf 123456789abcde*
8195
8196: determine where library module manual pages go
8197set man3dir man3dir none
8198eval $prefixit
8199$cat <<EOM
8200
8201$spackage has manual pages for many of the library modules.
8202EOM
8203
8204case "$nroff" in
8205nroff)
8206 $cat <<'EOM'
8207However, you don't have nroff, so they're probably useless to you.
8208EOM
8209 case "$man3dir" in
8210 '') man3dir="none";;
8211 esac;;
8212esac
8213
8214case "$d_flexfnam" in
8215undef)
8216 $cat <<'EOM'
f3f1a2d8 8217However, your system can't handle the long file names like File::Basename.3.
b4eb6b3d
JH
8218EOM
8219 case "$man3dir" in
8220 '') man3dir="none";;
8221 esac;;
8222esac
8223
8224echo "If you don't want the manual sources installed, answer 'none'."
8225prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8226case "$man3dir" in
8227'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8228 if $test -d "$privlib/man/man3"; then
8229 cat <<EOM >&4
8230
8231WARNING: Previous versions of perl installed man3 pages into
f3f1a2d8
MB
8232$privlib/man/man3. This version will suggest a
8233new default of $dflt.
b4eb6b3d
JH
8234EOM
8235 tdflt=$dflt
8236 dflt='n'
8237 rp='Do you wish to preserve the old behavior?(y/n)'
8238 . ./myread
8239 case "$ans" in
8240 y*) dflt="$privlib/man/man3" ;;
8241 *) dflt=$tdflt ;;
8242 esac
8243 fi
8244 ;;
8245*) dflt="$man3dir" ;;
8246esac
8247case "$dflt" in
8248' ') dflt=none ;;
8249esac
8250echo " "
8251fn=dn+~
8252rp="Where do the $package library man pages (source) go?"
8253. ./getfile
79522dd2
NC
8254prefixvar=man3dir
8255. ./setprefixvar
8256
477140ee
NC
8257case "$man3dir" in
8258'') man3dir=' '
8259 installman3dir='';;
8260esac
b4eb6b3d
JH
8261
8262: What suffix to use on installed man pages
8263case "$man3dir" in
8264' ')
8265 man3ext='0'
8266 ;;
8267*)
8268 rp="What suffix should be used for the $package library man pages?"
8269 case "$man3ext" in
8270 '') case "$man3dir" in
8271 *3) dflt=3 ;;
8272 *3p) dflt=3p ;;
8273 *3pm) dflt=3pm ;;
8274 *l) dflt=l;;
8275 *n) dflt=n;;
8276 *o) dflt=o;;
8277 *p) dflt=p;;
8278 *C) dflt=C;;
8279 *L) dflt=L;;
8280 *L3) dflt=L3;;
8281 *) dflt=3;;
8282 esac
8283 ;;
8284 *) dflt="$man3ext";;
8285 esac
8286 . ./myread
8287 man3ext="$ans"
8288 ;;
8289esac
8290
8291: see if we have to deal with yellow pages, now NIS.
0384a54a 8292if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8293 if $test -f /usr/etc/nibindd; then
8294 echo " "
8295 echo "I'm fairly confident you're on a NeXT."
8296 echo " "
8297 rp='Do you get the hosts file via NetInfo?'
8298 dflt=y
8299 case "$hostcat" in
8300 nidump*) ;;
8301 '') ;;
8302 *) dflt=n;;
8303 esac
8304 . ./myread
8305 case "$ans" in
8306 y*) hostcat='nidump hosts .';;
8307 *) case "$hostcat" in
8308 nidump*) hostcat='';;
8309 esac
8310 ;;
8311 esac
8312 fi
8313 case "$hostcat" in
8314 nidump*) ;;
8315 *)
8316 case "$hostcat" in
8317 *ypcat*) dflt=y;;
8318 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8319 dflt=y
8320 else
8321 dflt=n
8322 fi;;
8323 *) dflt=n;;
8324 esac
8325 echo " "
8326 rp='Are you getting the hosts file via yellow pages?'
8327 . ./myread
8328 case "$ans" in
8329 y*) hostcat='ypcat hosts';;
8330 *) hostcat='cat /etc/hosts';;
8331 esac
8332 ;;
8333 esac
8334fi
8335case "$hostcat" in
8336'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8337esac
8338case "$groupcat" in
8339'') test -f /etc/group && groupcat='cat /etc/group';;
8340esac
8341case "$passcat" in
8342'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8343esac
8344
8345: now get the host name
8346echo " "
8347echo "Figuring out host name..." >&4
8348case "$myhostname" in
8349'') cont=true
8350 echo 'Maybe "hostname" will work...'
73614538 8351 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8352 myhostname=$tans
8353 phostname=hostname
8354 cont=''
8355 fi
8356 ;;
8357*) cont='';;
8358esac
8359if $test "$cont"; then
8360 if ./xenix; then
8361 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8362 if tans=`cat /etc/systemid 2>&1` ; then
8363 myhostname=$tans
8364 phostname='cat /etc/systemid'
8365 echo "Whadyaknow. Xenix always was a bit strange..."
8366 cont=''
8367 fi
8368 elif $test -r /etc/systemid; then
8369 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8370 fi
8371fi
8372if $test "$cont"; then
8373 echo 'No, maybe "uuname -l" will work...'
73614538 8374 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8375 myhostname=$tans
8376 phostname='uuname -l'
8377 else
8378 echo 'Strange. Maybe "uname -n" will work...'
73614538 8379 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8380 myhostname=$tans
8381 phostname='uname -n'
8382 else
8383 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8384 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8385 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8386 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8387 else
8388 case "$myhostname" in
8389 '') echo "Does this machine have an identity crisis or something?"
8390 phostname='';;
8391 *)
8392 echo "Well, you said $myhostname before..."
8393 phostname='echo $myhostname';;
8394 esac
8395 fi
8396 fi
8397 fi
8398fi
52a549d0
JH
8399case "$myhostname" in
8400'') myhostname=noname ;;
8401esac
b4eb6b3d
JH
8402: you do not want to know about this
8403set $myhostname
8404myhostname=$1
8405
8406: verify guess
8407if $test "$myhostname" ; then
8408 dflt=y
8409 rp='Your host name appears to be "'$myhostname'".'" Right?"
8410 . ./myread
8411 case "$ans" in
8412 y*) ;;
8413 *) myhostname='';;
8414 esac
8415fi
8416
8417: bad guess or no guess
8418while $test "X$myhostname" = X ; do
8419 dflt=''
8420 rp="Please type the (one word) name of your host:"
8421 . ./myread
8422 myhostname="$ans"
8423done
8424
8425: translate upper to lower if necessary
8426case "$myhostname" in
8427*[A-Z]*)
8428 echo "(Normalizing case in your host name)"
8429 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8430 ;;
8431esac
8432
8433case "$myhostname" in
8434*.*)
8435 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8436 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8437 echo "(Trimming domain name from host name--host name is now $myhostname)"
8438 ;;
8439*) case "$mydomain" in
8440 '')
8441 {
8442 test "X$hostcat" = "Xypcat hosts" &&
8443 ypmatch "$myhostname" hosts 2>/dev/null |\
8444 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8445 $test -s hosts
8446 } || {
8447 test "X$hostcat" != "X" &&
8448 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8449 /[ ]$myhostname[ . ]/p" > hosts
8450 }
8451 tmp_re="[ . ]"
f08cbdd1
PP
8452 if $test -f hosts; then
8453 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8454 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8455 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8456 hosts | $sort | $uniq | \
8457 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8458 case `$echo X$dflt` in
8459 X*\ *) echo "(Several hosts in the database matched hostname)"
8460 dflt=.
8461 ;;
8462 X.) echo "(You do not have fully-qualified names in the hosts database)"
8463 ;;
8464 esac
8465 else
8466 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8467 dflt=.
f08cbdd1 8468 fi
b4eb6b3d
JH
8469 case "$dflt" in
8470 .)
8471 tans=`./loc resolv.conf X /etc /usr/etc`
8472 if $test -f "$tans"; then
8473 echo "(Attempting domain name extraction from $tans)"
8474 dflt=.`$sed -n -e 's/ / /g' \
8475 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
8476 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8477 case "$dflt" in
8478 .) dflt=.`$sed -n -e 's/ / /g' \
8479 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
8480 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8481 ;;
8482 esac
8483 fi
8484 ;;
8485 esac
8486 case "$dflt" in
8487 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8488 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8489 case "$dflt" in
8490 '') dflt='.';;
8491 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8492 esac
8493 ;;
8494 esac
59c9e5d6
PP
8495 case "$dflt$osname" in
8496 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8497 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8498 ;;
8499 esac
b4eb6b3d
JH
8500 case "$dflt" in
8501 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8502 dflt='.nonet'
b4eb6b3d
JH
8503 ;;
8504 esac
8505 $rm -f hosts
8506 ;;
8507 *) dflt="$mydomain";;
8508 esac;;
8509esac
8510echo " "
8511rp="What is your domain name?"
8512. ./myread
8513tans="$ans"
8514case "$ans" in
8515'') ;;
8516.*) ;;
8517*) tans=".$tans";;
8518esac
8519mydomain="$tans"
8520
8521: translate upper to lower if necessary
8522case "$mydomain" in
8523*[A-Z]*)
8524 echo "(Normalizing case in your domain name)"
8525 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8526 ;;
8527esac
8528
8529: a little sanity check here
8530case "$phostname" in
8531'') ;;
8532*)
8533 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8534 $myhostname$mydomain|$myhostname) ;;
8535 *)
8536 case "$phostname" in
8537 sed*)
8538 echo "(That doesn't agree with your whoami.h file, by the way.)"
8539 ;;
8540 *)
8541 echo "(That doesn't agree with your $phostname command, by the way.)"
8542 ;;
8543 esac
8544 ;;
8545 esac
8546 ;;
8547esac
8548
8549$cat <<EOM
8550
8551I need to get your e-mail address in Internet format if possible, i.e.
8552something like user@host.domain. Please answer accurately since I have
8553no easy means to double check it. The default value provided below
8554is most probably close to reality but may not be valid from outside
8555your organization...
8556
8557EOM
8558cont=x
8559while test "$cont"; do
8560 case "$cf_email" in
8561 '') dflt="$cf_by@$myhostname$mydomain";;
8562 *) dflt="$cf_email";;
8563 esac
8564 rp='What is your e-mail address?'
8565 . ./myread
8566 cf_email="$ans"
8567 case "$cf_email" in
8568 *@*.*) cont='' ;;
8569 *)
8570 rp='Address does not look like an Internet one. Use it anyway?'
8571 case "$fastread" in
8572 yes) dflt=y ;;
8573 *) dflt=n ;;
8574 esac
8575 . ./myread
8576 case "$ans" in
8577 y*) cont='' ;;
8578 *) echo " " ;;
8579 esac
8580 ;;
8581 esac
8582done
8583
8584$cat <<EOM
8585
8586If you or somebody else will be maintaining perl at your site, please
8587fill in the correct e-mail address here so that they may be contacted
8588if necessary. Currently, the "perlbug" program included with perl
8589will send mail to this address in addition to perlbug@perl.org. You may
8590enter "none" for no administrator.
8591
8592EOM
8593case "$perladmin" in
8594'') dflt="$cf_email";;
8595*) dflt="$perladmin";;
8596esac
8597rp='Perl administrator e-mail address'
8598. ./myread
8599perladmin="$ans"
8600
674912d7
RB
8601: determine whether to only install version-specific parts.
8602echo " "
8603$cat <<EOM
8604Do you want to install only the version-specific parts of the perl
8605distribution? Usually you do *not* want to do this.
8606EOM
8607case "$versiononly" in
8608"$define"|[Yy]*|true) dflt='y' ;;
8609*) dflt='n';
8610esac
8611rp="Do you want to install only the version-specific parts of perl?"
8612. ./myread
8613case "$ans" in
8614[yY]*) val="$define";;
8615*) val="$undef" ;;
8616esac
8617set versiononly
8618eval $setvar
8619
ad493445
MB
8620case "$versiononly" in
8621"$define") inc_version_list=''
8622 inc_version_list_init=0
8623 ;;
8624esac
8625
b4eb6b3d 8626: figure out how to guarantee perl startup
d0e36aa9 8627: XXX Note that this currently takes advantage of the bug that binexp ignores
a2d23ec2
MB
8628: the Configure -Dinstallprefix setting, which in turn means that under
8629: relocatable @INC, initialinstalllocation is what binexp started as.
b4eb6b3d
JH
8630case "$startperl" in
8631'')
8632 case "$sharpbang" in
8633 *!)
8634 $cat <<EOH
8635
8636I can use the #! construct to start perl on your system. This will
8637make startup of perl scripts faster, but may cause problems if you
8638want to share those scripts and perl is not in a standard place
a2d23ec2
MB
8639($initialinstalllocation/perl) on all your platforms. The alternative
8640is to force a shell by starting the script with a single ':' character.
b4eb6b3d
JH
8641
8642EOH
674912d7 8643 case "$versiononly" in
a2d23ec2 8644 "$define") dflt="$initialinstalllocation/perl$version";;
d0e36aa9 8645 *) dflt="$initialinstalllocation/perl";;
674912d7 8646 esac
b4eb6b3d
JH
8647 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8648 . ./myread
8649 case "$ans" in
8650 none) startperl=": # use perl";;
8651 *) startperl="#!$ans"
8652 if $test 30 -lt `echo "$ans" | wc -c`; then
8653 $cat >&4 <<EOM
8654
8655WARNING: Some systems limit the #! command to 32 characters.
8656If you experience difficulty running Perl scripts with #!, try
8657installing Perl in a directory with a shorter pathname.
8658
8659EOM
8660 fi ;;
8661 esac
8662 ;;
8663 *) startperl=": # use perl"
8664 ;;
8665 esac
8666 ;;
8667esac
8668echo "I'll use $startperl to start perl scripts."
8669
8670: figure best path for perl in scripts
8671case "$perlpath" in
8672'')
5e20a8ca 8673 case "$versiononly" in
d0e36aa9
NC
8674 "$define") perlpath="$initialinstalllocation/perl$version";;
8675 *) perlpath="$initialinstalllocation/perl";;
5e20a8ca 8676 esac
b4eb6b3d
JH
8677 case "$startperl" in
8678 *!*) ;;
8679 *)
8680 $cat <<EOH
8681
8682I will use the "eval 'exec'" idiom to start Perl on your system.
8683I can use the full path of your Perl binary for this purpose, but
8684doing so may cause problems if you want to share those scripts and
d0e36aa9 8685Perl is not always in a standard place ($initialinstalllocation/perl).
b4eb6b3d
JH
8686
8687EOH
d0e36aa9 8688 dflt="$initialinstalllocation/perl"
b4eb6b3d
JH
8689 rp="What path shall I use in \"eval 'exec'\"?"
8690 . ./myread
8691 perlpath="$ans"
8692 ;;
8693 esac
8694 ;;
8695esac
8696case "$startperl" in
8697*!*) ;;
8698*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8699esac
8700
8701: determine where public executable scripts go
8702set scriptdir scriptdir
8703eval $prefixit
8704case "$scriptdir" in
8705'')
8706 dflt="$bin"
8707 : guess some guesses
8708 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8709 $test -d /usr/share/bin && dflt=/usr/share/bin
8710 $test -d /usr/local/script && dflt=/usr/local/script
8711 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8712 $test -d $prefixexp/script && dflt=$prefixexp/script
8713 set dflt
8714 eval $prefixup
8715 ;;
8716*) dflt="$scriptdir"
8717 ;;
8718esac
8719$cat <<EOM
f3f1a2d8 8720
b4eb6b3d
JH
8721Some installations have a separate directory just for executable scripts so
8722that they can mount it across multiple architectures but keep the scripts in
8723one spot. You might, for example, have a subdirectory of /usr/share for this.
8724Or you might just lump your scripts in with all your other executables.
f3f1a2d8 8725
b4eb6b3d
JH
8726EOM
8727fn=d~
8728rp='Where do you keep publicly executable scripts?'
8729. ./getfile
8730if $test "X$ansexp" != "X$scriptdirexp"; then
8731 installscript=''
8732fi
f3f1a2d8 8733installscriptdir=''
79522dd2
NC
8734prefixvar=scriptdir
8735. ./setprefixvar
8736: A little fix up for an irregularly named variable.
8737installscript="$installscriptdir"
8738
b4eb6b3d
JH
8739: determine where add-on public executables go
8740case "$sitebin" in
8741'') dflt=$siteprefix/bin ;;
8742*) dflt=$sitebin ;;
8743esac
8744fn=d~
8745rp='Pathname where the add-on public executables should be installed?'
8746. ./getfile
79522dd2
NC
8747prefixvar=sitebin
8748. ./setprefixvar
b4eb6b3d 8749
6e1038e0 8750: determine where add-on html pages go
8d2cbf27 8751: There is no standard location, so try to copy the previously-selected
6e1038e0 8752: directory structure for the core html pages.
8d2cbf27
JH
8753case "$sitehtml1dir" in
8754'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8755*) dflt=$sitehtml1dir ;;
6e1038e0
MB
8756esac
8757case "$dflt" in
8758''|' ') dflt=none ;;
8759esac
8760fn=dn+~
8761rp='Pathname where the site-specific html pages should be installed?'
8762. ./getfile
79522dd2
NC
8763prefixvar=sitehtml1dir
8764. ./setprefixvar
6e1038e0
MB
8765
8766: determine where add-on library html pages go
8767: There is no standard location, so try to copy the previously-selected
8768: directory structure for the core html pages.
8d2cbf27
JH
8769case "$sitehtml3dir" in
8770'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8771*) dflt=$sitehtml3dir ;;
6e1038e0
MB
8772esac
8773case "$dflt" in
8774''|' ') dflt=none ;;
8775esac
8776fn=dn+~
8777rp='Pathname where the site-specific library html pages should be installed?'
8778. ./getfile
79522dd2
NC
8779prefixvar=sitehtml3dir
8780. ./setprefixvar
6e1038e0
MB
8781
8782: determine where add-on manual pages go
91e123a8
JH
8783case "$siteman1dir" in
8784'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 8785*) dflt=$siteman1dir ;;
6e1038e0 8786esac
257059b5
JH
8787case "$dflt" in
8788''|' ') dflt=none ;;
8789esac
6e1038e0
MB
8790fn=dn+~
8791rp='Pathname where the site-specific manual pages should be installed?'
8792. ./getfile
79522dd2
NC
8793prefixvar=siteman1dir
8794. ./setprefixvar
6e1038e0
MB
8795
8796: determine where add-on library man pages go
91e123a8
JH
8797case "$siteman3dir" in
8798'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 8799*) dflt=$siteman3dir ;;
6e1038e0 8800esac
257059b5
JH
8801case "$dflt" in
8802''|' ') dflt=none ;;
8803esac
6e1038e0
MB
8804fn=dn+~
8805rp='Pathname where the site-specific library manual pages should be installed?'
8806. ./getfile
79522dd2
NC
8807prefixvar=siteman3dir
8808. ./setprefixvar
6e1038e0
MB
8809
8810: determine where add-on public executable scripts go
8811case "$sitescript" in
8812'') dflt=$siteprefix/script
8813 $test -d $dflt || dflt=$sitebin ;;
8814*) dflt="$sitescript" ;;
8815esac
8816fn=d~+
8817rp='Pathname where add-on public executable scripts should be installed?'
8818. ./getfile
79522dd2
NC
8819prefixvar=sitescript
8820. ./setprefixvar
6e1038e0 8821
15b61c98
JH
8822case "$usefaststdio" in
8823$define|true|[yY]*|'')
8824 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8825 case "$xversion" in
8826 [68]) dflt='y' ;;
8827 *) dflt='n' ;;
8828 esac
8829 ;;
8830*) dflt='n';;
8831esac
8832cat <<EOM
8833
8834Perl can be built to use 'fast stdio', which means using the stdio
8835library but also directly manipulating the stdio buffers to enable
8836faster I/O. Using stdio is better for backward compatibility (especially
8837for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8838interface has been preferred instead of stdio.
8839
8840If this doesn't make any sense to you, just accept the default '$dflt'.
8841EOM
8842rp='Use the "fast stdio" if available?'
8843. ./myread
8844case "$ans" in
8845y|Y) val="$define" ;;
8846*) val="$undef" ;;
8847esac
8848set usefaststdio
8849eval $setvar
8850
8851
96056487
JH
8852: define an is-a-typedef? function
8853typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8854case "$inclist" in
8855"") inclist="sys/types.h";;
8856esac;
8857eval "varval=\$$var";
8858case "$varval" in
8859"")
8860 $rm -f temp.c;
8861 for inc in $inclist; do
8862 echo "#include <$inc>" >>temp.c;
8863 done;
8864 echo "#ifdef $type" >> temp.c;
8865 echo "printf(\"We have $type\");" >> temp.c;
8866 echo "#endif" >> temp.c;
8867 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8868 if $contains $type temp.E >/dev/null 2>&1; then
8869 eval "$var=\$type";
8870 else
8871 eval "$var=\$def";
8872 fi;
8873 $rm -f temp.?;;
8874*) eval "$var=\$varval";;
8875esac'
8876
8877: define an is-a-typedef? function that prompts if the type is not available.
8878typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8879case "$inclist" in
8880"") inclist="sys/types.h";;
8881esac;
8882eval "varval=\$$var";
8883case "$varval" in
8884"")
8885 $rm -f temp.c;
8886 for inc in $inclist; do
8887 echo "#include <$inc>" >>temp.c;
8888 done;
8889 echo "#ifdef $type" >> temp.c;
8890 echo "printf(\"We have $type\");" >> temp.c;
8891 echo "#endif" >> temp.c;
8892 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8893 echo " " ;
8894 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8895 if $contains $type temp.E >/dev/null 2>&1; then
8896 echo "$type found." >&4;
8897 eval "$var=\$type";
8898 else
8899 echo "$type NOT found." >&4;
8900 dflt="$def";
8901 . ./myread ;
8902 eval "$var=\$ans";
8903 fi;
8904 $rm -f temp.?;;
8905*) eval "$var=\$varval";;
8906esac'
8907
8908: see what type lseek is declared as in the kernel
8909rp="What is the type used for lseek's offset on this system?"
8910set off_t lseektype long stdio.h sys/types.h
8911eval $typedef_ask
8912
8913echo " "
8914echo "Checking to see how big your file offsets are..." >&4
8915$cat >try.c <<EOCP
8916#include <sys/types.h>
8917#include <stdio.h>
8918int main()
8919{
8920 printf("%d\n", (int)sizeof($lseektype));
8921 return(0);
8922}
8923EOCP
8924set try
8925if eval $compile_ok; then
8926 lseeksize=`$run ./try`
8927 echo "Your file offsets are $lseeksize bytes long."
8928else
8929 dflt=$longsize
8930 echo " "
8931 echo "(I can't seem to compile the test program. Guessing...)"
8932 rp="What is the size of your file offsets (in bytes)?"
8933 . ./myread
8934 lseeksize="$ans"
8935fi
8936$rm -f try.c try
8937
8938: see what type file positions are declared as in the library
8939rp="What is the type for file position used by fsetpos()?"
8940set fpos_t fpostype long stdio.h sys/types.h
8941eval $typedef_ask
8942
8943echo " "
8944case "$fpostype" in
8945*_t) zzz="$fpostype" ;;
8946*) zzz="fpos_t" ;;
8947esac
8948echo "Checking the size of $zzz..." >&4
8949cat > try.c <<EOCP
8950#include <sys/types.h>
8951#include <stdio.h>
d1daaddf
JH
8952#$i_stdlib I_STDLIB
8953#ifdef I_STDLIB
8954#include <stdlib.h>
8955#endif
96056487
JH
8956int main() {
8957 printf("%d\n", (int)sizeof($fpostype));
8958 exit(0);
8959}
8960EOCP
8961set try
8962if eval $compile_ok; then
8963 yyy=`$run ./try`
8964 case "$yyy" in
8965 '') fpossize=4
8966 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8967 ;;
8968 *) fpossize=$yyy
8969 echo "Your $zzz is $fpossize bytes long."
8970 ;;
8971 esac
8972else
8973 dflt="$longsize"
8974 echo " " >&4
8975 echo "(I can't compile the test program. Guessing...)" >&4
8976 rp="What is the size of your file positions (in bytes)?"
8977 . ./myread
8978 fpossize="$ans"
8979fi
8980
96056487
JH
8981# Backward compatibility (uselfs is deprecated).
8982case "$uselfs" in
8983"$define"|true|[yY]*)
8984 cat <<EOM >&4
8985
8986*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8987EOM
8988 uselargefiles="$define"
8989 ;;
8990esac
8991
8992case "$lseeksize:$fpossize" in
89938:8) cat <<EOM
8994
8995You can have files larger than 2 gigabytes.
8996EOM
8997 val="$define" ;;
8998*) case "$uselargefiles" in
8999 "$undef"|false|[nN]*) dflt='n' ;;
9000 *) dflt='y' ;;
9001 esac
9002 cat <<EOM
9003
9004Perl can be built to understand large files (files larger than 2 gigabytes)
9005on some systems. To do so, Configure can be run with -Duselargefiles.
9006
9007If this doesn't make any sense to you, just accept the default '$dflt'.
9008EOM
9009 rp='Try to understand large files, if available?'
9010 . ./myread
9011 case "$ans" in
9012 y|Y) val="$define" ;;
9013 *) val="$undef" ;;
9014 esac
9015 ;;
9016esac
9017set uselargefiles
9018eval $setvar
96056487
JH
9019: Look for a hint-file generated 'call-back-unit'. If the
9020: user has specified that a large files perl is to be built,
9021: we may need to set or change some other defaults.
9da7673b
MB
9022if $test -f uselargefiles.cbu; then
9023 echo "Your platform has some specific hints regarding large file builds, using them..."
9024 . ./uselargefiles.cbu
9025fi
9026case "$uselargefiles" in
9027"$define")
96056487 9028 if $test -f uselargefiles.cbu; then
96056487
JH
9029 echo " "
9030 echo "Rechecking to see how big your file offsets are..." >&4
9031 $cat >try.c <<EOCP
9032#include <sys/types.h>
9033#include <stdio.h>
9034int main()
9035{
9036 printf("%d\n", (int)sizeof($lseektype));
9037 return(0);
9038}
9039EOCP
9040 set try
9041 if eval $compile_ok; then
9042 lseeksize=`$run ./try`
9043 $echo "Your file offsets are now $lseeksize bytes long."
9044 else
9045 dflt="$lseeksize"
9046 echo " "
9047 echo "(I can't seem to compile the test program. Guessing...)"
9048 rp="What is the size of your file offsets (in bytes)?"
9049 . ./myread
9050 lseeksize="$ans"
9051 fi
9052 case "$fpostype" in
9053 *_t) zzz="$fpostype" ;;
9054 *) zzz="fpos_t" ;;
9055 esac
9056 $echo $n "Rechecking the size of $zzz...$c" >&4
9057 $cat > try.c <<EOCP
9058#include <sys/types.h>
9059#include <stdio.h>
55954f19
JH
9060#$i_stdlib I_STDLIB
9061#ifdef I_STDLIB
9062#include <stdlib.h>
9063#endif
96056487
JH
9064int main() {
9065 printf("%d\n", (int)sizeof($fpostype));
073b6de5 9066 return(0);
96056487
JH
9067}
9068EOCP
9069 set try
9070 if eval $compile_ok; then
9071 yyy=`$run ./try`
9072 dflt="$lseeksize"
9073 case "$yyy" in
9074 '') echo " "
9075 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9076 ;;
9077 *) fpossize=$yyy
9078 echo " $fpossize bytes." >&4
9079 ;;
9080 esac
9081 else
9082 dflt="$fpossize"
9083 echo " "
9084 echo "(I can't compile the test program. Guessing...)" >&4
9085 rp="What is the size of your file positions (in bytes)?"
9086 . ./myread
9087 fpossize="$ans"
9088 fi
9089 $rm -f try.c try
9090 fi
9091 ;;
9092esac
9093
b4eb6b3d
JH
9094case "$vendorprefix" in
9095'') d_vendorbin="$undef"
9096 vendorbin=''
9097 vendorbinexp=''
9098 ;;
9099*) d_vendorbin="$define"
9100 : determine where vendor-supplied executables go.
9101 case "$vendorbin" in
9102 '') dflt=$vendorprefix/bin ;;
9103 *) dflt="$vendorbin" ;;
9104 esac
9105 fn=d~+
9106 rp='Pathname for the vendor-supplied executables directory?'
9107 . ./getfile
9108 vendorbin="$ans"
9109 vendorbinexp="$ansexp"
9110 ;;
9111esac
a092d240
NC
9112prefixvar=vendorbin
9113. ./installprefix
b4eb6b3d 9114
6e1038e0 9115case "$vendorprefix" in
8d2cbf27
JH
9116'') vendorhtml1dir=''
9117 vendorhtml1direxp=''
6e1038e0
MB
9118 ;;
9119*) : determine where vendor-supplied html pages go.
9120 : There is no standard location, so try to copy the previously-selected
9121 : directory structure for the core html pages.
9122 : XXX Better default suggestions would be welcome.
8d2cbf27 9123 case "$vendorhtml1dir" in
6e1038e0 9124 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9125 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9126 esac
9127 case "$dflt" in
9128 ''|' ') dflt=none ;;
9129 esac
9130 fn=dn+~
9131 rp='Pathname for the vendor-supplied html pages?'
9132 . ./getfile
8d2cbf27
JH
9133 vendorhtml1dir="$ans"
9134 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9135 ;;
9136esac
9137: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9138$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
a092d240
NC
9139prefixvar=vendorhtml1dir
9140. ./installprefix
6e1038e0
MB
9141
9142case "$vendorprefix" in
8d2cbf27
JH
9143'') vendorhtml3dir=''
9144 vendorhtml3direxp=''
6e1038e0
MB
9145 ;;
9146*) : determine where vendor-supplied module html pages go.
9147 : There is no standard location, so try to copy the previously-selected
9148 : directory structure for the core html pages.
9149 : XXX Better default suggestions would be welcome.
8d2cbf27 9150 case "$vendorhtml3dir" in
6e1038e0 9151 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9152 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9153 esac
9154 case "$dflt" in
9155 ''|' ') dflt=none ;;
9156 esac
9157 fn=dn+~
9158 rp='Pathname for the vendor-supplied html pages?'
9159 . ./getfile
8d2cbf27
JH
9160 vendorhtml3dir="$ans"
9161 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9162 ;;
9163esac
9164: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9165$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
a092d240
NC
9166prefixvar=vendorhtml3dir
9167. ./installprefix
6e1038e0
MB
9168
9169case "$vendorprefix" in
91e123a8
JH
9170'') vendorman1dir=''
9171 vendorman1direxp=''
6e1038e0
MB
9172 ;;
9173*) : determine where vendor-supplied manual pages go.
91e123a8 9174 case "$vendorman1dir" in
6e1038e0 9175 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9176 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9177 esac
9178 case "$dflt" in
9179 ''|' ') dflt=none ;;
9180 esac
9181 fn=nd~+
9182 rp='Pathname for the vendor-supplied manual section 1 pages?'
9183 . ./getfile
91e123a8
JH
9184 vendorman1dir="$ans"
9185 vendorman1direxp="$ansexp"
6e1038e0
MB
9186 ;;
9187esac
9188: Use ' ' for none so value is preserved next time through Configure
91e123a8 9189$test X"$vendorman1dir" = "X" && vendorman1dir=' '
a092d240
NC
9190prefixvar=vendorman1dir
9191. ./installprefix
6e1038e0
MB
9192
9193case "$vendorprefix" in
91e123a8
JH
9194'') vendorman3dir=''
9195 vendorman3direxp=''
6e1038e0
MB
9196 ;;
9197*) : determine where vendor-supplied module manual pages go.
91e123a8 9198 case "$vendorman3dir" in
6e1038e0 9199 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9200 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9201 esac
9202 case "$dflt" in
9203 ''|' ') dflt=none ;;
9204 esac
9205 fn=nd~+
9206 rp='Pathname for the vendor-supplied manual section 3 pages?'
9207 . ./getfile
91e123a8
JH
9208 vendorman3dir="$ans"
9209 vendorman3direxp="$ansexp"
6e1038e0
MB
9210 ;;
9211esac
9212: Use ' ' for none so value is preserved next time through Configure
91e123a8 9213$test X"$vendorman3dir" = "X" && vendorman3dir=' '
a092d240
NC
9214prefixvar=vendorman3dir
9215. ./installprefix
6e1038e0
MB
9216
9217case "$vendorprefix" in
9218'') d_vendorscript="$undef"
9219 vendorscript=''
9220 vendorscriptexp=''
9221 ;;
9222*) d_vendorscript="$define"
9223 : determine where vendor-supplied scripts go.
9224 case "$vendorscript" in
9225 '') dflt=$vendorprefix/script
9226 $test -d $dflt || dflt=$vendorbin ;;
9227 *) dflt="$vendorscript" ;;
9228 esac
9229 $cat <<EOM
9230
f3f1a2d8 9231The installation process will create a directory for
6e1038e0
MB
9232vendor-supplied scripts.
9233
9234EOM
9235 fn=d~+
9236 rp='Pathname for the vendor-supplied scripts directory?'
9237 . ./getfile
9238 vendorscript="$ans"
9239 vendorscriptexp="$ansexp"
9240 ;;
9241esac
a092d240
NC
9242prefixvar=vendorscript
9243. ./installprefix
6e1038e0 9244
b4eb6b3d
JH
9245: see if qgcvt exists
9246set qgcvt d_qgcvt
9247eval $inlibc
9248
89ce900e
JH
9249echo " "
9250
9251if $test X"$d_longdbl" = X"$define"; then
9252
9253echo "Checking how to print long doubles..." >&4
9254
9255if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9256 $cat >try.c <<'EOCP'
9257#include <sys/types.h>
9258#include <stdio.h>
9259int main() {
9260 double d = 123.456;
9261 printf("%.3f\n", d);
9262}
9263EOCP
9264 set try
9265 if eval $compile; then
9266 yyy=`$run ./try`
9267 case "$yyy" in
9268 123.456)
9269 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9270 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9271 echo "We will use %f."
9272 ;;
9273 esac
9274 fi
9275fi
9276
9277if $test X"$sPRIfldbl" = X; then
9278 $cat >try.c <<'EOCP'
9279#include <sys/types.h>
9280#include <stdio.h>
9281int main() {
9282 long double d = 123.456;
9283 printf("%.3Lf\n", d);
9284}
9285EOCP
9286 set try
9287 if eval $compile; then
9288 yyy=`$run ./try`
9289 case "$yyy" in
9290 123.456)
9291 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9292 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9293 echo "We will use %Lf."
9294 ;;
9295 esac
9296 fi
9297fi
9298
9299if $test X"$sPRIfldbl" = X; then
9300 $cat >try.c <<'EOCP'
9301#include <sys/types.h>
9302#include <stdio.h>
9303int main() {
9304 long double d = 123.456;
9305 printf("%.3llf\n", d);
9306}
9307EOCP
9308 set try
9309 if eval $compile; then
9310 yyy=`$run ./try`
9311 case "$yyy" in
9312 123.456)
9313 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9314 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9315 echo "We will use %llf."
9316 ;;
9317 esac
9318 fi
9319fi
9320
9321if $test X"$sPRIfldbl" = X; then
9322 $cat >try.c <<'EOCP'
9323#include <sys/types.h>
9324#include <stdio.h>
9325int main() {
9326 long double d = 123.456;
9327 printf("%.3lf\n", d);
9328}
9329EOCP
9330 set try
9331 if eval $compile; then
9332 yyy=`$run ./try`
9333 case "$yyy" in
9334 123.456)
9335 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9336 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9337 echo "We will use %lf."
9338 ;;
9339 esac
9340 fi
9341fi
9342
9343if $test X"$sPRIfldbl" = X; then
9344 echo "Cannot figure out how to print long doubles." >&4
9345else
9346 sSCNfldbl=$sPRIfldbl # expect consistency
9347fi
9348
9349$rm -f try try.*
9350
9351fi # d_longdbl
9352
9353case "$sPRIfldbl" in
9354'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9355 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9356 d_SCNfldbl="$undef";
9357 ;;
9358*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9359 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9360 d_SCNfldbl="$define";
9361 ;;
9362esac
9363
b4eb6b3d 9364: Check how to convert floats to strings.
a5b10d80
YST
9365
9366if test "X$d_Gconvert" = X; then
9367
b4eb6b3d
JH
9368echo " "
9369echo "Checking for an efficient way to convert floats to strings."
9370echo " " > try.c
9371case "$uselongdouble" in
9372"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9373esac
9374case "$d_longdbl" in
9375"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9376esac
9377case "$d_PRIgldbl" in
9378"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9379esac
9380$cat >>try.c <<EOP
9381#ifdef TRY_gconvert
9382#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9383char *myname = "gconvert";
9384#endif
9385#ifdef TRY_gcvt
9386#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9387char *myname = "gcvt";
9388#endif
9389#ifdef TRY_qgcvt
9390#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9391char *myname = "qgcvt";
9392#define DOUBLETYPE long double
9393#endif
9394#ifdef TRY_sprintf
a5b10d80
YST
9395#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9396#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9397#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9398#else
a5b10d80
YST
9399#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9400#endif
9401#else
b4eb6b3d
JH
9402#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9403#endif
9404char *myname = "sprintf";
9405#endif
9406
9407#ifndef DOUBLETYPE
9408#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9409#define DOUBLETYPE long double
9410#else
9411#define DOUBLETYPE double
9412#endif
9413#endif
9414
9415#include <stdio.h>
9416
9417#define I_STDLIB $i_stdlib
9418#ifdef I_STDLIB
9419#include <stdlib.h>
9420#endif
9421
9422int
9423checkit(expect, got)
9424char *expect;
9425char *got;
9426{
9427 if (strcmp(expect, got)) {
9428 printf("%s oddity: Expected %s, got %s\n",
9429 myname, expect, got);
9430 exit(1);
9431 }
9432}
9433
9434int main()
9435{
9436 char buf[64];
9437 buf[63] = '\0';
9438
9439 /* This must be 1st test on (which?) platform */
9440 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9441 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9442 checkit("0.1", buf);
9443
a5b10d80
YST
9444 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9445 checkit("0.01", buf);
9446
9447 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9448 checkit("0.001", buf);
9449
9450 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9451 checkit("0.0001", buf);
9452
9453 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9454 if (strlen(buf) > 5)
9455 checkit("9e-005", buf); /* for Microsoft ?? */
9456 else
9457 checkit("9e-05", buf);
9458
b4eb6b3d
JH
9459 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9460 checkit("1", buf);
9461
9462 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9463 checkit("1.1", buf);
9464
9465 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9466 checkit("1.01", buf);
9467
9468 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9469 checkit("1.001", buf);
9470
9471 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9472 checkit("1.0001", buf);
9473
9474 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9475 checkit("1.00001", buf);
9476
9477 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9478 checkit("1.000001", buf);
9479
9480 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9481 checkit("0", buf);
9482
9483 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9484 checkit("-1", buf);
9485
9486 /* Some Linux gcvt's give 1.e+5 here. */
9487 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9488 checkit("100000", buf);
9489
9490 /* Some Linux gcvt's give -1.e+5 here. */
9491 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9492 checkit("-100000", buf);
9493
9494 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9495 checkit("123.456", buf);
9496
ab6ca9f4 9497 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9498 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9499 /* 34 should be enough to scare even long double
9500 * places into using the e notation. */
ab6ca9f4 9501 if (strlen(buf) > 5)
94b339ad 9502 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9503 else
94b339ad 9504 checkit("1e+34", buf);
8e2a5ede 9505
d1eb8299
YST
9506 /* For Perl, if you add additional tests here, also add them to
9507 * t/base/num.t for benefit of platforms not using Configure or
9508 * overriding d_Gconvert */
9509
b4eb6b3d
JH
9510 exit(0);
9511}
9512EOP
ab6ca9f4 9513: first add preferred functions to our list
a5b10d80 9514xxx_list=""
ab6ca9f4 9515for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9516 case $xxx_convert in
9517 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9518 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
a5b10d80
YST
9519 esac
9520done
9521: then add any others
9522for xxx_convert in gconvert gcvt sprintf; do
9523 case "$xxx_list" in
9524 *$xxx_convert*) ;;
9525 *) xxx_list="$xxx_list $xxx_convert" ;;
9526 esac
9527done
9528
9529case "$d_longdbl$uselongdouble" in
9530"$define$define")
9531 : again, add prefered functions to our list first
9532 xxx_ld_list=""
ab6ca9f4 9533 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9534 case $xxx_convert in
9535 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9536 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9537 esac
9538 done
9539 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9540 for xxx_convert in qgcvt sprintf $xxx_list; do
9541 case "$xxx_ld_list" in
9542 $xxx_convert*|*" $xxx_convert"*) ;;
9543 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9544 esac
9545 done
9546 : if sprintf cannot do long doubles, move it to the end
9547 if test "$d_PRIgldbl" != "$define"; then
9548 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9549 fi
9550 : if no qgcvt, remove it
9551 if test "$d_qgcvt" != "$define"; then
9552 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9553 fi
9554 : use the ld_list
9555 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9556 ;;
9557esac
9558
9559for xxx_convert in $xxx_list; do
9560 echo "Trying $xxx_convert..."
9561 $rm -f try try$_o
9562 set try -DTRY_$xxx_convert
9563 if eval $compile; then
9564 echo "$xxx_convert() found." >&4
5440bc8e 9565 if $run ./try; then
b4eb6b3d
JH
9566 echo "I'll use $xxx_convert to convert floats into a string." >&4
9567 break;
9568 else
9569 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9570 xxx_convert=''
b4eb6b3d
JH
9571 fi
9572 else
9573 echo "$xxx_convert NOT found." >&4
9574 fi
9575done
ab6ca9f4 9576
a5b10d80
YST
9577if test X$xxx_convert = X; then
9578 echo "*** WHOA THERE!!! ***" >&4
9579 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9580 xxx_convert=sprintf
9581fi
9582
b4eb6b3d
JH
9583case "$xxx_convert" in
9584gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9585gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9586qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9587*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9588 "$define$define$define")
9589 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9590 "$define$define$undef")
9591 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9592 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9593 esac
9594 ;;
9595esac
9596
a5b10d80
YST
9597fi
9598
74cac757
JH
9599: see if _fwalk exists
9600set fwalk d__fwalk
9601eval $inlibc
9602
b4eb6b3d
JH
9603: Initialize h_fcntl
9604h_fcntl=false
9605
9606: Initialize h_sysfile
9607h_sysfile=false
9608
9609: access call always available on UNIX
9610set access d_access
9611eval $inlibc
9612
9613: locate the flags for 'access()'
9614case "$d_access" in
9615"$define")
9616 echo " "
55954f19 9617 $cat >access.c <<EOCP
b4eb6b3d
JH
9618#include <sys/types.h>
9619#ifdef I_FCNTL
9620#include <fcntl.h>
9621#endif
9622#ifdef I_SYS_FILE
9623#include <sys/file.h>
9624#endif
9625#ifdef I_UNISTD
9626#include <unistd.h>
9627#endif
55954f19
JH
9628#$i_stdlib I_STDLIB
9629#ifdef I_STDLIB
9630#include <stdlib.h>
9631#endif
b4eb6b3d
JH
9632int main() {
9633 exit(R_OK);
9634}
9635EOCP
9636 : check sys/file.h first, no particular reason here
9637 if $test `./findhdr sys/file.h` && \
7a282f6d 9638 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9639 h_sysfile=true;
9640 echo "<sys/file.h> defines the *_OK access constants." >&4
9641 elif $test `./findhdr fcntl.h` && \
7a282f6d 9642 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9643 h_fcntl=true;
9644 echo "<fcntl.h> defines the *_OK access constants." >&4
9645 elif $test `./findhdr unistd.h` && \
7a282f6d 9646 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9647 echo "<unistd.h> defines the *_OK access constants." >&4
9648 else
9649 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9650 fi
9651 ;;
9652esac
9653$rm -f access*
9654
9655: see if accessx exists
9656set accessx d_accessx
9657eval $inlibc
9658
89ce900e
JH
9659: see if aintl exists
9660set aintl d_aintl
9661eval $inlibc
9662
b4eb6b3d
JH
9663: see if alarm exists
9664set alarm d_alarm
9665eval $inlibc
9666
a9dade78
JH
9667: see if POSIX threads are available
9668set pthread.h i_pthread
9669eval $inhdr
9670
10bc17b6
JH
9671: define a fucntion to check prototypes
9672$cat > protochk <<EOSH
9673$startsh
9674cc="$cc"
9675optimize="$optimize"
9676ccflags="$ccflags"
9677prototype="$prototype"
9678define="$define"
9679rm=$rm
a9dade78
JH
9680usethreads=$usethreads
9681i_pthread=$i_pthread
9682pthread_h_first=$pthread_h_first
10bc17b6
JH
9683EOSH
9684
9685$cat >> protochk <<'EOSH'
9686
9687$rm -f try.c
9688foo="$1"
9689shift
9690while test $# -ge 2; do
9691 case "$1" in
9692 $define) echo "#include <$2>" >> try.c ;;
9693 literal) echo "$2" >> try.c ;;
9694 esac
cce6a207
MB
9695 # Extra magic for the benefit of systems that need pthread.h
9696 # to be included early to correctly detect threadsafe functions.
9697 # Such functions must guarantee themselves, though, that the usethreads
9698 # and i_pthread have been defined, before calling protochk.
9699 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9700 echo "#include <pthread.h>" >> try.c
9701 pthread_h_done=yes
9702 fi
10bc17b6
JH
9703 shift 2
9704done
9705test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
9706cat >> try.c <<'EOCP'
9707#ifdef CAN_PROTOTYPE
9708#define _(args) args
9709#else
9710#define _(args) ()
9711#endif
9712EOCP
9713echo "$foo" >> try.c
9714echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9715$cc $optimize $ccflags -c try.c > /dev/null 2>&1
9716status=$?
9717$rm -f try.[co]
9718exit $status
9719EOSH
9720chmod +x protochk
9721$eunicefix protochk
9722
89ce900e
JH
9723hasproto='varname=$1; func=$2; shift; shift;
9724while $test $# -ge 2; do
9725 case "$1" in
9726 $define) echo "#include <$2>";;
9727 esac ;
9728 shift 2;
9729done > try.c;
9730$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9731if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9732 echo "$func() prototype found.";
9733 val="$define";
9734else
9735 echo "$func() prototype NOT found.";
9736 val="$undef";
9737fi;
9738set $varname;
9739eval $setvar;
9740$rm -f try.c tryout.c'
9741
10bc17b6
JH
9742: see if sys/types.h has to be included
9743set sys/types.h i_systypes
9744eval $inhdr
9745
9746: see if sys/select.h has to be included
9747set sys/select.h i_sysselct
9748eval $inhdr
9749
9750hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9751while $test $# -ge 2; do
9752 case "$1" in
9753 $define) echo "#include <$2>";;
9754 esac ;
9755 shift 2;
9756done > try.c;
9757echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9758set try;
9759if eval $compile; then
9760 val="$define";
9761else
9762 val="$undef";
9763fi;
9764set $varname;
9765eval $setvar;
9766$rm -f try.c try.o'
9767
9768: see if we should include time.h, sys/time.h, or both
9769echo " "
9770if test "X$timeincl" = X; then
9771 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9772 $echo $n "I'm now running the test program...$c"
55954f19 9773 $cat >try.c <<EOCP
10bc17b6
JH
9774#include <sys/types.h>
9775#ifdef I_TIME
9776#include <time.h>
9777#endif
9778#ifdef I_SYSTIME
9779#ifdef SYSTIMEKERNEL
9780#define KERNEL
9781#endif
9782#include <sys/time.h>
9783#endif
9784#ifdef I_SYSSELECT
9785#include <sys/select.h>
9786#endif
55954f19
JH
9787#$i_stdlib I_STDLIB
9788#ifdef I_STDLIB
9789#include <stdlib.h>
9790#endif
10bc17b6
JH
9791int main()
9792{
9793 struct tm foo;
9794#ifdef S_TIMEVAL
9795 struct timeval bar;
9796#endif
9797#ifdef S_TIMEZONE
9798 struct timezone tzp;
9799#endif
9800 if (foo.tm_sec == foo.tm_sec)
9801 exit(0);
9802#ifdef S_TIMEVAL
9803 if (bar.tv_sec == bar.tv_sec)
9804 exit(0);
9805#endif
9806 exit(1);
9807}
9808EOCP
9809 flags=''
9810 for s_timezone in '-DS_TIMEZONE' ''; do
9811 sysselect=''
9812 for s_timeval in '-DS_TIMEVAL' ''; do
9813 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9814 for i_time in '' '-DI_TIME'; do
9815 for i_systime in '-DI_SYSTIME' ''; do
9816 case "$flags" in
9817 '') $echo $n ".$c"
9818 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9819 if eval $compile; then
9820 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9821 shift
9822 flags="$*"
9823 echo " "
9824 $echo $n "Succeeded with $flags$c"
9825 fi
9826 ;;
9827 esac
9828 done
9829 done
9830 done
9831 done
9832 done
9833 timeincl=''
9834 echo " "
9835 case "$flags" in
9836 *SYSTIMEKERNEL*) i_systimek="$define"
9837 timeincl=`./findhdr sys/time.h`
9838 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9839 *) i_systimek="$undef";;
9840 esac
9841 case "$flags" in
9842 *I_TIME*) i_time="$define"
9843 timeincl=`./findhdr time.h`" $timeincl"
9844 echo "We'll include <time.h>." >&4;;
9845 *) i_time="$undef";;
9846 esac
9847 case "$flags" in
9848 *I_SYSTIME*) i_systime="$define"
9849 timeincl=`./findhdr sys/time.h`" $timeincl"
9850 echo "We'll include <sys/time.h>." >&4;;
9851 *) i_systime="$undef";;
9852 esac
9853 $rm -f try.c try
9854fi
9855: see if struct tm knows about tm_zone
9856case "$i_systime$i_time" in
9857*$define*)
9858 echo " "
9859 echo "Checking to see if your struct tm has tm_zone field..." >&4
9860 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9861 eval $hasfield
9862 ;;
9863*) val="$undef"
9864 set d_tm_tm_zone
9865 eval $setvar
9866 ;;
9867esac
9868case "$d_tm_tm_zone" in
9869"$define") echo "Yes, it does." ;;
9870*) echo "No, it doesn't." ;;
9871esac
9872: see if struct tm knows about tm_gmtoff
9873case "$i_systime$i_time" in
9874*$define*)
9875 echo " "
9876 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9877 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9878 eval $hasfield
9879 ;;
9880*) val="$undef"
9881 set d_tm_tm_gmtoff
9882 eval $setvar
9883 ;;
9884esac
9885case "$d_tm_tm_gmtoff" in
9886"$define") echo "Yes, it does." ;;
9887*) echo "No, it doesn't." ;;
9888esac
9889
9890: see if asctime_r exists
9891set asctime_r d_asctime_r
9892eval $inlibc
9893case "$d_asctime_r" in
9894"$define")
d63eadf0 9895 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
9896 case "$d_asctime_r_proto:$usethreads" in
9897 ":define") d_asctime_r_proto=define
a48ec845
JH
9898 set d_asctime_r_proto asctime_r $hdrs
9899 eval $hasproto ;;
9900 *) ;;
9901 esac
9902 case "$d_asctime_r_proto" in
9903 define)
10bc17b6
JH
9904 case "$asctime_r_proto" in
9905 ''|0) try='char* asctime_r(const struct tm*, char*);'
9906 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9907 esac
9908 case "$asctime_r_proto" in
9909 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9910 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9911 esac
9912 case "$asctime_r_proto" in
9913 ''|0) try='int asctime_r(const struct tm*, char*);'
9914 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9915 esac
9916 case "$asctime_r_proto" in
9917 ''|0) try='int asctime_r(const struct tm*, char*, int);'
9918 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9919 esac
9920 case "$asctime_r_proto" in
90e831dc 9921 ''|0) d_asctime_r=undef
10bc17b6 9922 asctime_r_proto=0
a48ec845 9923 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
9924 * ) case "$asctime_r_proto" in
9925 REENTRANT_PROTO*) ;;
9926 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9927 esac
9928 echo "Prototype: $try" ;;
9929 esac
9930 ;;
c18e646a
JH
9931 *) case "$usethreads" in
9932 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9933 esac
90e831dc
SB
9934 d_asctime_r=undef
9935 asctime_r_proto=0
c18e646a 9936 ;;
a48ec845
JH
9937 esac
9938 ;;
10bc17b6
JH
9939*) asctime_r_proto=0
9940 ;;
9941esac
9942
b4eb6b3d
JH
9943: see if atolf exists
9944set atolf d_atolf
9945eval $inlibc
9946
9947: see if atoll exists
9948set atoll d_atoll
9949eval $inlibc
9950
0dbb1585
AL
9951: Look for GCC-style attribute format
9952case "$d_attribute_format" in
bde30f85 9953'')
b4eb6b3d 9954echo " "
0dbb1585 9955echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
b4eb6b3d
JH
9956$cat >attrib.c <<'EOCP'
9957#include <stdio.h>
0dbb1585 9958void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
b4eb6b3d
JH
9959EOCP
9960if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9961 if $contains 'warning' attrib.out >/dev/null 2>&1; then
0dbb1585 9962 echo "Your C compiler doesn't support __attribute__((format))."
b4eb6b3d
JH
9963 val="$undef"
9964 else
0dbb1585 9965 echo "Your C compiler supports __attribute__((format))."
b4eb6b3d
JH
9966 val="$define"
9967 fi
9968else
9969 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9970 val="$undef"
9971fi
bde30f85 9972;;
0dbb1585 9973*) val="$d_attribute_format" ;;
bde30f85 9974esac
0dbb1585
AL
9975set d_attribute_format
9976eval $setvar
9977$rm -f attrib*
9978
9979: Look for GCC-style attribute malloc
9980case "$d_attribute_malloc" in
9981'')
9982echo " "
9983echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9984$cat >attrib.c <<'EOCP'
9985#include <stdio.h>
9986char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9987EOCP
9988if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9989 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9990 echo "Your C compiler doesn't support __attribute__((malloc))."
9991 val="$undef"
9992 else
9993 echo "Your C compiler supports __attribute__((malloc))."
9994 val="$define"
9995 fi
9996else
9997 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9998 val="$undef"
9999fi
10000;;
10001*) val="$d_attribute_malloc" ;;
10002esac
10003set d_attribute_malloc
10004eval $setvar
10005$rm -f attrib*
10006
10007: Look for GCC-style attribute nonnull
10008case "$d_attribute_nonnull" in
10009'')
10010echo " "
10011echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10012$cat >attrib.c <<'EOCP'
10013#include <stdio.h>
10014void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10015EOCP
10016if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10017 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10018 echo "Your C compiler doesn't support __attribute__((nonnull))."
10019 val="$undef"
10020 else
10021 echo "Your C compiler supports __attribute__((nonnull))."
10022 val="$define"
10023 fi
10024else
10025 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10026 val="$undef"
10027fi
10028;;
10029*) val="$d_attribute_nonnull" ;;
10030esac
10031set d_attribute_nonnull
10032eval $setvar
10033$rm -f attrib*
10034
10035: Look for GCC-style attribute noreturn
10036case "$d_attribute_noreturn" in
10037'')
10038echo " "
10039echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10040$cat >attrib.c <<'EOCP'
10041#include <stdio.h>
10042void fall_over_dead( void ) __attribute__((noreturn));
10043EOCP
10044if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10045 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10046 echo "Your C compiler doesn't support __attribute__((noreturn))."
10047 val="$undef"
10048 else
10049 echo "Your C compiler supports __attribute__((noreturn))."
10050 val="$define"
10051 fi
10052else
10053 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10054 val="$undef"
10055fi
10056;;
10057*) val="$d_attribute_noreturn" ;;
10058esac
10059set d_attribute_noreturn
10060eval $setvar
10061$rm -f attrib*
10062
10063: Look for GCC-style attribute pure
10064case "$d_attribute_pure" in
10065'')
10066echo " "
10067echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10068$cat >attrib.c <<'EOCP'
10069#include <stdio.h>
10070int square( int n ) __attribute__((pure));
10071EOCP
10072if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10073 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10074 echo "Your C compiler doesn't support __attribute__((pure))."
10075 val="$undef"
10076 else
10077 echo "Your C compiler supports __attribute__((pure))."
10078 val="$define"
10079 fi
10080else
10081 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10082 val="$undef"
10083fi
10084;;
10085*) val="$d_attribute_pure" ;;
10086esac
10087set d_attribute_pure
10088eval $setvar
10089$rm -f attrib*
10090
10091: Look for GCC-style attribute unused
10092case "$d_attribute_unused" in
10093'')
10094echo " "
10095echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10096$cat >attrib.c <<'EOCP'
10097#include <stdio.h>
10098int do_something( int dummy __attribute__((unused)), int n );
10099EOCP
10100if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10101 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10102 echo "Your C compiler doesn't support __attribute__((unused))."
10103 val="$undef"
10104 else
10105 echo "Your C compiler supports __attribute__((unused))."
10106 val="$define"
10107 fi
10108else
10109 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10110 val="$undef"
10111fi
10112;;
10113*) val="$d_attribute_unused" ;;
10114esac
10115set d_attribute_unused
10116eval $setvar
10117$rm -f attrib*
10118
10119: Look for GCC-style attribute warn_unused_result
10120case "$d_attribute_warn_unused_result" in
10121'')
10122echo " "
10123echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10124$cat >attrib.c <<'EOCP'
10125#include <stdio.h>
10126int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10127EOCP
10128if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10129 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10130 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10131 val="$undef"
10132 else
10133 echo "Your C compiler supports __attribute__((warn_unused_result))."
10134 val="$define"
10135 fi
10136else
10137 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10138 val="$undef"
10139fi
10140;;
10141*) val="$d_attribute_warn_unused_result" ;;
10142esac
10143set d_attribute_warn_unused_result
b4eb6b3d
JH
10144eval $setvar
10145$rm -f attrib*
10146
10147: see if bcmp exists
10148set bcmp d_bcmp
10149eval $inlibc
10150
10151: see if bcopy exists
10152set bcopy d_bcopy
10153eval $inlibc
10154
b4eb6b3d
JH
10155: see if getpgrp exists
10156set getpgrp d_getpgrp
10157eval $inlibc
10158
10159case "$d_getpgrp" in
10160"$define")
10161 echo " "
10162 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 10163 $cat >try.c <<EOP
b4eb6b3d
JH
10164#$i_unistd I_UNISTD
10165#include <sys/types.h>
10166#ifdef I_UNISTD
10167# include <unistd.h>
10168#endif
55954f19
JH
10169#$i_stdlib I_STDLIB
10170#ifdef I_STDLIB
10171#include <stdlib.h>
10172#endif
b4eb6b3d
JH
10173int main()
10174{
10175 if (getuid() == 0) {
10176 printf("(I see you are running Configure as super-user...)\n");
10177 setuid(1);
10178 }
10179#ifdef TRY_BSD_PGRP
10180 if (getpgrp(1) == 0)
10181 exit(0);
10182#else
10183 if (getpgrp() > 0)
10184 exit(0);
10185#endif
10186 exit(1);
10187}
10188EOP
5440bc8e 10189 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10190 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10191 val="$define"
5440bc8e 10192 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10193 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10194 val="$undef"
10195 else
10196 echo "I can't seem to compile and run the test program."
10197 if ./usg; then
10198 xxx="a USG one, i.e. you use getpgrp()."
10199 else
10200 # SVR4 systems can appear rather BSD-ish.
10201 case "$i_unistd" in
10202 $undef)
10203 xxx="a BSD one, i.e. you use getpgrp(pid)."
10204 val="$define"
10205 ;;
10206 $define)
10207 xxx="probably a USG one, i.e. you use getpgrp()."
10208 val="$undef"
10209 ;;
10210 esac
10211 fi
10212 echo "Assuming your getpgrp is $xxx" >&4
10213 fi
10214 ;;
10215*) val="$undef";;
10216esac
10217set d_bsdgetpgrp
10218eval $setvar
5440bc8e 10219$rm -f try try.*
b4eb6b3d
JH
10220
10221: see if setpgrp exists
10222set setpgrp d_setpgrp
10223eval $inlibc
10224
10225case "$d_setpgrp" in
10226"$define")
10227 echo " "
10228 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 10229 $cat >try.c <<EOP
b4eb6b3d
JH
10230#$i_unistd I_UNISTD
10231#include <sys/types.h>
10232#ifdef I_UNISTD
10233# include <unistd.h>
10234#endif
55954f19
JH
10235#$i_stdlib I_STDLIB
10236#ifdef I_STDLIB
10237#include <stdlib.h>
10238#endif
b4eb6b3d
JH
10239int main()
10240{
10241 if (getuid() == 0) {
10242 printf("(I see you are running Configure as super-user...)\n");
10243 setuid(1);
10244 }
10245#ifdef TRY_BSD_PGRP
10246 if (-1 == setpgrp(1, 1))
10247 exit(0);
10248#else
10249 if (setpgrp() != -1)
10250 exit(0);
10251#endif
10252 exit(1);
10253}
10254EOP
5440bc8e 10255 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10256 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10257 val="$define"
5440bc8e 10258 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10259 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10260 val="$undef"
10261 else
10262 echo "(I can't seem to compile and run the test program.)"
10263 if ./usg; then
10264 xxx="a USG one, i.e. you use setpgrp()."
10265 else
10266 # SVR4 systems can appear rather BSD-ish.
10267 case "$i_unistd" in
10268 $undef)
10269 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10270 val="$define"
10271 ;;
10272 $define)
10273 xxx="probably a USG one, i.e. you use setpgrp()."
10274 val="$undef"
10275 ;;
10276 esac
10277 fi
10278 echo "Assuming your setpgrp is $xxx" >&4
10279 fi
10280 ;;
10281*) val="$undef";;
10282esac
10283set d_bsdsetpgrp
10284eval $setvar
5440bc8e 10285$rm -f try try.*
635aebb7
AL
10286: Look for GCC-style __builtin_choose_expr
10287case "$d_builtin_choose_expr" in
10288'')
10289 echo " "
10290 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10291 $cat >try.c <<'EOCP'
10292#include <assert.h>
10293#include <stdlib.h>
10294#include <stdio.h>
10295
10296#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10297
10298int main(void) {
10299 assert( SYRINX(1) == 2112 );
10300 assert( SYRINX(1) != 5150 );
10301 assert( SYRINX(0) == 5150 );
10302 assert( SYRINX(0) != 2112 );
10303 puts( "All good!" );
10304 exit(0);
10305}
10306
10307EOCP
10308 set try
10309 if eval $compile; then
10310 echo "Your C compiler supports __builtin_choose_expr."
10311 val="$define"
10312 else
10313 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10314 val="$undef"
10315 fi
10316;;
10317*) val="$d_builtin_choose_expr" ;;
10318esac
10319
10320set d_builtin_choose_expr
10321eval $setvar
10322$rm -f try.* try core core.try.*
10323
10324: Look for GCC-style __builtin_expect
10325case "$d_builtin_expect" in
10326'')
10327 echo " "
10328 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10329 $cat >builtin.c <<'EOCP'
10330int main(void) {
10331 int n = 50;
10332 if ( __builtin_expect(n, 0) ) n = 1;
10333}
10334EOCP
10335 set try
10336 if eval $compile; then
10337 echo "Your C compiler supports __builtin_choose_expr."
10338 val="$define"
10339 else
10340 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10341 val="$undef"
10342 fi
10343 ;;
10344*) val="$d_builtin_expect" ;;
10345esac
10346
10347set d_builtin_expect
10348eval $setvar
10349$rm -f try.* try core core.try.*
10350
b4eb6b3d
JH
10351: see if bzero exists
10352set bzero d_bzero
10353eval $inlibc
10354
a2d23ec2
MB
10355: see if stdarg is available
10356echo " "
10357if $test `./findhdr stdarg.h`; then
10358 echo "<stdarg.h> found." >&4
10359 valstd="$define"
10360else
10361 echo "<stdarg.h> NOT found." >&4
10362 valstd="$undef"
10363fi
10364
10365: see if varags is available
10366echo " "
10367if $test `./findhdr varargs.h`; then
10368 echo "<varargs.h> found." >&4
10369else
10370 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10371fi
10372
10373: set up the varargs testing programs
10374$cat > varargs.c <<EOP
10375#ifdef I_STDARG
10376#include <stdarg.h>
10377#endif
10378#ifdef I_VARARGS
10379#include <varargs.h>
10380#endif
10381
10382#ifdef I_STDARG
10383int f(char *p, ...)
10384#else
10385int f(va_alist)
10386va_dcl
10387#endif
10388{
10389 va_list ap;
10390#ifndef I_STDARG
10391 char *p;
10392#endif
10393#ifdef I_STDARG
10394 va_start(ap,p);
10395#else
10396 va_start(ap);
10397 p = va_arg(ap, char *);
10398#endif
10399 va_end(ap);
4fb7dc7d 10400 return 0;
a2d23ec2
MB
10401}
10402EOP
10403$cat > varargs <<EOP
10404$startsh
10405if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10406 echo "true"
10407else
10408 echo "false"
10409fi
10410$rm -f varargs$_o
10411EOP
10412chmod +x varargs
10413
10414: now check which varargs header should be included
10415echo " "
10416i_varhdr=''
10417case "$valstd" in
10418"$define")
10419 if `./varargs I_STDARG`; then
10420 val='stdarg.h'
10421 elif `./varargs I_VARARGS`; then
10422 val='varargs.h'
10423 fi
10424 ;;
10425*)
10426 if `./varargs I_VARARGS`; then
10427 val='varargs.h'
10428 fi
10429 ;;
10430esac
10431case "$val" in
10432'')
10433echo "I could not find the definition for va_dcl... You have problems..." >&4
10434 val="$undef"; set i_stdarg; eval $setvar
10435 val="$undef"; set i_varargs; eval $setvar
10436 ;;
10437*)
10438 set i_varhdr
10439 eval $setvar
10440 case "$i_varhdr" in
10441 stdarg.h)
10442 val="$define"; set i_stdarg; eval $setvar
10443 val="$undef"; set i_varargs; eval $setvar
10444 ;;
10445 varargs.h)
10446 val="$undef"; set i_stdarg; eval $setvar
10447 val="$define"; set i_varargs; eval $setvar
10448 ;;
10449 esac
10450 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10451esac
10452$rm -f varargs*
10453
10454: see if the Compiler supports C99 variadic macros
10455case "$i_stdarg$i_stdlib" in
10456 "$define$define")
10457 echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10458 $cat >try.c <<EOCP
10459#include <stdio.h>
10460#include <stdarg.h>
10461
10462#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10463
10464int main() {
10465 char buf[20];
10466 foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10467 puts(buf);
10468 return 0;
10469}
10470EOCP
10471 set try
10472 if eval $compile && $run ./try 2>&1 >/dev/null; then
10473 case "`$run ./try`" in
10474 "123 456 789")
10475 echo "You have C99 variadic macros." >&4
10476 d_c99_variadic_macros="$define"
10477 ;;
10478 *)
10479 echo "You don't have functional C99 variadic macros." >&4
10480 d_c99_variadic_macros="$undef"
10481 ;;
10482 esac
10483 else
10484 echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10485 d_c99_variadic_macros="$undef"
10486 fi
10487 $rm -f try.* try core core.try.*
10488 ;;
10489 *)
10490 echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10491 d_c99_variadic_macros="$undef"
10492 ;;
10493esac
10494
b4eb6b3d
JH
10495: see if signal is declared as pointer to function returning int or void
10496echo " "
10497xxx=`./findhdr signal.h`
10498$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10499if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10500 echo "You have int (*signal())() instead of void." >&4
10501 val="$undef"
10502elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10503 echo "You have void (*signal())()." >&4
10504 val="$define"
10505elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10506 echo "You have int (*signal())() instead of void." >&4
10507 val="$undef"
10508elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10509 echo "You have void (*signal())()." >&4
10510 val="$define"
10511else
10512 case "$d_voidsig" in
10513 '')
10514 echo "I can't determine whether signal handler returns void or int..." >&4
10515 dflt=void
10516 rp="What type does your signal handler return?"
10517 . ./myread
10518 case "$ans" in
10519 v*) val="$define";;
10520 *) val="$undef";;
10521 esac;;
10522 "$define")
10523 echo "As you already told me, signal handler returns void." >&4
10524 val="$define"
10525 ;;
10526 *) echo "As you already told me, signal handler returns int." >&4
10527 val="$undef"
10528 ;;
10529 esac
10530fi
10531set d_voidsig
10532eval $setvar
10533case "$d_voidsig" in
10534"$define") signal_t="void";;
10535*) signal_t="int";;
10536esac
10537$rm -f $$.tmp
10538
10539: check for ability to cast large floats to 32-bit ints.
10540echo " "
10541echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10542if $test "$intsize" -ge 4; then
10543 xxx=int
10544else
10545 xxx=long
10546fi
10547$cat >try.c <<EOCP
10548#include <stdio.h>
d1daaddf
JH
10549#$i_stdlib I_STDLIB
10550#ifdef I_STDLIB
10551#include <stdlib.h>
10552#endif
b4eb6b3d
JH
10553#include <sys/types.h>
10554#include <signal.h>
7090f861 10555$signal_t blech(int s) { exit(3); }
b4eb6b3d
JH
10556int main()
10557{
10558 $xxx i32;
10559 double f, g;
10560 int result = 0;
10561 char str[16];
10562 signal(SIGFPE, blech);
10563
10564 /* Don't let compiler optimize the test away. Store the number
10565 in a writable string for gcc to pass to sscanf under HP/UX.
10566 */
10567 sprintf(str, "2147483647");
10568 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10569 g = 10 * f;
10570 i32 = ($xxx) g;
10571
10572 /* x86 processors will probably give 0x8000 0000, which is a
4a39fcde 10573 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
10574 behavior here, which is to preserve the sign and give
10575 back 0x7fff ffff.
10576 */
10577 if (i32 != ($xxx) f)
10578 result |= 1;
10579 exit(result);
10580}
10581EOCP
10582set try
10583if eval $compile_ok; then
5440bc8e 10584 $run ./try
b4eb6b3d
JH
10585 yyy=$?
10586else
10587 echo "(I can't seem to compile the test program--assuming it can't)"
10588 yyy=1
10589fi
10590case "$yyy" in
105910) val="$define"
10592 echo "Yup, it can."
10593 ;;
10594*) val="$undef"
10595 echo "Nope, it can't."
10596 ;;
10597esac
10598set d_casti32
10599eval $setvar
10600$rm -f try try.*
10601
10602: check for ability to cast negative floats to unsigned
10603echo " "
10604echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10605$cat >try.c <<EOCP
10606#include <stdio.h>
d1daaddf
JH
10607#$i_stdlib I_STDLIB
10608#ifdef I_STDLIB
10609#include <stdlib.h>
10610#endif
b4eb6b3d
JH
10611#include <sys/types.h>
10612#include <signal.h>
7090f861
JH
10613$signal_t blech(int s) { exit(7); }
10614$signal_t blech_in_list(int s) { exit(4); }
10615unsigned long dummy_long(unsigned long p) { return p; }
10616unsigned int dummy_int(unsigned int p) { return p; }
10617unsigned short dummy_short(unsigned short p) { return p; }
b4eb6b3d
JH
10618int main()
10619{
10620 double f;
10621 unsigned long along;
10622 unsigned int aint;
10623 unsigned short ashort;
10624 int result = 0;
10625 char str[16];
10626
10627 /* Frustrate gcc-2.7.2's optimizer which failed this test with
10628 a direct f = -123. assignment. gcc-2.8.0 reportedly
10629 optimized the whole file away
10630 */
10631 /* Store the number in a writable string for gcc to pass to
10632 sscanf under HP/UX.
10633 */
10634 sprintf(str, "-123");
10635 sscanf(str, "%lf", &f); /* f = -123.; */
10636
10637 signal(SIGFPE, blech);
10638 along = (unsigned long)f;
10639 aint = (unsigned int)f;
10640 ashort = (unsigned short)f;
10641 if (along != (unsigned long)-123)
10642 result |= 1;
10643 if (aint != (unsigned int)-123)
10644 result |= 1;
10645 if (ashort != (unsigned short)-123)
10646 result |= 1;
10647 sprintf(str, "1073741824.");
10648 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10649 f = f + f;
10650 along = 0;
10651 along = (unsigned long)f;
10652 if (along != 0x80000000)
10653 result |= 2;
10654 f -= 1.;
10655 along = 0;
10656 along = (unsigned long)f;
10657 if (along != 0x7fffffff)
10658 result |= 1;
10659 f += 2.;
10660 along = 0;
10661 along = (unsigned long)f;
10662 if (along != 0x80000001)
10663 result |= 2;
10664 if (result)
10665 exit(result);
10666 signal(SIGFPE, blech_in_list);
10667 sprintf(str, "123.");
10668 sscanf(str, "%lf", &f); /* f = 123.; */
10669 along = dummy_long((unsigned long)f);
10670 aint = dummy_int((unsigned int)f);
10671 ashort = dummy_short((unsigned short)f);
10672 if (along != (unsigned long)123)
10673 result |= 4;
10674 if (aint != (unsigned int)123)
10675 result |= 4;
10676 if (ashort != (unsigned short)123)
10677 result |= 4;
10678 exit(result);
10679
10680}
10681EOCP
10682set try
10683if eval $compile_ok; then
5440bc8e 10684 $run ./try
b4eb6b3d
JH
10685 castflags=$?
10686else
10687 echo "(I can't seem to compile the test program--assuming it can't)"
10688 castflags=7
10689fi
10690case "$castflags" in
106910) val="$define"
10692 echo "Yup, it can."
10693 ;;
10694*) val="$undef"
10695 echo "Nope, it can't."
10696 ;;
10697esac
10698set d_castneg
10699eval $setvar
10700$rm -f try.*
10701
10702: see if vprintf exists
10703echo " "
10704if set vprintf val -f d_vprintf; eval $csym; $val; then
10705 echo 'vprintf() found.' >&4
10706 val="$define"
55954f19 10707 $cat >try.c <<EOF
b4eb6b3d 10708#include <varargs.h>
55954f19
JH
10709#$i_stdlib I_STDLIB
10710#ifdef I_STDLIB
10711#include <stdlib.h>
10712#endif
b4eb6b3d
JH
10713
10714int main() { xxx("foo"); }
10715
10716xxx(va_alist)
10717va_dcl
10718{
10719 va_list args;
10720 char buf[10];
10721
10722 va_start(args);
10723 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10724}
10725EOF
5440bc8e
JH
10726 set try
10727 if eval $compile && $run ./try; then
b4eb6b3d
JH
10728 echo "Your vsprintf() returns (int)." >&4
10729 val2="$undef"
10730 else
10731 echo "Your vsprintf() returns (char*)." >&4
10732 val2="$define"
10733 fi
10734else
10735 echo 'vprintf() NOT found.' >&4
10736 val="$undef"
10737 val2="$undef"
10738fi
5440bc8e 10739$rm -f try try.*
b4eb6b3d
JH
10740set d_vprintf
10741eval $setvar
10742val=$val2
10743set d_charvspr
10744eval $setvar
10745
10746: see if chown exists
10747set chown d_chown
10748eval $inlibc
10749
10750: see if chroot exists
10751set chroot d_chroot
10752eval $inlibc
10753
10754: see if chsize exists
10755set chsize d_chsize
10756eval $inlibc
10757
758a5d79
JH
10758: see if class exists
10759set class d_class
10760eval $inlibc
10761
b0a2e8e6
MB
10762: see if clearenv exists
10763set clearenv d_clearenv
10764eval $inlibc
10765
4e0554ec
JH
10766hasstruct='varname=$1; struct=$2; shift; shift;
10767while $test $# -ge 2; do
10768 case "$1" in
10769 $define) echo "#include <$2>";;
10770 esac ;
10771 shift 2;
10772done > try.c;
10773echo "int main () { struct $struct foo; }" >> try.c;
10774set try;
10775if eval $compile; then
10776 val="$define";
10777else
10778 val="$undef";
10779fi;
10780set $varname;
10781eval $setvar;
10782$rm -f try.c try.o'
10783
4e0554ec
JH
10784socketlib=''
10785sockethdr=''
10786: see whether socket exists
10787echo " "
10788$echo $n "Hmm... $c" >&4
10789if set socket val -f d_socket; eval $csym; $val; then
10790 echo "Looks like you have Berkeley networking support." >&4
10791 d_socket="$define"
10792 if set setsockopt val -f; eval $csym; $val; then
10793 d_oldsock="$undef"
10794 else
10795 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10796 d_oldsock="$define"
10797 fi
10798else
10799 if $contains socklib libc.list >/dev/null 2>&1; then
10800 echo "Looks like you have Berkeley networking support." >&4
10801 d_socket="$define"
10802 : we will have to assume that it supports the 4.2 BSD interface
10803 d_oldsock="$undef"
10804 else
10805 echo "You don't have Berkeley networking in libc$_a..." >&4
10806 if test "X$d_socket" = "X$define"; then
10807 echo "...but you seem to believe that you have sockets." >&4
10808 else
10809 for net in net socket
10810 do
10811 if test -f /usr/lib/lib$net$_a; then
10812 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
10813 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10814 if $contains socket libc.list >/dev/null 2>&1; then
10815 d_socket="$define"
10816 socketlib="-l$net"
10817 case "$net" in
10818 net)
10819 echo "...but the Wollongong group seems to have hacked it in." >&4
10820 sockethdr="-I/usr/netinclude"
10821 ;;
10822 esac
3c728e00 10823 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
10824 if $contains setsockopt libc.list >/dev/null 2>&1; then
10825 d_oldsock="$undef"
10826 else
10827 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10828 d_oldsock="$define"
10829 fi
10830 break
10831 fi
10832 fi
10833 done
10834 if test "X$d_socket" != "X$define"; then
10835 echo "or anywhere else I see." >&4
10836 d_socket="$undef"
10837 d_oldsock="$undef"
10838 fi
10839 fi
10840 fi
10841fi
10842
10843: see if socketpair exists
10844set socketpair d_sockpair
10845eval $inlibc
10846
10847
10848echo " "
3c728e00 10849echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
10850for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10851 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10852 $cat >try.c <<EOF
10853#include <sys/types.h>
10854#include <sys/socket.h>
10855int main() {
10856 int i = $ENUM;
10857}
10858EOF
10859 val="$undef"
10860 set try; if eval $compile; then
10861 val="$define"
10862 fi
10863 set d_${enum}; eval $setvar
10864 $rm -f try.c try
10865done
10866
10867: see if this is a sys/uio.h system
10868set sys/uio.h i_sysuio
10869eval $inhdr
10870
10871
10872echo " "
10873echo "Checking to see if your system supports struct cmsghdr..." >&4
10874set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10875eval $hasstruct
10876case "$d_cmsghdr_s" in
10877"$define") echo "Yes, it does." ;;
10878*) echo "No, it doesn't." ;;
10879esac
10880
10881
b4eb6b3d
JH
10882: check for const keyword
10883echo " "
10884echo 'Checking to see if your C compiler knows about "const"...' >&4
10885$cat >const.c <<'EOCP'
10886typedef struct spug { int drokk; } spug;
76f47787 10887int main()
b4eb6b3d
JH
10888{
10889 const char *foo;
666ea192 10890 const spug y = { 0 };
b4eb6b3d
JH
10891}
10892EOCP
10893if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10894 val="$define"
10895 echo "Yup, it does."
10896else
10897 val="$undef"
10898 echo "Nope, it doesn't."
10899fi
10900set d_const
10901eval $setvar
10902
89ce900e
JH
10903: see if copysignl exists
10904set copysignl d_copysignl
10905eval $inlibc
10906
b4eb6b3d
JH
10907: see if crypt exists
10908echo " "
a5a94ea5
JH
10909set crypt d_crypt
10910eval $inlibc
10911case "$d_crypt" in
10912$define) cryptlib='' ;;
10913*) if set crypt val -f d_crypt; eval $csym; $val; then
10914 echo 'crypt() found.' >&4
b4eb6b3d 10915 val="$define"
a5a94ea5
JH
10916 cryptlib=''
10917 else
10918 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10919 if $test -z "$cryptlib"; then
10920 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10921 else
10922 cryptlib=-lcrypt
10923 fi
10924 if $test -z "$cryptlib"; then
10925 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10926 else
10927 cryptlib=-lcrypt
10928 fi
10929 if $test -z "$cryptlib"; then
10930 cryptlib=`./loc libcrypt$_a "" $libpth`
10931 else
10932 cryptlib=-lcrypt
10933 fi
10934 if $test -z "$cryptlib"; then
10935 echo 'crypt() NOT found.' >&4
10936 val="$undef"
10937 else
10938 val="$define"
10939 fi
b4eb6b3d 10940 fi
a5a94ea5
JH
10941 set d_crypt
10942 eval $setvar
10943 ;;
10944esac
b4eb6b3d 10945
10bc17b6
JH
10946: see if this is a crypt.h system
10947set crypt.h i_crypt
10948eval $inhdr
10949
10950: see if crypt_r exists
10951set crypt_r d_crypt_r
10952eval $inlibc
10953case "$d_crypt_r" in
10954"$define")
10955 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
10956 case "$d_crypt_r_proto:$usethreads" in
10957 ":define") d_crypt_r_proto=define
a48ec845
JH
10958 set d_crypt_r_proto crypt_r $hdrs
10959 eval $hasproto ;;
10960 *) ;;
10961 esac
10962 case "$d_crypt_r_proto" in
10963 define)
10bc17b6
JH
10964 case "$crypt_r_proto" in
10965 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10966 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10967 esac
10968 case "$crypt_r_proto" in
b430fd04
JH
10969 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10970 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10971 esac
10972 case "$crypt_r_proto" in
90e831dc 10973 ''|0) d_crypt_r=undef
10bc17b6 10974 crypt_r_proto=0
a48ec845 10975 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10976 * ) case "$crypt_r_proto" in
10977 REENTRANT_PROTO*) ;;
10978 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10979 esac
10980 echo "Prototype: $try" ;;
10981 esac
10982 ;;
c18e646a
JH
10983 *) case "$usethreads" in
10984 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10985 esac
90e831dc
SB
10986 d_crypt_r=undef
10987 crypt_r_proto=0
c18e646a 10988 ;;
a48ec845
JH
10989 esac
10990 ;;
10bc17b6
JH
10991*) crypt_r_proto=0
10992 ;;
10993esac
10994
b4eb6b3d
JH
10995: get csh whereabouts
10996case "$csh" in
10997'csh') val="$undef" ;;
10998*) val="$define" ;;
10999esac
11000set d_csh
11001eval $setvar
11002: Respect a hint or command line value for full_csh.
11003case "$full_csh" in
11004'') full_csh=$csh ;;
11005esac
11006
13cfc98d
MB
11007: see if ctermid exists
11008set ctermid d_ctermid
11009eval $inlibc
11010
10bc17b6
JH
11011: see if ctermid_r exists
11012set ctermid_r d_ctermid_r
11013eval $inlibc
11014case "$d_ctermid_r" in
11015"$define")
31ee0cb7 11016 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
11017 case "$d_ctermid_r_proto:$usethreads" in
11018 ":define") d_ctermid_r_proto=define
a48ec845
JH
11019 set d_ctermid_r_proto ctermid_r $hdrs
11020 eval $hasproto ;;
11021 *) ;;
11022 esac
11023 case "$d_ctermid_r_proto" in
11024 define)
10bc17b6
JH
11025 case "$ctermid_r_proto" in
11026 ''|0) try='char* ctermid_r(char*);'
11027 ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11028 esac
11029 case "$ctermid_r_proto" in
90e831dc 11030 ''|0) d_ctermid_r=undef
10bc17b6 11031 ctermid_r_proto=0
a48ec845 11032 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11033 * ) case "$ctermid_r_proto" in
11034 REENTRANT_PROTO*) ;;
11035 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11036 esac
11037 echo "Prototype: $try" ;;
11038 esac
11039 ;;
c18e646a
JH
11040 *) case "$usethreads" in
11041 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11042 esac
90e831dc
SB
11043 d_ctermid_r=undef
11044 ctermid_r_proto=0
c18e646a 11045 ;;
a48ec845
JH
11046 esac
11047 ;;
10bc17b6
JH
11048*) ctermid_r_proto=0
11049 ;;
11050esac
11051
11052: see if ctime_r exists
11053set ctime_r d_ctime_r
11054eval $inlibc
11055case "$d_ctime_r" in
11056"$define")
d63eadf0 11057 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
11058 case "$d_ctime_r_proto:$usethreads" in
11059 ":define") d_ctime_r_proto=define
a48ec845
JH
11060 set d_ctime_r_proto ctime_r $hdrs
11061 eval $hasproto ;;
11062 *) ;;
11063 esac
11064 case "$d_ctime_r_proto" in
11065 define)
10bc17b6
JH
11066 case "$ctime_r_proto" in
11067 ''|0) try='char* ctime_r(const time_t*, char*);'
11068 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11069 esac
11070 case "$ctime_r_proto" in
11071 ''|0) try='char* ctime_r(const time_t*, char*, int);'
11072 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11073 esac
11074 case "$ctime_r_proto" in
11075 ''|0) try='int ctime_r(const time_t*, char*);'
11076 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11077 esac
11078 case "$ctime_r_proto" in
11079 ''|0) try='int ctime_r(const time_t*, char*, int);'
11080 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11081 esac
11082 case "$ctime_r_proto" in
90e831dc 11083 ''|0) d_ctime_r=undef
10bc17b6 11084 ctime_r_proto=0
a48ec845 11085 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11086 * ) case "$ctime_r_proto" in
11087 REENTRANT_PROTO*) ;;
11088 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11089 esac
11090 echo "Prototype: $try" ;;
11091 esac
11092 ;;
c18e646a
JH
11093 *) case "$usethreads" in
11094 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11095 esac
90e831dc
SB
11096 d_ctime_r=undef
11097 ctime_r_proto=0
c18e646a 11098 ;;
a48ec845
JH
11099 esac
11100 ;;
10bc17b6
JH
11101*) ctime_r_proto=0
11102 ;;
11103esac
11104
b4eb6b3d
JH
11105: see if cuserid exists
11106set cuserid d_cuserid
11107eval $inlibc
11108
11109: see if this is a limits.h system
11110set limits.h i_limits
11111eval $inhdr
11112
11113: see if this is a float.h system
11114set float.h i_float
11115eval $inhdr
11116
11117: See if number of significant digits in a double precision number is known
11118echo " "
11119$cat >dbl_dig.c <<EOM
11120#$i_limits I_LIMITS
11121#$i_float I_FLOAT
11122#ifdef I_LIMITS
11123#include <limits.h>
11124#endif
11125#ifdef I_FLOAT
11126#include <float.h>
11127#endif
11128#ifdef DBL_DIG
11129printf("Contains DBL_DIG");
11130#endif
11131EOM
11132$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11133if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11134 echo "DBL_DIG found." >&4
11135 val="$define"
11136else
11137 echo "DBL_DIG NOT found." >&4
11138 val="$undef"
11139fi
11140$rm -f dbl_dig.?
11141set d_dbl_dig
11142eval $setvar
11143
2ef53570
JH
11144: see if dbm.h is available
11145: see if dbmclose exists
11146set dbmclose d_dbmclose
11147eval $inlibc
11148
11149case "$d_dbmclose" in
11150$define)
11151 set dbm.h i_dbm
11152 eval $inhdr
11153 case "$i_dbm" in
11154 $define)
11155 val="$undef"
11156 set i_rpcsvcdbm
11157 eval $setvar
11158 ;;
11159 *) set rpcsvc/dbm.h i_rpcsvcdbm
11160 eval $inhdr
11161 ;;
11162 esac
11163 ;;
11164*) echo "We won't be including <dbm.h>"
11165 val="$undef"
11166 set i_dbm
11167 eval $setvar
11168 val="$undef"
11169 set i_rpcsvcdbm
11170 eval $setvar
11171 ;;
11172esac
11173
11174: see if prototype for dbminit is available
11175echo " "
11176set d_dbminitproto dbminit $i_dbm dbm.h
11177eval $hasproto
11178
b4eb6b3d
JH
11179: see if difftime exists
11180set difftime d_difftime
11181eval $inlibc
11182
11183: see if this is a dirent system
11184echo " "
11185if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11186 val="$define"
11187 echo "<dirent.h> found." >&4
11188else
11189 val="$undef"
11190 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11191 echo "<sys/dir.h> found." >&4
11192 echo " "
11193 else
11194 xinc=`./findhdr sys/ndir.h`
11195 fi
11196 echo "<dirent.h> NOT found." >&4
11197fi
11198set i_dirent
11199eval $setvar
11200
11201: Look for type of directory structure.
11202echo " "
11203$cppstdin $cppflags $cppminus < "$xinc" > try.c
11204
11205case "$direntrytype" in
11206''|' ')
11207 case "$i_dirent" in
11208 $define) guess1='struct dirent' ;;
11209 *) guess1='struct direct' ;;
11210 esac
11211 ;;
11212*) guess1="$direntrytype"
11213 ;;
11214esac
11215
11216case "$guess1" in
11217'struct dirent') guess2='struct direct' ;;
11218*) guess2='struct dirent' ;;
11219esac
11220
11221if $contains "$guess1" try.c >/dev/null 2>&1; then
11222 direntrytype="$guess1"
11223 echo "Your directory entries are $direntrytype." >&4
11224elif $contains "$guess2" try.c >/dev/null 2>&1; then
11225 direntrytype="$guess2"
11226 echo "Your directory entries seem to be $direntrytype." >&4
11227else
11228 echo "I don't recognize your system's directory entries." >&4
11229 rp="What type is used for directory entries on this system?"
11230 dflt="$guess1"
11231 . ./myread
11232 direntrytype="$ans"
11233fi
11234$rm -f try.c
11235
11236
11237: see if the directory entry stores field length
11238echo " "
11239$cppstdin $cppflags $cppminus < "$xinc" > try.c
11240if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11241 echo "Good, your directory entry keeps length information in d_namlen." >&4
11242 val="$define"
11243else
11244 echo "Your directory entry does not know about the d_namlen field." >&4
11245 val="$undef"
11246fi
11247set d_dirnamlen
11248eval $setvar
11249$rm -f try.c
11250
ae0e3d3b
JH
11251: see if this is an sysdir system
11252set sys/dir.h i_sysdir
11253eval $inhdr
11254
11255: see if this is an sysndir system
11256set sys/ndir.h i_sysndir
11257eval $inhdr
11258
11259: Look for dirfd
11260echo " "
11261$cat >dirfd.c <<EOM
11262#include <stdio.h>
55954f19
JH
11263#$i_stdlib I_STDLIB
11264#ifdef I_STDLIB
11265#include <stdlib.h>
11266#endif
ae0e3d3b
JH
11267#$i_dirent I_DIRENT /**/
11268#$i_sysdir I_SYS_DIR /**/
11269#$i_sysndir I_SYS_NDIR /**/
11270#$i_systypes I_SYS_TYPES /**/
11271#if defined(I_SYS_TYPES)
11272#include <sys/types.h>
11273#endif
11274#if defined(I_DIRENT)
11275#include <dirent.h>
11276#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11277#include <sys/dir.h>
11278#endif
11279#else
11280#ifdef I_SYS_NDIR
11281#include <sys/ndir.h>
11282#else
11283#ifdef I_SYS_DIR
11284#ifdef hp9000s500
11285#include <ndir.h> /* may be wrong in the future */
11286#else
11287#include <sys/dir.h>
11288#endif
11289#endif
11290#endif
11291#endif
11292int main() {
11293 DIR *dirp = opendir(".");
11294 if (dirfd(dirp) >= 0)
11295 exit(0);
11296 else
11297 exit(1);
11298}
11299EOM
5cadb3f3 11300val=$undef
ae0e3d3b
JH
11301set dirfd
11302if eval $compile; then
11303 val="$define"
11304fi
11305case "$val" in
11306$define) echo "dirfd() found." >&4 ;;
11307*) echo "dirfd() NOT found." >&4 ;;
11308esac
11309set d_dirfd
11310eval $setvar
11311$rm -f dirfd*
11312
b4eb6b3d
JH
11313: see if dlerror exists
11314xxx_runnm="$runnm"
11315runnm=false
11316set dlerror d_dlerror
11317eval $inlibc
11318runnm="$xxx_runnm"
11319
11320: see if dlfcn is available
11321set dlfcn.h i_dlfcn
11322eval $inhdr
11323
11324case "$usedl" in
11325$define|y|true)
11326 $cat << EOM
11327
11328On a few systems, the dynamically loaded modules that perl generates and uses
11329will need a different extension than shared libs. The default will probably
11330be appropriate.
11331
11332EOM
11333 case "$dlext" in
11334 '') dflt="$so" ;;
11335 *) dflt="$dlext" ;;
11336 esac
11337 rp='What is the extension of dynamically loaded modules'
11338 . ./myread
11339 dlext="$ans"
11340 ;;
11341*)
11342 dlext="none"
11343 ;;
11344esac
11345
11346: Check if dlsym need a leading underscore
11347echo " "
11348val="$undef"
11349
11350case "$dlsrc" in
11351dl_dlopen.xs)
11352 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11353 $cat >dyna.c <<'EOM'
11354fred () { }
11355EOM
11356
11357$cat >fred.c<<EOM
11358
11359#include <stdio.h>
55954f19
JH
11360#$i_stdlib I_STDLIB
11361#ifdef I_STDLIB
11362#include <stdlib.h>
11363#endif
b4eb6b3d
JH
11364#$i_dlfcn I_DLFCN
11365#ifdef I_DLFCN
5440bc8e 11366#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
11367#else
11368#include <sys/types.h>
11369#include <nlist.h>
11370#include <link.h>
11371#endif
11372
11373extern int fred() ;
11374
11375int main()
11376{
11377 void * handle ;
11378 void * symbol ;
11379#ifndef RTLD_LAZY
11380 int mode = 1 ;
11381#else
11382 int mode = RTLD_LAZY ;
11383#endif
11384 handle = dlopen("./dyna.$dlext", mode) ;
11385 if (handle == NULL) {
11386 printf ("1\n") ;
11387 fflush (stdout) ;
11388 exit(0);
11389 }
11390 symbol = dlsym(handle, "fred") ;
11391 if (symbol == NULL) {
11392 /* try putting a leading underscore */
11393 symbol = dlsym(handle, "_fred") ;
11394 if (symbol == NULL) {
11395 printf ("2\n") ;
11396 fflush (stdout) ;
11397 exit(0);
11398 }
11399 printf ("3\n") ;
11400 }
11401 else
11402 printf ("4\n") ;
11403 fflush (stdout) ;
11404 exit(0);
11405}
11406EOM
11407 : Call the object file tmp-dyna.o in case dlext=o.
11408 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11409 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 11410 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
11411 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11412 xxx=`$run ./fred`
b4eb6b3d
JH
11413 case $xxx in
11414 1) echo "Test program failed using dlopen." >&4
11415 echo "Perhaps you should not use dynamic loading." >&4;;
11416 2) echo "Test program failed using dlsym." >&4
11417 echo "Perhaps you should not use dynamic loading." >&4;;
11418 3) echo "dlsym needs a leading underscore" >&4
11419 val="$define" ;;
11420 4) echo "dlsym doesn't need a leading underscore." >&4;;
11421 esac
11422 else
11423 echo "I can't compile and run the test program." >&4
11424 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11425 fi
11426 ;;
11427esac
11428
3c728e00 11429$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
11430
11431set d_dlsymun
11432eval $setvar
11433
10bc17b6
JH
11434: see if drand48_r exists
11435set drand48_r d_drand48_r
11436eval $inlibc
11437case "$d_drand48_r" in
11438"$define")
11439 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
11440 case "$d_drand48_r_proto:$usethreads" in
11441 ":define") d_drand48_r_proto=define
a48ec845
JH
11442 set d_drand48_r_proto drand48_r $hdrs
11443 eval $hasproto ;;
11444 *) ;;
11445 esac
11446 case "$d_drand48_r_proto" in
11447 define)
10bc17b6
JH
11448 case "$drand48_r_proto" in
11449 ''|0) try='int drand48_r(struct drand48_data*, double*);'
11450 ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11451 esac
11452 case "$drand48_r_proto" in
90e831dc 11453 ''|0) d_drand48_r=undef
10bc17b6 11454 drand48_r_proto=0
a48ec845 11455 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11456 * ) case "$drand48_r_proto" in
11457 REENTRANT_PROTO*) ;;
11458 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11459 esac
11460 echo "Prototype: $try" ;;
11461 esac
11462 ;;
c18e646a
JH
11463 *) case "$usethreads" in
11464 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11465 esac
90e831dc
SB
11466 d_drand48_r=undef
11467 drand48_r_proto=0
c18e646a 11468 ;;
a48ec845
JH
11469 esac
11470 ;;
10bc17b6
JH
11471*) drand48_r_proto=0
11472 ;;
11473esac
11474
11475: see if prototype for drand48 is available
11476echo " "
11477set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11478eval $hasproto
11479
b4eb6b3d
JH
11480: see if dup2 exists
11481set dup2 d_dup2
11482eval $inlibc
11483
11484: see if eaccess exists
11485set eaccess d_eaccess
11486eval $inlibc
11487
11488: see if endgrent exists
11489set endgrent d_endgrent
11490eval $inlibc
11491
10bc17b6
JH
11492: see if this is an grp system
11493set grp.h i_grp
11494eval $inhdr
11495
11496case "$i_grp" in
11497$define)
11498 xxx=`./findhdr grp.h`
11499 $cppstdin $cppflags $cppminus < $xxx >$$.h
11500
11501 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11502 val="$define"
11503 else
11504 val="$undef"
11505 fi
11506 set d_grpasswd
11507 eval $setvar
11508
11509 $rm -f $$.h
11510 ;;
11511*)
11512 val="$undef";
11513 set d_grpasswd; eval $setvar
11514 ;;
11515esac
11516
11517: see if endgrent_r exists
11518set endgrent_r d_endgrent_r
11519eval $inlibc
11520case "$d_endgrent_r" in
11521"$define")
11522 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11523 case "$d_endgrent_r_proto:$usethreads" in
11524 ":define") d_endgrent_r_proto=define
a48ec845
JH
11525 set d_endgrent_r_proto endgrent_r $hdrs
11526 eval $hasproto ;;
11527 *) ;;
11528 esac
11529 case "$d_endgrent_r_proto" in
11530 define)
10bc17b6
JH
11531 case "$endgrent_r_proto" in
11532 ''|0) try='int endgrent_r(FILE**);'
11533 ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11534 esac
11535 case "$endgrent_r_proto" in
11536 ''|0) try='void endgrent_r(FILE**);'
11537 ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11538 esac
11539 case "$endgrent_r_proto" in
90e831dc 11540 ''|0) d_endgrent_r=undef
10bc17b6 11541 endgrent_r_proto=0
a48ec845 11542 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11543 * ) case "$endgrent_r_proto" in
11544 REENTRANT_PROTO*) ;;
11545 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11546 esac
11547 echo "Prototype: $try" ;;
11548 esac
11549 ;;
c18e646a
JH
11550 *) case "$usethreads" in
11551 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11552 esac
90e831dc
SB
11553 d_endgrent_r=undef
11554 endgrent_r_proto=0
c18e646a 11555 ;;
a48ec845
JH
11556 esac
11557 ;;
10bc17b6
JH
11558*) endgrent_r_proto=0
11559 ;;
11560esac
11561
b4eb6b3d
JH
11562: see if endhostent exists
11563set endhostent d_endhent
11564eval $inlibc
11565
10bc17b6
JH
11566: see if this is a netdb.h system
11567set netdb.h i_netdb
11568eval $inhdr
11569
11570: see if endhostent_r exists
11571set endhostent_r d_endhostent_r
11572eval $inlibc
11573case "$d_endhostent_r" in
11574"$define")
11575 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11576 case "$d_endhostent_r_proto:$usethreads" in
11577 ":define") d_endhostent_r_proto=define
a48ec845
JH
11578 set d_endhostent_r_proto endhostent_r $hdrs
11579 eval $hasproto ;;
11580 *) ;;
11581 esac
11582 case "$d_endhostent_r_proto" in
11583 define)
10bc17b6
JH
11584 case "$endhostent_r_proto" in
11585 ''|0) try='int endhostent_r(struct hostent_data*);'
31ee0cb7 11586 ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
11587 esac
11588 case "$endhostent_r_proto" in
11589 ''|0) try='void endhostent_r(struct hostent_data*);'
31ee0cb7 11590 ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
11591 esac
11592 case "$endhostent_r_proto" in
90e831dc 11593 ''|0) d_endhostent_r=undef
10bc17b6 11594 endhostent_r_proto=0
a48ec845 11595 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11596 * ) case "$endhostent_r_proto" in
11597 REENTRANT_PROTO*) ;;
11598 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11599 esac
11600 echo "Prototype: $try" ;;
11601 esac
11602 ;;
c18e646a
JH
11603 *) case "$usethreads" in
11604 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11605 esac
90e831dc
SB
11606 d_endhostent_r=undef
11607 endhostent_r_proto=0
c18e646a 11608 ;;
a48ec845
JH
11609 esac
11610 ;;
10bc17b6
JH
11611*) endhostent_r_proto=0
11612 ;;
11613esac
11614
b4eb6b3d
JH
11615: see if endnetent exists
11616set endnetent d_endnent
11617eval $inlibc
11618
10bc17b6
JH
11619: see if endnetent_r exists
11620set endnetent_r d_endnetent_r
11621eval $inlibc
11622case "$d_endnetent_r" in
11623"$define")
11624 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11625 case "$d_endnetent_r_proto:$usethreads" in
11626 ":define") d_endnetent_r_proto=define
a48ec845
JH
11627 set d_endnetent_r_proto endnetent_r $hdrs
11628 eval $hasproto ;;
11629 *) ;;
11630 esac
11631 case "$d_endnetent_r_proto" in
11632 define)
10bc17b6
JH
11633 case "$endnetent_r_proto" in
11634 ''|0) try='int endnetent_r(struct netent_data*);'
31ee0cb7 11635 ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
11636 esac
11637 case "$endnetent_r_proto" in
11638 ''|0) try='void endnetent_r(struct netent_data*);'
31ee0cb7 11639 ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
11640 esac
11641 case "$endnetent_r_proto" in
90e831dc 11642 ''|0) d_endnetent_r=undef
10bc17b6 11643 endnetent_r_proto=0
a48ec845 11644 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11645 * ) case "$endnetent_r_proto" in
11646 REENTRANT_PROTO*) ;;
11647 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11648 esac
11649 echo "Prototype: $try" ;;
11650 esac
11651 ;;
c18e646a
JH
11652 *) case "$usethreads" in
11653 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11654 esac
90e831dc
SB
11655 d_endnetent_r=undef
11656 endnetent_r_proto=0
c18e646a 11657 ;;
a48ec845
JH
11658 esac
11659 ;;
10bc17b6
JH
11660*) endnetent_r_proto=0
11661 ;;
11662esac
11663
b4eb6b3d
JH
11664: see if endprotoent exists
11665set endprotoent d_endpent
11666eval $inlibc
11667
10bc17b6
JH
11668: see if endprotoent_r exists
11669set endprotoent_r d_endprotoent_r
11670eval $inlibc
11671case "$d_endprotoent_r" in
11672"$define")
11673 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11674 case "$d_endprotoent_r_proto:$usethreads" in
11675 ":define") d_endprotoent_r_proto=define
a48ec845
JH
11676 set d_endprotoent_r_proto endprotoent_r $hdrs
11677 eval $hasproto ;;
11678 *) ;;
11679 esac
11680 case "$d_endprotoent_r_proto" in
11681 define)
10bc17b6
JH
11682 case "$endprotoent_r_proto" in
11683 ''|0) try='int endprotoent_r(struct protoent_data*);'
31ee0cb7 11684 ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
11685 esac
11686 case "$endprotoent_r_proto" in
11687 ''|0) try='void endprotoent_r(struct protoent_data*);'
31ee0cb7 11688 ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
11689 esac
11690 case "$endprotoent_r_proto" in
90e831dc 11691 ''|0) d_endprotoent_r=undef
10bc17b6 11692 endprotoent_r_proto=0
a48ec845 11693 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11694 * ) case "$endprotoent_r_proto" in
11695 REENTRANT_PROTO*) ;;
11696 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11697 esac
11698 echo "Prototype: $try" ;;
11699 esac
11700 ;;
c18e646a
JH
11701 *) case "$usethreads" in
11702 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11703 esac
90e831dc
SB
11704 d_endprotoent_r=undef
11705 endprotoent_r_proto=0
c18e646a 11706 ;;
a48ec845
JH
11707 esac
11708 ;;
10bc17b6
JH
11709*) endprotoent_r_proto=0
11710 ;;
11711esac
11712
b4eb6b3d
JH
11713: see if endpwent exists
11714set endpwent d_endpwent
11715eval $inlibc
11716
10bc17b6
JH
11717: see if this is a pwd.h system
11718set pwd.h i_pwd
11719eval $inhdr
11720
11721case "$i_pwd" in
11722$define)
11723 xxx=`./findhdr pwd.h`
11724 $cppstdin $cppflags $cppminus < $xxx >$$.h
11725
11726 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11727 val="$define"
11728 else
11729 val="$undef"
11730 fi
11731 set d_pwquota
11732 eval $setvar
11733
11734 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11735 val="$define"
11736 else
11737 val="$undef"
11738 fi
11739 set d_pwage
11740 eval $setvar
11741
11742 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11743 val="$define"
11744 else
11745 val="$undef"
11746 fi
11747 set d_pwchange
11748 eval $setvar
11749
11750 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11751 val="$define"
11752 else
11753 val="$undef"
11754 fi
11755 set d_pwclass
11756 eval $setvar
11757
11758 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11759 val="$define"
11760 else
11761 val="$undef"
11762 fi
11763 set d_pwexpire
11764 eval $setvar
11765
11766 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11767 val="$define"
11768 else
11769 val="$undef"
11770 fi
11771 set d_pwcomment
11772 eval $setvar
11773
11774 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11775 val="$define"
11776 else
11777 val="$undef"
11778 fi
11779 set d_pwgecos
11780 eval $setvar
11781
11782 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11783 val="$define"
11784 else
11785 val="$undef"
11786 fi
11787 set d_pwpasswd
11788 eval $setvar
11789
11790 $rm -f $$.h
11791 ;;
11792*)
11793 val="$undef";
11794 set d_pwquota; eval $setvar
11795 set d_pwage; eval $setvar
11796 set d_pwchange; eval $setvar
11797 set d_pwclass; eval $setvar
11798 set d_pwexpire; eval $setvar
11799 set d_pwcomment; eval $setvar
11800 set d_pwgecos; eval $setvar
11801 set d_pwpasswd; eval $setvar
11802 ;;
11803esac
11804
11805: see if endpwent_r exists
11806set endpwent_r d_endpwent_r
11807eval $inlibc
11808case "$d_endpwent_r" in
11809"$define")
11810 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
11811 case "$d_endpwent_r_proto:$usethreads" in
11812 ":define") d_endpwent_r_proto=define
a48ec845
JH
11813 set d_endpwent_r_proto endpwent_r $hdrs
11814 eval $hasproto ;;
11815 *) ;;
11816 esac
11817 case "$d_endpwent_r_proto" in
11818 define)
10bc17b6
JH
11819 case "$endpwent_r_proto" in
11820 ''|0) try='int endpwent_r(FILE**);'
11821 ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11822 esac
11823 case "$endpwent_r_proto" in
11824 ''|0) try='void endpwent_r(FILE**);'
11825 ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11826 esac
11827 case "$endpwent_r_proto" in
90e831dc 11828 ''|0) d_endpwent_r=undef
10bc17b6 11829 endpwent_r_proto=0
a48ec845 11830 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11831 * ) case "$endpwent_r_proto" in
11832 REENTRANT_PROTO*) ;;
11833 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11834 esac
11835 echo "Prototype: $try" ;;
11836 esac
11837 ;;
c18e646a
JH
11838 *) case "$usethreads" in
11839 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11840 esac
90e831dc
SB
11841 d_endpwent_r=undef
11842 endpwent_r_proto=0
c18e646a 11843 ;;
a48ec845
JH
11844 esac
11845 ;;
10bc17b6
JH
11846*) endpwent_r_proto=0
11847 ;;
11848esac
11849
b4eb6b3d
JH
11850: see if endservent exists
11851set endservent d_endsent
11852eval $inlibc
11853
10bc17b6
JH
11854: see if endservent_r exists
11855set endservent_r d_endservent_r
11856eval $inlibc
11857case "$d_endservent_r" in
11858"$define")
11859 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11860 case "$d_endservent_r_proto:$usethreads" in
11861 ":define") d_endservent_r_proto=define
a48ec845
JH
11862 set d_endservent_r_proto endservent_r $hdrs
11863 eval $hasproto ;;
11864 *) ;;
11865 esac
11866 case "$d_endservent_r_proto" in
11867 define)
10bc17b6
JH
11868 case "$endservent_r_proto" in
11869 ''|0) try='int endservent_r(struct servent_data*);'
31ee0cb7 11870 ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
11871 esac
11872 case "$endservent_r_proto" in
11873 ''|0) try='void endservent_r(struct servent_data*);'
31ee0cb7 11874 ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
11875 esac
11876 case "$endservent_r_proto" in
90e831dc 11877 ''|0) d_endservent_r=undef
10bc17b6 11878 endservent_r_proto=0
a48ec845 11879 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11880 * ) case "$endservent_r_proto" in
11881 REENTRANT_PROTO*) ;;
11882 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11883 esac
11884 echo "Prototype: $try" ;;
11885 esac
11886 ;;
c18e646a
JH
11887 *) case "$usethreads" in
11888 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11889 esac
90e831dc
SB
11890 d_endservent_r=undef
11891 endservent_r_proto=0
c18e646a 11892 ;;
a48ec845
JH
11893 esac
11894 ;;
10bc17b6
JH
11895*) endservent_r_proto=0
11896 ;;
11897esac
11898
b4eb6b3d
JH
11899: Locate the flags for 'open()'
11900echo " "
55954f19 11901$cat >try.c <<EOCP
b4eb6b3d
JH
11902#include <sys/types.h>
11903#ifdef I_FCNTL
11904#include <fcntl.h>
11905#endif
11906#ifdef I_SYS_FILE
11907#include <sys/file.h>
11908#endif
55954f19
JH
11909#$i_stdlib I_STDLIB
11910#ifdef I_STDLIB
11911#include <stdlib.h>
11912#endif
b4eb6b3d
JH
11913int main() {
11914 if(O_RDONLY);
11915#ifdef O_TRUNC
11916 exit(0);
11917#else
11918 exit(1);
11919#endif
11920}
11921EOCP
11922: check sys/file.h first to get FREAD on Sun
11923if $test `./findhdr sys/file.h` && \
5440bc8e 11924 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
11925 h_sysfile=true;
11926 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 11927 if $run ./try; then
b4eb6b3d
JH
11928 echo "and you have the 3 argument form of open()." >&4
11929 val="$define"
11930 else
11931 echo "but not the 3 argument form of open(). Oh, well." >&4
11932 val="$undef"
11933 fi
11934elif $test `./findhdr fcntl.h` && \
5440bc8e 11935 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
11936 h_fcntl=true;
11937 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 11938 if $run ./try; then
b4eb6b3d
JH
11939 echo "and you have the 3 argument form of open()." >&4
11940 val="$define"
11941 else
11942 echo "but not the 3 argument form of open(). Oh, well." >&4
11943 val="$undef"
11944 fi
11945else
11946 val="$undef"
11947 echo "I can't find the O_* constant definitions! You got problems." >&4
11948fi
11949set d_open3
11950eval $setvar
5440bc8e 11951$rm -f try try.*
b4eb6b3d
JH
11952
11953: see which of string.h or strings.h is needed
11954echo " "
11955strings=`./findhdr string.h`
11956if $test "$strings" && $test -r "$strings"; then
11957 echo "Using <string.h> instead of <strings.h>." >&4
11958 val="$define"
11959else
11960 val="$undef"
11961 strings=`./findhdr strings.h`
11962 if $test "$strings" && $test -r "$strings"; then
11963 echo "Using <strings.h> instead of <string.h>." >&4
11964 else
11965 echo "No string header found -- You'll surely have problems." >&4
11966 fi
11967fi
11968set i_string
11969eval $setvar
11970case "$i_string" in
11971"$undef") strings=`./findhdr strings.h`;;
11972*) strings=`./findhdr string.h`;;
11973esac
11974
3c728e00
JH
11975: see if this is a sys/file.h system
11976val=''
11977set sys/file.h val
11978eval $inhdr
11979
11980: do we need to include sys/file.h ?
11981case "$val" in
11982"$define")
11983 echo " "
11984 if $h_sysfile; then
11985 val="$define"
11986 echo "We'll be including <sys/file.h>." >&4
11987 else
11988 val="$undef"
11989 echo "We won't be including <sys/file.h>." >&4
11990 fi
11991 ;;
11992*)
11993 h_sysfile=false
11994 ;;
11995esac
11996set i_sysfile
11997eval $setvar
11998
11999: see if fcntl.h is there
12000val=''
12001set fcntl.h val
12002eval $inhdr
12003
12004: see if we can include fcntl.h
12005case "$val" in
12006"$define")
12007 echo " "
12008 if $h_fcntl; then
12009 val="$define"
12010 echo "We'll be including <fcntl.h>." >&4
12011 else
12012 val="$undef"
12013 if $h_sysfile; then
12014 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12015 else
12016 echo "We won't be including <fcntl.h>." >&4
12017 fi
12018 fi
12019 ;;
12020*)
12021 h_fcntl=false
12022 val="$undef"
12023 ;;
12024esac
12025set i_fcntl
12026eval $setvar
12027
b4eb6b3d
JH
12028: check for non-blocking I/O stuff
12029case "$h_sysfile" in
a0acbdc3
JH
12030true) echo "#include <sys/file.h>" > head.c;;
12031*)
12032 case "$h_fcntl" in
12033 true) echo "#include <fcntl.h>" > head.c;;
12034 *) echo "#include <sys/fcntl.h>" > head.c;;
12035 esac
12036 ;;
b4eb6b3d
JH
12037esac
12038echo " "
12039echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12040case "$o_nonblock" in
12041'')
12042 $cat head.c > try.c
3c728e00 12043 $cat >>try.c <<EOCP
b4eb6b3d 12044#include <stdio.h>
55954f19
JH
12045#$i_stdlib I_STDLIB
12046#ifdef I_STDLIB
80b3ef99 12047#include <stdlib.h>
55954f19 12048#endif
3c728e00
JH
12049#$i_fcntl I_FCNTL
12050#ifdef I_FCNTL
12051#include <fcntl.h>
12052#endif
b4eb6b3d
JH
12053int main() {
12054#ifdef O_NONBLOCK
12055 printf("O_NONBLOCK\n");
12056 exit(0);
12057#endif
12058#ifdef O_NDELAY
12059 printf("O_NDELAY\n");
12060 exit(0);
12061#endif
12062#ifdef FNDELAY
12063 printf("FNDELAY\n");
12064 exit(0);
12065#endif
12066 exit(0);
12067}
12068EOCP
12069 set try
12070 if eval $compile_ok; then
5440bc8e 12071 o_nonblock=`$run ./try`
b4eb6b3d
JH
12072 case "$o_nonblock" in
12073 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12074 *) echo "Seems like we can use $o_nonblock.";;
12075 esac
12076 else
12077 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12078 fi
12079 ;;
12080*) echo "Using $hint value $o_nonblock.";;
12081esac
12082$rm -f try try.* .out core
12083
12084echo " "
12085echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12086case "$eagain" in
12087'')
12088 $cat head.c > try.c
12089 $cat >>try.c <<EOCP
12090#include <errno.h>
12091#include <sys/types.h>
12092#include <signal.h>
12093#include <stdio.h>
55954f19
JH
12094#$i_stdlib I_STDLIB
12095#ifdef I_STDLIB
12096#include <stdlib.h>
12097#endif
1deb0a86
JH
12098#$i_fcntl I_FCNTL
12099#ifdef I_FCNTL
12100#include <fcntl.h>
12101#endif
b4eb6b3d
JH
12102#define MY_O_NONBLOCK $o_nonblock
12103#ifndef errno /* XXX need better Configure test */
12104extern int errno;
12105#endif
12106#$i_unistd I_UNISTD
12107#ifdef I_UNISTD
12108#include <unistd.h>
12109#endif
12110#$i_string I_STRING
12111#ifdef I_STRING
12112#include <string.h>
12113#else
12114#include <strings.h>
12115#endif
7090f861 12116$signal_t blech(int x) { exit(3); }
b4eb6b3d
JH
12117EOCP
12118 $cat >> try.c <<'EOCP'
12119int main()
12120{
12121 int pd[2];
12122 int pu[2];
12123 char buf[1];
12124 char string[100];
12125
12126 pipe(pd); /* Down: child -> parent */
12127 pipe(pu); /* Up: parent -> child */
12128 if (0 != fork()) {
12129 int ret;
12130 close(pd[1]); /* Parent reads from pd[0] */
12131 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 12132#ifdef F_SETFL
b4eb6b3d
JH
12133 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12134 exit(1);
a0acbdc3
JH
12135#else
12136 exit(4);
12137#endif
b4eb6b3d
JH
12138 signal(SIGALRM, blech);
12139 alarm(5);
12140 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
12141 exit(2);
12142 sprintf(string, "%d\n", ret);
12143 write(2, string, strlen(string));
12144 alarm(0);
12145#ifdef EAGAIN
12146 if (errno == EAGAIN) {
12147 printf("EAGAIN\n");
12148 goto ok;
12149 }
12150#endif
12151#ifdef EWOULDBLOCK
12152 if (errno == EWOULDBLOCK)
12153 printf("EWOULDBLOCK\n");
12154#endif
12155 ok:
12156 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
12157 sleep(2); /* Give it time to close our pipe */
12158 alarm(5);
12159 ret = read(pd[0], buf, 1); /* Should read EOF */
12160 alarm(0);
12161 sprintf(string, "%d\n", ret);
868439a2 12162 write(4, string, strlen(string));
b4eb6b3d
JH
12163 exit(0);
12164 }
12165
12166 close(pd[0]); /* We write to pd[1] */
12167 close(pu[1]); /* We read from pu[0] */
12168 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
12169 close(pd[1]); /* Pipe pd is now fully closed! */
12170 exit(0); /* Bye bye, thank you for playing! */
12171}
12172EOCP
12173 set try
12174 if eval $compile_ok; then
12175 echo "$startsh" >mtry
868439a2 12176 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
12177 chmod +x mtry
12178 ./mtry >/dev/null 2>&1
12179 case $? in
12180 0) eagain=`$cat try.out`;;
12181 1) echo "Could not perform non-blocking setting!";;
12182 2) echo "I did a successful read() for something that was not there!";;
12183 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 12184 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
12185 *) echo "Something terribly wrong happened during testing.";;
12186 esac
12187 rd_nodata=`$cat try.ret`
12188 echo "A read() system call with no data present returns $rd_nodata."
12189 case "$rd_nodata" in
12190 0|-1) ;;
12191 *)
12192 echo "(That's peculiar, fixing that to be -1.)"
12193 rd_nodata=-1
12194 ;;
12195 esac
12196 case "$eagain" in
12197 '')
12198 echo "Forcing errno EAGAIN on read() with no data available."
12199 eagain=EAGAIN
12200 ;;
12201 *)
12202 echo "Your read() sets errno to $eagain when no data is available."
12203 ;;
12204 esac
12205 status=`$cat try.err`
12206 case "$status" in
12207 0) echo "And it correctly returns 0 to signal EOF.";;
12208 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12209 *) echo "However, your read() returns '$status' on EOF??";;
12210 esac
12211 val="$define"
12212 if test "$status" = "$rd_nodata"; then
12213 echo "WARNING: you can't distinguish between EOF and no data!"
12214 val="$undef"
12215 fi
12216 else
12217 echo "I can't compile the test program--assuming errno EAGAIN will do."
12218 eagain=EAGAIN
12219 fi
12220 set d_eofnblk
12221 eval $setvar
12222 ;;
12223*)
12224 echo "Using $hint value $eagain."
12225 echo "Your read() returns $rd_nodata when no data is present."
12226 case "$d_eofnblk" in
12227 "$define") echo "And you can see EOF because read() returns 0.";;
12228 "$undef") echo "But you can't see EOF status from read() returned value.";;
12229 *)
12230 echo "(Assuming you can't see EOF status from read anyway.)"
12231 d_eofnblk=$undef
12232 ;;
12233 esac
12234 ;;
12235esac
12236$rm -f try try.* .out core head.c mtry
12237
15b61c98
JH
12238: see if _ptr and _cnt from stdio act std
12239echo " "
b4eb6b3d 12240
15b61c98
JH
12241if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12242 echo "(Looks like you have stdio.h from BSD.)"
12243 case "$stdio_ptr" in
12244 '') stdio_ptr='((fp)->_p)'
12245 ptr_lval=$define
12246 ;;
12247 *) ptr_lval=$d_stdio_ptr_lval;;
12248 esac
12249 case "$stdio_cnt" in
12250 '') stdio_cnt='((fp)->_r)'
12251 cnt_lval=$define
12252 ;;
12253 *) cnt_lval=$d_stdio_cnt_lval;;
12254 esac
12255 case "$stdio_base" in
12256 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12257 esac
12258 case "$stdio_bufsiz" in
12259 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12260 esac
12261elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12262 echo "(Looks like you have stdio.h from Linux.)"
12263 case "$stdio_ptr" in
12264 '') stdio_ptr='((fp)->_IO_read_ptr)'
12265 ptr_lval=$define
12266 ;;
12267 *) ptr_lval=$d_stdio_ptr_lval;;
12268 esac
12269 case "$stdio_cnt" in
12270 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12271 cnt_lval=$undef
12272 ;;
12273 *) cnt_lval=$d_stdio_cnt_lval;;
12274 esac
12275 case "$stdio_base" in
12276 '') stdio_base='((fp)->_IO_read_base)';;
12277 esac
12278 case "$stdio_bufsiz" in
12279 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12280 esac
12281else
12282 case "$stdio_ptr" in
12283 '') stdio_ptr='((fp)->_ptr)'
12284 ptr_lval=$define
12285 ;;
12286 *) ptr_lval=$d_stdio_ptr_lval;;
12287 esac
12288 case "$stdio_cnt" in
12289 '') stdio_cnt='((fp)->_cnt)'
12290 cnt_lval=$define
12291 ;;
12292 *) cnt_lval=$d_stdio_cnt_lval;;
12293 esac
12294 case "$stdio_base" in
12295 '') stdio_base='((fp)->_base)';;
12296 esac
12297 case "$stdio_bufsiz" in
12298 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12299 esac
12300fi
b4eb6b3d 12301
15b61c98
JH
12302: test whether _ptr and _cnt really work
12303echo "Checking how std your stdio is..." >&4
12304$cat >try.c <<EOP
12305#include <stdio.h>
55954f19
JH
12306#$i_stdlib I_STDLIB
12307#ifdef I_STDLIB
9d9004a9 12308#include <stdlib.h>
55954f19 12309#endif
15b61c98
JH
12310#define FILE_ptr(fp) $stdio_ptr
12311#define FILE_cnt(fp) $stdio_cnt
9d9004a9 12312int main() {
15b61c98
JH
12313 FILE *fp = fopen("try.c", "r");
12314 char c = getc(fp);
12315 if (
12316 18 <= FILE_cnt(fp) &&
12317 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12318 )
12319 exit(0);
12320 exit(1);
9d9004a9 12321}
15b61c98
JH
12322EOP
12323val="$undef"
12324set try
12325if eval $compile && $to try.c; then
12326 if $run ./try; then
12327 echo "Your stdio acts pretty std."
12328 val="$define"
9d9004a9 12329 else
15b61c98 12330 echo "Your stdio isn't very std."
9d9004a9 12331 fi
15b61c98
JH
12332else
12333 echo "Your stdio doesn't appear very std."
12334fi
12335$rm -f try.c try
12336
12337# glibc 2.2.90 and above apparently change stdio streams so Perl's
12338# direct buffer manipulation no longer works. The Configure tests
12339# should be changed to correctly detect this, but until then,
12340# the following check should at least let perl compile and run.
12341# (This quick fix should be updated before 5.8.1.)
12342# To be defensive, reject all unknown versions, and all versions > 2.2.9.
12343# A. Dougherty, June 3, 2002.
12344case "$d_gnulibc" in
12345$define)
12346 case "$gnulibc_version" in
12347 2.[01]*) ;;
12348 2.2) ;;
12349 2.2.[0-9]) ;;
12350 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12351 val="$undef"
12352 ;;
12353 esac
9d9004a9
AD
12354 ;;
12355esac
15b61c98 12356set d_stdstdio
9d9004a9 12357eval $setvar
9d9004a9 12358
15b61c98
JH
12359: Can _ptr be used as an lvalue?
12360case "$d_stdstdio$ptr_lval" in
12361$define$define) val=$define ;;
12362*) val=$undef ;;
12363esac
12364set d_stdio_ptr_lval
12365eval $setvar
9d9004a9 12366
15b61c98
JH
12367: Can _cnt be used as an lvalue?
12368case "$d_stdstdio$cnt_lval" in
12369$define$define) val=$define ;;
12370*) val=$undef ;;
12371esac
12372set d_stdio_cnt_lval
12373eval $setvar
b4eb6b3d 12374
15b61c98
JH
12375
12376: test whether setting _ptr sets _cnt as a side effect
12377d_stdio_ptr_lval_sets_cnt="$undef"
12378d_stdio_ptr_lval_nochange_cnt="$undef"
12379case "$d_stdio_ptr_lval$d_stdstdio" in
12380$define$define)
12381 echo "Checking to see what happens if we set the stdio ptr..." >&4
12382$cat >try.c <<EOP
12383#include <stdio.h>
12384/* Can we scream? */
12385/* Eat dust sed :-) */
12386/* In the buffer space, no one can hear you scream. */
55954f19
JH
12387#$i_stdlib I_STDLIB
12388#ifdef I_STDLIB
12389#include <stdlib.h>
12390#endif
15b61c98
JH
12391#define FILE_ptr(fp) $stdio_ptr
12392#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 12393#include <sys/types.h>
b4eb6b3d 12394int main() {
15b61c98
JH
12395 FILE *fp = fopen("try.c", "r");
12396 int c;
12397 char *ptr;
12398 size_t cnt;
12399 if (!fp) {
12400 puts("Fail even to read");
12401 exit(1);
12402 }
12403 c = getc(fp); /* Read away the first # */
12404 if (c == EOF) {
12405 puts("Fail even to read");
12406 exit(1);
12407 }
12408 if (!(
12409 18 <= FILE_cnt(fp) &&
12410 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12411 )) {
12412 puts("Fail even to read");
12413 exit (1);
12414 }
12415 ptr = (char*) FILE_ptr(fp);
12416 cnt = (size_t)FILE_cnt(fp);
12417
12418 FILE_ptr(fp) += 42;
12419
12420 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12421 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12422 exit (1);
12423 }
12424 if (FILE_cnt(fp) <= 20) {
12425 printf ("Fail (<20 chars to test)");
12426 exit (1);
12427 }
12428 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12429 puts("Fail compare");
12430 exit (1);
12431 }
12432 if (cnt == FILE_cnt(fp)) {
12433 puts("Pass_unchanged");
12434 exit (0);
12435 }
12436 if (FILE_cnt(fp) == (cnt - 42)) {
12437 puts("Pass_changed");
12438 exit (0);
12439 }
12440 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12441 return 1;
12442
12443}
12444EOP
12445 set try
12446 if eval $compile && $to try.c; then
12447 case `$run ./try` in
12448 Pass_changed)
12449 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
12450 d_stdio_ptr_lval_sets_cnt="$define" ;;
12451 Pass_unchanged)
12452 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12453 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12454 Fail*)
12455 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12456 *)
12457 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12458 esac
12459 else
12460 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12461 fi
12462 $rm -f try.c try
12463 ;;
12464esac
12465
12466: see if _base is also standard
12467val="$undef"
12468case "$d_stdstdio" in
12469$define)
12470 $cat >try.c <<EOP
12471#include <stdio.h>
12472#$i_stdlib I_STDLIB
12473#ifdef I_STDLIB
12474#include <stdlib.h>
12475#endif
12476#define FILE_base(fp) $stdio_base
12477#define FILE_bufsiz(fp) $stdio_bufsiz
12478int main() {
12479 FILE *fp = fopen("try.c", "r");
12480 char c = getc(fp);
12481 if (
12482 19 <= FILE_bufsiz(fp) &&
12483 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12484 )
12485 exit(0);
12486 exit(1);
12487}
12488EOP
12489 set try
12490 if eval $compile && $to try.c; then
12491 if $run ./try; then
12492 echo "And its _base field acts std."
12493 val="$define"
12494 else
12495 echo "But its _base field isn't std."
12496 fi
12497 else
12498 echo "However, it seems to be lacking the _base field."
12499 fi
12500 $rm -f try.c try
12501 ;;
12502esac
12503set d_stdiobase
12504eval $setvar
12505
12506: see if fast_stdio exists
12507val="$undef"
12508case "$d_stdstdio:$d_stdio_ptr_lval" in
12509"$define:$define")
12510 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12511 *$define*)
12512 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12513 val="$define"
12514 ;;
12515 esac
12516 ;;
12517esac
12518set d_faststdio
12519eval $setvar
12520
12521
12522
12523: see if fchdir exists
12524set fchdir d_fchdir
12525eval $inlibc
12526
12527: see if fchmod exists
12528set fchmod d_fchmod
12529eval $inlibc
12530
12531: see if fchown exists
12532set fchown d_fchown
12533eval $inlibc
12534
12535: see if this is an fcntl system
12536set fcntl d_fcntl
12537eval $inlibc
12538
12539echo " "
12540: See if fcntl-based locking works.
12541$cat >try.c <<EOCP
12542#$i_stdlib I_STDLIB
12543#ifdef I_STDLIB
12544#include <stdlib.h>
12545#endif
12546#include <unistd.h>
12547#include <fcntl.h>
12548#include <signal.h>
7090f861 12549$signal_t blech(int x) { exit(3); }
15b61c98
JH
12550int main() {
12551#if defined(F_SETLK) && defined(F_SETLKW)
12552 struct flock flock;
12553 int retval, fd;
12554 fd = open("try.c", O_RDONLY);
12555 flock.l_type = F_RDLCK;
12556 flock.l_whence = SEEK_SET;
12557 flock.l_start = flock.l_len = 0;
12558 signal(SIGALRM, blech);
12559 alarm(10);
12560 retval = fcntl(fd, F_SETLK, &flock);
12561 close(fd);
12562 (retval < 0 ? exit(2) : exit(0));
12563#else
12564 exit(2);
12565#endif
12566}
12567EOCP
12568echo "Checking if fcntl-based file locking works... "
12569case "$d_fcntl" in
12570"$define")
12571 set try
12572 if eval $compile_ok; then
12573 if $run ./try; then
12574 echo "Yes, it seems to work."
12575 val="$define"
12576 else
12577 echo "Nope, it didn't work."
12578 val="$undef"
12579 case "$?" in
12580 3) $cat >&4 <<EOM
12581***
12582*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12583*** This is (almost) impossible.
12584*** If your NFS lock daemons are not feeling well, something like
12585*** this may happen, please investigate. Cannot continue, aborting.
12586***
12587EOM
12588 exit 1
12589 ;;
12590 esac
12591 fi
12592 else
12593 echo "I'm unable to compile the test program, so I'll assume not."
12594 val="$undef"
12595 fi
12596 ;;
12597*) val="$undef";
12598 echo "Nope, since you don't even have fcntl()."
12599 ;;
12600esac
12601set d_fcntl_can_lock
12602eval $setvar
12603$rm -f try*
12604
12605
12606: check for fd_set items
12607$cat <<EOM
12608
12609Checking to see how well your C compiler handles fd_set and friends ...
12610EOM
12611$cat >try.c <<EOCP
12612#$i_stdlib I_STDLIB
12613#ifdef I_STDLIB
12614#include <stdlib.h>
12615#endif
12616#$i_systime I_SYS_TIME
12617#$i_sysselct I_SYS_SELECT
12618#$d_socket HAS_SOCKET
12619#include <sys/types.h>
12620#ifdef HAS_SOCKET
12621#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12622#endif
12623#ifdef I_SYS_TIME
12624#include <sys/time.h>
12625#endif
12626#ifdef I_SYS_SELECT
12627#include <sys/select.h>
12628#endif
12629int main() {
12630 fd_set fds;
12631
12632#ifdef TRYBITS
12633 if(fds.fds_bits);
12634#endif
12635
12636#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12637 exit(0);
12638#else
12639 exit(1);
12640#endif
12641}
12642EOCP
12643set try -DTRYBITS
12644if eval $compile; then
12645 d_fds_bits="$define"
12646 d_fd_set="$define"
12647 echo "Well, your system knows about the normal fd_set typedef..." >&4
12648 if $run ./try; then
b4eb6b3d
JH
12649 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12650 d_fd_macros="$define"
12651 else
12652 $cat >&4 <<'EOM'
12653but not the normal fd_set macros! Gaaack! I'll have to cover for you.
12654EOM
12655 d_fd_macros="$undef"
12656 fi
12657else
12658 $cat <<'EOM'
12659Hmm, your compiler has some difficulty with fd_set. Checking further...
12660EOM
5440bc8e 12661 set try
b4eb6b3d
JH
12662 if eval $compile; then
12663 d_fds_bits="$undef"
12664 d_fd_set="$define"
12665 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 12666 if $run ./try; then
b4eb6b3d
JH
12667 echo "and you have the normal fd_set macros." >&4
12668 d_fd_macros="$define"
12669 else
12670 $cat <<'EOM'
12671but not the normal fd_set macros! Gross! More work for me...
12672EOM
12673 d_fd_macros="$undef"
12674 fi
12675 else
12676 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
12677 d_fd_set="$undef"
12678 d_fds_bits="$undef"
12679 d_fd_macros="$undef"
12680 fi
12681fi
5440bc8e 12682$rm -f try try.*
b4eb6b3d
JH
12683
12684: see if fgetpos exists
12685set fgetpos d_fgetpos
12686eval $inlibc
12687
758a5d79
JH
12688: see if finite exists
12689set finite d_finite
12690eval $inlibc
12691
12692: see if finitel exists
12693set finitel d_finitel
12694eval $inlibc
12695
b4eb6b3d
JH
12696: see if flock exists
12697set flock d_flock
12698eval $inlibc
12699
2ef53570
JH
12700: see if prototype for flock is available
12701echo " "
12702set d_flockproto flock $i_sysfile sys/file.h
12703eval $hasproto
12704
b4eb6b3d
JH
12705: see if fork exists
12706set fork d_fork
12707eval $inlibc
12708
758a5d79
JH
12709: see if fp_class exists
12710set fp_class d_fp_class
12711eval $inlibc
12712
b4eb6b3d
JH
12713: see if pathconf exists
12714set pathconf d_pathconf
12715eval $inlibc
12716
12717: see if fpathconf exists
12718set fpathconf d_fpathconf
12719eval $inlibc
12720
758a5d79
JH
12721: see if fpclass exists
12722set fpclass d_fpclass
12723eval $inlibc
12724
12725: see if fpclassify exists
12726set fpclassify d_fpclassify
12727eval $inlibc
12728
12729: see if fpclassl exists
12730set fpclassl d_fpclassl
12731eval $inlibc
12732
b4eb6b3d
JH
12733
12734: check for fpos64_t
12735echo " "
12736echo "Checking to see if you have fpos64_t..." >&4
12737$cat >try.c <<EOCP
12738#include <stdio.h>
12739int main() { fpos64_t x = 7; }
12740EOCP
12741set try
12742if eval $compile; then
12743 val="$define"
12744 echo "You have fpos64_t."
12745else
12746 val="$undef"
12747 echo "You do not have fpos64_t."
12748 case "$fpossize" in
12749 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12750 esac
12751fi
12752$rm -f try.* try
12753set d_fpos64_t
12754eval $setvar
12755
12756: see if frexpl exists
12757set frexpl d_frexpl
12758eval $inlibc
12759
b4eb6b3d
JH
12760: see if this is a sys/param system
12761set sys/param.h i_sysparam
12762eval $inhdr
12763
12764: see if this is a sys/mount.h system
12765set sys/mount.h i_sysmount
12766eval $inhdr
12767
b4eb6b3d
JH
12768
12769echo " "
12770echo "Checking to see if your system supports struct fs_data..." >&4
12771set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12772eval $hasstruct
12773case "$d_fs_data_s" in
12774"$define") echo "Yes, it does." ;;
12775*) echo "No, it doesn't." ;;
12776esac
12777
12778: see if fseeko exists
12779set fseeko d_fseeko
12780eval $inlibc
12781case "$longsize" in
127828) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12783esac
12784
12785: see if fsetpos exists
12786set fsetpos d_fsetpos
12787eval $inlibc
12788
12789
12790: see if fstatfs exists
12791set fstatfs d_fstatfs
12792eval $inlibc
12793
12794
12795: see if statvfs exists
12796set statvfs d_statvfs
12797eval $inlibc
12798
12799: see if fstatvfs exists
12800set fstatvfs d_fstatvfs
12801eval $inlibc
12802
12803
411ab01c
JH
12804: see if fsync exists
12805set fsync d_fsync
12806eval $inlibc
12807
b4eb6b3d
JH
12808: see if ftello exists
12809set ftello d_ftello
12810eval $inlibc
12811case "$longsize" in
128128) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12813esac
12814
bff98e24
SP
12815d_futimes="$undef"
12816: check for a working futimes
12817echo " "
12818echo "Checking for a working futimes()" >&4
12819$cat >try.c <<EOCP
12820#include <stdio.h>
12821#include <sys/time.h>
12822#include <errno.h>
12823#include <fcntl.h>
12824
12825int main ()
12826{
12827 int fd, rv;
12828 fd = open ("try.c", O_RDWR);
12829 if (-1 == fd) exit (1);
12830 rv = futimes (fd, NULL);
12831 exit (rv == -1 ? errno : 0);
12832}
12833EOCP
12834set try
12835if eval $compile; then
12836 `$run ./try`
12837 rc=$?
12838 case "$rc" in
12839 0) echo "Yes, it does" >&4
12840 d_futimes="$define"
12841 ;;
12842 *) echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12843 ;;
12844 esac
12845else
12846 echo "No, it does not (probably harmless)\n" >&4
12847fi
12848$rm -f try.* try core core.try.*
dc814df1 12849
b4eb6b3d
JH
12850: see if getcwd exists
12851set getcwd d_getcwd
12852eval $inlibc
12853
12854: see if getespwnam exists
12855set getespwnam d_getespwnam
12856eval $inlibc
12857
12858
12859: see if getfsstat exists
12860set getfsstat d_getfsstat
12861eval $inlibc
12862
12863: see if getgrent exists
12864set getgrent d_getgrent
12865eval $inlibc
12866
10bc17b6
JH
12867: see if getgrent_r exists
12868set getgrent_r d_getgrent_r
12869eval $inlibc
12870case "$d_getgrent_r" in
12871"$define")
12872 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12873 case "$d_getgrent_r_proto:$usethreads" in
12874 ":define") d_getgrent_r_proto=define
a48ec845
JH
12875 set d_getgrent_r_proto getgrent_r $hdrs
12876 eval $hasproto ;;
12877 *) ;;
12878 esac
12879 case "$d_getgrent_r_proto" in
12880 define)
10bc17b6
JH
12881 case "$getgrent_r_proto" in
12882 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12883 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12884 esac
12885 case "$getgrent_r_proto" in
12886 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12887 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12888 esac
12889 case "$getgrent_r_proto" in
12890 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12891 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12892 esac
12893 case "$getgrent_r_proto" in
12894 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12895 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12896 esac
12897 case "$getgrent_r_proto" in
12898 ''|0) try='int getgrent_r(struct group*, char*, int);'
12899 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12900 esac
12901 case "$getgrent_r_proto" in
12902 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12903 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12904 esac
12905 case "$getgrent_r_proto" in
90e831dc 12906 ''|0) d_getgrent_r=undef
10bc17b6 12907 getgrent_r_proto=0
a48ec845 12908 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12909 * ) case "$getgrent_r_proto" in
12910 REENTRANT_PROTO*) ;;
12911 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12912 esac
12913 echo "Prototype: $try" ;;
12914 esac
12915 ;;
c18e646a
JH
12916 *) case "$usethreads" in
12917 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12918 esac
90e831dc
SB
12919 d_getgrent_r=undef
12920 getgrent_r_proto=0
c18e646a 12921 ;;
a48ec845
JH
12922 esac
12923 ;;
10bc17b6
JH
12924*) getgrent_r_proto=0
12925 ;;
12926esac
12927
12928: see if getgrgid_r exists
12929set getgrgid_r d_getgrgid_r
12930eval $inlibc
12931case "$d_getgrgid_r" in
12932"$define")
12933 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12934 case "$d_getgrgid_r_proto:$usethreads" in
12935 ":define") d_getgrgid_r_proto=define
a48ec845
JH
12936 set d_getgrgid_r_proto getgrgid_r $hdrs
12937 eval $hasproto ;;
12938 *) ;;
12939 esac
12940 case "$d_getgrgid_r_proto" in
12941 define)
10bc17b6
JH
12942 case "$getgrgid_r_proto" in
12943 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12944 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12945 esac
12946 case "$getgrgid_r_proto" in
12947 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12948 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12949 esac
12950 case "$getgrgid_r_proto" in
12951 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12952 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12953 esac
12954 case "$getgrgid_r_proto" in
12955 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12956 ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12957 esac
12958 case "$getgrgid_r_proto" in
90e831dc 12959 ''|0) d_getgrgid_r=undef
10bc17b6 12960 getgrgid_r_proto=0
a48ec845 12961 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12962 * ) case "$getgrgid_r_proto" in
12963 REENTRANT_PROTO*) ;;
12964 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12965 esac
12966 echo "Prototype: $try" ;;
12967 esac
12968 ;;
c18e646a
JH
12969 *) case "$usethreads" in
12970 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12971 esac
90e831dc
SB
12972 d_getgrgid_r=undef
12973 getgrgid_r_proto=0
c18e646a 12974 ;;
a48ec845
JH
12975 esac
12976 ;;
10bc17b6
JH
12977*) getgrgid_r_proto=0
12978 ;;
12979esac
12980
12981: see if getgrnam_r exists
12982set getgrnam_r d_getgrnam_r
12983eval $inlibc
12984case "$d_getgrnam_r" in
12985"$define")
12986 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12987 case "$d_getgrnam_r_proto:$usethreads" in
12988 ":define") d_getgrnam_r_proto=define
a48ec845
JH
12989 set d_getgrnam_r_proto getgrnam_r $hdrs
12990 eval $hasproto ;;
12991 *) ;;
12992 esac
12993 case "$d_getgrnam_r_proto" in
12994 define)
10bc17b6
JH
12995 case "$getgrnam_r_proto" in
12996 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12997 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12998 esac
12999 case "$getgrnam_r_proto" in
13000 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13001 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13002 esac
13003 case "$getgrnam_r_proto" in
13004 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13005 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13006 esac
13007 case "$getgrnam_r_proto" in
13008 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13009 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13010 esac
13011 case "$getgrnam_r_proto" in
13012 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13013 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13014 esac
13015 case "$getgrnam_r_proto" in
90e831dc 13016 ''|0) d_getgrnam_r=undef
10bc17b6 13017 getgrnam_r_proto=0
a48ec845 13018 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13019 * ) case "$getgrnam_r_proto" in
13020 REENTRANT_PROTO*) ;;
13021 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13022 esac
13023 echo "Prototype: $try" ;;
13024 esac
13025 ;;
c18e646a
JH
13026 *) case "$usethreads" in
13027 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13028 esac
90e831dc
SB
13029 d_getgrnam_r=undef
13030 getgrnam_r_proto=0
c18e646a 13031 ;;
a48ec845
JH
13032 esac
13033 ;;
10bc17b6
JH
13034*) getgrnam_r_proto=0
13035 ;;
13036esac
13037
b4eb6b3d
JH
13038: see if gethostbyaddr exists
13039set gethostbyaddr d_gethbyaddr
13040eval $inlibc
13041
13042: see if gethostbyname exists
13043set gethostbyname d_gethbyname
13044eval $inlibc
13045
13046: see if gethostent exists
13047set gethostent d_gethent
13048eval $inlibc
13049
13050: see how we will look up host name
13051echo " "
13052call=''
13053if set gethostname val -f d_gethname; eval $csym; $val; then
13054 echo 'gethostname() found.' >&4
13055 d_gethname="$define"
13056 call=gethostname
13057fi
13058if set uname val -f d_uname; eval $csym; $val; then
13059 if ./xenix; then
13060 $cat <<'EOM'
13061uname() was found, but you're running xenix, and older versions of xenix
13062have a broken uname(). If you don't really know whether your xenix is old
13063enough to have a broken system call, use the default answer.
13064
13065EOM
13066 dflt=y
13067 case "$d_uname" in
13068 "$define") dflt=n;;
13069 esac
13070 rp='Is your uname() broken?'
13071 . ./myread
13072 case "$ans" in
13073 n*) d_uname="$define"; call=uname;;
13074 esac
13075 else
13076 echo 'uname() found.' >&4
13077 d_uname="$define"
13078 case "$call" in
13079 '') call=uname ;;
13080 esac
13081 fi
13082fi
13083case "$d_gethname" in
13084'') d_gethname="$undef";;
13085esac
13086case "$d_uname" in
13087'') d_uname="$undef";;
13088esac
13089case "$d_uname$d_gethname" in
13090*define*)
13091 dflt=n
13092 cat <<EOM
13093
13094Every now and then someone has a $call() that lies about the hostname
13095but can't be fixed for political or economic reasons. If you wish, I can
13096pretend $call() isn't there and maybe compute hostname at run-time
13097thanks to the '$phostname' command.
13098
13099EOM
13100 rp="Shall I ignore $call() from now on?"
13101 . ./myread
13102 case "$ans" in
13103 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13104 esac;;
13105esac
13106case "$phostname" in
13107'') aphostname='';;
13108*) case "$aphostname" in
13109 /*) ;;
13110 *) set X $phostname
13111 shift
13112 file=$1
13113 shift
13114 file=`./loc $file $file $pth`
13115 aphostname=`echo $file $*`
13116 ;;
13117 esac
13118 ;;
13119esac
13120case "$d_uname$d_gethname" in
13121*define*) ;;
13122*)
13123 case "$phostname" in
13124 '')
13125 echo "There will be no way for $package to get your hostname." >&4;;
13126 *)
13127 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13128 ;;
13129 esac;;
13130esac
13131case "$d_phostname" in
13132'') d_phostname="$undef";;
13133esac
13134
10bc17b6
JH
13135: see if gethostbyaddr_r exists
13136set gethostbyaddr_r d_gethostbyaddr_r
13137eval $inlibc
13138case "$d_gethostbyaddr_r" in
13139"$define")
13140 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13141 case "$d_gethostbyaddr_r_proto:$usethreads" in
13142 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
13143 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13144 eval $hasproto ;;
13145 *) ;;
13146 esac
13147 case "$d_gethostbyaddr_r_proto" in
13148 define)
10bc17b6
JH
13149 case "$gethostbyaddr_r_proto" in
13150 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13151 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13152 esac
13153 case "$gethostbyaddr_r_proto" in
13154 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13155 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13156 esac
13157 case "$gethostbyaddr_r_proto" in
13158 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13159 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13160 esac
13161 case "$gethostbyaddr_r_proto" in
13162 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13163 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13164 esac
13165 case "$gethostbyaddr_r_proto" in
13166 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13167 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13168 esac
13169 case "$gethostbyaddr_r_proto" in
13170 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13171 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13172 esac
13173 case "$gethostbyaddr_r_proto" in
13174 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13175 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13176 esac
13177 case "$gethostbyaddr_r_proto" in
13178 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13179 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13180 esac
13181 case "$gethostbyaddr_r_proto" in
13182 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13183 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13184 esac
13185 case "$gethostbyaddr_r_proto" in
13186 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13187 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13188 esac
13189 case "$gethostbyaddr_r_proto" in
a845a0d4
JH
13190 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13191 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13192 esac
13193 case "$gethostbyaddr_r_proto" in
90e831dc 13194 ''|0) d_gethostbyaddr_r=undef
10bc17b6 13195 gethostbyaddr_r_proto=0
a48ec845 13196 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13197 * ) case "$gethostbyaddr_r_proto" in
13198 REENTRANT_PROTO*) ;;
13199 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13200 esac
13201 echo "Prototype: $try" ;;
13202 esac
13203 ;;
c18e646a
JH
13204 *) case "$usethreads" in
13205 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13206 esac
90e831dc
SB
13207 d_gethostbyaddr_r=undef
13208 gethostbyaddr_r_proto=0
c18e646a 13209 ;;
a48ec845
JH
13210 esac
13211 ;;
10bc17b6
JH
13212*) gethostbyaddr_r_proto=0
13213 ;;
13214esac
13215
13216: see if gethostbyname_r exists
13217set gethostbyname_r d_gethostbyname_r
13218eval $inlibc
13219case "$d_gethostbyname_r" in
13220"$define")
13221 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13222 case "$d_gethostbyname_r_proto:$usethreads" in
13223 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
13224 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13225 eval $hasproto ;;
13226 *) ;;
13227 esac
13228 case "$d_gethostbyname_r_proto" in
13229 define)
10bc17b6
JH
13230 case "$gethostbyname_r_proto" in
13231 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13232 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13233 esac
13234 case "$gethostbyname_r_proto" in
13235 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13236 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13237 esac
13238 case "$gethostbyname_r_proto" in
13239 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13240 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13241 esac
13242 case "$gethostbyname_r_proto" in
90e831dc 13243 ''|0) d_gethostbyname_r=undef
10bc17b6 13244 gethostbyname_r_proto=0
a48ec845 13245 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13246 * ) case "$gethostbyname_r_proto" in
13247 REENTRANT_PROTO*) ;;
13248 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13249 esac
13250 echo "Prototype: $try" ;;
13251 esac
13252 ;;
c18e646a
JH
13253 *) case "$usethreads" in
13254 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13255 esac
90e831dc
SB
13256 d_gethostbyname_r=undef
13257 gethostbyname_r_proto=0
c18e646a 13258 ;;
a48ec845
JH
13259 esac
13260 ;;
10bc17b6
JH
13261*) gethostbyname_r_proto=0
13262 ;;
13263esac
13264
13265: see if gethostent_r exists
13266set gethostent_r d_gethostent_r
13267eval $inlibc
13268case "$d_gethostent_r" in
13269"$define")
13270 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13271 case "$d_gethostent_r_proto:$usethreads" in
13272 ":define") d_gethostent_r_proto=define
a48ec845
JH
13273 set d_gethostent_r_proto gethostent_r $hdrs
13274 eval $hasproto ;;
13275 *) ;;
13276 esac
13277 case "$d_gethostent_r_proto" in
13278 define)
10bc17b6
JH
13279 case "$gethostent_r_proto" in
13280 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13281 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13282 esac
13283 case "$gethostent_r_proto" in
13284 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13285 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13286 esac
13287 case "$gethostent_r_proto" in
13288 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13289 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13290 esac
13291 case "$gethostent_r_proto" in
13292 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13293 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13294 esac
13295 case "$gethostent_r_proto" in
13296 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13297 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13298 esac
13299 case "$gethostent_r_proto" in
13300 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13301 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13302 esac
13303 case "$gethostent_r_proto" in
90e831dc 13304 ''|0) d_gethostent_r=undef
10bc17b6 13305 gethostent_r_proto=0
a48ec845 13306 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13307 * ) case "$gethostent_r_proto" in
13308 REENTRANT_PROTO*) ;;
13309 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13310 esac
13311 echo "Prototype: $try" ;;
13312 esac
13313 ;;
c18e646a
JH
13314 *) case "$usethreads" in
13315 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13316 esac
90e831dc
SB
13317 d_gethostent_r=undef
13318 gethostent_r_proto=0
c18e646a 13319 ;;
a48ec845
JH
13320 esac
13321 ;;
10bc17b6
JH
13322*) gethostent_r_proto=0
13323 ;;
13324esac
b4eb6b3d
JH
13325
13326: see if prototypes for various gethostxxx netdb.h functions are available
13327echo " "
13328set d_gethostprotos gethostent $i_netdb netdb.h
13329eval $hasproto
13330
4e0554ec
JH
13331: see if getitimer exists
13332set getitimer d_getitimer
13333eval $inlibc
13334
b4eb6b3d
JH
13335: see if getlogin exists
13336set getlogin d_getlogin
13337eval $inlibc
13338
10bc17b6
JH
13339: see if getlogin_r exists
13340set getlogin_r d_getlogin_r
13341eval $inlibc
13342case "$d_getlogin_r" in
13343"$define")
13344 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
13345 case "$d_getlogin_r_proto:$usethreads" in
13346 ":define") d_getlogin_r_proto=define
a48ec845
JH
13347 set d_getlogin_r_proto getlogin_r $hdrs
13348 eval $hasproto ;;
13349 *) ;;
13350 esac
13351 case "$d_getlogin_r_proto" in
13352 define)
10bc17b6
JH
13353 case "$getlogin_r_proto" in
13354 ''|0) try='int getlogin_r(char*, size_t);'
13355 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13356 esac
13357 case "$getlogin_r_proto" in
13358 ''|0) try='int getlogin_r(char*, int);'
13359 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13360 esac
13361 case "$getlogin_r_proto" in
13362 ''|0) try='char* getlogin_r(char*, size_t);'
13363 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13364 esac
13365 case "$getlogin_r_proto" in
13366 ''|0) try='char* getlogin_r(char*, int);'
13367 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13368 esac
13369 case "$getlogin_r_proto" in
90e831dc 13370 ''|0) d_getlogin_r=undef
10bc17b6 13371 getlogin_r_proto=0
a48ec845 13372 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13373 * ) case "$getlogin_r_proto" in
13374 REENTRANT_PROTO*) ;;
13375 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13376 esac
13377 echo "Prototype: $try" ;;
13378 esac
13379 ;;
c18e646a
JH
13380 *) case "$usethreads" in
13381 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13382 esac
90e831dc
SB
13383 d_getlogin_r=undef
13384 getlogin_r_proto=0
c18e646a 13385 ;;
a48ec845
JH
13386 esac
13387 ;;
10bc17b6
JH
13388*) getlogin_r_proto=0
13389 ;;
13390esac
13391
b4eb6b3d
JH
13392: see if getmnt exists
13393set getmnt d_getmnt
13394eval $inlibc
13395
13396: see if getmntent exists
13397set getmntent d_getmntent
13398eval $inlibc
13399
13400: see if getnetbyaddr exists
13401set getnetbyaddr d_getnbyaddr
13402eval $inlibc
13403
13404: see if getnetbyname exists
13405set getnetbyname d_getnbyname
13406eval $inlibc
13407
13408: see if getnetent exists
13409set getnetent d_getnent
13410eval $inlibc
13411
10bc17b6
JH
13412: see if getnetbyaddr_r exists
13413set getnetbyaddr_r d_getnetbyaddr_r
13414eval $inlibc
13415case "$d_getnetbyaddr_r" in
13416"$define")
13417 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13418 case "$d_getnetbyaddr_r_proto:$usethreads" in
13419 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
13420 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13421 eval $hasproto ;;
13422 *) ;;
13423 esac
13424 case "$d_getnetbyaddr_r_proto" in
13425 define)
10bc17b6
JH
13426 case "$getnetbyaddr_r_proto" in
13427 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13428 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13429 esac
13430 case "$getnetbyaddr_r_proto" in
13431 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13432 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13433 esac
13434 case "$getnetbyaddr_r_proto" in
13435 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13436 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13437 esac
13438 case "$getnetbyaddr_r_proto" in
13439 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13440 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13441 esac
13442 case "$getnetbyaddr_r_proto" in
13443 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13444 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13445 esac
13446 case "$getnetbyaddr_r_proto" in
13447 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13448 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13449 esac
13450 case "$getnetbyaddr_r_proto" in
13451 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13452 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13453 esac
13454 case "$getnetbyaddr_r_proto" in
a845a0d4
JH
13455 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13456 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13457 esac
13458 case "$getnetbyaddr_r_proto" in
90e831dc 13459 ''|0) d_getnetbyaddr_r=undef
10bc17b6 13460 getnetbyaddr_r_proto=0
a48ec845 13461 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13462 * ) case "$getnetbyaddr_r_proto" in
13463 REENTRANT_PROTO*) ;;
13464 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13465 esac
13466 echo "Prototype: $try" ;;
13467 esac
13468 ;;
c18e646a
JH
13469 *) case "$usethreads" in
13470 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13471 esac
90e831dc
SB
13472 d_getnetbyaddr_r=undef
13473 getnetbyaddr_r_proto=0
c18e646a 13474 ;;
a48ec845
JH
13475 esac
13476 ;;
10bc17b6
JH
13477*) getnetbyaddr_r_proto=0
13478 ;;
13479esac
13480
13481: see if getnetbyname_r exists
13482set getnetbyname_r d_getnetbyname_r
13483eval $inlibc
13484case "$d_getnetbyname_r" in
13485"$define")
13486 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13487 case "$d_getnetbyname_r_proto:$usethreads" in
13488 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
13489 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13490 eval $hasproto ;;
13491 *) ;;
13492 esac
13493 case "$d_getnetbyname_r_proto" in
13494 define)
10bc17b6
JH
13495 case "$getnetbyname_r_proto" in
13496 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13497 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13498 esac
13499 case "$getnetbyname_r_proto" in
13500 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13501 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13502 esac
13503 case "$getnetbyname_r_proto" in
13504 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13505 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13506 esac
13507 case "$getnetbyname_r_proto" in
13508 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13509 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13510 esac
13511 case "$getnetbyname_r_proto" in
90e831dc 13512 ''|0) d_getnetbyname_r=undef
10bc17b6 13513 getnetbyname_r_proto=0
a48ec845 13514 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13515 * ) case "$getnetbyname_r_proto" in
13516 REENTRANT_PROTO*) ;;
13517 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13518 esac
13519 echo "Prototype: $try" ;;
13520 esac
13521 ;;
c18e646a
JH
13522 *) case "$usethreads" in
13523 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13524 esac
90e831dc
SB
13525 d_getnetbyname_r=undef
13526 getnetbyname_r_proto=0
c18e646a 13527 ;;
a48ec845
JH
13528 esac
13529 ;;
10bc17b6
JH
13530*) getnetbyname_r_proto=0
13531 ;;
13532esac
13533
13534: see if getnetent_r exists
13535set getnetent_r d_getnetent_r
13536eval $inlibc
13537case "$d_getnetent_r" in
13538"$define")
13539 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13540 case "$d_getnetent_r_proto:$usethreads" in
13541 ":define") d_getnetent_r_proto=define
a48ec845
JH
13542 set d_getnetent_r_proto getnetent_r $hdrs
13543 eval $hasproto ;;
13544 *) ;;
13545 esac
13546 case "$d_getnetent_r_proto" in
13547 define)
10bc17b6
JH
13548 case "$getnetent_r_proto" in
13549 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13550 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13551 esac
13552 case "$getnetent_r_proto" in
13553 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13554 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13555 esac
13556 case "$getnetent_r_proto" in
13557 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13558 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13559 esac
13560 case "$getnetent_r_proto" in
13561 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13562 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13563 esac
13564 case "$getnetent_r_proto" in
13565 ''|0) try='int getnetent_r(struct netent*, char*, int);'
13566 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13567 esac
13568 case "$getnetent_r_proto" in
13569 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13570 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13571 esac
13572 case "$getnetent_r_proto" in
90e831dc 13573 ''|0) d_getnetent_r=undef
10bc17b6 13574 getnetent_r_proto=0
a48ec845 13575 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13576 * ) case "$getnetent_r_proto" in
13577 REENTRANT_PROTO*) ;;
13578 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13579 esac
13580 echo "Prototype: $try" ;;
13581 esac
13582 ;;
c18e646a
JH
13583 *) case "$usethreads" in
13584 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13585 esac
90e831dc
SB
13586 d_getnetent_r=undef
13587 getnetent_r_proto=0
c18e646a 13588 ;;
a48ec845
JH
13589 esac
13590 ;;
10bc17b6
JH
13591*) getnetent_r_proto=0
13592 ;;
13593esac
13594
b4eb6b3d
JH
13595: see if prototypes for various getnetxxx netdb.h functions are available
13596echo " "
13597set d_getnetprotos getnetent $i_netdb netdb.h
13598eval $hasproto
13599
0c0643d0
JH
13600: see if getpagesize exists
13601set getpagesize d_getpagsz
13602eval $inlibc
13603
b4eb6b3d
JH
13604
13605: see if getprotobyname exists
13606set getprotobyname d_getpbyname
13607eval $inlibc
13608
13609: see if getprotobynumber exists
13610set getprotobynumber d_getpbynumber
13611eval $inlibc
13612
13613: see if getprotoent exists
13614set getprotoent d_getpent
13615eval $inlibc
13616
13617: see if getpgid exists
13618set getpgid d_getpgid
13619eval $inlibc
13620
13621: see if getpgrp2 exists
13622set getpgrp2 d_getpgrp2
13623eval $inlibc
13624
13625: see if getppid exists
13626set getppid d_getppid
13627eval $inlibc
13628
13629: see if getpriority exists
13630set getpriority d_getprior
13631eval $inlibc
13632
10bc17b6
JH
13633: see if getprotobyname_r exists
13634set getprotobyname_r d_getprotobyname_r
13635eval $inlibc
13636case "$d_getprotobyname_r" in
13637"$define")
13638 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13639 case "$d_getprotobyname_r_proto:$usethreads" in
13640 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
13641 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13642 eval $hasproto ;;
13643 *) ;;
13644 esac
13645 case "$d_getprotobyname_r_proto" in
13646 define)
10bc17b6
JH
13647 case "$getprotobyname_r_proto" in
13648 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13649 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13650 esac
13651 case "$getprotobyname_r_proto" in
13652 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13653 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13654 esac
13655 case "$getprotobyname_r_proto" in
13656 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13657 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13658 esac
13659 case "$getprotobyname_r_proto" in
90e831dc 13660 ''|0) d_getprotobyname_r=undef
10bc17b6 13661 getprotobyname_r_proto=0
a48ec845 13662 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13663 * ) case "$getprotobyname_r_proto" in
13664 REENTRANT_PROTO*) ;;
13665 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13666 esac
13667 echo "Prototype: $try" ;;
13668 esac
13669 ;;
c18e646a
JH
13670 *) case "$usethreads" in
13671 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13672 esac
90e831dc
SB
13673 d_getprotobyname_r=undef
13674 getprotobyname_r_proto=0
c18e646a 13675 ;;
a48ec845
JH
13676 esac
13677 ;;
10bc17b6
JH
13678*) getprotobyname_r_proto=0
13679 ;;
13680esac
13681
13682: see if getprotobynumber_r exists
13683set getprotobynumber_r d_getprotobynumber_r
13684eval $inlibc
13685case "$d_getprotobynumber_r" in
13686"$define")
13687 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13688 case "$d_getprotobynumber_r_proto:$usethreads" in
13689 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
13690 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13691 eval $hasproto ;;
13692 *) ;;
13693 esac
13694 case "$d_getprotobynumber_r_proto" in
13695 define)
10bc17b6
JH
13696 case "$getprotobynumber_r_proto" in
13697 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13698 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13699 esac
13700 case "$getprotobynumber_r_proto" in
13701 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13702 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13703 esac
13704 case "$getprotobynumber_r_proto" in
13705 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13706 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13707 esac
13708 case "$getprotobynumber_r_proto" in
90e831dc 13709 ''|0) d_getprotobynumber_r=undef
10bc17b6 13710 getprotobynumber_r_proto=0
a48ec845 13711 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13712 * ) case "$getprotobynumber_r_proto" in
13713 REENTRANT_PROTO*) ;;
13714 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13715 esac
13716 echo "Prototype: $try" ;;
13717 esac
13718 ;;
c18e646a
JH
13719 *) case "$usethreads" in
13720 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13721 esac
90e831dc
SB
13722 d_getprotobynumber_r=undef
13723 getprotobynumber_r_proto=0
c18e646a 13724 ;;
a48ec845
JH
13725 esac
13726 ;;
10bc17b6
JH
13727*) getprotobynumber_r_proto=0
13728 ;;
13729esac
13730
13731: see if getprotoent_r exists
13732set getprotoent_r d_getprotoent_r
13733eval $inlibc
13734case "$d_getprotoent_r" in
13735"$define")
13736 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13737 case "$d_getprotoent_r_proto:$usethreads" in
13738 ":define") d_getprotoent_r_proto=define
a48ec845
JH
13739 set d_getprotoent_r_proto getprotoent_r $hdrs
13740 eval $hasproto ;;
13741 *) ;;
13742 esac
13743 case "$d_getprotoent_r_proto" in
13744 define)
10bc17b6
JH
13745 case "$getprotoent_r_proto" in
13746 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13747 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13748 esac
13749 case "$getprotoent_r_proto" in
13750 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13751 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13752 esac
13753 case "$getprotoent_r_proto" in
13754 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13755 ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13756 esac
13757 case "$getprotoent_r_proto" in
13758 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13759 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13760 esac
13761 case "$getprotoent_r_proto" in
90e831dc 13762 ''|0) d_getprotoent_r=undef
10bc17b6 13763 getprotoent_r_proto=0
a48ec845 13764 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13765 * ) case "$getprotoent_r_proto" in
13766 REENTRANT_PROTO*) ;;
13767 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13768 esac
13769 echo "Prototype: $try" ;;
13770 esac
13771 ;;
c18e646a
JH
13772 *) case "$usethreads" in
13773 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13774 esac
90e831dc
SB
13775 d_getprotoent_r=undef
13776 getprotoent_r_proto=0
c18e646a 13777 ;;
a48ec845
JH
13778 esac
13779 ;;
10bc17b6
JH
13780*) getprotoent_r_proto=0
13781 ;;
13782esac
13783
b4eb6b3d
JH
13784: see if prototypes for various getprotoxxx netdb.h functions are available
13785echo " "
13786set d_getprotoprotos getprotoent $i_netdb netdb.h
13787eval $hasproto
13788
13789: see if getprpwnam exists
13790set getprpwnam d_getprpwnam
13791eval $inlibc
13792
13793: see if getpwent exists
13794set getpwent d_getpwent
13795eval $inlibc
13796
10bc17b6
JH
13797: see if getpwent_r exists
13798set getpwent_r d_getpwent_r
13799eval $inlibc
13800case "$d_getpwent_r" in
13801"$define")
13802 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13803 case "$d_getpwent_r_proto:$usethreads" in
13804 ":define") d_getpwent_r_proto=define
a48ec845
JH
13805 set d_getpwent_r_proto getpwent_r $hdrs
13806 eval $hasproto ;;
13807 *) ;;
13808 esac
13809 case "$d_getpwent_r_proto" in
13810 define)
10bc17b6
JH
13811 case "$getpwent_r_proto" in
13812 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13813 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13814 esac
13815 case "$getpwent_r_proto" in
13816 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13817 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13818 esac
13819 case "$getpwent_r_proto" in
13820 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13821 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13822 esac
13823 case "$getpwent_r_proto" in
13824 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13825 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13826 esac
13827 case "$getpwent_r_proto" in
13828 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13829 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13830 esac
13831 case "$getpwent_r_proto" in
13832 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13833 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13834 esac
13835 case "$getpwent_r_proto" in
90e831dc 13836 ''|0) d_getpwent_r=undef
10bc17b6 13837 getpwent_r_proto=0
a48ec845 13838 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13839 * ) case "$getpwent_r_proto" in
13840 REENTRANT_PROTO*) ;;
13841 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13842 esac
13843 echo "Prototype: $try" ;;
13844 esac
13845 ;;
c18e646a
JH
13846 *) case "$usethreads" in
13847 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13848 esac
90e831dc
SB
13849 d_getpwent_r=undef
13850 getpwent_r_proto=0
c18e646a 13851 ;;
a48ec845
JH
13852 esac
13853 ;;
10bc17b6
JH
13854*) getpwent_r_proto=0
13855 ;;
13856esac
13857
13858: see if getpwnam_r exists
13859set getpwnam_r d_getpwnam_r
13860eval $inlibc
13861case "$d_getpwnam_r" in
13862"$define")
13863 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13864 case "$d_getpwnam_r_proto:$usethreads" in
13865 ":define") d_getpwnam_r_proto=define
a48ec845
JH
13866 set d_getpwnam_r_proto getpwnam_r $hdrs
13867 eval $hasproto ;;
13868 *) ;;
13869 esac
13870 case "$d_getpwnam_r_proto" in
13871 define)
10bc17b6
JH
13872 case "$getpwnam_r_proto" in
13873 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13874 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13875 esac
13876 case "$getpwnam_r_proto" in
13877 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13878 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13879 esac
13880 case "$getpwnam_r_proto" in
13881 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13882 ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13883 esac
13884 case "$getpwnam_r_proto" in
13885 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13886 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13887 esac
13888 case "$getpwnam_r_proto" in
90e831dc 13889 ''|0) d_getpwnam_r=undef
10bc17b6 13890 getpwnam_r_proto=0
a48ec845 13891 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13892 * ) case "$getpwnam_r_proto" in
13893 REENTRANT_PROTO*) ;;
13894 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13895 esac
13896 echo "Prototype: $try" ;;
13897 esac
13898 ;;
c18e646a
JH
13899 *) case "$usethreads" in
13900 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13901 esac
90e831dc
SB
13902 d_getpwnam_r=undef
13903 getpwnam_r_proto=0
c18e646a 13904 ;;
a48ec845
JH
13905 esac
13906 ;;
10bc17b6
JH
13907*) getpwnam_r_proto=0
13908 ;;
13909esac
13910
13911: see if getpwuid_r exists
13912set getpwuid_r d_getpwuid_r
13913eval $inlibc
13914case "$d_getpwuid_r" in
13915"$define")
13916 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13917 case "$d_getpwuid_r_proto:$usethreads" in
13918 ":define") d_getpwuid_r_proto=define
a48ec845
JH
13919 set d_getpwuid_r_proto getpwuid_r $hdrs
13920 eval $hasproto ;;
13921 *) ;;
13922 esac
13923 case "$d_getpwuid_r_proto" in
13924 define)
10bc17b6
JH
13925 case "$getpwuid_r_proto" in
13926 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13927 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13928 esac
13929 case "$getpwuid_r_proto" in
13930 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13931 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13932 esac
13933 case "$getpwuid_r_proto" in
13934 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13935 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13936 esac
13937 case "$getpwuid_r_proto" in
13938 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13939 ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13940 esac
13941 case "$getpwuid_r_proto" in
90e831dc 13942 ''|0) d_getpwuid_r=undef
10bc17b6 13943 getpwuid_r_proto=0
a48ec845 13944 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13945 * ) case "$getpwuid_r_proto" in
13946 REENTRANT_PROTO*) ;;
13947 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13948 esac
13949 echo "Prototype: $try" ;;
13950 esac
13951 ;;
c18e646a
JH
13952 *) case "$usethreads" in
13953 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13954 esac
90e831dc
SB
13955 d_getpwuid_r=undef
13956 getpwuid_r_proto=0
c18e646a 13957 ;;
a48ec845
JH
13958 esac
13959 ;;
10bc17b6
JH
13960*) getpwuid_r_proto=0
13961 ;;
13962esac
13963
b4eb6b3d
JH
13964
13965: see if getservbyname exists
13966set getservbyname d_getsbyname
13967eval $inlibc
13968
13969: see if getservbyport exists
13970set getservbyport d_getsbyport
13971eval $inlibc
13972
13973: see if getservent exists
13974set getservent d_getsent
13975eval $inlibc
13976
10bc17b6
JH
13977: see if getservbyname_r exists
13978set getservbyname_r d_getservbyname_r
13979eval $inlibc
13980case "$d_getservbyname_r" in
13981"$define")
13982 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13983 case "$d_getservbyname_r_proto:$usethreads" in
13984 ":define") d_getservbyname_r_proto=define
a48ec845
JH
13985 set d_getservbyname_r_proto getservbyname_r $hdrs
13986 eval $hasproto ;;
13987 *) ;;
13988 esac
13989 case "$d_getservbyname_r_proto" in
13990 define)
10bc17b6
JH
13991 case "$getservbyname_r_proto" in
13992 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13993 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13994 esac
13995 case "$getservbyname_r_proto" in
13996 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13997 ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13998 esac
13999 case "$getservbyname_r_proto" in
14000 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14001 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14002 esac
14003 case "$getservbyname_r_proto" in
90e831dc 14004 ''|0) d_getservbyname_r=undef
10bc17b6 14005 getservbyname_r_proto=0
a48ec845 14006 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14007 * ) case "$getservbyname_r_proto" in
14008 REENTRANT_PROTO*) ;;
14009 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14010 esac
14011 echo "Prototype: $try" ;;
14012 esac
14013 ;;
c18e646a
JH
14014 *) case "$usethreads" in
14015 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14016 esac
90e831dc
SB
14017 d_getservbyname_r=undef
14018 getservbyname_r_proto=0
c18e646a 14019 ;;
a48ec845
JH
14020 esac
14021 ;;
10bc17b6
JH
14022*) getservbyname_r_proto=0
14023 ;;
14024esac
14025
14026: see if getservbyport_r exists
14027set getservbyport_r d_getservbyport_r
14028eval $inlibc
14029case "$d_getservbyport_r" in
14030"$define")
14031 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14032 case "$d_getservbyport_r_proto:$usethreads" in
14033 ":define") d_getservbyport_r_proto=define
a48ec845
JH
14034 set d_getservbyport_r_proto getservbyport_r $hdrs
14035 eval $hasproto ;;
14036 *) ;;
14037 esac
14038 case "$d_getservbyport_r_proto" in
14039 define)
10bc17b6
JH
14040 case "$getservbyport_r_proto" in
14041 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14042 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14043 esac
14044 case "$getservbyport_r_proto" in
14045 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14046 ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14047 esac
14048 case "$getservbyport_r_proto" in
14049 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14050 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14051 esac
14052 case "$getservbyport_r_proto" in
90e831dc 14053 ''|0) d_getservbyport_r=undef
10bc17b6 14054 getservbyport_r_proto=0
a48ec845 14055 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14056 * ) case "$getservbyport_r_proto" in
14057 REENTRANT_PROTO*) ;;
14058 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14059 esac
14060 echo "Prototype: $try" ;;
14061 esac
14062 ;;
c18e646a
JH
14063 *) case "$usethreads" in
14064 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14065 esac
90e831dc
SB
14066 d_getservbyport_r=undef
14067 getservbyport_r_proto=0
c18e646a 14068 ;;
a48ec845
JH
14069 esac
14070 ;;
10bc17b6
JH
14071*) getservbyport_r_proto=0
14072 ;;
14073esac
14074
14075: see if getservent_r exists
14076set getservent_r d_getservent_r
14077eval $inlibc
14078case "$d_getservent_r" in
14079"$define")
14080 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14081 case "$d_getservent_r_proto:$usethreads" in
14082 ":define") d_getservent_r_proto=define
a48ec845
JH
14083 set d_getservent_r_proto getservent_r $hdrs
14084 eval $hasproto ;;
14085 *) ;;
14086 esac
14087 case "$d_getservent_r_proto" in
14088 define)
10bc17b6
JH
14089 case "$getservent_r_proto" in
14090 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14091 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14092 esac
14093 case "$getservent_r_proto" in
14094 ''|0) try='int getservent_r(struct servent*, char*, int);'
14095 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14096 esac
14097 case "$getservent_r_proto" in
14098 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14099 ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14100 esac
14101 case "$getservent_r_proto" in
14102 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14103 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14104 esac
14105 case "$getservent_r_proto" in
90e831dc 14106 ''|0) d_getservent_r=undef
10bc17b6 14107 getservent_r_proto=0
a48ec845 14108 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14109 * ) case "$getservent_r_proto" in
14110 REENTRANT_PROTO*) ;;
14111 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14112 esac
14113 echo "Prototype: $try" ;;
14114 esac
14115 ;;
c18e646a
JH
14116 *) case "$usethreads" in
14117 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14118 esac
90e831dc
SB
14119 d_getservent_r=undef
14120 getservent_r_proto=0
c18e646a 14121 ;;
a48ec845
JH
14122 esac
14123 ;;
10bc17b6
JH
14124*) getservent_r_proto=0
14125 ;;
14126esac
14127
b4eb6b3d
JH
14128: see if prototypes for various getservxxx netdb.h functions are available
14129echo " "
14130set d_getservprotos getservent $i_netdb netdb.h
14131eval $hasproto
14132
14133: see if getspnam exists
14134set getspnam d_getspnam
14135eval $inlibc
14136
10bc17b6
JH
14137: see if this is a shadow.h system
14138set shadow.h i_shadow
14139eval $inhdr
14140
14141: see if getspnam_r exists
14142set getspnam_r d_getspnam_r
14143eval $inlibc
14144case "$d_getspnam_r" in
14145"$define")
14146 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
14147 case "$d_getspnam_r_proto:$usethreads" in
14148 ":define") d_getspnam_r_proto=define
a48ec845
JH
14149 set d_getspnam_r_proto getspnam_r $hdrs
14150 eval $hasproto ;;
14151 *) ;;
14152 esac
14153 case "$d_getspnam_r_proto" in
14154 define)
10bc17b6
JH
14155 case "$getspnam_r_proto" in
14156 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14157 ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14158 esac
14159 case "$getspnam_r_proto" in
14160 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14161 ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14162 esac
14163 case "$getspnam_r_proto" in
90e831dc 14164 ''|0) d_getspnam_r=undef
10bc17b6 14165 getspnam_r_proto=0
a48ec845 14166 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14167 * ) case "$getspnam_r_proto" in
14168 REENTRANT_PROTO*) ;;
14169 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14170 esac
14171 echo "Prototype: $try" ;;
14172 esac
14173 ;;
c18e646a
JH
14174 *) case "$usethreads" in
14175 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14176 esac
90e831dc
SB
14177 d_getspnam_r=undef
14178 getspnam_r_proto=0
c18e646a 14179 ;;
a48ec845
JH
14180 esac
14181 ;;
10bc17b6
JH
14182*) getspnam_r_proto=0
14183 ;;
14184esac
14185
b4eb6b3d
JH
14186: see if gettimeofday or ftime exists
14187set gettimeofday d_gettimeod
14188eval $inlibc
14189case "$d_gettimeod" in
14190"$undef")
14191 set ftime d_ftime
14192 eval $inlibc
14193 ;;
14194*)
14195 val="$undef"; set d_ftime; eval $setvar
14196 ;;
14197esac
14198case "$d_gettimeod$d_ftime" in
14199"$undef$undef")
14200 echo " "
14201 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14202 ;;
14203esac
14204
10bc17b6
JH
14205: see if gmtime_r exists
14206set gmtime_r d_gmtime_r
14207eval $inlibc
14208case "$d_gmtime_r" in
14209"$define")
d63eadf0 14210 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14211 case "$d_gmtime_r_proto:$usethreads" in
14212 ":define") d_gmtime_r_proto=define
a48ec845
JH
14213 set d_gmtime_r_proto gmtime_r $hdrs
14214 eval $hasproto ;;
14215 *) ;;
14216 esac
14217 case "$d_gmtime_r_proto" in
14218 define)
10bc17b6
JH
14219 case "$gmtime_r_proto" in
14220 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14221 ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14222 esac
14223 case "$gmtime_r_proto" in
14224 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14225 ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14226 esac
14227 case "$gmtime_r_proto" in
90e831dc 14228 ''|0) d_gmtime_r=undef
10bc17b6 14229 gmtime_r_proto=0
a48ec845 14230 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14231 * ) case "$gmtime_r_proto" in
14232 REENTRANT_PROTO*) ;;
14233 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14234 esac
14235 echo "Prototype: $try" ;;
14236 esac
b4eb6b3d 14237 ;;
c18e646a
JH
14238 *) case "$usethreads" in
14239 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14240 esac
90e831dc
SB
14241 d_gmtime_r=undef
14242 gmtime_r_proto=0
c18e646a 14243 ;;
a48ec845
JH
14244 esac
14245 ;;
10bc17b6 14246*) gmtime_r_proto=0
b4eb6b3d
JH
14247 ;;
14248esac
14249
14250: see if hasmntopt exists
14251set hasmntopt d_hasmntopt
14252eval $inlibc
14253
14254: see if this is a netinet/in.h or sys/in.h system
14255set netinet/in.h i_niin sys/in.h i_sysin
14256eval $inhdr
14257
14258: see if arpa/inet.h has to be included
14259set arpa/inet.h i_arpainet
14260eval $inhdr
14261
14262: see if htonl --and friends-- exists
14263val=''
14264set htonl val
14265eval $inlibc
14266
14267: Maybe they are macros.
14268case "$val" in
14269$undef)
14270 $cat >htonl.c <<EOM
14271#include <stdio.h>
14272#include <sys/types.h>
14273#$i_niin I_NETINET_IN
14274#$i_sysin I_SYS_IN
14275#$i_arpainet I_ARPA_INET
14276#ifdef I_NETINET_IN
14277#include <netinet/in.h>
14278#endif
14279#ifdef I_SYS_IN
14280#include <sys/in.h>
14281#endif
14282#ifdef I_ARPA_INET
14283#include <arpa/inet.h>
14284#endif
14285#ifdef htonl
14286printf("Defined as a macro.");
14287#endif
14288EOM
14289 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14290 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14291 val="$define"
14292 echo "But it seems to be defined as a macro." >&4
14293 fi
14294 $rm -f htonl.?
14295 ;;
14296esac
14297set d_htonl
14298eval $setvar
14299
36adc09b
JH
14300: see if ilogbl exists
14301set ilogbl d_ilogbl
14302eval $inlibc
14303
b4eb6b3d
JH
14304: index or strchr
14305echo " "
14306if set index val -f; eval $csym; $val; then
14307 if set strchr val -f d_strchr; eval $csym; $val; then
14308 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14309 val="$define"
14310 vali="$undef"
14311 echo "strchr() found." >&4
14312 else
14313 val="$undef"
14314 vali="$define"
14315 echo "index() found." >&4
14316 fi
14317 else
14318 val="$undef"
14319 vali="$define"
8dfa8df9
JH
14320 echo "index() found." >&4
14321 fi
b4eb6b3d 14322else
8dfa8df9
JH
14323 if set strchr val -f d_strchr; eval $csym; $val; then
14324 val="$define"
14325 vali="$undef"
14326 echo "strchr() found." >&4
14327 else
14328 echo "No index() or strchr() found!" >&4
14329 val="$undef"
14330 vali="$undef"
14331 fi
b4eb6b3d 14332fi
8dfa8df9
JH
14333set d_strchr; eval $setvar
14334val="$vali"
14335set d_index; eval $setvar
14336
14337: check whether inet_aton exists
14338set inet_aton d_inetaton
14339eval $inlibc
b4eb6b3d
JH
14340
14341: Look for isascii
14342echo " "
36adc09b 14343$cat >isascii.c <<EOCP
b4eb6b3d
JH
14344#include <stdio.h>
14345#include <ctype.h>
55954f19
JH
14346#$i_stdlib I_STDLIB
14347#ifdef I_STDLIB
14348#include <stdlib.h>
14349#endif
b4eb6b3d
JH
14350int main() {
14351 int c = 'A';
14352 if (isascii(c))
14353 exit(0);
14354 else
14355 exit(1);
14356}
14357EOCP
14358set isascii
14359if eval $compile; then
14360 echo "isascii() found." >&4
14361 val="$define"
14362else
14363 echo "isascii() NOT found." >&4
14364 val="$undef"
14365fi
14366set d_isascii
14367eval $setvar
14368$rm -f isascii*
14369
758a5d79
JH
14370: see if isfinite exists
14371set isfinite d_isfinite
14372eval $inlibc
14373
14374: see if isinf exists
14375set isinf d_isinf
14376eval $inlibc
14377
b4eb6b3d
JH
14378: see if isnan exists
14379set isnan d_isnan
14380eval $inlibc
14381
14382: see if isnanl exists
14383set isnanl d_isnanl
14384eval $inlibc
14385
14386: see if killpg exists
14387set killpg d_killpg
14388eval $inlibc
14389
14390: see if lchown exists
14391echo " "
14392$cat > try.c <<'EOCP'
14393/* System header to define __stub macros and hopefully few prototypes,
14394 which can conflict with char lchown(); below. */
14395#include <assert.h>
14396/* Override any gcc2 internal prototype to avoid an error. */
14397/* We use char because int might match the return type of a gcc2
14398 builtin and then its argument prototype would still apply. */
14399char lchown();
14400int main() {
14401 /* The GNU C library defines this for functions which it implements
14402 to always fail with ENOSYS. Some functions are actually named
14403 something starting with __ and the normal name is an alias. */
14404#if defined (__stub_lchown) || defined (__stub___lchown)
14405choke me
14406#else
14407lchown();
14408#endif
14409; return 0; }
14410EOCP
14411set try
14412if eval $compile; then
14413 $echo "lchown() found." >&4
14414 val="$define"
14415else
14416 $echo "lchown() NOT found." >&4
14417 val="$undef"
14418fi
14419set d_lchown
14420eval $setvar
14421
14422: See if number of significant digits in a double precision number is known
14423echo " "
14424$cat >ldbl_dig.c <<EOM
14425#$i_limits I_LIMITS
14426#$i_float I_FLOAT
14427#ifdef I_LIMITS
14428#include <limits.h>
14429#endif
14430#ifdef I_FLOAT
14431#include <float.h>
14432#endif
14433#ifdef LDBL_DIG
14434printf("Contains LDBL_DIG");
14435#endif
14436EOM
14437$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14438if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14439 echo "LDBL_DIG found." >&4
14440 val="$define"
14441else
14442 echo "LDBL_DIG NOT found." >&4
14443 val="$undef"
14444fi
14445$rm -f ldbl_dig.?
14446set d_ldbl_dig
14447eval $setvar
14448
0a0abfba
MB
14449: see if this is a math.h system
14450set math.h i_math
14451eval $inhdr
14452
14453d_libm_lib_version="$undef"
14454case $i_math in
14455 $define)
14456 : check to see if math.h defines _LIB_VERSION
14457 echo " "
14458 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14459 $cat >try.c <<EOCP
14460#include <unistd.h>
14461#include <math.h>
14462int main (int argc, char *argv[])
14463{
14464 printf ("%d\n", _LIB_VERSION);
14465 return (0);
14466 } /* main */
14467EOCP
14468 set try
14469 if eval $compile; then
14470 foo=`$run ./try`
14471 echo "Yes, it does ($foo)" >&4
14472 d_libm_lib_version="$define"
14473 else
14474 echo "No, it does not (probably harmless)\n" >&4
14475 fi
14476 $rm -f try.* try core core.try.*
14477 ;;
14478
14479 esac
14480
b4eb6b3d
JH
14481: see if link exists
14482set link d_link
14483eval $inlibc
14484
10bc17b6
JH
14485: see if localtime_r exists
14486set localtime_r d_localtime_r
14487eval $inlibc
14488case "$d_localtime_r" in
14489"$define")
d63eadf0 14490 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14491 case "$d_localtime_r_proto:$usethreads" in
14492 ":define") d_localtime_r_proto=define
a48ec845
JH
14493 set d_localtime_r_proto localtime_r $hdrs
14494 eval $hasproto ;;
14495 *) ;;
14496 esac
14497 case "$d_localtime_r_proto" in
14498 define)
10bc17b6
JH
14499 case "$localtime_r_proto" in
14500 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14501 ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14502 esac
14503 case "$localtime_r_proto" in
14504 ''|0) try='int localtime_r(const time_t*, struct tm*);'
14505 ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14506 esac
14507 case "$localtime_r_proto" in
90e831dc 14508 ''|0) d_localtime_r=undef
10bc17b6 14509 localtime_r_proto=0
a48ec845 14510 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14511 * ) case "$localtime_r_proto" in
14512 REENTRANT_PROTO*) ;;
14513 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14514 esac
14515 echo "Prototype: $try" ;;
14516 esac
14517 ;;
c18e646a
JH
14518 *) case "$usethreads" in
14519 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14520 esac
90e831dc
SB
14521 d_localtime_r=undef
14522 localtime_r_proto=0
c18e646a 14523 ;;
a48ec845
JH
14524 esac
14525 ;;
10bc17b6
JH
14526*) localtime_r_proto=0
14527 ;;
14528esac
14529
8572b25d
BH
14530: see if localtime_r calls tzset
14531case "$localtime_r_proto" in
14532REENTRANT_PROTO*)
14533 $cat >try.c <<EOCP
14534/* Does our libc's localtime_r call tzset ?
14535 * return 0 if so, 1 otherwise.
14536 */
14537#include <sys/types.h>
14538#include <unistd.h>
14539#include <time.h>
14540#include <string.h>
14541#include <malloc.h>
14542int main()
14543{
14544 time_t t = time(0L);
14545 char w_tz[]="TZ" "=GMT+5",
14546 e_tz[]="TZ" "=GMT-5",
14547 *tz_e = (char*)malloc(16),
14548 *tz_w = (char*)malloc(16);
14549 struct tm tm_e, tm_w;
14550 memset(&tm_e,'\0',sizeof(struct tm));
14551 memset(&tm_w,'\0',sizeof(struct tm));
14552 strcpy(tz_e,e_tz);
14553 strcpy(tz_w,w_tz);
14554
14555 putenv(tz_e);
14556 localtime_r(&t, &tm_e);
14557
14558 putenv(tz_w);
14559 localtime_r(&t, &tm_w);
14560
14561 if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14562 return 1;
14563 return 0;
14564}
14565EOCP
14566 set try
14567 if eval $compile; then
14568 if ./try; then
14569 d_localtime_r_needs_tzset=undef;
14570 else
14571 d_localtime_r_needs_tzset=define;
14572 fi;
14573 else
14574 d_localtime_r_needs_tzset=undef;
14575 fi;
14576 ;;
14577 *)
14578 d_localtime_r_needs_tzset=undef;
14579 ;;
14580esac
14581$rm -f try try.* core
14582
b4eb6b3d
JH
14583: see if localeconv exists
14584set localeconv d_locconv
14585eval $inlibc
14586
14587: see if lockf exists
14588set lockf d_lockf
14589eval $inlibc
14590
b4eb6b3d
JH
14591: see if prototype for lseek is available
14592echo " "
4786929f 14593set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
14594eval $hasproto
14595
14596: see if lstat exists
14597set lstat d_lstat
14598eval $inlibc
14599
14600: see if madvise exists
14601set madvise d_madvise
14602eval $inlibc
14603
7dd121ae
MB
14604: see if malloc_size exists
14605set malloc_size d_malloc_size
14606eval $inlibc
14607
14608: see if malloc_size_good exists
14609set malloc_good_size d_malloc_good_size
14610eval $inlibc
14611
b4eb6b3d
JH
14612: see if mblen exists
14613set mblen d_mblen
14614eval $inlibc
14615
14616: see if mbstowcs exists
14617set mbstowcs d_mbstowcs
14618eval $inlibc
14619
14620: see if mbtowc exists
14621set mbtowc d_mbtowc
14622eval $inlibc
14623
14624: see if memchr exists
14625set memchr d_memchr
14626eval $inlibc
14627
14628: see if memcmp exists
14629set memcmp d_memcmp
14630eval $inlibc
14631
14632: see if memcpy exists
14633set memcpy d_memcpy
14634eval $inlibc
14635
14636: see if memmove exists
14637set memmove d_memmove
14638eval $inlibc
14639
14640: see if memset exists
14641set memset d_memset
14642eval $inlibc
14643
14644: see if mkdir exists
14645set mkdir d_mkdir
14646eval $inlibc
14647
14648: see if mkdtemp exists
14649set mkdtemp d_mkdtemp
14650eval $inlibc
14651
14652: see if mkfifo exists
14653set mkfifo d_mkfifo
14654eval $inlibc
14655
14656: see if mkstemp exists
14657set mkstemp d_mkstemp
14658eval $inlibc
14659
14660: see if mkstemps exists
14661set mkstemps d_mkstemps
14662eval $inlibc
14663
14664: see if mktime exists
14665set mktime d_mktime
14666eval $inlibc
14667
14668: see if this is a sys/mman.h system
14669set sys/mman.h i_sysmman
14670eval $inhdr
14671
14672: see if mmap exists
14673set mmap d_mmap
14674eval $inlibc
14675: see what shmat returns
14676: default to something harmless
14677mmaptype='void *'
14678case "$i_sysmman$d_mmap" in
14679"$define$define")
14680 $cat >mmap.c <<'END'
14681#include <sys/mman.h>
14682void *mmap();
14683END
14684 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14685 mmaptype='void *'
14686 else
14687 mmaptype='caddr_t'
14688 fi
14689 echo "and it returns ($mmaptype)." >&4
14690 ;;
14691esac
14692
14693
14694
89ce900e
JH
14695: see if sqrtl exists
14696set sqrtl d_sqrtl
14697eval $inlibc
14698
af1ff193
JH
14699: see if scalbnl exists
14700set scalbnl d_scalbnl
14701eval $inlibc
14702
89ce900e
JH
14703: see if modfl exists
14704set modfl d_modfl
14705eval $inlibc
14706
14707: see if prototype for modfl is available
14708echo " "
3a794506 14709set d_modflproto modfl $i_math math.h
89ce900e
JH
14710eval $hasproto
14711
14712d_modfl_pow32_bug="$undef"
14713
14714case "$d_longdbl$d_modfl" in
14715$define$define)
14716 $cat <<EOM
14717Checking to see whether your modfl() is okay for large values...
14718EOM
14719$cat >try.c <<EOCP
14720#include <math.h>
14721#include <stdio.h>
14722EOCP
14723if $test "X$d_modflproto" != "X$define"; then
14724 $cat >>try.c <<EOCP
14725/* Sigh. many current glibcs provide the function, but do not prototype it. */
14726long double modfl (long double, long double *);
14727EOCP
14728fi
14729$cat >>try.c <<EOCP
14730int main() {
14731 long double nv = 4294967303.15;
14732 long double v, w;
14733 v = modfl(nv, &w);
14734#ifdef __GLIBC__
14735 printf("glibc");
14736#endif
14737 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14738 return 0;
14739}
14740EOCP
14741 case "$osname:$gccversion" in
14742 aix:) saveccflags="$ccflags"
14743 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14744 esac
14745 set try
14746 if eval $compile; then
14747 foo=`$run ./try`
14748 case "$foo" in
14749 *" 4294967303.150000 1.150000 4294967302.000000")
14750 echo >&4 "Your modfl() is broken for large values."
14751 d_modfl_pow32_bug="$define"
14752 case "$foo" in
14753 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14754 ;;
14755 esac
14756 ;;
14757 *" 4294967303.150000 0.150000 4294967303.000000")
14758 echo >&4 "Your modfl() seems okay for large values."
14759 ;;
14760 *) echo >&4 "I don't understand your modfl() at all."
14761 d_modfl="$undef"
14762 ;;
14763 esac
14764 $rm -f try.* try core core.try.*
14765 else
14766 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14767 d_modfl="$undef"
14768 fi
14769 case "$osname:$gccversion" in
14770 aix:) ccflags="$saveccflags" ;; # restore
14771 esac
14772 ;;
14773esac
14774
14775if $test "$uselongdouble" = "$define"; then
af1ff193
JH
14776 message=""
14777 if $test "$d_sqrtl" != "$define"; then
14778 message="$message sqrtl"
14779 fi
14780 if $test "$d_modfl" != "$define"; then
89ce900e
JH
14781 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14782 echo "You have both aintl and copysignl, so I can emulate modfl."
14783 else
af1ff193 14784 message="$message modfl"
89ce900e 14785 fi
af1ff193
JH
14786 fi
14787 if $test "$d_frexpl" != "$define"; then
14788 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14789 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14790 else
14791 message="$message frexpl"
14792 fi
14793 fi
89ce900e 14794
af1ff193 14795 if $test "$message" != ""; then
89ce900e
JH
14796 $cat <<EOM >&4
14797
14798*** You requested the use of long doubles but you do not seem to have
af1ff193
JH
14799*** the following mathematical functions needed for long double support:
14800*** $message
fe63a0b4
JH
14801*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14802*** Cannot continue, aborting.
89ce900e
JH
14803
14804EOM
14805
fe63a0b4 14806 exit 1
89ce900e
JH
14807 fi
14808fi
14809
b4eb6b3d
JH
14810: see if mprotect exists
14811set mprotect d_mprotect
14812eval $inlibc
14813
14814: see if msgctl exists
14815set msgctl d_msgctl
14816eval $inlibc
14817
14818: see if msgget exists
14819set msgget d_msgget
14820eval $inlibc
14821
14822: see if msgsnd exists
14823set msgsnd d_msgsnd
14824eval $inlibc
14825
14826: see if msgrcv exists
14827set msgrcv d_msgrcv
14828eval $inlibc
14829
14830: see how much of the 'msg*(2)' library is present.
14831h_msg=true
14832echo " "
14833case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14834*"$undef"*) h_msg=false;;
14835esac
14836case "$osname" in
14837freebsd)
14838 case "`ipcs 2>&1`" in
14839 "SVID messages"*"not configured"*)
14840 echo "Your $osname does not have the msg*(2) configured." >&4
14841 h_msg=false
14842 val="$undef"
14843 set msgctl d_msgctl
14844 eval $setvar
14845 set msgget d_msgget
14846 eval $setvar
14847 set msgsnd d_msgsnd
14848 eval $setvar
14849 set msgrcv d_msgrcv
14850 eval $setvar
14851 ;;
14852 esac
14853 ;;
14854esac
14855: we could also check for sys/ipc.h ...
14856if $h_msg && $test `./findhdr sys/msg.h`; then
14857 echo "You have the full msg*(2) library." >&4
14858 val="$define"
14859else
14860 echo "You don't have the full msg*(2) library." >&4
14861 val="$undef"
14862fi
14863set d_msg
14864eval $setvar
14865
4e0554ec
JH
14866
14867echo " "
14868echo "Checking to see if your system supports struct msghdr..." >&4
14869set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14870eval $hasstruct
14871case "$d_msghdr_s" in
14872"$define") echo "Yes, it does." ;;
14873*) echo "No, it doesn't." ;;
14874esac
14875
14876
b4eb6b3d
JH
14877: see if msync exists
14878set msync d_msync
14879eval $inlibc
14880
14881: see if munmap exists
14882set munmap d_munmap
14883eval $inlibc
14884
14885: see if nice exists
14886set nice d_nice
14887eval $inlibc
14888
2765b840
JH
14889: see if this is a langinfo.h system
14890set langinfo.h i_langinfo
14891eval $inhdr
14892
14893: see if nl_langinfo exists
14894set nl_langinfo d_nl_langinfo
14895eval $inlibc
14896
b4eb6b3d
JH
14897: check for length of character
14898echo " "
14899case "$charsize" in
14900'')
14901 echo "Checking to see how big your characters are (hey, you never know)..." >&4
74d00865 14902 $cat >try.c <<EOCP
b4eb6b3d 14903#include <stdio.h>
d1daaddf
JH
14904#$i_stdlib I_STDLIB
14905#ifdef I_STDLIB
14906#include <stdlib.h>
14907#endif
b4eb6b3d
JH
14908int main()
14909{
14910 printf("%d\n", (int)sizeof(char));
14911 exit(0);
14912}
14913EOCP
14914 set try
14915 if eval $compile_ok; then
5440bc8e 14916 dflt=`$run ./try`
b4eb6b3d
JH
14917 else
14918 dflt='1'
14919 echo "(I can't seem to compile the test program. Guessing...)"
14920 fi
14921 ;;
14922*)
14923 dflt="$charsize"
14924 ;;
14925esac
14926rp="What is the size of a character (in bytes)?"
14927. ./myread
14928charsize="$ans"
14929$rm -f try.c try
14930
1d1be0dc
NC
14931: check for volatile keyword
14932echo " "
14933echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14934$cat >try.c <<'EOCP'
76f47787 14935int main()
1d1be0dc
NC
14936{
14937 typedef struct _goo_struct goo_struct;
14938 goo_struct * volatile goo = ((goo_struct *)0);
14939 struct _goo_struct {
14940 long long_int;
14941 int reg_int;
14942 char char_var;
14943 };
14944 typedef unsigned short foo_t;
14945 char *volatile foo;
14946 volatile int bar;
14947 volatile foo_t blech;
14948 foo = foo;
14949}
14950EOCP
14951if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14952 val="$define"
14953 echo "Yup, it does."
14954else
14955 val="$undef"
14956 echo "Nope, it doesn't."
14957fi
14958set d_volatile
14959eval $setvar
14960$rm -f try.*
14961
b4eb6b3d
JH
14962
14963echo " "
14964$echo "Choosing the C types to be used for Perl's internal types..." >&4
14965
14966case "$use64bitint:$d_quad:$quadtype" in
14967define:define:?*)
14968 ivtype="$quadtype"
14969 uvtype="$uquadtype"
14970 ivsize=8
14971 uvsize=8
14972 ;;
14973*) ivtype="long"
14974 uvtype="unsigned long"
14975 ivsize=$longsize
14976 uvsize=$longsize
14977 ;;
14978esac
14979
14980case "$uselongdouble:$d_longdbl" in
14981define:define)
14982 nvtype="long double"
14983 nvsize=$longdblsize
14984 ;;
14985*) nvtype=double
14986 nvsize=$doublesize
14987 ;;
14988esac
14989
14990$echo "(IV will be "$ivtype", $ivsize bytes)"
14991$echo "(UV will be "$uvtype", $uvsize bytes)"
14992$echo "(NV will be "$nvtype", $nvsize bytes)"
14993
14994$cat >try.c <<EOCP
14995#$i_inttypes I_INTTYPES
14996#ifdef I_INTTYPES
14997#include <inttypes.h>
14998#endif
14999#include <stdio.h>
15000int main() {
15001#ifdef INT8
15002 int8_t i = INT8_MAX;
15003 uint8_t u = UINT8_MAX;
15004 printf("int8_t\n");
15005#endif
15006#ifdef INT16
15007 int16_t i = INT16_MAX;
15008 uint16_t i = UINT16_MAX;
15009 printf("int16_t\n");
15010#endif
15011#ifdef INT32
15012 int32_t i = INT32_MAX;
15013 uint32_t u = UINT32_MAX;
15014 printf("int32_t\n");
15015#endif
15016}
15017EOCP
15018
15019case "$i8type" in
15020'') case "$charsize" in
15021 1) i8type=char
15022 u8type="unsigned char"
15023 i8size=$charsize
15024 u8size=$charsize
15025 ;;
15026 esac
15027 ;;
15028esac
15029case "$i8type" in
15030'') set try -DINT8
15031 if eval $compile; then
5440bc8e 15032 case "`$run ./try`" in
b4eb6b3d
JH
15033 int8_t) i8type=int8_t
15034 u8type=uint8_t
15035 i8size=1
15036 u8size=1
15037 ;;
15038 esac
15039 fi
15040 ;;
15041esac
15042case "$i8type" in
15043'') if $test $charsize -ge 1; then
15044 i8type=char
15045 u8type="unsigned char"
15046 i8size=$charsize
15047 u8size=$charsize
15048 fi
15049 ;;
15050esac
15051
15052case "$i16type" in
15053'') case "$shortsize" in
15054 2) i16type=short
15055 u16type="unsigned short"
15056 i16size=$shortsize
15057 u16size=$shortsize
15058 ;;
15059 esac
15060 ;;
15061esac
15062case "$i16type" in
15063'') set try -DINT16
15064 if eval $compile; then
5440bc8e 15065 case "`$run ./try`" in
b4eb6b3d
JH
15066 int16_t)
15067 i16type=int16_t
15068 u16type=uint16_t
15069 i16size=2
15070 u16size=2
15071 ;;
15072 esac
15073 fi
15074 ;;
15075esac
15076case "$i16type" in
15077'') if $test $shortsize -ge 2; then
15078 i16type=short
15079 u16type="unsigned short"
15080 i16size=$shortsize
15081 u16size=$shortsize
15082 fi
15083 ;;
15084esac
15085
15086case "$i32type" in
15087'') case "$longsize" in
15088 4) i32type=long
15089 u32type="unsigned long"
15090 i32size=$longsize
15091 u32size=$longsize
15092 ;;
15093 *) case "$intsize" in
15094 4) i32type=int
15095 u32type="unsigned int"
15096 i32size=$intsize
15097 u32size=$intsize
15098 ;;
15099 esac
15100 ;;
15101 esac
15102 ;;
15103esac
15104case "$i32type" in
15105'') set try -DINT32
15106 if eval $compile; then
5440bc8e 15107 case "`$run ./try`" in
b4eb6b3d
JH
15108 int32_t)
15109 i32type=int32_t
15110 u32type=uint32_t
15111 i32size=4
15112 u32size=4
15113 ;;
15114 esac
15115 fi
15116 ;;
15117esac
15118case "$i32type" in
15119'') if $test $intsize -ge 4; then
15120 i32type=int
15121 u32type="unsigned int"
15122 i32size=$intsize
15123 u32size=$intsize
15124 fi
15125 ;;
15126esac
15127
15128case "$i64type" in
15129'') case "$d_quad:$quadtype" in
15130 define:?*)
15131 i64type="$quadtype"
15132 u64type="$uquadtype"
15133 i64size=8
15134 u64size=8
15135 ;;
15136 esac
15137 ;;
15138esac
15139
1d1be0dc
NC
15140$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15141: volatile so that the compiler has to store it out to memory.
15142if test X"$d_volatile" = X"$define"; then
15143 volatile=volatile
15144fi
b4eb6b3d
JH
15145$cat <<EOP >try.c
15146#include <stdio.h>
55954f19
JH
15147#$i_stdlib I_STDLIB
15148#ifdef I_STDLIB
15149#include <stdlib.h>
15150#endif
1d1be0dc
NC
15151#include <sys/types.h>
15152#include <signal.h>
15153#ifdef SIGFPE
15154$volatile int bletched = 0;
7090f861 15155$signal_t blech(int s) { bletched = 1; }
1d1be0dc 15156#endif
b4eb6b3d
JH
15157int main() {
15158 $uvtype u = 0;
1d1be0dc 15159 $nvtype d;
b4eb6b3d
JH
15160 int n = 8 * $uvsize;
15161 int i;
1d1be0dc
NC
15162#ifdef SIGFPE
15163 signal(SIGFPE, blech);
15164#endif
15165
b4eb6b3d
JH
15166 for (i = 0; i < n; i++) {
15167 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
15168 d = ($nvtype)u;
15169 if (($uvtype)d != u)
b4eb6b3d 15170 break;
1d1be0dc
NC
15171 if (d <= 0)
15172 break;
15173 d = ($nvtype)(u - 1);
15174 if (($uvtype)d != (u - 1))
15175 break;
15176#ifdef SIGFPE
15177 if (bletched) {
15178 break;
15179#endif
15180 }
b4eb6b3d 15181 }
efd1522b 15182 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
15183 exit(0);
15184}
15185EOP
1d1be0dc
NC
15186set try
15187
15188d_nv_preserves_uv="$undef"
15189if eval $compile; then
53133ed1 15190 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 15191fi
53133ed1 15192case "$nv_preserves_uv_bits" in
1d1be0dc 15193\-[1-9]*)
53133ed1
NC
15194 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15195 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 15196 d_nv_preserves_uv="$define"
b4eb6b3d 15197 ;;
53133ed1 15198[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
15199 d_nv_preserves_uv="$undef" ;;
15200*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
53133ed1 15201 nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
15202esac
15203
1d1be0dc
NC
15204$rm -f try.* try
15205
f607920a
CB
15206$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15207: volatile so that the compiler has to store it out to memory.
15208if test X"$d_volatile" = X"$define"; then
15209 volatile=volatile
15210fi
15211$cat <<EOP >try.c
15212#include <stdio.h>
15213#$i_stdlib I_STDLIB
15214#ifdef I_STDLIB
15215#include <stdlib.h>
15216#endif
15217#$i_string I_STRING
15218#ifdef I_STRING
15219# include <string.h>
15220#else
15221# include <strings.h>
15222#endif
15223#include <sys/types.h>
15224#include <signal.h>
15225#ifdef SIGFPE
15226$volatile int bletched = 0;
7090f861 15227$signal_t blech(int s) { bletched = 1; }
f607920a
CB
15228#endif
15229
15230int checkit($nvtype d, char *where) {
15231 unsigned char *p = (char *)&d;
15232 unsigned char *end = p + sizeof(d);
15233 int fail = 0;
15234
15235 while (p < end)
15236 fail += *p++;
15237
15238 if (!fail)
17f6277d 15239 return 0;
f607920a
CB
15240
15241 p = (char *)&d;
15242 printf("No - %s: 0x", where);
15243 while (p < end)
15244 printf ("%02X", *p++);
15245 printf("\n");
15246 return 1;
15247}
15248
15249int main(int argc, char **argv) {
15250 $nvtype d = 0.0;
15251 int fail = 0;
15252 fail += checkit(d, "0.0");
15253
15254 /* The compiler shouldn't be assuming that bletched is 0 */
15255 d = bletched;
15256
15257 fail += checkit(d, "bleched");
15258
15259#ifdef SIGFPE
15260 signal(SIGFPE, blech);
15261#endif
15262
15263 /* Paranoia - the compiler should have no way of knowing that ANSI says
15264 that argv[argc] will always be NULL. Actually, if it did assume this it
15265 would be buggy, as this is C and main() can be called from elsewhere in
15266 the program. */
15267 d = argv[argc] ? 1 : 0;
15268
15269 if (d) {
15270 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15271 }
15272
15273 fail += checkit(d, "ternary");
15274
15275 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15276
15277 if (d != 0.0) {
15278 printf("No - memset doesn't give 0.0\n");
15279 /* This might just blow up: */
15280 printf("(gives %g)\n", d);
15281 return 1;
15282 }
15283
15284#ifdef SIGFPE
15285 if (bletched) {
15286 printf("No - something bleched\n");
15287 return 1;
15288 }
15289#endif
15290 if (fail) {
15291 printf("No - %d fail(s)\n", fail);
15292 return 1;
15293 }
15294 printf("Yes\n");
15295 return 0;
15296}
15297EOP
15298set try
15299
15300d_nv_zero_is_allbits_zero="$undef"
15301if eval $compile; then
15302 xxx="`$run ./try`"
15303 case "$?" in
15304 0)
15305 case "$xxx" in
15306 Yes) cat >&4 <<EOM
153070.0 is represented as all bits zero in memory
15308EOM
15309 d_nv_zero_is_allbits_zero="$define"
15310 ;;
15311 *) cat >&4 <<EOM
153120.0 is not represented as all bits zero in memory
15313EOM
15314 d_nv_zero_is_allbits_zero="$undef"
15315 ;;
15316 esac
15317 ;;
15318 *) cat >&4 <<EOM
153190.0 is not represented as all bits zero in memory
15320EOM
15321 d_nv_zero_is_allbits_zero="$undef"
15322 ;;
15323 esac
15324fi
15325
15326$rm -f try.* try
15327
b4eb6b3d
JH
15328
15329: check for off64_t
15330echo " "
15331echo "Checking to see if you have off64_t..." >&4
15332$cat >try.c <<EOCP
15333#include <sys/types.h>
15334#include <unistd.h>
15335int main() { off64_t x = 7; }
15336EOCP
15337set try
15338if eval $compile; then
15339 val="$define"
15340 echo "You have off64_t."
15341else
15342 val="$undef"
15343 echo "You do not have off64_t."
15344 case "$lseeksize" in
15345 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15346 esac
15347fi
15348$rm -f try.* try
15349set d_off64_t
15350eval $setvar
15351
b4eb6b3d
JH
15352: how to create joinable pthreads
15353if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15354 echo " "
15355 echo "Checking what constant to use for creating joinable pthreads..." >&4
15356 $cat >try.c <<'EOCP'
15357#include <pthread.h>
15358int main() {
15359 int detachstate = JOINABLE;
15360}
15361EOCP
15362 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15363 if eval $compile; then
15364 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15365 val="$undef" # Yes, undef.
15366 set d_old_pthread_create_joinable
15367 eval $setvar
15368 val=""
15369 set old_pthread_create_joinable
15370 eval $setvar
15371 else
15372 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15373 if eval $compile; then
15374 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15375 val="$define"
15376 set d_old_pthread_create_joinable
15377 eval $setvar
15378 val=PTHREAD_CREATE_UNDETACHED
15379 set old_pthread_create_joinable
15380 eval $setvar
15381 else
15382 set try -DJOINABLE=__UNDETACHED
15383 if eval $compile; then
15384 echo "You seem to use __UNDETACHED." >&4
15385 val="$define"
15386 set d_old_pthread_create_joinable
15387 eval $setvar
15388 val=__UNDETACHED
15389 set old_pthread_create_joinable
15390 eval $setvar
15391 else
15392 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
15393 val="$define"
15394 set d_old_pthread_create_joinable
15395 eval $setvar
15396 val=0
15397 set old_pthread_create_joinable
15398 eval $setvar
15399 fi
15400 fi
15401 fi
15402 $rm -f try try.*
15403else
15404 d_old_pthread_create_joinable="$undef"
15405 old_pthread_create_joinable=""
15406fi
15407
15408: see if pause exists
15409set pause d_pause
15410eval $inlibc
15411
15412: see if pipe exists
15413set pipe d_pipe
15414eval $inlibc
15415
15416: see if poll exists
15417set poll d_poll
15418eval $inlibc
15419
c7aff470
NIS
15420: see if readlink exists
15421set readlink d_readlink
15422eval $inlibc
15423
15424echo " "
f24dbf84 15425procselfexe=''
c7aff470 15426val="$undef"
a33c94aa
JH
15427case "$d_readlink" in
15428"$define")
c7aff470
NIS
15429 if $issymlink /proc/self/exe ; then
15430 $ls -l /proc/self/exe > reflect
51660ed5 15431 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 15432 echo "You have Linux-like /proc/self/exe."
92236451 15433 procselfexe='"/proc/self/exe"'
f24dbf84 15434 val="$define"
f24dbf84
JH
15435 fi
15436 fi
15437 if $issymlink /proc/curproc/file ; then
15438 $ls -l /proc/curproc/file > reflect
15439 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15440 echo "You have BSD-like /proc/curproc/file."
92236451 15441 procselfexe='"/proc/curproc/file"'
f24dbf84 15442 val="$define"
c7aff470 15443 fi
c7aff470 15444 fi
a33c94aa
JH
15445 ;;
15446esac
428dc699 15447$rm -f reflect
c7aff470
NIS
15448set d_procselfexe
15449eval $setvar
15450
263fee3f
JH
15451: see whether the pthread_atfork exists
15452$cat >try.c <<EOP
15453#include <pthread.h>
15454#include <stdio.h>
15455int main() {
15456#ifdef PTHREAD_ATFORK
15457 pthread_atfork(NULL,NULL,NULL);
15458#endif
15459}
15460EOP
15461
d6483fcc 15462: see if pthread_atfork exists
263fee3f
JH
15463set try -DPTHREAD_ATFORK
15464if eval $compile; then
15465 val="$define"
15466else
15467 val="$undef"
15468fi
15469case "$usethreads" in
15470$define)
15471 case "$val" in
15472 $define) echo 'pthread_atfork found.' >&4 ;;
15473 *) echo 'pthread_atfork NOT found.' >&4 ;;
15474 esac
15475esac
15476set d_pthread_atfork
15477eval $setvar
d6483fcc 15478
58d975c3
JH
15479: see if pthread_attr_setscope exists
15480set pthread_attr_setscope d_pthread_attr_setscope
15481eval $inlibc
15482
b4eb6b3d
JH
15483
15484: see whether the various POSIXish _yields exist
15485$cat >try.c <<EOP
15486#include <pthread.h>
15487#include <stdio.h>
15488int main() {
15489#ifdef SCHED_YIELD
15490 sched_yield();
15491#else
15492#ifdef PTHREAD_YIELD
15493 pthread_yield();
15494#else
15495#ifdef PTHREAD_YIELD_NULL
15496 pthread_yield(NULL);
15497#endif
15498#endif
15499#endif
15500}
15501EOP
15502: see if sched_yield exists
15503set try -DSCHED_YIELD
15504if eval $compile; then
15505 val="$define"
15506 sched_yield='sched_yield()'
15507else
15508 val="$undef"
15509fi
15510case "$usethreads" in
15511$define)
15512 case "$val" in
15513 $define) echo 'sched_yield() found.' >&4 ;;
15514 *) echo 'sched_yield() NOT found.' >&4 ;;
15515 esac
15516esac
10bc17b6
JH
15517set d_sched_yield
15518eval $setvar
b4eb6b3d 15519
10bc17b6
JH
15520: see if pthread_yield exists
15521set try -DPTHREAD_YIELD
15522if eval $compile; then
15523 val="$define"
15524 case "$sched_yield" in
15525 '') sched_yield='pthread_yield()' ;;
15526 esac
15527else
15528 set try -DPTHREAD_YIELD_NULL
15529 if eval $compile; then
15530 val="$define"
15531 case "$sched_yield" in
15532 '') sched_yield='pthread_yield(NULL)' ;;
15533 esac
15534 else
15535 val="$undef"
15536 fi
15537fi
15538case "$usethreads" in
15539$define)
15540 case "$val" in
15541 $define) echo 'pthread_yield() found.' >&4 ;;
15542 *) echo 'pthread_yield() NOT found.' >&4 ;;
15543 esac
15544 ;;
15545esac
15546set d_pthread_yield
15547eval $setvar
b4eb6b3d 15548
10bc17b6
JH
15549case "$sched_yield" in
15550'') sched_yield=undef ;;
15551esac
b4eb6b3d 15552
10bc17b6
JH
15553$rm -f try try.*
15554
15555: see if random_r exists
15556set random_r d_random_r
15557eval $inlibc
15558case "$d_random_r" in
15559"$define")
15560 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
15561 case "$d_random_r_proto:$usethreads" in
15562 ":define") d_random_r_proto=define
a48ec845
JH
15563 set d_random_r_proto random_r $hdrs
15564 eval $hasproto ;;
15565 *) ;;
15566 esac
15567 case "$d_random_r_proto" in
15568 define)
10bc17b6
JH
15569 case "$random_r_proto" in
15570 ''|0) try='int random_r(int*, struct random_data*);'
a845a0d4
JH
15571 ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15572 esac
15573 case "$random_r_proto" in
15574 ''|0) try='int random_r(long*, struct random_data*);'
15575 ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15576 esac
15577 case "$random_r_proto" in
15578 ''|0) try='int random_r(struct random_data*, int32_t*);'
15579 ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
15580 esac
15581 case "$random_r_proto" in
90e831dc 15582 ''|0) d_random_r=undef
10bc17b6 15583 random_r_proto=0
a48ec845 15584 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15585 * ) case "$random_r_proto" in
15586 REENTRANT_PROTO*) ;;
15587 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15588 esac
15589 echo "Prototype: $try" ;;
15590 esac
b4eb6b3d 15591 ;;
c18e646a
JH
15592 *) case "$usethreads" in
15593 define) echo "random_r has no prototype, not using it." >&4 ;;
15594 esac
90e831dc
SB
15595 d_random_r=undef
15596 random_r_proto=0
c18e646a 15597 ;;
a48ec845
JH
15598 esac
15599 ;;
10bc17b6 15600*) random_r_proto=0
b4eb6b3d
JH
15601 ;;
15602esac
15603
15604: see if readdir and friends exist
15605set readdir d_readdir
15606eval $inlibc
15607set seekdir d_seekdir
15608eval $inlibc
15609set telldir d_telldir
15610eval $inlibc
15611set rewinddir d_rewinddir
15612eval $inlibc
15613
10bc17b6
JH
15614: see if readdir64_r exists
15615set readdir64_r d_readdir64_r
15616eval $inlibc
15617case "$d_readdir64_r" in
15618"$define")
15619 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15620 case "$d_readdir64_r_proto:$usethreads" in
15621 ":define") d_readdir64_r_proto=define
a48ec845
JH
15622 set d_readdir64_r_proto readdir64_r $hdrs
15623 eval $hasproto ;;
15624 *) ;;
15625 esac
15626 case "$d_readdir64_r_proto" in
15627 define)
10bc17b6
JH
15628 case "$readdir64_r_proto" in
15629 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15630 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15631 esac
15632 case "$readdir64_r_proto" in
15633 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15634 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15635 esac
15636 case "$readdir64_r_proto" in
90e831dc 15637 ''|0) d_readdir64_r=undef
10bc17b6 15638 readdir64_r_proto=0
a48ec845 15639 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15640 * ) case "$readdir64_r_proto" in
15641 REENTRANT_PROTO*) ;;
15642 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15643 esac
15644 echo "Prototype: $try" ;;
15645 esac
15646 ;;
c18e646a
JH
15647 *) case "$usethreads" in
15648 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15649 esac
90e831dc
SB
15650 d_readdir64_r=undef
15651 readdir64_r_proto=0
c18e646a 15652 ;;
a48ec845
JH
15653 esac
15654 ;;
10bc17b6
JH
15655*) readdir64_r_proto=0
15656 ;;
15657esac
15658
15659: see if readdir_r exists
15660set readdir_r d_readdir_r
15661eval $inlibc
15662case "$d_readdir_r" in
15663"$define")
15664 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15665 case "$d_readdir_r_proto:$usethreads" in
15666 ":define") d_readdir_r_proto=define
a48ec845
JH
15667 set d_readdir_r_proto readdir_r $hdrs
15668 eval $hasproto ;;
15669 *) ;;
15670 esac
15671 case "$d_readdir_r_proto" in
15672 define)
10bc17b6
JH
15673 case "$readdir_r_proto" in
15674 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15675 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15676 esac
15677 case "$readdir_r_proto" in
15678 ''|0) try='int readdir_r(DIR*, struct dirent*);'
15679 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15680 esac
15681 case "$readdir_r_proto" in
90e831dc 15682 ''|0) d_readdir_r=undef
10bc17b6 15683 readdir_r_proto=0
a48ec845 15684 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15685 * ) case "$readdir_r_proto" in
15686 REENTRANT_PROTO*) ;;
15687 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15688 esac
15689 echo "Prototype: $try" ;;
15690 esac
15691 ;;
c18e646a
JH
15692 *) case "$usethreads" in
15693 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15694 esac
90e831dc
SB
15695 d_readdir_r=undef
15696 readdir_r_proto=0
c18e646a 15697 ;;
a48ec845
JH
15698 esac
15699 ;;
10bc17b6
JH
15700*) readdir_r_proto=0
15701 ;;
15702esac
15703
4e0554ec
JH
15704: see if readv exists
15705set readv d_readv
15706eval $inlibc
15707
15708: see if recvmsg exists
15709set recvmsg d_recvmsg
15710eval $inlibc
15711
b4eb6b3d
JH
15712: see if rename exists
15713set rename d_rename
15714eval $inlibc
15715
15716: see if rmdir exists
15717set rmdir d_rmdir
15718eval $inlibc
15719
15720: see if memory.h is available.
15721val=''
15722set memory.h val
15723eval $inhdr
15724
15725: See if it conflicts with string.h
15726case "$val" in
15727$define)
15728 case "$strings" in
15729 '') ;;
15730 *)
15731 $cppstdin $cppflags $cppminus < $strings > mem.h
15732 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15733 echo " "
15734 echo "We won't be including <memory.h>."
15735 val="$undef"
15736 fi
15737 $rm -f mem.h
15738 ;;
15739 esac
15740esac
15741set i_memory
15742eval $setvar
15743
15744: can bcopy handle overlapping blocks?
b6cc3bc4 15745echo " "
b4eb6b3d 15746val="$undef"
b6cc3bc4
AD
15747case "$d_memmove" in
15748"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15749*) case "$d_bcopy" in
15750 "$define")
15751 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15752 $cat >try.c <<EOCP
b4eb6b3d
JH
15753#$i_memory I_MEMORY
15754#$i_stdlib I_STDLIB
15755#$i_string I_STRING
15756#$i_unistd I_UNISTD
15757EOCP
15758 $cat >>try.c <<'EOCP'
15759#include <stdio.h>
15760#ifdef I_MEMORY
15761# include <memory.h>
15762#endif
15763#ifdef I_STDLIB
15764# include <stdlib.h>
15765#endif
15766#ifdef I_STRING
15767# include <string.h>
15768#else
15769# include <strings.h>
15770#endif
15771#ifdef I_UNISTD
15772# include <unistd.h> /* Needed for NetBSD */
15773#endif
15774int main()
15775{
15776char buf[128], abc[128];
15777char *b;
15778int len;
15779int off;
15780int align;
15781
b6cc3bc4
AD
15782/* Copy "abcde..." string to char abc[] so that gcc doesn't
15783 try to store the string in read-only memory. */
b4eb6b3d
JH
15784bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15785
15786for (align = 7; align >= 0; align--) {
15787 for (len = 36; len; len--) {
15788 b = buf+align;
15789 bcopy(abc, b, len);
15790 for (off = 1; off <= len; off++) {
15791 bcopy(b, b+off, len);
15792 bcopy(b+off, b, len);
15793 if (bcmp(b, abc, len))
15794 exit(1);
15795 }
15796 }
15797}
15798exit(0);
15799}
15800EOCP
b6cc3bc4
AD
15801 set try
15802 if eval $compile_ok; then
15803 if ./try 2>/dev/null; then
15804 echo "Yes, it can."
15805 val="$define"
15806 else
15807 echo "It can't, sorry."
15808 fi
b4eb6b3d 15809 else
b6cc3bc4 15810 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15811 fi
b6cc3bc4
AD
15812 ;;
15813 esac
15814 $rm -f try.* try core
b4eb6b3d
JH
15815 ;;
15816esac
b4eb6b3d
JH
15817set d_safebcpy
15818eval $setvar
15819
15820: can memcpy handle overlapping blocks?
b6cc3bc4 15821echo " "
b4eb6b3d 15822val="$undef"
b6cc3bc4
AD
15823case "$d_memmove" in
15824"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15825*) case "$d_memcpy" in
15826 "$define")
15827 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15828 $cat >try.c <<EOCP
b4eb6b3d
JH
15829#$i_memory I_MEMORY
15830#$i_stdlib I_STDLIB
15831#$i_string I_STRING
15832#$i_unistd I_UNISTD
15833EOCP
15834 $cat >>try.c <<'EOCP'
15835#include <stdio.h>
15836#ifdef I_MEMORY
15837# include <memory.h>
15838#endif
15839#ifdef I_STDLIB
15840# include <stdlib.h>
15841#endif
15842#ifdef I_STRING
15843# include <string.h>
15844#else
15845# include <strings.h>
15846#endif
15847#ifdef I_UNISTD
15848# include <unistd.h> /* Needed for NetBSD */
15849#endif
15850int main()
15851{
15852char buf[128], abc[128];
15853char *b;
15854int len;
15855int off;
15856int align;
15857
15858/* Copy "abcde..." string to char abc[] so that gcc doesn't
15859 try to store the string in read-only memory. */
15860memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15861
15862for (align = 7; align >= 0; align--) {
15863 for (len = 36; len; len--) {
15864 b = buf+align;
15865 memcpy(b, abc, len);
15866 for (off = 1; off <= len; off++) {
15867 memcpy(b+off, b, len);
15868 memcpy(b, b+off, len);
15869 if (memcmp(b, abc, len))
15870 exit(1);
15871 }
15872 }
15873}
15874exit(0);
15875}
15876EOCP
b6cc3bc4
AD
15877 set try
15878 if eval $compile_ok; then
15879 if ./try 2>/dev/null; then
15880 echo "Yes, it can."
15881 val="$define"
15882 else
15883 echo "It can't, sorry."
15884 fi
b4eb6b3d 15885 else
b6cc3bc4 15886 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15887 fi
b6cc3bc4
AD
15888 ;;
15889 esac
15890 $rm -f try.* try core
b4eb6b3d
JH
15891 ;;
15892esac
b4eb6b3d
JH
15893set d_safemcpy
15894eval $setvar
15895
15896: can memcmp be trusted to compare relative magnitude?
15897val="$undef"
15898case "$d_memcmp" in
15899"$define")
15900 echo " "
15901 echo "Checking if your memcmp() can compare relative magnitude..." >&4
15902 $cat >try.c <<EOCP
15903#$i_memory I_MEMORY
15904#$i_stdlib I_STDLIB
15905#$i_string I_STRING
15906#$i_unistd I_UNISTD
15907EOCP
15908 $cat >>try.c <<'EOCP'
15909#include <stdio.h>
15910#ifdef I_MEMORY
15911# include <memory.h>
15912#endif
15913#ifdef I_STDLIB
36adc09b 15914# include <stdlib.h>
b4eb6b3d
JH
15915#endif
15916#ifdef I_STRING
15917# include <string.h>
15918#else
15919# include <strings.h>
15920#endif
15921#ifdef I_UNISTD
15922# include <unistd.h> /* Needed for NetBSD */
15923#endif
15924int main()
15925{
15926char a = -1;
15927char b = 0;
15928if ((a < b) && memcmp(&a, &b, 1) < 0)
15929 exit(1);
15930exit(0);
15931}
15932EOCP
15933 set try
15934 if eval $compile_ok; then
5440bc8e 15935 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
15936 echo "Yes, it can."
15937 val="$define"
15938 else
15939 echo "No, it can't (it uses signed chars)."
15940 fi
15941 else
15942 echo "(I can't compile the test program, so we'll assume not...)"
15943 fi
15944 ;;
15945esac
15946$rm -f try.* try core
15947set d_sanemcmp
15948eval $setvar
15949
ef9f17be
JH
15950: see if prototype for sbrk is available
15951echo " "
15952set d_sbrkproto sbrk $i_unistd unistd.h
15953eval $hasproto
15954
b4eb6b3d
JH
15955: see if select exists
15956set select d_select
15957eval $inlibc
15958
15959: see if semctl exists
15960set semctl d_semctl
15961eval $inlibc
15962
15963: see if semget exists
15964set semget d_semget
15965eval $inlibc
15966
15967: see if semop exists
15968set semop d_semop
15969eval $inlibc
15970
15971: see how much of the 'sem*(2)' library is present.
15972h_sem=true
15973echo " "
15974case "$d_semctl$d_semget$d_semop" in
15975*"$undef"*) h_sem=false;;
15976esac
15977case "$osname" in
15978freebsd)
15979 case "`ipcs 2>&1`" in
15980 "SVID messages"*"not configured"*)
15981 echo "Your $osname does not have the sem*(2) configured." >&4
15982 h_sem=false
15983 val="$undef"
15984 set semctl d_semctl
15985 eval $setvar
15986 set semget d_semget
15987 eval $setvar
15988 set semop d_semop
15989 eval $setvar
15990 ;;
15991 esac
15992 ;;
15993esac
15994: we could also check for sys/ipc.h ...
15995if $h_sem && $test `./findhdr sys/sem.h`; then
15996 echo "You have the full sem*(2) library." >&4
15997 val="$define"
15998else
15999 echo "You don't have the full sem*(2) library." >&4
16000 val="$undef"
16001fi
16002set d_sem
16003eval $setvar
16004
16005: see whether sys/sem.h defines union semun
16006echo " "
16007$cat > try.c <<'END'
16008#include <sys/types.h>
16009#include <sys/ipc.h>
16010#include <sys/sem.h>
16011int main () { union semun semun; semun.buf = 0; }
16012END
16013set try
16014if eval $compile; then
16015 echo "You have union semun in <sys/sem.h>." >&4
16016 val="$define"
16017else
16018 echo "You do not have union semun in <sys/sem.h>." >&4
16019 val="$undef"
16020fi
2fad75a1 16021$rm -f try try.c
b4eb6b3d
JH
16022set d_union_semun
16023eval $setvar
16024
16025: see how to do semctl IPC_STAT
16026case "$d_sem" in
16027$define)
b4eb6b3d
JH
16028 echo " "
16029 $cat > try.h <<END
16030#ifndef S_IRUSR
16031# ifdef S_IREAD
16032# define S_IRUSR S_IREAD
16033# define S_IWUSR S_IWRITE
16034# define S_IXUSR S_IEXEC
16035# else
16036# define S_IRUSR 0400
16037# define S_IWUSR 0200
16038# define S_IXUSR 0100
16039# endif
16040# define S_IRGRP (S_IRUSR>>3)
16041# define S_IWGRP (S_IWUSR>>3)
16042# define S_IXGRP (S_IXUSR>>3)
16043# define S_IROTH (S_IRUSR>>6)
16044# define S_IWOTH (S_IWUSR>>6)
16045# define S_IXOTH (S_IXUSR>>6)
16046#endif
16047#ifndef S_IRWXU
16048# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16049# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16050# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16051#endif
16052END
2fad75a1 16053 : see whether semctl IPC_STAT can use union semun
2fad75a1
JH
16054 case "$d_semctl_semun" in
16055 '')
35918792 16056 val="$undef"
2fad75a1 16057 $cat > try.c <<END
b4eb6b3d
JH
16058#include <sys/types.h>
16059#include <sys/ipc.h>
16060#include <sys/sem.h>
16061#include <sys/stat.h>
16062#include <stdio.h>
16063#include <errno.h>
16064#include "try.h"
16065#ifndef errno
16066extern int errno;
16067#endif
16068#$d_union_semun HAS_UNION_SEMUN
16069int main() {
16070 union semun
16071#ifndef HAS_UNION_SEMUN
16072 {
16073 int val;
16074 struct semid_ds *buf;
16075 unsigned short *array;
16076 }
16077#endif
16078 arg;
16079 int sem, st;
16080
16081#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16082 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16083 if (sem > -1) {
16084 struct semid_ds argbuf;
16085 arg.buf = &argbuf;
16086# ifdef IPC_STAT
16087 st = semctl(sem, 0, IPC_STAT, arg);
16088 if (st == 0)
16089 printf("semun\n");
16090 else
16091# endif /* IPC_STAT */
16092 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16093# ifdef IPC_RMID
16094 if (semctl(sem, 0, IPC_RMID, arg) != 0)
35918792 16095# endif /* IPC_RMID */
b4eb6b3d
JH
16096 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16097 } else
16098#endif /* IPC_PRIVATE && ... */
16099 printf("semget failed: errno = %d\n", errno);
16100 return 0;
16101}
16102END
2fad75a1
JH
16103 set try
16104 if eval $compile; then
16105 xxx=`$run ./try`
16106 case "$xxx" in
16107 semun) val="$define" ;;
16108 esac
16109 fi
16110 $rm -f try try.c
35918792
YST
16111 set d_semctl_semun
16112 eval $setvar
2fad75a1
JH
16113 ;;
16114 esac
b4eb6b3d
JH
16115 case "$d_semctl_semun" in
16116 $define)
16117 echo "You can use union semun for semctl IPC_STAT." >&4
16118 also='also'
16119 ;;
16120 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
16121 also=''
16122 ;;
16123 esac
16124
16125 : see whether semctl IPC_STAT can use struct semid_ds pointer
2fad75a1
JH
16126 case "$d_semctl_semid_ds" in
16127 '')
35918792 16128 val="$undef"
2fad75a1 16129 $cat > try.c <<'END'
b4eb6b3d
JH
16130#include <sys/types.h>
16131#include <sys/ipc.h>
16132#include <sys/sem.h>
16133#include <sys/stat.h>
16134#include "try.h"
16135#include <stdio.h>
16136#include <errno.h>
16137#ifndef errno
16138extern int errno;
16139#endif
16140int main() {
16141 struct semid_ds arg;
16142 int sem, st;
16143
16144#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16145 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16146 if (sem > -1) {
16147# ifdef IPC_STAT
16148 st = semctl(sem, 0, IPC_STAT, &arg);
16149 if (st == 0)
16150 printf("semid_ds\n");
16151 else
16152# endif /* IPC_STAT */
16153 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16154# ifdef IPC_RMID
16155 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16156# endif /* IPC_RMID */
16157 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16158 } else
16159#endif /* IPC_PRIVATE && ... */
16160 printf("semget failed: errno = %d\n", errno);
16161
16162 return 0;
16163}
16164END
2fad75a1
JH
16165 set try
16166 if eval $compile; then
16167 xxx=`$run ./try`
16168 case "$xxx" in
16169 semid_ds) val="$define" ;;
16170 esac
16171 fi
16172 $rm -f try try.c
35918792
YST
16173 set d_semctl_semid_ds
16174 eval $setvar
2fad75a1
JH
16175 ;;
16176 esac
b4eb6b3d
JH
16177 case "$d_semctl_semid_ds" in
16178 $define)
16179 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16180 ;;
16181 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16182 ;;
16183 esac
16184 $rm -f try.h
16185 ;;
16186*) val="$undef"
16187
16188 # We do not have the full sem*(2) library, so assume we can not
16189 # use either.
16190
16191 set d_semctl_semun
16192 eval $setvar
16193
16194 set d_semctl_semid_ds
16195 eval $setvar
16196 ;;
16197esac
16198
4e0554ec
JH
16199: see if sendmsg exists
16200set sendmsg d_sendmsg
16201eval $inlibc
16202
b4eb6b3d
JH
16203: see if setegid exists
16204set setegid d_setegid
16205eval $inlibc
16206
16207: see if seteuid exists
16208set seteuid d_seteuid
16209eval $inlibc
16210
16211: see if setgrent exists
16212set setgrent d_setgrent
16213eval $inlibc
16214
10bc17b6
JH
16215: see if setgrent_r exists
16216set setgrent_r d_setgrent_r
16217eval $inlibc
16218case "$d_setgrent_r" in
16219"$define")
16220 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
16221 case "$d_setgrent_r_proto:$usethreads" in
16222 ":define") d_setgrent_r_proto=define
a48ec845
JH
16223 set d_setgrent_r_proto setgrent_r $hdrs
16224 eval $hasproto ;;
16225 *) ;;
16226 esac
16227 case "$d_setgrent_r_proto" in
16228 define)
10bc17b6
JH
16229 case "$setgrent_r_proto" in
16230 ''|0) try='int setgrent_r(FILE**);'
16231 ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16232 esac
16233 case "$setgrent_r_proto" in
16234 ''|0) try='void setgrent_r(FILE**);'
16235 ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16236 esac
16237 case "$setgrent_r_proto" in
90e831dc 16238 ''|0) d_setgrent_r=undef
10bc17b6 16239 setgrent_r_proto=0
a48ec845 16240 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16241 * ) case "$setgrent_r_proto" in
16242 REENTRANT_PROTO*) ;;
16243 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16244 esac
16245 echo "Prototype: $try" ;;
16246 esac
16247 ;;
c18e646a
JH
16248 *) case "$usethreads" in
16249 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16250 esac
90e831dc
SB
16251 d_setgrent_r=undef
16252 setgrent_r_proto=0
c18e646a 16253 ;;
a48ec845
JH
16254 esac
16255 ;;
10bc17b6
JH
16256*) setgrent_r_proto=0
16257 ;;
16258esac
16259
b4eb6b3d
JH
16260: see if sethostent exists
16261set sethostent d_sethent
16262eval $inlibc
16263
10bc17b6
JH
16264: see if sethostent_r exists
16265set sethostent_r d_sethostent_r
16266eval $inlibc
16267case "$d_sethostent_r" in
16268"$define")
16269 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16270 case "$d_sethostent_r_proto:$usethreads" in
16271 ":define") d_sethostent_r_proto=define
a48ec845
JH
16272 set d_sethostent_r_proto sethostent_r $hdrs
16273 eval $hasproto ;;
16274 *) ;;
16275 esac
16276 case "$d_sethostent_r_proto" in
16277 define)
10bc17b6
JH
16278 case "$sethostent_r_proto" in
16279 ''|0) try='int sethostent_r(int, struct hostent_data*);'
16280 ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16281 esac
16282 case "$sethostent_r_proto" in
16283 ''|0) try='void sethostent_r(int, struct hostent_data*);'
16284 ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16285 esac
16286 case "$sethostent_r_proto" in
90e831dc 16287 ''|0) d_sethostent_r=undef
10bc17b6 16288 sethostent_r_proto=0
a48ec845 16289 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16290 * ) case "$sethostent_r_proto" in
16291 REENTRANT_PROTO*) ;;
16292 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16293 esac
16294 echo "Prototype: $try" ;;
16295 esac
16296 ;;
c18e646a
JH
16297 *) case "$usethreads" in
16298 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16299 esac
90e831dc
SB
16300 d_sethostent_r=undef
16301 sethostent_r_proto=0
c18e646a 16302 ;;
a48ec845
JH
16303 esac
16304 ;;
10bc17b6
JH
16305*) sethostent_r_proto=0
16306 ;;
16307esac
16308
4e0554ec
JH
16309: see if setitimer exists
16310set setitimer d_setitimer
16311eval $inlibc
16312
b4eb6b3d
JH
16313: see if setlinebuf exists
16314set setlinebuf d_setlinebuf
16315eval $inlibc
16316
16317: see if setlocale exists
16318set setlocale d_setlocale
16319eval $inlibc
16320
10bc17b6
JH
16321: see if locale.h is available
16322set locale.h i_locale
16323eval $inhdr
16324
16325: see if setlocale_r exists
16326set setlocale_r d_setlocale_r
16327eval $inlibc
16328case "$d_setlocale_r" in
16329"$define")
16330 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
16331 case "$d_setlocale_r_proto:$usethreads" in
16332 ":define") d_setlocale_r_proto=define
a48ec845
JH
16333 set d_setlocale_r_proto setlocale_r $hdrs
16334 eval $hasproto ;;
16335 *) ;;
16336 esac
16337 case "$d_setlocale_r_proto" in
16338 define)
10bc17b6
JH
16339 case "$setlocale_r_proto" in
16340 ''|0) try='int setlocale_r(int, const char*, char*, int);'
16341 ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16342 esac
16343 case "$setlocale_r_proto" in
90e831dc 16344 ''|0) d_setlocale_r=undef
10bc17b6 16345 setlocale_r_proto=0
a48ec845 16346 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16347 * ) case "$setlocale_r_proto" in
16348 REENTRANT_PROTO*) ;;
16349 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16350 esac
16351 echo "Prototype: $try" ;;
16352 esac
16353 ;;
c18e646a
JH
16354 *) case "$usethreads" in
16355 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16356 esac
90e831dc
SB
16357 d_setlocale_r=undef
16358 setlocale_r_proto=0
c18e646a 16359 ;;
a48ec845
JH
16360 esac
16361 ;;
10bc17b6
JH
16362*) setlocale_r_proto=0
16363 ;;
16364esac
16365
b4eb6b3d
JH
16366: see if setnetent exists
16367set setnetent d_setnent
16368eval $inlibc
16369
10bc17b6
JH
16370: see if setnetent_r exists
16371set setnetent_r d_setnetent_r
16372eval $inlibc
16373case "$d_setnetent_r" in
16374"$define")
16375 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16376 case "$d_setnetent_r_proto:$usethreads" in
16377 ":define") d_setnetent_r_proto=define
a48ec845
JH
16378 set d_setnetent_r_proto setnetent_r $hdrs
16379 eval $hasproto ;;
16380 *) ;;
16381 esac
16382 case "$d_setnetent_r_proto" in
16383 define)
10bc17b6
JH
16384 case "$setnetent_r_proto" in
16385 ''|0) try='int setnetent_r(int, struct netent_data*);'
16386 ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16387 esac
16388 case "$setnetent_r_proto" in
16389 ''|0) try='void setnetent_r(int, struct netent_data*);'
16390 ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16391 esac
16392 case "$setnetent_r_proto" in
90e831dc 16393 ''|0) d_setnetent_r=undef
10bc17b6 16394 setnetent_r_proto=0
a48ec845 16395 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16396 * ) case "$setnetent_r_proto" in
16397 REENTRANT_PROTO*) ;;
16398 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16399 esac
16400 echo "Prototype: $try" ;;
16401 esac
16402 ;;
c18e646a
JH
16403 *) case "$usethreads" in
16404 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16405 esac
90e831dc
SB
16406 d_setnetent_r=undef
16407 setnetent_r_proto=0
c18e646a 16408 ;;
a48ec845
JH
16409 esac
16410 ;;
10bc17b6
JH
16411*) setnetent_r_proto=0
16412 ;;
16413esac
16414
b4eb6b3d
JH
16415: see if setprotoent exists
16416set setprotoent d_setpent
16417eval $inlibc
16418
16419: see if setpgid exists
16420set setpgid d_setpgid
16421eval $inlibc
16422
16423: see if setpgrp2 exists
16424set setpgrp2 d_setpgrp2
16425eval $inlibc
16426
16427: see if setpriority exists
16428set setpriority d_setprior
16429eval $inlibc
16430
16431: see if setproctitle exists
16432set setproctitle d_setproctitle
16433eval $inlibc
16434
10bc17b6
JH
16435: see if setprotoent_r exists
16436set setprotoent_r d_setprotoent_r
16437eval $inlibc
16438case "$d_setprotoent_r" in
16439"$define")
16440 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16441 case "$d_setprotoent_r_proto:$usethreads" in
16442 ":define") d_setprotoent_r_proto=define
a48ec845
JH
16443 set d_setprotoent_r_proto setprotoent_r $hdrs
16444 eval $hasproto ;;
16445 *) ;;
16446 esac
16447 case "$d_setprotoent_r_proto" in
16448 define)
10bc17b6
JH
16449 case "$setprotoent_r_proto" in
16450 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16451 ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16452 esac
16453 case "$setprotoent_r_proto" in
16454 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16455 ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16456 esac
16457 case "$setprotoent_r_proto" in
90e831dc 16458 ''|0) d_setprotoent_r=undef
10bc17b6 16459 setprotoent_r_proto=0
a48ec845 16460 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16461 * ) case "$setprotoent_r_proto" in
16462 REENTRANT_PROTO*) ;;
16463 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16464 esac
16465 echo "Prototype: $try" ;;
16466 esac
16467 ;;
c18e646a
JH
16468 *) case "$usethreads" in
16469 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16470 esac
90e831dc
SB
16471 d_setprotoent_r=undef
16472 setprotoent_r_proto=0
c18e646a 16473 ;;
a48ec845
JH
16474 esac
16475 ;;
10bc17b6
JH
16476*) setprotoent_r_proto=0
16477 ;;
16478esac
16479
b4eb6b3d
JH
16480: see if setpwent exists
16481set setpwent d_setpwent
16482eval $inlibc
16483
10bc17b6
JH
16484: see if setpwent_r exists
16485set setpwent_r d_setpwent_r
16486eval $inlibc
16487case "$d_setpwent_r" in
16488"$define")
16489 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
16490 case "$d_setpwent_r_proto:$usethreads" in
16491 ":define") d_setpwent_r_proto=define
a48ec845
JH
16492 set d_setpwent_r_proto setpwent_r $hdrs
16493 eval $hasproto ;;
16494 *) ;;
16495 esac
16496 case "$d_setpwent_r_proto" in
16497 define)
10bc17b6
JH
16498 case "$setpwent_r_proto" in
16499 ''|0) try='int setpwent_r(FILE**);'
16500 ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16501 esac
16502 case "$setpwent_r_proto" in
16503 ''|0) try='void setpwent_r(FILE**);'
16504 ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16505 esac
16506 case "$setpwent_r_proto" in
90e831dc 16507 ''|0) d_setpwent_r=undef
10bc17b6 16508 setpwent_r_proto=0
a48ec845 16509 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16510 * ) case "$setpwent_r_proto" in
16511 REENTRANT_PROTO*) ;;
16512 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16513 esac
16514 echo "Prototype: $try" ;;
16515 esac
16516 ;;
c18e646a
JH
16517 *) case "$usethreads" in
16518 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16519 esac
90e831dc
SB
16520 d_setpwent_r=undef
16521 setpwent_r_proto=0
c18e646a 16522 ;;
a48ec845
JH
16523 esac
16524 ;;
10bc17b6
JH
16525*) setpwent_r_proto=0
16526 ;;
16527esac
16528
b4eb6b3d
JH
16529: see if setregid exists
16530set setregid d_setregid
16531eval $inlibc
16532set setresgid d_setresgid
16533eval $inlibc
16534
16535: see if setreuid exists
16536set setreuid d_setreuid
16537eval $inlibc
16538set setresuid d_setresuid
16539eval $inlibc
16540
16541: see if setrgid exists
16542set setrgid d_setrgid
16543eval $inlibc
16544
16545: see if setruid exists
16546set setruid d_setruid
16547eval $inlibc
16548
16549: see if setservent exists
16550set setservent d_setsent
16551eval $inlibc
16552
10bc17b6
JH
16553: see if setservent_r exists
16554set setservent_r d_setservent_r
16555eval $inlibc
16556case "$d_setservent_r" in
16557"$define")
16558 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16559 case "$d_setservent_r_proto:$usethreads" in
16560 ":define") d_setservent_r_proto=define
a48ec845
JH
16561 set d_setservent_r_proto setservent_r $hdrs
16562 eval $hasproto ;;
16563 *) ;;
16564 esac
16565 case "$d_setservent_r_proto" in
16566 define)
10bc17b6
JH
16567 case "$setservent_r_proto" in
16568 ''|0) try='int setservent_r(int, struct servent_data*);'
16569 ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16570 esac
16571 case "$setservent_r_proto" in
16572 ''|0) try='void setservent_r(int, struct servent_data*);'
16573 ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16574 esac
16575 case "$setservent_r_proto" in
90e831dc 16576 ''|0) d_setservent_r=undef
10bc17b6 16577 setservent_r_proto=0
a48ec845 16578 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16579 * ) case "$setservent_r_proto" in
16580 REENTRANT_PROTO*) ;;
16581 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16582 esac
16583 echo "Prototype: $try" ;;
16584 esac
16585 ;;
c18e646a
JH
16586 *) case "$usethreads" in
16587 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16588 esac
90e831dc
SB
16589 d_setservent_r=undef
16590 setservent_r_proto=0
c18e646a 16591 ;;
a48ec845
JH
16592 esac
16593 ;;
10bc17b6
JH
16594*) setservent_r_proto=0
16595 ;;
16596esac
16597
b4eb6b3d
JH
16598: see if setsid exists
16599set setsid d_setsid
16600eval $inlibc
16601
16602: see if setvbuf exists
16603set setvbuf d_setvbuf
16604eval $inlibc
16605
16606: see if sfio.h is available
16607set sfio.h i_sfio
16608eval $inhdr
16609
16610
16611: see if sfio library is available
16612case "$i_sfio" in
16613$define)
16614 val=''
16615 set sfreserve val
16616 eval $inlibc
16617 ;;
16618*)
16619 val="$undef"
16620 ;;
16621esac
16622: Ok, but do we want to use it.
16623case "$val" in
16624$define)
16625 case "$usesfio" in
16626 true|$define|[yY]*) dflt='y';;
16627 *) dflt='n';;
16628 esac
16629 echo "$package can use the sfio library, but it is experimental."
16630 case "$useperlio" in
16631 "$undef")
16632 echo "For sfio also the PerlIO abstraction layer is needed."
16633 echo "Earlier you said you wouldn't want that."
16634 ;;
16635 esac
16636 rp="You seem to have sfio available, do you want to try using it?"
16637 . ./myread
16638 case "$ans" in
16639 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
16640 useperlio="$define"
16641 val="$define"
16642 ;;
16643 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
16644 val="$undef"
b4eb6b3d
JH
16645 ;;
16646 esac
16647 ;;
16648*) case "$usesfio" in
16649 true|$define|[yY]*)
16650 echo "Sorry, cannot find sfio on this machine." >&4
16651 echo "Ignoring your setting of usesfio=$usesfio." >&4
16652 val="$undef"
16653 ;;
16654 esac
16655 ;;
16656esac
16657set d_sfio
16658eval $setvar
16659case "$d_sfio" in
16660$define) usesfio='true';;
16661*) usesfio='false';;
16662esac
3659ebf1
JH
16663case "$d_sfio" in
16664$define) ;;
16665*) : Remove sfio from list of libraries to use
7483f793
JH
16666 case "$libs" in
16667 *-lsfio*)
16668 echo "Removing unneeded -lsfio from library list" >&4
16669 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16670 shift
16671 libs="$*"
16672 echo "libs = $libs" >&4
16673 ;;
16674 esac
3659ebf1
JH
16675;;
16676esac
16677
b4eb6b3d
JH
16678
16679: see if shmctl exists
16680set shmctl d_shmctl
16681eval $inlibc
16682
16683: see if shmget exists
16684set shmget d_shmget
16685eval $inlibc
16686
16687: see if shmat exists
16688set shmat d_shmat
16689eval $inlibc
16690: see what shmat returns
16691case "$d_shmat" in
16692"$define")
16693 $cat >shmat.c <<'END'
16694#include <sys/shm.h>
16695void *shmat();
16696END
16697 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16698 shmattype='void *'
16699 else
16700 shmattype='char *'
16701 fi
16702 echo "and it returns ($shmattype)." >&4
16703 : see if a prototype for shmat is available
16704 xxx=`./findhdr sys/shm.h`
16705 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16706 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16707 val="$define"
16708 else
16709 val="$undef"
16710 fi
16711 $rm -f shmat.[co]
16712 ;;
16713*)
16714 val="$undef"
16715 ;;
16716esac
16717set d_shmatprototype
16718eval $setvar
16719
16720: see if shmdt exists
16721set shmdt d_shmdt
16722eval $inlibc
16723
16724: see how much of the 'shm*(2)' library is present.
16725h_shm=true
16726echo " "
16727case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16728*"$undef"*) h_shm=false;;
16729esac
16730case "$osname" in
16731freebsd)
16732 case "`ipcs 2>&1`" in
16733 "SVID shared memory"*"not configured"*)
16734 echo "Your $osname does not have the shm*(2) configured." >&4
16735 h_shm=false
16736 val="$undef"
16737 set shmctl d_shmctl
16738 evat $setvar
16739 set shmget d_shmget
16740 evat $setvar
16741 set shmat d_shmat
16742 evat $setvar
16743 set shmdt d_shmdt
16744 evat $setvar
16745 ;;
16746 esac
16747 ;;
16748esac
16749: we could also check for sys/ipc.h ...
16750if $h_shm && $test `./findhdr sys/shm.h`; then
16751 echo "You have the full shm*(2) library." >&4
16752 val="$define"
16753else
16754 echo "You don't have the full shm*(2) library." >&4
16755 val="$undef"
16756fi
16757set d_shm
16758eval $setvar
16759
16760echo " "
16761: see if we have sigaction
16762if set sigaction val -f d_sigaction; eval $csym; $val; then
16763 echo 'sigaction() found.' >&4
073b6de5 16764 $cat > try.c <<EOP
b4eb6b3d
JH
16765#include <stdio.h>
16766#include <sys/types.h>
16767#include <signal.h>
073b6de5
JH
16768#$i_stdlib I_STDLIB
16769#ifdef I_STDLIB
16770#include <stdlib.h>
16771#endif
b4eb6b3d
JH
16772int main()
16773{
16774 struct sigaction act, oact;
16775 act.sa_flags = 0;
16776 oact.sa_handler = 0;
16777 /* so that act and oact are used */
16778 exit(act.sa_flags == 0 && oact.sa_handler == 0);
16779}
16780EOP
16781 set try
16782 if eval $compile_ok; then
16783 val="$define"
16784 else
16785 echo "But you don't seem to have a useable struct sigaction." >&4
16786 val="$undef"
16787 fi
16788else
16789 echo 'sigaction NOT found.' >&4
16790 val="$undef"
16791fi
16792set d_sigaction; eval $setvar
16793$rm -f try try$_o try.c
16794
983dbef6
JH
16795: see if sigprocmask exists
16796set sigprocmask d_sigprocmask
16797eval $inlibc
16798
b4eb6b3d
JH
16799: see if sigsetjmp exists
16800echo " "
16801case "$d_sigsetjmp" in
16802'')
c727eafa 16803 $cat >try.c <<EOP
b4eb6b3d 16804#include <setjmp.h>
d1daaddf
JH
16805#$i_stdlib I_STDLIB
16806#ifdef I_STDLIB
16807#include <stdlib.h>
16808#endif
b4eb6b3d
JH
16809sigjmp_buf env;
16810int set = 1;
16811int main()
16812{
16813 if (sigsetjmp(env,1))
16814 exit(set);
16815 set = 0;
16816 siglongjmp(env, 1);
16817 exit(1);
16818}
16819EOP
16820 set try
16821 if eval $compile; then
5440bc8e 16822 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
16823 echo "POSIX sigsetjmp found." >&4
16824 val="$define"
16825 else
16826 $cat >&4 <<EOM
16827Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16828I'll ignore them.
16829EOM
16830 val="$undef"
16831 fi
16832 else
16833 echo "sigsetjmp not found." >&4
16834 val="$undef"
16835 fi
16836 ;;
16837*) val="$d_sigsetjmp"
16838 case "$d_sigsetjmp" in
16839 $define) echo "POSIX sigsetjmp found." >&4;;
16840 $undef) echo "sigsetjmp not found." >&4;;
16841 esac
16842 ;;
16843esac
16844set d_sigsetjmp
16845eval $setvar
16846$rm -f try.c try
16847
4f5da3e9
SP
16848: see if snprintf exists
16849set snprintf d_snprintf
16850eval $inlibc
16851
16852: see if vsnprintf exists
16853set vsnprintf d_vsnprintf
16854eval $inlibc
16855
2478f7a0
MB
16856case "$d_snprintf-$d_vsnprintf" in
16857"$define-$define")
16858 $cat <<EOM
16859Checking whether your snprintf() and vsnprintf() work okay...
16860EOM
16861 $cat >try.c <<'EOCP'
16862/* v?snprintf testing logic courtesy of Russ Allbery.
16863 * According to C99:
16864 * - if the buffer is too short it still must be \0-terminated
16865 * - if the buffer is too short the potentially required length
16866 * must be returned and not -1
16867 * - if the buffer is NULL the potentially required length
16868 * must be returned and not -1 or core dump
16869 */
16870#include <stdio.h>
16871#include <stdarg.h>
16872
16873char buf[2];
16874
16875int test (char *format, ...)
16876{
16877 va_list args;
16878 int count;
16879
16880 va_start (args, format);
16881 count = vsnprintf (buf, sizeof buf, format, args);
16882 va_end (args);
16883 return count;
16884}
16885
16886int main ()
16887{
16888 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16889 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16890}
16891EOCP
16892 set try
16893 if eval $compile; then
16894 `$run ./try`
16895 case "$?" in
16896 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16897 *) cat <<EOM >&4
16898Your snprintf() and snprintf() don't seem to be working okay.
16899EOM
16900 d_snprintf="$undef"
16901 d_vsnprintf="$undef"
16902 ;;
16903 esac
16904 else
16905 echo "(I can't seem to compile the test program--assuming they don't)"
16906 d_snprintf="$undef"
16907 d_vsnprintf="$undef"
16908 fi
16909 $rm -f try.* try core core.try.*
16910 ;;
16911esac
16912
49a78c82
JH
16913: see if sockatmark exists
16914set sockatmark d_sockatmark
16915eval $inlibc
16916
2ef53570
JH
16917: see if prototype for sockatmark is available
16918echo " "
16919set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16920eval $hasproto
16921
b4eb6b3d
JH
16922: see if socks5_init exists
16923set socks5_init d_socks5_init
16924eval $inlibc
16925
360321b3
YST
16926: see if sprintf returns the length of the string in the buffer as per ANSI
16927$echo "Checking whether sprintf returns the length of the string..." >&4
16928$cat <<EOP >try.c
16929#include <stdio.h>
16930#$i_stdlib I_STDLIB
16931#ifdef I_STDLIB
16932#include <stdlib.h>
16933#endif
16934#$i_string I_STRING
16935#ifdef I_STRING
16936# include <string.h>
16937#else
16938# include <strings.h>
16939#endif
16940#$i_math I_MATH
16941#ifdef I_MATH
16942#include <math.h>
16943#endif
16944
16945char buffer[256];
16946
16947int check (size_t expect, int test) {
16948 size_t got = strlen(buffer);
16949 if (expect == got)
16950 return 0;
16951
16952 printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16953 test, buffer);
16954 exit (test);
16955}
16956
16957int main(int argc, char **argv) {
16958 int test = 0;
16959
16960 check(sprintf(buffer, ""), ++test);
16961 check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16962 check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16963
16964 return 0;
16965}
16966EOP
16967set try
16968
16969d_sprintf_returns_strlen="$undef"
16970if eval $compile; then
16971 xxx="`$run ./try`"
16972 case "$?" in
16973 0) cat >&4 <<EOM
16974sprintf returns the length of the string (as ANSI says it should)
16975EOM
16976 d_sprintf_returns_strlen="$define"
16977 ;;
16978 *) cat >&4 <<EOM
16979sprintf does not return the length of the string (how old is this system?)
16980EOM
16981 d_sprintf_returns_strlen="$undef"
16982 ;;
16983 esac
16984fi
16985
16986$rm -f try.* try
16987
10bc17b6
JH
16988: see if srand48_r exists
16989set srand48_r d_srand48_r
16990eval $inlibc
16991case "$d_srand48_r" in
16992"$define")
16993 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16994 case "$d_srand48_r_proto:$usethreads" in
16995 ":define") d_srand48_r_proto=define
a48ec845
JH
16996 set d_srand48_r_proto srand48_r $hdrs
16997 eval $hasproto ;;
16998 *) ;;
16999 esac
17000 case "$d_srand48_r_proto" in
17001 define)
10bc17b6
JH
17002 case "$srand48_r_proto" in
17003 ''|0) try='int srand48_r(long, struct drand48_data*);'
17004 ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17005 esac
17006 case "$srand48_r_proto" in
90e831dc 17007 ''|0) d_srand48_r=undef
10bc17b6 17008 srand48_r_proto=0
a48ec845 17009 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17010 * ) case "$srand48_r_proto" in
17011 REENTRANT_PROTO*) ;;
17012 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17013 esac
17014 echo "Prototype: $try" ;;
17015 esac
17016 ;;
c18e646a
JH
17017 *) case "$usethreads" in
17018 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17019 esac
90e831dc
SB
17020 d_srand48_r=undef
17021 srand48_r_proto=0
c18e646a 17022 ;;
a48ec845
JH
17023 esac
17024 ;;
10bc17b6
JH
17025*) srand48_r_proto=0
17026 ;;
17027esac
17028
17029: see if srandom_r exists
17030set srandom_r d_srandom_r
17031eval $inlibc
17032case "$d_srandom_r" in
17033"$define")
17034 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17035 case "$d_srandom_r_proto:$usethreads" in
17036 ":define") d_srandom_r_proto=define
a48ec845
JH
17037 set d_srandom_r_proto srandom_r $hdrs
17038 eval $hasproto ;;
17039 *) ;;
17040 esac
17041 case "$d_srandom_r_proto" in
17042 define)
10bc17b6
JH
17043 case "$srandom_r_proto" in
17044 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17045 ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17046 esac
17047 case "$srandom_r_proto" in
90e831dc 17048 ''|0) d_srandom_r=undef
10bc17b6 17049 srandom_r_proto=0
a48ec845 17050 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17051 * ) case "$srandom_r_proto" in
17052 REENTRANT_PROTO*) ;;
17053 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17054 esac
17055 echo "Prototype: $try" ;;
17056 esac
17057 ;;
c18e646a
JH
17058 *) case "$usethreads" in
17059 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17060 esac
90e831dc
SB
17061 d_srandom_r=undef
17062 srandom_r_proto=0
c18e646a 17063 ;;
a48ec845
JH
17064 esac
17065 ;;
10bc17b6
JH
17066*) srandom_r_proto=0
17067 ;;
17068esac
17069
eef837ea
JH
17070: see if prototype for setresgid is available
17071echo " "
17072set d_sresgproto setresgid $i_unistd unistd.h
17073eval $hasproto
17074
640374d0
JH
17075: see if prototype for setresuid is available
17076echo " "
17077set d_sresuproto setresuid $i_unistd unistd.h
17078eval $hasproto
17079
b4eb6b3d
JH
17080: see if sys/stat.h is available
17081set sys/stat.h i_sysstat
17082eval $inhdr
17083
17084
17085: see if stat knows about block sizes
17086echo " "
17087echo "Checking to see if your struct stat has st_blocks field..." >&4
17088set d_statblks stat st_blocks $i_sysstat sys/stat.h
17089eval $hasfield
17090
17091
17092: see if this is a sys/vfs.h system
17093set sys/vfs.h i_sysvfs
17094eval $inhdr
17095
17096
17097: see if this is a sys/statfs.h system
17098set sys/statfs.h i_sysstatfs
17099eval $inhdr
17100
17101
17102echo " "
17103echo "Checking to see if your system supports struct statfs..." >&4
17104set d_statfs_s statfs $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
17105eval $hasstruct
17106case "$d_statfs_s" in
17107"$define") echo "Yes, it does." ;;
17108*) echo "No, it doesn't." ;;
17109esac
17110
17111
17112
17113: see if struct statfs knows about f_flags
17114case "$d_statfs_s" in
17115define)
17116 echo " "
17117 echo "Checking to see if your struct statfs has f_flags field..." >&4
17118 set d_statfs_f_flags statfs f_flags $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
17119 eval $hasfield
17120 ;;
17121*) val="$undef"
17122 set d_statfs_f_flags
17123 eval $setvar
17124 ;;
17125esac
17126case "$d_statfs_f_flags" in
17127"$define") echo "Yes, it does." ;;
17128*) echo "No, it doesn't." ;;
17129esac
17130
b4eb6b3d
JH
17131$cat >&4 <<EOM
17132Checking how to access stdio streams by file descriptor number...
17133EOM
17134case "$stdio_stream_array" in
17135'') $cat >try.c <<EOCP
17136#include <stdio.h>
17137int main() {
17138 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17139 printf("yes\n");
17140}
17141EOCP
17142 for s in _iob __iob __sF
17143 do
17144 set try -DSTDIO_STREAM_ARRAY=$s
17145 if eval $compile; then
5440bc8e 17146 case "`$run ./try`" in
b4eb6b3d
JH
17147 yes) stdio_stream_array=$s; break ;;
17148 esac
17149 fi
17150 done
17151 $rm -f try.* try$exe_ext
17152esac
17153case "$stdio_stream_array" in
17154'') $cat >&4 <<EOM
17155I can't figure out how to access stdio streams by file descriptor number.
17156EOM
17157 d_stdio_stream_array="$undef"
17158 ;;
17159*) $cat >&4 <<EOM
17160You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17161EOM
17162 d_stdio_stream_array="$define"
17163 ;;
17164esac
17165
17166: see if strcoll exists
17167set strcoll d_strcoll
17168eval $inlibc
17169
17170: check for structure copying
17171echo " "
17172echo "Checking to see if your C compiler can copy structs..." >&4
17173$cat >try.c <<'EOCP'
76f47787 17174int main()
b4eb6b3d
JH
17175{
17176 struct blurfl {
17177 int dyick;
17178 } foo, bar;
17179
17180 foo = bar;
17181}
17182EOCP
17183if $cc -c try.c >/dev/null 2>&1 ; then
17184 val="$define"
17185 echo "Yup, it can."
17186else
17187 val="$undef"
17188 echo "Nope, it can't."
17189fi
17190set d_strctcpy
17191eval $setvar
17192$rm -f try.*
17193
17194: see if strerror and/or sys_errlist[] exist
17195echo " "
17196if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17197 if set strerror val -f d_strerror; eval $csym; $val; then
17198 echo 'strerror() found.' >&4
17199 d_strerror="$define"
17200 d_strerrm='strerror(e)'
17201 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17202 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
17203 d_syserrlst="$define"
17204 else
17205 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17206 d_syserrlst="$undef"
17207 fi
17208 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17209 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17210 echo 'strerror() found in string header.' >&4
17211 d_strerror="$define"
17212 d_strerrm='strerror(e)'
17213 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17214 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17215 d_syserrlst="$define"
17216 else
17217 echo "(You don't appear to have any sys_errlist[], how can this be?)"
17218 d_syserrlst="$undef"
17219 fi
17220 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17221 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17222 d_strerror="$undef"
17223 d_syserrlst="$define"
17224 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17225 else
17226 echo 'strerror() and sys_errlist[] NOT found.' >&4
17227 d_strerror="$undef"
17228 d_syserrlst="$undef"
17229 d_strerrm='"unknown"'
17230 fi
17231fi
17232
10bc17b6
JH
17233: see if strerror_r exists
17234set strerror_r d_strerror_r
17235eval $inlibc
17236case "$d_strerror_r" in
17237"$define")
17238 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
17239 case "$d_strerror_r_proto:$usethreads" in
17240 ":define") d_strerror_r_proto=define
a48ec845
JH
17241 set d_strerror_r_proto strerror_r $hdrs
17242 eval $hasproto ;;
17243 *) ;;
17244 esac
17245 case "$d_strerror_r_proto" in
17246 define)
10bc17b6
JH
17247 case "$strerror_r_proto" in
17248 ''|0) try='int strerror_r(int, char*, size_t);'
17249 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17250 esac
17251 case "$strerror_r_proto" in
17252 ''|0) try='int strerror_r(int, char*, int);'
17253 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17254 esac
17255 case "$strerror_r_proto" in
17256 ''|0) try='char* strerror_r(int, char*, size_t);'
17257 ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17258 esac
17259 case "$strerror_r_proto" in
90e831dc 17260 ''|0) d_strerror_r=undef
10bc17b6 17261 strerror_r_proto=0
a48ec845 17262 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17263 * ) case "$strerror_r_proto" in
17264 REENTRANT_PROTO*) ;;
17265 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17266 esac
17267 echo "Prototype: $try" ;;
17268 esac
17269 ;;
c18e646a
JH
17270 *) case "$usethreads" in
17271 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17272 esac
90e831dc
SB
17273 d_strerror_r=undef
17274 strerror_r_proto=0
c18e646a 17275 ;;
a48ec845
JH
17276 esac
17277 ;;
10bc17b6
JH
17278*) strerror_r_proto=0
17279 ;;
17280esac
17281
b3c85772
JH
17282: see if strftime exists
17283set strftime d_strftime
17284eval $inlibc
17285
08c92000
MB
17286: see if strlcat exists
17287set strlcat d_strlcat
17288eval $inlibc
17289
17290: see if strlcpy exists
17291set strlcpy d_strlcpy
17292eval $inlibc
17293
b4eb6b3d
JH
17294: see if strtod exists
17295set strtod d_strtod
17296eval $inlibc
17297
17298: see if strtol exists
17299set strtol d_strtol
17300eval $inlibc
17301
17302: see if strtold exists
17303set strtold d_strtold
17304eval $inlibc
17305
17306: see if strtoll exists
17307set strtoll d_strtoll
17308eval $inlibc
17309
17310case "$d_longlong-$d_strtoll" in
17311"$define-$define")
17312 $cat <<EOM
17313Checking whether your strtoll() works okay...
17314EOM
17315 $cat >try.c <<'EOCP'
17316#include <errno.h>
17317#ifdef __hpux
17318#define strtoll __strtoll
17319#endif
e75931a7
YST
17320#ifdef __EMX__
17321#define strtoll _strtoll
17322#endif
b4eb6b3d
JH
17323#include <stdio.h>
17324extern long long int strtoll(char *s, char **, int);
17325static int bad = 0;
17326int check(char *s, long long ell, int een) {
17327 long long gll;
17328 errno = 0;
17329 gll = strtoll(s, 0, 10);
17330 if (!((gll == ell) && (errno == een)))
17331 bad++;
17332}
17333int main() {
17334 check(" 1", 1LL, 0);
17335 check(" 0", 0LL, 0);
17336 check("-1", -1LL, 0);
17337 check("-9223372036854775808", -9223372036854775808LL, 0);
17338 check("-9223372036854775808", -9223372036854775808LL, 0);
17339 check(" 9223372036854775807", 9223372036854775807LL, 0);
17340 check("-9223372036854775808", -9223372036854775808LL, 0);
17341 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
17342 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17343 if (!bad)
17344 printf("ok\n");
17345}
17346EOCP
17347 set try
17348 if eval $compile; then
5440bc8e 17349 yyy=`$run ./try`
e75931a7 17350 case "$yyy" in
b4eb6b3d
JH
17351 ok) echo "Your strtoll() seems to be working okay." ;;
17352 *) cat <<EOM >&4
17353Your strtoll() doesn't seem to be working okay.
17354EOM
17355 d_strtoll="$undef"
17356 ;;
69eadf66 17357 esac
e75931a7
YST
17358 else
17359 echo "(I can't seem to compile the test program--assuming it doesn't)"
17360 d_strtoll="$undef"
b4eb6b3d
JH
17361 fi
17362 ;;
17363esac
17364
28e5dec8
JH
17365: see if strtoq exists
17366set strtoq d_strtoq
17367eval $inlibc
17368
b4eb6b3d
JH
17369: see if strtoul exists
17370set strtoul d_strtoul
17371eval $inlibc
17372
d0e6d399
NC
17373case "$d_strtoul" in
17374"$define")
17375 $cat <<EOM
17376Checking whether your strtoul() works okay...
17377EOM
17378 $cat >try.c <<'EOCP'
17379#include <errno.h>
17380#include <stdio.h>
17381extern unsigned long int strtoul(char *s, char **, int);
17382static int bad = 0;
17383void check(char *s, unsigned long eul, int een) {
17384 unsigned long gul;
17385 errno = 0;
17386 gul = strtoul(s, 0, 10);
17387 if (!((gul == eul) && (errno == een)))
17388 bad++;
17389}
17390int main() {
17391 check(" 1", 1L, 0);
17392 check(" 0", 0L, 0);
17393EOCP
17394 case "$longsize" in
17395 8)
17396 $cat >>try.c <<'EOCP'
09c0d2c4
JH
17397 check("18446744073709551615", 18446744073709551615UL, 0);
17398 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 17399#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 17400 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
17401 check("-18446744073709551614", 2, 0);
17402 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
17403 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17404 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 17405#endif
d0e6d399
NC
17406EOCP
17407 ;;
17408 4)
17409 $cat >>try.c <<'EOCP'
17410 check("4294967295", 4294967295UL, 0);
17411 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 17412#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
17413 check("-1", 4294967295UL, 0);
17414 check("-4294967294", 2, 0);
17415 check("-4294967295", 1, 0);
17416 check("-4294967296", 4294967295UL, ERANGE);
17417 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 17418#endif
d0e6d399
NC
17419EOCP
17420 ;;
17421 *)
17422: Should we write these tests to be more portable by sprintf-ing
17423: ~0 and then manipulating that char string as input for strtol?
17424 ;;
17425 esac
17426 $cat >>try.c <<'EOCP'
17427 if (!bad)
17428 printf("ok\n");
17429 return 0;
17430}
17431EOCP
17432 set try
17433 if eval $compile; then
5440bc8e 17434 case "`$run ./try`" in
d0e6d399
NC
17435 ok) echo "Your strtoul() seems to be working okay." ;;
17436 *) cat <<EOM >&4
17437Your strtoul() doesn't seem to be working okay.
17438EOM
17439 d_strtoul="$undef"
17440 ;;
17441 esac
17442 fi
17443 ;;
17444esac
17445
b4eb6b3d
JH
17446: see if strtoull exists
17447set strtoull d_strtoull
17448eval $inlibc
17449
17450case "$d_longlong-$d_strtoull" in
17451"$define-$define")
17452 $cat <<EOM
17453Checking whether your strtoull() works okay...
17454EOM
17455 $cat >try.c <<'EOCP'
17456#include <errno.h>
17457#ifdef __hpux
17458#define strtoull __strtoull
17459#endif
17460#include <stdio.h>
17461extern unsigned long long int strtoull(char *s, char **, int);
17462static int bad = 0;
17463int check(char *s, long long eull, int een) {
17464 long long gull;
17465 errno = 0;
17466 gull = strtoull(s, 0, 10);
17467 if (!((gull == eull) && (errno == een)))
17468 bad++;
17469}
17470int main() {
d0e6d399
NC
17471 check(" 1", 1LL, 0);
17472 check(" 0", 0LL, 0);
17473 check("18446744073709551615", 18446744073709551615ULL, 0);
17474 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 17475#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
17476 check("-1", 18446744073709551615ULL, 0);
17477 check("-18446744073709551614", 2LL, 0);
17478 check("-18446744073709551615", 1LL, 0);
17479 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17480 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 17481#endif
b4eb6b3d
JH
17482 if (!bad)
17483 printf("ok\n");
17484}
17485EOCP
17486 set try
17487 if eval $compile; then
5440bc8e 17488 case "`$run ./try`" in
b4eb6b3d
JH
17489 ok) echo "Your strtoull() seems to be working okay." ;;
17490 *) cat <<EOM >&4
17491Your strtoull() doesn't seem to be working okay.
17492EOM
17493 d_strtoull="$undef"
17494 ;;
17495 esac
17496 fi
17497 ;;
17498esac
17499
17500: see if strtouq exists
17501set strtouq d_strtouq
17502eval $inlibc
17503
d0e6d399
NC
17504case "$d_strtouq" in
17505"$define")
17506 $cat <<EOM
17507Checking whether your strtouq() works okay...
17508EOM
17509 $cat >try.c <<'EOCP'
17510#include <errno.h>
17511#include <stdio.h>
17512extern unsigned long long int strtouq(char *s, char **, int);
17513static int bad = 0;
17514void check(char *s, unsigned long long eull, int een) {
17515 unsigned long long gull;
17516 errno = 0;
17517 gull = strtouq(s, 0, 10);
17518 if (!((gull == eull) && (errno == een)))
17519 bad++;
17520}
17521int main() {
17522 check(" 1", 1LL, 0);
17523 check(" 0", 0LL, 0);
17524 check("18446744073709551615", 18446744073709551615ULL, 0);
17525 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 17526#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
17527 check("-1", 18446744073709551615ULL, 0);
17528 check("-18446744073709551614", 2LL, 0);
17529 check("-18446744073709551615", 1LL, 0);
17530 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17531 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 17532#endif
d0e6d399
NC
17533 if (!bad)
17534 printf("ok\n");
17535 return 0;
17536}
17537EOCP
17538 set try
17539 if eval $compile; then
5440bc8e 17540 case "`$run ./try`" in
d0e6d399
NC
17541 ok) echo "Your strtouq() seems to be working okay." ;;
17542 *) cat <<EOM >&4
17543Your strtouq() doesn't seem to be working okay.
17544EOM
17545 d_strtouq="$undef"
17546 ;;
17547 esac
17548 fi
17549 ;;
17550esac
17551
b4eb6b3d
JH
17552: see if strxfrm exists
17553set strxfrm d_strxfrm
17554eval $inlibc
17555
17556: see if symlink exists
17557set symlink d_symlink
17558eval $inlibc
17559
17560: see if syscall exists
17561set syscall d_syscall
17562eval $inlibc
17563
2ef53570
JH
17564: see if prototype for syscall is available
17565echo " "
17566set d_syscallproto syscall $i_unistd unistd.h
17567eval $hasproto
17568
b4eb6b3d
JH
17569: see if sysconf exists
17570set sysconf d_sysconf
17571eval $inlibc
17572
17573: see if system exists
17574set system d_system
17575eval $inlibc
17576
17577: see if tcgetpgrp exists
17578set tcgetpgrp d_tcgetpgrp
17579eval $inlibc
17580
17581: see if tcsetpgrp exists
17582set tcsetpgrp d_tcsetpgrp
17583eval $inlibc
17584
17585: see if prototype for telldir is available
17586echo " "
17587set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17588eval $hasproto
17589
ad493445
MB
17590: see if time exists
17591echo " "
17592if test "X$d_time" = X -o X"$timetype" = X; then
17593 if set time val -f d_time; eval $csym; $val; then
17594 echo 'time() found.' >&4
17595 val="$define"
17596 rp="What is the type returned by time() on this system?"
17597 set time_t timetype long stdio.h sys/types.h
17598 eval $typedef_ask
17599 else
17600 echo 'time() not found, hope that will do.' >&4
17601 val="$undef"
17602 timetype='int';
17603 fi
17604 set d_time
17605 eval $setvar
17606fi
17607
b4eb6b3d
JH
17608: see if this is a sys/times.h system
17609set sys/times.h i_systimes
17610eval $inhdr
17611
17612: see if times exists
17613echo " "
17614if set times val -f d_times; eval $csym; $val; then
17615 echo 'times() found.' >&4
17616 d_times="$define"
17617 inc=''
17618 case "$i_systimes" in
17619 "$define") inc='sys/times.h';;
17620 esac
17621 rp="What is the type returned by times() on this system?"
17622 set clock_t clocktype long stdio.h sys/types.h $inc
17623 eval $typedef_ask
17624else
17625 echo 'times() NOT found, hope that will do.' >&4
17626 d_times="$undef"
17627 clocktype='int'
17628fi
17629
10bc17b6
JH
17630: see if tmpnam_r exists
17631set tmpnam_r d_tmpnam_r
17632eval $inlibc
17633case "$d_tmpnam_r" in
17634"$define")
31ee0cb7 17635 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
17636 case "$d_tmpnam_r_proto:$usethreads" in
17637 ":define") d_tmpnam_r_proto=define
a48ec845
JH
17638 set d_tmpnam_r_proto tmpnam_r $hdrs
17639 eval $hasproto ;;
17640 *) ;;
17641 esac
17642 case "$d_tmpnam_r_proto" in
17643 define)
10bc17b6
JH
17644 case "$tmpnam_r_proto" in
17645 ''|0) try='char* tmpnam_r(char*);'
17646 ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17647 esac
17648 case "$tmpnam_r_proto" in
90e831dc 17649 ''|0) d_tmpnam_r=undef
10bc17b6 17650 tmpnam_r_proto=0
a48ec845 17651 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17652 * ) case "$tmpnam_r_proto" in
17653 REENTRANT_PROTO*) ;;
17654 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17655 esac
17656 echo "Prototype: $try" ;;
17657 esac
17658 ;;
c18e646a
JH
17659 *) case "$usethreads" in
17660 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17661 esac
90e831dc
SB
17662 d_tmpnam_r=undef
17663 tmpnam_r_proto=0
c18e646a 17664 ;;
a48ec845
JH
17665 esac
17666 ;;
10bc17b6
JH
17667*) tmpnam_r_proto=0
17668 ;;
17669esac
17670
b4eb6b3d
JH
17671: see if truncate exists
17672set truncate d_truncate
17673eval $inlibc
17674
10bc17b6
JH
17675: see if ttyname_r exists
17676set ttyname_r d_ttyname_r
17677eval $inlibc
17678case "$d_ttyname_r" in
17679"$define")
17680 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
17681 case "$d_ttyname_r_proto:$usethreads" in
17682 ":define") d_ttyname_r_proto=define
a48ec845
JH
17683 set d_ttyname_r_proto ttyname_r $hdrs
17684 eval $hasproto ;;
17685 *) ;;
17686 esac
17687 case "$d_ttyname_r_proto" in
17688 define)
10bc17b6
JH
17689 case "$ttyname_r_proto" in
17690 ''|0) try='int ttyname_r(int, char*, size_t);'
17691 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17692 esac
17693 case "$ttyname_r_proto" in
17694 ''|0) try='int ttyname_r(int, char*, int);'
17695 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17696 esac
17697 case "$ttyname_r_proto" in
17698 ''|0) try='char* ttyname_r(int, char*, int);'
17699 ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17700 esac
17701 case "$ttyname_r_proto" in
90e831dc 17702 ''|0) d_ttyname_r=undef
10bc17b6 17703 ttyname_r_proto=0
a48ec845 17704 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17705 * ) case "$ttyname_r_proto" in
17706 REENTRANT_PROTO*) ;;
17707 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17708 esac
17709 echo "Prototype: $try" ;;
17710 esac
17711 ;;
c18e646a
JH
17712 *) case "$usethreads" in
17713 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17714 esac
90e831dc
SB
17715 d_ttyname_r=undef
17716 ttyname_r_proto=0
c18e646a 17717 ;;
a48ec845
JH
17718 esac
17719 ;;
10bc17b6
JH
17720*) ttyname_r_proto=0
17721 ;;
17722esac
17723
b4eb6b3d
JH
17724: see if tzname[] exists
17725echo " "
17726if set tzname val -a d_tzname; eval $csym; $val; then
17727 val="$define"
17728 echo 'tzname[] found.' >&4
17729else
17730 val="$undef"
17731 echo 'tzname[] NOT found.' >&4
17732fi
17733set d_tzname
17734eval $setvar
17735
4e0554ec
JH
17736case "$osname" in
17737next|rhapsody|darwin) multiarch="$define" ;;
17738esac
17739case "$multiarch" in
17740''|[nN]*) multiarch="$undef" ;;
17741esac
17742
24412007 17743: check for ordering of bytes in a UV
4e0554ec 17744echo " "
5440bc8e 17745case "$usecrosscompile$multiarch" in
4e0554ec
JH
17746*$define*)
17747 $cat <<EOM
17748You seem to be either cross-compiling or doing a multiarchitecture build,
17749skipping the byteorder check.
17750
17751EOM
5440bc8e 17752 byteorder='ffff'
4e0554ec
JH
17753 ;;
17754*)
17755 case "$byteorder" in
17756 '')
17757 $cat <<'EOM'
17758In the following, larger digits indicate more significance. A big-endian
17759machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17760little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17761machines may have weird orders like 3412. A Cray will report 87654321,
17762an Alpha will report 12345678. If the test program works the default is
17763probably right.
17764I'm now running the test program...
17765EOM
24412007 17766 $cat >try.c <<EOCP
4e0554ec 17767#include <stdio.h>
55954f19
JH
17768#$i_stdlib I_STDLIB
17769#ifdef I_STDLIB
17770#include <stdlib.h>
17771#endif
24412007
JH
17772#include <sys/types.h>
17773typedef $uvtype UV;
4e0554ec
JH
17774int main()
17775{
17776 int i;
17777 union {
24412007
JH
17778 UV l;
17779 char c[$uvsize];
4e0554ec
JH
17780 } u;
17781
24412007 17782 if ($uvsize > 4)
b5ded3e5 17783 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 17784 else
a4c53327 17785 u.l = (UV)0x04030201;
24412007 17786 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
17787 printf("%c", u.c[i]+'0');
17788 printf("\n");
17789 exit(0);
17790}
17791EOCP
17792 xxx_prompt=y
17793 set try
17794 if eval $compile && ./try > /dev/null; then
5440bc8e 17795 dflt=`$run ./try`
4e0554ec
JH
17796 case "$dflt" in
17797 [1-4][1-4][1-4][1-4]|12345678|87654321)
17798 echo "(The test program ran ok.)"
17799 echo "byteorder=$dflt"
17800 xxx_prompt=n
17801 ;;
17802 ????|????????) echo "(The test program ran ok.)" ;;
17803 *) echo "(The test program didn't run right for some reason.)" ;;
17804 esac
17805 else
17806 dflt='4321'
17807 cat <<'EOM'
17808(I can't seem to compile the test program. Guessing big-endian...)
17809EOM
17810 fi
17811 case "$xxx_prompt" in
17812 y)
24412007 17813 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
17814 . ./myread
17815 byteorder="$ans"
17816 ;;
17817 *) byteorder=$dflt
17818 ;;
17819 esac
17820 ;;
17821 esac
17822 $rm -f try.c try
17823 ;;
17824esac
17825
17826
17827$cat <<EOM
17828
17829Checking to see whether you can access character data unalignedly...
17830EOM
dc7b0a4f
JH
17831case "$d_u32align" in
17832'') $cat >try.c <<EOCP
4e0554ec 17833#include <stdio.h>
d1daaddf
JH
17834#$i_stdlib I_STDLIB
17835#ifdef I_STDLIB
17836#include <stdlib.h>
17837#endif
4e0554ec 17838#define U32 $u32type
d308175a
JH
17839#define BYTEORDER 0x$byteorder
17840#define U8 $u8type
9958dc3c
JH
17841#include <signal.h>
17842#ifdef SIGBUS
7090f861 17843$signal_t bletch(int s) { exit(4); }
9958dc3c 17844#endif
4e0554ec
JH
17845int main() {
17846#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
8906a23e 17847 U8 buf[8];
4e0554ec
JH
17848 U32 *up;
17849 int i;
17850
17851 if (sizeof(U32) != 4) {
17852 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17853 exit(1);
17854 }
17855
17856 fflush(stdout);
17857
9958dc3c
JH
17858#ifdef SIGBUS
17859 signal(SIGBUS, bletch);
17860#endif
17861
8906a23e
JH
17862 buf[0] = 0;
17863 buf[1] = 0;
17864 buf[2] = 0;
17865 buf[3] = 1;
7eac3fd6 17866 buf[4] = 0;
8906a23e
JH
17867 buf[5] = 0;
17868 buf[6] = 0;
7eac3fd6 17869 buf[7] = 1;
8906a23e 17870
4e0554ec
JH
17871 for (i = 0; i < 4; i++) {
17872 up = (U32*)(buf + i);
17873 if (! ((*up == 1 << (8*i)) || /* big-endian */
17874 (*up == 1 << (8*(3-i))) /* little-endian */
17875 )
17876 )
17877 {
17878 printf("read failed (%x)\n", *up);
17879 exit(2);
17880 }
17881 }
17882
17883 /* write test */
17884 for (i = 0; i < 4; i++) {
17885 up = (U32*)(buf + i);
17886 *up = 0xBeef;
17887 if (*up != 0xBeef) {
17888 printf("write failed (%x)\n", *up);
17889 exit(3);
17890 }
17891 }
17892
17893 exit(0);
17894#else
17895 printf("1\n");
17896 exit(1);
17897#endif
17898 return 0;
17899}
17900EOCP
17901set try
17902if eval $compile_ok; then
d308175a 17903 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 17904 $run ./try 2>&1 >/dev/null
4e0554ec
JH
17905 case "$?" in
17906 0) cat >&4 <<EOM
17907You can access character data pretty unalignedly.
17908EOM
17909 d_u32align="$undef"
17910 ;;
17911 *) cat >&4 <<EOM
17912It seems that you must access character data in an aligned manner.
17913EOM
17914 d_u32align="$define"
17915 ;;
17916 esac
4e0554ec
JH
17917else
17918 rp='Can you access character data at unaligned addresses?'
17919 dflt='n'
17920 . ./myread
17921 case "$ans" in
17922 [yY]*) d_u32align="$undef" ;;
17923 *) d_u32align="$define" ;;
17924 esac
17925fi
e36b5403 17926$rm -f core core.try.* try.core
dc7b0a4f
JH
17927;;
17928esac
4e0554ec
JH
17929
17930: see if ualarm exists
17931set ualarm d_ualarm
17932eval $inlibc
17933
b4eb6b3d
JH
17934: see if umask exists
17935set umask d_umask
17936eval $inlibc
17937
758a5d79
JH
17938: see if unordered exists
17939set unordered d_unordered
17940eval $inlibc
17941
bdf33aa7
SP
17942: see if unsetenv exists
17943set unsetenv d_unsetenv
17944eval $inlibc
17945
4e0554ec
JH
17946: see if usleep exists
17947set usleep d_usleep
17948eval $inlibc
17949
2ef53570
JH
17950: see if prototype for usleep is available
17951echo " "
17952set d_usleepproto usleep $i_unistd unistd.h
17953eval $hasproto
17954
b4eb6b3d
JH
17955: see if ustat exists
17956set ustat d_ustat
17957eval $inlibc
17958
17959: backward compatibility for d_hvfork
17960if test X$d_hvfork != X; then
17961 d_vfork="$d_hvfork"
17962 d_hvfork=''
17963fi
17964: see if there is a vfork
17965val=''
17966set vfork val
17967eval $inlibc
17968
17969: Ok, but do we want to use it. vfork is reportedly unreliable in
17970: perl on Solaris 2.x, and probably elsewhere.
17971case "$val" in
17972$define)
17973 echo " "
17974 case "$usevfork" in
17975 false) dflt='n';;
17976 *) dflt='y';;
17977 esac
17978 cat <<'EOM'
17979
17980Perl can only use a vfork() that doesn't suffer from strict
17981restrictions on calling functions or modifying global data in
17982the child. For example, glibc-2.1 contains such a vfork()
17983that is unsuitable. If your system provides a proper fork()
17984call, chances are that you do NOT want perl to use vfork().
17985
17986EOM
17987 rp="Do you still want to use vfork()?"
17988 . ./myread
17989 case "$ans" in
17990 y|Y) ;;
17991 *)
17992 echo "Ok, we won't use vfork()."
17993 val="$undef"
17994 ;;
17995 esac
17996 ;;
17997esac
17998set d_vfork
17999eval $setvar
18000case "$d_vfork" in
18001$define) usevfork='true';;
18002*) usevfork='false';;
18003esac
18004
b4eb6b3d
JH
18005: see if closedir exists
18006set closedir d_closedir
18007eval $inlibc
18008
18009case "$d_closedir" in
18010"$define")
18011 echo " "
18012 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 18013 cat > try.c <<EOM
b4eb6b3d
JH
18014#$i_dirent I_DIRENT /**/
18015#$i_sysdir I_SYS_DIR /**/
18016#$i_sysndir I_SYS_NDIR /**/
18017#$i_systypes I_SYS_TYPES /**/
18018
18019#if defined(I_SYS_TYPES)
18020#include <sys/types.h>
18021#endif
18022#if defined(I_DIRENT)
18023#include <dirent.h>
18024#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18025#include <sys/dir.h>
18026#endif
18027#else
18028#ifdef I_SYS_NDIR
18029#include <sys/ndir.h>
18030#else
18031#ifdef I_SYS_DIR
18032#ifdef hp9000s500
18033#include <ndir.h> /* may be wrong in the future */
18034#else
18035#include <sys/dir.h>
18036#endif
18037#endif
18038#endif
18039#endif
18040int main() { return closedir(opendir(".")); }
18041EOM
5440bc8e 18042 set try
b4eb6b3d 18043 if eval $compile_ok; then
5440bc8e 18044 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
18045 echo "Yes, it does."
18046 val="$undef"
18047 else
18048 echo "No, it doesn't."
18049 val="$define"
18050 fi
18051 else
18052 echo "(I can't seem to compile the test program--assuming it doesn't)"
18053 val="$define"
18054 fi
18055 ;;
18056*)
18057 val="$undef";
18058 ;;
18059esac
18060set d_void_closedir
18061eval $setvar
5440bc8e 18062$rm -f try try.*
b4eb6b3d
JH
18063: see if there is a wait4
18064set wait4 d_wait4
18065eval $inlibc
18066
18067: see if waitpid exists
18068set waitpid d_waitpid
18069eval $inlibc
18070
18071: see if wcstombs exists
18072set wcstombs d_wcstombs
18073eval $inlibc
18074
18075: see if wctomb exists
18076set wctomb d_wctomb
18077eval $inlibc
18078
4e0554ec
JH
18079: see if writev exists
18080set writev d_writev
18081eval $inlibc
18082
b4eb6b3d
JH
18083: preserve RCS keywords in files with variable substitution, grrr
18084Date='$Date'
18085Id='$Id'
18086Log='$Log'
18087RCSfile='$RCSfile'
18088Revision='$Revision'
18089
b4eb6b3d
JH
18090: check for alignment requirements
18091echo " "
5440bc8e 18092case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
18093*$define*)
18094 $cat <<EOM
18095You seem to be either cross-compiling or doing a multiarchitecture build,
18096skipping the memory alignment check.
18097
18098EOM
18099 case "$alignbytes" in
18100 '') alignbytes=8 ;;
18101 esac
18102 ;;
18103*)
18104 case "$alignbytes" in
18105 '') echo "Checking alignment constraints..." >&4
18106 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18107 $cat >try.c <<'EOCP'
18108typedef long double NV;
18109EOCP
18110 else
18111 $cat >try.c <<'EOCP'
18112typedef double NV;
18113EOCP
18114 fi
18115 $cat >>try.c <<'EOCP'
18116#include <stdio.h>
18117struct foobar {
18118 char foo;
18119 NV bar;
18120} try_algn;
18121int main()
18122{
18123 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18124 return(0);
18125}
18126EOCP
18127 set try
18128 if eval $compile_ok; then
5440bc8e 18129 dflt=`$run ./try`
b4eb6b3d
JH
18130 else
18131 dflt='8'
18132 echo "(I can't seem to compile the test program...)"
18133 fi
18134 ;;
18135 *) dflt="$alignbytes"
18136 ;;
18137 esac
18138 rp="Doubles must be aligned on a how-many-byte boundary?"
18139 . ./myread
18140 alignbytes="$ans"
18141 $rm -f try.c try
18142 ;;
18143esac
18144
18145
18146: set the base revision
18147baserev=5.0
18148
3099fc99 18149: how do we concatenate cpp tokens here?
b4eb6b3d 18150echo " "
3099fc99 18151echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
18152$cat >cpp_stuff.c <<'EOCP'
18153#define RCAT(a,b)a/**/b
18154#define ACAT(a,b)a ## b
18155RCAT(Rei,ser)
18156ACAT(Cir,cus)
18157EOCP
18158$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18159if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18160 echo "Oh! Smells like ANSI's been here." >&4
18161 echo "We can catify or stringify, separately or together!"
18162 cpp_stuff=42
18163elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18164 echo "Ah, yes! The good old days!" >&4
18165 echo "However, in the good old days we don't know how to stringify and"
18166 echo "catify at the same time."
18167 cpp_stuff=1
18168else
18169 $cat >&4 <<EOM
3099fc99
CW
18170Hmm, I don't seem to be able to concatenate tokens with your cpp.
18171You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
18172EOM
18173 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18174fi
18175$rm -f cpp_stuff.*
18176
18177: see if this is a db.h system
18178set db.h i_db
18179eval $inhdr
18180
18181case "$i_db" in
18182$define)
18183 : Check db version.
18184 echo " "
18185 echo "Checking Berkeley DB version ..." >&4
18186 $cat >try.c <<EOCP
18187#$d_const HASCONST
18188#ifndef HASCONST
18189#define const
18190#endif
18191#include <sys/types.h>
18192#include <stdio.h>
55954f19
JH
18193#$i_stdlib I_STDLIB
18194#ifdef I_STDLIB
18195#include <stdlib.h>
18196#endif
b4eb6b3d 18197#include <db.h>
640374d0 18198int main(int argc, char *argv[])
b4eb6b3d
JH
18199{
18200#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18201 int Major, Minor, Patch ;
18202 unsigned long Version ;
18203 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
18204 if (argc == 2) {
18205 printf("%d %d %d %d %d %d\n",
18206 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18207 Major, Minor, Patch);
18208 exit(0);
18209 }
18210 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
18211
18212 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18213 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18214 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18215 Major, Minor, Patch) ;
18216
18217 /* check that db.h & libdb are compatible */
18218 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 18219 printf("db.h and libdb are incompatible.\n") ;
b4eb6b3d
JH
18220 exit(3);
18221 }
18222
640374d0 18223 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
18224
18225 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18226 + DB_VERSION_PATCH ;
18227
18228 /* needs to be >= 2.3.4 */
18229 if (Version < 2003004) {
18230 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 18231 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
b4eb6b3d
JH
18232 exit(2);
18233 }
18234
18235 exit(0);
18236#else
18237#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
18238 if (argc == 2) {
18239 printf("1 0 0\n");
18240 exit(0);
18241 }
18242 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
18243 exit(0); /* DB version < 2: the coast is clear. */
18244#else
18245 exit(1); /* <db.h> not Berkeley DB? */
18246#endif
18247#endif
18248}
18249EOCP
18250 set try
5440bc8e 18251 if eval $compile_ok && $run ./try; then
b4eb6b3d 18252 echo 'Looks OK.' >&4
5440bc8e 18253 set `$run ./try 1`
640374d0
JH
18254 db_version_major=$1
18255 db_version_minor=$2
18256 db_version_patch=$3
b4eb6b3d
JH
18257 else
18258 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
18259 i_db=$undef
18260 case " $libs " in
18261 *"-ldb "*)
18262 : Remove db from list of libraries to use
18263 echo "Removing unusable -ldb from library list" >&4
18264 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18265 shift
18266 libs="$*"
18267 echo "libs = $libs" >&4
18268 ;;
18269 esac
18270 fi
18271 $rm -f try.*
18272 ;;
18273esac
18274
18275case "$i_db" in
18276define)
18277 : Check the return type needed for hash
18278 echo " "
18279 echo "Checking return type needed for hash for Berkeley DB ..." >&4
18280 $cat >try.c <<EOCP
18281#$d_const HASCONST
18282#ifndef HASCONST
18283#define const
18284#endif
18285#include <sys/types.h>
18286#include <db.h>
18287
18288#ifndef DB_VERSION_MAJOR
18289u_int32_t hash_cb (ptr, size)
18290const void *ptr;
18291size_t size;
18292{
18293}
18294HASHINFO info;
18295int main()
18296{
18297 info.hash = hash_cb;
18298}
18299#endif
18300EOCP
18301 if $cc $ccflags -c try.c >try.out 2>&1 ; then
18302 if $contains warning try.out >>/dev/null 2>&1 ; then
18303 db_hashtype='int'
18304 else
18305 db_hashtype='u_int32_t'
18306 fi
18307 else
18308 : XXX Maybe we should just give up here.
18309 db_hashtype=u_int32_t
18310 $cat try.out >&4
18311 echo "Help: I can't seem to compile the db test program." >&4
18312 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18313 fi
18314 $rm -f try.*
18315 echo "Your version of Berkeley DB uses $db_hashtype for hash."
18316 ;;
18317*) db_hashtype=u_int32_t
18318 ;;
18319esac
18320case "$i_db" in
18321define)
18322 : Check the return type needed for prefix
18323 echo " "
18324 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18325 cat >try.c <<EOCP
18326#$d_const HASCONST
18327#ifndef HASCONST
18328#define const
18329#endif
18330#include <sys/types.h>
18331#include <db.h>
18332
18333#ifndef DB_VERSION_MAJOR
18334size_t prefix_cb (key1, key2)
18335const DBT *key1;
18336const DBT *key2;
18337{
18338}
18339BTREEINFO info;
18340int main()
18341{
18342 info.prefix = prefix_cb;
18343}
18344#endif
18345EOCP
18346 if $cc $ccflags -c try.c >try.out 2>&1 ; then
18347 if $contains warning try.out >>/dev/null 2>&1 ; then
18348 db_prefixtype='int'
18349 else
18350 db_prefixtype='size_t'
18351 fi
18352 else
18353 db_prefixtype='size_t'
18354 : XXX Maybe we should just give up here.
18355 $cat try.out >&4
18356 echo "Help: I can't seem to compile the db test program." >&4
18357 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18358 fi
18359 $rm -f try.*
18360 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18361 ;;
18362*) db_prefixtype='size_t'
18363 ;;
18364esac
18365
b4eb6b3d
JH
18366
18367: How can we generate normalized random numbers ?
18368echo " "
18369echo "Looking for a random number function..." >&4
18370case "$randfunc" in
18371'')
18372 if set drand48 val -f; eval $csym; $val; then
18373 dflt="drand48"
18374 echo "Good, found drand48()." >&4
18375 elif set random val -f; eval $csym; $val; then
18376 dflt="random"
18377 echo "OK, found random()." >&4
18378 else
18379 dflt="rand"
18380 echo "Yick, looks like I have to use rand()." >&4
18381 fi
18382 echo " "
18383 ;;
18384*)
18385 dflt="$randfunc"
18386 ;;
18387esac
18388cont=true
18389
18390case "$ccflags" in
18391*-Dmy_rand=*|*-Dmy_srand=*)
18392 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18393 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18394 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18395 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18396 ;;
18397esac
18398
18399while $test "$cont"; do
18400 rp="Use which function to generate random numbers?"
18401 . ./myread
18402 if $test "$ans" = "$dflt"; then
18403 : null
18404 else
18405 randbits=''
18406 fi
18407 randfunc="$ans"
18408 if set $ans val -f; eval $csym; $val; then
18409 cont=''
18410 else
18411 dflt=y
18412 rp="I cannot find function $ans. Use that name anyway?"
18413 . ./myread
18414 dflt=rand
18415 case "$ans" in
18416 [yY]*) cont='';;
18417 esac
18418 fi
18419 case "$cont" in
18420 '')
18421 case "$randfunc" in
18422 drand48)
18423 drand01="drand48()"
18424 seedfunc="srand48"
18425 randbits=48
18426 randseedtype=long
18427 ;;
18428 rand|random)
18429 case "$randbits" in
18430 '')
18431echo "Checking to see how many bits your $randfunc() function produces..." >&4
18432 $cat >try.c <<EOCP
18433#$i_unistd I_UNISTD
18434#$i_stdlib I_STDLIB
18435#include <stdio.h>
18436#ifdef I_UNISTD
18437# include <unistd.h>
18438#endif
18439#ifdef I_STDLIB
18440# include <stdlib.h>
18441#endif
18442int main()
18443{
18444 register int i;
18445 register unsigned long tmp;
18446 register unsigned long max = 0L;
18447
18448 for (i = 1000; i; i--) {
18449 tmp = (unsigned long) $randfunc();
18450 if (tmp > max) max = tmp;
18451 }
18452 for (i = 0; max; i++)
18453 max /= 2;
18454 printf("%d\n",i);
18455}
18456EOCP
18457 set try
18458 if eval $compile_ok; then
18459 dflt=`try`
18460 else
18461 dflt='?'
18462 echo "(I can't seem to compile the test program...)"
18463 fi
18464 ;;
18465 *)
18466 dflt="$randbits"
18467 ;;
18468 esac
18469 rp="How many bits does your $randfunc() function produce?"
18470 . ./myread
18471 randbits="$ans"
18472 $rm -f try.c try
18473 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18474 seedfunc="s$randfunc"
18475 randseedtype=unsigned
18476 ;;
18477 *)
18478 dflt="31"
18479 rp="How many bits does your $randfunc() function produce?"
18480 . ./myread
18481 randbits="$ans"
18482 seedfunc="s$randfunc"
18483 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18484 if set $seedfunc val -f; eval $csym; $val; then
18485 echo "(Using $seedfunc() to seed random generator)"
18486 else
18487 echo "(Warning: no $seedfunc() to seed random generator)"
18488 seedfunc=rand
18489 fi
18490 randseedtype=unsigned
18491 ;;
18492 esac
18493 ;;
18494 esac
18495done
18496
18497echo " "
18498echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 18499$cat >try.c <<'EOM'
b4eb6b3d
JH
18500int main()
18501{
18502 if ('M'==0xd4) return 0;
18503 return 1;
18504}
18505EOM
18506
18507val=$undef
5440bc8e 18508set try
b4eb6b3d 18509if eval $compile_ok; then
5440bc8e 18510 if $run ./try; then
b4eb6b3d
JH
18511 echo "You seem to speak EBCDIC." >&4
18512 val="$define"
18513 else
5440bc8e 18514 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
18515 fi
18516else
18517 echo "I'm unable to compile the test program." >&4
18518 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18519fi
5440bc8e 18520$rm -f try try.*
b4eb6b3d
JH
18521set ebcdic
18522eval $setvar
18523
18524echo " "
18525$cat >&4 <<EOM
18526Checking how to flush all pending stdio output...
18527EOM
18528# I only know how to find the first 32 possibly open files on SunOS.
18529# See also hints/sunos_4_1.sh and util.c --AD
18530case "$osname" in
18531sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18532esac
18533$cat >>try.c <<EOCP
18534#include <stdio.h>
55954f19
JH
18535#$i_stdlib I_STDLIB
18536#ifdef I_STDLIB
18537#include <stdlib.h>
18538#endif
b4eb6b3d
JH
18539#$i_unistd I_UNISTD
18540#ifdef I_UNISTD
18541# include <unistd.h>
18542#endif
18543#$d_sysconf HAS_SYSCONF
18544#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18545#ifdef HAS_STDIO_STREAM_ARRAY
18546# define STDIO_STREAM_ARRAY $stdio_stream_array
18547#endif
18548int main() {
5440bc8e
JH
18549 FILE* p;
18550 unlink("try.out");
18551 p = fopen("try.out", "w");
b4eb6b3d
JH
18552#ifdef TRY_FPUTC
18553 fputc('x', p);
18554#else
18555# ifdef TRY_FPRINTF
18556 fprintf(p, "x");
18557# endif
18558#endif
18559#ifdef TRY_FFLUSH_NULL
18560 fflush(NULL);
18561#endif
18562#ifdef TRY_FFLUSH_ALL
18563 {
18564 long open_max = -1;
18565# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18566 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18567# else
18568# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18569 open_max = sysconf(_SC_OPEN_MAX);
18570# else
18571# ifdef FOPEN_MAX
18572 open_max = FOPEN_MAX;
18573# else
18574# ifdef OPEN_MAX
18575 open_max = OPEN_MAX;
18576# else
18577# ifdef _NFILE
18578 open_max = _NFILE;
18579# endif
18580# endif
18581# endif
18582# endif
18583# endif
18584# ifdef HAS_STDIO_STREAM_ARRAY
18585 if (open_max > 0) {
18586 long i;
18587 for (i = 0; i < open_max; i++)
18588 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18589 STDIO_STREAM_ARRAY[i]._file < open_max &&
18590 STDIO_STREAM_ARRAY[i]._flag)
18591 fflush(&STDIO_STREAM_ARRAY[i]);
18592 }
18593 }
18594# endif
18595#endif
18596 _exit(42);
18597}
18598EOCP
18599: first we have to find out how _not_ to flush
5440bc8e 18600$to try.c
b4eb6b3d
JH
18601if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18602 output=''
18603 set try -DTRY_FPUTC
18604 if eval $compile; then
fbe73d74 18605 $run ./try 2>/dev/null
28f5ac64 18606 code="$?"
5440bc8e 18607 $from try.out
28f5ac64 18608 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18609 output=-DTRY_FPUTC
18610 fi
18611 fi
18612 case "$output" in
18613 '')
18614 set try -DTRY_FPRINTF
b4eb6b3d 18615 if eval $compile; then
fbe73d74 18616 $run ./try 2>/dev/null
28f5ac64 18617 code="$?"
5440bc8e 18618 $from try.out
28f5ac64 18619 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18620 output=-DTRY_FPRINTF
18621 fi
18622 fi
18623 ;;
18624 esac
18625fi
18626: check for fflush NULL behaviour
18627case "$fflushNULL" in
18628'') set try -DTRY_FFLUSH_NULL $output
18629 if eval $compile; then
5440bc8e 18630 $run ./try 2>/dev/null
b4eb6b3d 18631 code="$?"
5440bc8e 18632 $from try.out
b4eb6b3d
JH
18633 if $test -s try.out -a "X$code" = X42; then
18634 fflushNULL="`$cat try.out`"
18635 else
18636 if $test "X$code" != X42; then
18637 $cat >&4 <<EOM
18638(If this test failed, don't worry, we'll try another method shortly.)
18639EOM
18640 fi
18641 fi
18642 fi
18643 $rm -f core try.core core.try.*
18644 case "$fflushNULL" in
18645 x) $cat >&4 <<EOM
18646Your fflush(NULL) works okay for output streams.
18647Let's see if it clobbers input pipes...
18648EOM
18649# As of mid-March 2000 all versions of Solaris appear to have a stdio
18650# bug that improperly flushes the input end of pipes. So we avoid the
18651# autoflush on fork/system/exec support for now. :-(
18652$cat >tryp.c <<EOCP
18653#include <stdio.h>
18654int
18655main(int argc, char **argv)
18656{
18657 char buf[1024];
18658 int i;
18659 char *bp = buf;
18660 while (1) {
18661 while ((i = getc(stdin)) != -1
18662 && (*bp++ = i) != '\n'
18663 && bp < &buf[1024])
18664 /* DO NOTHING */ ;
18665 *bp = '\0';
18666 fprintf(stdout, "%s", buf);
18667 fflush(NULL);
18668 if (i == -1)
18669 return 0;
18670 bp = buf;
18671 }
18672}
18673EOCP
18674 fflushNULL="$define"
18675 set tryp
18676 if eval $compile; then
18677 $rm -f tryp.out
5440bc8e 18678 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18679 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18680 $cat >&4 <<EOM
18681fflush(NULL) seems to behave okay with input streams.
18682EOM
18683 fflushNULL="$define"
18684 else
18685 $cat >&4 <<EOM
18686Ouch, fflush(NULL) clobbers input pipes! We will not use it.
18687EOM
18688 fflushNULL="$undef"
18689 fi
18690 fi
18691 $rm -f core tryp.c tryp.core core.tryp.*
18692 ;;
18693 '') $cat >&4 <<EOM
18694Your fflush(NULL) isn't working (contrary to ANSI C).
18695EOM
18696 fflushNULL="$undef"
18697 ;;
18698 *) $cat >&4 <<EOM
18699Cannot figure out whether your fflush(NULL) works or not.
18700I'm assuming it doesn't (contrary to ANSI C).
18701EOM
18702 fflushNULL="$undef"
18703 ;;
18704 esac
18705 ;;
18706$define|true|[yY]*)
18707 fflushNULL="$define"
18708 ;;
18709*)
18710 fflushNULL="$undef"
18711 ;;
18712esac
18713: check explicit looping only if NULL did not work, and if the pipe
18714: bug does not show up on an explicit flush too
18715case "$fflushNULL" in
18716"$undef")
18717 $cat >tryp.c <<EOCP
18718#include <stdio.h>
18719int
18720main(int argc, char **argv)
18721{
18722 char buf[1024];
18723 int i;
18724 char *bp = buf;
18725 while (1) {
18726 while ((i = getc(stdin)) != -1
18727 && (*bp++ = i) != '\n'
18728 && bp < &buf[1024])
18729 /* DO NOTHING */ ;
18730 *bp = '\0';
18731 fprintf(stdout, "%s", buf);
18732 fflush(stdin);
18733 if (i == -1)
18734 return 0;
18735 bp = buf;
18736 }
18737}
18738EOCP
18739 set tryp
18740 if eval $compile; then
18741 $rm -f tryp.out
5440bc8e 18742 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18743 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18744 $cat >&4 <<EOM
18745Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18746EOM
18747 : now check for fflushall behaviour
18748 case "$fflushall" in
18749 '') set try -DTRY_FFLUSH_ALL $output
18750 if eval $compile; then
18751 $cat >&4 <<EOM
18752(Now testing the other method--but note that this also may fail.)
18753EOM
5440bc8e 18754 $run ./try 2>/dev/null
28f5ac64 18755 code=$?
fbe73d74 18756 $from try.out
28f5ac64 18757 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18758 fflushall="`$cat try.out`"
18759 fi
18760 fi
18761 $rm -f core try.core core.try.*
18762 case "$fflushall" in
18763 x) $cat >&4 <<EOM
18764Whew. Flushing explicitly all the stdio streams works.
18765EOM
18766 fflushall="$define"
18767 ;;
18768 '') $cat >&4 <<EOM
18769Sigh. Flushing explicitly all the stdio streams doesn't work.
18770EOM
18771 fflushall="$undef"
18772 ;;
18773 *) $cat >&4 <<EOM
18774Cannot figure out whether flushing stdio streams explicitly works or not.
18775I'm assuming it doesn't.
18776EOM
18777 fflushall="$undef"
18778 ;;
18779 esac
18780 ;;
18781 "$define"|true|[yY]*)
18782 fflushall="$define"
18783 ;;
18784 *)
18785 fflushall="$undef"
18786 ;;
18787 esac
18788 else
18789 $cat >&4 <<EOM
18790All is futile. Even fflush(stdin) clobbers input pipes!
18791EOM
18792 fflushall="$undef"
18793 fi
18794 else
18795 fflushall="$undef"
18796 fi
18797 $rm -f core tryp.c tryp.core core.tryp.*
18798 ;;
18799*) fflushall="$undef"
18800 ;;
18801esac
18802
18803case "$fflushNULL$fflushall" in
18804undefundef)
18805 $cat <<EOM
18806OK, I give up. I cannot figure out how to flush pending stdio output.
18807We won't be flushing handles at all before fork/exec/popen.
18808EOM
18809 ;;
18810esac
18811$rm -f try.* try$exe_ext
18812
18813: Store the full pathname to the ar program for use in the C program
18814: Respect a hint or command line value for full_ar.
18815case "$full_ar" in
18816'') full_ar=$ar ;;
18817esac
18818
18819: Store the full pathname to the sed program for use in the C program
18820full_sed=$sed
18821
18822: see what type gids are declared as in the kernel
18823echo " "
18824echo "Looking for the type for group ids returned by getgid()."
18825set gid_t gidtype xxx stdio.h sys/types.h
18826eval $typedef
18827case "$gidtype" in
18828xxx)
18829 xxx=`./findhdr sys/user.h`
18830 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18831 case $1 in
18832 unsigned) dflt="$1 $2" ;;
18833 *) dflt="$1" ;;
18834 esac
18835 ;;
18836*) dflt="$gidtype";;
18837esac
18838case "$gidtype" in
18839gid_t) echo "gid_t found." ;;
18840*) rp="What is the type for group ids returned by getgid()?"
18841 . ./myread
18842 gidtype="$ans"
18843 ;;
18844esac
18845
18846echo " "
18847case "$gidtype" in
18848*_t) zzz="$gidtype" ;;
18849*) zzz="gid" ;;
18850esac
18851echo "Checking the size of $zzz..." >&4
18852cat > try.c <<EOCP
18853#include <sys/types.h>
18854#include <stdio.h>
d1daaddf
JH
18855#$i_stdlib I_STDLIB
18856#ifdef I_STDLIB
18857#include <stdlib.h>
18858#endif
b4eb6b3d
JH
18859int main() {
18860 printf("%d\n", (int)sizeof($gidtype));
18861 exit(0);
18862}
18863EOCP
18864set try
18865if eval $compile_ok; then
5440bc8e 18866 yyy=`$run ./try`
b4eb6b3d
JH
18867 case "$yyy" in
18868 '') gidsize=4
18869 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18870 ;;
18871 *) gidsize=$yyy
18872 echo "Your $zzz is $gidsize bytes long."
18873 ;;
18874 esac
18875else
18876 gidsize=4
18877 echo "(I can't compile the test program--guessing $gidsize.)" >&4
18878fi
18879
18880
18881echo " "
18882case "$gidtype" in
18883*_t) zzz="$gidtype" ;;
18884*) zzz="gid" ;;
18885esac
18886echo "Checking the sign of $zzz..." >&4
18887cat > try.c <<EOCP
18888#include <sys/types.h>
18889#include <stdio.h>
18890int main() {
18891 $gidtype foo = -1;
18892 if (foo < 0)
18893 printf("-1\n");
18894 else
18895 printf("1\n");
18896}
18897EOCP
18898set try
18899if eval $compile; then
5440bc8e 18900 yyy=`$run ./try`
b4eb6b3d
JH
18901 case "$yyy" in
18902 '') gidsign=1
18903 echo "(I can't execute the test program--guessing unsigned.)" >&4
18904 ;;
18905 *) gidsign=$yyy
18906 case "$gidsign" in
18907 1) echo "Your $zzz is unsigned." ;;
18908 -1) echo "Your $zzz is signed." ;;
18909 esac
18910 ;;
18911 esac
18912else
18913 gidsign=1
18914 echo "(I can't compile the test program--guessing unsigned.)" >&4
18915fi
18916
18917
18918echo " "
18919
18920if $test X"$quadtype" != X; then
18921
18922echo "Checking how to print 64-bit integers..." >&4
18923
18924if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18925 $cat >try.c <<'EOCP'
18926#include <sys/types.h>
18927#include <stdio.h>
18928int main() {
18929 int q = 12345678901;
18930 printf("%ld\n", q);
18931}
18932EOCP
18933 set try
18934 if eval $compile; then
5440bc8e 18935 yyy=`$run ./try`
b4eb6b3d
JH
18936 case "$yyy" in
18937 12345678901)
18938 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18939 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18940 echo "We will use %d."
18941 ;;
18942 esac
18943 fi
18944fi
18945
18946if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18947 $cat >try.c <<'EOCP'
18948#include <sys/types.h>
18949#include <stdio.h>
18950int main() {
18951 long q = 12345678901;
18952 printf("%ld\n", q);
18953}
18954EOCP
18955 set try
18956 if eval $compile; then
5440bc8e 18957 yyy=`$run ./try`
b4eb6b3d
JH
18958 case "$yyy" in
18959 12345678901)
18960 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18961 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18962 echo "We will use %ld."
18963 ;;
18964 esac
18965 fi
18966fi
18967
18968if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18969 $cat >try.c <<'EOCP'
18970#include <sys/types.h>
18971#include <inttypes.h>
18972#include <stdio.h>
18973int main() {
18974 int64_t q = 12345678901;
18975 printf("%" PRId64 "\n", q);
18976}
18977EOCP
18978 set try
18979 if eval $compile; then
5440bc8e 18980 yyy=`$run ./try`
b4eb6b3d
JH
18981 case "$yyy" in
18982 12345678901)
18983 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18984 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18985 echo "We will use the C9X style."
18986 ;;
18987 esac
18988 fi
18989fi
18990
2ef53570
JH
18991if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18992 $cat >try.c <<EOCP
b4eb6b3d
JH
18993#include <sys/types.h>
18994#include <stdio.h>
18995int main() {
2ef53570
JH
18996 $quadtype q = 12345678901;
18997 printf("%Ld\n", q);
b4eb6b3d
JH
18998}
18999EOCP
19000 set try
19001 if eval $compile; then
5440bc8e 19002 yyy=`$run ./try`
b4eb6b3d
JH
19003 case "$yyy" in
19004 12345678901)
2ef53570
JH
19005 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19006 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19007 echo "We will use %Ld."
b4eb6b3d
JH
19008 ;;
19009 esac
19010 fi
19011fi
19012
2ef53570
JH
19013if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19014 $cat >try.c <<'EOCP'
b4eb6b3d
JH
19015#include <sys/types.h>
19016#include <stdio.h>
19017int main() {
2ef53570
JH
19018 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19019 printf("%lld\n", q);
b4eb6b3d
JH
19020}
19021EOCP
19022 set try
19023 if eval $compile; then
5440bc8e 19024 yyy=`$run ./try`
b4eb6b3d
JH
19025 case "$yyy" in
19026 12345678901)
2ef53570
JH
19027 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19028 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19029 echo "We will use the %lld style."
b4eb6b3d
JH
19030 ;;
19031 esac
19032 fi
19033fi
19034
19035if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19036 $cat >try.c <<EOCP
19037#include <sys/types.h>
19038#include <stdio.h>
19039int main() {
19040 $quadtype q = 12345678901;
19041 printf("%qd\n", q);
19042}
19043EOCP
19044 set try
19045 if eval $compile; then
5440bc8e 19046 yyy=`$run ./try`
b4eb6b3d
JH
19047 case "$yyy" in
19048 12345678901)
19049 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19050 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19051 echo "We will use %qd."
19052 ;;
19053 esac
19054 fi
19055fi
19056
19057if $test X"$sPRId64" = X; then
19058 echo "Cannot figure out how to print 64-bit integers." >&4
19059fi
19060
19061$rm -f try try.*
19062
19063fi
19064
19065case "$sPRId64" in
19066'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19067 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19068 ;;
19069*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19070 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19071 ;;
19072esac
19073
19074
19075echo " "
19076$echo "Checking the format strings to be used for Perl's internal types..." >&4
19077
19078if $test X"$ivsize" = X8; then
19079 ivdformat="$sPRId64"
19080 uvuformat="$sPRIu64"
19081 uvoformat="$sPRIo64"
19082 uvxformat="$sPRIx64"
19083 uvXUformat="$sPRIXU64"
19084else
19085 if $test X"$ivsize" = X"$longsize"; then
19086 ivdformat='"ld"'
19087 uvuformat='"lu"'
19088 uvoformat='"lo"'
19089 uvxformat='"lx"'
19090 uvXUformat='"lX"'
19091 else
19092 if $test X"$ivsize" = X"$intsize"; then
19093 ivdformat='"d"'
19094 uvuformat='"u"'
19095 uvoformat='"o"'
19096 uvxformat='"x"'
19097 uvXUformat='"X"'
19098 else
19099 : far out
19100 if $test X"$ivsize" = X"$shortsize"; then
19101 ivdformat='"hd"'
19102 uvuformat='"hu"'
19103 uvoformat='"ho"'
19104 uvxformat='"hx"'
19105 uvXUformat='"hX"'
19106 fi
19107 fi
19108 fi
19109fi
19110
19111if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19112 nveformat="$sPRIeldbl"
19113 nvfformat="$sPRIfldbl"
19114 nvgformat="$sPRIgldbl"
19115 nvEUformat="$sPRIEUldbl"
19116 nvFUformat="$sPRIFUldbl"
19117 nvGUformat="$sPRIGUldbl"
19118else
19119 nveformat='"e"'
19120 nvfformat='"f"'
19121 nvgformat='"g"'
19122 nvEUformat='"E"'
19123 nvFUformat='"F"'
19124 nvGUformat='"G"'
19125fi
19126
19127case "$ivdformat" in
3c728e00 19128'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
19129 exit 1
19130 ;;
19131esac
19132
19133
19134echo " "
19135$echo "Checking the format string to be used for gids..." >&4
19136
19137case "$gidsign" in
19138-1) if $test X"$gidsize" = X"$ivsize"; then
19139 gidformat="$ivdformat"
19140 else
19141 if $test X"$gidsize" = X"$longsize"; then
19142 gidformat='"ld"'
19143 else
19144 if $test X"$gidsize" = X"$intsize"; then
19145 gidformat='"d"'
19146 else
19147 if $test X"$gidsize" = X"$shortsize"; then
19148 gidformat='"hd"'
19149 fi
19150 fi
19151 fi
19152 fi
19153 ;;
19154*) if $test X"$gidsize" = X"$uvsize"; then
19155 gidformat="$uvuformat"
19156 else
19157 if $test X"$gidsize" = X"$longsize"; then
19158 gidformat='"lu"'
19159 else
19160 if $test X"$gidsize" = X"$intsize"; then
19161 gidformat='"u"'
19162 else
19163 if $test X"$gidsize" = X"$shortsize"; then
19164 gidformat='"hu"'
19165 fi
19166 fi
19167 fi
19168 fi
19169 ;;
19170esac
19171
19172: see if getgroups exists
19173set getgroups d_getgrps
19174eval $inlibc
19175
19176: see if setgroups exists
19177set setgroups d_setgrps
19178eval $inlibc
19179
19180
19181: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19182echo " "
19183case "$d_getgrps$d_setgrps" in
19184*define*)
19185 case "$groupstype" in
19186 '') dflt="$gidtype" ;;
19187 *) dflt="$groupstype" ;;
19188 esac
19189 $cat <<EOM
19190What type of pointer is the second argument to getgroups() and setgroups()?
19191Usually this is the same as group ids, $gidtype, but not always.
19192
19193EOM
19194 rp='What type pointer is the second argument to getgroups() and setgroups()?'
19195 . ./myread
19196 groupstype="$ans"
19197 ;;
19198*) groupstype="$gidtype";;
19199esac
19200
d620c7b3 19201
fd655d33
NC
19202if $test $patchlevel -lt 9; then
19203: MAD is not available in 5.8.x or earlier.
19204 ans=n;
19205else
19206 case "$mad" in
19207 $define|true|[yY]*) dflt='y' ;;
19208 *) dflt='n' ;;
19209 esac
19210 cat <<EOM
d620c7b3
MB
19211
19212Would you like to build with Misc Attribute Decoration? This is development
19213work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19214overhead on the interpreter.
19215
19216If this doesn't make any sense to you, just accept the default '$dflt'.
19217EOM
fd655d33
NC
19218 rp='Build Perl with MAD?'
19219 . ./myread
19220fi
d620c7b3 19221case "$ans" in
00e74f14
NC
19222y|Y) val="$define"
19223 madlyh='madly.h madly.act madly.tab'
19224 madlysrc='madly.c'
19225 madlyobj="madly$_o" ;;
19226*) val="$undef"
19227 madlyh=''
19228 madlysrc=''
19229 madlyobj='' ;;
d620c7b3
MB
19230esac
19231set mad
19232eval $setvar
19233
b4eb6b3d
JH
19234echo " "
19235echo "Checking if your $make program sets \$(MAKE)..." >&4
19236case "$make_set_make" in
19237'')
19238 $sed 's/^X //' > testmake.mak << 'EOF'
19239Xall:
19240X @echo 'maketemp="$(MAKE)"'
19241EOF
19242 case "`$make -f testmake.mak 2>/dev/null`" in
19243 *maketemp=*) make_set_make='#' ;;
19244 *) make_set_make="MAKE=$make" ;;
19245 esac
19246 $rm -f testmake.mak
19247 ;;
19248esac
19249case "$make_set_make" in
19250'#') echo "Yup, it does.";;
19251*) echo "Nope, it doesn't.";;
19252esac
19253
19254: see what type is used for mode_t
19255rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19256set mode_t modetype int stdio.h sys/types.h
19257eval $typedef_ask
19258
2cc61e15
DD
19259: see if we need va_copy
19260echo " "
19261case "$i_stdarg" in
19262"$define")
19263 $cat >try.c <<EOCP
19264#include <stdarg.h>
19265#include <stdio.h>
85c8a686
DD
19266#$i_stdlib I_STDLIB
19267#ifdef I_STDLIB
19268#include <stdlib.h>
19269#endif
19270#include <signal.h>
2cc61e15
DD
19271
19272int
19273ivfprintf(FILE *f, const char *fmt, va_list *valp)
19274{
19275 return vfprintf(f, fmt, *valp);
19276}
19277
19278int
19279myvfprintf(FILE *f, const char *fmt, va_list val)
19280{
19281 return ivfprintf(f, fmt, &val);
19282}
19283
19284int
19285myprintf(char *fmt, ...)
19286{
19287 va_list val;
19288 va_start(val, fmt);
19289 return myvfprintf(stdout, fmt, val);
19290}
19291
19292int
19293main(int ac, char **av)
19294{
85c8a686
DD
19295 signal(SIGSEGV, exit);
19296
2cc61e15
DD
19297 myprintf("%s%cs all right, then\n", "that", '\'');
19298 exit(0);
19299}
19300EOCP
19301 set try
5440bc8e
JH
19302 if eval $compile && $run ./try 2>&1 >/dev/null; then
19303 case "`$run ./try`" in
2cc61e15
DD
19304 "that's all right, then")
19305 okay=yes
19306 ;;
19307 esac
19308 fi
19309 case "$okay" in
19310 yes) echo "It seems that you don't need va_copy()." >&4
19311 need_va_copy="$undef"
19312 ;;
19313 *) echo "It seems that va_copy() or similar will be needed." >&4
19314 need_va_copy="$define"
19315 ;;
19316 esac
19317 $rm -f try.* core core.* *.core *.core.*
19318 ;;
19319*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19320 ;;
19321esac
19322
b4eb6b3d
JH
19323: see what type is used for size_t
19324rp="What is the type used for the length parameter for string functions?"
19325set size_t sizetype 'unsigned int' stdio.h sys/types.h
19326eval $typedef_ask
19327
19328: check for type of arguments to gethostbyaddr.
19329if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19330 case "$d_gethbyaddr" in
19331 $define)
19332 $cat <<EOM
19333
19334Checking to see what type of arguments are accepted by gethostbyaddr().
19335EOM
19336 hdrs="$define sys/types.h
19337 $d_socket sys/socket.h
19338 $i_niin netinet/in.h
19339 $i_netdb netdb.h
19340 $i_unistd unistd.h"
19341 : The first arg can 'char *' or 'void *'
19342 : The second arg is some of integral type
19343 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19344 for yyy in size_t long int; do
19345 case "$netdb_host_type" in
19346 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19347 if ./protochk "$try" $hdrs; then
19348 echo "Your system accepts $xxx for the first arg."
19349 echo "...and $yyy for the second arg."
19350 netdb_host_type="$xxx"
19351 netdb_hlen_type="$yyy"
19352 fi
19353 ;;
19354 esac
19355 done
19356 done
19357 : In case none of those worked, prompt the user.
19358 case "$netdb_host_type" in
19359 '') rp='What is the type for the 1st argument to gethostbyaddr?'
19360 dflt='char *'
19361 . ./myread
19362 netdb_host_type=$ans
19363 rp='What is the type for the 2nd argument to gethostbyaddr?'
19364 dflt="$sizetype"
19365 . ./myread
19366 netdb_hlen_type=$ans
19367 ;;
19368 esac
19369 ;;
19370 *) : no gethostbyaddr, so pick harmless defaults
19371 netdb_host_type='char *'
19372 netdb_hlen_type="$sizetype"
19373 ;;
19374 esac
19375 # Remove the "const" if needed. -- but then we'll have a
19376 # prototype clash!
19377 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19378fi
19379
19380: check for type of argument to gethostbyname.
19381if test "X$netdb_name_type" = X ; then
19382 case "$d_gethbyname" in
19383 $define)
19384 $cat <<EOM
19385
19386Checking to see what type of argument is accepted by gethostbyname().
19387EOM
19388 hdrs="$define sys/types.h
19389 $d_socket sys/socket.h
19390 $i_niin netinet/in.h
19391 $i_netdb netdb.h
19392 $i_unistd unistd.h"
19393 for xxx in "const char *" "char *"; do
19394 case "$netdb_name_type" in
19395 '') try="extern struct hostent *gethostbyname($xxx);"
19396 if ./protochk "$try" $hdrs; then
19397 echo "Your system accepts $xxx."
19398 netdb_name_type="$xxx"
19399 fi
19400 ;;
19401 esac
19402 done
19403 : In case none of those worked, prompt the user.
19404 case "$netdb_name_type" in
19405 '') rp='What is the type for the 1st argument to gethostbyname?'
19406 dflt='char *'
19407 . ./myread
19408 netdb_name_type=$ans
19409 ;;
19410 esac
19411 ;;
19412 *) : no gethostbyname, so pick harmless default
19413 netdb_name_type='char *'
19414 ;;
19415 esac
19416fi
19417
19418: check for type of 1st argument to getnetbyaddr.
19419if test "X$netdb_net_type" = X ; then
19420 case "$d_getnbyaddr" in
19421 $define)
19422 $cat <<EOM
19423
19424Checking to see what type of 1st argument is accepted by getnetbyaddr().
19425EOM
19426 hdrs="$define sys/types.h
19427 $d_socket sys/socket.h
19428 $i_niin netinet/in.h
19429 $i_netdb netdb.h
19430 $i_unistd unistd.h"
19431 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19432 case "$netdb_net_type" in
19433 '') try="extern struct netent *getnetbyaddr($xxx, int);"
19434 if ./protochk "$try" $hdrs; then
19435 echo "Your system accepts $xxx."
19436 netdb_net_type="$xxx"
19437 fi
19438 ;;
19439 esac
19440 done
19441 : In case none of those worked, prompt the user.
19442 case "$netdb_net_type" in
19443 '') rp='What is the type for the 1st argument to getnetbyaddr?'
19444 dflt='long'
19445 . ./myread
19446 netdb_net_type=$ans
19447 ;;
19448 esac
19449 ;;
19450 *) : no getnetbyaddr, so pick harmless default
19451 netdb_net_type='long'
19452 ;;
19453 esac
19454fi
19455: locate the preferred pager for this system
d604bb53 19456fn=f/
b4eb6b3d
JH
19457case "$pager" in
19458'')
19459 dflt=''
19460 case "$pg" in
19461 /*) dflt=$pg;;
19462 [a-zA-Z]:/*) dflt=$pg;;
19463 esac
19464 case "$more" in
19465 /*) dflt=$more;;
19466 [a-zA-Z]:/*) dflt=$more;;
19467 esac
19468 case "$less" in
19469 /*) dflt=$less;;
19470 [a-zA-Z]:/*) dflt=$less;;
19471 esac
19472 case "$dflt" in
19473 '') dflt=/usr/ucb/more;;
19474 esac
19475 ;;
d604bb53
JH
19476*) dflt="$pager"
19477 : Instruct ./getfile to trust the hinted or previous pager value,
19478 : even if it does not begin with a slash. For example, on os2,
19479 : pager might be cmd /c more. See comments in UU/getfile.
19480 fn="f/($pager)"
19481 ;;
b4eb6b3d
JH
19482esac
19483echo " "
b4eb6b3d
JH
19484rp='What pager is used on your system?'
19485. ./getfile
19486pager="$ans"
19487
19488: see what type pids are declared as in the kernel
19489rp="What is the type of process ids on this system?"
19490set pid_t pidtype int stdio.h sys/types.h
19491eval $typedef_ask
19492
b4eb6b3d
JH
19493: see if ar generates random libraries by itself
19494echo " "
19495echo "Checking how to generate random libraries on your machine..." >&4
19496echo 'int bar1() { return bar2(); }' > bar1.c
19497echo 'int bar2() { return 2; }' > bar2.c
55954f19
JH
19498$cat > foo.c <<EOP
19499#$i_stdlib I_STDLIB
19500#ifdef I_STDLIB
19501#include <stdlib.h>
19502#endif
b4eb6b3d
JH
19503int main() { printf("%d\n", bar1()); exit(0); }
19504EOP
19505$cc $ccflags -c bar1.c >/dev/null 2>&1
19506$cc $ccflags -c bar2.c >/dev/null 2>&1
19507$cc $ccflags -c foo.c >/dev/null 2>&1
19508$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 19509if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19510 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19511 echo "$ar appears to generate random libraries itself."
19512 orderlib=false
e39a9d84
LC
19513 if [ "X$ranlib" = "X" ]; then
19514 ranlib=":"
19515 fi
88d4d47b
PC
19516elif $ar s bar$_a >/dev/null 2>&1 &&
19517 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19518 $run ./foobar >/dev/null 2>&1; then
19519 echo "a table of contents needs to be added with '$ar s'."
19520 orderlib=false
19521 ranlib="$ar s"
b4eb6b3d 19522elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 19523 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19524 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19525 echo "a table of contents needs to be added with '$ar ts'."
19526 orderlib=false
19527 ranlib="$ar ts"
19528else
19529 case "$ranlib" in
19530 :) ranlib='';;
19531 '')
19532 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19533 $test -f $ranlib || ranlib=''
19534 ;;
19535 esac
19536 if $test -n "$ranlib"; then
19537 echo "your system has '$ranlib'; we'll use that."
19538 orderlib=false
19539 else
19540 echo "your system doesn't seem to support random libraries"
19541 echo "so we'll use lorder and tsort to order the libraries."
19542 orderlib=true
19543 ranlib=":"
19544 fi
19545fi
88d4d47b 19546$rm -f foo* bar*
b4eb6b3d
JH
19547
19548: check for type of arguments to select.
19549case "$selecttype" in
19550'') case "$d_select" in
19551 $define)
19552 echo " "
19553 $cat <<EOM
19554Checking to see what type of arguments are accepted by select().
19555EOM
19556 hdrs="$define sys/types.h
19557 $i_systime sys/time.h
19558 $i_sysselct sys/select.h
19559 $d_socket sys/socket.h"
19560 : The first arg can be int, unsigned, or size_t
19561 : The last arg may or may not be 'const'
19562 val=''
19563 : void pointer has been seen but using that
19564 : breaks the selectminbits test
19565 for xxx in 'fd_set *' 'int *'; do
19566 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19567 for tmo in 'struct timeval *' 'const struct timeval *'; do
19568 case "$val" in
19569 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19570 if ./protochk "$try" $hdrs; then
19571 echo "Your system accepts $xxx."
19572 val="$xxx"
19573 fi
19574 ;;
19575 esac
19576 done
19577 done
19578 done
19579 case "$val" in
19580 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19581 case "$d_fd_set" in
19582 $define) dflt="fd_set *" ;;
19583 *) dflt="int *" ;;
19584 esac
19585 . ./myread
19586 val=$ans
19587 ;;
19588 esac
19589 selecttype="$val"
19590 ;;
19591 *) : no select, so pick a harmless default
19592 selecttype='int *'
19593 ;;
19594 esac
19595 ;;
19596esac
19597
19598: check for the select 'width'
19599case "$selectminbits" in
e6e7e605
JH
19600'') safebits=`expr $ptrsize \* 8`
19601 case "$d_select" in
b4eb6b3d
JH
19602 $define)
19603 $cat <<EOM
19604
19605Checking to see on how many bits at a time your select() operates...
19606EOM
19607 $cat >try.c <<EOCP
19608#include <sys/types.h>
19609#$i_time I_TIME
19610#$i_systime I_SYS_TIME
19611#$i_systimek I_SYS_TIME_KERNEL
19612#ifdef I_TIME
19613# include <time.h>
19614#endif
19615#ifdef I_SYS_TIME
19616# ifdef I_SYS_TIME_KERNEL
19617# define KERNEL
19618# endif
19619# include <sys/time.h>
19620# ifdef I_SYS_TIME_KERNEL
19621# undef KERNEL
19622# endif
19623#endif
19624#$i_sysselct I_SYS_SELECT
19625#ifdef I_SYS_SELECT
19626#include <sys/select.h>
19627#endif
19628#$d_socket HAS_SOCKET
19629#ifdef HAS_SOCKET
19630# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19631#endif
19632#include <stdio.h>
d1daaddf
JH
19633#$i_stdlib I_STDLIB
19634#ifdef I_STDLIB
19635#include <stdlib.h>
19636#endif
b4eb6b3d
JH
19637$selecttype b;
19638#define S sizeof(*(b))
19639#define MINBITS 64
19640#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19641#define NBITS (NBYTES * 8)
19642int main() {
7090f861 19643 char *s = (char *)malloc(NBYTES);
b4eb6b3d
JH
19644 struct timeval t;
19645 int i;
19646 FILE* fp;
19647 int fd;
19648
e6e7e605
JH
19649 if (!s)
19650 exit(1);
b4eb6b3d
JH
19651 fclose(stdin);
19652 fp = fopen("try.c", "r");
19653 if (fp == 0)
e6e7e605 19654 exit(2);
b4eb6b3d
JH
19655 fd = fileno(fp);
19656 if (fd < 0)
e6e7e605 19657 exit(3);
b4eb6b3d
JH
19658 b = ($selecttype)s;
19659 for (i = 0; i < NBITS; i++)
19660 FD_SET(i, b);
19661 t.tv_sec = 0;
19662 t.tv_usec = 0;
19663 select(fd + 1, b, 0, 0, &t);
19664 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
e6e7e605 19665 free(s);
b4eb6b3d
JH
19666 printf("%d\n", i + 1);
19667 return 0;
19668}
19669EOCP
19670 set try
19671 if eval $compile_ok; then
5440bc8e 19672 selectminbits=`$run ./try`
b4eb6b3d
JH
19673 case "$selectminbits" in
19674 '') cat >&4 <<EOM
19675Cannot figure out on how many bits at a time your select() operates.
e6e7e605 19676I'll play safe and guess it is $safebits bits.
b4eb6b3d 19677EOM
e6e7e605
JH
19678 selectminbits=$safebits
19679 bits="$safebits bits"
b4eb6b3d
JH
19680 ;;
19681 1) bits="1 bit" ;;
19682 *) bits="$selectminbits bits" ;;
19683 esac
19684 echo "Your select() operates on $bits at a time." >&4
19685 else
19686 rp='What is the minimum number of bits your select() operates on?'
19687 case "$byteorder" in
e6e7e605
JH
19688 12345678) dflt=64 ;;
19689 1234) dflt=32 ;;
b4eb6b3d
JH
19690 *) dflt=1 ;;
19691 esac
19692 . ./myread
19693 val=$ans
19694 selectminbits="$val"
19695 fi
19696 $rm -f try.* try
19697 ;;
19698 *) : no select, so pick a harmless default
e6e7e605 19699 selectminbits=$safebits
b4eb6b3d
JH
19700 ;;
19701 esac
19702 ;;
19703esac
19704
19705: Trace out the files included by signal.h, then look for SIGxxx names.
19706: Remove SIGARRAYSIZE used by HPUX.
19707: Remove SIGSTKSIZE used by Linux.
19708: Remove SIGSTKSZ used by Posix.
19709: Remove SIGTYP void lines used by OS2.
19710: Some cpps, like os390, dont give the file name anywhere
19711if [ "X$fieldn" = X ]; then
19712 : Just make some guesses. We check them later.
19713 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19714else
19715 xxx=`echo '#include <signal.h>' |
19716 $cppstdin $cppminus $cppflags 2>/dev/null |
19717 $grep '^[ ]*#.*include' |
a938a3bb 19718 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
19719fi
19720: Check this list of files to be sure we have parsed the cpp output ok.
19721: This will also avoid potentially non-existent files, such
19722: as ../foo/bar.h
19723xxxfiles=''
19724for xx in $xxx /dev/null ; do
19725 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19726done
19727: If we have found no files, at least try signal.h
19728case "$xxxfiles" in
19729'') xxxfiles=`./findhdr signal.h` ;;
19730esac
19731xxx=`awk '
19732$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19733 print substr($2, 4, 20)
19734}
19735$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19736 print substr($3, 4, 20)
19737}' $xxxfiles`
19738: Append some common names just in case the awk scan failed.
19739xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19740xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19741xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19742xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19743xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19744
19745: generate a few handy files for later
55954f19 19746$cat > signal.c <<EOCP
b4eb6b3d
JH
19747#include <sys/types.h>
19748#include <signal.h>
55954f19
JH
19749#$i_stdlib I_STDLIB
19750#ifdef I_STDLIB
19751#include <stdlib.h>
19752#endif
b4eb6b3d
JH
19753#include <stdio.h>
19754int main() {
19755
19756/* Strange style to avoid deeply-nested #if/#else/#endif */
19757#ifndef NSIG
19758# ifdef _NSIG
19759# define NSIG (_NSIG)
19760# endif
19761#endif
19762
19763#ifndef NSIG
19764# ifdef SIGMAX
19765# define NSIG (SIGMAX+1)
19766# endif
19767#endif
19768
19769#ifndef NSIG
19770# ifdef SIG_MAX
19771# define NSIG (SIG_MAX+1)
19772# endif
19773#endif
19774
19775#ifndef NSIG
3609ea0d
JH
19776# ifdef _SIG_MAX
19777# define NSIG (_SIG_MAX+1)
19778# endif
19779#endif
19780
19781#ifndef NSIG
b4eb6b3d
JH
19782# ifdef MAXSIG
19783# define NSIG (MAXSIG+1)
19784# endif
19785#endif
19786
19787#ifndef NSIG
19788# ifdef MAX_SIG
19789# define NSIG (MAX_SIG+1)
19790# endif
19791#endif
19792
19793#ifndef NSIG
19794# ifdef SIGARRAYSIZE
3609ea0d 19795# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
b4eb6b3d
JH
19796# endif
19797#endif
19798
19799#ifndef NSIG
19800# ifdef _sys_nsig
19801# define NSIG (_sys_nsig) /* Solaris 2.5 */
19802# endif
19803#endif
19804
19805/* Default to some arbitrary number that's big enough to get most
19806 of the common signals.
19807*/
19808#ifndef NSIG
19809# define NSIG 50
19810#endif
19811
19812printf("NSIG %d\n", NSIG);
19813
19814#ifndef JUST_NSIG
19815
19816EOCP
19817
19818echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19819{
19820 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 19821 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
19822 printf $1; printf ");\n"
19823 printf "#endif\n"
19824}
19825END {
19826 printf "#endif /* JUST_NSIG */\n";
19827 printf "exit(0);\n}\n";
19828}
19829' >>signal.c
19830$cat >signal.awk <<'EOP'
19831BEGIN { ndups = 0 }
65197d93 19832$1 ~ /^NSIG$/ { nsig = $2 }
1ebe1ffb 19833($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
19834 if ($2 > maxsig) { maxsig = $2 }
19835 if (sig_name[$2]) {
19836 dup_name[ndups] = $1
19837 dup_num[ndups] = $2
b4eb6b3d
JH
19838 ndups++
19839 }
1ebe1ffb 19840 else {
65197d93
JH
19841 sig_name[$2] = $1
19842 sig_num[$2] = $2
b4eb6b3d
JH
19843 }
19844}
19845END {
19846 if (nsig == 0) {
19847 nsig = maxsig + 1
19848 }
19849 printf("NSIG %d\n", nsig);
19850 for (n = 1; n < nsig; n++) {
19851 if (sig_name[n]) {
19852 printf("%s %d\n", sig_name[n], sig_num[n])
19853 }
19854 else {
19855 printf("NUM%d %d\n", n, n)
19856 }
19857 }
19858 for (n = 0; n < ndups; n++) {
19859 printf("%s %d\n", dup_name[n], dup_num[n])
19860 }
19861}
19862EOP
19863$cat >signal_cmd <<EOS
19864$startsh
19865if $test -s signal.lst; then
19866 echo "Using your existing signal.lst file"
19867 exit 0
19868fi
19869xxx="$xxx"
19870EOS
19871$cat >>signal_cmd <<'EOS'
19872
19873set signal
19874if eval $compile_ok; then
1eb9ad5b 19875 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
19876else
19877 echo "(I can't seem be able to compile the whole test program)" >&4
19878 echo "(I'll try it in little pieces.)" >&4
19879 set signal -DJUST_NSIG
19880 if eval $compile_ok; then
5440bc8e 19881 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
19882 $cat signal.nsg
19883 else
19884 echo "I can't seem to figure out how many signals you have." >&4
19885 echo "Guessing 50." >&4
19886 echo 'NSIG 50' > signal.nsg
19887 fi
19888 : Now look at all the signal names, one at a time.
19889 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19890 $cat > signal.c <<EOCP
19891#include <sys/types.h>
19892#include <signal.h>
19893#include <stdio.h>
19894int main() {
19895printf("$xx %d\n", SIG${xx});
19896return 0;
19897}
19898EOCP
19899 set signal
19900 if eval $compile; then
19901 echo "SIG${xx} found."
5440bc8e 19902 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
19903 else
19904 echo "SIG${xx} NOT found."
19905 fi
19906 done
19907 if $test -s signal.ls1; then
19908 $cat signal.nsg signal.ls1 |
65197d93 19909 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
19910 fi
19911
19912fi
19913if $test -s signal.lst; then
19914 :
19915else
19916 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19917 echo 'kill -l' >signal
19918 set X `csh -f <signal`
19919 $rm -f signal
19920 shift
19921 case $# in
19922 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19923 esac
19924 echo $@ | $tr ' ' $trnl | \
19925 $awk '{ printf "%s %d\n", $1, ++s; }
19926 END { printf "NSIG %d\n", ++s }' >signal.lst
19927fi
19928$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19929EOS
19930chmod a+x signal_cmd
19931$eunicefix signal_cmd
19932
19933: generate list of signal names
19934echo " "
19935case "$sig_name_init" in
19936'') doinit=yes ;;
19937*) case "$sig_num_init" in
19938 ''|*,*) doinit=yes ;;
19939 esac ;;
19940esac
19941case "$doinit" in
19942yes)
19943 echo "Generating a list of signal names and numbers..." >&4
19944 . ./signal_cmd
19945 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19946 sig_name=`$awk 'BEGIN { printf "ZERO " }
19947 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19948 sig_num=`$awk 'BEGIN { printf "0 " }
19949 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19950 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
19951 !/^NSIG/ { printf "\"%s\", ", $1 }
19952 END { printf "0\n" }' signal.lst`
19953 sig_num_init=`$awk 'BEGIN { printf "0, " }
19954 !/^NSIG/ { printf "%d, ", $2}
19955 END { printf "0\n"}' signal.lst`
19956 ;;
19957esac
19958echo "The following $sig_count signals are available:"
19959echo " "
19960echo $sig_name | $awk \
19961'BEGIN { linelen = 0 }
19962{
19963 for (i = 1; i <= NF; i++) {
19964 name = "SIG" $i " "
19965 linelen = linelen + length(name)
19966 if (linelen > 70) {
19967 printf "\n"
19968 linelen = length(name)
19969 }
19970 printf "%s", name
19971 }
19972 printf "\n"
19973}'
76d3c696 19974sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
19975$rm -f signal signal.c signal.awk signal.lst signal_cmd
19976
19977echo " "
19978case "$sizetype" in
19979*_t) zzz="$sizetype" ;;
19980*) zzz="filesize" ;;
19981esac
19982echo "Checking the size of $zzz..." >&4
19983cat > try.c <<EOCP
19984#include <sys/types.h>
19985#include <stdio.h>
d1daaddf
JH
19986#$i_stdlib I_STDLIB
19987#ifdef I_STDLIB
19988#include <stdlib.h>
19989#endif
b4eb6b3d
JH
19990int main() {
19991 printf("%d\n", (int)sizeof($sizetype));
19992 exit(0);
19993}
19994EOCP
19995set try
19996if eval $compile_ok; then
5440bc8e 19997 yyy=`$run ./try`
b4eb6b3d
JH
19998 case "$yyy" in
19999 '') sizesize=4
20000 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20001 ;;
20002 *) sizesize=$yyy
20003 echo "Your $zzz size is $sizesize bytes."
20004 ;;
20005 esac
20006else
20007 sizesize=4
20008 echo "(I can't compile the test program--guessing $sizesize.)" >&4
20009fi
20010
20011
20012: check for socklen_t
20013echo " "
20014echo "Checking to see if you have socklen_t..." >&4
20015$cat >try.c <<EOCP
20016#include <sys/types.h>
20017#$d_socket HAS_SOCKET
20018#ifdef HAS_SOCKET
20019#include <sys/socket.h>
20020#endif
20021int main() { socklen_t x = 16; }
20022EOCP
20023set try
20024if eval $compile; then
20025 val="$define"
20026 echo "You have socklen_t."
20027else
20028 val="$undef"
20029 echo "You do not have socklen_t."
20030 case "$sizetype" in
20031 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20032 esac
20033fi
20034$rm -f try try.*
20035set d_socklen_t
20036eval $setvar
20037
a7710f8d
JH
20038: see if this is a socks.h system
20039set socks.h i_socks
20040eval $inhdr
20041
b4eb6b3d
JH
20042: check for type of the size argument to socket calls
20043case "$d_socket" in
20044"$define")
20045 $cat <<EOM
20046
20047Checking to see what type is the last argument of accept().
20048EOM
b4eb6b3d
JH
20049 yyy=''
20050 case "$d_socklen_t" in
20051 "$define") yyy="$yyy socklen_t"
20052 esac
20053 yyy="$yyy $sizetype int long unsigned"
20054 for xxx in $yyy; do
20055 case "$socksizetype" in
20056 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
20057 case "$usesocks" in
20058 "$define")
20059 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20060 echo "Your system accepts '$xxx *' for the last argument of accept()."
20061 socksizetype="$xxx"
20062 fi
20063 ;;
20064 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
20065 echo "Your system accepts '$xxx *' for the last argument of accept()."
20066 socksizetype="$xxx"
20067 fi
20068 ;;
20069 esac
b4eb6b3d
JH
20070 ;;
20071 esac
20072 done
20073: In case none of those worked, prompt the user.
20074 case "$socksizetype" in
20075 '') rp='What is the type for socket address structure sizes?'
20076 dflt='int'
20077 . ./myread
20078 socksizetype=$ans
20079 ;;
20080 esac
20081 ;;
20082*) : no sockets, so pick relatively harmless default
20083 socksizetype='int'
20084 ;;
20085esac
20086
20087: see what type is used for signed size_t
20088set ssize_t ssizetype int stdio.h sys/types.h
20089eval $typedef
20090dflt="$ssizetype"
5440bc8e 20091$cat > try.c <<EOM
b4eb6b3d 20092#include <stdio.h>
d1daaddf
JH
20093#$i_stdlib I_STDLIB
20094#ifdef I_STDLIB
20095#include <stdlib.h>
20096#endif
b4eb6b3d
JH
20097#include <sys/types.h>
20098#define Size_t $sizetype
20099#define SSize_t $dflt
20100int main()
20101{
20102 if (sizeof(Size_t) == sizeof(SSize_t))
20103 printf("$dflt\n");
20104 else if (sizeof(Size_t) == sizeof(int))
20105 printf("int\n");
20106 else
20107 printf("long\n");
20108 exit(0);
20109}
20110EOM
20111echo " "
5440bc8e
JH
20112set try
20113if eval $compile_ok && $run ./try > /dev/null; then
20114 ssizetype=`$run ./try`
b4eb6b3d
JH
20115 echo "I'll be using $ssizetype for functions returning a byte count." >&4
20116else
20117 $cat >&4 <<EOM
20118Help! I can't compile and run the ssize_t test program: please enlighten me!
20119(This is probably a misconfiguration in your system or libraries, and
20120you really ought to fix it. Still, I'll try anyway.)
20121
20122I need a type that is the same size as $sizetype, but is guaranteed to
20123be signed. Common values are ssize_t, int and long.
20124
20125EOM
20126 rp="What signed type is the same size as $sizetype?"
20127 . ./myread
20128 ssizetype="$ans"
20129fi
5440bc8e 20130$rm -f try try.*
b4eb6b3d
JH
20131
20132: see what type of char stdio uses.
20133echo " "
359842a5
JH
20134echo '#include <stdio.h>' > stdio.c
20135$cppstdin $cppminus < stdio.c > stdioh
aa517f50 20136if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
20137 echo "Your stdio uses unsigned chars." >&4
20138 stdchar="unsigned char"
20139else
aa517f50
JH
20140 echo "Your stdio uses signed chars." >&4
20141 stdchar="char"
b4eb6b3d 20142fi
359842a5 20143$rm -f stdio.* stdioh
b4eb6b3d 20144
b4eb6b3d
JH
20145: see what type uids are declared as in the kernel
20146echo " "
20147echo "Looking for the type for user ids returned by getuid()."
20148set uid_t uidtype xxx stdio.h sys/types.h
20149eval $typedef
20150case "$uidtype" in
20151xxx)
20152 xxx=`./findhdr sys/user.h`
20153 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20154 case $1 in
20155 unsigned) dflt="$1 $2" ;;
20156 *) dflt="$1" ;;
20157 esac
20158 ;;
20159*) dflt="$uidtype";;
20160esac
20161case "$uidtype" in
20162uid_t) echo "uid_t found." ;;
20163*) rp="What is the type for user ids returned by getuid()?"
20164 . ./myread
20165 uidtype="$ans"
20166 ;;
20167esac
20168
20169echo " "
20170case "$uidtype" in
20171*_t) zzz="$uidtype" ;;
20172*) zzz="uid" ;;
20173esac
20174echo "Checking the size of $zzz..." >&4
20175cat > try.c <<EOCP
20176#include <sys/types.h>
20177#include <stdio.h>
d1daaddf
JH
20178#$i_stdlib I_STDLIB
20179#ifdef I_STDLIB
20180#include <stdlib.h>
20181#endif
b4eb6b3d
JH
20182int main() {
20183 printf("%d\n", (int)sizeof($uidtype));
20184 exit(0);
20185}
20186EOCP
20187set try
20188if eval $compile_ok; then
5440bc8e 20189 yyy=`$run ./try`
b4eb6b3d
JH
20190 case "$yyy" in
20191 '') uidsize=4
20192 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20193 ;;
20194 *) uidsize=$yyy
20195 echo "Your $zzz is $uidsize bytes long."
20196 ;;
20197 esac
20198else
20199 uidsize=4
20200 echo "(I can't compile the test program--guessing $uidsize.)" >&4
20201fi
20202
20203echo " "
20204case "$uidtype" in
20205*_t) zzz="$uidtype" ;;
20206*) zzz="uid" ;;
20207esac
20208echo "Checking the sign of $zzz..." >&4
20209cat > try.c <<EOCP
20210#include <sys/types.h>
20211#include <stdio.h>
20212int main() {
20213 $uidtype foo = -1;
20214 if (foo < 0)
20215 printf("-1\n");
20216 else
20217 printf("1\n");
20218}
20219EOCP
20220set try
20221if eval $compile; then
5440bc8e 20222 yyy=`$run ./try`
b4eb6b3d
JH
20223 case "$yyy" in
20224 '') uidsign=1
20225 echo "(I can't execute the test program--guessing unsigned.)" >&4
20226 ;;
20227 *) uidsign=$yyy
20228 case "$uidsign" in
20229 1) echo "Your $zzz is unsigned." ;;
20230 -1) echo "Your $zzz is signed." ;;
20231 esac
20232 ;;
20233 esac
20234else
20235 uidsign=1
20236 echo "(I can't compile the test program--guessing unsigned.)" >&4
20237fi
20238
20239
20240
20241echo " "
20242$echo "Checking the format string to be used for uids..." >&4
20243
20244case "$uidsign" in
20245-1) if $test X"$uidsize" = X"$ivsize"; then
20246 uidformat="$ivdformat"
20247 else
20248 if $test X"$uidsize" = X"$longsize"; then
20249 uidformat='"ld"'
20250 else
20251 if $test X"$uidsize" = X"$intsize"; then
20252 uidformat='"d"'
20253 else
20254 if $test X"$uidsize" = X"$shortsize"; then
20255 uidformat='"hd"'
20256 fi
20257 fi
20258 fi
20259 fi
20260 ;;
20261*) if $test X"$uidsize" = X"$uvsize"; then
20262 uidformat="$uvuformat"
20263 else
20264 if $test X"$uidsize" = X"$longsize"; then
20265 uidformat='"lu"'
20266 else
20267 if $test X"$uidsize" = X"$intsize"; then
20268 uidformat='"u"'
20269 else
20270 if $test X"$uidsize" = X"$shortsize"; then
20271 uidformat='"hu"'
20272 fi
20273 fi
20274 fi
20275 fi
20276 ;;
20277esac
20278
4afd418c
MB
20279
20280case "$usesitecustomize" in
20281 $define|true|[Yy]*)
20282 usesitecustomize="$define"
20283 ;;
20284 *)
20285 usesitecustomize="$undef"
20286 ;;
20287 esac
20288
3659ebf1
JH
20289: determine compiler compiler
20290case "$yacc" in
20291'')
20292 dflt=yacc;;
20293*)
20294 dflt="$yacc";;
20295esac
20296echo " "
20297comp='yacc'
3c728e00 20298if $test -f "$byacc$_exe"; then
3659ebf1
JH
20299 dflt="$byacc"
20300 comp="byacc or $comp"
20301fi
3c728e00 20302if $test -f "$bison$_exe"; then
3659ebf1
JH
20303 comp="$comp or bison -y"
20304fi
20305rp="Which compiler compiler ($comp) shall I use?"
20306. ./myread
20307yacc="$ans"
20308case "$yacc" in
20309*bis*)
20310 case "$yacc" in
20311 *-y*) ;;
20312 *)
20313 yacc="$yacc -y"
20314 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20315 ;;
20316 esac
20317 ;;
20318esac
20319
758a5d79
JH
20320: see if this is a fp.h system
20321set fp.h i_fp
20322eval $inhdr
20323
20324: see if this is a fp_class.h system
20325set fp_class.h i_fp_class
20326eval $inhdr
20327
13cfc98d
MB
20328: see if gdbm.h is available
20329set gdbm.h t_gdbm
20330eval $inhdr
20331case "$t_gdbm" in
20332$define)
20333 : see if gdbm_open exists
20334 set gdbm_open d_gdbm_open
20335 eval $inlibc
20336 case "$d_gdbm_open" in
20337 $undef)
20338 t_gdbm="$undef"
20339 echo "We won't be including <gdbm.h>"
20340 ;;
20341 esac
20342 ;;
20343esac
20344val="$t_gdbm"
20345set i_gdbm
20346eval $setvar
20347
b4eb6b3d 20348: see if this is a ieeefp.h system
b5b9f165
JH
20349case "$i_ieeefp" in
20350'' ) set ieeefp.h i_ieeefp
20351 eval $inhdr
20352 ;;
20353esac
b4eb6b3d
JH
20354
20355: see if this is a libutil.h system
20356set libutil.h i_libutil
20357eval $inhdr
20358
b4eb6b3d
JH
20359: see if mach cthreads are available
20360if test "X$usethreads" = "X$define"; then
20361 set mach/cthreads.h i_machcthr
20362 eval $inhdr
20363else
20364 i_machcthr="$undef"
20365fi
20366
20367
20368
b4eb6b3d
JH
20369: see if this is a mntent.h system
20370set mntent.h i_mntent
20371eval $inhdr
20372
20373: see if ndbm.h is available
20374set ndbm.h t_ndbm
20375eval $inhdr
1c6861ad
JS
20376
20377case "$t_ndbm" in
20378$undef)
20379 # Some Linux distributions such as RedHat 7.1 put the
20380 # ndbm.h header in /usr/include/gdbm/ndbm.h.
20381 if $test -f /usr/include/gdbm/ndbm.h; then
d11b91bf 20382 echo '<gdbm/ndbm.h> found.'
1c6861ad
JS
20383 ccflags="$ccflags -I/usr/include/gdbm"
20384 cppflags="$cppflags -I/usr/include/gdbm"
20385 t_ndbm=$define
20386 fi
20387 ;;
20388esac
20389
b4eb6b3d
JH
20390case "$t_ndbm" in
20391$define)
20392 : see if dbm_open exists
20393 set dbm_open d_dbm_open
20394 eval $inlibc
20395 case "$d_dbm_open" in
20396 $undef)
20397 t_ndbm="$undef"
20398 echo "We won't be including <ndbm.h>"
20399 ;;
20400 esac
20401 ;;
20402esac
20403val="$t_ndbm"
20404set i_ndbm
20405eval $setvar
20406
20407: see if net/errno.h is available
20408val=''
20409set net/errno.h val
20410eval $inhdr
20411
20412: Unfortunately, it causes problems on some systems. Arrgh.
20413case "$val" in
20414$define)
20415 cat > try.c <<'EOM'
20416#include <stdio.h>
20417#include <errno.h>
20418#include <net/errno.h>
20419int func()
20420{
20421 return ENOTSOCK;
20422}
20423EOM
20424 if $cc $ccflags -c try.c >/dev/null 2>&1; then
20425 echo "We'll be including <net/errno.h>." >&4
20426 else
20427 echo "We won't be including <net/errno.h>." >&4
20428 val="$undef"
20429 fi
20430 $rm -f try.* try
20431 ;;
20432esac
20433set i_neterrno
20434eval $setvar
20435
20436: see if netinet/tcp.h is available
20437set netinet/tcp.h i_netinettcp
20438eval $inhdr
20439
20440: see if this is a poll.h system
20441set poll.h i_poll
20442eval $inhdr
20443
20444: see if this is a prot.h system
20445set prot.h i_prot
20446eval $inhdr
20447
20448echo " "
ddfca5da 20449$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
b4eb6b3d
JH
20450$cat <<'EOSH' > Cppsym.know
20451a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20452AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
44c87379 20453alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
d46c9a2d
JH
20454ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20455BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
20456BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20457bull c cadmus clipper CMU COFF COMPILER_VERSION
20458concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
8b7d8421 20459CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
20460Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20461FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20462GLIBC GLIBC_MINOR
20463GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
20464H3050R H3050RX hbullx20 hcx host_mips
20465hp200 hp300 hp700 HP700 hp800 hp9000
20466hp9000s200 hp9000s300 hp9000s400 hp9000s500
20467hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20468i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 20469IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
20470INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20471LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20472LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20473Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20474LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20475M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20476M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20477M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20478MATH_HAS_NO_SIDE_EFFECTS
20479mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20480mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20481mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20482MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20483mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20484NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 20485news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
20486ns32016 ns32332 ns32k nsc32000
20487OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20488pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20489pc532 pdp11 PGC PIC plexus PORTAR posix
20490POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20491POSIX_C_SOURCE POSIX_SOURCE POWER
20492PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 20493riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
20494SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20495sony sony_news sonyrisc sparc sparclite spectrum
20496stardent stdc STDC_EXT stratos sun sun3 sun386
20497Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20498SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20499SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20500sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 20501TM3200 TM5400 TM5600
b4eb6b3d
JH
20502tower tower32 tower32_200 tower32_600 tower32_700
20503tower32_800 tower32_850 tss
20504u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20505ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
20506unix UNIX95 UNIX99 unixpc unos
20507USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20508USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20509USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20510USGr4 USGr4_2
44c87379 20511Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
b4eb6b3d
JH
20512XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20513XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20514z8000
20515EOSH
20516# Maybe put other stuff here too.
20517cat <<EOSH >>Cppsym.know
20518$osname
20519EOSH
20520./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20521./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20522$cat Cppsym.know > Cppsym.c
381aa1ff 20523$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
20524$rm -f Cppsym.a Cppsym.b Cppsym.c
20525cat <<EOSH > Cppsym
20526$startsh
20527if $test \$# -gt 0; then
20528 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20529 if $test -s Cppsym.got; then
20530 $rm -f Cppsym.got
20531 exit 0
20532 fi
20533 $rm -f Cppsym.got
20534 exit 1
20535else
20536 $tr " " "$trnl" | ./Cppsym.try
20537 exit 0
20538fi
20539EOSH
20540chmod +x Cppsym
20541$eunicefix Cppsym
20542cat <<EOSH > Cppsym.try
20543$startsh
20544cat <<'EOCP' > try.c
20545#include <stdio.h>
360321b3
YST
20546#if cpp_stuff == 1
20547#define STRINGIFY(a) "a"
20548#endif
20549#if cpp_stuff == 42
20550#define StGiFy(a) #a
20551#define STRINGIFY(a) StGiFy(a)
20552#endif
20553#if $cpp_stuff != 1 && $cpp_stuff != 42
20554# include "Bletch: How does this C preprocessor stringify macros?"
20555#endif
b4eb6b3d
JH
20556int main() {
20557EOCP
20558$awk \\
20559EOSH
20560cat <<'EOSH' >> Cppsym.try
20561'length($1) > 0 {
360321b3
YST
20562 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20563 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20564 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20565 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
b4eb6b3d 20566}' >> try.c
2ef53570 20567echo 'return 0;}' >> try.c
b4eb6b3d
JH
20568EOSH
20569cat <<EOSH >> Cppsym.try
20570ccflags="$ccflags"
20571case "$osname-$gccversion" in
20572irix-) ccflags="\$ccflags -woff 1178" ;;
20573os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20574esac
360321b3 20575$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
b4eb6b3d
JH
20576EOSH
20577chmod +x Cppsym.try
20578$eunicefix Cppsym.try
20579./Cppsym < Cppsym.know > Cppsym.true
ddfca5da 20580: Add in any linux cpp "predefined macros":
b6a7163e
MB
20581case "$osname::$gccversion" in
20582 *linux*::*.*)
20583 tHdrH=_tmpHdr
20584 rm -f $tHdrH'.h' $tHdrH
20585 touch $tHdrH'.h'
20586 if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20587 sed 's/#define[\ \ ]*//;s/[\ \ ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20588 if [ -s $tHdrH'_cppsym.real' ]; then
20589 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20590 fi
20591 fi
20592 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20593 ;;
20594esac
b4eb6b3d
JH
20595: now check the C compiler for additional symbols
20596postprocess_cc_v=''
20597case "$osname" in
20598aix) postprocess_cc_v="|$tr , ' '" ;;
20599esac
20600$cat >ccsym <<EOS
20601$startsh
20602$cat >tmp.c <<EOF
20603extern int foo;
20604EOF
20605for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20606do
20607 case "\$i" in
20608 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 20609 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
20610 esac
20611done
20612$rm -f try.c
20613EOS
20614postprocess_cc_v=''
20615chmod +x ccsym
20616$eunicefix ccsym
20617./ccsym > ccsym1.raw
20618if $test -s ccsym1.raw; then
20619 $sort ccsym1.raw | $uniq >ccsym.raw
20620else
20621 mv ccsym1.raw ccsym.raw
20622fi
20623
20624$awk '/\=/ { print $0; next }
20625 { print $0"=1" }' ccsym.raw >ccsym.list
360321b3
YST
20626$comm -13 Cppsym.true ccsym.list >ccsym.own
20627$comm -12 Cppsym.true ccsym.list >ccsym.com
20628$comm -23 Cppsym.true ccsym.list >ccsym.cpp
b4eb6b3d
JH
20629also=''
20630if $test -z ccsym.raw; then
20631 echo "Your C compiler doesn't seem to define any symbols!" >&4
20632 echo " "
20633 echo "However, your C preprocessor defines the following symbols:"
20634 $cat Cppsym.true
20635 ccsymbols=''
20636 cppsymbols=`$cat Cppsym.true`
20637 cppsymbols=`echo $cppsymbols`
20638 cppccsymbols="$cppsymbols"
20639else
20640 if $test -s ccsym.com; then
20641 echo "Your C compiler and pre-processor define these symbols:"
20642 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20643 also='also '
20644 symbols='ones'
20645 cppccsymbols=`$cat ccsym.com`
20646 cppccsymbols=`echo $cppccsymbols`
20647 $test "$silent" || sleep 1
20648 fi
20649 if $test -s ccsym.cpp; then
20650 $test "$also" && echo " "
20651 echo "Your C pre-processor ${also}defines the following symbols:"
20652 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20653 also='further '
20654 cppsymbols=`$cat ccsym.cpp`
20655 cppsymbols=`echo $cppsymbols`
20656 $test "$silent" || sleep 1
20657 fi
20658 if $test -s ccsym.own; then
20659 $test "$also" && echo " "
20660 echo "Your C compiler ${also}defines the following cpp symbols:"
20661 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20662 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20663 ccsymbols=`$cat ccsym.own`
20664 ccsymbols=`echo $ccsymbols`
20665 $test "$silent" || sleep 1
20666 fi
20667fi
b4eb6b3d
JH
20668
20669: see if this is a termio system
20670val="$undef"
20671val2="$undef"
20672val3="$undef"
20673if $test `./findhdr termios.h`; then
20674 set tcsetattr i_termios
20675 eval $inlibc
20676 val3="$i_termios"
20677fi
20678echo " "
20679case "$val3" in
20680"$define") echo "You have POSIX termios.h... good!" >&4;;
20681*) if ./Cppsym pyr; then
20682 case "`/bin/universe`" in
20683 ucb) if $test `./findhdr sgtty.h`; then
20684 val2="$define"
20685 echo "<sgtty.h> found." >&4
20686 else
20687 echo "System is pyramid with BSD universe."
20688 echo "<sgtty.h> not found--you could have problems." >&4
20689 fi;;
20690 *) if $test `./findhdr termio.h`; then
20691 val="$define"
20692 echo "<termio.h> found." >&4
20693 else
20694 echo "System is pyramid with USG universe."
20695 echo "<termio.h> not found--you could have problems." >&4
20696 fi;;
20697 esac
20698 elif ./usg; then
20699 if $test `./findhdr termio.h`; then
20700 echo "<termio.h> found." >&4
20701 val="$define"
20702 elif $test `./findhdr sgtty.h`; then
20703 echo "<sgtty.h> found." >&4
20704 val2="$define"
20705 else
20706echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20707 fi
20708 else
20709 if $test `./findhdr sgtty.h`; then
20710 echo "<sgtty.h> found." >&4
20711 val2="$define"
20712 elif $test `./findhdr termio.h`; then
20713 echo "<termio.h> found." >&4
20714 val="$define"
20715 else
20716echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20717 fi
20718 fi;;
20719esac
20720set i_termio; eval $setvar
20721val=$val2; set i_sgtty; eval $setvar
20722val=$val3; set i_termios; eval $setvar
20723
b4eb6b3d
JH
20724: see if stddef is available
20725set stddef.h i_stddef
20726eval $inhdr
923fc586 20727
b4eb6b3d
JH
20728: see if this is a sunmath.h system
20729set sunmath.h i_sunmath
20730eval $inhdr
5f80c64f 20731
b4eb6b3d
JH
20732: see if sys/access.h is available
20733set sys/access.h i_sysaccess
20734eval $inhdr
20735
20736: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20737set sys/filio.h i_sysfilio
20738eval $inhdr
20739echo " "
20740if $test `./findhdr sys/ioctl.h`; then
20741 val="$define"
20742 echo '<sys/ioctl.h> found.' >&4
20743else
20744 val="$undef"
20745 if $test $i_sysfilio = "$define"; then
20746 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 20747 else
b4eb6b3d
JH
20748 $test $i_sgtty = "$define" && xxx="sgtty.h"
20749 $test $i_termio = "$define" && xxx="termio.h"
20750 $test $i_termios = "$define" && xxx="termios.h"
20751echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20752 fi
20753fi
20754set i_sysioctl
20755eval $setvar
20756
49a78c82
JH
20757: see if socket ioctl defs are in sys/sockio.h
20758echo " "
20759xxx=`./findhdr sys/sockio.h`
20760if $test "$xxx"; then
20761 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20762 val="$define"
20763 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20764 else
20765 val="$undef"
20766 echo "No socket ioctls found in <sys/sockio.h>." >&4
20767 fi
20768else
20769 val="$undef"
20770 $cat <<EOM
20771<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20772EOM
20773fi
20774set i_syssockio
20775eval $setvar
20776
b4eb6b3d
JH
20777
20778: see if this is a syslog.h system
20779set syslog.h i_syslog
20780eval $inhdr
20781
20782
20783: see if this is a sys/mode.h system
20784set sys/mode.h i_sysmode
20785eval $inhdr
20786
20787: see if sys/resource.h has to be included
20788set sys/resource.h i_sysresrc
20789eval $inhdr
20790
20791: see if sys/security.h is available
20792set sys/security.h i_syssecrt
20793eval $inhdr
20794
20795: see if this is a sys/statvfs.h system
20796set sys/statvfs.h i_sysstatvfs
20797eval $inhdr
20798
b4eb6b3d
JH
20799: see if this is a sys/un.h system
20800set sys/un.h i_sysun
20801eval $inhdr
20802
20803
20804: see if this is a sys/utsname.h system
20805set sys/utsname.h i_sysutsname
20806eval $inhdr
20807
20808: see if this is a syswait system
20809set sys/wait.h i_syswait
20810eval $inhdr
20811
20812: see if this is a ustat.h system
20813set ustat.h i_ustat
20814eval $inhdr
20815
20816: see if this is an utime system
20817set utime.h i_utime
20818eval $inhdr
20819
20820: see if this is a values.h system
20821set values.h i_values
20822eval $inhdr
20823
20824: see if this is a vfork system
20825case "$d_vfork" in
20826"$define")
20827 set vfork.h i_vfork
20828 eval $inhdr
20829 ;;
20830*)
20831 i_vfork="$undef"
20832 ;;
20833esac
20834
b4eb6b3d
JH
20835echo " "
20836echo "Looking for extensions..." >&4
20837: If we are using the old config.sh, known_extensions may contain
20838: old or inaccurate or duplicate values.
20839known_extensions=''
20840nonxs_extensions=''
20841: We do not use find because it might not be available.
20842: We do not just use MANIFEST because the user may have dropped
20843: some additional extensions into the source tree and expect them
20844: to be built.
20845
20846: Function to recursively find available extensions, ignoring DynaLoader
20847: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20848find_extensions='
20849 for xxx in *; do
20850 case "$xxx" in
20851 DynaLoader|dynaload) ;;
20852 *)
20853 if $test -f $xxx/$xxx.xs; then
20854 known_extensions="$known_extensions $1$xxx";
20855 elif $test -f $xxx/Makefile.PL; then
20856 nonxs_extensions="$nonxs_extensions $1$xxx";
20857 else
20858 if $test -d $xxx -a $# -lt 10; then
20859 set $1$xxx/ $*;
6904989c 20860 cd "$xxx";
b4eb6b3d
JH
20861 eval $find_extensions;
20862 cd ..;
20863 shift;
20864 fi;
20865 fi
20866 ;;
20867 esac;
20868 done'
20869tdir=`pwd`
6904989c 20870cd "$rsrc/ext"
b4eb6b3d
JH
20871set X
20872shift
20873eval $find_extensions
4e1a6d26
AD
20874# Special case: Add in threads/shared since it is not picked up by the
20875# recursive find above (and adding in general recursive finding breaks
20876# SDBM_File/sdbm). A.D. 10/25/2001.
998b396c 20877known_extensions="$known_extensions threads/shared"
b4eb6b3d
JH
20878set X $nonxs_extensions
20879shift
20880nonxs_extensions="$*"
20881set X $known_extensions
20882shift
20883known_extensions="$*"
6904989c 20884cd "$tdir"
b4eb6b3d
JH
20885
20886: Now see which are supported on this system.
20887avail_ext=''
20888for xxx in $known_extensions ; do
20889 case "$xxx" in
20890 DB_File|db_file)
20891 case "$i_db" in
20892 $define) avail_ext="$avail_ext $xxx" ;;
20893 esac
20894 ;;
20895 GDBM_File|gdbm_fil)
20896 case "$i_gdbm" in
20897 $define) avail_ext="$avail_ext $xxx" ;;
20898 esac
20899 ;;
1d59c593 20900 I18N/Langinfo|i18n_lan)
4bbcc6e8
JH
20901 case "$i_langinfo$d_nl_langinfo" in
20902 $define$define) avail_ext="$avail_ext $xxx" ;;
20903 esac
20904 ;;
b4eb6b3d
JH
20905 NDBM_File|ndbm_fil)
20906 case "$i_ndbm" in
20907 $define)
20908 case "$osname-$use64bitint" in
0be9fa5d 20909 hpux-define)
b4eb6b3d
JH
20910 case "$libs" in
20911 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20912 esac
20913 ;;
20914 *) avail_ext="$avail_ext $xxx" ;;
20915 esac
20916 ;;
20917 esac
20918 ;;
20919 ODBM_File|odbm_fil)
20920 case "${i_dbm}${i_rpcsvcdbm}" in
20921 *"${define}"*)
20922 case "$osname-$use64bitint" in
0be9fa5d 20923 hpux-define)
b4eb6b3d
JH
20924 case "$libs" in
20925 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20926 esac
20927 ;;
20928 *) avail_ext="$avail_ext $xxx" ;;
20929 esac
20930 ;;
20931 esac
20932 ;;
20933 POSIX|posix)
20934 case "$useposix" in
20935 true|define|y) avail_ext="$avail_ext $xxx" ;;
20936 esac
20937 ;;
20938 Opcode|opcode)
20939 case "$useopcode" in
20940 true|define|y) avail_ext="$avail_ext $xxx" ;;
20941 esac
20942 ;;
20943 Socket|socket)
20944 case "$d_socket" in
4a9f028c
JH
20945 true|$define|y)
20946 case "$osname" in
20947 beos) ;; # not unless BONE
20948 *) avail_ext="$avail_ext $xxx" ;;
20949 esac
20950 ;;
b4eb6b3d
JH
20951 esac
20952 ;;
20953 Sys/Syslog|sys/syslog)
20954 : XXX syslog requires socket
20955 case "$d_socket" in
20956 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20957 esac
20958 ;;
20959 Thread|thread)
b00ec89b
AB
20960 case "$usethreads" in
20961 true|$define|y)
20962 case "$useithreads" in
20963 $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20964 esac
b4eb6b3d
JH
20965 esac
20966 ;;
f9b6ed1c
AD
20967 XS/APItest|xs/apitest)
20968 # This is just for testing. Skip it unless we have dynamic loading.
20969
20970 case "$usedl" in
20971 $define) avail_ext="$avail_ext $xxx" ;;
20972 esac
20973 ;;
20974 XS/Typemap|xs/typemap)
20975 # This is just for testing. Skip it unless we have dynamic loading.
20976 case "$usedl" in
20977 $define) avail_ext="$avail_ext $xxx" ;;
20978 esac
20979 ;;
7deadc5f 20980 threads|threads/shared)
73e09c8f
JH
20981 # threads and threads::shared are special cases.
20982 # To stop people from asking "Perl 5.8.0 was supposed
20983 # to have this new fancy threads implementation but my
20984 # perl doesn't have it" and from people trying to
20985 # (re)install the threads module using CPAN.pm and
20986 # CPAN.pm then offering to reinstall Perl 5.8.0,
20987 # the threads.pm and threads/shared.pm will always be
20988 # there, croaking informatively ("you need to rebuild
20989 # all of Perl with threads, sorry") when threads haven't
20990 # been compiled in.
20991 # --jhi
20992 avail_ext="$avail_ext $xxx"
1dca008a 20993 ;;
b4eb6b3d
JH
20994 IPC/SysV|ipc/sysv)
20995 : XXX Do we need a useipcsysv variable here
20996 case "${d_msg}${d_sem}${d_shm}" in
20997 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20998 esac
20999 ;;
21000 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
21001 ;;
21002 esac
b4eb6b3d 21003done
5f80c64f 21004
b4eb6b3d
JH
21005set X $avail_ext
21006shift
21007avail_ext="$*"
5f80c64f 21008
ef0c5be8
JH
21009case "$onlyextensions" in
21010'') ;;
21011*) keepextensions=''
21012 echo "You have requested that only certains extensions be included..." >&4
21013 for i in $onlyextensions; do
21014 case " $avail_ext " in
21015 *" $i "*)
21016 echo "Keeping extension $i."
21017 keepextensions="$keepextensions $i"
21018 ;;
21019 *) echo "Ignoring extension $i." ;;
21020 esac
21021 done
21022 avail_ext="$keepextensions"
21023 ;;
21024esac
21025
21026case "$noextensions" in
21027'') ;;
21028*) keepextensions=''
21029 echo "You have requested that certain extensions be ignored..." >&4
21030 for i in $avail_ext; do
c3dadc13
AD
21031 case " $noextensions " in
21032 *" $i "*) echo "Ignoring extension $i." ;;
ef0c5be8
JH
21033 *) echo "Keeping extension $i.";
21034 keepextensions="$keepextensions $i"
21035 ;;
21036 esac
21037 done
21038 avail_ext="$keepextensions"
21039 ;;
21040esac
21041
b4eb6b3d
JH
21042: Now see which nonxs extensions are supported on this system.
21043: For now assume all are.
21044nonxs_ext=''
21045for xxx in $nonxs_extensions ; do
21046 case "$xxx" in
21047 *) nonxs_ext="$nonxs_ext $xxx"
21048 ;;
21049 esac
21050done
5f80c64f 21051
b4eb6b3d
JH
21052set X $nonxs_ext
21053shift
21054nonxs_ext="$*"
21055
21056case $usedl in
21057$define)
21058 $cat <<EOM
21059A number of extensions are supplied with $package. You may choose to
21060compile these extensions for dynamic loading (the default), compile
21061them into the $package executable (static loading), or not include
21062them at all. Answer "none" to include no extensions.
21063Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
21064
21065EOM
b4eb6b3d 21066 case "$dynamic_ext" in
736accd3
YST
21067 '')
21068 : Exclude those listed in static_ext
21069 dflt=''
21070 for xxx in $avail_ext; do
21071 case " $static_ext " in
21072 *" $xxx "*) ;;
21073 *) dflt="$dflt $xxx" ;;
21074 esac
21075 done
21076 set X $dflt
21077 shift
21078 dflt="$*"
21079 ;;
b4eb6b3d
JH
21080 *) dflt="$dynamic_ext"
21081 # Perhaps we are reusing an old out-of-date config.sh.
21082 case "$hint" in
21083 previous)
21084 if test X"$dynamic_ext" != X"$avail_ext"; then
21085 $cat <<EOM
21086NOTICE: Your previous config.sh list may be incorrect.
21087The extensions now available to you are
21088 ${avail_ext}
21089but the default list from your previous config.sh is
21090 ${dynamic_ext}
9c839522 21091
b4eb6b3d
JH
21092EOM
21093 fi
9c839522
PM
21094 ;;
21095 esac
b4eb6b3d
JH
21096 ;;
21097 esac
5f80c64f 21098 case "$dflt" in
b4eb6b3d
JH
21099 '') dflt=none;;
21100 esac
21101 rp="What extensions do you wish to load dynamically?"
21102 . ./myread
21103 case "$ans" in
21104 none) dynamic_ext=' ' ;;
21105 *) dynamic_ext="$ans" ;;
5f80c64f 21106 esac
5f80c64f 21107
b4eb6b3d
JH
21108 case "$static_ext" in
21109 '')
21110 : Exclude those already listed in dynamic linking
21111 dflt=''
21112 for xxx in $avail_ext; do
21113 case " $dynamic_ext " in
21114 *" $xxx "*) ;;
21115 *) dflt="$dflt $xxx" ;;
21116 esac
21117 done
21118 set X $dflt
21119 shift
21120 dflt="$*"
21121 ;;
21122 *) dflt="$static_ext"
21123 ;;
21124 esac
9c839522 21125
b4eb6b3d
JH
21126 case "$dflt" in
21127 '') dflt=none;;
21128 esac
21129 rp="What extensions do you wish to load statically?"
21130 . ./myread
21131 case "$ans" in
21132 none) static_ext=' ' ;;
21133 *) static_ext="$ans" ;;
21134 esac
21135 ;;
21136*)
21137 $cat <<EOM
21138A number of extensions are supplied with $package. Answer "none"
21139to include no extensions.
21140Note that DynaLoader is always built and need not be mentioned here.
9c839522 21141
b4eb6b3d
JH
21142EOM
21143 case "$static_ext" in
21144 '') dflt="$avail_ext" ;;
21145 *) dflt="$static_ext"
21146 # Perhaps we are reusing an old out-of-date config.sh.
21147 case "$hint" in
21148 previous)
21149 if test X"$static_ext" != X"$avail_ext"; then
21150 $cat <<EOM
21151NOTICE: Your previous config.sh list may be incorrect.
21152The extensions now available to you are
21153 ${avail_ext}
21154but the default list from your previous config.sh is
21155 ${static_ext}
5f80c64f
JH
21156
21157EOM
b4eb6b3d
JH
21158 fi
21159 ;;
21160 esac
21161 ;;
21162 esac
21163 : Exclude those that are not xs extensions
21164 case "$dflt" in
21165 '') dflt=none;;
21166 esac
21167 rp="What extensions do you wish to include?"
21168 . ./myread
21169 case "$ans" in
21170 none) static_ext=' ' ;;
21171 *) static_ext="$ans" ;;
21172 esac
21173 ;;
5f80c64f 21174esac
f1f6834f
AD
21175#
21176# Encode is a special case. If we are building Encode as a static
21177# extension, we need to explicitly list its subextensions as well.
21178# For other nested extensions, this is handled automatically by
21179# the appropriate Makefile.PL.
21180case " $static_ext " in
21181 *" Encode "*) # Add the subextensions of Encode
21182 cd "$rsrc/ext"
21183 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21184 static_ext="$static_ext Encode/$xxx"
21185 done
21186 cd "$tdir"
21187 ;;
21188esac
5f80c64f 21189
b4eb6b3d
JH
21190set X $dynamic_ext $static_ext $nonxs_ext
21191shift
21192extensions="$*"
21193
93a2cd18
AD
21194# Sanity check: We require an extension suitable for use with
21195# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
21196# should show up as failures in the test suite, but it's helpful to
21197# catch them now.) The 'extensions' list is normally sorted
21198# alphabetically, so we need to accept either
21199# DB_File ... Fcntl ... IO ....
21200# or something like
21201# Fcntl ... NDBM_File ... IO ....
42fde7b2
JH
21202case " $extensions" in
21203*"_File "*" Fcntl "*" IO "*) ;; # DB_File
21204*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21205*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
7a8675bc
JH
21206*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21207 echo "WARNING: The Perl you are building will be quite crippled." >& 4
21208 ;;
21209esac
21210
9c839522
PM
21211: Remove libraries needed only for extensions
21212: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
21213: The exception is SunOS 4.x, which needs them.
21214case "${osname}X${osvers}" in
21215sunos*X4*)
21216 perllibs="$libs"
21217 ;;
21218*) case "$usedl" in
21219 $define|true|[yY]*)
21220 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
21221 shift
21222 perllibs="$*"
21223 ;;
21224 *) perllibs="$libs"
21225 ;;
21226 esac
21227 ;;
9c839522 21228esac
5f80c64f
JH
21229
21230: Remove build directory name from cppstdin so it can be used from
21231: either the present location or the final installed location.
21232echo " "
21233: Get out of the UU directory to get correct path name.
21234cd ..
21235case "$cppstdin" in
21236`pwd`/cppstdin)
21237 echo "Stripping down cppstdin path name"
21238 cppstdin=cppstdin
21239 ;;
21240esac
21241cd UU
21242
21243: end of configuration questions
21244echo " "
21245echo "End of configuration questions."
21246echo " "
21247
21248: back to where it started
21249if test -d ../UU; then
21250 cd ..
21251fi
21252
48370efc
JH
21253: configuration may be patched via a 'config.arch' file
21254if $test -f config.arch; then
21255 echo "I see a config.arch file, loading it."
21256 . ./config.arch
21257fi
21258
5f80c64f
JH
21259: configuration may be patched via a 'config.over' file
21260if $test -f config.over; then
21261 echo " "
21262 dflt=y
21263 rp='I see a config.over file. Do you wish to load it?'
21264 . UU/myread
21265 case "$ans" in
21266 n*) echo "OK, I'll ignore it.";;
21267 *) . ./config.over
21268 echo "Configuration override changes have been loaded."
21269 ;;
21270 esac
21271fi
21272
21273: in case they want portability, strip down executable paths
21274case "$d_portable" in
21275"$define")
21276 echo " "
21277 echo "Stripping down executable paths..." >&4
21278 for file in $loclist $trylist; do
534ac15a
JH
21279 eval temp=\$$file
21280 eval $file=`basename $temp`
5f80c64f
JH
21281 done
21282 ;;
21283esac
21284
21285: create config.sh file
21286echo " "
21287echo "Creating config.sh..." >&4
21288$spitshell <<EOT >config.sh
21289$startsh
21290#
21291# This file was produced by running the Configure script. It holds all the
21292# definitions figured out by Configure. Should you modify one of these values,
21293# do not forget to propagate your changes by running "Configure -der". You may
21294# instead choose to run each of the .SH files by yourself, or "Configure -S".
21295#
21296
21297# Package name : $package
21298# Source directory : $src
21299# Configuration time: $cf_time
21300# Configured by : $cf_by
21301# Target system : $myuname
21302
21303Author='$Author'
21304Date='$Date'
21305Header='$Header'
21306Id='$Id'
21307Locker='$Locker'
21308Log='$Log'
21309Mcc='$Mcc'
21310RCSfile='$RCSfile'
21311Revision='$Revision'
21312Source='$Source'
21313State='$State'
21314_a='$_a'
21315_exe='$_exe'
21316_o='$_o'
b4eb6b3d 21317afs='$afs'
a6d26a0d 21318afsroot='$afsroot'
b4eb6b3d
JH
21319alignbytes='$alignbytes'
21320ansi2knr='$ansi2knr'
21321aphostname='$aphostname'
21322api_revision='$api_revision'
21323api_subversion='$api_subversion'
21324api_version='$api_version'
21325api_versionstring='$api_versionstring'
5f80c64f 21326ar='$ar'
b4eb6b3d
JH
21327archlib='$archlib'
21328archlibexp='$archlibexp'
21329archname64='$archname64'
21330archname='$archname'
5f80c64f 21331archobjs='$archobjs'
10bc17b6 21332asctime_r_proto='$asctime_r_proto'
5f80c64f 21333awk='$awk'
b4eb6b3d 21334baserev='$baserev'
5f80c64f 21335bash='$bash'
b4eb6b3d 21336bin='$bin'
b4eb6b3d 21337binexp='$binexp'
5f80c64f
JH
21338bison='$bison'
21339byacc='$byacc'
b4eb6b3d 21340byteorder='$byteorder'
5f80c64f 21341c='$c'
b4eb6b3d 21342castflags='$castflags'
5f80c64f
JH
21343cat='$cat'
21344cc='$cc'
21345cccdlflags='$cccdlflags'
21346ccdlflags='$ccdlflags'
21347ccflags='$ccflags'
b4eb6b3d 21348ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 21349ccname='$ccname'
b4eb6b3d 21350ccsymbols='$ccsymbols'
6b356c8e 21351ccversion='$ccversion'
5f80c64f 21352cf_by='$cf_by'
b4eb6b3d 21353cf_email='$cf_email'
5f80c64f 21354cf_time='$cf_time'
b4eb6b3d 21355charsize='$charsize'
5f80c64f
JH
21356chgrp='$chgrp'
21357chmod='$chmod'
21358chown='$chown'
b4eb6b3d 21359clocktype='$clocktype'
5f80c64f
JH
21360comm='$comm'
21361compress='$compress'
21362contains='$contains'
21363cp='$cp'
21364cpio='$cpio'
21365cpp='$cpp'
b4eb6b3d
JH
21366cpp_stuff='$cpp_stuff'
21367cppccsymbols='$cppccsymbols'
5f80c64f
JH
21368cppflags='$cppflags'
21369cpplast='$cpplast'
21370cppminus='$cppminus'
21371cpprun='$cpprun'
21372cppstdin='$cppstdin'
b4eb6b3d 21373cppsymbols='$cppsymbols'
10bc17b6 21374crypt_r_proto='$crypt_r_proto'
b4eb6b3d 21375cryptlib='$cryptlib'
5f80c64f 21376csh='$csh'
10bc17b6
JH
21377ctermid_r_proto='$ctermid_r_proto'
21378ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
21379d_Gconvert='$d_Gconvert'
21380d_PRIEUldbl='$d_PRIEUldbl'
21381d_PRIFUldbl='$d_PRIFUldbl'
21382d_PRIGUldbl='$d_PRIGUldbl'
21383d_PRIXU64='$d_PRIXU64'
21384d_PRId64='$d_PRId64'
21385d_PRIeldbl='$d_PRIeldbl'
21386d_PRIfldbl='$d_PRIfldbl'
21387d_PRIgldbl='$d_PRIgldbl'
21388d_PRIi64='$d_PRIi64'
21389d_PRIo64='$d_PRIo64'
21390d_PRIu64='$d_PRIu64'
21391d_PRIx64='$d_PRIx64'
21392d_SCNfldbl='$d_SCNfldbl'
74cac757 21393d__fwalk='$d__fwalk'
b4eb6b3d
JH
21394d_access='$d_access'
21395d_accessx='$d_accessx'
55954f19 21396d_aintl='$d_aintl'
b4eb6b3d
JH
21397d_alarm='$d_alarm'
21398d_archlib='$d_archlib'
10bc17b6 21399d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
21400d_atolf='$d_atolf'
21401d_atoll='$d_atoll'
0dbb1585
AL
21402d_attribute_format='$d_attribute_format'
21403d_attribute_malloc='$d_attribute_malloc'
21404d_attribute_nonnull='$d_attribute_nonnull'
21405d_attribute_noreturn='$d_attribute_noreturn'
21406d_attribute_pure='$d_attribute_pure'
21407d_attribute_unused='$d_attribute_unused'
21408d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
b4eb6b3d
JH
21409d_bcmp='$d_bcmp'
21410d_bcopy='$d_bcopy'
5f80c64f 21411d_bsd='$d_bsd'
b4eb6b3d
JH
21412d_bsdgetpgrp='$d_bsdgetpgrp'
21413d_bsdsetpgrp='$d_bsdsetpgrp'
635aebb7
AL
21414d_builtin_choose_expr='$d_builtin_choose_expr'
21415d_builtin_expect='$d_builtin_expect'
b4eb6b3d 21416d_bzero='$d_bzero'
a2d23ec2 21417d_c99_variadic_macros='$d_c99_variadic_macros'
b4eb6b3d
JH
21418d_casti32='$d_casti32'
21419d_castneg='$d_castneg'
21420d_charvspr='$d_charvspr'
21421d_chown='$d_chown'
21422d_chroot='$d_chroot'
21423d_chsize='$d_chsize'
758a5d79 21424d_class='$d_class'
b0a2e8e6 21425d_clearenv='$d_clearenv'
b4eb6b3d 21426d_closedir='$d_closedir'
4e0554ec 21427d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 21428d_const='$d_const'
55954f19 21429d_copysignl='$d_copysignl'
666ea192 21430d_cplusplus='$d_cplusplus'
b4eb6b3d 21431d_crypt='$d_crypt'
10bc17b6 21432d_crypt_r='$d_crypt_r'
b4eb6b3d 21433d_csh='$d_csh'
13cfc98d 21434d_ctermid='$d_ctermid'
10bc17b6
JH
21435d_ctermid_r='$d_ctermid_r'
21436d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
21437d_cuserid='$d_cuserid'
21438d_dbl_dig='$d_dbl_dig'
2ef53570 21439d_dbminitproto='$d_dbminitproto'
b4eb6b3d 21440d_difftime='$d_difftime'
ae0e3d3b 21441d_dirfd='$d_dirfd'
b4eb6b3d
JH
21442d_dirnamlen='$d_dirnamlen'
21443d_dlerror='$d_dlerror'
5f80c64f 21444d_dlopen='$d_dlopen'
b4eb6b3d
JH
21445d_dlsymun='$d_dlsymun'
21446d_dosuid='$d_dosuid'
10bc17b6 21447d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
21448d_drand48proto='$d_drand48proto'
21449d_dup2='$d_dup2'
21450d_eaccess='$d_eaccess'
21451d_endgrent='$d_endgrent'
10bc17b6 21452d_endgrent_r='$d_endgrent_r'
b4eb6b3d 21453d_endhent='$d_endhent'
10bc17b6 21454d_endhostent_r='$d_endhostent_r'
b4eb6b3d 21455d_endnent='$d_endnent'
10bc17b6 21456d_endnetent_r='$d_endnetent_r'
b4eb6b3d 21457d_endpent='$d_endpent'
10bc17b6 21458d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 21459d_endpwent='$d_endpwent'
10bc17b6 21460d_endpwent_r='$d_endpwent_r'
b4eb6b3d 21461d_endsent='$d_endsent'
10bc17b6 21462d_endservent_r='$d_endservent_r'
b4eb6b3d 21463d_eofnblk='$d_eofnblk'
5f80c64f 21464d_eunice='$d_eunice'
15b61c98 21465d_faststdio='$d_faststdio'
b363b713 21466d_fchdir='$d_fchdir'
b4eb6b3d
JH
21467d_fchmod='$d_fchmod'
21468d_fchown='$d_fchown'
21469d_fcntl='$d_fcntl'
9d9004a9 21470d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
21471d_fd_macros='$d_fd_macros'
21472d_fd_set='$d_fd_set'
21473d_fds_bits='$d_fds_bits'
21474d_fgetpos='$d_fgetpos'
758a5d79
JH
21475d_finite='$d_finite'
21476d_finitel='$d_finitel'
b4eb6b3d
JH
21477d_flexfnam='$d_flexfnam'
21478d_flock='$d_flock'
2ef53570 21479d_flockproto='$d_flockproto'
b4eb6b3d 21480d_fork='$d_fork'
758a5d79 21481d_fp_class='$d_fp_class'
b4eb6b3d 21482d_fpathconf='$d_fpathconf'
758a5d79
JH
21483d_fpclass='$d_fpclass'
21484d_fpclassify='$d_fpclassify'
21485d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
21486d_fpos64_t='$d_fpos64_t'
21487d_frexpl='$d_frexpl'
21488d_fs_data_s='$d_fs_data_s'
21489d_fseeko='$d_fseeko'
21490d_fsetpos='$d_fsetpos'
21491d_fstatfs='$d_fstatfs'
21492d_fstatvfs='$d_fstatvfs'
411ab01c 21493d_fsync='$d_fsync'
b4eb6b3d
JH
21494d_ftello='$d_ftello'
21495d_ftime='$d_ftime'
dc814df1 21496d_futimes='$d_futimes'
b4eb6b3d
JH
21497d_getcwd='$d_getcwd'
21498d_getespwnam='$d_getespwnam'
21499d_getfsstat='$d_getfsstat'
21500d_getgrent='$d_getgrent'
10bc17b6
JH
21501d_getgrent_r='$d_getgrent_r'
21502d_getgrgid_r='$d_getgrgid_r'
21503d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
21504d_getgrps='$d_getgrps'
21505d_gethbyaddr='$d_gethbyaddr'
21506d_gethbyname='$d_gethbyname'
21507d_gethent='$d_gethent'
21508d_gethname='$d_gethname'
10bc17b6
JH
21509d_gethostbyaddr_r='$d_gethostbyaddr_r'
21510d_gethostbyname_r='$d_gethostbyname_r'
21511d_gethostent_r='$d_gethostent_r'
b4eb6b3d 21512d_gethostprotos='$d_gethostprotos'
4e0554ec 21513d_getitimer='$d_getitimer'
b4eb6b3d 21514d_getlogin='$d_getlogin'
10bc17b6 21515d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
21516d_getmnt='$d_getmnt'
21517d_getmntent='$d_getmntent'
21518d_getnbyaddr='$d_getnbyaddr'
21519d_getnbyname='$d_getnbyname'
21520d_getnent='$d_getnent'
10bc17b6
JH
21521d_getnetbyaddr_r='$d_getnetbyaddr_r'
21522d_getnetbyname_r='$d_getnetbyname_r'
21523d_getnetent_r='$d_getnetent_r'
b4eb6b3d 21524d_getnetprotos='$d_getnetprotos'
0c0643d0 21525d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
21526d_getpbyname='$d_getpbyname'
21527d_getpbynumber='$d_getpbynumber'
21528d_getpent='$d_getpent'
21529d_getpgid='$d_getpgid'
21530d_getpgrp2='$d_getpgrp2'
21531d_getpgrp='$d_getpgrp'
21532d_getppid='$d_getppid'
21533d_getprior='$d_getprior'
10bc17b6
JH
21534d_getprotobyname_r='$d_getprotobyname_r'
21535d_getprotobynumber_r='$d_getprotobynumber_r'
21536d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
21537d_getprotoprotos='$d_getprotoprotos'
21538d_getprpwnam='$d_getprpwnam'
21539d_getpwent='$d_getpwent'
10bc17b6
JH
21540d_getpwent_r='$d_getpwent_r'
21541d_getpwnam_r='$d_getpwnam_r'
21542d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
21543d_getsbyname='$d_getsbyname'
21544d_getsbyport='$d_getsbyport'
21545d_getsent='$d_getsent'
10bc17b6
JH
21546d_getservbyname_r='$d_getservbyname_r'
21547d_getservbyport_r='$d_getservbyport_r'
21548d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
21549d_getservprotos='$d_getservprotos'
21550d_getspnam='$d_getspnam'
10bc17b6 21551d_getspnam_r='$d_getspnam_r'
b4eb6b3d 21552d_gettimeod='$d_gettimeod'
10bc17b6 21553d_gmtime_r='$d_gmtime_r'
5f80c64f 21554d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
21555d_grpasswd='$d_grpasswd'
21556d_hasmntopt='$d_hasmntopt'
21557d_htonl='$d_htonl'
55954f19 21558d_ilogbl='$d_ilogbl'
f3f1a2d8 21559d_inc_version_list='$d_inc_version_list'
b4eb6b3d
JH
21560d_index='$d_index'
21561d_inetaton='$d_inetaton'
21562d_int64_t='$d_int64_t'
21563d_isascii='$d_isascii'
758a5d79
JH
21564d_isfinite='$d_isfinite'
21565d_isinf='$d_isinf'
b4eb6b3d
JH
21566d_isnan='$d_isnan'
21567d_isnanl='$d_isnanl'
21568d_killpg='$d_killpg'
21569d_lchown='$d_lchown'
21570d_ldbl_dig='$d_ldbl_dig'
0a0abfba 21571d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 21572d_link='$d_link'
10bc17b6 21573d_localtime_r='$d_localtime_r'
8572b25d 21574d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
b4eb6b3d
JH
21575d_locconv='$d_locconv'
21576d_lockf='$d_lockf'
21577d_longdbl='$d_longdbl'
21578d_longlong='$d_longlong'
21579d_lseekproto='$d_lseekproto'
21580d_lstat='$d_lstat'
21581d_madvise='$d_madvise'
7dd121ae
MB
21582d_malloc_good_size='$d_malloc_good_size'
21583d_malloc_size='$d_malloc_size'
b4eb6b3d
JH
21584d_mblen='$d_mblen'
21585d_mbstowcs='$d_mbstowcs'
21586d_mbtowc='$d_mbtowc'
21587d_memchr='$d_memchr'
21588d_memcmp='$d_memcmp'
21589d_memcpy='$d_memcpy'
21590d_memmove='$d_memmove'
21591d_memset='$d_memset'
21592d_mkdir='$d_mkdir'
21593d_mkdtemp='$d_mkdtemp'
21594d_mkfifo='$d_mkfifo'
21595d_mkstemp='$d_mkstemp'
21596d_mkstemps='$d_mkstemps'
21597d_mktime='$d_mktime'
21598d_mmap='$d_mmap'
21599d_modfl='$d_modfl'
e67aeab1 21600d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 21601d_modflproto='$d_modflproto'
b4eb6b3d
JH
21602d_mprotect='$d_mprotect'
21603d_msg='$d_msg'
21604d_msg_ctrunc='$d_msg_ctrunc'
21605d_msg_dontroute='$d_msg_dontroute'
21606d_msg_oob='$d_msg_oob'
21607d_msg_peek='$d_msg_peek'
21608d_msg_proxy='$d_msg_proxy'
21609d_msgctl='$d_msgctl'
21610d_msgget='$d_msgget'
4e0554ec 21611d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
21612d_msgrcv='$d_msgrcv'
21613d_msgsnd='$d_msgsnd'
21614d_msync='$d_msync'
21615d_munmap='$d_munmap'
21616d_mymalloc='$d_mymalloc'
21617d_nice='$d_nice'
2765b840 21618d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 21619d_nv_preserves_uv='$d_nv_preserves_uv'
f607920a 21620d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
b4eb6b3d
JH
21621d_off64_t='$d_off64_t'
21622d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21623d_oldpthreads='$d_oldpthreads'
21624d_oldsock='$d_oldsock'
21625d_open3='$d_open3'
21626d_pathconf='$d_pathconf'
21627d_pause='$d_pause'
21628d_perl_otherlibdirs='$d_perl_otherlibdirs'
21629d_phostname='$d_phostname'
21630d_pipe='$d_pipe'
21631d_poll='$d_poll'
5f80c64f 21632d_portable='$d_portable'
c7aff470 21633d_procselfexe='$d_procselfexe'
d6483fcc 21634d_pthread_atfork='$d_pthread_atfork'
58d975c3 21635d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
21636d_pthread_yield='$d_pthread_yield'
21637d_pwage='$d_pwage'
21638d_pwchange='$d_pwchange'
21639d_pwclass='$d_pwclass'
21640d_pwcomment='$d_pwcomment'
21641d_pwexpire='$d_pwexpire'
21642d_pwgecos='$d_pwgecos'
21643d_pwpasswd='$d_pwpasswd'
21644d_pwquota='$d_pwquota'
21645d_qgcvt='$d_qgcvt'
21646d_quad='$d_quad'
10bc17b6
JH
21647d_random_r='$d_random_r'
21648d_readdir64_r='$d_readdir64_r'
b4eb6b3d 21649d_readdir='$d_readdir'
10bc17b6 21650d_readdir_r='$d_readdir_r'
b4eb6b3d 21651d_readlink='$d_readlink'
4e0554ec
JH
21652d_readv='$d_readv'
21653d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
21654d_rename='$d_rename'
21655d_rewinddir='$d_rewinddir'
21656d_rmdir='$d_rmdir'
21657d_safebcpy='$d_safebcpy'
21658d_safemcpy='$d_safemcpy'
21659d_sanemcmp='$d_sanemcmp'
ef9f17be 21660d_sbrkproto='$d_sbrkproto'
55954f19 21661d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
21662d_sched_yield='$d_sched_yield'
21663d_scm_rights='$d_scm_rights'
21664d_seekdir='$d_seekdir'
21665d_select='$d_select'
21666d_sem='$d_sem'
21667d_semctl='$d_semctl'
21668d_semctl_semid_ds='$d_semctl_semid_ds'
21669d_semctl_semun='$d_semctl_semun'
21670d_semget='$d_semget'
21671d_semop='$d_semop'
4e0554ec 21672d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
21673d_setegid='$d_setegid'
21674d_seteuid='$d_seteuid'
21675d_setgrent='$d_setgrent'
10bc17b6 21676d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
21677d_setgrps='$d_setgrps'
21678d_sethent='$d_sethent'
10bc17b6 21679d_sethostent_r='$d_sethostent_r'
4e0554ec 21680d_setitimer='$d_setitimer'
b4eb6b3d
JH
21681d_setlinebuf='$d_setlinebuf'
21682d_setlocale='$d_setlocale'
10bc17b6 21683d_setlocale_r='$d_setlocale_r'
b4eb6b3d 21684d_setnent='$d_setnent'
10bc17b6 21685d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
21686d_setpent='$d_setpent'
21687d_setpgid='$d_setpgid'
21688d_setpgrp2='$d_setpgrp2'
21689d_setpgrp='$d_setpgrp'
21690d_setprior='$d_setprior'
21691d_setproctitle='$d_setproctitle'
10bc17b6 21692d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 21693d_setpwent='$d_setpwent'
10bc17b6 21694d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
21695d_setregid='$d_setregid'
21696d_setresgid='$d_setresgid'
21697d_setresuid='$d_setresuid'
21698d_setreuid='$d_setreuid'
21699d_setrgid='$d_setrgid'
21700d_setruid='$d_setruid'
21701d_setsent='$d_setsent'
10bc17b6 21702d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
21703d_setsid='$d_setsid'
21704d_setvbuf='$d_setvbuf'
21705d_sfio='$d_sfio'
21706d_shm='$d_shm'
21707d_shmat='$d_shmat'
21708d_shmatprototype='$d_shmatprototype'
21709d_shmctl='$d_shmctl'
21710d_shmdt='$d_shmdt'
21711d_shmget='$d_shmget'
21712d_sigaction='$d_sigaction'
983dbef6 21713d_sigprocmask='$d_sigprocmask'
b4eb6b3d 21714d_sigsetjmp='$d_sigsetjmp'
c95d0e17 21715d_sitearch='$d_sitearch'
4f5da3e9 21716d_snprintf='$d_snprintf'
49a78c82 21717d_sockatmark='$d_sockatmark'
2ef53570 21718d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
21719d_socket='$d_socket'
21720d_socklen_t='$d_socklen_t'
21721d_sockpair='$d_sockpair'
21722d_socks5_init='$d_socks5_init'
360321b3 21723d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
b4eb6b3d 21724d_sqrtl='$d_sqrtl'
10bc17b6
JH
21725d_srand48_r='$d_srand48_r'
21726d_srandom_r='$d_srandom_r'
eef837ea 21727d_sresgproto='$d_sresgproto'
640374d0 21728d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
21729d_statblks='$d_statblks'
21730d_statfs_f_flags='$d_statfs_f_flags'
21731d_statfs_s='$d_statfs_s'
21732d_statvfs='$d_statvfs'
21733d_stdio_cnt_lval='$d_stdio_cnt_lval'
21734d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
21735d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21736d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
21737d_stdio_stream_array='$d_stdio_stream_array'
21738d_stdiobase='$d_stdiobase'
21739d_stdstdio='$d_stdstdio'
21740d_strchr='$d_strchr'
21741d_strcoll='$d_strcoll'
21742d_strctcpy='$d_strctcpy'
21743d_strerrm='$d_strerrm'
21744d_strerror='$d_strerror'
10bc17b6 21745d_strerror_r='$d_strerror_r'
b3c85772 21746d_strftime='$d_strftime'
08c92000
MB
21747d_strlcat='$d_strlcat'
21748d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
21749d_strtod='$d_strtod'
21750d_strtol='$d_strtol'
21751d_strtold='$d_strtold'
21752d_strtoll='$d_strtoll'
28e5dec8 21753d_strtoq='$d_strtoq'
b4eb6b3d
JH
21754d_strtoul='$d_strtoul'
21755d_strtoull='$d_strtoull'
21756d_strtouq='$d_strtouq'
21757d_strxfrm='$d_strxfrm'
21758d_suidsafe='$d_suidsafe'
21759d_symlink='$d_symlink'
21760d_syscall='$d_syscall'
2ef53570 21761d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
21762d_sysconf='$d_sysconf'
21763d_sysernlst='$d_sysernlst'
21764d_syserrlst='$d_syserrlst'
21765d_system='$d_system'
21766d_tcgetpgrp='$d_tcgetpgrp'
21767d_tcsetpgrp='$d_tcsetpgrp'
21768d_telldir='$d_telldir'
21769d_telldirproto='$d_telldirproto'
21770d_time='$d_time'
21771d_times='$d_times'
14b90194
JH
21772d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21773d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 21774d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 21775d_truncate='$d_truncate'
10bc17b6 21776d_ttyname_r='$d_ttyname_r'
b4eb6b3d 21777d_tzname='$d_tzname'
4e0554ec
JH
21778d_u32align='$d_u32align'
21779d_ualarm='$d_ualarm'
b4eb6b3d
JH
21780d_umask='$d_umask'
21781d_uname='$d_uname'
21782d_union_semun='$d_union_semun'
758a5d79 21783d_unordered='$d_unordered'
bdf33aa7 21784d_unsetenv='$d_unsetenv'
4e0554ec 21785d_usleep='$d_usleep'
2ef53570 21786d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
21787d_ustat='$d_ustat'
21788d_vendorarch='$d_vendorarch'
21789d_vendorbin='$d_vendorbin'
21790d_vendorlib='$d_vendorlib'
6e1038e0 21791d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
21792d_vfork='$d_vfork'
21793d_void_closedir='$d_void_closedir'
21794d_voidsig='$d_voidsig'
21795d_voidtty='$d_voidtty'
21796d_volatile='$d_volatile'
21797d_vprintf='$d_vprintf'
4f5da3e9 21798d_vsnprintf='$d_vsnprintf'
b4eb6b3d
JH
21799d_wait4='$d_wait4'
21800d_waitpid='$d_waitpid'
21801d_wcstombs='$d_wcstombs'
21802d_wctomb='$d_wctomb'
4e0554ec 21803d_writev='$d_writev'
5f80c64f
JH
21804d_xenix='$d_xenix'
21805date='$date'
b4eb6b3d
JH
21806db_hashtype='$db_hashtype'
21807db_prefixtype='$db_prefixtype'
640374d0
JH
21808db_version_major='$db_version_major'
21809db_version_minor='$db_version_minor'
21810db_version_patch='$db_version_patch'
b4eb6b3d
JH
21811defvoidused='$defvoidused'
21812direntrytype='$direntrytype'
21813dlext='$dlext'
5f80c64f 21814dlsrc='$dlsrc'
b4eb6b3d
JH
21815doublesize='$doublesize'
21816drand01='$drand01'
10bc17b6 21817drand48_r_proto='$drand48_r_proto'
b4eb6b3d
JH
21818dynamic_ext='$dynamic_ext'
21819eagain='$eagain'
21820ebcdic='$ebcdic'
5f80c64f
JH
21821echo='$echo'
21822egrep='$egrep'
21823emacs='$emacs'
10bc17b6
JH
21824endgrent_r_proto='$endgrent_r_proto'
21825endhostent_r_proto='$endhostent_r_proto'
21826endnetent_r_proto='$endnetent_r_proto'
21827endprotoent_r_proto='$endprotoent_r_proto'
21828endpwent_r_proto='$endpwent_r_proto'
21829endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
21830eunicefix='$eunicefix'
21831exe_ext='$exe_ext'
21832expr='$expr'
b4eb6b3d 21833extensions='$extensions'
6fcddf3b 21834extras='$extras'
b4eb6b3d
JH
21835fflushNULL='$fflushNULL'
21836fflushall='$fflushall'
5f80c64f
JH
21837find='$find'
21838firstmakefile='$firstmakefile'
21839flex='$flex'
b4eb6b3d
JH
21840fpossize='$fpossize'
21841fpostype='$fpostype'
21842freetype='$freetype'
5440bc8e 21843from='$from'
b4eb6b3d
JH
21844full_ar='$full_ar'
21845full_csh='$full_csh'
21846full_sed='$full_sed'
2d736872 21847gccansipedantic='$gccansipedantic'
5b463ca7 21848gccosandvers='$gccosandvers'
5f80c64f 21849gccversion='$gccversion'
10bc17b6
JH
21850getgrent_r_proto='$getgrent_r_proto'
21851getgrgid_r_proto='$getgrgid_r_proto'
21852getgrnam_r_proto='$getgrnam_r_proto'
21853gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21854gethostbyname_r_proto='$gethostbyname_r_proto'
21855gethostent_r_proto='$gethostent_r_proto'
21856getlogin_r_proto='$getlogin_r_proto'
21857getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21858getnetbyname_r_proto='$getnetbyname_r_proto'
21859getnetent_r_proto='$getnetent_r_proto'
21860getprotobyname_r_proto='$getprotobyname_r_proto'
21861getprotobynumber_r_proto='$getprotobynumber_r_proto'
21862getprotoent_r_proto='$getprotoent_r_proto'
21863getpwent_r_proto='$getpwent_r_proto'
21864getpwnam_r_proto='$getpwnam_r_proto'
21865getpwuid_r_proto='$getpwuid_r_proto'
21866getservbyname_r_proto='$getservbyname_r_proto'
21867getservbyport_r_proto='$getservbyport_r_proto'
21868getservent_r_proto='$getservent_r_proto'
21869getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
21870gidformat='$gidformat'
21871gidsign='$gidsign'
21872gidsize='$gidsize'
21873gidtype='$gidtype'
5f80c64f 21874glibpth='$glibpth'
3c728e00 21875gmake='$gmake'
10bc17b6 21876gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 21877gnulibc_version='$gnulibc_version'
5f80c64f 21878grep='$grep'
b4eb6b3d
JH
21879groupcat='$groupcat'
21880groupstype='$groupstype'
5f80c64f 21881gzip='$gzip'
b4eb6b3d
JH
21882h_fcntl='$h_fcntl'
21883h_sysfile='$h_sysfile'
5f80c64f 21884hint='$hint'
b4eb6b3d 21885hostcat='$hostcat'
6e1038e0
MB
21886html1dir='$html1dir'
21887html1direxp='$html1direxp'
21888html3dir='$html3dir'
21889html3direxp='$html3direxp'
b4eb6b3d
JH
21890i16size='$i16size'
21891i16type='$i16type'
21892i32size='$i32size'
21893i32type='$i32type'
21894i64size='$i64size'
21895i64type='$i64type'
21896i8size='$i8size'
21897i8type='$i8type'
21898i_arpainet='$i_arpainet'
21899i_bsdioctl='$i_bsdioctl'
10bc17b6 21900i_crypt='$i_crypt'
b4eb6b3d
JH
21901i_db='$i_db'
21902i_dbm='$i_dbm'
21903i_dirent='$i_dirent'
5f80c64f 21904i_dld='$i_dld'
b4eb6b3d
JH
21905i_dlfcn='$i_dlfcn'
21906i_fcntl='$i_fcntl'
21907i_float='$i_float'
758a5d79
JH
21908i_fp='$i_fp'
21909i_fp_class='$i_fp_class'
b4eb6b3d
JH
21910i_gdbm='$i_gdbm'
21911i_grp='$i_grp'
b4eb6b3d
JH
21912i_ieeefp='$i_ieeefp'
21913i_inttypes='$i_inttypes'
2765b840 21914i_langinfo='$i_langinfo'
b4eb6b3d
JH
21915i_libutil='$i_libutil'
21916i_limits='$i_limits'
21917i_locale='$i_locale'
21918i_machcthr='$i_machcthr'
21919i_malloc='$i_malloc'
21920i_math='$i_math'
21921i_memory='$i_memory'
21922i_mntent='$i_mntent'
21923i_ndbm='$i_ndbm'
21924i_netdb='$i_netdb'
21925i_neterrno='$i_neterrno'
21926i_netinettcp='$i_netinettcp'
21927i_niin='$i_niin'
21928i_poll='$i_poll'
21929i_prot='$i_prot'
21930i_pthread='$i_pthread'
21931i_pwd='$i_pwd'
21932i_rpcsvcdbm='$i_rpcsvcdbm'
21933i_sfio='$i_sfio'
21934i_sgtty='$i_sgtty'
21935i_shadow='$i_shadow'
21936i_socks='$i_socks'
21937i_stdarg='$i_stdarg'
21938i_stddef='$i_stddef'
21939i_stdlib='$i_stdlib'
21940i_string='$i_string'
21941i_sunmath='$i_sunmath'
21942i_sysaccess='$i_sysaccess'
21943i_sysdir='$i_sysdir'
21944i_sysfile='$i_sysfile'
21945i_sysfilio='$i_sysfilio'
21946i_sysin='$i_sysin'
21947i_sysioctl='$i_sysioctl'
21948i_syslog='$i_syslog'
21949i_sysmman='$i_sysmman'
21950i_sysmode='$i_sysmode'
21951i_sysmount='$i_sysmount'
21952i_sysndir='$i_sysndir'
21953i_sysparam='$i_sysparam'
21954i_sysresrc='$i_sysresrc'
21955i_syssecrt='$i_syssecrt'
21956i_sysselct='$i_sysselct'
21957i_syssockio='$i_syssockio'
21958i_sysstat='$i_sysstat'
21959i_sysstatfs='$i_sysstatfs'
21960i_sysstatvfs='$i_sysstatvfs'
21961i_systime='$i_systime'
21962i_systimek='$i_systimek'
21963i_systimes='$i_systimes'
21964i_systypes='$i_systypes'
21965i_sysuio='$i_sysuio'
21966i_sysun='$i_sysun'
21967i_sysutsname='$i_sysutsname'
21968i_sysvfs='$i_sysvfs'
21969i_syswait='$i_syswait'
21970i_termio='$i_termio'
21971i_termios='$i_termios'
21972i_time='$i_time'
21973i_unistd='$i_unistd'
21974i_ustat='$i_ustat'
21975i_utime='$i_utime'
21976i_values='$i_values'
21977i_varargs='$i_varargs'
21978i_varhdr='$i_varhdr'
21979i_vfork='$i_vfork'
5f80c64f 21980ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
21981inc_version_list='$inc_version_list'
21982inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
21983incpath='$incpath'
21984inews='$inews'
f3f1a2d8 21985initialinstalllocation='$initialinstalllocation'
b4eb6b3d
JH
21986installarchlib='$installarchlib'
21987installbin='$installbin'
6e1038e0
MB
21988installhtml1dir='$installhtml1dir'
21989installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
21990installman1dir='$installman1dir'
21991installman3dir='$installman3dir'
21992installprefix='$installprefix'
21993installprefixexp='$installprefixexp'
21994installprivlib='$installprivlib'
21995installscript='$installscript'
21996installsitearch='$installsitearch'
21997installsitebin='$installsitebin'
8d2cbf27
JH
21998installsitehtml1dir='$installsitehtml1dir'
21999installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 22000installsitelib='$installsitelib'
91e123a8
JH
22001installsiteman1dir='$installsiteman1dir'
22002installsiteman3dir='$installsiteman3dir'
6e1038e0 22003installsitescript='$installsitescript'
b4eb6b3d
JH
22004installstyle='$installstyle'
22005installusrbinperl='$installusrbinperl'
22006installvendorarch='$installvendorarch'
22007installvendorbin='$installvendorbin'
8d2cbf27
JH
22008installvendorhtml1dir='$installvendorhtml1dir'
22009installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 22010installvendorlib='$installvendorlib'
91e123a8
JH
22011installvendorman1dir='$installvendorman1dir'
22012installvendorman3dir='$installvendorman3dir'
6e1038e0 22013installvendorscript='$installvendorscript'
b4eb6b3d 22014intsize='$intsize'
4b661809 22015issymlink='$issymlink'
b4eb6b3d
JH
22016ivdformat='$ivdformat'
22017ivsize='$ivsize'
22018ivtype='$ivtype'
22019known_extensions='$known_extensions'
5f80c64f 22020ksh='$ksh'
5f80c64f
JH
22021ld='$ld'
22022lddlflags='$lddlflags'
22023ldflags='$ldflags'
b4eb6b3d
JH
22024ldflags_uselargefiles='$ldflags_uselargefiles'
22025ldlibpthname='$ldlibpthname'
5f80c64f
JH
22026less='$less'
22027lib_ext='$lib_ext'
22028libc='$libc'
b4eb6b3d 22029libperl='$libperl'
5f80c64f
JH
22030libpth='$libpth'
22031libs='$libs'
43999f95
JH
22032libsdirs='$libsdirs'
22033libsfiles='$libsfiles'
22034libsfound='$libsfound'
13b3f787 22035libspath='$libspath'
5f80c64f 22036libswanted='$libswanted'
b4eb6b3d 22037libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
22038line='$line'
22039lint='$lint'
22040lkflags='$lkflags'
22041ln='$ln'
22042lns='$lns'
10bc17b6 22043localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
22044locincpth='$locincpth'
22045loclibpth='$loclibpth'
b4eb6b3d
JH
22046longdblsize='$longdblsize'
22047longlongsize='$longlongsize'
22048longsize='$longsize'
5f80c64f
JH
22049lp='$lp'
22050lpr='$lpr'
22051ls='$ls'
b4eb6b3d
JH
22052lseeksize='$lseeksize'
22053lseektype='$lseektype'
a724edfe 22054mad='$mad'
f3f1a2d8
MB
22055madlyh='$madlyh'
22056madlyobj='$madlyobj'
22057madlysrc='$madlysrc'
5f80c64f
JH
22058mail='$mail'
22059mailx='$mailx'
22060make='$make'
22061make_set_make='$make_set_make'
b4eb6b3d
JH
22062mallocobj='$mallocobj'
22063mallocsrc='$mallocsrc'
22064malloctype='$malloctype'
22065man1dir='$man1dir'
22066man1direxp='$man1direxp'
22067man1ext='$man1ext'
22068man3dir='$man3dir'
22069man3direxp='$man3direxp'
22070man3ext='$man3ext'
5f80c64f 22071mips_type='$mips_type'
5129fff4 22072mistrustnm='$mistrustnm'
5f80c64f 22073mkdir='$mkdir'
b4eb6b3d
JH
22074mmaptype='$mmaptype'
22075modetype='$modetype'
5f80c64f 22076more='$more'
b4eb6b3d 22077multiarch='$multiarch'
5f80c64f 22078mv='$mv'
b4eb6b3d
JH
22079myarchname='$myarchname'
22080mydomain='$mydomain'
22081myhostname='$myhostname'
5f80c64f
JH
22082myuname='$myuname'
22083n='$n'
2cc61e15 22084need_va_copy='$need_va_copy'
b4eb6b3d
JH
22085netdb_hlen_type='$netdb_hlen_type'
22086netdb_host_type='$netdb_host_type'
22087netdb_name_type='$netdb_name_type'
22088netdb_net_type='$netdb_net_type'
5f80c64f
JH
22089nm='$nm'
22090nm_opt='$nm_opt'
22091nm_so_opt='$nm_so_opt'
b4eb6b3d 22092nonxs_ext='$nonxs_ext'
5f80c64f 22093nroff='$nroff'
b4eb6b3d
JH
22094nvEUformat='$nvEUformat'
22095nvFUformat='$nvFUformat'
22096nvGUformat='$nvGUformat'
53133ed1 22097nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
22098nveformat='$nveformat'
22099nvfformat='$nvfformat'
22100nvgformat='$nvgformat'
22101nvsize='$nvsize'
22102nvtype='$nvtype'
22103o_nonblock='$o_nonblock'
5f80c64f 22104obj_ext='$obj_ext'
b4eb6b3d 22105old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 22106optimize='$optimize'
b4eb6b3d 22107orderlib='$orderlib'
5f80c64f
JH
22108osname='$osname'
22109osvers='$osvers'
b4eb6b3d 22110otherlibdirs='$otherlibdirs'
5f80c64f 22111package='$package'
b4eb6b3d
JH
22112pager='$pager'
22113passcat='$passcat'
22114patchlevel='$patchlevel'
5f80c64f 22115path_sep='$path_sep'
b4eb6b3d 22116perl5='$perl5'
5f80c64f 22117perl='$perl'
151e6568 22118perl_patchlevel='$perl_patchlevel'
b4eb6b3d 22119perladmin='$perladmin'
9c839522 22120perllibs='$perllibs'
b4eb6b3d 22121perlpath='$perlpath'
5f80c64f 22122pg='$pg'
b4eb6b3d
JH
22123phostname='$phostname'
22124pidtype='$pidtype'
5f80c64f
JH
22125plibpth='$plibpth'
22126pmake='$pmake'
22127pr='$pr'
b4eb6b3d
JH
22128prefix='$prefix'
22129prefixexp='$prefixexp'
22130privlib='$privlib'
22131privlibexp='$privlibexp'
f24dbf84 22132procselfexe='$procselfexe'
b4eb6b3d
JH
22133prototype='$prototype'
22134ptrsize='$ptrsize'
22135quadkind='$quadkind'
22136quadtype='$quadtype'
22137randbits='$randbits'
22138randfunc='$randfunc'
10bc17b6 22139random_r_proto='$random_r_proto'
b4eb6b3d
JH
22140randseedtype='$randseedtype'
22141ranlib='$ranlib'
22142rd_nodata='$rd_nodata'
10bc17b6
JH
22143readdir64_r_proto='$readdir64_r_proto'
22144readdir_r_proto='$readdir_r_proto'
b4eb6b3d 22145revision='$revision'
5f80c64f
JH
22146rm='$rm'
22147rmail='$rmail'
5440bc8e 22148run='$run'
5f80c64f 22149runnm='$runnm'
b4eb6b3d
JH
22150sPRIEUldbl='$sPRIEUldbl'
22151sPRIFUldbl='$sPRIFUldbl'
22152sPRIGUldbl='$sPRIGUldbl'
22153sPRIXU64='$sPRIXU64'
22154sPRId64='$sPRId64'
22155sPRIeldbl='$sPRIeldbl'
22156sPRIfldbl='$sPRIfldbl'
22157sPRIgldbl='$sPRIgldbl'
22158sPRIi64='$sPRIi64'
22159sPRIo64='$sPRIo64'
22160sPRIu64='$sPRIu64'
22161sPRIx64='$sPRIx64'
22162sSCNfldbl='$sSCNfldbl'
22163sched_yield='$sched_yield'
22164scriptdir='$scriptdir'
22165scriptdirexp='$scriptdirexp'
5f80c64f 22166sed='$sed'
b4eb6b3d
JH
22167seedfunc='$seedfunc'
22168selectminbits='$selectminbits'
22169selecttype='$selecttype'
5f80c64f 22170sendmail='$sendmail'
10bc17b6
JH
22171setgrent_r_proto='$setgrent_r_proto'
22172sethostent_r_proto='$sethostent_r_proto'
22173setlocale_r_proto='$setlocale_r_proto'
22174setnetent_r_proto='$setnetent_r_proto'
22175setprotoent_r_proto='$setprotoent_r_proto'
22176setpwent_r_proto='$setpwent_r_proto'
22177setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
22178sh='$sh'
22179shar='$shar'
22180sharpbang='$sharpbang'
b4eb6b3d
JH
22181shmattype='$shmattype'
22182shortsize='$shortsize'
22183shrpenv='$shrpenv'
5f80c64f 22184shsharp='$shsharp'
b4eb6b3d
JH
22185sig_count='$sig_count'
22186sig_name='$sig_name'
22187sig_name_init='$sig_name_init'
22188sig_num='$sig_num'
22189sig_num_init='$sig_num_init'
76d3c696 22190sig_size='$sig_size'
b4eb6b3d
JH
22191signal_t='$signal_t'
22192sitearch='$sitearch'
22193sitearchexp='$sitearchexp'
22194sitebin='$sitebin'
22195sitebinexp='$sitebinexp'
8d2cbf27
JH
22196sitehtml1dir='$sitehtml1dir'
22197sitehtml1direxp='$sitehtml1direxp'
22198sitehtml3dir='$sitehtml3dir'
22199sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
22200sitelib='$sitelib'
22201sitelib_stem='$sitelib_stem'
22202sitelibexp='$sitelibexp'
91e123a8
JH
22203siteman1dir='$siteman1dir'
22204siteman1direxp='$siteman1direxp'
22205siteman3dir='$siteman3dir'
22206siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
22207siteprefix='$siteprefix'
22208siteprefixexp='$siteprefixexp'
6e1038e0
MB
22209sitescript='$sitescript'
22210sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
22211sizesize='$sizesize'
22212sizetype='$sizetype'
5f80c64f
JH
22213sleep='$sleep'
22214smail='$smail'
5f80c64f 22215so='$so'
b4eb6b3d
JH
22216sockethdr='$sockethdr'
22217socketlib='$socketlib'
22218socksizetype='$socksizetype'
5f80c64f
JH
22219sort='$sort'
22220spackage='$spackage'
22221spitshell='$spitshell'
10bc17b6
JH
22222srand48_r_proto='$srand48_r_proto'
22223srandom_r_proto='$srandom_r_proto'
5f80c64f 22224src='$src'
b4eb6b3d
JH
22225ssizetype='$ssizetype'
22226startperl='$startperl'
5f80c64f 22227startsh='$startsh'
b4eb6b3d
JH
22228static_ext='$static_ext'
22229stdchar='$stdchar'
22230stdio_base='$stdio_base'
22231stdio_bufsiz='$stdio_bufsiz'
22232stdio_cnt='$stdio_cnt'
22233stdio_filbuf='$stdio_filbuf'
22234stdio_ptr='$stdio_ptr'
22235stdio_stream_array='$stdio_stream_array'
10bc17b6 22236strerror_r_proto='$strerror_r_proto'
b4eb6b3d 22237strings='$strings'
5f80c64f 22238submit='$submit'
b4eb6b3d
JH
22239subversion='$subversion'
22240sysman='$sysman'
5f80c64f
JH
22241tail='$tail'
22242tar='$tar'
5440bc8e 22243targetarch='$targetarch'
5f80c64f
JH
22244tbl='$tbl'
22245tee='$tee'
22246test='$test'
b4eb6b3d
JH
22247timeincl='$timeincl'
22248timetype='$timetype'
10bc17b6 22249tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 22250to='$to'
5f80c64f
JH
22251touch='$touch'
22252tr='$tr'
22253trnl='$trnl'
22254troff='$troff'
10bc17b6 22255ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
22256u16size='$u16size'
22257u16type='$u16type'
22258u32size='$u32size'
22259u32type='$u32type'
22260u64size='$u64size'
22261u64type='$u64type'
22262u8size='$u8size'
22263u8type='$u8type'
22264uidformat='$uidformat'
22265uidsign='$uidsign'
22266uidsize='$uidsize'
22267uidtype='$uidtype'
5f80c64f
JH
22268uname='$uname'
22269uniq='$uniq'
b4eb6b3d
JH
22270uquadtype='$uquadtype'
22271use5005threads='$use5005threads'
22272use64bitall='$use64bitall'
22273use64bitint='$use64bitint'
5440bc8e 22274usecrosscompile='$usecrosscompile'
5f80c64f 22275usedl='$usedl'
15b61c98 22276usefaststdio='$usefaststdio'
b4eb6b3d
JH
22277useithreads='$useithreads'
22278uselargefiles='$uselargefiles'
22279uselongdouble='$uselongdouble'
19a100ff 22280usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
22281usemorebits='$usemorebits'
22282usemultiplicity='$usemultiplicity'
22283usemymalloc='$usemymalloc'
5f80c64f 22284usenm='$usenm'
b4eb6b3d
JH
22285useopcode='$useopcode'
22286useperlio='$useperlio'
22287useposix='$useposix'
9514c62b 22288usereentrant='$usereentrant'
d51aaa9d 22289userelocatableinc='$userelocatableinc'
b4eb6b3d
JH
22290usesfio='$usesfio'
22291useshrplib='$useshrplib'
5f106f9c 22292usesitecustomize='$usesitecustomize'
29209bc5 22293usesocks='$usesocks'
b4eb6b3d
JH
22294usethreads='$usethreads'
22295usevendorprefix='$usevendorprefix'
22296usevfork='$usevfork'
5f80c64f
JH
22297usrinc='$usrinc'
22298uuname='$uuname'
b4eb6b3d
JH
22299uvXUformat='$uvXUformat'
22300uvoformat='$uvoformat'
22301uvsize='$uvsize'
22302uvtype='$uvtype'
22303uvuformat='$uvuformat'
22304uvxformat='$uvxformat'
22305vendorarch='$vendorarch'
22306vendorarchexp='$vendorarchexp'
22307vendorbin='$vendorbin'
22308vendorbinexp='$vendorbinexp'
8d2cbf27
JH
22309vendorhtml1dir='$vendorhtml1dir'
22310vendorhtml1direxp='$vendorhtml1direxp'
22311vendorhtml3dir='$vendorhtml3dir'
22312vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
22313vendorlib='$vendorlib'
22314vendorlib_stem='$vendorlib_stem'
22315vendorlibexp='$vendorlibexp'
91e123a8
JH
22316vendorman1dir='$vendorman1dir'
22317vendorman1direxp='$vendorman1direxp'
22318vendorman3dir='$vendorman3dir'
22319vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
22320vendorprefix='$vendorprefix'
22321vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
22322vendorscript='$vendorscript'
22323vendorscriptexp='$vendorscriptexp'
b4eb6b3d 22324version='$version'
861eb78d 22325version_patchlevel_string='$version_patchlevel_string'
d56c5707 22326versiononly='$versiononly'
5f80c64f 22327vi='$vi'
b4eb6b3d 22328voidflags='$voidflags'
5f80c64f 22329xlibpth='$xlibpth'
3659ebf1
JH
22330yacc='$yacc'
22331yaccflags='$yaccflags'
5f80c64f
JH
22332zcat='$zcat'
22333zip='$zip'
22334EOT
22335
22336: Add in command line options if available
22337$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22338
22339: add special variables
22340$test -f $src/patchlevel.h && \
d00b958f 22341awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 22342echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 22343echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
22344
22345: propagate old symbols
22346if $test -f UU/config.sh; then
381aa1ff 22347 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 22348 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 22349 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
22350 set X `cat UU/oldsyms`
22351 shift
22352 case $# in
22353 0) ;;
22354 *)
22355 cat <<EOM
22356Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22357EOM
22358 echo "# Variables propagated from previous config.sh file." >>config.sh
22359 for sym in `cat UU/oldsyms`; do
22360 echo " Propagating $hint variable "'$'"$sym..."
22361 eval 'tmp="$'"${sym}"'"'
22362 echo "$tmp" | \
22363 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22364 done
22365 ;;
22366 esac
22367fi
22368
22369: Finish up by extracting the .SH files
22370case "$alldone" in
22371exit)
22372 $rm -rf UU
24ccb310 22373 echo "Extraction done."
5f80c64f
JH
22374 exit 0
22375 ;;
22376cont)
22377 ;;
22378'')
22379 dflt=''
22380 nostick=true
22381 $cat <<EOM
22382
22383If you'd like to make any changes to the config.sh file before I begin
22384to configure things, do it as a shell escape now (e.g. !vi config.sh).
22385
22386EOM
22387 rp="Press return or use a shell escape to edit config.sh:"
22388 . UU/myread
22389 nostick=''
22390 case "$ans" in
22391 '') ;;
22392 *) : in case they cannot read
22393 sh 1>&4 -c "$ans";;
22394 esac
22395 ;;
22396esac
22397
22398: if this fails, just run all the .SH files by hand
22399. ./config.sh
22400
22401echo " "
22402exec 1>&4
a43e8593 22403pwd=`pwd`
5f80c64f 22404. ./UU/extract
6904989c 22405cd "$pwd"
5f80c64f
JH
22406
22407if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22408 dflt=y
22409 case "$silent" in
22410 true) ;;
22411 *)
22412 $cat <<EOM
22413
22414Now you need to generate make dependencies by running "$make depend".
22415You might prefer to run it in background: "$make depend > makedepend.out &"
22416It can take a while, so you might not want to run it right now.
22417
22418EOM
22419 ;;
22420 esac
22421 rp="Run $make depend now?"
22422 . UU/myread
22423 case "$ans" in
22424 y*)
3d5d58b1 22425 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
22426 ;;
22427 *)
22428 echo "You must run '$make depend' then '$make'."
22429 ;;
22430 esac
22431elif test -f [Mm]akefile; then
22432 echo " "
22433 echo "Now you must run a $make."
22434else
24ccb310 22435 echo "Configure done."
5f80c64f
JH
22436fi
22437
22438if $test -f Policy.sh; then
22439 $cat <<EOM
22440
22441If you compile $package on a different machine or from a different object
22442directory, copy the Policy.sh file from this object directory to the
22443new one before you run Configure -- this will help you with most of
22444the policy defaults.
22445
22446EOM
22447fi
22448if $test -f config.msg; then
22449 echo "Hmm. I also noted the following information while running:"
22450 echo " "
22451 $cat config.msg >&4
22452 $rm -f config.msg
22453fi
22454$rm -f kit*isdone ark*isdone
22455$rm -rf UU
22456
22457: End of Configure
22458