This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
for pod/perlfaq2.pod against latest snapshot for Alpaca
[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
AD
19#
20
dfe9444c 21# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
2304df62 22#
15431986 23# Generated on Tue Jul 1 10:09:27 EEST 2003 [metaconfig 3.0 PL70]
7f2de2d2 24# (with additional metaconfig patches by perlbug@perl.org)
2304df62 25
283fdd21 26cat >c1$$ <<EOF
2304df62
AD
27ARGGGHHHH!!!!!
28
29SCO csh still thinks true is false. Write to SCO today and tell them that next
30year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
33we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35[End of diatribe. We now return you to your regularly scheduled programming...]
36EOF
283fdd21 37cat >c2$$ <<EOF
2304df62
AD
38
39OOPS! You naughty creature! You didn't run Configure with sh!
40I will attempt to remedy the situation by running sh for you...
41EOF
42
283fdd21 43true || cat c1$$ c2$$
2304df62
AD
44true || exec sh $0 $argv:q
45
283fdd21 46(exit $?0) || cat c2$$
2304df62 47(exit $?0) || exec sh $0 $argv:q
283fdd21 48rm -f c1$$ c2$$
2304df62 49
f6538904 50if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
cbee2ce6
JH
51 cat >&4 <<EOF
52***
53*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
54*** Configure that well. (Plan 9 is close to UNIX but not close enough.)
55*** Please read the README.plan9 for further instructions.
56*** Cannot continue, aborting.
57***
58EOF
59 exit 1
60fi
61
a0d0e21e
LW
62: compute my invocation name
63me=$0
64case "$0" in
65*/*)
66 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
67 test "$me" || me=$0
68 ;;
69esac
70
dfe9444c 71: Proper separator for the PATH environment variable
8e07c86e
AD
72p_=:
73: On OS/2 this directory should exist if this is not floppy only system :-]
5c728af0 74if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
dfe9444c
AD
75 if test -n "$OS2_SHELL"; then
76 p_=\;
77 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
78 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
5c728af0 79 is_os2=yes
c4f23d77 80 elif test -n "$DJGPP"; then
495e2cbe
MB
81 case "X${MACHTYPE:-nonesuchmach}" in
82 *cygwin) ;;
83 *) p_=\; ;;
84 esac
dfe9444c 85 fi
39e571d4 86fi
a0d0e21e
LW
87
88: Proper PATH setting
89paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 90paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 91paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 92paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e
AD
93paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
94paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
95paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
96paths="$paths /sbin /usr/sbin /usr/libexec"
3c728e00 97paths="$paths /system/gnu_library/bin"
a0d0e21e
LW
98
99for p in $paths
100do
8e07c86e
AD
101 case "$p_$PATH$p_" in
102 *$p_$p$p_*) ;;
103 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
104 esac
105done
106
8e07c86e 107PATH=.$p_$PATH
2304df62
AD
108export PATH
109
dfe9444c
AD
110: shall we be using ksh?
111inksh=''
112needksh=''
113avoidksh=''
114newsh=/bin/ksh
115changesh=''
ff0cee69 116if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
117 inksh=true
118fi
119if test -f /hp-ux -a -f /bin/ksh; then
120 needksh='to avoid sh bug in "here document" expansion'
121fi
122if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
123 if test X`/usr/bin/uname -v` = X4; then
124 avoidksh="to avoid AIX 4's /bin/sh"
125 newsh=/usr/bin/bsh
2304df62 126 fi
dfe9444c 127fi
cf04f91f
JH
128if test -f /osf_boot -a -f /usr/sbin/setld; then
129 if test X`/usr/bin/uname -s` = XOSF1; then
130 avoidksh="to avoid Digital UNIX' ksh"
131 newsh=/bin/sh
132 unset BIN_SH # if this is 'xpg4' sh will start up ksh
133 fi
134fi
dfe9444c
AD
135case "$inksh/$needksh" in
136/[a-z]*)
c4f23d77 137 ENV=''
dfe9444c
AD
138 changesh=true
139 reason="$needksh"
140 ;;
141esac
142case "$inksh/$avoidksh" in
143true/[a-z]*)
144 changesh=true
145 reason="$avoidksh"
146 ;;
147esac
148case "$inksh/$needksh-$avoidksh-" in
149true/--)
a0d0e21e
LW
150 cat <<EOM
151(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 152mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 153EOM
dfe9444c
AD
154 ;;
155esac
156case "$changesh" in
157true)
2e2a97a6 158 export newsh
dfe9444c
AD
159 echo "(Feeding myself to $newsh $reason.)"
160 case "$0" in
161 Configure|*/Configure) exec $newsh $0 "$@";;
162 *) exec $newsh Configure "$@";;
163 esac
164 ;;
165esac
2304df62 166
bfb7748a
AD
167: if needed set CDPATH to a harmless value that is not chatty
168: avoid bash 2.02 problems with empty CDPATH.
169case "$CDPATH" in
170'') ;;
171*) case "$SHELL" in
172 *bash*) CDPATH='.' ;;
173 *) CDPATH='' ;;
174 esac
175 ;;
176esac
2304df62
AD
177: Configure runs within the UU subdirectory
178test -d UU || mkdir UU
8e07c86e 179cd UU && rm -f ./*
2304df62 180
6b356c8e
JH
181ccname=''
182ccversion=''
b4eb6b3d
JH
183ccsymbols=''
184cppccsymbols=''
185cppsymbols=''
5440bc8e
JH
186from=''
187run=''
188targetarch=''
189to=''
190usecrosscompile=''
6b34ded5 191mistrustnm=''
9c839522 192perllibs=''
b4eb6b3d
JH
193dynamic_ext=''
194extensions=''
195known_extensions=''
196nonxs_ext=''
197static_ext=''
198useopcode=''
199useposix=''
6fcddf3b 200extras=''
ecfc5424 201d_bsd=''
40a7a20a 202d_eunice=''
2304df62
AD
203d_xenix=''
204eunicefix=''
205Mcc=''
dfe9444c 206ar=''
2304df62
AD
207awk=''
208bash=''
209bison=''
210byacc=''
211cat=''
212chgrp=''
213chmod=''
214chown=''
ecfc5424 215comm=''
2304df62
AD
216compress=''
217cp=''
218cpio=''
219cpp=''
220csh=''
221date=''
222echo=''
223egrep=''
224emacs=''
225expr=''
226find=''
227flex=''
3c728e00 228gmake=''
2304df62 229grep=''
8ff267be 230gzip=''
2304df62
AD
231inews=''
232ksh=''
233less=''
234line=''
235lint=''
236ln=''
237lp=''
238lpr=''
239ls=''
240mail=''
241mailx=''
dfe9444c 242make=''
2304df62
AD
243mkdir=''
244more=''
245mv=''
693762b4 246nm=''
2304df62
AD
247nroff=''
248perl=''
249pg=''
250pmake=''
251pr=''
252rm=''
253rmail=''
254sed=''
255sendmail=''
2304df62
AD
256shar=''
257sleep=''
258smail=''
259sort=''
260submit=''
261tail=''
262tar=''
263tbl=''
693762b4 264tee=''
2304df62
AD
265test=''
266touch=''
267tr=''
268troff=''
269uname=''
270uniq=''
271uuname=''
272vi=''
273zcat=''
8ff267be 274zip=''
b4eb6b3d
JH
275full_ar=''
276full_sed=''
a0d0e21e 277libswanted=''
2304df62
AD
278hint=''
279myuname=''
85e6fe83
LW
280osname=''
281osvers=''
2304df62
AD
282Author=''
283Date=''
284Header=''
285Id=''
286Locker=''
287Log=''
288RCSfile=''
289Revision=''
290Source=''
291State=''
dfe9444c
AD
292_a=''
293_exe=''
294_o=''
4633a7c4
LW
295archobjs=''
296exe_ext=''
297firstmakefile=''
298lib_ext=''
299obj_ext=''
300path_sep=''
b4eb6b3d 301afs=''
a6d26a0d 302afsroot=''
b4eb6b3d
JH
303alignbytes=''
304ansi2knr=''
305archlib=''
306archlibexp=''
307d_archlib=''
308installarchlib=''
309archname=''
310myarchname=''
311d_atolf=''
312d_atoll=''
313baserev=''
314bin=''
315binexp=''
316installbin=''
b4eb6b3d 317byteorder=''
2304df62 318cc=''
2304df62
AD
319ccflags=''
320cppflags=''
321ldflags=''
322lkflags=''
8e07c86e 323locincpth=''
2304df62 324optimize=''
b4eb6b3d 325cf_email=''
2304df62
AD
326cf_by=''
327cf_time=''
b4eb6b3d 328charsize=''
2304df62 329contains=''
b4eb6b3d 330cpp_stuff=''
2304df62
AD
331cpplast=''
332cppminus=''
333cpprun=''
334cppstdin=''
74cac757 335d__fwalk=''
b4eb6b3d
JH
336d_access=''
337d_accessx=''
55954f19 338d_aintl=''
b4eb6b3d 339d_alarm=''
10bc17b6
JH
340asctime_r_proto=''
341d_asctime_r=''
b4eb6b3d
JH
342d_attribut=''
343d_bcmp=''
344d_bcopy=''
345d_bzero=''
346d_casti32=''
347castflags=''
348d_castneg=''
349d_chown=''
350d_chroot=''
351d_chsize=''
758a5d79 352d_class=''
b4eb6b3d
JH
353d_closedir=''
354d_void_closedir=''
4e0554ec 355d_cmsghdr_s=''
b4eb6b3d 356d_const=''
36adc09b 357d_copysignl=''
b4eb6b3d
JH
358cryptlib=''
359d_crypt=''
10bc17b6
JH
360crypt_r_proto=''
361d_crypt_r=''
b4eb6b3d
JH
362d_csh=''
363full_csh=''
10bc17b6
JH
364ctermid_r_proto=''
365d_ctermid_r=''
366ctime_r_proto=''
367d_ctime_r=''
b4eb6b3d
JH
368d_cuserid=''
369d_dbl_dig=''
2ef53570 370d_dbminitproto=''
b4eb6b3d 371d_difftime=''
ae0e3d3b 372d_dirfd=''
b4eb6b3d 373d_dlerror=''
a0d0e21e 374d_dlopen=''
b4eb6b3d
JH
375d_dlsymun=''
376d_dosuid=''
377d_suidsafe=''
10bc17b6
JH
378d_drand48_r=''
379drand48_r_proto=''
b4eb6b3d
JH
380d_drand48proto=''
381d_dup2=''
382d_eaccess=''
383d_endgrent=''
10bc17b6
JH
384d_endgrent_r=''
385endgrent_r_proto=''
b4eb6b3d 386d_endhent=''
10bc17b6
JH
387d_endhostent_r=''
388endhostent_r_proto=''
b4eb6b3d 389d_endnent=''
10bc17b6
JH
390d_endnetent_r=''
391endnetent_r_proto=''
b4eb6b3d 392d_endpent=''
10bc17b6
JH
393d_endprotoent_r=''
394endprotoent_r_proto=''
b4eb6b3d 395d_endpwent=''
10bc17b6
JH
396d_endpwent_r=''
397endpwent_r_proto=''
b4eb6b3d 398d_endsent=''
10bc17b6
JH
399d_endservent_r=''
400endservent_r_proto=''
15b61c98 401d_faststdio=''
b363b713 402d_fchdir=''
b4eb6b3d
JH
403d_fchmod=''
404d_fchown=''
405d_fcntl=''
9d9004a9 406d_fcntl_can_lock=''
b4eb6b3d
JH
407d_fd_macros=''
408d_fd_set=''
409d_fds_bits=''
410d_fgetpos=''
758a5d79
JH
411d_finite=''
412d_finitel=''
b4eb6b3d
JH
413d_flexfnam=''
414d_flock=''
2ef53570 415d_flockproto=''
b4eb6b3d 416d_fork=''
758a5d79
JH
417d_fp_class=''
418d_fpclass=''
419d_fpclassify=''
420d_fpclassl=''
b4eb6b3d
JH
421d_fpos64_t=''
422d_frexpl=''
423d_fs_data_s=''
424d_fseeko=''
425d_fsetpos=''
426d_fstatfs=''
411ab01c 427d_fsync=''
b4eb6b3d
JH
428d_ftello=''
429d_ftime=''
430d_gettimeod=''
431d_Gconvert=''
432d_getcwd=''
433d_getespwnam=''
434d_getfsstat=''
435d_getgrent=''
10bc17b6
JH
436d_getgrent_r=''
437getgrent_r_proto=''
438d_getgrgid_r=''
439getgrgid_r_proto=''
440d_getgrnam_r=''
441getgrnam_r_proto=''
b4eb6b3d
JH
442d_getgrps=''
443d_gethbyaddr=''
444d_gethbyname=''
445d_gethent=''
446aphostname=''
447d_gethname=''
448d_phostname=''
449d_uname=''
10bc17b6
JH
450d_gethostbyaddr_r=''
451gethostbyaddr_r_proto=''
452d_gethostbyname_r=''
453gethostbyname_r_proto=''
454d_gethostent_r=''
455gethostent_r_proto=''
b4eb6b3d 456d_gethostprotos=''
4e0554ec 457d_getitimer=''
b4eb6b3d 458d_getlogin=''
10bc17b6
JH
459d_getlogin_r=''
460getlogin_r_proto=''
b4eb6b3d
JH
461d_getmnt=''
462d_getmntent=''
463d_getnbyaddr=''
464d_getnbyname=''
465d_getnent=''
10bc17b6
JH
466d_getnetbyaddr_r=''
467getnetbyaddr_r_proto=''
468d_getnetbyname_r=''
469getnetbyname_r_proto=''
470d_getnetent_r=''
471getnetent_r_proto=''
b4eb6b3d 472d_getnetprotos=''
0c0643d0 473d_getpagsz=''
b4eb6b3d
JH
474d_getpent=''
475d_getpgid=''
476d_getpgrp2=''
477d_bsdgetpgrp=''
478d_getpgrp=''
479d_getppid=''
480d_getprior=''
481d_getpbyname=''
482d_getpbynumber=''
10bc17b6
JH
483d_getprotobyname_r=''
484getprotobyname_r_proto=''
485d_getprotobynumber_r=''
486getprotobynumber_r_proto=''
487d_getprotoent_r=''
488getprotoent_r_proto=''
b4eb6b3d
JH
489d_getprotoprotos=''
490d_getprpwnam=''
491d_getpwent=''
10bc17b6
JH
492d_getpwent_r=''
493getpwent_r_proto=''
494d_getpwnam_r=''
495getpwnam_r_proto=''
496d_getpwuid_r=''
497getpwuid_r_proto=''
b4eb6b3d 498d_getsent=''
10bc17b6
JH
499d_getservbyname_r=''
500getservbyname_r_proto=''
501d_getservbyport_r=''
502getservbyport_r_proto=''
503d_getservent_r=''
504getservent_r_proto=''
b4eb6b3d
JH
505d_getservprotos=''
506d_getspnam=''
10bc17b6
JH
507d_getspnam_r=''
508getspnam_r_proto=''
b4eb6b3d
JH
509d_getsbyname=''
510d_getsbyport=''
10bc17b6
JH
511d_gmtime_r=''
512gmtime_r_proto=''
a4f3eea9 513d_gnulibc=''
5f6e0ee4 514gnulibc_version=''
b4eb6b3d
JH
515d_hasmntopt=''
516d_htonl=''
55954f19 517d_ilogbl=''
b4eb6b3d
JH
518d_inetaton=''
519d_int64_t=''
520d_isascii=''
758a5d79
JH
521d_isfinite=''
522d_isinf=''
b4eb6b3d
JH
523d_isnan=''
524d_isnanl=''
525d_killpg=''
526d_lchown=''
527d_ldbl_dig=''
528d_link=''
10bc17b6
JH
529d_localtime_r=''
530localtime_r_proto=''
b4eb6b3d
JH
531d_locconv=''
532d_lockf=''
533d_longdbl=''
534longdblsize=''
535d_longlong=''
536longlongsize=''
537d_lseekproto=''
538d_lstat=''
539d_madvise=''
540d_mblen=''
541d_mbstowcs=''
542d_mbtowc=''
543d_memchr=''
544d_memcmp=''
545d_memcpy=''
546d_memmove=''
547d_memset=''
548d_mkdir=''
549d_mkdtemp=''
550d_mkfifo=''
551d_mkstemp=''
552d_mkstemps=''
553d_mktime=''
554d_mmap=''
555mmaptype=''
556d_modfl=''
e67aeab1 557d_modfl_pow32_bug=''
bc9a1b2c 558d_modflproto=''
b4eb6b3d
JH
559d_mprotect=''
560d_msg=''
561d_msgctl=''
562d_msgget=''
4e0554ec 563d_msghdr_s=''
b4eb6b3d
JH
564d_msgrcv=''
565d_msgsnd=''
566d_msync=''
567d_munmap=''
568d_nice=''
2765b840 569d_nl_langinfo=''
b4eb6b3d
JH
570d_off64_t=''
571d_open3=''
572d_fpathconf=''
573d_pathconf=''
574d_pause=''
575d_pipe=''
576d_poll=''
2304df62 577d_portable=''
a33c94aa 578d_procselfexe=''
f24dbf84 579procselfexe=''
b4eb6b3d
JH
580d_old_pthread_create_joinable=''
581old_pthread_create_joinable=''
d6483fcc 582d_pthread_atfork=''
58d975c3 583d_pthread_attr_setscope=''
b4eb6b3d
JH
584d_pthread_yield=''
585d_sched_yield=''
586sched_yield=''
587d_qgcvt=''
10bc17b6
JH
588d_random_r=''
589random_r_proto=''
590d_readdir64_r=''
591readdir64_r_proto=''
b4eb6b3d
JH
592d_readdir=''
593d_rewinddir=''
594d_seekdir=''
595d_telldir=''
10bc17b6
JH
596d_readdir_r=''
597readdir_r_proto=''
b4eb6b3d 598d_readlink=''
4e0554ec
JH
599d_readv=''
600d_recvmsg=''
b4eb6b3d
JH
601d_rename=''
602d_rmdir=''
603d_safebcpy=''
604d_safemcpy=''
605d_sanemcmp=''
ef9f17be 606d_sbrkproto=''
55954f19 607d_scalbnl=''
b4eb6b3d
JH
608d_select=''
609d_sem=''
610d_semctl=''
611d_semget=''
612d_semop=''
4e0554ec 613d_sendmsg=''
b4eb6b3d
JH
614d_setegid=''
615d_seteuid=''
616d_setgrent=''
10bc17b6
JH
617d_setgrent_r=''
618setgrent_r_proto=''
b4eb6b3d
JH
619d_setgrps=''
620d_sethent=''
10bc17b6
JH
621d_sethostent_r=''
622sethostent_r_proto=''
4e0554ec 623d_setitimer=''
b4eb6b3d
JH
624d_setlinebuf=''
625d_setlocale=''
10bc17b6
JH
626d_setlocale_r=''
627setlocale_r_proto=''
b4eb6b3d 628d_setnent=''
10bc17b6
JH
629d_setnetent_r=''
630setnetent_r_proto=''
b4eb6b3d
JH
631d_setpent=''
632d_setpgid=''
633d_setpgrp2=''
634d_bsdsetpgrp=''
635d_setpgrp=''
636d_setprior=''
637d_setproctitle=''
10bc17b6
JH
638d_setprotoent_r=''
639setprotoent_r_proto=''
b4eb6b3d 640d_setpwent=''
10bc17b6
JH
641d_setpwent_r=''
642setpwent_r_proto=''
b4eb6b3d
JH
643d_setregid=''
644d_setresgid=''
645d_setresuid=''
646d_setreuid=''
647d_setrgid=''
648d_setruid=''
649d_setsent=''
10bc17b6
JH
650d_setservent_r=''
651setservent_r_proto=''
b4eb6b3d
JH
652d_setsid=''
653d_setvbuf=''
654d_sfio=''
655usesfio=''
656d_shm=''
657d_shmat=''
658d_shmatprototype=''
659shmattype=''
660d_shmctl=''
661d_shmdt=''
662d_shmget=''
663d_sigaction=''
983dbef6 664d_sigprocmask=''
b4eb6b3d 665d_sigsetjmp=''
49a78c82 666d_sockatmark=''
2ef53570 667d_sockatmarkproto=''
b4eb6b3d
JH
668d_msg_ctrunc=''
669d_msg_dontroute=''
670d_msg_oob=''
671d_msg_peek=''
672d_msg_proxy=''
673d_oldsock=''
674d_scm_rights=''
675d_socket=''
676d_sockpair=''
677sockethdr=''
678socketlib=''
679d_socklen_t=''
680d_socks5_init=''
681d_sqrtl=''
10bc17b6
JH
682d_srand48_r=''
683srand48_r_proto=''
684d_srandom_r=''
685srandom_r_proto=''
eef837ea 686d_sresgproto=''
640374d0 687d_sresuproto=''
b4eb6b3d
JH
688d_statblks=''
689d_statfs_f_flags=''
690d_statfs_s=''
691d_fstatvfs=''
692d_statvfs=''
693d_stdio_cnt_lval=''
694d_stdio_ptr_lval=''
a7ffa9b9
NC
695d_stdio_ptr_lval_nochange_cnt=''
696d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
697d_stdiobase=''
698d_stdstdio=''
699stdio_base=''
700stdio_bufsiz=''
701stdio_cnt=''
702stdio_filbuf=''
703stdio_ptr=''
704d_index=''
705d_strchr=''
706d_strcoll=''
707d_strctcpy=''
708d_strerrm=''
709d_strerror=''
710d_sysernlst=''
711d_syserrlst=''
10bc17b6
JH
712d_strerror_r=''
713strerror_r_proto=''
b3c85772 714d_strftime=''
b4eb6b3d
JH
715d_strtod=''
716d_strtol=''
717d_strtold=''
718d_strtoll=''
28e5dec8 719d_strtoq=''
b4eb6b3d
JH
720d_strtoul=''
721d_strtoull=''
722d_strtouq=''
723d_strxfrm=''
724d_symlink=''
725d_syscall=''
2ef53570 726d_syscallproto=''
b4eb6b3d
JH
727d_sysconf=''
728d_system=''
729d_tcgetpgrp=''
730d_tcsetpgrp=''
731d_telldirproto=''
732d_time=''
733timetype=''
734clocktype=''
735d_times=''
10bc17b6
JH
736d_tmpnam_r=''
737tmpnam_r_proto=''
b4eb6b3d 738d_truncate=''
10bc17b6
JH
739d_ttyname_r=''
740ttyname_r_proto=''
b4eb6b3d 741d_tzname=''
4e0554ec
JH
742d_u32align=''
743d_ualarm=''
b4eb6b3d
JH
744d_umask=''
745d_semctl_semid_ds=''
746d_semctl_semun=''
747d_union_semun=''
758a5d79 748d_unordered=''
4e0554ec 749d_usleep=''
2ef53570 750d_usleepproto=''
b4eb6b3d
JH
751d_ustat=''
752d_vfork=''
753usevfork=''
754d_voidsig=''
755signal_t=''
756d_volatile=''
757d_charvspr=''
758d_vprintf=''
759d_wait4=''
760d_waitpid=''
761d_wcstombs=''
762d_wctomb=''
4e0554ec 763d_writev=''
b4eb6b3d 764dlext=''
85e6fe83
LW
765cccdlflags=''
766ccdlflags=''
2304df62 767dlsrc=''
232e078e 768ld=''
85e6fe83 769lddlflags=''
2304df62 770usedl=''
b4eb6b3d
JH
771doublesize=''
772ebcdic=''
773fflushNULL=''
774fflushall=''
775fpossize=''
776fpostype=''
2d736872 777gccansipedantic=''
5b463ca7 778gccosandvers=''
8a27cf78 779gccversion=''
b4eb6b3d
JH
780gidformat=''
781gidsign=''
782gidsize=''
783gidtype=''
784groupstype=''
785h_fcntl=''
786h_sysfile=''
6e1038e0
MB
787html1dir=''
788html1direxp=''
789installhtml1dir=''
790html3dir=''
791html3direxp=''
792installhtml3dir=''
b4eb6b3d 793i_arpainet=''
10bc17b6 794i_crypt=''
b4eb6b3d
JH
795db_hashtype=''
796db_prefixtype=''
640374d0
JH
797db_version_major=''
798db_version_minor=''
799db_version_patch=''
b4eb6b3d
JH
800i_db=''
801i_dbm=''
802i_rpcsvcdbm=''
803d_dirnamlen=''
804direntrytype=''
805i_dirent=''
a0d0e21e 806i_dld=''
b4eb6b3d
JH
807i_dlfcn=''
808i_fcntl=''
809i_float=''
758a5d79
JH
810i_fp=''
811i_fp_class=''
b4eb6b3d
JH
812i_gdbm=''
813d_grpasswd=''
814i_grp=''
b4eb6b3d
JH
815i_ieeefp=''
816i_inttypes=''
2765b840 817i_langinfo=''
b4eb6b3d
JH
818i_libutil=''
819i_limits=''
820i_locale=''
821i_machcthr=''
822i_malloc=''
823i_math=''
824i_memory=''
825i_mntent=''
826i_ndbm=''
827i_netdb=''
828i_neterrno=''
829i_netinettcp=''
830i_niin=''
831i_sysin=''
832i_poll=''
833i_prot=''
834i_pthread=''
835d_pwage=''
836d_pwchange=''
837d_pwclass=''
838d_pwcomment=''
839d_pwexpire=''
840d_pwgecos=''
841d_pwpasswd=''
842d_pwquota=''
843i_pwd=''
844i_sfio=''
845i_shadow=''
846i_socks=''
847i_stddef=''
848i_stdlib=''
849i_string=''
850strings=''
851i_sunmath=''
852i_sysaccess=''
853i_sysdir=''
854i_sysfile=''
855d_voidtty=''
856i_bsdioctl=''
857i_sysfilio=''
858i_sysioctl=''
859i_syssockio=''
860i_syslog=''
861i_sysmman=''
862i_sysmode=''
863i_sysmount=''
864i_sysndir=''
865i_sysparam=''
866i_sysresrc=''
867i_syssecrt=''
868i_sysselct=''
869i_sysstat=''
870i_sysstatfs=''
871i_sysstatvfs=''
872i_systimes=''
873i_systypes=''
874i_sysuio=''
875i_sysun=''
876i_sysutsname=''
877i_sysvfs=''
878i_syswait=''
879i_sgtty=''
880i_termio=''
881i_termios=''
14b90194
JH
882d_tm_tm_gmtoff=''
883d_tm_tm_zone=''
b4eb6b3d
JH
884i_systime=''
885i_systimek=''
886i_time=''
887timeincl=''
888i_unistd=''
889i_ustat=''
890i_utime=''
891i_values=''
892i_stdarg=''
893i_varargs=''
894i_varhdr=''
895i_vfork=''
896inc_version_list=''
897inc_version_list_init=''
898installprefix=''
899installprefixexp=''
900installstyle=''
901installusrbinperl=''
902intsize=''
903longsize=''
904shortsize=''
4b661809 905issymlink=''
2304df62 906libc=''
b4eb6b3d
JH
907ldlibpthname=''
908libperl=''
909shrpenv=''
910useshrplib=''
a0d0e21e 911glibpth=''
2304df62 912libpth=''
8e07c86e 913loclibpth=''
2304df62
AD
914plibpth=''
915xlibpth=''
1cfa4ec7 916ignore_versioned_solibs=''
2304df62 917libs=''
43999f95
JH
918libsdirs=''
919libsfiles=''
920libsfound=''
13b3f787 921libspath=''
85e6fe83 922lns=''
b4eb6b3d
JH
923d_PRIEUldbl=''
924d_PRIFUldbl=''
925d_PRIGUldbl=''
926d_PRIeldbl=''
927d_PRIfldbl=''
928d_PRIgldbl=''
929d_SCNfldbl=''
930sPRIEUldbl=''
931sPRIFUldbl=''
932sPRIGUldbl=''
933sPRIeldbl=''
934sPRIfldbl=''
935sPRIgldbl=''
936sSCNfldbl=''
937lseeksize=''
938lseektype=''
8ff267be 939make_set_make=''
b4eb6b3d
JH
940d_mymalloc=''
941freetype=''
942mallocobj=''
943mallocsrc=''
944malloctype=''
945usemymalloc=''
946installman1dir=''
947man1dir=''
948man1direxp=''
949man1ext=''
950installman3dir=''
951man3dir=''
952man3direxp=''
953man3ext=''
954modetype=''
955multiarch=''
956mydomain=''
957myhostname=''
958phostname=''
2304df62
AD
959c=''
960n=''
b4eb6b3d
JH
961d_eofnblk=''
962eagain=''
963o_nonblock=''
964rd_nodata=''
2cc61e15 965need_va_copy=''
b4eb6b3d
JH
966netdb_hlen_type=''
967netdb_host_type=''
968netdb_name_type=''
969netdb_net_type=''
970groupcat=''
971hostcat=''
972passcat=''
973orderlib=''
974ranlib=''
975d_perl_otherlibdirs=''
976otherlibdirs=''
2304df62
AD
977package=''
978spackage=''
b4eb6b3d
JH
979pager=''
980api_revision=''
981api_subversion=''
982api_version=''
983api_versionstring=''
984patchlevel=''
151e6568 985perl_patchlevel=''
b4eb6b3d
JH
986revision=''
987subversion=''
988version=''
861eb78d 989version_patchlevel_string=''
b4eb6b3d
JH
990perl5=''
991perladmin=''
992perlpath=''
993d_nv_preserves_uv=''
b4eb6b3d
JH
994i16size=''
995i16type=''
996i32size=''
997i32type=''
998i64size=''
999i64type=''
1000i8size=''
1001i8type=''
1002ivsize=''
1003ivtype=''
53133ed1 1004nv_preserves_uv_bits=''
b4eb6b3d
JH
1005nvsize=''
1006nvtype=''
1007u16size=''
1008u16type=''
1009u32size=''
1010u32type=''
1011u64size=''
1012u64type=''
1013u8size=''
1014u8type=''
1015uvsize=''
1016uvtype=''
1017ivdformat=''
1018nvEUformat=''
1019nvFUformat=''
1020nvGUformat=''
1021nveformat=''
1022nvfformat=''
1023nvgformat=''
1024uvXUformat=''
1025uvoformat=''
1026uvuformat=''
1027uvxformat=''
1028pidtype=''
1029prefix=''
1030prefixexp=''
1031installprivlib=''
1032privlib=''
1033privlibexp=''
1034prototype=''
1035ptrsize=''
1036d_PRIXU64=''
1037d_PRId64=''
1038d_PRIi64=''
1039d_PRIo64=''
1040d_PRIu64=''
1041d_PRIx64=''
1042sPRIXU64=''
1043sPRId64=''
1044sPRIi64=''
1045sPRIo64=''
1046sPRIu64=''
1047sPRIx64=''
1048d_quad=''
1049quadkind=''
1050quadtype=''
1051uquadtype=''
1052drand01=''
1053randbits=''
1054randfunc=''
1055randseedtype=''
1056seedfunc=''
1057installscript=''
1058scriptdir=''
1059scriptdirexp=''
1060selectminbits=''
1061selecttype=''
8ff267be 1062sh=''
b4eb6b3d
JH
1063sig_count=''
1064sig_name=''
1065sig_name_init=''
1066sig_num=''
1067sig_num_init=''
76d3c696 1068sig_size=''
b4eb6b3d
JH
1069installsitearch=''
1070sitearch=''
1071sitearchexp=''
1072installsitebin=''
1073sitebin=''
1074sitebinexp=''
6e1038e0
MB
1075installsitehtml1=''
1076sitehtml1=''
1077sitehtml1exp=''
1078installsitehtml3=''
1079sitehtml3=''
1080sitehtml3exp=''
b4eb6b3d
JH
1081installsitelib=''
1082sitelib=''
1083sitelib_stem=''
1084sitelibexp=''
6e1038e0
MB
1085installsiteman1=''
1086siteman1=''
1087siteman1exp=''
1088installsiteman3=''
1089siteman3=''
1090siteman3exp=''
b4eb6b3d
JH
1091siteprefix=''
1092siteprefixexp=''
6e1038e0
MB
1093installsitescript=''
1094sitescript=''
1095sitescriptexp=''
b4eb6b3d
JH
1096sizesize=''
1097sizetype=''
a0d0e21e 1098so=''
b4eb6b3d 1099socksizetype=''
2304df62
AD
1100sharpbang=''
1101shsharp=''
1102spitshell=''
dfe9444c 1103src=''
b4eb6b3d
JH
1104ssizetype=''
1105startperl=''
2304df62 1106startsh=''
b4eb6b3d
JH
1107stdchar=''
1108d_stdio_stream_array=''
1109stdio_stream_array=''
1110sysman=''
5ff3f7a4 1111trnl=''
b4eb6b3d
JH
1112uidformat=''
1113uidsign=''
1114uidsize=''
1115uidtype=''
1116archname64=''
1117use64bitall=''
1118use64bitint=''
15b61c98 1119usefaststdio=''
b4eb6b3d
JH
1120ccflags_uselargefiles=''
1121ldflags_uselargefiles=''
1122libswanted_uselargefiles=''
1123uselargefiles=''
1124uselongdouble=''
1125usemorebits=''
1126usemultiplicity=''
2304df62 1127nm_opt=''
40a7a20a 1128nm_so_opt=''
2304df62
AD
1129runnm=''
1130usenm=''
b4eb6b3d 1131useperlio=''
29209bc5 1132usesocks=''
b4eb6b3d
JH
1133d_oldpthreads=''
1134use5005threads=''
1135useithreads=''
9514c62b 1136usereentrant=''
b4eb6b3d 1137usethreads=''
2304df62 1138incpath=''
2304df62
AD
1139mips_type=''
1140usrinc=''
b4eb6b3d
JH
1141d_vendorarch=''
1142installvendorarch=''
1143vendorarch=''
1144vendorarchexp=''
1145d_vendorbin=''
1146installvendorbin=''
1147vendorbin=''
1148vendorbinexp=''
6e1038e0
MB
1149installvendorhtml1=''
1150vendorhtml1=''
1151vendorhtml1exp=''
1152installvendorhtml3=''
1153vendorhtml3=''
1154vendorhtml3exp=''
b4eb6b3d
JH
1155d_vendorlib=''
1156installvendorlib=''
1157vendorlib=''
1158vendorlib_stem=''
1159vendorlibexp=''
6e1038e0
MB
1160installvendorman1=''
1161vendorman1=''
1162vendorman1exp=''
1163installvendorman3=''
1164vendorman3=''
1165vendorman3exp=''
b4eb6b3d
JH
1166usevendorprefix=''
1167vendorprefix=''
1168vendorprefixexp=''
6e1038e0
MB
1169d_vendorscript=''
1170installvendorscript=''
1171vendorscript=''
1172vendorscriptexp=''
d56c5707 1173versiononly=''
b4eb6b3d
JH
1174defvoidused=''
1175voidflags=''
1176pm_apiversion=''
1177xs_apiversion=''
3659ebf1
JH
1178yacc=''
1179yaccflags=''
2304df62
AD
1180CONFIG=''
1181
ecfc5424
AD
1182define='define'
1183undef='undef'
1184smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1185rmlist=''
1186
1187: We must find out about Eunice early
1188eunicefix=':'
1189if test -f /etc/unixtovms; then
1190 eunicefix=/etc/unixtovms
1191fi
1192if test -f /etc/unixtovms.exe; then
1193 eunicefix=/etc/unixtovms.exe
1194fi
1195
cfb04860 1196: Set executable suffix now -- needed before hints available
6153ba32
PG
1197if test -f "/libs/version.library"; then
1198: Amiga OS
1199 _exe=""
1200elif test -f "/system/gnu_library/bin/ar.pm"; then
1201: Stratus VOS
cfb04860 1202 _exe=".pm"
6153ba32
PG
1203elif test -n "$DJGPP"; then
1204: DOS DJGPP
cfb04860 1205 _exe=".exe"
5c728af0 1206elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1207: OS/2 or cygwin
ba863942
JH
1208 _exe=".exe"
1209fi
868439a2 1210
b4eb6b3d 1211i_whoami=''
ff935051
JH
1212: Possible local include directories to search.
1213: Set locincpth to "" in a hint file to defeat local include searches.
1214locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1215locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1216:
1217: no include file wanted by default
1218inclwanted=''
1219
76f47787
JH
1220siteman1=''
1221siteman3=''
1222sitescript=''
1223: Trailing extension. Override this in a hint file, if needed.
1224: Extra object files, if any, needed on this platform.
1225archobjs=''
b4eb6b3d 1226groupstype=''
64615a5e 1227libnames=''
732c9516
JH
1228: change the next line if compiling for Xenix/286 on Xenix/386
1229xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1230: Possible local library directories to search.
1231loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1232loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1233
1234: general looking path for locating libraries
5869b1f1 1235glibpth="/lib /usr/lib $xlibpth"
732c9516 1236glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1237test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1238test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1239
1240: Private path used by Configure to find libraries. Its value
1241: is prepended to libpth. This variable takes care of special
1242: machines, like the mips. Usually, it should be empty.
1243plibpth=''
1244
1cfa4ec7
GS
1245: default library list
1246libswanted=''
921b2963 1247: some systems want to use only the non-versioned libso:s
1cfa4ec7 1248ignore_versioned_solibs=''
76f47787
JH
1249: full support for void wanted by default
1250defvoidused=15
1251
1252ccname=''
1253ccversion=''
1254perllibs=''
1255: set useposix=false in your hint file to disable the POSIX extension.
1256useposix=true
1257: set useopcode=false in your hint file to disable the Opcode extension.
1258useopcode=true
b4eb6b3d
JH
1259archname64=''
1260ccflags_uselargefiles=''
1261ldflags_uselargefiles=''
1262libswanted_uselargefiles=''
1263: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1264: set usesocks on the Configure command line to enable socks.
76f47787 1265archname=''
b4eb6b3d 1266: set usethreads on the Configure command line to enable threads.
cd040c5e 1267usereentrant='undef'
ecfc5424 1268: List of libraries we want.
15431986 1269: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef
AB
1270libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1271libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1272: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1273: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1274glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1275glibpth="/usr/shlib $glibpth"
1276: Do not use vfork unless overridden by a hint file.
1277usevfork=false
1278
8ff267be 1279: Find the basic shell for Bourne shell scripts
1280case "$sh" in
1281'')
8ff267be 1282 case "$SYSTYPE" in
1283 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1284 *) xxx='/bin/sh';;
1285 esac
1286 if test -f "$xxx"; then
1287 sh="$xxx"
1288 else
1289 : Build up a list and do a single loop so we can 'break' out.
1290 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1291 for xxx in sh bash ksh pdksh ash; do
1292 for p in $pth; do
1293 try="$try ${p}/${xxx}"
1294 done
1295 done
1296 for xxx in $try; do
1297 if test -f "$xxx"; then
1298 sh="$xxx";
8ff267be 1299 break
a5a94ea5
JH
1300 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1301 sh="$xxx";
1302 break
8ff267be 1303 elif test -f "$xxx.exe"; then
1304 sh="$xxx";
8ff267be 1305 break
1306 fi
1307 done
1308 fi
1309 ;;
1310esac
1311
1312case "$sh" in
a33c94aa 1313'') cat >&2 <<EOM
8ff267be 1314$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1315
8ff267be 1316Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1317Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1318we'll try to straighten this all out.
8ff267be 1319EOM
1320 exit 1
1321 ;;
1322esac
1323
760ac839 1324: see if sh knows # comments
73614538 1325if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1326 shsharp=true
1327 spitshell=cat
760ac839 1328 xcat=/bin/cat
a931254c
JH
1329 test -f $xcat$_exe || xcat=/usr/bin/cat
1330 if test ! -f $xcat$_exe; then
4bdb8fb5 1331 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1332 if test -f $p/cat$_exe; then
1deb0a86 1333 xcat=$p/cat
3c728e00
JH
1334 break
1335 fi
1336 done
1deb0a86
JH
1337 if test ! -f $xcat$_exe; then
1338 echo "Can't find cat anywhere!"
3c728e00
JH
1339 exit 1
1340 fi
1341 fi
5440bc8e
JH
1342 echo "#!$xcat" >sharp
1343 $eunicefix sharp
1344 chmod +x sharp
1345 ./sharp > today
760ac839 1346 if test -s today; then
760ac839
LW
1347 sharpbang='#!'
1348 else
5440bc8e
JH
1349 echo "#! $xcat" > sharp
1350 $eunicefix sharp
1351 chmod +x sharp
1352 ./sharp > today
760ac839 1353 if test -s today; then
760ac839
LW
1354 sharpbang='#! '
1355 else
760ac839
LW
1356 sharpbang=': use '
1357 fi
1358 fi
1359else
dfe9444c 1360 echo " "
8ff267be 1361 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1362 shsharp=false
1363 cd ..
1364 echo "exec grep -v '^[ ]*#'" >spitshell
1365 chmod +x spitshell
1366 $eunicefix spitshell
1367 spitshell=`pwd`/spitshell
1368 cd UU
1369 echo "I presume that if # doesn't work, #! won't work either!"
1370 sharpbang=': use '
1371fi
5440bc8e 1372rm -f sharp today
760ac839
LW
1373
1374: figure out how to guarantee sh startup
8ff267be 1375case "$startsh" in
1376'') startsh=${sharpbang}${sh} ;;
1377*)
760ac839 1378esac
5440bc8e 1379cat >sharp <<EOSS
760ac839
LW
1380$startsh
1381set abc
1382test "$?abc" != 1
1383EOSS
1384
5440bc8e
JH
1385chmod +x sharp
1386$eunicefix sharp
1387if ./sharp; then
8ff267be 1388 : echo "Yup, it does."
760ac839 1389else
dfe9444c
AD
1390 echo "Hmm... '$startsh' does not guarantee sh startup..."
1391 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1392fi
5440bc8e 1393rm -f sharp
760ac839 1394
aebf16e7
AD
1395
1396: Save command line options in file UU/cmdline.opt for later use in
1397: generating config.sh.
1398cat > cmdline.opt <<EOSH
1399# Configure command line arguments.
1400config_arg0='$0'
1401config_args='$*'
1402config_argc=$#
1403EOSH
1404argn=1
ee45ea83
IZ
1405args_exp=''
1406args_sep=''
aebf16e7
AD
1407for arg in "$@"; do
1408 cat >>cmdline.opt <<EOSH
1409config_arg$argn='$arg'
1410EOSH
ee45ea83
IZ
1411 # Extreme backslashitis: replace each ' by '"'"'
1412 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1413$arg
1414EOC
1415 arg_exp=`cat cmdl.opt`
1416 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1417 argn=`expr $argn + 1`
ee45ea83 1418 args_sep=' '
aebf16e7 1419done
ee45ea83
IZ
1420# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1421# used by ./hints/os2.sh
1422rm -f cmdl.opt
aebf16e7 1423
2304df62
AD
1424: produce awk script to parse command line options
1425cat >options.awk <<'EOF'
1426BEGIN {
02e93a22 1427 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1428
1429 len = length(optstr);
1430 for (i = 1; i <= len; i++) {
1431 c = substr(optstr, i, 1);
1432 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1433 if (a == ":") {
1434 arg[c] = 1;
1435 i++;
1436 }
1437 opt[c] = 1;
1438 }
1439}
1440{
1441 expect = 0;
1442 str = $0;
1443 if (substr(str, 1, 1) != "-") {
1444 printf("'%s'\n", str);
1445 next;
1446 }
1447 len = length($0);
1448 for (i = 2; i <= len; i++) {
1449 c = substr(str, i, 1);
1450 if (!opt[c]) {
1451 printf("-%s\n", substr(str, i));
1452 next;
1453 }
1454 printf("-%s\n", c);
1455 if (arg[c]) {
1456 if (i < len)
1457 printf("'%s'\n", substr(str, i + 1));
1458 else
1459 expect = 1;
1460 next;
1461 }
1462 }
1463}
1464END {
1465 if (expect)
1466 print "?";
1467}
1468EOF
1469
1470: process the command line options
4633a7c4
LW
1471set X `for arg in "$@"; do echo "X$arg"; done |
1472 sed -e s/X// | awk -f options.awk`
2304df62
AD
1473eval "set $*"
1474shift
1475rm -f options.awk
1476
1477: set up default values
1478fastread=''
1479reuseval=false
1480config_sh=''
1481alldone=''
1482error=''
1483silent=''
1484extractsh=''
ecfc5424 1485override=''
16d20bd9 1486knowitall=''
02e93a22 1487rm -f optdef.sh posthint.sh
28757baa 1488cat >optdef.sh <<EOS
1489$startsh
1490EOS
2304df62 1491
dfe9444c 1492
2304df62
AD
1493: option parsing
1494while test $# -gt 0; do
1495 case "$1" in
1496 -d) shift; fastread=yes;;
1497 -e) shift; alldone=cont;;
1498 -f)
1499 shift
1500 cd ..
1501 if test -r "$1"; then
1502 config_sh="$1"
1503 else
a0d0e21e 1504 echo "$me: cannot read config file $1." >&2
2304df62
AD
1505 error=true
1506 fi
1507 cd UU
1508 shift;;
1509 -h) shift; error=true;;
1510 -r) shift; reuseval=true;;
dfe9444c 1511 -s) shift; silent=true; realsilent=true;;
2304df62 1512 -E) shift; alldone=exit;;
16d20bd9 1513 -K) shift; knowitall=true;;
ecfc5424 1514 -O) shift; override=true;;
dfe9444c 1515 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1516 -D)
1517 shift
1518 case "$1" in
1519 *=)
1520 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1521 echo "$me: ignoring -D $1" >&2
1522 ;;
ecfc5424 1523 *=*) echo "$1" | \
1aef975c
AD
1524 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1525 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1526 esac
1527 shift
1528 ;;
1529 -U)
1530 shift
1531 case "$1" in
1aef975c 1532 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1533 *=*)
1534 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1535 echo "$me: ignoring -U $1" >&2
1536 ;;
1aef975c 1537 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1538 esac
1539 shift
1540 ;;
02e93a22
JH
1541 -A)
1542 shift
1543 xxx=''
1544 yyy="$1"
02e93a22 1545 zzz=''
5f83a3e9 1546 uuu=undef
02e93a22 1547 case "$yyy" in
f7c31117 1548 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1549 case "$zzz" in
1550 *:*) zzz='' ;;
1551 *) xxx=append
f7c31117
JH
1552 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1553 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1554 esac
1555 ;;
1556 esac
1557 case "$xxx" in
1558 '') case "$yyy" in
f7c31117
JH
1559 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1560 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1561 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1562 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1563 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1564 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9
JH
1565 esac
1566 ;;
1567 esac
02e93a22
JH
1568 case "$xxx" in
1569 append)
5f83a3e9 1570 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1571 clear)
5f83a3e9 1572 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1573 define)
1574 case "$zzz" in
1575 '') zzz=define ;;
1576 esac
5f83a3e9 1577 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1578 eval)
5f83a3e9 1579 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1580 prepend)
5f83a3e9 1581 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1582 undef)
1583 case "$zzz" in
1584 '') zzz="$uuu" ;;
1585 esac
5f83a3e9
JH
1586 echo "$yyy=$zzz" >> posthint.sh ;;
1587 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1588 esac
bde6b06b 1589 shift
02e93a22 1590 ;;
dfe9444c 1591 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1592 exit 0;;
2304df62 1593 --) break;;
a0d0e21e 1594 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1595 *) break;;
1596 esac
1597done
1598
1599case "$error" in
1600true)
1601 cat >&2 <<EOM
2afac517 1602Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1603 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1604 -d : use defaults for all answers.
1605 -e : go on without questioning past the production of config.sh.
1606 -f : specify an alternate default configuration file.
1607 -h : print this help message and exit (with an error status).
1608 -r : reuse C symbols value if possible (skips costly nm extraction).
1609 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1610 -D : define symbol to have some value:
1611 -D symbol symbol gets the value 'define'
1612 -D symbol=value symbol gets the value 'value'
2304df62 1613 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1614 -K : do not use unless you know what you are doing.
ecfc5424 1615 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1616 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1617 -U : undefine symbol:
1618 -U symbol symbol gets the value 'undef'
1619 -U symbol= symbol gets completely empty
02e93a22 1620 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1621 -A symbol=value append " "value to symbol
02e93a22
JH
1622 -A append:symbol=value append value to symbol
1623 -A define:symbol=value define symbol to have value
02e93a22
JH
1624 -A clear:symbol define symbol to be ''
1625 -A define:symbol define symbol to be 'define'
1626 -A eval:symbol=value define symbol to be eval of value
1627 -A prepend:symbol=value prepend value to symbol
1628 -A undef:symbol define symbol to be 'undef'
1629 -A undef:symbol= define symbol to be ''
2304df62
AD
1630 -V : print version number and exit (with a zero status).
1631EOM
1632 exit 1
1633 ;;
1634esac
1635
dfe9444c
AD
1636: Sanity checks
1637case "$fastread$alldone" in
1638yescont|yesexit) ;;
1639*)
aaeb8e51
GS
1640 case "$extractsh" in
1641 true) ;;
1642 *)
1643 if test ! -t 0; then
1644 echo "Say 'sh Configure', not 'sh <Configure'"
1645 exit 1
1646 fi
1647 ;;
1648 esac
dfe9444c
AD
1649 ;;
1650esac
1651
2304df62
AD
1652exec 4>&1
1653case "$silent" in
1654true) exec 1>/dev/null;;
1655esac
1656
ecfc5424 1657: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1658touch optdef.sh
1659. ./optdef.sh
02e93a22
JH
1660: create the posthint manipulation script and leave the file out there...
1661touch posthint.sh
a0d0e21e 1662
2304df62 1663: set package name
85e6fe83 1664package=perl5
b4eb6b3d
JH
1665first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1666last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1667case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1668ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1669*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1670esac
2304df62 1671
2304df62
AD
1672: Some greps do not return status, grrr.
1673echo "grimblepritz" >grimble
1674if grep blurfldyick grimble >/dev/null 2>&1 ; then
1675 contains=contains
1676elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1677 contains=grep
1678else
1679 contains=contains
1680fi
1681rm -f grimble
1682: the following should work in any shell
1683case "$contains" in
1684contains*)
1685 echo " "
1686 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1687 cat >contains <<'EOSS'
1688grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1689EOSS
1690chmod +x contains
1691esac
1692
dfe9444c
AD
1693: Find the path to the source tree
1694case "$src" in
1695'') case "$0" in
b233458b
JH
1696 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1697 case "$src" in
1698 /*) ;;
8504afb7 1699 .) ;;
b233458b
JH
1700 *) src=`cd ../$src && pwd` ;;
1701 esac
1702 ;;
dfe9444c
AD
1703 *) src='.';;
1704 esac;;
1705esac
1706case "$src" in
1707'') src=/
1708 rsrc=/
1709 ;;
1710/*) rsrc="$src";;
1711*) rsrc="../$src";;
1712esac
1713if test -f $rsrc/Configure && \
1714 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1715then
1716 : found it, so we are ok.
1717else
1718 rsrc=''
1719 for src in . .. ../.. ../../.. ../../../..; do
1720 if test -f ../$src/Configure && \
1721 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1722 then
1723 rsrc=../$src
1724 break
1725 fi
1726 done
1727fi
1728case "$rsrc" in
1729'')
1730 cat <<EOM >&4
1731
1732Sorry, I can't seem to locate the source dir for $package. Please start
1733Configure with an explicit path -- i.e. /some/path/Configure.
1734
1735EOM
1736 exit 1
1737 ;;
1738../.) rsrc='..';;
1739*)
1740 echo " "
1741 echo "Sources for $package found in \"$src\"." >&4
1742 ;;
1743esac
1744
1745: script used to extract .SH files with variable substitutions
1746cat >extract <<'EOS'
a02608de 1747PERL_CONFIG_SH=true
dfe9444c 1748echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1749if test -f MANIFEST; then
1750 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1751else
1752 echo "(Looking for .SH files under the source directory.)"
6904989c 1753 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1754fi
1755shift
1756case $# in
6904989c 17570) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1758esac
6904989c 1759if test ! -f "$src/$1"; then
dfe9444c
AD
1760 shift
1761fi
1762mkdir_p='
1763name=$1;
1764create="";
1765while test $name; do
1766 if test ! -d "$name"; then
1767 create="$name $create";
1768 name=`echo $name | sed -e "s|^[^/]*$||"`;
1769 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1770 else
1771 name="";
1772 fi;
1773done;
1774for file in $create; do
1775 mkdir $file;
1776done
1777'
1778for file in $*; do
1779 case "$src" in
1780 ".")
1781 case "$file" in
1782 */*)
1783 dir=`expr X$file : 'X\(.*\)/'`
1784 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1785 (cd "$dir" && . ./$file)
dfe9444c
AD
1786 ;;
1787 *)
1788 . ./$file
1789 ;;
1790 esac
1791 ;;
1792 *)
1793 case "$file" in
1794 */*)
1795 dir=`expr X$file : 'X\(.*\)/'`
1796 file=`expr X$file : 'X.*/\(.*\)'`
1797 (set x $dir; shift; eval $mkdir_p)
6904989c 1798 sh <"$src/$dir/$file"
dfe9444c
AD
1799 ;;
1800 *)
6904989c 1801 sh <"$src/$file"
dfe9444c
AD
1802 ;;
1803 esac
1804 ;;
1805 esac
1806done
6904989c 1807if test -f "$src/config_h.SH"; then
dfe9444c
AD
1808 if test ! -f config.h; then
1809 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1810 . "$src/config_h.SH"
dfe9444c
AD
1811 fi
1812fi
1813EOS
1814
1815: extract files and exit if asked to do so
1816case "$extractsh" in
1817true)
1818 case "$realsilent" in
1819 true) ;;
1820 *) exec 1>&4;;
1821 esac
1822 case "$config_sh" in
1823 '') config_sh='config.sh';;
1824 esac
1825 echo " "
1826 echo "Fetching answers from $config_sh..."
1827 cd ..
1828 . $config_sh
1829 test "$override" && . ./optdef.sh
1830 echo " "
1831 . UU/extract
1832 rm -rf UU
24ccb310 1833 echo "Extraction done."
dfe9444c
AD
1834 exit 0
1835 ;;
1836esac
1837
1838: Eunice requires " " instead of "", can you believe it
1839echo " "
1840: Here we go...
1841echo "Beginning of configuration questions for $package."
1842
1843trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1844
2304df62
AD
1845: first determine how to suppress newline on echo command
1846echo " "
1847echo "Checking echo to see how to suppress newlines..."
1848(echo "hi there\c" ; echo " ") >.echotmp
1849if $contains c .echotmp >/dev/null 2>&1 ; then
1850 echo "...using -n."
1851 n='-n'
1852 c=''
1853else
1854 cat <<'EOM'
1855...using \c
1856EOM
1857 n=''
1858 c='\c'
1859fi
1860echo $n "The star should be here-->$c"
1861echo '*'
1862rm -f .echotmp
1863
1864: Now test for existence of everything in MANIFEST
1865echo " "
6904989c 1866if test -f "$rsrc/MANIFEST"; then
2304df62 1867 echo "First let's make sure your kit is complete. Checking..." >&4
4242830c 1868 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
2304df62 1869 rm -f missing
dfe9444c 1870 tmppwd=`pwd`
2304df62 1871 for filelist in x??; do
6904989c 1872 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1873 done
1874 if test -s missing; then
1875 cat missing >&4
1876 cat >&4 <<'EOM'
1877
1878THIS PACKAGE SEEMS TO BE INCOMPLETE.
1879
1880You have the option of continuing the configuration process, despite the
1881distinct possibility that your kit is damaged, by typing 'y'es. If you
1882do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1883and contact the author (perlbug@perl.org).
2304df62
AD
1884
1885EOM
1886 echo $n "Continue? [n] $c" >&4
1887 read ans
1888 case "$ans" in
1889 y*)
1890 echo "Continuing..." >&4
1891 rm -f missing
1892 ;;
1893 *)
1894 echo "ABORTING..." >&4
1895 kill $$
1896 ;;
1897 esac
1898 else
dfe9444c 1899 echo "Looks good..."
2304df62
AD
1900 fi
1901else
1902 echo "There is no MANIFEST file. I hope your kit is complete !"
1903fi
1904rm -f missing x??
1905
5ff3f7a4
GS
1906echo " "
1907: Find the appropriate value for a newline for tr
1908if test -n "$DJGPP"; then
1909 trnl='\012'
1910fi
1911if test X"$trnl" = X; then
1912 case "`echo foo|tr '\n' x 2>/dev/null`" in
1913 foox) trnl='\n' ;;
1914 esac
1915fi
1916if test X"$trnl" = X; then
1917 case "`echo foo|tr '\012' x 2>/dev/null`" in
1918 foox) trnl='\012' ;;
1919 esac
1920fi
1921if test X"$trnl" = X; then
8be2c24c
JH
1922 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1923 fooxy) trnl='\n\r' ;;
1924 esac
1925fi
1926if test X"$trnl" = X; then
5ff3f7a4
GS
1927 cat <<EOM >&2
1928
1929$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1930
1931EOM
1932 exit 1
1933fi
1934
2304df62
AD
1935: compute the number of columns on the terminal for proper question formatting
1936case "$COLUMNS" in
1937'') COLUMNS='80';;
1938esac
1939
1940: set up the echo used in my read
1941myecho="case \"\$xxxm\" in
1942'') echo $n \"\$rp $c\" >&4;;
1943*) case \"\$rp\" in
1944 '') echo $n \"[\$xxxm] $c\";;
1945 *)
1946 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1947 echo \"\$rp\" >&4
1948 echo $n \"[\$xxxm] $c\" >&4
1949 else
1950 echo $n \"\$rp [\$xxxm] $c\" >&4
1951 fi
1952 ;;
1953 esac;;
1954esac"
1955
1956: now set up to do reads with possible shell escape and default assignment
1957cat <<EOSC >myread
28757baa 1958$startsh
2304df62
AD
1959xxxm=\$dflt
1960$myecho
1961ans='!'
1962case "\$fastread" in
1963yes) case "\$dflt" in
1964 '') ;;
1965 *) ans='';
1966 case "\$silent-\$rp" in
1967 true-) ;;
1968 *) echo " " >&4;;
1969 esac;;
1970 esac;;
1971*) case "\$silent" in
1972 true) case "\$rp" in
1973 '') ans='';;
1974 esac;;
1975 esac;;
1976esac
1977while expr "X\$ans" : "X!" >/dev/null; do
1978 read answ
1979 set x \$xxxm
1980 shift
dfe9444c 1981 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1982 case "\$answ" in
dfe9444c
AD
1983 "!")
1984 sh 1>&4
1985 echo " "
1986 $myecho
1987 ;;
1988 !*)
1989 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1990 shift
1991 sh 1>&4 -c "\$*"
1992 echo " "
1993 $myecho
1994 ;;
2304df62
AD
1995 "\$ans")
1996 case "\$ans" in
ecfc5424
AD
1997 \\&*)
1998 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1999 shift
2000 case "\$1" in
2001 -d)
2002 fastread=yes
40a7a20a 2003 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2004 ;;
2005 -*)
40a7a20a 2006 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2007 ;;
2008 esac
2009 $myecho
2010 ans=!
2011 ;;
2304df62
AD
2012 esac;;
2013 *)
2014 case "\$aok" in
2015 y)
2016 echo "*** Substitution done -- please confirm."
2017 xxxm="\$ans"
c9795ab7 2018 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2019 xxxm="\$ans"
2020 ans=!
2021 ;;
2022 *)
2023 echo "*** Error -- try again."
2024 ans=!
2025 ;;
2026 esac
2027 $myecho
2028 ;;
2029 esac
2030 case "\$ans\$xxxm\$nostick" in
2031 '')
2032 ans=!
2033 $myecho
2034 ;;
2035 esac
2036done
2037case "\$ans" in
2038'') ans="\$xxxm";;
2039esac
2040EOSC
2041
2042: create .config dir to save info across Configure sessions
2043test -d ../.config || mkdir ../.config
2044cat >../.config/README <<EOF
2045This directory created by Configure to save information that should
dfe9444c 2046persist across sessions for $package.
2304df62
AD
2047
2048You may safely delete it if you wish.
2049EOF
2050
9507cadf 2051xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2052case "$usedevel" in
0107c034 2053$define|true|[yY]*) ;;
9507cadf 2054*) case "$xversion" in
0107c034
JH
2055 *[13579])
2056 cat >&4 <<EOH
2057*** WHOA THERE!!! ***
2058
2059 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2060 The version of this $package distribution is $xversion, that is, odd,
2061 (as opposed to even) and that signifies a development release.
3d5d58b1 2062 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2063
2064 Do ***NOT*** install this into production use.
2065 Data corruption and crashes are possible.
2066
2067 It is most seriously suggested that you do not continue any further
2068 unless you want to help in developing and debugging Perl.
2069
6adc6a45
JH
2070 If you *still* want to build perl, you can answer 'y' now,
2071 or pass -Dusedevel to Configure.
2072
0107c034
JH
2073EOH
2074 rp='Do you really want to continue?'
2075 dflt='n'
2076 . ./myread
2077 case "$ans" in
8feeef0e
JH
2078 [yY]) echo >&4 "Okay, continuing."
2079 usedevel="$define" ;;
0107c034
JH
2080 *) echo >&4 "Okay, bye."
2081 exit 1
2082 ;;
2083 esac
2084 ;;
2085 esac
2086 ;;
2087esac
8feeef0e
JH
2088case "$usedevel" in
2089$define|true|[yY]*)
2090 case "$versiononly" in
2091 '') versiononly="$define" ;;
2092 esac
2093 case "$installusrbinperl" in
2094 '') installusrbinperl="$undef" ;;
2095 esac
2096 ;;
2097esac
0107c034 2098
2304df62
AD
2099: general instructions
2100needman=true
2101firsttime=true
760ac839 2102user=`(logname) 2>/dev/null`
dfe9444c
AD
2103case "$user" in
2104'') user=`whoami 2>&1`;;
760ac839 2105esac
2304df62
AD
2106if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2107 firsttime=false
2108 echo " "
2109 rp='Would you like to see the instructions?'
2110 dflt=n
2111 . ./myread
2112 case "$ans" in
2113 [yY]*) ;;
2114 *) needman=false;;
2115 esac
2116fi
2117if $needman; then
2118 cat <<EOH
4e2a5f63 2119
2304df62 2120This installation shell script will examine your system and ask you questions
a0d0e21e 2121to determine how the perl5 package should be installed. If you get
2304df62
AD
2122stuck on a question, you may use a ! shell escape to start a subshell or
2123execute a command. Many of the questions will have default answers in square
2124brackets; typing carriage return will give you the default.
2125
2126On some of the questions which ask for file or directory names you are allowed
2127to use the ~name construct to specify the login directory belonging to "name",
2128even if you don't have a shell which knows about that. Questions where this is
2129allowed will be marked "(~name ok)".
2130
2131EOH
2132 rp=''
2133 dflt='Type carriage return to continue'
2134 . ./myread
2135 cat <<'EOH'
2136
2137The prompter used in this script allows you to use shell variables and
2138backticks in your answers. You may use $1, $2, etc... to refer to the words
2139in the default answer, as if the default line was a set of arguments given to a
2140script shell. This means you may also use $* to repeat the whole default line,
2141so you do not have to re-type everything to add something to the default.
2142
2143Everytime there is a substitution, you will have to confirm. If there is an
2144error (e.g. an unmatched backtick), the default answer will remain unchanged
2145and you will be prompted again.
2146
2147If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2148the questions and use the computed defaults (or the previous answers if there
2149was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2150You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2151on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2152
2153EOH
2154 . ./myread
2155 cat <<EOH
2156
2157Much effort has been expended to ensure that this shell script will run on any
2158Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2159Configure and run it again. If you can't run Configure for some reason,
2160you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2161have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2162
2163This installation script affects things in two ways:
2164
21651) it may do direct variable substitutions on some of the files included
2166 in this kit.
21672) it builds a config.h file for inclusion in C programs. You may edit
2168 any of these files as the need arises after running this script.
2169
2170If you make a mistake on a question, there is no easy way to back up to it
2171currently. The easiest thing to do is to edit config.sh and rerun all the SH
2172files. Configure will offer to let you do this before it runs the SH files.
2173
2174EOH
2175 dflt='Type carriage return to continue'
2176 . ./myread
2177 case "$firsttime" in
2178 true) echo $user >>../.config/instruct;;
2179 esac
2180fi
2181
2304df62
AD
2182: find out where common programs are
2183echo " "
2184echo "Locating common programs..." >&4
2185cat <<EOSC >loc
2186$startsh
2187case \$# in
21880) exit 1;;
2189esac
2190thing=\$1
2191shift
2192dflt=\$1
2193shift
2194for dir in \$*; do
2195 case "\$thing" in
2196 .)
2197 if test -d \$dir/\$thing; then
2198 echo \$dir
2199 exit 0
2200 fi
2201 ;;
2202 *)
a0d0e21e 2203 for thisthing in \$dir/\$thing; do
ecfc5424 2204 : just loop through to pick last item
a0d0e21e 2205 done
25f94b33 2206 if test -f \$thisthing; then
a0d0e21e 2207 echo \$thisthing
2304df62 2208 exit 0
a5a94ea5
JH
2209 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2210 echo \$thisthing
2211 exit 0
2304df62 2212 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2213 if test -n "$DJGPP"; then
2214 echo \$dir/\$thing.exe
b921d661 2215 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2216 : on Eunice apparently
2217 echo \$dir/\$thing
b921d661 2218 exit 0
c4f23d77 2219 fi
2d736872 2220 exit 0
2304df62
AD
2221 fi
2222 ;;
2223 esac
2224done
2225echo \$dflt
2226exit 1
2227EOSC
2228chmod +x loc
2229$eunicefix loc
2230loclist="
2231awk
2232cat
f8006fac 2233chmod
b4eb6b3d
JH
2234comm
2235cp
2304df62
AD
2236echo
2237expr
2238grep
a0d0e21e 2239ls
b4eb6b3d 2240mkdir
2304df62
AD
2241rm
2242sed
b4eb6b3d 2243sort
85e6fe83 2244touch
2304df62 2245tr
b4eb6b3d 2246uniq
2304df62
AD
2247"
2248trylist="
2249Mcc
dfe9444c 2250ar
3659ebf1 2251bison
b4eb6b3d 2252byacc
2304df62 2253cpp
b4eb6b3d 2254csh
2304df62
AD
2255date
2256egrep
1fef16b3 2257gmake
8ff267be 2258gzip
b4eb6b3d 2259less
8ff267be 2260ln
3c728e00 2261make
b4eb6b3d 2262more
693762b4 2263nm
b4eb6b3d
JH
2264nroff
2265pg
2304df62
AD
2266test
2267uname
8ff267be 2268zip
2304df62 2269"
8e07c86e 2270pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2271pth="$pth /lib /usr/lib"
2272for file in $loclist; do
dfe9444c
AD
2273 eval xxx=\$$file
2274 case "$xxx" in
2275 /*|?:[\\/]*)
2276 if test -f "$xxx"; then
2277 : ok
2278 else
2279 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2280 xxx=`./loc $file $file $pth`
2281 fi
2282 ;;
2283 '') xxx=`./loc $file $file $pth`;;
2284 *) xxx=`./loc $xxx $xxx $pth`;;
2285 esac
a5a94ea5 2286 eval $file=$xxx$_exe
2304df62
AD
2287 eval _$file=$xxx
2288 case "$xxx" in
2289 /*)
2290 echo $file is in $xxx.
2291 ;;
8e07c86e
AD
2292 ?:[\\/]*)
2293 echo $file is in $xxx.
2294 ;;
2304df62 2295 *)
25f94b33
AD
2296 echo "I don't know where '$file' is, and my life depends on it." >&4
2297 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2298 exit 1
2304df62
AD
2299 ;;
2300 esac
2301done
2302echo " "
2303echo "Don't worry if any of the following aren't found..."
2304say=offhand
2305for file in $trylist; do
dfe9444c
AD
2306 eval xxx=\$$file
2307 case "$xxx" in
2308 /*|?:[\\/]*)
2309 if test -f "$xxx"; then
2310 : ok
2311 else
2312 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2313 xxx=`./loc $file $file $pth`
2314 fi
2315 ;;
2316 '') xxx=`./loc $file $file $pth`;;
2317 *) xxx=`./loc $xxx $xxx $pth`;;
2318 esac
306a8474 2319 eval $file=$xxx$_exe
2304df62
AD
2320 eval _$file=$xxx
2321 case "$xxx" in
2322 /*)
2323 echo $file is in $xxx.
2324 ;;
8e07c86e
AD
2325 ?:[\\/]*)
2326 echo $file is in $xxx.
2327 ;;
2304df62
AD
2328 *)
2329 echo "I don't see $file out there, $say."
2330 say=either
2331 ;;
2332 esac
2333done
2334case "$egrep" in
1fef16b3 2335egrep)
2304df62
AD
2336 echo "Substituting grep for egrep."
2337 egrep=$grep
868439a2 2338 _egrep=$grep
2304df62
AD
2339 ;;
2340esac
8ff267be 2341case "$ln" in
1fef16b3 2342ln)
8ff267be 2343 echo "Substituting cp for ln."
2344 ln=$cp
868439a2 2345 _ln=$cp
8ff267be 2346 ;;
2347esac
2e26f1d5
JH
2348case "$make" in
2349make)
2350 case "$gmake" in
2351 gmake)
2352 echo "I can't find make or gmake, and my life depends on it." >&4
2353 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2354 exit 1
2355 ;;
2356 esac
2357 ;;
2358esac
2359case "$gmake" in
2360gmake) ;;
2361*) # We can't have osname yet.
1fef16b3
JH
2362 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2363 # Assume that gmake, if found, is definitely GNU make
2364 # and prefer it over the system make.
2365 echo "Substituting gmake for make."
2366 make=$gmake
868439a2 2367 _make=$gmake
1fef16b3
JH
2368 fi
2369 ;;
a5a94ea5 2370esac
2304df62
AD
2371case "$test" in
2372test)
2373 echo "Hopefully test is built into your sh."
2374 ;;
2375*)
73614538 2376 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2377 echo "Using the test built into your sh."
2304df62
AD
2378 test=test
2379 _test=test
2380 fi
2381 ;;
2382esac
2383case "$echo" in
2384echo)
2385 echo "Hopefully echo is built into your sh."
2386 ;;
2387'') ;;
2388*)
2389 echo " "
2390echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2391 $echo $n "hi there$c" >foo1
2392 echo $n "hi there$c" >foo2
2393 if cmp foo1 foo2 >/dev/null 2>&1; then
2394 echo "They are compatible. In fact, they may be identical."
2395 else
2396 case "$n" in
2397 '-n') n='' c='\c';;
2398 *) n='-n' c='';;
2399 esac
2400 cat <<FOO
2401They are not compatible! You are probably running ksh on a non-USG system.
2402I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2403have echo built in and we may have to run some Bourne shell scripts. That
2404means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2405
2406FOO
2407 $echo $n "The star should be here-->$c"
2408 $echo "*"
2409 fi
2410 $rm -f foo1 foo2
2411 ;;
2412esac
2413
6b769f8f 2414cat <<EOS >trygcc
2573c5f9
JH
2415$startsh
2416EOS
6b769f8f 2417cat <<'EOSC' >>trygcc
2573c5f9
JH
2418case "$cc" in
2419'') ;;
2420*) $rm -f try try.*
2421 $cat >try.c <<EOM
2422int main(int argc, char *argv[]) {
2423 return 0;
2424}
2425EOM
e4778687 2426 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2427 :
2428 else
2429 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2430 despair=yes
2431 trygcc=yes
2432 case "$cc" in
2433 *gcc*) trygcc=no ;;
2434 esac
2435 case "`$cc -v -c try.c 2>&1`" in
2436 *gcc*) trygcc=no ;;
2437 esac
2438 if $test X"$trygcc" = Xyes; then
2439 if gcc -o try -c try.c; then
2440 echo " "
2441 echo "You seem to have a working gcc, though." >&4
2442 rp="Would you like to use it?"
2443 dflt=y
2444 if $test -f myread; then
2445 . ./myread
2446 else
2447 if $test -f UU/myread; then
2448 . ./UU/myread
2449 else
2450 echo "Cannot find myread, sorry. Aborting." >&2
2451 exit 1
2452 fi
2453 fi
2454 case "$ans" in
6371411c
RB
2455 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2456 if $test -f usethreads.cbu; then
2457 $cat >&4 <<EOM
2458
2459*** However, any setting of the C compiler flags (e.g. for thread support)
2460*** has been lost. It may be necessary to pass -Dcc=gcc to Configure
2461*** (together with e.g. -Dusethreads).
2462
2463EOM
2464 fi;;
2573c5f9
JH
2465 esac
2466 fi
2467 fi
6b769f8f
RB
2468 fi
2469 $rm -f try try.*
2470 ;;
2471esac
2472EOSC
2473
2474cat <<EOS >checkcc
2475$startsh
2476EOS
2477cat <<'EOSC' >>checkcc
2478case "$cc" in
2479'') ;;
2480*) $rm -f try try.*
2481 $cat >try.c <<EOM
2482int main(int argc, char *argv[]) {
2483 return 0;
2484}
2485EOM
2486 if $cc -o try $ccflags $ldflags try.c; then
2487 :
2488 else
2573c5f9 2489 if $test X"$despair" = Xyes; then
6b769f8f
RB
2490 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2491 fi
2492 $cat >&4 <<EOM
5dd4fbdf
MB
2493You need to find a working C compiler.
2494Either (purchase and) install the C compiler supplied by your OS vendor,
2495or for a free C compiler try http://gcc.gnu.org/
2496I cannot continue any further, aborting.
2497EOM
6b769f8f 2498 exit 1
2573c5f9
JH
2499 fi
2500 $rm -f try try.*
2501 ;;
2502esac
2503EOSC
2504
a0d0e21e
LW
2505: determine whether symbolic links are supported
2506echo " "
2507$touch blurfl
2508if $ln -s blurfl sym > /dev/null 2>&1 ; then
2509 echo "Symbolic links are supported." >&4
818f00be 2510 lns="$ln -s"
a0d0e21e
LW
2511else
2512 echo "Symbolic links are NOT supported." >&4
2513 lns="$ln"
2514fi
2515$rm -f blurfl sym
2516
dafca956
JH
2517: determine whether symbolic links are supported
2518echo " "
2519case "$lns" in
18ea2752 2520*"ln"*" -s")
dafca956
JH
2521 echo "Checking how to test for symbolic links..." >&4
2522 $lns blurfl sym
4b661809 2523 if $test "X$issymlink" = X; then
2e2a97a6
JH
2524 case "$newsh" in
2525 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2526 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2527 esac
5d644a95
MB
2528 if test $? = 0; then
2529 issymlink="test -h"
2e2a97a6
JH
2530 else
2531 echo "Your builtin 'test -h' may be broken." >&4
2532 case "$test" in
2533 /*) ;;
2534 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2535 for p in $pth
2536 do
2537 if test -f "$p/$test"; then
2538 test="$p/$test"
2539 break
2540 fi
2541 done
2542 ;;
2543 esac
2544 case "$test" in
2545 /*)
2546 echo "Trying external '$test -h'." >&4
2547 issymlink="$test -h"
2548 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2549 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2550 issymlink=''
2551 fi
2552 ;;
2553 *) issymlink='' ;;
2554 esac
5d644a95
MB
2555 fi
2556 fi
4b661809 2557 if $test "X$issymlink" = X; then
dafca956 2558 if $test -L sym 2>/dev/null; then
5d644a95 2559 issymlink="$test -L"
2e2a97a6 2560 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2561 fi
2562 fi
4b661809 2563 if $test "X$issymlink" != X; then
5d644a95 2564 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2565 else
2566 echo "I do not know how you can test for symbolic links." >&4
2567 fi
2568 $rm -f blurfl sym
2569 ;;
2570*) echo "No symbolic links, so not testing for their testing..." >&4
2571 ;;
2572esac
2573echo " "
2574
2575
2576case "$mksymlinks" in
2577$define|true|[yY]*)
2578 case "$src" in
2579 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2580 exit 1
2581 ;;
4b661809 2582 *) case "$lns:$issymlink" in
f314eb9f 2583 *"ln"*" -s:"*"test -"?)
dafca956
JH
2584 echo "Creating the symbolic links..." >&4
2585 echo "(First creating the subdirectories...)" >&4
2586 cd ..
2587 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2588 read directory
2589 test -z "$directory" && break
2590 mkdir -p $directory
2591 done
2592 # Sanity check 1.
2593 if test ! -d t/base; then
2594 echo "Failed to create the subdirectories. Aborting." >&4
2595 exit 1
2596 fi
2597 echo "(Then creating the symlinks...)" >&4
2598 awk '{print $1}' $src/MANIFEST | while true; do
2599 read filename
2600 test -z "$filename" && break
2601 if test -f $filename; then
5d644a95 2602 if $issymlink $filename; then
dafca956
JH
2603 rm -f $filename
2604 fi
2605 fi
2606 if test -f $filename; then
2607 echo "$filename already exists, not symlinking."
2608 else
2609 ln -s $src/$filename $filename
2610 fi
2611 done
2612 # Sanity check 2.
a0d24b8a
JH
2613 if test ! -f t/base/lex.t; then
2614 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2615 exit 1
2616 fi
2617 cd UU
2618 ;;
2619 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2620 ;;
2621 esac
2622 ;;
2623 esac
2624 ;;
2625esac
2626
5440bc8e
JH
2627
2628case "$usecrosscompile" in
2629$define|true|[yY]*)
93bc48fa 2630 $echo "Cross-compiling..."
5440bc8e
JH
2631 croak=''
2632 case "$cc" in
2633 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2634 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2635 ar=$targetarch-ar
2636 # leave out ld, choosing it is more complex
2637 nm=$targetarch-nm
2638 ranlib=$targetarch-ranlib
93bc48fa 2639 $echo 'extern int foo;' > try.c
f8006fac 2640 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2641 shift
2642 if $test $# -gt 0; then
2643 incpth="$incpth $*"
f8006fac
JH
2644 incpth="`$echo $incpth|$sed 's/^ //'`"
2645 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2646 for i in $*; do
f8006fac 2647 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2648 if $test -d $j; then
2649 libpth="$libpth $j"
2650 fi
2651 done
f8006fac
JH
2652 libpth="`$echo $libpth|$sed 's/^ //'`"
2653 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2654 fi
2655 $rm -f try.c
5440bc8e
JH
2656 ;;
2657 esac
2658 case "$targetarch" in
93bc48fa
JH
2659 '') echo "Targetarch not defined." >&4; croak=y ;;
2660 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2661 esac
2662 case "$incpth" in
93bc48fa 2663 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2664 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2665 esac
2666 case "$libpth" in
93bc48fa 2667 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2668 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2669 esac
93bc48fa
JH
2670 case "$usrinc" in
2671 '') for i in $incpth; do
2672 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2673 usrinc=$i
2674 echo "Guessing usrinc $usrinc." >&4
2675 break
2676 fi
2677 done
2678 case "$usrinc" in
2679 '') echo "Usrinc not defined." >&4; croak=y ;;
2680 esac
2681 ;;
2682 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2683 esac
93bc48fa
JH
2684 case "$targethost" in
2685 '') echo "Targethost not defined." >&4; croak=y ;;
2686 *) echo "Using targethost $targethost." >&4
5440bc8e 2687 esac
93bc48fa
JH
2688 locincpth=' '
2689 loclibpth=' '
5440bc8e 2690 case "$croak" in
93bc48fa 2691 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2692 esac
2693 case "$src" in
2694 /*) run=$src/Cross/run
93c0359c 2695 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2696 to=$src/Cross/to
2697 from=$src/Cross/from
2698 ;;
93bc48fa 2699 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2700 run=$pwd/Cross/run
f8006fac 2701 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2702 to=$pwd/Cross/to
2703 from=$pwd/Cross/from
2704 ;;
2705 esac
2706 case "$targetrun" in
2707 '') targetrun=ssh ;;
2708 esac
2709 case "$targetto" in
2710 '') targetto=scp ;;
2711 esac
2712 case "$targetfrom" in
2713 '') targetfrom=scp ;;
2714 esac
2715 run=$run-$targetrun
2716 to=$to-$targetto
2717 from=$from-$targetfrom
93bc48fa
JH
2718 case "$targetdir" in
2719 '') targetdir=/tmp
2720 echo "Guessing targetdir $targetdir." >&4
2721 ;;
2722 esac
5440bc8e 2723 case "$targetuser" in
93bc48fa
JH
2724 '') targetuser=root
2725 echo "Guessing targetuser $targetuser." >&4
2726 ;;
5440bc8e
JH
2727 esac
2728 case "$targetfrom" in
2729 scp) q=-q ;;
2730 *) q='' ;;
2731 esac
2732 case "$targetrun" in
2733 ssh|rsh)
2734 cat >$run <<EOF
2735#!/bin/sh
93c0359c
JH
2736case "\$1" in
2737-cwd)
2738 shift
2739 cwd=\$1
2740 shift
2741 ;;
2742esac
2743case "\$cwd" in
2744'') cwd=$targetdir ;;
2745esac
5440bc8e
JH
2746exe=\$1
2747shift
93c0359c
JH
2748if $test ! -f \$exe.xok; then
2749 $to \$exe
2750 $touch \$exe.xok
2751fi
2752$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2753EOF
2754 ;;
93bc48fa 2755 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2756 exit 1
2757 ;;
2758 esac
93c0359c
JH
2759 case "$targetmkdir" in
2760 */Cross/mkdir)
2761 cat >$targetmkdir <<EOF
2762#!/bin/sh
2763$targetrun -l $targetuser $targethost "mkdir -p \$@"
2764EOF
f8006fac 2765 $chmod a+rx $targetmkdir
93c0359c
JH
2766 ;;
2767 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2768 exit 1
2769 ;;
2770 esac
5440bc8e
JH
2771 case "$targetto" in
2772 scp|rcp)
2773 cat >$to <<EOF
2774#!/bin/sh
2775for f in \$@
2776do
93c0359c
JH
2777 case "\$f" in
2778 /*)
2779 $targetmkdir \`dirname \$f\`
2780 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2781 ;;
2782 *)
2783 $targetmkdir $targetdir/\`dirname \$f\`
2784 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2785 ;;
2786 esac
5440bc8e
JH
2787done
2788exit 0
2789EOF
2790 ;;
2791 cp) cat >$to <<EOF
2792#!/bin/sh
93c0359c
JH
2793for f in \$@
2794do
2795 case "\$f" in
2796 /*)
2797 $mkdir -p $targetdir/\`dirname \$f\`
2798 $cp \$f $targetdir/\$f || exit 1
2799 ;;
2800 *)
2801 $targetmkdir $targetdir/\`dirname \$f\`
2802 $cp \$f $targetdir/\$f || exit 1
2803 ;;
2804 esac
2805done
2806exit 0
5440bc8e
JH
2807EOF
2808 ;;
93bc48fa 2809 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2810 exit 1
2811 ;;
2812 esac
2813 case "$targetfrom" in
2814 scp|rcp)
2815 cat >$from <<EOF
2816#!/bin/sh
2817for f in \$@
2818do
93c0359c 2819 $rm -f \$f
5440bc8e
JH
2820 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2821done
2822exit 0
2823EOF
2824 ;;
2825 cp) cat >$from <<EOF
2826#!/bin/sh
2827for f in \$@
2828do
93c0359c 2829 $rm -f \$f
5440bc8e
JH
2830 cp $targetdir/\$f . || exit 1
2831done
2832exit 0
2833EOF
2834 ;;
93bc48fa 2835 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2836 exit 1
2837 ;;
2838 esac
93bc48fa
JH
2839 if $test ! -f $run; then
2840 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2841 else
f8006fac 2842 $chmod a+rx $run
5440bc8e 2843 fi
93bc48fa
JH
2844 if $test ! -f $to; then
2845 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2846 else
f8006fac 2847 $chmod a+rx $to
5440bc8e 2848 fi
93bc48fa
JH
2849 if $test ! -f $from; then
2850 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2851 else
f8006fac 2852 $chmod a+rx $from
5440bc8e 2853 fi
93bc48fa 2854 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2855 exit 1
2856 fi
2857 cat >&4 <<EOF
f8006fac
JH
2858Using '$run' for remote execution,
2859and '$from' and '$to'
93bc48fa 2860for remote file transfer.
5440bc8e
JH
2861EOF
2862 ;;
2863*) run=''
2864 to=:
2865 from=:
2866 usecrosscompile='undef'
2867 targetarch=''
2868 ;;
2869esac
2870
ecfc5424
AD
2871: see whether [:lower:] and [:upper:] are supported character classes
2872echo " "
ecfc5424
AD
2873case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2874ABYZ)
2875 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2876 up='[:upper:]'
2877 low='[:lower:]'
2878 ;;
28e8609d
JH
2879*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2880 # (0xc9 and 0xd1), therefore that is a nice testing point.
2881 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2882 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2883 ij) up='[A-Z]'
2884 low='[a-z]'
2885 ;;
2886 esac
2887 fi
2888 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2889 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2890 ij) up='A-Z'
2891 low='a-z'
2892 ;;
2893 esac
2894 fi
2895 if test "X$up" = X -o "X$low" = X; then
2896 case "`echo IJ | od -x 2>/dev/null`" in
2897 *C9D1*|*c9d1*)
2898 echo "Hey, this might be EBCDIC." >&4
2899 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2900 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2901 ij) up='[A-IJ-RS-Z]'
2902 low='[a-ij-rs-z]'
2903 ;;
2904 esac
2905 fi
2906 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2907 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2908 ij) up='A-IJ-RS-Z'
2909 low='a-ij-rs-z'
2910 ;;
2911 esac
2912 fi
2913 ;;
2914 esac
2915 fi
2916esac
3eaeeeae 2917case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2918ij)
2919 echo "Using $up and $low to convert case." >&4
2920 ;;
ecfc5424 2921*)
28e8609d
JH
2922 echo "I don't know how to translate letters from upper to lower case." >&4
2923 echo "Your tr is not acting any way I know of." >&4
2924 exit 1
2925 ;;
ecfc5424
AD
2926esac
2927: set up the translation script tr, must be called with ./tr of course
2928cat >tr <<EOSC
2929$startsh
2930case "\$1\$2" in
2931'[A-Z][a-z]') exec $tr '$up' '$low';;
2932'[a-z][A-Z]') exec $tr '$low' '$up';;
2933esac
2934exec $tr "\$@"
2935EOSC
2936chmod +x tr
2937$eunicefix tr
2938
2304df62
AD
2939: Try to determine whether config.sh was made on this system
2940case "$config_sh" in
2941'')
43999f95
JH
2942myuname=`$uname -a 2>/dev/null`
2943$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2944# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2945# because the A-Z/a-z are not consecutive.
a0d0e21e 2946myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2947 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2948newmyuname="$myuname"
2304df62 2949dflt=n
16d20bd9
AD
2950case "$knowitall" in
2951'')
2952 if test -f ../config.sh; then
2953 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2954 eval "`grep myuname= ../config.sh`"
2955 fi
2956 if test "X$myuname" = "X$newmyuname"; then
2957 dflt=y
2958 fi
2304df62 2959 fi
16d20bd9
AD
2960 ;;
2961*) dflt=y;;
2962esac
2304df62
AD
2963
2964: Get old answers from old config file if Configure was run on the
2965: same system, otherwise use the hints.
2966hint=default
2967cd ..
2968if test -f config.sh; then
16d20bd9
AD
2969 echo " "
2970 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2971 . UU/myread
2972 case "$ans" in
f83701cd
AD
2973 n*|N*) echo "OK, I'll ignore it."
2974 mv config.sh config.sh.old
2975 myuname="$newmyuname"
2976 ;;
2304df62 2977 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2978 tmp_n="$n"
2979 tmp_c="$c"
85cad39c 2980 tmp_sh="$sh"
2304df62
AD
2981 . ./config.sh
2982 cp config.sh UU
ecfc5424
AD
2983 n="$tmp_n"
2984 c="$tmp_c"
85cad39c 2985 : Older versions did not always set $sh. Catch re-use of such
2986 : an old config.sh.
2987 case "$sh" in
2988 '') sh="$tmp_sh" ;;
2989 esac
2304df62
AD
2990 hint=previous
2991 ;;
2992 esac
2993fi
2573c5f9 2994. ./UU/checkcc
2304df62
AD
2995if test ! -f config.sh; then
2996 $cat <<EOM
2997
4e2a5f63
AD
2998First time through, eh? I have some defaults handy for some systems
2999that need some extra help getting the Configure answers right:
2304df62
AD
3000
3001EOM
dfe9444c 3002 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3003 dflt=''
3004 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3005 : tests or hints, please send them to perlbug@perl.org
2304df62 3006 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3007 $test -f /irix && osname=irix
85e6fe83
LW
3008 $test -f /xenix && osname=sco_xenix
3009 $test -f /dynix && osname=dynix
3010 $test -f /dnix && osname=dnix
5f05dabc 3011 $test -f /lynx.os && osname=lynxos
3012 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3013 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3014 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3015 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3016 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3017 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3018 $test -d /usr/apollo/bin && osname=apollo
3019 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3020 $test -d /usr/include/minix && osname=minix
d54344fc 3021 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3022 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3023 osname=machten
4633a7c4 3024 if $test -x /sbin/version; then
dfe9444c 3025 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3026 $sed -e 's/[A-Za-z]$//'`
3027 elif $test -x /usr/etc/version; then
dfe9444c 3028 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3029 $sed -e 's/[A-Za-z]$//'`
3030 else
3031 osvers="$2.$3"
3032 fi
3033 fi
aaacdc8b
GS
3034
3035 $test -f /sys/posix.dll &&
3036 $test -f /usr/bin/what &&
3037 set X `/usr/bin/what /sys/posix.dll` &&
3038 $test "$3" = UWIN &&
3039 osname=uwin &&
3040 osvers="$5"
3041
2304df62
AD
3042 if $test -f $uname; then
3043 set X $myuname
3044 shift
3045
2304df62 3046 case "$5" in
85e6fe83 3047 fps*) osname=fps ;;
2304df62
AD
3048 mips*)
3049 case "$4" in
85e6fe83
LW
3050 umips) osname=umips ;;
3051 *) osname=mips ;;
2304df62 3052 esac;;
85e6fe83
LW
3053 [23]100) osname=mips ;;
3054 next*) osname=next ;;
ecfc5424 3055 i386*)
c6912327
JH
3056 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3057 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3058 osname='sco'
3059 osvers=$tmp
3060 elif $test -f /etc/kconfig; then
ecfc5424 3061 osname=isc
bd628c73 3062 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3063 osvers=4
3064 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3065 osvers=3
2304df62 3066 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3067 osvers=2
ecfc5424
AD
3068 fi
3069 fi
2000072c 3070 tmp=''
ecfc5424 3071 ;;
c4f23d77
AD
3072 pc*)
3073 if test -n "$DJGPP"; then
3074 osname=dos
3075 osvers=djgpp
3076 fi
3077 ;;
2304df62
AD
3078 esac
3079
3080 case "$1" in
a0d0e21e
LW
3081 aix) osname=aix
3082 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3083 case "$tmp" in
1aef975c 3084 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
3085 '<3240'|'<>3240') osvers=3.2.0 ;;
3086 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3087 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3088 *) osvers=$tmp;;
a0d0e21e
LW
3089 esac
3090 ;;
aaacdc8b
GS
3091 bsd386) osname=bsd386
3092 osvers=`$uname -r`
3093 ;;
3094 cygwin*) osname=cygwin
3095 osvers="$3"
3096 ;;
23f87696
SZ
3097 *dc.osx) osname=dcosx
3098 osvers="$3"
3099 ;;
a0d0e21e
LW
3100 dnix) osname=dnix
3101 osvers="$3"
3102 ;;
3103 domainos) osname=apollo
3104 osvers="$3"
3105 ;;
3106 dgux) osname=dgux
3107 osvers="$3"
3108 ;;
760ac839 3109 dynixptx*) osname=dynixptx
e58e581d 3110 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3111 ;;
a0d0e21e
LW
3112 freebsd) osname=freebsd
3113 osvers="$3" ;;
3114 genix) osname=genix ;;
3115 hp*) osname=hpux
bfb7748a 3116 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3117 ;;
a78b0d02 3118 irix*) osname=irix
a0d0e21e
LW
3119 case "$3" in
3120 4*) osvers=4 ;;
3121 5*) osvers=5 ;;
ecfc5424 3122 *) osvers="$3" ;;
a0d0e21e
LW
3123 esac
3124 ;;
3125 linux) osname=linux
3126 case "$3" in
a0d0e21e
LW
3127 *) osvers="$3" ;;
3128 esac
3129 ;;
28e8609d
JH
3130 MiNT) osname=mint
3131 ;;
3132 netbsd*) osname=netbsd
ecfc5424
AD
3133 osvers="$3"
3134 ;;
4e81affe
MM
3135 news-os) osvers="$3"
3136 case "$3" in
3137 4*) osname=newsos4 ;;
3138 *) osname=newsos ;;
3139 esac
3140 ;;
aaacdc8b 3141 next*) osname=next ;;
28bb1e2c 3142 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3143 openbsd) osname=openbsd
3144 osvers="$3"
3145 ;;
5c728af0
IZ
3146 os2) osname=os2
3147 osvers="$4"
3148 ;;
aaacdc8b
GS
3149 POSIX-BC | posix-bc ) osname=posix-bc
3150 osvers="$3"
a0d0e21e 3151 ;;
ae3afa4e
TH
3152 powerux | power_ux | powermax_os | powermaxos | \
3153 powerunix | power_unix) osname=powerux
3154 osvers="$3"
3155 ;;
aaacdc8b
GS
3156 qnx) osname=qnx
3157 osvers="$4"
3158 ;;
a0d0e21e
LW
3159 solaris) osname=solaris
3160 case "$3" in
3161 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3162 *) osvers="$3" ;;
a0d0e21e
LW
3163 esac
3164 ;;
85e6fe83
LW
3165 sunos) osname=sunos
3166 case "$3" in
85e6fe83
LW
3167 5*) osname=solaris
3168 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3169 *) osvers="$3" ;;
2304df62
AD
3170 esac
3171 ;;
a0d0e21e 3172 titanos) osname=titanos
85e6fe83 3173 case "$3" in
a0d0e21e
LW
3174 1*) osvers=1 ;;
3175 2*) osvers=2 ;;
3176 3*) osvers=3 ;;
3177 4*) osvers=4 ;;
ecfc5424 3178 *) osvers="$3" ;;
2304df62
AD
3179 esac
3180 ;;
85e6fe83 3181 ultrix) osname=ultrix
ecfc5424 3182 osvers="$3"
2304df62 3183 ;;
28757baa 3184 osf1|mls+) case "$5" in
fed7345c
AD
3185 alpha)
3186 osname=dec_osf
fdd85a03 3187 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3188 case "$osvers" in
3189 [1-9].[0-9]*) ;;
3190 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3191 esac
ecfc5424
AD
3192 ;;
3193 hp*) osname=hp_osf1 ;;
3194 mips) osname=mips_osf1 ;;
85e6fe83
LW
3195 esac
3196 ;;
af1ff193 3197 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3198 openunix|unixware) osname=svr5
0337d152
BG
3199 osvers="$4"
3200 ;;
3c728e00 3201 uts) osname=uts
a0d0e21e
LW
3202 osvers="$3"
3203 ;;
3c728e00
JH
3204 vos) osvers="$3"
3205 ;;
85e6fe83 3206 $2) case "$osname" in
2304df62 3207 *isc*) ;;
a0d0e21e 3208 *freebsd*) ;;
5f05dabc 3209 svr*)
a0d0e21e
LW
3210 : svr4.x or possibly later
3211 case "svr$3" in
3212 ${osname}*)
3213 osname=svr$3
3214 osvers=$4
3215 ;;
3216 esac
3217 case "$osname" in
3218 svr4.0)
3219 : Check for ESIX
3220 if test -f /stand/boot ; then
3221 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3222 if test -n "$INITPROG" -a -f "$INITPROG"; then
3223 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3224 if test -n "$isesix"; then
a0d0e21e
LW
3225 osname=esix4
3226 fi
3227 fi
3228 fi
3229 ;;
3230 esac
3231 ;;
2304df62 3232 *) if test -f /etc/systemid; then
a0d0e21e
LW
3233 osname=sco
3234 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3235 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3236 osvers=$1.$2.$3
c4f23d77 3237 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3238 osvers=$1.$2
c4f23d77 3239 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3240 osvers=$1
2304df62 3241 fi
a0d0e21e
LW
3242 else
3243 case "$osname" in
3244 '') : Still unknown. Probably a generic Sys V.
3245 osname="sysv"
3246 osvers="$3"
3247 ;;
3248 esac
2304df62
AD
3249 fi
3250 ;;
3251 esac
3252 ;;
a0d0e21e
LW
3253 *) case "$osname" in
3254 '') : Still unknown. Probably a generic BSD.
3255 osname="$1"
3256 osvers="$3"
3257 ;;
3258 esac
3259 ;;
2304df62
AD
3260 esac
3261 else
dfe9444c
AD
3262 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3263 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3264 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3265 osname=news_os
2304df62 3266 fi
dfe9444c 3267 $rm -f UU/kernel.what
5c728af0 3268 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3269 set X $myuname
3270 osname=os2
3271 osvers="$5"
2304df62
AD
3272 fi
3273 fi
85e6fe83 3274
5440bc8e
JH
3275 case "$targetarch" in
3276 '') ;;
3277 *) hostarch=$osname
3278 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3279 osvers=''
3280 ;;
3281 esac
3282
a0d0e21e
LW
3283 : Now look for a hint file osname_osvers, unless one has been
3284 : specified already.
3285 case "$hintfile" in
3286 ''|' ')
1e127011 3287 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3288 : Also try without trailing minor version numbers.
1e127011
DD
3289 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3290 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3291 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3292 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3293 case "$file" in
3294 '') dflt=none ;;
3295 *) case "$osvers" in
3296 '') dflt=$file
3297 ;;
dfe9444c 3298 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3299 dflt=$file
dfe9444c 3300 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3301 dflt=$xfile
dfe9444c 3302 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3303 dflt=$xxfile
dfe9444c 3304 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3305 dflt=$xxxfile
dfe9444c 3306 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3307 dflt=$xxxxfile
dfe9444c 3308 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3309 dflt="${osname}"
3310 else
3311 dflt=none
3312 fi
3313 ;;
3314 esac
85e6fe83
LW
3315 ;;
3316 esac
4e2a5f63
AD
3317 if $test -f Policy.sh ; then
3318 case "$dflt" in
3319 *Policy*) ;;
3320 none) dflt="Policy" ;;
3321 *) dflt="Policy $dflt" ;;
3322 esac
3323 fi
85e6fe83 3324 ;;
a0d0e21e 3325 *)
ecfc5424 3326 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3327 ;;
2304df62 3328 esac
1aef975c 3329
4e2a5f63
AD
3330 if $test -f Policy.sh ; then
3331 $cat <<EOM
3332
3333There's also a Policy hint file available, which should make the
3334site-specific (policy) questions easier to answer.
3335EOM
3336
3337 fi
3338
2304df62
AD
3339 $cat <<EOM
3340
3341You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 3342A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 3343is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
3344
3345EOM
4e2a5f63 3346
2304df62 3347 rp="Which of these apply, if any?"
dfe9444c 3348 . UU/myread
85e6fe83
LW
3349 tans=$ans
3350 for file in $tans; do
4e2a5f63
AD
3351 if $test X$file = XPolicy -a -f Policy.sh; then
3352 . Policy.sh
3353 $cat Policy.sh >> UU/config.sh
3354 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3355 . $src/hints/$file.sh
3356 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3357 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3358 : nothing
3359 else
85e6fe83
LW
3360 : Give one chance to correct a possible typo.
3361 echo "$file.sh does not exist"
3362 dflt=$file
3363 rp="hint to use instead?"
dfe9444c 3364 . UU/myread
85e6fe83 3365 for file in $ans; do
dfe9444c
AD
3366 if $test -f "$src/hints/$file.sh"; then
3367 . $src/hints/$file.sh
3368 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3369 elif $test X$ans = X -o X$ans = Xnone ; then
3370 : nothing
3371 else
3372 echo "$file.sh does not exist -- ignored."
3373 fi
3374 done
2304df62
AD
3375 fi
3376 done
85e6fe83 3377
2304df62 3378 hint=recommended
85e6fe83 3379 : Remember our hint file for later.
dfe9444c 3380 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3381 hintfile="$file"
85e6fe83 3382 else
a0d0e21e 3383 hintfile=''
85e6fe83 3384 fi
2304df62
AD
3385fi
3386cd UU
3387;;
3388*)
3389 echo " "
3390 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3391 tmp_n="$n"
3392 tmp_c="$c"
2304df62
AD
3393 cd ..
3394 cp $config_sh config.sh 2>/dev/null
a78b0d02 3395 chmod +w config.sh
2304df62
AD
3396 . ./config.sh
3397 cd UU
3398 cp ../config.sh .
ecfc5424
AD
3399 n="$tmp_n"
3400 c="$tmp_c"
2304df62
AD
3401 hint=previous
3402 ;;
3403esac
1aef975c 3404test "$override" && . ./optdef.sh
2304df62
AD
3405
3406: Restore computed paths
3407for file in $loclist $trylist; do
3408 eval $file="\$_$file"
3409done
3410
85e6fe83 3411cat << EOM
a0d0e21e 3412
85e6fe83 3413Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3414The default value is probably right if the name rings a bell. Otherwise,
3415since spelling matters for me, either accept the default or answer "none"
3416to leave it blank.
a0d0e21e 3417
85e6fe83 3418EOM
85e6fe83 3419case "$osname" in
a0d0e21e 3420 ''|' ')
85e6fe83 3421 case "$hintfile" in
a0d0e21e 3422 ''|' '|none) dflt=none ;;
ecfc5424 3423 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3424 esac
3425 ;;
3426 *) dflt="$osname" ;;
3427esac
3428rp="Operating system name?"
3429. ./myread
3430case "$ans" in
ecfc5424
AD
3431none) osname='' ;;
3432*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3433esac
8ff267be 3434echo " "
3435case "$osvers" in
3436 ''|' ')
3437 case "$hintfile" in
3438 ''|' '|none) dflt=none ;;
3439 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3440 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3441 case "$dflt" in
3442 ''|' ') dflt=none ;;
3443 esac
3444 ;;
3445 esac
3446 ;;
3447 *) dflt="$osvers" ;;
3448esac
3449rp="Operating system version?"
3450. ./myread
3451case "$ans" in
3452none) osvers='' ;;
3453*) osvers="$ans" ;;
3454esac
3455
02e93a22
JH
3456
3457. ./posthint.sh
3458
2304df62 3459: who configured the system
59b83a6f 3460cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
8ff267be 3461cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
3462case "$cf_by" in
3463"")
8ff267be 3464 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
3465 case "$cf_by" in
3466 "") cf_by=unknown ;;
8ff267be 3467 esac ;;
3468esac
2304df62 3469
b4eb6b3d
JH
3470: set up the script used to warn in case of inconsistency
3471cat <<EOS >whoa
3472$startsh
3473EOS
3474cat <<'EOSC' >>whoa
3475dflt=y
3476echo " "
3477echo "*** WHOA THERE!!! ***" >&4
3478echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3479rp=" Keep the $hint value?"
3480. ./myread
3481case "$ans" in
3482y) td=$was; tu=$was;;
3483esac
3484EOSC
3485
3486: function used to set $1 to $val
3487setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3488case "$val$was" in
3489$define$undef) . ./whoa; eval "$var=\$td";;
3490$undef$define) . ./whoa; eval "$var=\$tu";;
3491*) eval "$var=$val";;
3492esac'
3493
b29b105d
JH
3494case "$usesocks" in
3495$define|true|[yY]*) dflt='y';;
3496*) dflt='n';;
3497esac
3498cat <<EOM
3499
3500Perl can be built to use the SOCKS proxy protocol library. To do so,
3501Configure must be run with -Dusesocks. If you use SOCKS you also need
3502to use the PerlIO abstraction layer, this will be implicitly selected.
3503
3504If this doesn't make any sense to you, just accept the default '$dflt'.
3505EOM
3506rp='Build Perl for SOCKS?'
3507. ./myread
3508case "$ans" in
3509y|Y) val="$define" ;;
3510*) val="$undef" ;;
3511esac
3512set usesocks
3513eval $setvar
3514
3515case "$usesocks" in
3516$define|true|[yY]*) useperlio="$define";;
3517esac
3518
3519case "$useperlio" in
3520$define|true|[yY]*|'') dflt='y';;
3521*) dflt='n';;
3522esac
3523cat <<EOM
3524
3525Previous version of $package used the standard IO mechanisms as
3526defined in <stdio.h>. Versions 5.003_02 and later of $package allow
3527alternate IO mechanisms via the PerlIO abstraction layer, but the
3528stdio mechanism is still available if needed. The abstraction layer
3529can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3530Using PerlIO with sfio may cause problems with some extension modules.
3531
3532If this doesn't make any sense to you, just accept the default '$dflt'.
3533EOM
3534rp='Use the PerlIO abstraction layer?'
3535. ./myread
3536case "$ans" in
3537y|Y)
3538 val="$define"
3539 ;;
3540*)
3541 echo "Ok, doing things the stdio way."
3542 val="$undef"
3543 ;;
3544esac
3545set useperlio
3546eval $setvar
3547
3548case "$usesocks" in
3549$define|true|[yY]*)
3550 case "$useperlio" in
3551 $define|true|[yY]*) ;;
3552 *) cat >&4 <<EOM
3553
3554You are using the SOCKS proxy protocol library which means that you
3555should also use the PerlIO layer. You may be headed for trouble.
3556
3557EOM
3558 ;;
3559 esac
3560 ;;
3561esac
3562
3563
b4eb6b3d
JH
3564case "$usethreads" in
3565$define|true|[yY]*) dflt='y';;
8e285145
AD
3566*) # Catch case where user specified ithreads or 5005threads but
3567 # forgot -Dusethreads (A.D. 4/2002)
3568 case "$useithreads$use5005threads" in
b29b105d
JH
3569 *$define*)
3570 case "$useperlio" in
3571 "$define") dflt='y' ;;
3572 *) dflt='n' ;;
3573 esac
3574 ;;
3575 *) dflt='n';;
8e285145
AD
3576 esac
3577 ;;
b4eb6b3d
JH
3578esac
3579cat <<EOM
3580
3581Perl can be built to take advantage of threads on some systems.
3582To do so, Configure can be run with -Dusethreads.
3583
bfce6503
DM
3584Note that Perl built with threading support runs slightly slower
3585and uses more memory than plain Perl. The current implementation
3586is believed to be stable, but it is fairly new, and so should be
3587treated with caution.
b4eb6b3d
JH
3588
3589If this doesn't make any sense to you, just accept the default '$dflt'.
3590EOM
3591rp='Build a threading Perl?'
3592. ./myread
3593case "$ans" in
3594y|Y) val="$define" ;;
3595*) val="$undef" ;;
3596esac
3597set usethreads
3598eval $setvar
3599
3600case "$usethreads" in
3601$define)
3602 $cat <<EOM
3603
bfce6503
DM
3604Since release 5.6, Perl has had two different threading implementations,
3605the newer interpreter-based version (ithreads) with one interpreter per
3606thread, and the older 5.005 version (5005threads).
3607The 5005threads version is effectively unmaintained and will probably be
3608removed in Perl 5.10, so there should be no need to build a Perl using it
3609unless needed for backwards compatibility with some existing 5.005threads
3610code.
b4eb6b3d 3611
b4eb6b3d
JH
3612EOM
3613 : Default to ithreads unless overridden on command line or with
3614 : old config.sh
3615 dflt='y'
3616 case "$use5005threads" in
3617 $define|true|[yY]*) dflt='n';;
3618 esac
3619 case "$useithreads" in
3620 $undef|false|[nN]*) dflt='n';;
3621 esac
bfce6503 3622 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
3623 . ./myread
3624 case "$ans" in
3625 y|Y) val="$define" ;;
3626 *) val="$undef" ;;
3627 esac
3628 set useithreads
3629 eval $setvar
3630 : Now set use5005threads to the opposite value.
3631 case "$useithreads" in
3632 $define) val="$undef" ;;
3633 *) val="$define" ;;
3634 esac
3635 set use5005threads
3636 eval $setvar
3637 ;;
3638*)
3639 useithreads="$undef"
3640 use5005threads="$undef"
3641 ;;
3642esac
3643
c915ce7f
JH
3644case "$useithreads$use5005threads" in
3645"$define$define")
3646 $cat >&4 <<EOM
3647
3648You cannot have both the ithreads and the 5.005 threads enabled
3649at the same time. Disabling the 5.005 threads since they are
3650much less stable than the ithreads.
3651
3652EOM
3653 use5005threads="$undef"
3654 ;;
3655esac
3656
b29b105d
JH
3657if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3658 cat >&4 <<EOF
3659***
3660*** To build with ithreads you must also use the PerlIO layer.
3661*** Cannot continue, aborting.
3662***
3663EOF
3664 exit 1
3665fi
3666
b4eb6b3d
JH
3667case "$d_oldpthreads" in
3668'') : Configure tests would be welcome here. For now, assume undef.
3669 val="$undef" ;;
3670*) val="$d_oldpthreads" ;;
3671esac
3672set d_oldpthreads
3673eval $setvar
3674
3675
3676case "$usethreads" in
3677"$define"|true|[yY]*)
3678: Look for a hint-file generated 'call-back-unit'. If the
3679: user has specified that a threading perl is to be built,
3680: we may need to set or change some other defaults.
3681 if $test -f usethreads.cbu; then
3682 echo "Your platform has some specific hints for threaded builds, using them..."
3683 . ./usethreads.cbu
3684 else
3685 $cat <<EOM
3686(Your platform doesn't have any specific hints for threaded builds.
3687 Assuming POSIX threads, then.)
3688EOM
3689 fi
3690 ;;
3691esac
3692
3693cat <<EOM
3694
3695Perl can be built so that multiple Perl interpreters can coexist
3696within the same Perl executable.
3697EOM
3698
3699case "$useithreads" in
3700$define)
3701 cat <<EOM
3702This multiple interpreter support is required for interpreter-based threads.
3703EOM
3704 val="$define"
3705 ;;
3706*) case "$usemultiplicity" in
3707 $define|true|[yY]*) dflt='y';;
3708 *) dflt='n';;
3709 esac
3710 echo " "
3711 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3712 rp='Build Perl for multiplicity?'
3713 . ./myread
3714 case "$ans" in
3715 y|Y) val="$define" ;;
3716 *) val="$undef" ;;
3717 esac
3718 ;;
3719esac
3720set usemultiplicity
3721eval $setvar
3722
96056487
JH
3723
3724case "$usemorebits" in
3725"$define"|true|[yY]*)
3726 use64bitint="$define"
3727 uselongdouble="$define"
3728 usemorebits="$define"
3729 ;;
3730*) usemorebits="$undef"
3731 ;;
3732esac
3733
e5e20432
JH
3734: make some quick guesses about what we are up against
3735echo " "
3736$echo $n "Hmm... $c"
3737echo exit 1 >bsd
3738echo exit 1 >usg
3739echo exit 1 >v7
3740echo exit 1 >osf1
3741echo exit 1 >eunice
3742echo exit 1 >xenix
3743echo exit 1 >venix
3744echo exit 1 >os2
3745d_bsd="$undef"
3746$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3747if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3748then
3749 echo "Looks kind of like an OSF/1 system, but we'll see..."
3750 echo exit 0 >osf1
381aa1ff 3751elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3752 xxx=`./loc addbib blurfl $pth`
3753 if $test -f $xxx; then
3754 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3755 echo exit 0 >bsd
3756 echo exit 0 >usg
3757 else
3758 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3759 echo "Looks kind of like an extended USG system, but we'll see..."
3760 else
3761 echo "Looks kind of like a USG system, but we'll see..."
3762 fi
3763 echo exit 0 >usg
3764 fi
3765elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3766 echo "Looks kind of like a BSD system, but we'll see..."
3767 d_bsd="$define"
3768 echo exit 0 >bsd
3769else
3770 echo "Looks kind of like a Version 7 system, but we'll see..."
3771 echo exit 0 >v7
3772fi
3773case "$eunicefix" in
3774*unixtovms*)
3775 $cat <<'EOI'
3776There is, however, a strange, musty smell in the air that reminds me of
3777something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3778EOI
3779 echo exit 0 >eunice
3780 d_eunice="$define"
3781: it so happens the Eunice I know will not run shell scripts in Unix format
3782 ;;
3783*)
3784 echo " "
3785 echo "Congratulations. You aren't running Eunice."
3786 d_eunice="$undef"
3787 ;;
3788esac
3789: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3790: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3791: semicolon as a patch separator
e5e20432
JH
3792case "$p_" in
3793:) ;;
3794*)
3795 $cat <<'EOI'
3796I have the feeling something is not exactly right, however...don't tell me...
3797lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3798(Or you may be running DOS with DJGPP.)
e5e20432
JH
3799EOI
3800 echo exit 0 >os2
3801 ;;
3802esac
3803if test -f /xenix; then
3804 echo "Actually, this looks more like a XENIX system..."
3805 echo exit 0 >xenix
3806 d_xenix="$define"
3807else
3808 echo " "
3809 echo "It's not Xenix..."
3810 d_xenix="$undef"
3811fi
3812chmod +x xenix
3813$eunicefix xenix
3814if test -f /venix; then
3815 echo "Actually, this looks more like a VENIX system..."
3816 echo exit 0 >venix
3817else
3818 echo " "
3819 if ./xenix; then
3820 : null
3821 else
3822 echo "Nor is it Venix..."
3823 fi
3824fi
3825chmod +x bsd usg v7 osf1 eunice xenix venix os2
3826$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3827$rm -f foo
3828
5869b1f1
JH
3829case "$cc" in
3830'') dflt=cc;;
3831*) dflt="$cc";;
3832esac
3833rp="Use which C compiler?"
3834. ./myread
3835cc="$ans"
6b769f8f
RB
3836
3837: See if they have not cc but they do have gcc
3838. ./trygcc
e5e20432
JH
3839: Look for a hint-file generated 'call-back-unit'. Now that the
3840: user has specified the compiler, we may need to set or change some
3841: other defaults.
3842if $test -f cc.cbu; then
3843 . ./cc.cbu
3844fi
2573c5f9 3845. ./checkcc
8a27cf78 3846
e5e20432
JH
3847echo " "
3848echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 3849$cat >try.c <<EOM
e5e20432
JH
3850#include <stdio.h>
3851int main() {
3852#ifdef __GNUC__
3853#ifdef __VERSION__
3854 printf("%s\n", __VERSION__);
3855#else
3856 printf("%s\n", "1");
3857#endif
3858#endif
073b6de5 3859 return(0);
e5e20432
JH
3860}
3861EOM
5440bc8e
JH
3862if $cc -o try $ccflags $ldflags try.c; then
3863 gccversion=`$run ./try`
e5e20432
JH
3864 case "$gccversion" in
3865 '') echo "You are not using GNU cc." ;;
fc68435e 3866 *) echo "You are using GNU cc $gccversion."
48fe685d 3867 ccname=gcc
fc68435e 3868 ;;
e5e20432
JH
3869 esac
3870else
3871 echo " "
3872 echo "*** WHOA THERE!!! ***" >&4
3873 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3874 case "$knowitall" in
3875 '')
3876 echo " You'd better start hunting for one and let me know about it." >&4
3877 exit 1
3878 ;;
3879 esac
3880fi
5440bc8e 3881$rm -f try try.*
e5e20432
JH
3882case "$gccversion" in
38831*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3884esac
5b463ca7
KS
3885case "$gccversion" in
3886'') gccosandvers='' ;;
10b4ebb5
JH
3887*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3888 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3889 gccshortvers=''
5b463ca7 3890 case "$gccosandvers" in
02903077
JH
3891 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3892 $osname$osvers) ;; # looking good
5b463ca7
KS
3893 $osname*) cat <<EOM >&4
3894
3895*** WHOA THERE!!! ***
3896
3897 Your gcc has not been compiled for the exact release of
3898 your operating system ($gccosandvers versus $osname$osvers).
3899
3900 In general it is a good idea to keep gcc synchronized with
3901 the operating system because otherwise serious problems
3902 may ensue when trying to compile software, like Perl.
3903
3904 I'm trying to be optimistic here, though, and will continue.
3905 If later during the configuration and build icky compilation
02903077
JH
3906 problems appear (headerfile conflicts being the most common
3907 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3908 your operating system release.
3909
3910EOM
3911 ;;
81575342 3912 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3913 esac
3914 ;;
3915esac
e723fc21
JH
3916case "$ccname" in
3917'') ccname="$cc" ;;
3918esac
e5e20432 3919
224cb7cb 3920# gcc 3.* complain about adding -Idirectories that they already know about,
76589481
JH
3921# so we will take those off from locincpth.
3922case "$gccversion" in
39233*)
3924 echo "main(){}">try.c
224cb7cb
JH
3925 for incdir in $locincpth; do
3926 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
48fe685d 3927 grep '^c[cp]p*[01]: warning: changing search order '`
224cb7cb 3928 if test "X$warn" != X; then
44b94491 3929 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
224cb7cb 3930 fi
76589481
JH
3931 done
3932 $rm -f try try.*
3933esac
640374d0 3934
bd9b35c9
JH
3935: decide how portable to be. Allow command line overrides.
3936case "$d_portable" in
3937"$undef") ;;
3938*) d_portable="$define" ;;
104d25b7 3939esac
85ab1d1d 3940
bd9b35c9
JH
3941: set up shell script to do ~ expansion
3942cat >filexp <<EOSS
3943$startsh
3944: expand filename
3945case "\$1" in
3946 ~/*|~)
3947 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3948 ;;
3949 ~*)
3950 if $test -f /bin/csh; then
3951 /bin/csh -f -c "glob \$1"
3952 failed=\$?
3953 echo ""
3954 exit \$failed
e5e20432 3955 else
bd9b35c9
JH
3956 name=\`$expr x\$1 : '..\([^/]*\)'\`
3957 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3958 if $test ! -d "\$dir"; then
3959 me=\`basename \$0\`
3960 echo "\$me: can't locate home directory for: \$name" >&2
3961 exit 1
3962 fi
3963 case "\$1" in
3964 */*)
3965 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3966 ;;
3967 *)
3968 echo \$dir
e5e20432
JH
3969 ;;
3970 esac
3971 fi
b691c02f 3972 ;;
4633a7c4 3973*)
bd9b35c9 3974 echo \$1
2304df62
AD
3975 ;;
3976esac
4633a7c4
LW
3977EOSS
3978chmod +x filexp
3979$eunicefix filexp
2304df62
AD
3980
3981: now set up to get a file name
28757baa 3982cat <<EOS >getfile
3983$startsh
3984EOS
3985cat <<'EOSC' >>getfile
2304df62
AD
3986tilde=''
3987fullpath=''
3988already=''
3989skip=''
3990none_ok=''
3991exp_file=''
a0d0e21e 3992nopath_ok=''
2304df62
AD
3993orig_rp="$rp"
3994orig_dflt="$dflt"
b233458b
JH
3995case "$gfpth" in
3996'') gfpth='.' ;;
3997esac
2304df62
AD
3998
3999case "$fn" in
ecfc5424 4000*\(*)
d604bb53
JH
4001 : getfile will accept an answer from the comma-separated list
4002 : enclosed in parentheses even if it does not meet other criteria.
4003 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
4004 fn=`echo $fn | sed 's/(.*)//'`
4005 ;;
4006esac
4007
4008case "$fn" in
a0d0e21e
LW
4009*:*)
4010 loc_file=`expr $fn : '.*:\(.*\)'`
4011 fn=`expr $fn : '\(.*\):.*'`
4012 ;;
4013esac
4014
4015case "$fn" in
2304df62
AD
4016*~*) tilde=true;;
4017esac
4018case "$fn" in
4019*/*) fullpath=true;;
4020esac
4021case "$fn" in
4022*+*) skip=true;;
4023esac
4024case "$fn" in
4025*n*) none_ok=true;;
4026esac
4027case "$fn" in
4028*e*) exp_file=true;;
4029esac
a0d0e21e
LW
4030case "$fn" in
4031*p*) nopath_ok=true;;
4032esac
2304df62
AD
4033
4034case "$fn" in
4035*f*) type='File';;
4036*d*) type='Directory';;
a0d0e21e 4037*l*) type='Locate';;
2304df62
AD
4038esac
4039
4040what="$type"
4041case "$what" in
4042Locate) what='File';;
4043esac
4044
4045case "$exp_file" in
4046'')
4047 case "$d_portable" in
4048 "$define") ;;
4049 *) exp_file=true;;
4050 esac
4051 ;;
4052esac
4053
4054cd ..
4055while test "$type"; do
4056 redo=''
4057 rp="$orig_rp"
4058 dflt="$orig_dflt"
4059 case "$tilde" in
4060 true) rp="$rp (~name ok)";;
4061 esac
4062 . UU/myread
ecfc5424
AD
4063 if test -f UU/getfile.ok && \
4064 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4065 then
4066 value="$ans"
4067 ansexp="$ans"
4068 break
4069 fi
2304df62
AD
4070 case "$ans" in
4071 none)
4072 value=''
4073 ansexp=''
4074 case "$none_ok" in
4075 true) type='';;
4076 esac
4077 ;;
4078 *)
4079 case "$tilde" in
4080 '') value="$ans"
4081 ansexp="$ans";;
4082 *)
4083 value=`UU/filexp $ans`
4084 case $? in
4085 0)
4086 if test "$ans" != "$value"; then
ecfc5424 4087 echo "(That expands to $value on this system.)"
2304df62
AD
4088 fi
4089 ;;
4090 *) value="$ans";;
4091 esac
4092 ansexp="$value"
4093 case "$exp_file" in
4094 '') value="$ans";;
4095 esac
4096 ;;
4097 esac
4098 case "$fullpath" in
4099 true)
4100 case "$ansexp" in
4101 /*) value="$ansexp" ;;
23da6c43 4102 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
4103 *)
4104 redo=true
4105 case "$already" in
4106 true)
4107 echo "I shall only accept a full path name, as in /bin/ls." >&4
4108 echo "Use a ! shell escape if you wish to check pathnames." >&4
4109 ;;
4110 *)
4111 echo "Please give a full path name, starting with slash." >&4
4112 case "$tilde" in
4113 true)
4114 echo "Note that using ~name is ok provided it expands well." >&4
4115 already=true
4116 ;;
4117 esac
4118 esac
4119 ;;
4120 esac
4121 ;;
4122 esac
4123 case "$redo" in
4124 '')
4125 case "$type" in
4126 File)
b233458b
JH
4127 for fp in $gfpth; do
4128 if test "X$fp" = X.; then
4129 pf="$ansexp"
4130 else
4131 pf="$fp/$ansexp"
4132 fi
4133 if test -f "$pf"; then
4134 type=''
4135 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4136 then
4137 echo "($value is not a plain file, but that's ok.)"
4138 type=''
4139 fi
4140 if test X"$type" = X; then
4141 value="$pf"
4142 break
4143 fi
4144 done
2304df62
AD
4145 ;;
4146 Directory)
b233458b
JH
4147 for fp in $gfpth; do
4148 if test "X$fp" = X.; then
f78bfc9c
JH
4149 dir="$ans"
4150 direxp="$ansexp"
b233458b 4151 else
dd858076 4152 dir="$fp/$ansexp"
f78bfc9c 4153 direxp="$fp/$ansexp"
b233458b 4154 fi
f78bfc9c 4155 if test -d "$direxp"; then
b233458b 4156 type=''
f78bfc9c 4157 value="$dir"
b233458b
JH
4158 break
4159 fi
4160 done
2304df62
AD
4161 ;;
4162 Locate)
40000a8c 4163 if test -d "$ansexp"; then
a0d0e21e
LW
4164 echo "(Looking for $loc_file in directory $value.)"
4165 value="$value/$loc_file"
40000a8c 4166 ansexp="$ansexp/$loc_file"
2304df62 4167 fi
40000a8c 4168 if test -f "$ansexp"; then
2304df62
AD
4169 type=''
4170 fi
a0d0e21e
LW
4171 case "$nopath_ok" in
4172 true) case "$value" in
4173 */*) ;;
4174 *) echo "Assuming $value will be in people's path."
4175 type=''
4176 ;;
4177 esac
4178 ;;
4179 esac
2304df62
AD
4180 ;;
4181 esac
4182
4183 case "$skip" in
4184 true) type='';
4185 esac
4186
4187 case "$type" in
4188 '') ;;
4189 *)
4190 if test "$fastread" = yes; then
4191 dflt=y
4192 else
4193 dflt=n
4194 fi
4195 rp="$what $value doesn't exist. Use that name anyway?"
4196 . UU/myread
4197 dflt=''
4198 case "$ans" in
4199 y*) type='';;
4200 *) echo " ";;
4201 esac
4202 ;;
4203 esac
4204 ;;
4205 esac
4206 ;;
4207 esac
4208done
4209cd UU
4210ans="$value"
4211rp="$orig_rp"
4212dflt="$orig_dflt"
ecfc5424 4213rm -f getfile.ok
b233458b 4214test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
4215EOSC
4216
bd9b35c9
JH
4217: What should the include directory be ?
4218echo " "
4219$echo $n "Hmm... $c"
4220dflt='/usr/include'
4221incpath=''
4222mips_type=''
4223if $test -f /bin/mips && /bin/mips; then
4224 echo "Looks like a MIPS system..."
4225 $cat >usr.c <<'EOCP'
4226#ifdef SYSTYPE_BSD43
4227/bsd43
4228#endif
4229EOCP
8a27cf78 4230 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4231 dflt='/bsd43/usr/include'
4232 incpath='/bsd43'
4233 mips_type='BSD 4.3'
4234 else
4235 mips_type='System V'
4236 fi
4237 $rm -f usr.c usr.out
4238 echo "and you're compiling with the $mips_type compiler and libraries."
4239 xxx_prompt=y
4240 echo "exit 0" >mips
4241else
4242 echo "Doesn't look like a MIPS system."
4243 xxx_prompt=n
4244 echo "exit 1" >mips
4245fi
4246chmod +x mips
4247$eunicefix mips
4248case "$usrinc" in
4249'') ;;
4250*) dflt="$usrinc";;
4251esac
4252case "$xxx_prompt" in
4253y) fn=d/
4254 echo " "
4255 rp='Where are the include files you want to use?'
4256 . ./getfile
4257 usrinc="$ans"
8e07c86e 4258 ;;
bd9b35c9 4259*) usrinc="$dflt"
8e07c86e
AD
4260 ;;
4261esac
2304df62 4262
96056487
JH
4263: see how we invoke the C preprocessor
4264echo " "
4265echo "Now, how can we feed standard input to your C preprocessor..." >&4
4266cat <<'EOT' >testcpp.c
4267#define ABC abc
4268#define XYZ xyz
4269ABC.XYZ
4270EOT
4271cd ..
4272if test ! -f cppstdin; then
4273 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4274 # AIX cc -E doesn't show the absolute headerfile
4275 # locations but we'll cheat by using the -M flag.
4276 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
4277 else
4278 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4279 fi
4280else
4281 echo "Keeping your $hint cppstdin wrapper."
4282fi
4283chmod 755 cppstdin
4284wrapper=`pwd`/cppstdin
4285ok='false'
4286cd UU
4287
4288if $test "X$cppstdin" != "X" && \
4289 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4290 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4291then
4292 echo "You used to use $cppstdin $cppminus so we'll use that again."
4293 case "$cpprun" in
4294 '') echo "But let's see if we can live without a wrapper..." ;;
4295 *)
4296 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4297 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4298 then
4299 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4300 ok='true'
4301 else
4302 echo "(However, $cpprun $cpplast does not work, let's see...)"
4303 fi
4304 ;;
4305 esac
4306else
4307 case "$cppstdin" in
4308 '') ;;
4309 *)
4310 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4311 ;;
4312 esac
4313fi
4314
4315if $ok; then
4316 : nothing
4317elif echo 'Maybe "'"$cc"' -E" will work...'; \
4318 $cc -E <testcpp.c >testcpp.out 2>&1; \
4319 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4320 echo "Yup, it does."
4321 x_cpp="$cc -E"
4322 x_minus='';
4323elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4324 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4325 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4326 echo "Yup, it does."
4327 x_cpp="$cc -E"
4328 x_minus='-';
4329elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4330 $cc -P <testcpp.c >testcpp.out 2>&1; \
4331 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4332 echo "Yipee, that works!"
4333 x_cpp="$cc -P"
4334 x_minus='';
4335elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4336 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4337 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4338 echo "At long last!"
4339 x_cpp="$cc -P"
4340 x_minus='-';
4341elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4342 $cpp <testcpp.c >testcpp.out 2>&1; \
4343 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4344 echo "It works!"
4345 x_cpp="$cpp"
4346 x_minus='';
4347elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4348 $cpp - <testcpp.c >testcpp.out 2>&1; \
4349 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4350 echo "Hooray, it works! I was beginning to wonder."
4351 x_cpp="$cpp"
4352 x_minus='-';
4353elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4354 $wrapper <testcpp.c >testcpp.out 2>&1; \
4355 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4356 x_cpp="$wrapper"
4357 x_minus=''
4358 echo "Eureka!"
4359else
4360 dflt=''
4361 rp="No dice. I can't find a C preprocessor. Name one:"
4362 . ./myread
4363 x_cpp="$ans"
4364 x_minus=''
4365 $x_cpp <testcpp.c >testcpp.out 2>&1
4366 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4367 echo "OK, that will do." >&4
4368 else
4369echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4370 exit 1
4371 fi
4372fi
4373
4374case "$ok" in
4375false)
4376 cppstdin="$x_cpp"
4377 cppminus="$x_minus"
4378 cpprun="$x_cpp"
4379 cpplast="$x_minus"
4380 set X $x_cpp
4381 shift
4382 case "$1" in
4383 "$cpp")
4384 echo "Perhaps can we force $cc -E using a wrapper..."
4385 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4386 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4387 then
4388 echo "Yup, we can."
4389 cppstdin="$wrapper"
4390 cppminus='';
4391 else
4392 echo "Nope, we'll have to live without it..."
4393 fi
4394 ;;
4395 esac
4396 case "$cpprun" in
4397 "$wrapper")
4398 cpprun=''
4399 cpplast=''
4400 ;;
4401 esac
4402 ;;
4403esac
4404
4405case "$cppstdin" in
4406"$wrapper"|'cppstdin') ;;
4407*) $rm -f $wrapper;;
4408esac
4409$rm -f testcpp.c testcpp.out
4410
bd9b35c9
JH
4411: Set private lib path
4412case "$plibpth" in
4413'') if ./mips; then
4414 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4415 fi;;
4416esac
4417case "$libpth" in
4418' ') dlist='';;
4419'') dlist="$loclibpth $plibpth $glibpth";;
4420*) dlist="$libpth";;
4421esac
4422
4423: Now check and see which directories actually exist, avoiding duplicates
4424libpth=''
4425for xxx in $dlist
4426do
4427 if $test -d $xxx; then
4428 case " $libpth " in
4429 *" $xxx "*) ;;
4430 *) libpth="$libpth $xxx";;
4431 esac
4432 fi
4433done
4434$cat <<'EOM'
4435
4436Some systems have incompatible or broken versions of libraries. Among
4437the directories listed in the question below, please remove any you
4438know not to be holding relevant libraries, and add any that are needed.
4439Say "none" for none.
8e07c86e
AD
4440
4441EOM
bd9b35c9
JH
4442case "$libpth" in
4443'') dflt='none';;
8e07c86e 4444*)
bd9b35c9
JH
4445 set X $libpth
4446 shift
4447 dflt=${1+"$@"}
8e07c86e 4448 ;;
a0d0e21e 4449esac
bd9b35c9
JH
4450rp="Directories to use for library searches?"
4451. ./myread
4452case "$ans" in
4453none) libpth=' ';;
4454*) libpth="$ans";;
4455esac
a0d0e21e 4456
bd9b35c9
JH
4457: compute shared library extension
4458case "$so" in
4459'')
4460 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4461 dflt='sl'
dd4e71fd 4462 else
bd9b35c9 4463 dflt='so'
dd4e71fd
JH
4464 fi
4465 ;;
bd9b35c9 4466*) dflt="$so";;
dd4e71fd 4467esac
dd4e71fd
JH
4468$cat <<EOM
4469
bd9b35c9 4470On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4471you want to suppress searching of shared libraries for the remainder
bd9b35c9 4472of this configuration.
dd4e71fd
JH
4473
4474EOM
bd9b35c9
JH
4475rp='What is the file extension used for shared libraries?'
4476. ./myread
4477so="$ans"
dd4e71fd 4478
bd9b35c9
JH
4479: Define several unixisms.
4480: Hints files or command line option can be used to override them.
4481: The convoluted testing is in case hints files set either the old
4482: or the new name.
4483case "$_exe" in
4484'') case "$exe_ext" in
1fef16b3 4485 '') ;;
bd9b35c9 4486 *) _exe="$exe_ext" ;;
dd4e71fd 4487 esac
bd9b35c9 4488 ;;
bfb7748a 4489esac
bd9b35c9
JH
4490case "$_a" in
4491'') case "$lib_ext" in
4492 '') _a='.a';;
4493 *) _a="$lib_ext" ;;
dd4e71fd
JH
4494 esac
4495 ;;
dd4e71fd 4496esac
bd9b35c9
JH
4497case "$_o" in
4498'') case "$obj_ext" in
4499 '') _o='.o';;
4500 *) _o="$obj_ext";;
4501 esac
4502 ;;
4503esac
4504case "$p_" in
4505'') case "$path_sep" in
4506 '') p_=':';;
4507 *) p_="$path_sep";;
4508 esac
4509 ;;
4510esac
4511exe_ext=$_exe
4512lib_ext=$_a
4513obj_ext=$_o
4514path_sep=$p_
dd4e71fd 4515
b4eb6b3d
JH
4516: Which makefile gets called first. This is used by make depend.
4517case "$firstmakefile" in
4518'') firstmakefile='makefile';;
4633a7c4 4519esac
4633a7c4 4520
1f603089
JH
4521case "$ccflags" in
4522*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4523esac
4524
4525case "$uselongdouble" in
4526$define|true|[yY]*) dflt='y';;
4527*) dflt='n';;
4528esac
4529cat <<EOM
4530
4531Perl can be built to take advantage of long doubles which
4532(if available) may give more accuracy and range for floating point numbers.
4533
4534If this doesn't make any sense to you, just accept the default '$dflt'.
4535EOM
4536rp='Try to use long doubles if available?'
4537. ./myread
4538case "$ans" in
4539y|Y) val="$define" ;;
4540*) val="$undef" ;;
4541esac
4542set uselongdouble
4543eval $setvar
4544
4545case "$uselongdouble" in
4546true|[yY]*) uselongdouble="$define" ;;
4547esac
4548
4549case "$uselongdouble" in
4550$define)
4551: Look for a hint-file generated 'call-back-unit'. If the
4552: user has specified that long doubles should be used,
4553: we may need to set or change some other defaults.
4554 if $test -f uselongdouble.cbu; then
4555 echo "Your platform has some specific hints for long doubles, using them..."
4556 . ./uselongdouble.cbu
4557 else
4558 $cat <<EOM
4559(Your platform doesn't have any specific hints for long doubles.)
4560EOM
4561 fi
4562 ;;
4563esac
4564
bd9b35c9
JH
4565: Looking for optional libraries
4566echo " "
4567echo "Checking for optional libraries..." >&4
4568case "$libs" in
4569' '|'') dflt='';;
4570*) dflt="$libs";;
4571esac
4572case "$libswanted" in
4573'') libswanted='c_s';;
4574esac
4575case "$usesocks" in
923fc586 4576"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4577esac
68435ea7
JH
4578libsfound=''
4579libsfiles=''
4580libsdirs=''
13b3f787
JH
4581libspath=''
4582for thisdir in $libpth $xlibpth; do
4583 test -d $thisdir && libspath="$libspath $thisdir"
4584done
bd9b35c9 4585for thislib in $libswanted; do
13b3f787 4586 for thisdir in $libspath; do
f7dd4e7f
JH
4587 xxx=''
4588 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4589 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4590 $test -f "$xxx" && eval $libscheck
4591 $test -f "$xxx" && libstyle=shared
4592 fi
4593 if test ! -f "$xxx"; then
4594 xxx=$thisdir/lib$thislib.$so
4595 $test -f "$xxx" && eval $libscheck
4596 $test -f "$xxx" && libstyle=shared
4597 fi
4598 if test ! -f "$xxx"; then
4599 xxx=$thisdir/lib$thislib$_a
4600 $test -f "$xxx" && eval $libscheck
4601 $test -f "$xxx" && libstyle=static
4602 fi
4603 if test ! -f "$xxx"; then
4604 xxx=$thisdir/$thislib$_a
4605 $test -f "$xxx" && eval $libscheck
4606 $test -f "$xxx" && libstyle=static
4607 fi
4608 if test ! -f "$xxx"; then
4609 xxx=$thisdir/lib${thislib}_s$_a
4610 $test -f "$xxx" && eval $libscheck
4611 $test -f "$xxx" && libstyle=static
09ea5ba9 4612 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4613 fi
4614 if test ! -f "$xxx"; then
4615 xxx=$thisdir/Slib$thislib$_a
4616 $test -f "$xxx" && eval $libscheck
4617 $test -f "$xxx" && libstyle=static
4618 fi
4619 if $test -f "$xxx"; then
43999f95 4620 case "$libstyle" in
f7dd4e7f
JH
4621 shared) echo "Found -l$thislib (shared)." ;;
4622 static) echo "Found -l$thislib." ;;
4623 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4624 esac
bd9b35c9
JH
4625 case " $dflt " in
4626 *"-l$thislib "*);;
f7dd4e7f 4627 *) dflt="$dflt -l$thislib"
43999f95
JH
4628 libsfound="$libsfound $xxx"
4629 yyy=`basename $xxx`
4630 libsfiles="$libsfiles $yyy"
1e127011 4631 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4632 case " $libsdirs " in
4633 *" $yyy "*) ;;
4634 *) libsdirs="$libsdirs $yyy" ;;
4635 esac
4636 ;;
bd9b35c9 4637 esac
f7dd4e7f
JH
4638 break
4639 fi
4640 done
4641 if $test ! -f "$xxx"; then
4642 echo "No -l$thislib."
bd9b35c9
JH
4643 fi
4644done
4645set X $dflt
4646shift
4647dflt="$*"
4648case "$libs" in
4649'') dflt="$dflt";;
4650*) dflt="$libs";;
4651esac
4652case "$dflt" in
4653' '|'') dflt='none';;
4654esac
4633a7c4 4655
bd9b35c9 4656$cat <<EOM
4633a7c4 4657
bd9b35c9
JH
4658In order to compile $package on your machine, a number of libraries
4659are usually needed. Include any other special libraries here as well.
4660Say "none" for none. The default list is almost always right.
8e07c86e 4661EOM
8e07c86e 4662
bd9b35c9
JH
4663echo " "
4664rp="What libraries to use?"
4665. ./myread
4666case "$ans" in
4667none) libs=' ';;
4668*) libs="$ans";;
4669esac
d71b2b6b 4670
bd9b35c9
JH
4671: determine optimization, if desired, or use for debug flag also
4672case "$optimize" in
4673' '|$undef) dflt='none';;
4674'') dflt='-O';;
4675*) dflt="$optimize";;
4676esac
4677$cat <<EOH
d71b2b6b 4678
bd9b35c9
JH
4679By default, $package compiles with the -O flag to use the optimizer.
4680Alternately, you might want to use the symbolic debugger, which uses
4681the -g flag (on traditional Unix systems). Either flag can be
4682specified here. To use neither flag, specify the word "none".
d71b2b6b 4683
bd9b35c9
JH
4684EOH
4685rp="What optimizer/debugger flag should be used?"
4686. ./myread
4687optimize="$ans"
4688case "$optimize" in
4689'none') optimize=" ";;
4690esac
4691
4692dflt=''
4693: We will not override a previous value, but we might want to
4694: augment a hint file
4695case "$hint" in
4696default|recommended)
4697 case "$gccversion" in
4698 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 4699 esac
bd9b35c9
JH
4700 case "$optimize" in
4701 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 4702 esac
bd9b35c9
JH
4703 case "$gccversion" in
4704 2*) if test -d /etc/conf/kconfig.d &&
4705 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4706 then
4707 dflt="$dflt -posix"
4708 fi
f0d04425 4709 ;;
bd9b35c9
JH
4710 esac
4711 case "$gccversion" in
4712 1*) ;;
4713 2.[0-8]*) ;;
4714 ?*) echo " "
4715 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4716 echo 'int main(void) { return 0; }' > gcctest.c
4717 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4718 echo "Yes, it does." 2>&1
4719 case "$ccflags" in
4720 *strict-aliasing*)
4721 echo "Leaving current flags $ccflags alone." 2>&1
4722 ;;
4723 *) dflt="$dflt -fno-strict-aliasing" ;;
4724 esac
4725 else
4726 echo "Nope, it doesn't, but that's ok." 2>&1
4727 fi
f0d04425 4728 ;;
e5e20432
JH
4729 esac
4730 ;;
4731esac
4732
bd9b35c9
JH
4733case "$mips_type" in
4734*BSD*|'') inclwanted="$locincpth $usrinc";;
4735*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4736esac
4737for thisincl in $inclwanted; do
4738 if $test -d $thisincl; then
4739 if $test x$thisincl != x$usrinc; then
4740 case "$dflt" in
422af00a
LC
4741 *" -I$thisincl "*);;
4742 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
4743 esac
4744 fi
4745 fi
4746done
40a7a20a 4747
bd9b35c9
JH
4748inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4749 xxx=true;
4750elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4751 xxx=true;
4752else
4753 xxx=false;
4754fi;
4755if $xxx; then
4756 case "$dflt" in
4757 *$2*);;
4758 *) dflt="$dflt -D$2";;
4759 esac;
4760fi'
40a7a20a 4761
bd9b35c9 4762set signal.h LANGUAGE_C; eval $inctest
40a7a20a 4763
bd9b35c9
JH
4764case "$usesocks" in
4765$define)
4766 ccflags="$ccflags -DSOCKS"
4767 ;;
4768esac
40a7a20a 4769
bd9b35c9
JH
4770case "$hint" in
4771default|recommended) dflt="$ccflags $dflt" ;;
4772*) dflt="$ccflags";;
4773esac
40a7a20a 4774
bd9b35c9
JH
4775case "$dflt" in
4776''|' ') dflt=none;;
4777esac
422af00a 4778
bd9b35c9 4779$cat <<EOH
40a7a20a 4780
bd9b35c9
JH
4781Your C compiler may want other flags. For this question you should include
4782-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4783but you should NOT include libraries or ld flags like -lwhatever. If you
4784want $package to honor its debug switch, you should include -DDEBUGGING here.
4785Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 4786
bd9b35c9 4787To use no flags, specify the word "none".
40a7a20a 4788
bd9b35c9
JH
4789EOH
4790set X $dflt
4791shift
4792dflt=${1+"$@"}
4793rp="Any additional cc flags?"
4794. ./myread
4795case "$ans" in
4796none) ccflags='';;
4797*) ccflags="$ans";;
4798esac
8e07c86e 4799
bd9b35c9 4800: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
4801case "$cppflags" in
4802'') cppflags="$ccflags" ;;
4803*) cppflags="$cppflags $ccflags" ;;
4804esac
bd9b35c9
JH
4805case "$gccversion" in
48061*) cppflags="$cppflags -D__GNUC__"
4633a7c4 4807esac
bd9b35c9
JH
4808case "$mips_type" in
4809'');;
4810*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4811esac
4812case "$cppflags" in
4813'');;
4814*)
4815 echo " "
4816 echo "Let me guess what the preprocessor flags are..." >&4
4817 set X $cppflags
4818 shift
4819 cppflags=''
4820 $cat >cpp.c <<'EOM'
4821#define BLURFL foo
8e07c86e 4822
bd9b35c9
JH
4823BLURFL xx LFRULB
4824EOM
4825 previous=''
4826 for flag in $*
4827 do
4828 case "$flag" in
4829 -*) ftry="$flag";;
4830 *) ftry="$previous $flag";;
4831 esac
4832 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4833 >cpp1.out 2>/dev/null && \
4834 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4835 >cpp2.out 2>/dev/null && \
4836 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4837 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4838 then
4839 cppflags="$cppflags $ftry"
4840 previous=''
4841 else
4842 previous="$flag"
4843 fi
4844 done
4845 set X $cppflags
4846 shift
4847 cppflags=${1+"$@"}
4848 case "$cppflags" in
4849 *-*) echo "They appear to be: $cppflags";;
4850 esac
4851 $rm -f cpp.c cpp?.out
2afac517 4852 ;;
4853esac
8e07c86e 4854
bd9b35c9
JH
4855: flags used in final linking phase
4856case "$ldflags" in
4857'') if ./venix; then
4858 dflt='-i -z'
10a23457 4859 else
bd9b35c9 4860 dflt=''
10a23457 4861 fi
bd9b35c9
JH
4862 case "$ccflags" in
4863 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 4864 esac
bd9b35c9
JH
4865 ;;
4866*) dflt="$ldflags";;
4867esac
4868
4869: Try to guess additional flags to pick up local libraries.
4870for thislibdir in $libpth; do
4871 case " $loclibpth " in
4872 *" $thislibdir "*)
4873 case "$dflt " in
4874 *"-L$thislibdir "*) ;;
4875 *) dflt="$dflt -L$thislibdir" ;;
4876 esac
c4f23d77
AD
4877 ;;
4878 esac
bd9b35c9 4879done
c4f23d77 4880
bd9b35c9
JH
4881case "$dflt" in
4882'') dflt='none' ;;
4883esac
c4f23d77 4884
bd9b35c9
JH
4885$cat <<EOH
4886
4887Your C linker may need flags. For this question you should
4888include -L/whatever and any other flags used by the C linker, but you
4889should NOT include libraries like -lwhatever.
4890
4891Make sure you include the appropriate -L/path flags if your C linker
4892does not normally search all of the directories you specified above,
4893namely
4894 $libpth
4895To use no flags, specify the word "none".
4896
4897EOH
4898
4899rp="Any additional ld flags (NOT including libraries)?"
4900. ./myread
4901case "$ans" in
4902none) ldflags='';;
4903*) ldflags="$ans";;
4904esac
4905rmlist="$rmlist pdp11"
4906
4907: coherency check
4908echo " "
4909echo "Checking your choice of C compiler and flags for coherency..." >&4
4910$cat > try.c <<'EOF'
4911#include <stdio.h>
55954f19 4912int main() { printf("Ok\n"); return(0); }
bd9b35c9 4913EOF
7a282f6d 4914set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
4915shift
4916$cat >try.msg <<'EOM'
4917I've tried to compile and run the following simple program:
4918
4919EOM
4920$cat try.c >> try.msg
4921
4922$cat >> try.msg <<EOM
4923
4924I used the command:
4925
4926 $*
5440bc8e 4927 $run ./try
bd9b35c9
JH
4928
4929and I got the following output:
4930
4931EOM
4932dflt=y
73614538 4933if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5440bc8e
JH
4934 if $sh -c "$run ./try" >>try.msg 2>&1; then
4935 xxx=`$run ./try`
bd9b35c9
JH
4936 case "$xxx" in
4937 "Ok") dflt=n ;;
4938 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4939 case " $libs " in
4940 *" -lsfio "*)
4941 cat >> try.msg <<'EOQS'
4942If $libs contains -lsfio, and sfio is mis-configured, then it
4943sometimes (apparently) runs and exits with a 0 status, but with no
4944output! It may have to do with sfio's use of _exit vs. exit.
4945
4946EOQS
4947 rp="You have a big problem. Shall I abort Configure"
4948 dflt=y
4949 ;;
4950 esac
4951 ;;
4952 esac
4953 else
4954 echo "The program compiled OK, but exited with status $?." >>try.msg
4955 rp="You have a problem. Shall I abort Configure"
4956 dflt=y
4957 fi
4958else
4959 echo "I can't compile the test program." >>try.msg
4960 rp="You have a BIG problem. Shall I abort Configure"
4961 dflt=y
4962fi
4963case "$dflt" in
4964y)
4965 $cat try.msg >&4
4966 case "$knowitall" in
4967 '')
4968 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 4969 ;;
bd9b35c9 4970 *) dflt=n;;
c4f23d77 4971 esac
bd9b35c9
JH
4972 echo " "
4973 . ./myread
4974 case "$ans" in
4975 n*|N*) ;;
4976 *) echo "Ok. Stopping Configure." >&4
4977 exit 1
c4f23d77
AD
4978 ;;
4979 esac
4980 ;;
bd9b35c9 4981n) echo "OK, that should do.";;
c4f23d77 4982esac
bd9b35c9 4983$rm -f try try.* core
c4f23d77 4984
bd9b35c9
JH
4985: define a shorthand compile call
4986compile='
4987mc_file=$1;
4988shift;
08413ebc 4989$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
4990: define a shorthand compile call for compilations that should be ok.
4991compile_ok='
4992mc_file=$1;
4993shift;
7a282f6d 4994$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 4995
8dfa8df9
JH
4996: determine filename position in cpp output
4997echo " "
4998echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
4999case "$osname" in
5000vos) testaccess=-e ;;
5001*) testaccess=-r ;;
5002esac
8dfa8df9
JH
5003echo '#include <stdio.h>' > foo.c
5004$cat >fieldn <<EOF
5005$startsh
5006$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5007$grep '^[ ]*#.*stdio\.h' | \
5008while read cline; do
5009 pos=1
5010 set \$cline
5011 while $test \$# -gt 0; do
a5a94ea5 5012 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5013 echo "\$pos"
5014 exit 0
5015 fi
5016 shift
5017 pos=\`expr \$pos + 1\`
5018 done
5019done
5020EOF
5021chmod +x fieldn
5022fieldn=`./fieldn`
5023$rm -f foo.c fieldn
5024case $fieldn in
5025'') pos='???';;
50261) pos=first;;
50272) pos=second;;
50283) pos=third;;
5029*) pos="${fieldn}th";;
5030esac
5031echo "Your cpp writes the filename in the $pos field of the line."
5032
3c728e00
JH
5033case "$osname" in
5034vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5c728af0 5035os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5036*) cppfilter='' ;;
5037esac
8dfa8df9
JH
5038: locate header file
5039$cat >findhdr <<EOF
5040$startsh
5041wanted=\$1
5042name=''
5043for usrincdir in $usrinc
5044do
5045 if test -f \$usrincdir/\$wanted; then
5046 echo "\$usrincdir/\$wanted"
5047 exit 0
5048 fi
5049done
5050awkprg='{ print \$$fieldn }'
5051echo "#include <\$wanted>" > foo\$\$.c
5052$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5053$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5054while read cline; do
5055 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5056 case "\$name" in
5057 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5058 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5059 *) exit 2;;
5060 esac;
5061done;
5062#
5063# status = 0: grep returned 0 lines, case statement not executed
5064# status = 1: headerfile found
5065# status = 2: while loop executed, no headerfile found
5066#
5067status=\$?
5068$rm -f foo\$\$.c;
5069if test \$status -eq 1; then
5070 exit 0;
5071fi
5072exit 1
5073EOF
5074chmod +x findhdr
5075
5076: define an alternate in-header-list? function
5077inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5078cont=true; xxf="echo \"<\$1> found.\" >&4";
5079case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5080*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5081esac;
5082case $# in 4) instead=instead;; *) instead="at last";; esac;
5083while $test "$cont"; do
5084 xxx=`./findhdr $1`
5085 var=$2; eval "was=\$$2";
5086 if $test "$xxx" && $test -r "$xxx";
5087 then eval $xxf;
5088 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5089 cont="";
5090 else eval $xxnf;
5091 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5092 set $yyy; shift; shift; yyy=$@;
5093 case $# in 0) cont="";;
5094 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5095 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5096 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5097 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5098 esac;
5099done;
5100while $test "$yyy";
5101do set $yyy; var=$2; eval "was=\$$2";
5102 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5103 set $yyy; shift; shift; yyy=$@;
5104done'
5105
d1daaddf
JH
5106: see if stdlib is available
5107set stdlib.h i_stdlib
5108eval $inhdr
5109
5110: check for lengths of integral types
5111echo " "
5112case "$intsize" in
5113'')
5114 echo "Checking to see how big your integers are..." >&4
c63dfae1 5115 $cat >try.c <<EOCP
d1daaddf
JH
5116#include <stdio.h>
5117#$i_stdlib I_STDLIB
5118#ifdef I_STDLIB
5119#include <stdlib.h>
5120#endif
5121int main()
5122{
5123 printf("intsize=%d;\n", (int)sizeof(int));
5124 printf("longsize=%d;\n", (int)sizeof(long));
5125 printf("shortsize=%d;\n", (int)sizeof(short));
5126 exit(0);
5127}
5128EOCP
5129 set try
5130 if eval $compile_ok && $run ./try > /dev/null; then
5131 eval `$run ./try`
5132 echo "Your integers are $intsize bytes long."
5133 echo "Your long integers are $longsize bytes long."
5134 echo "Your short integers are $shortsize bytes long."
5135 else
5136 $cat >&4 <<EOM
5137!
5138Help! I can't compile and run the intsize test program: please enlighten me!
5139(This is probably a misconfiguration in your system or libraries, and
5140you really ought to fix it. Still, I'll try anyway.)
5141!
5142EOM
5143 dflt=4
5144 rp="What is the size of an integer (in bytes)?"
5145 . ./myread
5146 intsize="$ans"
5147 dflt=$intsize
5148 rp="What is the size of a long integer (in bytes)?"
5149 . ./myread
5150 longsize="$ans"
5151 dflt=2
5152 rp="What is the size of a short integer (in bytes)?"
5153 . ./myread
5154 shortsize="$ans"
5155 fi
5156 ;;
5157esac
5158$rm -f try try.*
5159
5160: check for long long
5161echo " "
5162echo "Checking to see if you have long long..." >&4
5163echo 'int main() { long long x = 7; return 0; }' > try.c
5164set try
5165if eval $compile; then
5166 val="$define"
5167 echo "You have long long."
5168else
5169 val="$undef"
5170 echo "You do not have long long."
5171fi
5172$rm try.*
5173set d_longlong
5174eval $setvar
5175
5176: check for length of long long
5177case "${d_longlong}${longlongsize}" in
5178$define)
5179 echo " "
5180 echo "Checking to see how big your long longs are..." >&4
5181 $cat >try.c <<'EOCP'
5182#include <stdio.h>
5183int main()
5184{
5185 printf("%d\n", (int)sizeof(long long));
5186 return(0);
5187}
5188EOCP
5189 set try
5190 if eval $compile_ok; then
5191 longlongsize=`$run ./try`
5192 echo "Your long longs are $longlongsize bytes long."
5193 else
5194 dflt='8'
5195 echo " "
5196 echo "(I can't seem to compile the test program. Guessing...)"
5197 rp="What is the size of a long long (in bytes)?"
5198 . ./myread
5199 longlongsize="$ans"
5200 fi
5201 if $test "X$longsize" = "X$longlongsize"; then
5202 echo "(That isn't any different from an ordinary long.)"
5203 fi
5204 ;;
5205esac
5206$rm -f try.* try
5207
8dfa8df9
JH
5208: see if inttypes.h is available
5209: we want a real compile instead of Inhdr because some systems
5210: have an inttypes.h which includes non-existent headers
5211echo " "
5212$cat >try.c <<EOCP
5213#include <inttypes.h>
5214int main() {
5215 static int32_t foo32 = 0x12345678;
5216}
5217EOCP
5218set try
5219if eval $compile; then
5220 echo "<inttypes.h> found." >&4
5221 val="$define"
5222else
5223 echo "<inttypes.h> NOT found." >&4
5224 val="$undef"
5225fi
5226$rm -f try.c try
5227set i_inttypes
5228eval $setvar
5229
5230: check for int64_t
5231echo " "
5232echo "Checking to see if you have int64_t..." >&4
5233$cat >try.c <<EOCP
5234#include <sys/types.h>
5235#$i_inttypes I_INTTYPES
5236#ifdef I_INTTYPES
5237#include <inttypes.h>
5238#endif
5239int main() { int64_t x = 7; }
5240EOCP
5241set try
5242if eval $compile; then
5243 val="$define"
5244 echo "You have int64_t."
5245else
5246 val="$undef"
5247 echo "You do not have int64_t."
5248fi
5249$rm -f try try.*
5250set d_int64_t
5251eval $setvar
5252
5253
5254echo " "
5255echo "Checking which 64-bit integer type we could use..." >&4
5256
5257case "$intsize" in
52588) val=int
5259 set quadtype
5260 eval $setvar
5261 val='"unsigned int"'
5262 set uquadtype
5263 eval $setvar
5264 quadkind=1
5265 ;;
5266*) case "$longsize" in
5267 8) val=long
5268 set quadtype
5269 eval $setvar
5270 val='"unsigned long"'
5271 set uquadtype
5272 eval $setvar
5273 quadkind=2
5274 ;;
5275 *) case "$d_longlong:$longlongsize" in
5276 define:8)
5277 val='"long long"'
5278 set quadtype
5279 eval $setvar
5280 val='"unsigned long long"'
5281 set uquadtype
5282 eval $setvar
5283 quadkind=3
5284 ;;
5285 *) case "$d_int64_t" in
5286 define)
5287 val=int64_t
5288 set quadtype
5289 eval $setvar
5290 val=uint64_t
5291 set uquadtype
5292 eval $setvar
5293 quadkind=4
5294 ;;
5295 esac
5296 ;;
5297 esac
5298 ;;
5299 esac
5300 ;;
5301esac
5302
5303case "$quadtype" in
5304'') echo "Alas, no 64-bit integer types in sight." >&4
5305 d_quad="$undef"
5306 ;;
5307*) echo "We could use '$quadtype' for 64-bit integers." >&4
5308 d_quad="$define"
5309 ;;
5310esac
5311
b4eb6b3d
JH
5312
5313case "$uselonglong" in
5314"$define"|true|[yY]*)
5315 cat <<EOM >&4
5316
5317*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5318EOM
5319 use64bitint="$define"
5320 ;;
5321esac
5322case "$use64bits" in
5323"$define"|true|[yY]*)
5324 cat <<EOM >&4
5325
5326*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5327EOM
5328 use64bitint="$define"
5329 ;;
5330esac
5331case "$use64bitints" in
5332"$define"|true|[yY]*)
5333 cat <<EOM >&4
5334
5335*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5336EOM
5337 use64bitint="$define"
5338 ;;
5339esac
5340case "$use64bitsint" in
5341"$define"|true|[yY]*)
5342 cat <<EOM >&4
5343
5344*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5345EOM
5346 use64bitint="$define"
5347 ;;
5348esac
5349case "$uselonglongs" in
5350"$define"|true|[yY]*)
5351 cat <<EOM >&4
5352
5353*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5354EOM
5355 use64bitint="$define"
5356 ;;
5357esac
5358case "$use64bitsall" in
5359"$define"|true|[yY]*)
5360 cat <<EOM >&4
5361
5362*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5363EOM
5364 use64bitall="$define"
5365 ;;
5366esac
5367
5368case "$ccflags" in
5369*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5370esac
5371case "$use64bitall" in
5372"$define"|true|[yY]*) use64bitint="$define" ;;
5373esac
5374
5375case "$longsize" in
53768) cat <<EOM
5377
5378You have natively 64-bit long integers.
5379EOM
5380 val="$define"
5381 ;;
5382*) case "$use64bitint" in
5383 "$define"|true|[yY]*) dflt='y';;
5384 *) dflt='n';;
5385 esac
8dfa8df9
JH
5386 case "$d_quad" in
5387 "$define") ;;
5388 *) dflt='n' ;;
5389 esac
b4eb6b3d
JH
5390 cat <<EOM
5391
5392Perl can be built to take advantage of 64-bit integer types
5393on some systems. To do so, Configure can be run with -Duse64bitint.
5394Choosing this option will most probably introduce binary incompatibilities.
5395
5396If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5397(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5398EOM
5399 rp='Try to use 64-bit integers, if available?'
5400 . ./myread
5401 case "$ans" in
5402 [yY]*) val="$define" ;;
5403 *) val="$undef" ;;
5404 esac
5405 ;;
5406esac
5407set use64bitint
5408eval $setvar
5409
5410case "$use64bitall" in
5411"$define"|true|[yY]*) dflt='y' ;;
5412*) case "$longsize" in
5413 8) dflt='y' ;;
5414 *) dflt='n' ;;
5415 esac
5416 ;;
5417esac
5418cat <<EOM
5419
5420You may also choose to try maximal 64-bitness. It means using as much
542164-bitness as possible on the platform. This in turn means even more
5422binary incompatibilities. On the other hand, your platform may not
5423have any more 64-bitness available than what you already have chosen.
5424
5425If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5426(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5427EOM
5428rp='Try to use maximal 64-bit support, if available?'
5429. ./myread
5430case "$ans" in
5431[yY]*) val="$define" ;;
5432*) val="$undef" ;;
5433esac
5434set use64bitall
5435eval $setvar
5436case "$use64bitall" in
5437"$define")
5438 case "$use64bitint" in
5439 "$undef")
5440 cat <<EOM
5441
5442Since you have chosen a maximally 64-bit build, I'm also turning on
5443the use of 64-bit integers.
5444EOM
5445 use64bitint="$define" ;;
5446 esac
5447 ;;
5448esac
5449
5450case "$use64bitint" in
5451"$define"|true|[yY]*)
5452: Look for a hint-file generated 'call-back-unit'. If the
5453: user has specified that a 64-bit perl is to be built,
5454: we may need to set or change some other defaults.
5455 if $test -f use64bitint.cbu; then
5456 echo "Your platform has some specific hints for 64-bit integers, using them..."
5457 . ./use64bitint.cbu
5458 fi
5459 case "$longsize" in
5460 4) case "$archname64" in
5461 '') archname64=64int ;;
5462 esac
5463 ;;
5464 esac
5465 ;;
5466esac
5467
5468case "$use64bitall" in
5469"$define"|true|[yY]*)
5470: Look for a hint-file generated 'call-back-unit'. If the
5471: user has specified that a maximally 64-bit perl is to be built,
5472: we may need to set or change some other defaults.
5473 if $test -f use64bitall.cbu; then
5474 echo "Your platform has some specific hints for 64-bit builds, using them..."
5475 . ./use64bitall.cbu
5476 fi
5477 case "$longsize" in
5478 4) case "$archname64" in
5479 ''|64int) archname64=64all ;;
5480 esac
5481 ;;
5482 esac
5483 ;;
5484esac
5485
1911a026
JH
5486case "$d_quad:$use64bitint" in
5487$undef:$define)
5488 cat >&4 <<EOF
5489
5490*** You have chosen to use 64-bit integers,
5491*** but none cannot be found.
09b58c7b 5492*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
1911a026
JH
5493*** Cannot continue, aborting.
5494
5495EOF
5496 exit 1
5497 ;;
5498esac
5499
36adc09b
JH
5500: check for length of double
5501echo " "
5502case "$doublesize" in
5503'')
5504 echo "Checking to see how big your double precision numbers are..." >&4
5505 $cat >try.c <<EOCP
5506#include <stdio.h>
1911a026
JH
5507#$i_stdlib I_STDLIB
5508#ifdef I_STDLIB
5509#include <stdlib.h>
5510#endif
36adc09b
JH
5511int main()
5512{
5513 printf("%d\n", (int)sizeof(double));
1911a026 5514 exit(0);
36adc09b
JH
5515}
5516EOCP
5517 set try
5518 if eval $compile_ok; then
5519 doublesize=`$run ./try`
5520 echo "Your double is $doublesize bytes long."
5521 else
5522 dflt='8'
5523 echo "(I can't seem to compile the test program. Guessing...)"
5524 rp="What is the size of a double precision number (in bytes)?"
5525 . ./myread
5526 doublesize="$ans"
5527 fi
5528 ;;
5529esac
5530$rm -f try.c try
5531
5532: check for long doubles
5533echo " "
5534echo "Checking to see if you have long double..." >&4
5535echo 'int main() { long double x = 7.0; }' > try.c
5536set try
5537if eval $compile; then
5538 val="$define"
5539 echo "You have long double."
5540else
5541 val="$undef"
5542 echo "You do not have long double."
5543fi
5544$rm try.*
5545set d_longdbl
5546eval $setvar
5547
5548: check for length of long double
5549case "${d_longdbl}${longdblsize}" in
5550$define)
5551 echo " "
5552 echo "Checking to see how big your long doubles are..." >&4
5553 $cat >try.c <<'EOCP'
5554#include <stdio.h>
5555int main()
5556{
5557 printf("%d\n", sizeof(long double));
5558}
5559EOCP
5560 set try
5561 set try
5562 if eval $compile; then
5563 longdblsize=`$run ./try`
5564 echo "Your long doubles are $longdblsize bytes long."
5565 else
5566 dflt='8'
5567 echo " "
5568 echo "(I can't seem to compile the test program. Guessing...)" >&4
5569 rp="What is the size of a long double (in bytes)?"
5570 . ./myread
5571 longdblsize="$ans"
5572 fi
5573 if $test "X$doublesize" = "X$longdblsize"; then
5574 echo "(That isn't any different from an ordinary double.)"
5575 fi
5576 ;;
5577esac
5578$rm -f try.* try
5579
89ce900e 5580: determine the architecture name
b4eb6b3d 5581echo " "
89ce900e
JH
5582if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5583 tarch=`arch`"-$osname"
5584elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5585 if uname -m > tmparch 2>&1 ; then
5586 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5587 -e 's/$/'"-$osname/" tmparch`
5588 else
5589 tarch="$osname"
5590 fi
5591 $rm -f tmparch
b4eb6b3d 5592else
89ce900e 5593 tarch="$osname"
b4eb6b3d 5594fi
89ce900e
JH
5595case "$myarchname" in
5596''|"$tarch") ;;
5597*)
5598 echo "(Your architecture name used to be $myarchname.)"
5599 archname=''
5600 ;;
5601esac
5602case "$targetarch" in
5603'') ;;
5604*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5605esac
5606myarchname="$tarch"
5607case "$archname" in
5608'') dflt="$tarch";;
5609*) dflt="$archname";;
5610esac
5611rp='What is your architecture name'
5612. ./myread
5613archname="$ans"
5614case "$usethreads" in
5615$define)
5616 echo "Threads selected." >&4
5617 case "$archname" in
5618 *-thread*) echo "...and architecture name already has -thread." >&4
5619 ;;
5620 *) archname="$archname-thread"
5621 echo "...setting architecture name to $archname." >&4
5622 ;;
5623 esac
5624 ;;
5625esac
5626case "$usemultiplicity" in
5627$define)
5628 echo "Multiplicity selected." >&4
5629 case "$archname" in
5630 *-multi*) echo "...and architecture name already has -multi." >&4
5631 ;;
5632 *) archname="$archname-multi"
5633 echo "...setting architecture name to $archname." >&4
5634 ;;
5635 esac
5636 ;;
5637esac
5638case "$use64bitint$use64bitall" in
5639*"$define"*)
5640 case "$archname64" in
5641 '')
5642 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
bd9b35c9 5643 ;;
89ce900e
JH
5644 *)
5645 case "$use64bitint" in
5646 "$define") echo "64 bit integers selected." >&4 ;;
5647 esac
5648 case "$use64bitall" in
5649 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5650 esac
5651 case "$archname" in
5652 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5653 ;;
5654 *) archname="$archname-$archname64"
5655 echo "...setting architecture name to $archname." >&4
5656 ;;
5657 esac
c1a7f87b
JH
5658 ;;
5659 esac
89ce900e
JH
5660esac
5661case "$uselongdouble" in
5662$define)
5663 echo "Long doubles selected." >&4
5664 case "$longdblsize" in
5665 $doublesize)
5666 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5667 ;;
5668 *)
5669 case "$archname" in
5670 *-ld*) echo "...and architecture name already has -ld." >&4
5671 ;;
5672 *) archname="$archname-ld"
5673 echo "...setting architecture name to $archname." >&4
5674 ;;
5675 esac
bd9b35c9
JH
5676 ;;
5677 esac
bd9b35c9 5678 ;;
89ce900e
JH
5679esac
5680case "$useperlio" in
5681$define)
5682 echo "Perlio selected." >&4
5683 ;;
bd9b35c9 5684*)
89ce900e
JH
5685 echo "Perlio not selected, using stdio." >&4
5686 case "$archname" in
5687 *-stdio*) echo "...and architecture name already has -stdio." >&4
5688 ;;
5689 *) archname="$archname-stdio"
5690 echo "...setting architecture name to $archname." >&4
5691 ;;
5692 esac
bd9b35c9
JH
5693 ;;
5694esac
d2e0c6f7
JH
5695if $test -f archname.cbu; then
5696 echo "Your platform has some specific hints for architecture name, using them..."
5697 . ./archname.cbu
5698fi
bd9b35c9 5699
89ce900e
JH
5700: determine root of directory hierarchy where package will be installed.
5701case "$prefix" in
5702'')
5703 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5704 ;;
5705*?/)
5706 dflt=`echo "$prefix" | sed 's/.$//'`
5707 ;;
5708*)
5709 dflt="$prefix"
5710 ;;
5711esac
5712$cat <<EOM
c1a7f87b 5713
89ce900e
JH
5714By default, $package will be installed in $dflt/bin, manual pages
5715under $dflt/man, etc..., i.e. with $dflt as prefix for all
5716installation directories. Typically this is something like /usr/local.
5717If you wish to have binaries under /usr/bin but other parts of the
5718installation under /usr/local, that's ok: you will be prompted
5719separately for each of the installation directories, the prefix being
5720only used to set the defaults.
bd9b35c9
JH
5721
5722EOM
89ce900e
JH
5723fn=d~
5724rp='Installation prefix to use?'
5725. ./getfile
5726oldprefix=''
5727case "$prefix" in
5728'') ;;
5729*)
5730 case "$ans" in
5731 "$prefix") ;;
5732 *) oldprefix="$prefix";;
5733 esac
5734 ;;
bd9b35c9 5735esac
89ce900e
JH
5736prefix="$ans"
5737prefixexp="$ansexp"
bd9b35c9 5738
89ce900e
JH
5739case "$afsroot" in
5740'') afsroot=/afs ;;
5741*) afsroot=$afsroot ;;
8e07c86e 5742esac
29209bc5 5743
89ce900e
JH
5744: is AFS running?
5745echo " "
5746case "$afs" in
5747$define|true) afs=true ;;
5748$undef|false) afs=false ;;
5749*) if test -d $afsroot; then
5750 afs=true
c1a7f87b 5751 else
89ce900e
JH
5752 afs=false
5753 fi
5754 ;;
c1a7f87b 5755esac
89ce900e
JH
5756if $afs; then
5757 echo "AFS may be running... I'll be extra cautious then..." >&4
5758else
5759 echo "AFS does not seem to be running..." >&4
5760fi
b4eb6b3d
JH
5761
5762: determine installation prefix for where package is to be installed.
5763if $afs; then
5764$cat <<EOM
5765
5766Since you are running AFS, I need to distinguish the directory in which
5767files will reside from the directory in which they are installed (and from
5768which they are presumably copied to the former directory by occult means).
5769
5770EOM
5771 case "$installprefix" in
5772 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5773 *) dflt="$installprefix";;
5774 esac
5775else
5776$cat <<EOM
5777
5778In some special cases, particularly when building $package for distribution,
c2bfb7b1
MB
5779it is convenient to distinguish the directory in which files should be
5780installed from the directory ($prefix) in which they will
5781eventually reside. For most users, these two directories are the same.
b4eb6b3d
JH
5782
5783EOM
5784 case "$installprefix" in
5785 '') dflt=$prefix ;;
5786 *) dflt=$installprefix;;
5787 esac
5788fi
5789fn=d~
5790rp='What installation prefix should I use for installing files?'
5791. ./getfile
5792installprefix="$ans"
5793installprefixexp="$ansexp"
5794
5795: set the prefixit variable, to compute a suitable default value
5796prefixit='case "$3" in
5797""|none)
5798 case "$oldprefix" in
5799 "") eval "$1=\"\$$2\"";;
5800 *)
5801 case "$3" in
5802 "") eval "$1=";;
5803 none)
5804 eval "tp=\"\$$2\"";
5805 case "$tp" in
5806 ""|" ") eval "$1=\"\$$2\"";;
5807 *) eval "$1=";;
5808 esac;;
5809 esac;;
5810 esac;;
5811*)
5812 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5813 case "$tp" in
5814 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5815 /*-$oldprefix/*|\~*-$oldprefix/*)
5816 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5817 *) eval "$1=\"\$$2\"";;
5818 esac;;
5819esac'
5820
b4eb6b3d
JH
5821: get the patchlevel
5822echo " "
5823echo "Getting the current patchlevel..." >&4
5824if $test -r $rsrc/patchlevel.h;then
5825 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5826 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5827 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5828 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5829 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5830 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
151e6568 5831 perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
b4eb6b3d
JH
5832else
5833 revision=0
5834 patchlevel=0
5835 subversion=0
5836 api_revision=0
5837 api_version=0
5838 api_subversion=0
151e6568
MB
5839 perl_patchlevel=0
5840 $echo "(You do not have patchlevel.h. Eek.)"
b4eb6b3d 5841fi
151e6568
MB
5842if $test -r $rsrc/.patch ; then
5843 if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5844 perl_patchlevel=`cat $rsrc/.patch`
5845 fi
5846fi
861eb78d
AD
5847: Define a handy string here to avoid duplication in myconfig.SH and configpm.
5848version_patchlevel_string="version $patchlevel subversion $subversion"
151e6568 5849case "$perl_patchlevel" in
861eb78d
AD
58500|'') ;;
5851*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
151e6568 5852esac
861eb78d
AD
5853
5854$echo "(You have $package $version_patchlevel_string.)"
5855
b4eb6b3d
JH
5856case "$osname" in
5857dos|vms)
5858 : XXX Should be a Configure test for double-dots in filenames.
5859 version=`echo $revision $patchlevel $subversion | \
5860 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5861 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5862 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5863 ;;
5864*)
5865 version=`echo $revision $patchlevel $subversion | \
5866 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5867 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5868 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5869 ;;
5870esac
5871: Special case the 5.005_xx maintenance series, which used 5.005
5872: without any subversion label as a subdirectory in $sitelib
5873if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5874 api_versionstring='5.005'
5875fi
5876
5877: determine installation style
5878: For now, try to deduce it from prefix unless it is already set.
5879: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5880case "$installstyle" in
5881'') case "$prefix" in
5882 *perl*) dflt='lib';;
5883 *) dflt='lib/perl5' ;;
5884 esac
5885 ;;
5886*) dflt="$installstyle" ;;
5887esac
5888: Probably not worth prompting for this since we prompt for all
5889: the directories individually, and the prompt would be too long and
5890: confusing anyway.
5891installstyle=$dflt
5892
5893: determine where private library files go
5894: Usual default is /usr/local/lib/perl5/$version.
5895: Also allow things like /opt/perl/lib/$version, since
5896: /opt/perl/lib/perl5... would be redundant.
5897: The default "style" setting is made in installstyle.U
5898case "$installstyle" in
5899*lib/perl5*) set dflt privlib lib/$package/$version ;;
5900*) set dflt privlib lib/$version ;;
5901esac
5902eval $prefixit
5903$cat <<EOM
5904
5905There are some auxiliary files for $package that need to be put into a
5906private library directory that is accessible by everyone.
5907
5908EOM
5909fn=d~+
5910rp='Pathname where the private library files will reside?'
5911. ./getfile
5912privlib="$ans"
5913privlibexp="$ansexp"
5914: Change installation prefix, if necessary.
5915if $test X"$prefix" != X"$installprefix"; then
5916 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5917else
5918 installprivlib="$privlibexp"
5919fi
5920
5921: set the prefixup variable, to restore leading tilda escape
5922prefixup='case "$prefixexp" in
5923"$prefix") ;;
5924*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5925esac'
5926
5927: determine where public architecture dependent libraries go
5928set archlib archlib
5929eval $prefixit
5930: privlib default is /usr/local/lib/$package/$version
5931: archlib default is /usr/local/lib/$package/$version/$archname
5932: privlib may have an optional trailing /share.
5933tdflt=`echo $privlib | $sed 's,/share$,,'`
5934tdflt=$tdflt/$archname
5935case "$archlib" in
5936'') dflt=$tdflt
5937 ;;
5938*) dflt="$archlib"
5939 ;;
5940esac
5941$cat <<EOM
5942
5943$spackage contains architecture-dependent library files. If you are
5944sharing libraries in a heterogeneous environment, you might store
5945these files in a separate location. Otherwise, you can just include
5946them with the rest of the public library files.
5947
5948EOM
5949fn=d+~
5950rp='Where do you want to put the public architecture-dependent libraries?'
5951. ./getfile
5952archlib="$ans"
5953archlibexp="$ansexp"
5954if $test X"$archlib" = X"$privlib"; then
5955 d_archlib="$undef"
5956else
5957 d_archlib="$define"
5958fi
5959: Change installation prefix, if necessary.
5960if $test X"$prefix" != X"$installprefix"; then
5961 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5962else
5963 installarchlib="$archlibexp"
5964fi
5965
b4eb6b3d
JH
5966: see if setuid scripts can be secure
5967$cat <<EOM
5968
5969Some kernels have a bug that prevents setuid #! scripts from being
5970secure. Some sites have disabled setuid #! scripts because of this.
5971
5972First let's decide if your kernel supports secure setuid #! scripts.
5973(If setuid #! scripts would be secure but have been disabled anyway,
5974don't say that they are secure if asked.)
5975
5976EOM
5977
5978val="$undef"
5979if $test -d /dev/fd; then
5980 echo "#!$ls" >reflect
5981 chmod +x,u+s reflect
5982 ./reflect >flect 2>&1
5983 if $contains "/dev/fd" flect >/dev/null; then
5984 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5985 val="$define"
5986 else
5987 $cat <<EOM
5988If you are not sure if they are secure, I can check but I'll need a
5989username and password different from the one you are using right now.
5990If you don't have such a username or don't want me to test, simply
5991enter 'none'.
5992
5993EOM
5994 rp='Other username to test security of setuid scripts with?'
5995 dflt='none'
5996 . ./myread
5997 case "$ans" in
5998 n|none)
5999 case "$d_suidsafe" in
6000 '') echo "I'll assume setuid scripts are *not* secure." >&4
6001 dflt=n;;
6002 "$undef")
6003 echo "Well, the $hint value is *not* secure." >&4
6004 dflt=n;;
6005 *) echo "Well, the $hint value *is* secure." >&4
6006 dflt=y;;
6007 esac
c1a7f87b 6008 ;;
b4eb6b3d
JH
6009 *)
6010 $rm -f reflect flect
6011 echo "#!$ls" >reflect
6012 chmod +x,u+s reflect
6013 echo >flect
6014 chmod a+w flect
6015 echo '"su" will (probably) prompt you for '"$ans's password."
6016 su $ans -c './reflect >flect'
6017 if $contains "/dev/fd" flect >/dev/null; then
6018 echo "Okay, it looks like setuid scripts are secure." >&4
6019 dflt=y
6020 else
6021 echo "I don't think setuid scripts are secure." >&4
6022 dflt=n
6023 fi
6024 ;;
6025 esac
6026 rp='Does your kernel have *secure* setuid scripts?'
6027 . ./myread
6028 case "$ans" in
6029 [yY]*) val="$define";;
6030 *) val="$undef";;
6031 esac
6032 fi
6033else
6034 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6035 echo "(That's for file descriptors, not floppy disks.)"
6036 val="$undef"
6037fi
6038set d_suidsafe
6039eval $setvar
6040
6041$rm -f reflect flect
6042
6043: now see if they want to do setuid emulation
6044echo " "
6045val="$undef"
6046case "$d_suidsafe" in
6047"$define")
6048 val="$undef"
3c728e00 6049 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d
JH
6050 ;;
6051*)
6052 $cat <<EOM
6053Some systems have disabled setuid scripts, especially systems where
6054setuid scripts cannot be secure. On systems where setuid scripts have
6055been disabled, the setuid/setgid bits on scripts are currently
6056useless. It is possible for $package to detect those bits and emulate
6057setuid/setgid in a secure fashion. This emulation will only work if
6058setuid scripts have been disabled in your kernel.
6059
6060EOM
6061 case "$d_dosuid" in
6062 "$define") dflt=y ;;
6063 *) dflt=n ;;
6064 esac
6065 rp="Do you want to do setuid/setgid emulation?"
6066 . ./myread
6067 case "$ans" in
6068 [yY]*) val="$define";;
6069 *) val="$undef";;
6070 esac
6071 ;;
6072esac
6073set d_dosuid
6074eval $setvar
6075
b4eb6b3d 6076: see if this is a malloc.h system
01d07975
YST
6077: we want a real compile instead of Inhdr because some systems have a
6078: malloc.h that just gives a compile error saying to use stdlib.h instead
6079echo " "
6080$cat >try.c <<EOCP
6081#include <stdlib.h>
6082#include <malloc.h>
6083int main () { return 0; }
6084EOCP
6085set try
6086if eval $compile; then
6087 echo "<malloc.h> found." >&4
6088 val="$define"
6089else
6090 echo "<malloc.h> NOT found." >&4
6091 val="$undef"
6092fi
6093$rm -f try.c try
6094set i_malloc
6095eval $setvar
b4eb6b3d 6096
c8b93cf9
JH
6097: check for void type
6098echo " "
6099echo "Checking to see how well your C compiler groks the void type..." >&4
6100case "$voidflags" in
6101'')
c727eafa 6102 $cat >try.c <<EOCP
d1daaddf
JH
6103#$i_stdlib I_STDLIB
6104#ifdef I_STDLIB
6105#include <stdlib.h>
6106#endif
c8b93cf9
JH
6107#if TRY & 1
6108void sub() {
6109#else
6110sub() {
6111#endif
6112 extern void moo(); /* function returning void */
6113 void (*goo)(); /* ptr to func returning void */
6114#if TRY & 8
6115 void *hue; /* generic ptr */
6116#endif
6117#if TRY & 2
6118 void (*foo[10])();
6119#endif
6120
6121#if TRY & 4
6122 if(goo == moo) {
6123 exit(0);
6124 }
6125#endif
6126 exit(0);
6127}
6128int main() { sub(); }
6129EOCP
6130 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6131 voidflags=$defvoidused
6132 echo "Good. It appears to support void to the level $package wants.">&4
6133 if $contains warning .out >/dev/null 2>&1; then
6134 echo "However, you might get some warnings that look like this:"
6135 $cat .out
6136 fi
6137 else
6138echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6139 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6140 echo "It supports 1..."
6141 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6142 echo "It also supports 2..."
6143 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6144 voidflags=7
6145 echo "And it supports 4 but not 8 definitely."
6146 else
6147 echo "It doesn't support 4..."
6148 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6149 voidflags=11
6150 echo "But it supports 8."
6151 else
6152 voidflags=3
6153 echo "Neither does it support 8."
6154 fi
6155 fi
6156 else
6157 echo "It does not support 2..."
6158 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6159 voidflags=13
6160 echo "But it supports 4 and 8."
6161 else
6162 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6163 voidflags=5
6164 echo "And it supports 4 but has not heard about 8."
6165 else
6166 echo "However it supports 8 but not 4."
6167 fi
6168 fi
6169 fi
6170 else
6171 echo "There is no support at all for void."
6172 voidflags=0
6173 fi
6174 fi
6175esac
6176case "$voidflags" in
6177"$defvoidused") ;;
6178*) $cat >&4 <<'EOM'
6179 Support flag bits are:
6180 1: basic void declarations.
6181 2: arrays of pointers to functions returning void.
6182 4: operations between pointers to and addresses of void functions.
6183 8: generic void pointers.
6184EOM
6185 dflt="$voidflags";
6186 rp="Your void support flags add up to what?"
6187 . ./myread
6188 voidflags="$ans"
6189 ;;
6190esac
6191$rm -f try.* .out
6192
6193: check for length of pointer
6194echo " "
6195case "$ptrsize" in
6196'')
6197 echo "Checking to see how big your pointers are..." >&4
6198 if test "$voidflags" -gt 7; then
6199 echo '#define VOID_PTR char *' > try.c
6200 else
6201 echo '#define VOID_PTR void *' > try.c
6202 fi
74d00865 6203 $cat >>try.c <<EOCP
c8b93cf9 6204#include <stdio.h>
d1daaddf
JH
6205#$i_stdlib I_STDLIB
6206#ifdef I_STDLIB
6207#include <stdlib.h>
6208#endif
c8b93cf9
JH
6209int main()
6210{
6211 printf("%d\n", (int)sizeof(VOID_PTR));
6212 exit(0);
6213}
6214EOCP
6215 set try
6216 if eval $compile_ok; then
6217 ptrsize=`$run ./try`
6218 echo "Your pointers are $ptrsize bytes long."
6219 else
6220 dflt='4'
6221 echo "(I can't seem to compile the test program. Guessing...)" >&4
6222 rp="What is the size of a pointer (in bytes)?"
6223 . ./myread
6224 ptrsize="$ans"
6225 fi
6226 ;;
6227esac
6228$rm -f try.c try
6229case "$use64bitall" in
6230"$define"|true|[yY]*)
6231 case "$ptrsize" in
6232 4) cat <<EOM >&4
6233
1911a026
JH
6234*** You have chosen a maximally 64-bit build,
6235*** but your pointers are only 4 bytes wide.
09b58c7b
JH
6236*** Please rerun Configure without -Duse64bitall.
6237EOM
6238 case "$d_quad" in
6239 define)
6240 cat <<EOM >&4
6241*** Since you have quads, you could possibly try with -Duse64bitint.
6242EOM
6243 ;;
6244 esac
6245 cat <<EOM >&4
1911a026 6246*** Cannot continue, aborting.
c8b93cf9
JH
6247
6248EOM
09b58c7b 6249
1911a026 6250 exit 1
c8b93cf9
JH
6251 ;;
6252 esac
6253 ;;
6254esac
6255
6256
b4eb6b3d
JH
6257: determine which malloc to compile in
6258echo " "
6259case "$usemymalloc" in
c4163172
JH
6260[yY]*|true|$define) dflt='y' ;;
6261[nN]*|false|$undef) dflt='n' ;;
6262*) case "$ptrsize" in
6263 4) dflt='y' ;;
6264 *) dflt='n' ;;
6265 esac
6266 ;;
8dfa8df9 6267esac
b4eb6b3d
JH
6268rp="Do you wish to attempt to use the malloc that comes with $package?"
6269. ./myread
6270usemymalloc="$ans"
6271case "$ans" in
6272y*|true)
6273 usemymalloc='y'
6274 mallocsrc='malloc.c'
6275 mallocobj="malloc$_o"
6276 d_mymalloc="$define"
6277 case "$libs" in
6278 *-lmalloc*)
6279 : Remove malloc from list of libraries to use
6280 echo "Removing unneeded -lmalloc from library list" >&4
6281 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6282 shift
6283 libs="$*"
6284 echo "libs = $libs" >&4
6285 ;;
6286 esac
6287 ;;
6288*)
6289 usemymalloc='n'
6290 mallocsrc=''
6291 mallocobj=''
6292 d_mymalloc="$undef"
6293 ;;
6294esac
6295
6296: compute the return types of malloc and free
6297echo " "
6298$cat >malloc.c <<END
6299#$i_malloc I_MALLOC
6300#$i_stdlib I_STDLIB
6301#include <stdio.h>
6302#include <sys/types.h>
6303#ifdef I_MALLOC
6304#include <malloc.h>
6305#endif
6306#ifdef I_STDLIB
6307#include <stdlib.h>
6308#endif
6309#ifdef TRY_MALLOC
6310void *malloc();
6311#endif
6312#ifdef TRY_FREE
6313void free();
6314#endif
6315END
6316case "$malloctype" in
6317'')
6318 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6319 malloctype='void *'
6320 else
6321 malloctype='char *'
6322 fi
6323 ;;
6324esac
6325echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6326
6327case "$freetype" in
6328'')
6329 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6330 freetype='void'
6331 else
6332 freetype='int'
6333 fi
6334 ;;
6335esac
6336echo "Your system uses $freetype free(), it would seem." >&4
6337$rm -f malloc.[co]
6338$cat <<EOM
6339
6340After $package is installed, you may wish to install various
6341add-on modules and utilities. Typically, these add-ons will
6342be installed under $prefix with the rest
6343of this package. However, you may wish to install such add-ons
6344elsewhere under a different prefix.
6345
6346If you do not wish to put everything under a single prefix, that's
6347ok. You will be prompted for the individual locations; this siteprefix
6348is only used to suggest the defaults.
6349
6350The default should be fine for most people.
6351
6352EOM
6353fn=d~+
6354rp='Installation prefix to use for add-on modules and utilities?'
6355: XXX Here might be another good place for an installstyle setting.
6356case "$siteprefix" in
6357'') dflt=$prefix ;;
6358*) dflt=$siteprefix ;;
6359esac
6360. ./getfile
6361: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6362oldsiteprefix=''
6363case "$siteprefix" in
6364'') ;;
6365*) case "$ans" in
6366 "$prefix") ;;
6367 *) oldsiteprefix="$prefix";;
6368 esac
6369 ;;
6370esac
6371siteprefix="$ans"
6372siteprefixexp="$ansexp"
6373
6374: determine where site specific libraries go.
6375: Usual default is /usr/local/lib/perl5/site_perl/$version
6376: The default "style" setting is made in installstyle.U
6377: XXX No longer works with Prefixit stuff.
6378prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6379case "$sitelib" in
6380'') case "$installstyle" in
6381 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6382 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6383 esac
6384 ;;
6385*) dflt="$sitelib"
6386 ;;
6387esac
6388$cat <<EOM
6389
6390The installation process will create a directory for
6391site-specific extensions and modules. Most users find it convenient
6392to place all site-specific files in this directory rather than in the
6393main distribution directory.
6394
6395EOM
6396fn=d~+
6397rp='Pathname for the site-specific library files?'
6398. ./getfile
6399sitelib="$ans"
6400sitelibexp="$ansexp"
6401sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6402: Change installation prefix, if necessary.
6403if $test X"$prefix" != X"$installprefix"; then
6404 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6405else
6406 installsitelib="$sitelibexp"
6407fi
6408
6409: determine where site specific architecture-dependent libraries go.
6410: sitelib default is /usr/local/lib/perl5/site_perl/$version
6411: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6412: sitelib may have an optional trailing /share.
6413case "$sitearch" in
6414'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6415 dflt="$dflt/$archname"
6416 ;;
6417*) dflt="$sitearch"
6418 ;;
6419esac
6420set sitearch sitearch none
6421eval $prefixit
6422$cat <<EOM
6423
6424The installation process will also create a directory for
6425architecture-dependent site-specific extensions and modules.
6426
6427EOM
6428fn=d~+
6429rp='Pathname for the site-specific architecture-dependent library files?'
6430. ./getfile
6431sitearch="$ans"
6432sitearchexp="$ansexp"
6433: Change installation prefix, if necessary.
6434if $test X"$prefix" != X"$installprefix"; then
6435 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6436else
6437 installsitearch="$sitearchexp"
6438fi
6439
6440$cat <<EOM
6441
6442The installation process will also create a directory for
6443vendor-supplied add-ons. Vendors who supply perl with their system
6444may find it convenient to place all vendor-supplied files in this
6445directory rather than in the main distribution directory. This will
6446ease upgrades between binary-compatible maintenance versions of perl.
6447
6448Of course you may also use these directories in whatever way you see
6449fit. For example, you might use them to access modules shared over a
6450company-wide network.
6451
6452The default answer should be fine for most people.
6453This causes further questions about vendor add-ons to be skipped
6454and no vendor-specific directories will be configured for perl.
6455
6456EOM
6457rp='Do you want to configure vendor-specific add-on directories?'
6458case "$usevendorprefix" in
6459define|true|[yY]*) dflt=y ;;
6460*) : User may have set vendorprefix directly on Configure command line.
6461 case "$vendorprefix" in
6462 ''|' ') dflt=n ;;
6463 *) dflt=y ;;
6464 esac
6465 ;;
6466esac
6467. ./myread
6468case "$ans" in
6469[yY]*) fn=d~+
6470 rp='Installation prefix to use for vendor-supplied add-ons?'
6471 case "$vendorprefix" in
6472 '') dflt='' ;;
6473 *) dflt=$vendorprefix ;;
6474 esac
6475 . ./getfile
6476 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6477 oldvendorprefix=''
6478 case "$vendorprefix" in
6479 '') ;;
6480 *) case "$ans" in
6481 "$prefix") ;;
6482 *) oldvendorprefix="$prefix";;
6483 esac
6484 ;;
6485 esac
6486 usevendorprefix="$define"
6487 vendorprefix="$ans"
6488 vendorprefixexp="$ansexp"
6489 ;;
6490*) usevendorprefix="$undef"
6491 vendorprefix=''
6492 vendorprefixexp=''
6493 ;;
6494esac
6495
6496case "$vendorprefix" in
6497'') d_vendorlib="$undef"
6498 vendorlib=''
6499 vendorlibexp=''
6500 ;;
6501*) d_vendorlib="$define"
6502 : determine where vendor-supplied modules go.
6503 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6504 case "$vendorlib" in
6505 '')
6506 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6507 case "$installstyle" in
6508 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6509 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6510 esac
6511 ;;
6512 *) dflt="$vendorlib"
6513 ;;
6514 esac
6515 fn=d~+
6516 rp='Pathname for the vendor-supplied library files?'
6517 . ./getfile
6518 vendorlib="$ans"
6519 vendorlibexp="$ansexp"
6520 ;;
6521esac
6522vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6523: Change installation prefix, if necessary.
6524if $test X"$prefix" != X"$installprefix"; then
6525 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6526else
6527 installvendorlib="$vendorlibexp"
6528fi
6529
6530case "$vendorprefix" in
6531'') d_vendorarch="$undef"
6532 vendorarch=''
6533 vendorarchexp=''
6534 ;;
6535*) d_vendorarch="$define"
6536 : determine where vendor-supplied architecture-dependent libraries go.
6537 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6538 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6539 : vendorlib may have an optional trailing /share.
6540 case "$vendorarch" in
6541 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6542 dflt="$dflt/$archname"
6543 ;;
6544 *) dflt="$vendorarch" ;;
6545 esac
6546 fn=d~+
6547 rp='Pathname for vendor-supplied architecture-dependent files?'
6548 . ./getfile
6549 vendorarch="$ans"
6550 vendorarchexp="$ansexp"
6551 ;;
6552esac
6553: Change installation prefix, if necessary.
6554if $test X"$prefix" != X"$installprefix"; then
6555 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6556else
6557 installvendorarch="$vendorarchexp"
6558fi
6559
6560: Final catch-all directories to search
6561$cat <<EOM
6562
6563Lastly, you can have perl look in other directories for extensions and
6564modules in addition to those already specified.
6565These directories will be searched after
6566 $sitearch
6567 $sitelib
6568EOM
6569test X"$vendorlib" != "X" && echo ' ' $vendorlib
6570test X"$vendorarch" != "X" && echo ' ' $vendorarch
6571echo ' '
6572case "$otherlibdirs" in
6573''|' ') dflt='none' ;;
6574*) dflt="$otherlibdirs" ;;
6575esac
6576$cat <<EOM
6577Enter a colon-separated set of extra paths to include in perl's @INC
6578search path, or enter 'none' for no extra paths.
6579
6580EOM
6581
6582rp='Colon-separated list of additional directories for perl to search?'
6583. ./myread
6584case "$ans" in
6585' '|''|none) otherlibdirs=' ' ;;
6586*) otherlibdirs="$ans" ;;
6587esac
6588case "$otherlibdirs" in
6589' ') val=$undef ;;
6590*) val=$define ;;
6591esac
6592set d_perl_otherlibdirs
6593eval $setvar
6594
6595: Cruising for prototypes
6596echo " "
6597echo "Checking out function prototypes..." >&4
55954f19
JH
6598$cat >prototype.c <<EOCP
6599#$i_stdlib I_STDLIB
6600#ifdef I_STDLIB
6601#include <stdlib.h>
6602#endif
b4eb6b3d
JH
6603int main(int argc, char *argv[]) {
6604 exit(0);}
6605EOCP
6606if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6607 echo "Your C compiler appears to support function prototypes."
6608 val="$define"
6609else
6610 echo "Your C compiler doesn't seem to understand function prototypes."
6611 val="$undef"
6612fi
6613set prototype
6614eval $setvar
6615$rm -f prototype*
6616
6617case "$prototype" in
6618"$define") ;;
6619*) ansi2knr='ansi2knr'
6620 echo " "
6621 cat <<EOM >&4
6622
6623$me: FATAL ERROR:
6624This version of $package can only be compiled by a compiler that
6625understands function prototypes. Unfortunately, your C compiler
6626 $cc $ccflags
6627doesn't seem to understand them. Sorry about that.
6628
6629If GNU cc is available for your system, perhaps you could try that instead.
6630
6631Eventually, we hope to support building Perl with pre-ANSI compilers.
6632If you would like to help in that effort, please contact <perlbug@perl.org>.
6633
6634Aborting Configure now.
6635EOM
6636 exit 2
6637 ;;
6638esac
6639
6640: determine where public executables go
6641echo " "
6642set dflt bin bin
6643eval $prefixit
6644fn=d~
6645rp='Pathname where the public executables will reside?'
6646. ./getfile
6647if $test "X$ansexp" != "X$binexp"; then
6648 installbin=''
6649fi
6650bin="$ans"
6651binexp="$ansexp"
6652: Change installation prefix, if necessary.
6653: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6654if $test X"$prefix" != X"$installprefix"; then
6655 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6656else
6657 installbin="$binexp"
6658fi
6659
6fcddf3b 6660echo " "
6fcddf3b 6661case "$extras" in
bf35c3f6
JH
6662'') dflt='n';;
6663*) dflt='y';;
6fcddf3b
JH
6664esac
6665cat <<EOM
6666Perl can be built with extra modules or bundles of modules which
6667will be fetched from the CPAN and installed alongside Perl.
6668
6669Notice that you will need access to the CPAN; either via the Internet,
6670or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
6671be asked later to configure the CPAN.pm module which will in turn do
6672the installation of the rest of the extra modules or bundles.)
6673
6674Notice also that if the modules require any external software such as
dd2de242
JH
6675libraries and headers (the libz library and the zlib.h header for the
6676Compress::Zlib module, for example) you MUST have any such software
6677already installed, this configuration process will NOT install such
6678things for you.
6fcddf3b
JH
6679
6680If this doesn't make any sense to you, just accept the default '$dflt'.
6681EOM
dd2de242 6682rp='Install any extra modules (y or n)?'
6fcddf3b
JH
6683. ./myread
6684case "$ans" in
6685y|Y)
6686 cat <<EOM
6687
6688Please list any extra modules or bundles to be installed from CPAN,
6689with spaces between the names. The names can be in any format the
dd2de242
JH
6690'install' command of CPAN.pm will understand. (Answer 'none',
6691without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
6692EOM
6693 rp='Extras?'
6694 dflt="$extras"
6695 . ./myread
6696 extras="$ans"
6697esac
6698case "$extras" in
6699''|'none')
6700 val=''
6701 $rm -f ../extras.lst
6702 ;;
6703*) echo "(Saving the list of extras for later...)"
dd2de242
JH
6704 echo "$extras" > ../extras.lst
6705 val="'$extras'"
6fcddf3b
JH
6706 ;;
6707esac
6708set extras
6709eval $setvar
6710echo " "
6711
6e1038e0
MB
6712: determine where html pages for programs go
6713set html1dir html1dir none
6714eval $prefixit
6715$cat <<EOM
6716
6717If you wish to install html files for programs in $spackage, indicate
6718the appropriate directory here. To skip installing html files,
6719answer "none".
6720EOM
6721case "$html1dir" in
6722''|none|$undef|' ') dflt=none ;;
6723*) dflt=$html1dir ;;
6724esac
6725fn=dn+~
6726rp="Directory for the main $spackage html pages?"
6727. ./getfile
6728html1dir="$ans"
6729html1direxp="$ansexp"
6730: Use ' ' for none so value is preserved next time through Configure
6731$test X"$html1dir" = "X" && html1dir=' '
6732: Change installation prefix, if necessary.
6733if $test X"$prefix" != X"$installprefix"; then
6734 installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
6735else
6736 installhtml1dir="$html1direxp"
6737fi
6738
6739: determine where html pages for libraries and modules go
6740set html3dir html3dir none
6741eval $prefixit
6742$cat <<EOM
6743
6744If you wish to install html files for modules associated with $spackage,
6745indicate the appropriate directory here. To skip installing html files,
6746answer "none".
6747EOM
6748: There is no obvious default. If they have specified html1dir, then
6749: try to key off that, possibly changing .../html1 into .../html3.
6750case "$html3dir" in
6751'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6752*) dflt=$html3dir ;;
6753esac
6754fn=dn+~
6755rp="Directory for the $spackage module html pages?"
6756. ./getfile
6757html3dir="$ans"
6758html3direxp="$ansexp"
6759: Use ' ' for none so value is preserved next time through Configure
6760$test X"$html3dir" = "X" && html3dir=' '
6761: Change installation prefix, if necessary.
6762if $test X"$prefix" != X"$installprefix"; then
6763 installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
6764else
6765 installhtml3dir="$html3direxp"
6766fi
6767
b4eb6b3d
JH
6768: Find perl5.005 or later.
6769echo "Looking for a previously installed perl5.005 or later... "
6770case "$perl5" in
a938a3bb 6771'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
b4eb6b3d 6772 : Check if this perl is recent and can load a simple module
a938a3bb 6773 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
b4eb6b3d
JH
6774 perl5=$tdir/perl
6775 break;
a938a3bb
IZ
6776 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6777 perl5=$tdir/perl5
b4eb6b3d
JH
6778 break;
6779 fi
89ce900e
JH
6780 done
6781 ;;
6782*) perl5="$perl5"
6783 ;;
6784esac
6785case "$perl5" in
6786'') echo "None found. That's ok.";;
6787*) echo "Using $perl5." ;;
6788esac
6789
6790: Determine list of previous versions to include in @INC
6791$cat > getverlist <<EOPL
6792#!$perl5 -w
6793use File::Basename;
6794\$api_versionstring = "$api_versionstring";
6795\$version = "$version";
6796\$stem = "$sitelib_stem";
6797\$archname = "$archname";
6798EOPL
6799 $cat >> getverlist <<'EOPL'
6800# Can't have leading @ because metaconfig interprets it as a command!
6801;@inc_version_list=();
6802# XXX Redo to do opendir/readdir?
6803if (-d $stem) {
6804 chdir($stem);
6805 ;@candidates = glob("5.*");
6806}
6807else {
6808 ;@candidates = ();
6809}
6810
6811# XXX ToDo: These comparisons must be reworked when two-digit
6812# subversions come along, so that 5.7.10 compares as greater than
6813# 5.7.3! By that time, hope that 5.6.x is sufficiently
6814# widespread that we can use the built-in version vectors rather
6815# than reinventing them here. For 5.6.0, however, we must
6816# assume this script will likely be run by 5.005_0x. --AD 1/2000.
6817foreach $d (@candidates) {
6818 if ($d lt $version) {
6819 if ($d ge $api_versionstring) {
6820 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6821 }
6822 elsif ($d ge "5.005") {
6823 unshift(@inc_version_list, grep { -d } $d);
6824 }
6825 }
6826 else {
6827 # Skip newer version. I.e. don't look in
6828 # 5.7.0 if we're installing 5.6.1.
6829 }
6830}
6831
6832if (@inc_version_list) {
6833 print join(' ', @inc_version_list);
6834}
6835else {
6836 # Blank space to preserve value for next Configure run.
6837 print " ";
6838}
6839EOPL
6840chmod +x getverlist
6841case "$inc_version_list" in
6842'') if test -x "$perl5$exe_ext"; then
6843 dflt=`$perl5 getverlist`
6844 else
6845 dflt='none'
6846 fi
6847 ;;
6848$undef) dflt='none' ;;
6849*) eval dflt=\"$inc_version_list\" ;;
6850esac
6851case "$dflt" in
6852''|' ') dflt=none ;;
6853esac
6854case "$dflt" in
68555.005) dflt=none ;;
6856esac
6857$cat <<EOM
6858
6859In order to ease the process of upgrading, this version of perl
6860can be configured to use modules built and installed with earlier
6861versions of perl that were installed under $prefix. Specify here
6862the list of earlier versions that this version of perl should check.
6863If Configure detected no earlier versions of perl installed under
6864$prefix, then the list will be empty. Answer 'none' to tell perl
6865to not search earlier versions.
6866
6867The default should almost always be sensible, so if you're not sure,
6868just accept the default.
6869EOM
6870
6871rp='List of earlier versions to include in @INC?'
6872. ./myread
6873case "$ans" in
6874[Nn]one|''|' ') inc_version_list=' ' ;;
6875*) inc_version_list="$ans" ;;
6876esac
6877case "$inc_version_list" in
6878''|' ')
6879 inc_version_list_init='0';;
6880*) inc_version_list_init=`echo $inc_version_list |
6881 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6882 ;;
6883esac
6884$rm -f getverlist
6885
6886: determine whether to install perl also as /usr/bin/perl
6887
6888echo " "
6889if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6890 $cat <<EOM
6891Many scripts expect perl to be installed as /usr/bin/perl.
6892
6893If you want to, I can install the perl you are about to compile
6894as /usr/bin/perl (in addition to $bin/perl).
6895EOM
6896 if test -f /usr/bin/perl; then
6897 $cat <<EOM
6898
6899However, please note that because you already have a /usr/bin/perl,
6900overwriting that with a new Perl would very probably cause problems.
6901Therefore I'm assuming you don't want to do that (unless you insist).
6902
6903EOM
6904 case "$installusrbinperl" in
6905 "$define"|[yY]*) dflt='y';;
6906 *) dflt='n';;
6907 esac
6908 else
6909 $cat <<EOM
6910
6911Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
6912
6913EOM
6914 case "$installusrbinperl" in
6915 "$undef"|[nN]*) dflt='n';;
6916 *) dflt='y';;
6917 esac
6918 fi
6919 rp="Do you want to install perl as /usr/bin/perl?"
6920 . ./myread
6921 case "$ans" in
6922 [yY]*) val="$define";;
6923 *) val="$undef" ;;
6924 esac
6925else
6926 val="$undef"
6927fi
6928set installusrbinperl
6929eval $setvar
6930
6931echo " "
6932echo "Checking for GNU C Library..." >&4
6933cat >try.c <<'EOCP'
6934/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
6935 alone are insufficient to distinguish different versions, such as
6936 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
6937 libc version 2.1.0. A. Dougherty, June 3, 2002.
6938*/
6939#include <stdio.h>
6940int main(void)
6941{
6942#ifdef __GLIBC__
6943# ifdef __GLIBC_MINOR__
6944# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
6945# include <gnu/libc-version.h>
6946 printf("%s\n", gnu_get_libc_version());
6947# else
6948 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
6949# endif
6950# else
6951 printf("%d\n", __GLIBC__);
6952# endif
6953 return 0;
6954#else
6955 return 1;
6956#endif
6957}
6958EOCP
6959set try
6960if eval $compile_ok && $run ./try > glibc.ver; then
6961 val="$define"
6962 gnulibc_version=`$cat glibc.ver`
6963 echo "You are using the GNU C Library version $gnulibc_version"
6964else
6965 val="$undef"
6966 gnulibc_version=''
6967 echo "You are not using the GNU C Library"
6968fi
6969$rm -f try try.* glibc.ver
6970set d_gnulibc
6971eval $setvar
6972
6973: see if nm is to be used to determine whether a symbol is defined or not
6974case "$usenm" in
6975'')
6976 dflt=''
6977 case "$d_gnulibc" in
6978 "$define")
6979 echo " "
6980 echo "nm probably won't work on the GNU C Library." >&4
6981 dflt=n
6982 ;;
6983 esac
6984 case "$dflt" in
6985 '')
6986 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6987 echo " "
6988 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
6989 echo "'nm' won't be sufficient on this sytem." >&4
6990 dflt=n
6991 fi
6992 ;;
6993 esac
6994 case "$dflt" in
6995 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6996 if $test $dflt -gt 20; then
6997 dflt=y
6998 else
6999 dflt=n
7000 fi
7001 ;;
7002 esac
b4eb6b3d 7003 ;;
89ce900e
JH
7004*)
7005 case "$usenm" in
7006 true|$define) dflt=y;;
7007 *) dflt=n;;
7008 esac
b4eb6b3d
JH
7009 ;;
7010esac
89ce900e 7011$cat <<EOM
b4eb6b3d 7012
89ce900e
JH
7013I can use $nm to extract the symbols from your C libraries. This
7014is a time consuming task which may generate huge output on the disk (up
7015to 3 megabytes) but that should make the symbols extraction faster. The
7016alternative is to skip the 'nm' extraction part and to compile a small
7017test program instead to determine whether each symbol is present. If
7018you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7019this may be the best solution.
b4eb6b3d 7020
89ce900e 7021You probably shouldn't let me use 'nm' if you are using the GNU C Library.
b4eb6b3d 7022
89ce900e
JH
7023EOM
7024rp="Shall I use $nm to extract C symbols from the libraries?"
7025. ./myread
7026case "$ans" in
7027[Nn]*) usenm=false;;
7028*) usenm=true;;
b4eb6b3d 7029esac
89ce900e
JH
7030
7031runnm=$usenm
7032case "$reuseval" in
7033true) runnm=false;;
b4eb6b3d 7034esac
b4eb6b3d 7035
89ce900e
JH
7036: nm options which may be necessary
7037case "$nm_opt" in
7038'') if $test -f /mach_boot; then
7039 nm_opt='' # Mach
7040 elif $test -d /usr/ccs/lib; then
7041 nm_opt='-p' # Solaris (and SunOS?)
7042 elif $test -f /dgux; then
7043 nm_opt='-p' # DG-UX
7044 elif $test -f /lib64/rld; then
7045 nm_opt='-p' # 64-bit Irix
7046 else
7047 nm_opt=''
7048 fi;;
7049esac
b4eb6b3d 7050
89ce900e
JH
7051: nm options which may be necessary for shared libraries but illegal
7052: for archive libraries. Thank you, Linux.
7053case "$nm_so_opt" in
7054'') case "$myuname" in
7055 *linux*)
7056 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7057 nm_so_opt='--dynamic'
7058 fi
7059 ;;
7060 esac
7061 ;;
7062esac
b4eb6b3d 7063
89ce900e
JH
7064case "$runnm" in
7065true)
7066: get list of predefined functions in a handy place
7067echo " "
7068case "$libc" in
7069'') libc=unknown
7070 case "$libs" in
7071 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7072 esac
7073 ;;
b4eb6b3d 7074esac
89ce900e
JH
7075case "$libs" in
7076'') ;;
7077*) for thislib in $libs; do
7078 case "$thislib" in
7079 -lc|-lc_s)
7080 : Handle C library specially below.
7081 ;;
7082 -l*)
7083 thislib=`echo $thislib | $sed -e 's/^-l//'`
7084 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7085 :
7086 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7087 :
7088 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7089 :
7090 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7091 :
7092 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7093 :
7094 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7095 :
7096 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7097 :
7098 else
7099 try=''
7100 fi
7101 libnames="$libnames $try"
7102 ;;
7103 *) libnames="$libnames $thislib" ;;
7104 esac
7105 done
b4eb6b3d
JH
7106 ;;
7107esac
89ce900e
JH
7108xxx=normal
7109case "$libc" in
7110unknown)
7111 set /lib/libc.$so
7112 for xxx in $libpth; do
7113 $test -r $1 || set $xxx/libc.$so
7114 : The messy sed command sorts on library version numbers.
7115 $test -r $1 || \
7116 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7117 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7118 h
7119 s/[0-9][0-9]*/0000&/g
7120 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7121 G
7122 s/\n/ /' | \
7123 $sort | $sed -e 's/^.* //'`
7124 eval set \$$#
7125 done
7126 $test -r $1 || set /usr/ccs/lib/libc.$so
7127 $test -r $1 || set /lib/libsys_s$_a
7128 ;;
7129*)
7130 set blurfl
7131 ;;
7132esac
7133if $test -r "$1"; then
7134 echo "Your (shared) C library seems to be in $1."
7135 libc="$1"
7136elif $test -r /lib/libc && $test -r /lib/clib; then
7137 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7138 xxx=apollo
7139 libc='/lib/clib /lib/libc'
7140 if $test -r /lib/syslib; then
7141 echo "(Your math library is in /lib/syslib.)"
7142 libc="$libc /lib/syslib"
7143 fi
7144elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7145 echo "Your C library seems to be in $libc, as you said before."
7146elif $test -r $incpath/usr/lib/libc$_a; then
7147 libc=$incpath/usr/lib/libc$_a;
7148 echo "Your C library seems to be in $libc. That's fine."
7149elif $test -r /lib/libc$_a; then
7150 libc=/lib/libc$_a;
7151 echo "Your C library seems to be in $libc. You're normal."
7152else
7153 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7154 :
7155 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7156 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7157 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7158 :
7159 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7160 :
7161 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7162 :
7163 else
7164 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7165 fi
7166 if $test -r "$tans"; then
7167 echo "Your C library seems to be in $tans, of all places."
7168 libc=$tans
7169 else
7170 libc='blurfl'
7171 fi
7172fi
7173if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7174 dflt="$libc"
7175 cat <<EOM
b4eb6b3d 7176
89ce900e
JH
7177If the guess above is wrong (which it might be if you're using a strange
7178compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7179
89ce900e
JH
7180EOM
7181else
7182 dflt=''
7183 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7184 cat >&4 <<EOM
7185I can't seem to find your C library. I've looked in the following places:
5e366f65 7186
b4eb6b3d 7187EOM
89ce900e
JH
7188 $sed 's/^/ /' libpath
7189 cat <<EOM
5e366f65 7190
89ce900e 7191None of these seems to contain your C library. I need to get its name...
5e366f65
JH
7192
7193EOM
89ce900e
JH
7194fi
7195fn=f
7196rp='Where is your C library?'
7197. ./getfile
7198libc="$ans"
5e366f65 7199
89ce900e
JH
7200echo " "
7201echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7202set X `cat libnames`
7203shift
7204xxx=files
7205case $# in 1) xxx=file; esac
7206echo "Extracting names from the following $xxx for later perusal:" >&4
7207echo " "
7208$sed 's/^/ /' libnames >&4
7209echo " "
7210$echo $n "This may take a while...$c" >&4
5e366f65 7211
89ce900e
JH
7212for file in $*; do
7213 case $file in
7214 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7215 *) $nm $nm_opt $file 2>/dev/null;;
b4eb6b3d 7216 esac
89ce900e
JH
7217done >libc.tmp
7218
7219$echo $n ".$c"
7220$grep fprintf libc.tmp > libc.ptf
7221xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7222xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7223xxx='[ADTSIW]'
ab900c53 7224if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
89ce900e
JH
7225 eval $xscan;\
7226 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7227 eval $xrun
7228elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7229 eval $xscan;\
7230 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7231 eval $xrun
7232elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7233 eval $xscan;\
7234 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7235 eval $xrun
7236elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7237 eval $xscan;\
7238 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7239 eval $xrun
7240elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7241 eval $xscan;\
7242 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7243 eval $xrun
7244elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7245 eval $xscan;\
7246 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7247 eval $xrun
7248elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7249 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7250 eval $xscan;\
7251 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7252 eval $xrun
7253elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7254 eval $xscan;\
7255 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7256 eval $xrun
7257elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7258 eval $xscan;\
7259 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7260 eval $xrun
7261elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7262 eval $xscan;\
7263 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7264 eval $xrun
7265elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7266 eval $xscan;\
7267 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7268 eval $xrun
7269elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7270 eval $xscan;\
7271 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7272 eval $xrun
7273elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7274 eval $xscan;\
7275 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7276 eval $xrun
7277elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7278 eval $xscan;\
7279 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7280 eval $xrun
b4eb6b3d 7281else
89ce900e
JH
7282 $nm -p $* 2>/dev/null >libc.tmp
7283 $grep fprintf libc.tmp > libc.ptf
7284 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7285 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7286 then
7287 nm_opt='-p'
7288 eval $xrun
7289 else
7290 echo " "
7291 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7292 com=''
7293 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7294 for thisname in $libnames $libc; do
7295 $ar t $thisname >>libc.tmp
7296 done
7297 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7298 echo "Ok." >&4
7299 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7300 # Repeat libc to extract forwarders to DLL entries too
7301 for thisname in $libnames $libc; do
7302 $ar tv $thisname >>libc.tmp
7303 # Revision 50 of EMX has bug in $ar.
7304 # it will not extract forwarders to DLL entries
7305 # Use emximp which will extract exactly them.
7306 emximp -o tmp.imp $thisname \
7307 2>/dev/null && \
7308 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7309 < tmp.imp >>libc.tmp
7310 $rm tmp.imp
7311 done
7312 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7313 echo "Ok." >&4
7314 else
7315 echo "$ar didn't seem to work right." >&4
7316 echo "Maybe this is a Cray...trying bld instead..." >&4
7317 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7318 then
7319 for thisname in $libnames; do
7320 bld t $libnames | \
7321 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7322 $ar t $thisname >>libc.tmp
7323 done
7324 echo "Ok." >&4
7325 else
7326 echo "That didn't work either. Giving up." >&4
7327 exit 1
7328 fi
7329 fi
7330 fi
b4eb6b3d 7331fi
89ce900e
JH
7332nm_extract="$com"
7333case "$PASE" in
7334define)
7335 echo " "
7336 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7337 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7338 ;;
7339*) if $test -f /lib/syscalls.exp; then
7340 echo " "
7341 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7342 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' /lib/syscalls.exp >>libc.list
7343 fi
7344 ;;
7345esac
7346;;
7347esac
7348$rm -f libnames libpath
b4eb6b3d
JH
7349
7350: see if dld is available
7351set dld.h i_dld
7352eval $inhdr
7353
89ce900e
JH
7354: is a C symbol defined?
7355csym='tlook=$1;
7356case "$3" in
7357-v) tf=libc.tmp; tc=""; tdc="";;
7358-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5129fff4 7359*) tlook="^$1\$"; tf=libc.list; tc=""; tdc="()";;
89ce900e
JH
7360esac;
7361tx=yes;
7362case "$reuseval-$4" in
7363true-) ;;
7364true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7365esac;
7366case "$tx" in
7367yes)
ab900c53 7368 tval=false;
5129fff4
JH
7369 if $test "$runnm" = true; then
7370 if $contains $tlook $tf >/dev/null 2>&1; then
ab900c53 7371 tval=true;
5129fff4 7372 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
88cf0b85 7373 echo "int main() { extern void *$1$tdc; if (&$1$tc) return(0); else return(1); }" > try.c;
5129fff4
JH
7374 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7375 $test "$mistrustnm" = run -a -x try && { $run ./try >/dev/null 2>&1 || tval=false; };
7376 $rm -f try try.c core;
89ce900e 7377 fi;
5129fff4
JH
7378 else
7379 echo "#include <stdio.h>" > try.c;
88cf0b85 7380 echo "int main() { extern void *$1$tdc; if(&$1$tc) return(0); else return(1); }" > try.c;
5129fff4
JH
7381 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7382 $rm -f try try.c;
ab900c53
AB
7383 fi;
7384 ;;
89ce900e
JH
7385*)
7386 case "$tval" in
7387 $define) tval=true;;
7388 *) tval=false;;
ab900c53
AB
7389 esac;
7390 ;;
89ce900e
JH
7391esac;
7392eval "$2=$tval"'
7393
7394: define an is-in-libc? function
7395inlibc='echo " "; td=$define; tu=$undef;
7396sym=$1; var=$2; eval "was=\$$2";
7397tx=yes;
7398case "$reuseval$was" in
7399true) ;;
7400true*) tx=no;;
7401esac;
7402case "$tx" in
7403yes)
7404 set $sym tres -f;
7405 eval $csym;
7406 case "$tres" in
7407 true)
7408 echo "$sym() found." >&4;
7409 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7410 *)
7411 echo "$sym() NOT found." >&4;
7412 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7413 esac;;
7414*)
7415 case "$was" in
7416 $define) echo "$sym() found." >&4;;
7417 *) echo "$sym() NOT found." >&4;;
7418 esac;;
7419esac'
7420
b4eb6b3d
JH
7421: see if dlopen exists
7422xxx_runnm="$runnm"
7423runnm=false
7424set dlopen d_dlopen
7425eval $inlibc
7426runnm="$xxx_runnm"
7427
7428: determine which dynamic loading, if any, to compile in
7429echo " "
7430dldir="ext/DynaLoader"
7431case "$usedl" in
7432$define|y|true)
7433 dflt='y'
7434 usedl="$define"
7435 ;;
7436$undef|n|false)
7437 dflt='n'
7438 usedl="$undef"
7439 ;;
7440*)
7441 dflt='n'
7442 case "$d_dlopen" in
7443 $define) dflt='y' ;;
7444 esac
7445 case "$i_dld" in
7446 $define) dflt='y' ;;
7447 esac
7448 : Does a dl_xxx.xs file exist for this operating system
7449 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7450 ;;
7451esac
7452rp="Do you wish to use dynamic loading?"
7453. ./myread
7454usedl="$ans"
7455case "$ans" in
7456y*) usedl="$define"
7457 case "$dlsrc" in
7458 '')
7459 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7460 dflt="$dldir/dl_${osname}.xs"
7461 elif $test "$d_dlopen" = "$define" ; then
7462 dflt="$dldir/dl_dlopen.xs"
7463 elif $test "$i_dld" = "$define" ; then
7464 dflt="$dldir/dl_dld.xs"
7465 else
7466 dflt=''
7467 fi
7468 ;;
7469 *) dflt="$dldir/$dlsrc"
7470 ;;
7471 esac
7472 echo "The following dynamic loading files are available:"
7473 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7474 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7475 rp="Source file to use for dynamic loading"
7476 fn="fne"
7477 gfpth="$src"
7478 . ./getfile
7479 usedl="$define"
7480 : emulate basename
7481 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7482
7483 $cat << EOM
7484
7485Some systems may require passing special flags to $cc -c to
7486compile modules that will be used to create a shared library.
7487To use no flags, say "none".
7488
7489EOM
7490 case "$cccdlflags" in
7491 '') case "$gccversion" in
7492 '') case "$osname" in
7493 hpux) dflt='+z' ;;
7494 next) dflt='none' ;;
7495 irix*) dflt='-KPIC' ;;
48bcfe03 7496 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7497 sunos) dflt='-pic' ;;
7498 *) dflt='none' ;;
7499 esac
7500 ;;
7501 *) case "$osname" in
b6cc0f4c 7502 darwin) dflt='none' ;;
48bcfe03 7503 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7504 *) dflt='-fpic' ;;
7505 esac ;;
7506 esac ;;
7507 ' ') dflt='none' ;;
7508 *) dflt="$cccdlflags" ;;
7509 esac
7510 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7511 . ./myread
7512 case "$ans" in
7513 none) cccdlflags=' ' ;;
7514 *) cccdlflags="$ans" ;;
7515 esac
7516
7517 cat << EOM
7518
7519Some systems use ld to create libraries that can be dynamically loaded,
7520while other systems (such as those using ELF) use $cc.
7521
7522EOM
7523 case "$ld" in
55954f19 7524 '') $cat >try.c <<EOM
b4eb6b3d
JH
7525/* Test for whether ELF binaries are produced */
7526#include <fcntl.h>
55954f19
JH
7527#$i_stdlib I_STDLIB
7528#ifdef I_STDLIB
b4eb6b3d 7529#include <stdlib.h>
55954f19 7530#endif
b4eb6b3d
JH
7531int main() {
7532 char b[4];
7533 int i = open("a.out",O_RDONLY);
7534 if(i == -1)
7535 exit(1); /* fail */
7536 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7537 exit(0); /* succeed (yes, it's ELF) */
7538 else
7539 exit(1); /* fail */
7540}
7541EOM
5440bc8e 7542 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7543 cat <<EOM
7544You appear to have ELF support. I'll use $cc to build dynamic libraries.
7545EOM
7546 dflt="$cc"
7547 else
7548 echo "I'll use ld to build dynamic libraries."
7549 dflt='ld'
7550 fi
7551 rm -f try.c a.out
7552 ;;
7553 *) dflt="$ld"
7554 ;;
7555 esac
7556
7557 rp="What command should be used to create dynamic libraries?"
7558 . ./myread
7559 ld="$ans"
7560
7561 cat << EOM
7562
7563Some systems may require passing special flags to $ld to create a
7564library that can be dynamically loaded. If your ld flags include
7565-L/other/path options to locate libraries outside your loader's normal
7566search path, you may need to specify those -L options here as well. To
7567use no flags, say "none".
7568
7569EOM
7570 case "$lddlflags" in
7571 '') case "$osname" in
7572 beos) dflt='-nostart' ;;
7573 hpux) dflt='-b';
7574 case "$gccversion" in
7575 '') dflt="$dflt +vnocompatwarnings" ;;
7576 esac
7577 ;;
7578 linux|irix*) dflt='-shared' ;;
7579 next) dflt='none' ;;
7580 solaris) dflt='-G' ;;
7581 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 7582 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
7583 *) dflt='none' ;;
7584 esac
7585 ;;
7586 *) dflt="$lddlflags" ;;
7587 esac
7588
7589 : Try to guess additional flags to pick up local libraries.
7590 : Be careful not to append to a plain 'none'
7591 case "$dflt" in
7592 none) dflt='' ;;
7593 esac
7594 for thisflag in $ldflags; do
7595 case "$thisflag" in
b5b9f165 7596 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
7597 case " $dflt " in
7598 *" $thisflag "*) ;;
7599 *) dflt="$dflt $thisflag" ;;
7600 esac
7601 ;;
7602 esac
7603 done
7604
7605 case "$dflt" in
7606 ''|' ') dflt='none' ;;
7607 esac
7608
7609 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7610 . ./myread
7611 case "$ans" in
7612 none) lddlflags=' ' ;;
7613 *) lddlflags="$ans" ;;
7614 esac
7615
7616 cat <<EOM
7617
7618Some systems may require passing special flags to $cc to indicate that
7619the resulting executable will use dynamic linking. To use no flags,
7620say "none".
7621
7622EOM
7623 case "$ccdlflags" in
7624 '') case "$osname" in
7625 hpux) dflt='-Wl,-E' ;;
7626 linux) dflt='-rdynamic' ;;
7627 next) dflt='none' ;;
7628 sunos) dflt='none' ;;
7629 *) dflt='none' ;;
7630 esac ;;
7631 ' ') dflt='none' ;;
7632 *) dflt="$ccdlflags" ;;
7633 esac
7634 rp="Any special flags to pass to $cc to use dynamic linking?"
7635 . ./myread
7636 case "$ans" in
7637 none) ccdlflags=' ' ;;
7638 *) ccdlflags="$ans" ;;
7639 esac
7640 ;;
7641*) usedl="$undef"
7642 ld='ld'
7643 dlsrc='dl_none.xs'
7644 lddlflags=''
7645 ccdlflags=''
7646 ;;
7647esac
7648
7649also=''
7650case "$usedl" in
7651$undef)
7652 # No dynamic loading being used, so don't bother even to prompt.
7653 useshrplib='false'
7654 ;;
7655*) case "$useshrplib" in
7656 '') case "$osname" in
48bcfe03 7657 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7658 dflt=y
7659 also='Building a shared libperl is required for dynamic loading to work on your system.'
7660 ;;
7661 next*)
7662 case "$osvers" in
7663 4*) dflt=y
7664 also='Building a shared libperl is needed for MAB support.'
7665 ;;
7666 *) dflt=n
7667 ;;
7668 esac
7669 ;;
7670 *) dflt=n
7671 ;;
7672 esac
7673 ;;
7674 $define|true|[Yy]*)
7675 dflt=y
7676 ;;
7677 *) dflt=n
7678 ;;
7679 esac
7680 $cat << EOM
7681
7682The perl executable is normally obtained by linking perlmain.c with
7683libperl${_a}, any static extensions (usually just DynaLoader), and
7684any other libraries needed on this system (such as -lm, etc.). Since
7685your system supports dynamic loading, it is probably possible to build
7686a shared libperl.$so. If you will have more than one executable linked
7687to libperl.$so, this will significantly reduce the size of each
7688executable, but it may have a noticeable affect on performance. The
7689default is probably sensible for your system.
7690$also
7691
7692EOM
7693 rp="Build a shared libperl.$so (y/n)"
7694 . ./myread
7695 case "$ans" in
7696 true|$define|[Yy]*)
7697 useshrplib='true' ;;
7698 *) useshrplib='false' ;;
7699 esac
7700 ;;
7701esac
7702
7703case "$useshrplib" in
7704true)
7705 case "$libperl" in
7706 '')
7707 # Figure out a good name for libperl.so. Since it gets stored in
7708 # a version-specific architecture-dependent library, the version
7709 # number isn't really that important, except for making cc/ld happy.
7710 #
7711 # A name such as libperl.so.3.1
7712 majmin="libperl.$so.$patchlevel.$subversion"
7713 # A name such as libperl.so.301
7714 majonly=`echo $patchlevel $subversion |
7715 $awk '{printf "%d%02d", $1, $2}'`
7716 majonly=libperl.$so.$majonly
7717 # I'd prefer to keep the os-specific stuff here to a minimum, and
7718 # rely on figuring it out from the naming of libc.
7719 case "${osname}${osvers}" in
7720 next4*)
7721 dflt=libperl.5.$so
7722 # XXX How handle the --version stuff for MAB?
7723 ;;
7724 linux*) # ld won't link with a bare -lperl otherwise.
7725 dflt=libperl.$so
7726 ;;
b53432e4
GH
7727 cygwin*) # ld links against an importlib
7728 dflt=libperl$lib_ext
b4eb6b3d
JH
7729 ;;
7730 *) # Try to guess based on whether libc has major.minor.
7731 case "$libc" in
7732 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7733 *libc.$so.[0-9]*) dflt=$majonly ;;
7734 *) dflt=libperl.$so ;;
7735 esac
7736 ;;
7737 esac
7738 ;;
7739 *) dflt=$libperl
7740 ;;
7741 esac
7742 cat << EOM
7743
7744I need to select a good name for the shared libperl. If your system uses
7745library names with major and minor numbers, then you might want something
7746like $majmin. Alternatively, if your system uses a single version
7747number for shared libraries, then you might want to use $majonly.
7748Or, your system might be quite happy with a simple libperl.$so.
7749
7750Since the shared libperl will get installed into a version-specific
7751architecture-dependent directory, the version number of the shared perl
7752library probably isn't important, so the default should be o.k.
7753
7754EOM
7755 rp='What name do you want to give to the shared libperl?'
7756 . ./myread
7757 libperl=$ans
7758 echo "Ok, I'll use $libperl"
7759 ;;
7760*)
7761 libperl="libperl${_a}"
7762 ;;
7763esac
7764
7765# Detect old use of shrpdir via undocumented Configure -Dshrpdir
7766case "$shrpdir" in
7767'') ;;
7768*) $cat >&4 <<EOM
7769WARNING: Use of the shrpdir variable for the installation location of
7770the shared $libperl is not supported. It was never documented and
7771will not work in this version. Let me (perlbug@perl.org)
7772know of any problems this may cause.
7773
7774EOM
7775 case "$shrpdir" in
7776 "$archlibexp/CORE")
7777 $cat >&4 <<EOM
7778But your current setting of $shrpdir is
7779the default anyway, so it's harmless.
7780EOM
7781 ;;
7782 *)
7783 $cat >&4 <<EOM
7784Further, your current attempted setting of $shrpdir
7785conflicts with the value of $archlibexp/CORE
7786that installperl will use.
7787EOM
7788 ;;
7789 esac
7790 ;;
7791esac
7792
7793# How will the perl executable find the installed shared $libperl?
7794# Add $xxx to ccdlflags.
7795# If we can't figure out a command-line option, use $shrpenv to
7796# set env LD_RUN_PATH. The main perl makefile uses this.
7797shrpdir=$archlibexp/CORE
7798xxx=''
7799tmp_shrpenv=''
7800if "$useshrplib"; then
7801 case "$osname" in
7802 aix)
7803 # We'll set it in Makefile.SH...
7804 ;;
b5b9f165 7805 solaris)
b4eb6b3d
JH
7806 xxx="-R $shrpdir"
7807 ;;
32b2ae02 7808 freebsd|netbsd|openbsd)
b4eb6b3d
JH
7809 xxx="-Wl,-R$shrpdir"
7810 ;;
6b20d41b 7811 bsdos|linux|irix*|dec_osf)
b4eb6b3d
JH
7812 xxx="-Wl,-rpath,$shrpdir"
7813 ;;
7814 next)
7815 # next doesn't like the default...
7816 ;;
7817 beos)
7818 # beos doesn't like the default, either.
7819 ;;
7820 hpux*)
7821 # hpux doesn't like the default, either.
7822 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7823 ;;
7824 *)
7825 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7826 ;;
7827 esac
7828 case "$xxx" in
7829 '') ;;
7830 *)
7831 # Only add $xxx if it isn't already in ccdlflags.
7832 case " $ccdlflags " in
7833 *" $xxx "*) ;;
7834 *) ccdlflags="$ccdlflags $xxx"
7835 cat <<EOM >&4
7836
7837Adding $xxx to the flags
7838passed to $ld so that the perl executable will find the
7839installed shared $libperl.
7840
7841EOM
7842 ;;
7843 esac
7844 ;;
7845 esac
7846fi
7847# Fix ccdlflags in AIX for building external extensions.
7848# (For building Perl itself bare -bE:perl.exp is needed,
7849# Makefile.SH takes care of this.)
7850case "$osname" in
7851aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7852esac
7853# Respect a hint or command-line value.
7854case "$shrpenv" in
7855'') shrpenv="$tmp_shrpenv" ;;
7856esac
7857case "$ldlibpthname" in
7858'') ldlibpthname=LD_LIBRARY_PATH ;;
7859none) ldlibpthname='' ;;
7860esac
7861
7862: determine where manual pages are on this system
7863echo " "
7864case "$sysman" in
7865'')
4a0a3829
SD
7866 syspath='/usr/share/man/man1 /usr/man/man1'
7867 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7868 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
7869 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7870 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7871 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7872 sysman=`./loc . /usr/man/man1 $syspath`
7873 ;;
7874esac
7875if $test -d "$sysman"; then
7876 echo "System manual is in $sysman." >&4
7877else
7878 echo "Could not find manual pages in source form." >&4
7879fi
7880
7881: determine where manual pages go
7882set man1dir man1dir none
7883eval $prefixit
7884$cat <<EOM
7885
7886$spackage has manual pages available in source form.
7887EOM
7888case "$nroff" in
7889nroff)
7890 echo "However, you don't have nroff, so they're probably useless to you."
7891 case "$man1dir" in
7892 '') man1dir="none";;
7893 esac;;
7894esac
7895echo "If you don't want the manual sources installed, answer 'none'."
7896case "$man1dir" in
7897' ') dflt=none
7898 ;;
7899'')
4a0a3829
SD
7900 lookpath="$prefixexp/share/man/man1"
7901 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
7902 lookpath="$lookpath $prefixexp/man/p_man/man1"
7903 lookpath="$lookpath $prefixexp/man/u_man/man1"
7904 lookpath="$lookpath $prefixexp/man/man.1"
7905 case "$sysman" in
7906 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7907 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7908 esac
7909 set dflt
7910 eval $prefixup
7911 ;;
7912*) dflt="$man1dir"
7913 ;;
7914esac
7915echo " "
7916fn=dn+~
7917rp="Where do the main $spackage manual pages (source) go?"
7918. ./getfile
7919if $test "X$man1direxp" != "X$ansexp"; then
7920 installman1dir=''
7921fi
7922man1dir="$ans"
7923man1direxp="$ansexp"
7924case "$man1dir" in
7925'') man1dir=' '
7926 installman1dir='';;
7927esac
7928
7929: Change installation prefix, if necessary.
7930if $test X"$prefix" != X"$installprefix"; then
7931 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7932else
7933 installman1dir="$man1direxp"
7934fi
7935
7936: What suffix to use on installed man pages
7937
7938case "$man1dir" in
7939' ')
7940 man1ext='0'
7941 ;;
7942*)
7943 rp="What suffix should be used for the main $spackage man pages?"
7944 case "$man1ext" in
7945 '') case "$man1dir" in
7946 *1) dflt=1 ;;
7947 *1p) dflt=1p ;;
7948 *1pm) dflt=1pm ;;
7949 *l) dflt=l;;
7950 *n) dflt=n;;
7951 *o) dflt=o;;
7952 *p) dflt=p;;
7953 *C) dflt=C;;
7954 *L) dflt=L;;
7955 *L1) dflt=L1;;
7956 *) dflt=1;;
7957 esac
7958 ;;
7959 *) dflt="$man1ext";;
7960 esac
7961 . ./myread
7962 man1ext="$ans"
7963 ;;
7964esac
7965
7966: see if we can have long filenames
7967echo " "
7968first=123456789abcdef
7969$rm -f $first
7970if (echo hi >$first) 2>/dev/null; then
7971 if $test -f 123456789abcde; then
7972 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
7973 val="$undef"
7974 else
7975 echo 'You can have filenames longer than 14 characters.'>&4
7976 val="$define"
7977 fi
7978else
7979 $cat <<'EOM'
7980You can't have filenames longer than 14 chars.
7981You can't even think about them!
7982EOM
7983 val="$undef"
7984fi
7985set d_flexfnam
7986eval $setvar
7987$rm -rf 123456789abcde*
7988
7989: determine where library module manual pages go
7990set man3dir man3dir none
7991eval $prefixit
7992$cat <<EOM
7993
7994$spackage has manual pages for many of the library modules.
7995EOM
7996
7997case "$nroff" in
7998nroff)
7999 $cat <<'EOM'
8000However, you don't have nroff, so they're probably useless to you.
8001EOM
8002 case "$man3dir" in
8003 '') man3dir="none";;
8004 esac;;
8005esac
8006
8007case "$d_flexfnam" in
8008undef)
8009 $cat <<'EOM'
8010However, your system can't handle the long file names like File::Basename.3.
8011EOM
8012 case "$man3dir" in
8013 '') man3dir="none";;
8014 esac;;
8015esac
8016
8017echo "If you don't want the manual sources installed, answer 'none'."
8018prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8019case "$man3dir" in
8020'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8021 if $test -d "$privlib/man/man3"; then
8022 cat <<EOM >&4
8023
8024WARNING: Previous versions of perl installed man3 pages into
8025$privlib/man/man3. This version will suggest a
8026new default of $dflt.
8027EOM
8028 tdflt=$dflt
8029 dflt='n'
8030 rp='Do you wish to preserve the old behavior?(y/n)'
8031 . ./myread
8032 case "$ans" in
8033 y*) dflt="$privlib/man/man3" ;;
8034 *) dflt=$tdflt ;;
8035 esac
8036 fi
8037 ;;
8038*) dflt="$man3dir" ;;
8039esac
8040case "$dflt" in
8041' ') dflt=none ;;
8042esac
8043echo " "
8044fn=dn+~
8045rp="Where do the $package library man pages (source) go?"
8046. ./getfile
8047man3dir="$ans"
8048man3direxp="$ansexp"
8049case "$man3dir" in
8050'') man3dir=' '
8051 installman3dir='';;
8052esac
8053
8054: Change installation prefix, if necessary.
8055if $test X"$prefix" != X"$installprefix"; then
8056 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8057else
8058 installman3dir="$man3direxp"
8059fi
8060
8061: What suffix to use on installed man pages
8062case "$man3dir" in
8063' ')
8064 man3ext='0'
8065 ;;
8066*)
8067 rp="What suffix should be used for the $package library man pages?"
8068 case "$man3ext" in
8069 '') case "$man3dir" in
8070 *3) dflt=3 ;;
8071 *3p) dflt=3p ;;
8072 *3pm) dflt=3pm ;;
8073 *l) dflt=l;;
8074 *n) dflt=n;;
8075 *o) dflt=o;;
8076 *p) dflt=p;;
8077 *C) dflt=C;;
8078 *L) dflt=L;;
8079 *L3) dflt=L3;;
8080 *) dflt=3;;
8081 esac
8082 ;;
8083 *) dflt="$man3ext";;
8084 esac
8085 . ./myread
8086 man3ext="$ans"
8087 ;;
8088esac
8089
8090: see if we have to deal with yellow pages, now NIS.
0384a54a 8091if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8092 if $test -f /usr/etc/nibindd; then
8093 echo " "
8094 echo "I'm fairly confident you're on a NeXT."
8095 echo " "
8096 rp='Do you get the hosts file via NetInfo?'
8097 dflt=y
8098 case "$hostcat" in
8099 nidump*) ;;
8100 '') ;;
8101 *) dflt=n;;
8102 esac
8103 . ./myread
8104 case "$ans" in
8105 y*) hostcat='nidump hosts .';;
8106 *) case "$hostcat" in
8107 nidump*) hostcat='';;
8108 esac
8109 ;;
8110 esac
8111 fi
8112 case "$hostcat" in
8113 nidump*) ;;
8114 *)
8115 case "$hostcat" in
8116 *ypcat*) dflt=y;;
8117 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8118 dflt=y
8119 else
8120 dflt=n
8121 fi;;
8122 *) dflt=n;;
8123 esac
8124 echo " "
8125 rp='Are you getting the hosts file via yellow pages?'
8126 . ./myread
8127 case "$ans" in
8128 y*) hostcat='ypcat hosts';;
8129 *) hostcat='cat /etc/hosts';;
8130 esac
8131 ;;
8132 esac
8133fi
8134case "$hostcat" in
8135'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8136esac
8137case "$groupcat" in
8138'') test -f /etc/group && groupcat='cat /etc/group';;
8139esac
8140case "$passcat" in
8141'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8142esac
8143
8144: now get the host name
8145echo " "
8146echo "Figuring out host name..." >&4
8147case "$myhostname" in
8148'') cont=true
8149 echo 'Maybe "hostname" will work...'
73614538 8150 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8151 myhostname=$tans
8152 phostname=hostname
8153 cont=''
8154 fi
8155 ;;
8156*) cont='';;
8157esac
8158if $test "$cont"; then
8159 if ./xenix; then
8160 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8161 if tans=`cat /etc/systemid 2>&1` ; then
8162 myhostname=$tans
8163 phostname='cat /etc/systemid'
8164 echo "Whadyaknow. Xenix always was a bit strange..."
8165 cont=''
8166 fi
8167 elif $test -r /etc/systemid; then
8168 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8169 fi
8170fi
8171if $test "$cont"; then
8172 echo 'No, maybe "uuname -l" will work...'
73614538 8173 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8174 myhostname=$tans
8175 phostname='uuname -l'
8176 else
8177 echo 'Strange. Maybe "uname -n" will work...'
73614538 8178 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8179 myhostname=$tans
8180 phostname='uname -n'
8181 else
8182 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8183 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8184 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8185 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8186 else
8187 case "$myhostname" in
8188 '') echo "Does this machine have an identity crisis or something?"
8189 phostname='';;
8190 *)
8191 echo "Well, you said $myhostname before..."
8192 phostname='echo $myhostname';;
8193 esac
8194 fi
8195 fi
8196 fi
8197fi
52a549d0
JH
8198case "$myhostname" in
8199'') myhostname=noname ;;
8200esac
b4eb6b3d
JH
8201: you do not want to know about this
8202set $myhostname
8203myhostname=$1
8204
8205: verify guess
8206if $test "$myhostname" ; then
8207 dflt=y
8208 rp='Your host name appears to be "'$myhostname'".'" Right?"
8209 . ./myread
8210 case "$ans" in
8211 y*) ;;
8212 *) myhostname='';;
8213 esac
8214fi
8215
8216: bad guess or no guess
8217while $test "X$myhostname" = X ; do
8218 dflt=''
8219 rp="Please type the (one word) name of your host:"
8220 . ./myread
8221 myhostname="$ans"
8222done
8223
8224: translate upper to lower if necessary
8225case "$myhostname" in
8226*[A-Z]*)
8227 echo "(Normalizing case in your host name)"
8228 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8229 ;;
8230esac
8231
8232case "$myhostname" in
8233*.*)
8234 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8235 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8236 echo "(Trimming domain name from host name--host name is now $myhostname)"
8237 ;;
8238*) case "$mydomain" in
8239 '')
8240 {
8241 test "X$hostcat" = "Xypcat hosts" &&
8242 ypmatch "$myhostname" hosts 2>/dev/null |\
8243 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8244 $test -s hosts
8245 } || {
8246 test "X$hostcat" != "X" &&
8247 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8248 /[ ]$myhostname[ . ]/p" > hosts
8249 }
8250 tmp_re="[ . ]"
f08cbdd1
PP
8251 if $test -f hosts; then
8252 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8253 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8254 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8255 hosts | $sort | $uniq | \
8256 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8257 case `$echo X$dflt` in
8258 X*\ *) echo "(Several hosts in the database matched hostname)"
8259 dflt=.
8260 ;;
8261 X.) echo "(You do not have fully-qualified names in the hosts database)"
8262 ;;
8263 esac
8264 else
8265 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8266 dflt=.
f08cbdd1 8267 fi
b4eb6b3d
JH
8268 case "$dflt" in
8269 .)
8270 tans=`./loc resolv.conf X /etc /usr/etc`
8271 if $test -f "$tans"; then
8272 echo "(Attempting domain name extraction from $tans)"
8273 dflt=.`$sed -n -e 's/ / /g' \
8274 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
8275 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8276 case "$dflt" in
8277 .) dflt=.`$sed -n -e 's/ / /g' \
8278 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
8279 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8280 ;;
8281 esac
8282 fi
8283 ;;
8284 esac
8285 case "$dflt" in
8286 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8287 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8288 case "$dflt" in
8289 '') dflt='.';;
8290 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8291 esac
8292 ;;
8293 esac
59c9e5d6
PP
8294 case "$dflt$osname" in
8295 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8296 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8297 ;;
8298 esac
b4eb6b3d
JH
8299 case "$dflt" in
8300 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8301 dflt='.nonet'
b4eb6b3d
JH
8302 ;;
8303 esac
8304 $rm -f hosts
8305 ;;
8306 *) dflt="$mydomain";;
8307 esac;;
8308esac
8309echo " "
8310rp="What is your domain name?"
8311. ./myread
8312tans="$ans"
8313case "$ans" in
8314'') ;;
8315.*) ;;
8316*) tans=".$tans";;
8317esac
8318mydomain="$tans"
8319
8320: translate upper to lower if necessary
8321case "$mydomain" in
8322*[A-Z]*)
8323 echo "(Normalizing case in your domain name)"
8324 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8325 ;;
8326esac
8327
8328: a little sanity check here
8329case "$phostname" in
8330'') ;;
8331*)
8332 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8333 $myhostname$mydomain|$myhostname) ;;
8334 *)
8335 case "$phostname" in
8336 sed*)
8337 echo "(That doesn't agree with your whoami.h file, by the way.)"
8338 ;;
8339 *)
8340 echo "(That doesn't agree with your $phostname command, by the way.)"
8341 ;;
8342 esac
8343 ;;
8344 esac
8345 ;;
8346esac
8347
8348$cat <<EOM
8349
8350I need to get your e-mail address in Internet format if possible, i.e.
8351something like user@host.domain. Please answer accurately since I have
8352no easy means to double check it. The default value provided below
8353is most probably close to reality but may not be valid from outside
8354your organization...
8355
8356EOM
8357cont=x
8358while test "$cont"; do
8359 case "$cf_email" in
8360 '') dflt="$cf_by@$myhostname$mydomain";;
8361 *) dflt="$cf_email";;
8362 esac
8363 rp='What is your e-mail address?'
8364 . ./myread
8365 cf_email="$ans"
8366 case "$cf_email" in
8367 *@*.*) cont='' ;;
8368 *)
8369 rp='Address does not look like an Internet one. Use it anyway?'
8370 case "$fastread" in
8371 yes) dflt=y ;;
8372 *) dflt=n ;;
8373 esac
8374 . ./myread
8375 case "$ans" in
8376 y*) cont='' ;;
8377 *) echo " " ;;
8378 esac
8379 ;;
8380 esac
8381done
8382
8383$cat <<EOM
8384
8385If you or somebody else will be maintaining perl at your site, please
8386fill in the correct e-mail address here so that they may be contacted
8387if necessary. Currently, the "perlbug" program included with perl
8388will send mail to this address in addition to perlbug@perl.org. You may
8389enter "none" for no administrator.
8390
8391EOM
8392case "$perladmin" in
8393'') dflt="$cf_email";;
8394*) dflt="$perladmin";;
8395esac
8396rp='Perl administrator e-mail address'
8397. ./myread
8398perladmin="$ans"
8399
674912d7
RB
8400: determine whether to only install version-specific parts.
8401echo " "
8402$cat <<EOM
8403Do you want to install only the version-specific parts of the perl
8404distribution? Usually you do *not* want to do this.
8405EOM
8406case "$versiononly" in
8407"$define"|[Yy]*|true) dflt='y' ;;
8408*) dflt='n';
8409esac
8410rp="Do you want to install only the version-specific parts of perl?"
8411. ./myread
8412case "$ans" in
8413[yY]*) val="$define";;
8414*) val="$undef" ;;
8415esac
8416set versiononly
8417eval $setvar
8418
ad493445
MB
8419case "$versiononly" in
8420"$define") inc_version_list=''
8421 inc_version_list_init=0
8422 ;;
8423esac
8424
b4eb6b3d
JH
8425: figure out how to guarantee perl startup
8426case "$startperl" in
8427'')
8428 case "$sharpbang" in
8429 *!)
8430 $cat <<EOH
8431
8432I can use the #! construct to start perl on your system. This will
8433make startup of perl scripts faster, but may cause problems if you
8434want to share those scripts and perl is not in a standard place
8435($binexp/perl) on all your platforms. The alternative is to force
8436a shell by starting the script with a single ':' character.
8437
8438EOH
674912d7
RB
8439 case "$versiononly" in
8440 "$define") dflt="$binexp/perl$version";;
8441 *) dflt="$binexp/perl";;
8442 esac
b4eb6b3d
JH
8443 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8444 . ./myread
8445 case "$ans" in
8446 none) startperl=": # use perl";;
8447 *) startperl="#!$ans"
8448 if $test 30 -lt `echo "$ans" | wc -c`; then
8449 $cat >&4 <<EOM
8450
8451WARNING: Some systems limit the #! command to 32 characters.
8452If you experience difficulty running Perl scripts with #!, try
8453installing Perl in a directory with a shorter pathname.
8454
8455EOM
8456 fi ;;
8457 esac
8458 ;;
8459 *) startperl=": # use perl"
8460 ;;
8461 esac
8462 ;;
8463esac
8464echo "I'll use $startperl to start perl scripts."
8465
8466: figure best path for perl in scripts
8467case "$perlpath" in
8468'')
5e20a8ca
RGS
8469 case "$versiononly" in
8470 "$define") perlpath="$binexp/perl$version";;
8471 *) perlpath="$binexp/perl";;
8472 esac
b4eb6b3d
JH
8473 case "$startperl" in
8474 *!*) ;;
8475 *)
8476 $cat <<EOH
8477
8478I will use the "eval 'exec'" idiom to start Perl on your system.
8479I can use the full path of your Perl binary for this purpose, but
8480doing so may cause problems if you want to share those scripts and
8481Perl is not always in a standard place ($binexp/perl).
8482
8483EOH
8484 dflt="$binexp/perl"
8485 rp="What path shall I use in \"eval 'exec'\"?"
8486 . ./myread
8487 perlpath="$ans"
8488 ;;
8489 esac
8490 ;;
8491esac
8492case "$startperl" in
8493*!*) ;;
8494*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8495esac
8496
8497: determine where public executable scripts go
8498set scriptdir scriptdir
8499eval $prefixit
8500case "$scriptdir" in
8501'')
8502 dflt="$bin"
8503 : guess some guesses
8504 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8505 $test -d /usr/share/bin && dflt=/usr/share/bin
8506 $test -d /usr/local/script && dflt=/usr/local/script
8507 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8508 $test -d $prefixexp/script && dflt=$prefixexp/script
8509 set dflt
8510 eval $prefixup
8511 ;;
8512*) dflt="$scriptdir"
8513 ;;
8514esac
8515$cat <<EOM
8516
8517Some installations have a separate directory just for executable scripts so
8518that they can mount it across multiple architectures but keep the scripts in
8519one spot. You might, for example, have a subdirectory of /usr/share for this.
8520Or you might just lump your scripts in with all your other executables.
8521
8522EOM
8523fn=d~
8524rp='Where do you keep publicly executable scripts?'
8525. ./getfile
8526if $test "X$ansexp" != "X$scriptdirexp"; then
8527 installscript=''
8528fi
8529scriptdir="$ans"
8530scriptdirexp="$ansexp"
8531: Change installation prefix, if necessary.
8532if $test X"$prefix" != X"$installprefix"; then
8533 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8534else
8535 installscript="$scriptdirexp"
8536fi
8537
8538: determine where add-on public executables go
8539case "$sitebin" in
8540'') dflt=$siteprefix/bin ;;
8541*) dflt=$sitebin ;;
8542esac
8543fn=d~
8544rp='Pathname where the add-on public executables should be installed?'
8545. ./getfile
8546sitebin="$ans"
8547sitebinexp="$ansexp"
8548: Change installation prefix, if necessary.
8549if $test X"$prefix" != X"$installprefix"; then
8550 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8551else
8552 installsitebin="$sitebinexp"
8553fi
8554
6e1038e0
MB
8555: determine where add-on html pages go
8556: There is no standard location, so try to copy the previously-selected
8557: directory structure for the core html pages.
8558case "$sitehtml1" in
8559'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8560*) dflt=$sitehtml1 ;;
8561esac
8562case "$dflt" in
8563''|' ') dflt=none ;;
8564esac
8565fn=dn+~
8566rp='Pathname where the site-specific html pages should be installed?'
8567. ./getfile
8568sitehtml1="$ans"
8569sitehtml1exp="$ansexp"
8570: Use ' ' for none so value is preserved next time through Configure
8571$test X"$sitehtml1" = "X" && sitehtml1=' '
8572: Change installation prefix, if necessary.
8573if $test X"$prefix" != X"$installprefix"; then
8574 installsitehtml1=`echo "$sitehtml1exp" | $sed "s#^$prefix#$installprefix#"`
8575else
8576 installsitehtml1="$sitehtml1exp"
8577fi
8578
8579: determine where add-on library html pages go
8580: There is no standard location, so try to copy the previously-selected
8581: directory structure for the core html pages.
8582case "$sitehtml3" in
8583'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8584*) dflt=$sitehtml3 ;;
8585esac
8586case "$dflt" in
8587''|' ') dflt=none ;;
8588esac
8589fn=dn+~
8590rp='Pathname where the site-specific library html pages should be installed?'
8591. ./getfile
8592sitehtml3="$ans"
8593sitehtml3exp="$ansexp"
8594: Use ' ' for none so value is preserved next time through Configure
8595$test X"$sitehtml3" = "X" && sitehtml3=' '
8596: Change installation prefix, if necessary.
8597if $test X"$prefix" != X"$installprefix"; then
8598 installsitehtml3=`echo "$sitehtml3exp" | $sed "s#^$prefix#$installprefix#"`
8599else
8600 installsitehtml3="$sitehtml3exp"
8601fi
8602
8603: determine where add-on manual pages go
8604case "$siteman1" in
8605'') dflt=`echo "$man1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8606*) dflt=$siteman1 ;;
8607esac
8608case "$dflt" in
8609''|' ') dflt=none ;;
8610esac
8611fn=dn+~
8612rp='Pathname where the site-specific manual pages should be installed?'
8613. ./getfile
8614siteman1="$ans"
8615siteman1exp="$ansexp"
8616: Use ' ' for none so value is preserved next time through Configure
8617$test X"$siteman1" = "X" && siteman1=' '
8618: Change installation prefix, if necessary.
8619if $test X"$prefix" != X"$installprefix"; then
8620 installsiteman1=`echo "$siteman1exp" | $sed "s#^$prefix#$installprefix#"`
8621else
8622 installsiteman1="$siteman1exp"
8623fi
8624
8625: determine where add-on library man pages go
8626case "$siteman3" in
8627'') dflt=`echo "$man3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8628*) dflt=$siteman3 ;;
8629esac
8630case "$dflt" in
8631''|' ') dflt=none ;;
8632esac
8633fn=dn+~
8634rp='Pathname where the site-specific library manual pages should be installed?'
8635. ./getfile
8636siteman3="$ans"
8637siteman3exp="$ansexp"
8638: Use ' ' for none so value is preserved next time through Configure
8639$test X"$siteman3" = "X" && siteman3=' '
8640: Change installation prefix, if necessary.
8641if $test X"$prefix" != X"$installprefix"; then
8642 installsiteman3=`echo "$siteman3exp" | $sed "s#^$prefix#$installprefix#"`
8643else
8644 installsiteman3="$siteman3exp"
8645fi
8646
8647: determine where add-on public executable scripts go
8648case "$sitescript" in
8649'') dflt=$siteprefix/script
8650 $test -d $dflt || dflt=$sitebin ;;
8651*) dflt="$sitescript" ;;
8652esac
8653fn=d~+
8654rp='Pathname where add-on public executable scripts should be installed?'
8655. ./getfile
8656sitescript="$ans"
8657sitescriptexp="$ansexp"
8658: Change installation prefix, if necessary.
8659if $test X"$prefix" != X"$installprefix"; then
8660 installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8661else
8662 installsitescript="$sitescriptexp"
8663fi
8664
15b61c98
JH
8665case "$usefaststdio" in
8666$define|true|[yY]*|'')
8667 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8668 case "$xversion" in
8669 [68]) dflt='y' ;;
8670 *) dflt='n' ;;
8671 esac
8672 ;;
8673*) dflt='n';;
8674esac
8675cat <<EOM
8676
8677Perl can be built to use 'fast stdio', which means using the stdio
8678library but also directly manipulating the stdio buffers to enable
8679faster I/O. Using stdio is better for backward compatibility (especially
8680for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8681interface has been preferred instead of stdio.
8682
8683If this doesn't make any sense to you, just accept the default '$dflt'.
8684EOM
8685rp='Use the "fast stdio" if available?'
8686. ./myread
8687case "$ans" in
8688y|Y) val="$define" ;;
8689*) val="$undef" ;;
8690esac
8691set usefaststdio
8692eval $setvar
8693
8694
96056487
JH
8695: define an is-a-typedef? function
8696typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8697case "$inclist" in
8698"") inclist="sys/types.h";;
8699esac;
8700eval "varval=\$$var";
8701case "$varval" in
8702"")
8703 $rm -f temp.c;
8704 for inc in $inclist; do
8705 echo "#include <$inc>" >>temp.c;
8706 done;
8707 echo "#ifdef $type" >> temp.c;
8708 echo "printf(\"We have $type\");" >> temp.c;
8709 echo "#endif" >> temp.c;
8710 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8711 if $contains $type temp.E >/dev/null 2>&1; then
8712 eval "$var=\$type";
8713 else
8714 eval "$var=\$def";
8715 fi;
8716 $rm -f temp.?;;
8717*) eval "$var=\$varval";;
8718esac'
8719
8720: define an is-a-typedef? function that prompts if the type is not available.
8721typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8722case "$inclist" in
8723"") inclist="sys/types.h";;
8724esac;
8725eval "varval=\$$var";
8726case "$varval" in
8727"")
8728 $rm -f temp.c;
8729 for inc in $inclist; do
8730 echo "#include <$inc>" >>temp.c;
8731 done;
8732 echo "#ifdef $type" >> temp.c;
8733 echo "printf(\"We have $type\");" >> temp.c;
8734 echo "#endif" >> temp.c;
8735 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8736 echo " " ;
8737 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8738 if $contains $type temp.E >/dev/null 2>&1; then
8739 echo "$type found." >&4;
8740 eval "$var=\$type";
8741 else
8742 echo "$type NOT found." >&4;
8743 dflt="$def";
8744 . ./myread ;
8745 eval "$var=\$ans";
8746 fi;
8747 $rm -f temp.?;;
8748*) eval "$var=\$varval";;
8749esac'
8750
8751: see what type lseek is declared as in the kernel
8752rp="What is the type used for lseek's offset on this system?"
8753set off_t lseektype long stdio.h sys/types.h
8754eval $typedef_ask
8755
8756echo " "
8757echo "Checking to see how big your file offsets are..." >&4
8758$cat >try.c <<EOCP
8759#include <sys/types.h>
8760#include <stdio.h>
8761int main()
8762{
8763 printf("%d\n", (int)sizeof($lseektype));
8764 return(0);
8765}
8766EOCP
8767set try
8768if eval $compile_ok; then
8769 lseeksize=`$run ./try`
8770 echo "Your file offsets are $lseeksize bytes long."
8771else
8772 dflt=$longsize
8773 echo " "
8774 echo "(I can't seem to compile the test program. Guessing...)"
8775 rp="What is the size of your file offsets (in bytes)?"
8776 . ./myread
8777 lseeksize="$ans"
8778fi
8779$rm -f try.c try
8780
8781: see what type file positions are declared as in the library
8782rp="What is the type for file position used by fsetpos()?"
8783set fpos_t fpostype long stdio.h sys/types.h
8784eval $typedef_ask
8785
8786echo " "
8787case "$fpostype" in
8788*_t) zzz="$fpostype" ;;
8789*) zzz="fpos_t" ;;
8790esac
8791echo "Checking the size of $zzz..." >&4
8792cat > try.c <<EOCP
8793#include <sys/types.h>
8794#include <stdio.h>
d1daaddf
JH
8795#$i_stdlib I_STDLIB
8796#ifdef I_STDLIB
8797#include <stdlib.h>
8798#endif
96056487
JH
8799int main() {
8800 printf("%d\n", (int)sizeof($fpostype));
8801 exit(0);
8802}
8803EOCP
8804set try
8805if eval $compile_ok; then
8806 yyy=`$run ./try`
8807 case "$yyy" in
8808 '') fpossize=4
8809 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8810 ;;
8811 *) fpossize=$yyy
8812 echo "Your $zzz is $fpossize bytes long."
8813 ;;
8814 esac
8815else
8816 dflt="$longsize"
8817 echo " " >&4
8818 echo "(I can't compile the test program. Guessing...)" >&4
8819 rp="What is the size of your file positions (in bytes)?"
8820 . ./myread
8821 fpossize="$ans"
8822fi
8823
96056487
JH
8824# Backward compatibility (uselfs is deprecated).
8825case "$uselfs" in
8826"$define"|true|[yY]*)
8827 cat <<EOM >&4
8828
8829*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8830EOM
8831 uselargefiles="$define"
8832 ;;
8833esac
8834
8835case "$lseeksize:$fpossize" in
88368:8) cat <<EOM
8837
8838You can have files larger than 2 gigabytes.
8839EOM
8840 val="$define" ;;
8841*) case "$uselargefiles" in
8842 "$undef"|false|[nN]*) dflt='n' ;;
8843 *) dflt='y' ;;
8844 esac
8845 cat <<EOM
8846
8847Perl can be built to understand large files (files larger than 2 gigabytes)
8848on some systems. To do so, Configure can be run with -Duselargefiles.
8849
8850If this doesn't make any sense to you, just accept the default '$dflt'.
8851EOM
8852 rp='Try to understand large files, if available?'
8853 . ./myread
8854 case "$ans" in
8855 y|Y) val="$define" ;;
8856 *) val="$undef" ;;
8857 esac
8858 ;;
8859esac
8860set uselargefiles
8861eval $setvar
8862case "$uselargefiles" in
8863"$define")
8864: Look for a hint-file generated 'call-back-unit'. If the
8865: user has specified that a large files perl is to be built,
8866: we may need to set or change some other defaults.
8867 if $test -f uselargefiles.cbu; then
8868 echo "Your platform has some specific hints for large file builds, using them..."
8869 . ./uselargefiles.cbu
8870 echo " "
8871 echo "Rechecking to see how big your file offsets are..." >&4
8872 $cat >try.c <<EOCP
8873#include <sys/types.h>
8874#include <stdio.h>
8875int main()
8876{
8877 printf("%d\n", (int)sizeof($lseektype));
8878 return(0);
8879}
8880EOCP
8881 set try
8882 if eval $compile_ok; then
8883 lseeksize=`$run ./try`
8884 $echo "Your file offsets are now $lseeksize bytes long."
8885 else
8886 dflt="$lseeksize"
8887 echo " "
8888 echo "(I can't seem to compile the test program. Guessing...)"
8889 rp="What is the size of your file offsets (in bytes)?"
8890 . ./myread
8891 lseeksize="$ans"
8892 fi
8893 case "$fpostype" in
8894 *_t) zzz="$fpostype" ;;
8895 *) zzz="fpos_t" ;;
8896 esac
8897 $echo $n "Rechecking the size of $zzz...$c" >&4
8898 $cat > try.c <<EOCP
8899#include <sys/types.h>
8900#include <stdio.h>
55954f19
JH
8901#$i_stdlib I_STDLIB
8902#ifdef I_STDLIB
8903#include <stdlib.h>
8904#endif
96056487
JH
8905int main() {
8906 printf("%d\n", (int)sizeof($fpostype));
073b6de5 8907 return(0);
96056487
JH
8908}
8909EOCP
8910 set try
8911 if eval $compile_ok; then
8912 yyy=`$run ./try`
8913 dflt="$lseeksize"
8914 case "$yyy" in
8915 '') echo " "
8916 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8917 ;;
8918 *) fpossize=$yyy
8919 echo " $fpossize bytes." >&4
8920 ;;
8921 esac
8922 else
8923 dflt="$fpossize"
8924 echo " "
8925 echo "(I can't compile the test program. Guessing...)" >&4
8926 rp="What is the size of your file positions (in bytes)?"
8927 . ./myread
8928 fpossize="$ans"
8929 fi
8930 $rm -f try.c try
8931 fi
8932 ;;
8933esac
8934
b4eb6b3d
JH
8935case "$vendorprefix" in
8936'') d_vendorbin="$undef"
8937 vendorbin=''
8938 vendorbinexp=''
8939 ;;
8940*) d_vendorbin="$define"
8941 : determine where vendor-supplied executables go.
8942 case "$vendorbin" in
8943 '') dflt=$vendorprefix/bin ;;
8944 *) dflt="$vendorbin" ;;
8945 esac
8946 fn=d~+
8947 rp='Pathname for the vendor-supplied executables directory?'
8948 . ./getfile
8949 vendorbin="$ans"
8950 vendorbinexp="$ansexp"
8951 ;;
8952esac
8953: Change installation prefix, if necessary.
8954if $test X"$prefix" != X"$installprefix"; then
8955 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8956else
8957 installvendorbin="$vendorbinexp"
8958fi
8959
6e1038e0
MB
8960case "$vendorprefix" in
8961'') vendorhtml1=''
8962 vendorhtml1exp=''
8963 ;;
8964*) : determine where vendor-supplied html pages go.
8965 : There is no standard location, so try to copy the previously-selected
8966 : directory structure for the core html pages.
8967 : XXX Better default suggestions would be welcome.
8968 case "$vendorhtml1" in
8969 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8970 *) dflt=$vendorhtml1 ;;
8971 esac
8972 case "$dflt" in
8973 ''|' ') dflt=none ;;
8974 esac
8975 fn=dn+~
8976 rp='Pathname for the vendor-supplied html pages?'
8977 . ./getfile
8978 vendorhtml1="$ans"
8979 vendorhtml1exp="$ansexp"
8980 ;;
8981esac
8982: Use ' ' for none so value is preserved next time through Configure
8983$test X"$vendorhtml1" = "X" && vendorhtml1=' '
8984: Change installation prefix, if necessary.
8985if $test X"$prefix" != X"$installprefix"; then
8986 installvendorhtml1=`echo $vendorhtml1exp | $sed "s#^$prefix#$installprefix#"`
8987else
8988 installvendorhtml1="$vendorhtml1exp"
8989fi
8990
8991case "$vendorprefix" in
8992'') vendorhtml3=''
8993 vendorhtml3exp=''
8994 ;;
8995*) : determine where vendor-supplied module html pages go.
8996 : There is no standard location, so try to copy the previously-selected
8997 : directory structure for the core html pages.
8998 : XXX Better default suggestions would be welcome.
8999 case "$vendorhtml3" in
9000 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9001 *) dflt=$vendorhtml3 ;;
9002 esac
9003 case "$dflt" in
9004 ''|' ') dflt=none ;;
9005 esac
9006 fn=dn+~
9007 rp='Pathname for the vendor-supplied html pages?'
9008 . ./getfile
9009 vendorhtml3="$ans"
9010 vendorhtml3exp="$ansexp"
9011 ;;
9012esac
9013: Use ' ' for none so value is preserved next time through Configure
9014$test X"$vendorhtml3" = "X" && vendorhtml3=' '
9015: Change installation prefix, if necessary.
9016if $test X"$prefix" != X"$installprefix"; then
9017 installvendorhtml3=`echo $vendorhtml3exp | $sed "s#^$prefix#$installprefix#"`
9018else
9019 installvendorhtml3="$vendorhtml3exp"
9020fi
9021
9022case "$vendorprefix" in
9023'') vendorman1=''
9024 vendorman1exp=''
9025 ;;
9026*) : determine where vendor-supplied manual pages go.
9027 case "$vendorman1" in
9028 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9029 *) dflt=$vendorman1 ;;
9030 esac
9031 case "$dflt" in
9032 ''|' ') dflt=none ;;
9033 esac
9034 fn=nd~+
9035 rp='Pathname for the vendor-supplied manual section 1 pages?'
9036 . ./getfile
9037 vendorman1="$ans"
9038 vendorman1exp="$ansexp"
9039 ;;
9040esac
9041: Use ' ' for none so value is preserved next time through Configure
9042$test X"$vendorman1" = "X" && vendorman1=' '
9043: Change installation prefix, if necessary.
9044if $test X"$prefix" != X"$installprefix"; then
9045 installvendorman1=`echo "$vendorman1exp" | $sed "s#^$prefix#$installprefix#"`
9046else
9047 installvendorman1="$vendorman1exp"
9048fi
9049
9050case "$vendorprefix" in
9051'') vendorman3=''
9052 vendorman3exp=''
9053 ;;
9054*) : determine where vendor-supplied module manual pages go.
9055 case "$vendorman3" in
9056 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9057 *) dflt=$vendorman3 ;;
9058 esac
9059 case "$dflt" in
9060 ''|' ') dflt=none ;;
9061 esac
9062 fn=nd~+
9063 rp='Pathname for the vendor-supplied manual section 3 pages?'
9064 . ./getfile
9065 vendorman3="$ans"
9066 vendorman3exp="$ansexp"
9067 ;;
9068esac
9069: Use ' ' for none so value is preserved next time through Configure
9070$test X"$vendorman3" = "X" && vendorman3=' '
9071: Change installation prefix, if necessary.
9072if $test X"$prefix" != X"$installprefix"; then
9073 installvendorman3=`echo "$vendorman3exp" | $sed "s#^$prefix#$installprefix#"`
9074else
9075 installvendorman3="$vendorman3exp"
9076fi
9077
9078case "$vendorprefix" in
9079'') d_vendorscript="$undef"
9080 vendorscript=''
9081 vendorscriptexp=''
9082 ;;
9083*) d_vendorscript="$define"
9084 : determine where vendor-supplied scripts go.
9085 case "$vendorscript" in
9086 '') dflt=$vendorprefix/script
9087 $test -d $dflt || dflt=$vendorbin ;;
9088 *) dflt="$vendorscript" ;;
9089 esac
9090 $cat <<EOM
9091
9092The installation process will create a directory for
9093vendor-supplied scripts.
9094
9095EOM
9096 fn=d~+
9097 rp='Pathname for the vendor-supplied scripts directory?'
9098 . ./getfile
9099 vendorscript="$ans"
9100 vendorscriptexp="$ansexp"
9101 ;;
9102esac
9103: Change installation prefix, if necessary.
9104if $test X"$prefix" != X"$installprefix"; then
9105 installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9106else
9107 installvendorscript="$vendorscriptexp"
9108fi
9109
b4eb6b3d
JH
9110: see if qgcvt exists
9111set qgcvt d_qgcvt
9112eval $inlibc
9113
89ce900e
JH
9114echo " "
9115
9116if $test X"$d_longdbl" = X"$define"; then
9117
9118echo "Checking how to print long doubles..." >&4
9119
9120if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9121 $cat >try.c <<'EOCP'
9122#include <sys/types.h>
9123#include <stdio.h>
9124int main() {
9125 double d = 123.456;
9126 printf("%.3f\n", d);
9127}
9128EOCP
9129 set try
9130 if eval $compile; then
9131 yyy=`$run ./try`
9132 case "$yyy" in
9133 123.456)
9134 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9135 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9136 echo "We will use %f."
9137 ;;
9138 esac
9139 fi
9140fi
9141
9142if $test X"$sPRIfldbl" = X; then
9143 $cat >try.c <<'EOCP'
9144#include <sys/types.h>
9145#include <stdio.h>
9146int main() {
9147 long double d = 123.456;
9148 printf("%.3Lf\n", d);
9149}
9150EOCP
9151 set try
9152 if eval $compile; then
9153 yyy=`$run ./try`
9154 case "$yyy" in
9155 123.456)
9156 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9157 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9158 echo "We will use %Lf."
9159 ;;
9160 esac
9161 fi
9162fi
9163
9164if $test X"$sPRIfldbl" = X; then
9165 $cat >try.c <<'EOCP'
9166#include <sys/types.h>
9167#include <stdio.h>
9168int main() {
9169 long double d = 123.456;
9170 printf("%.3llf\n", d);
9171}
9172EOCP
9173 set try
9174 if eval $compile; then
9175 yyy=`$run ./try`
9176 case "$yyy" in
9177 123.456)
9178 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9179 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9180 echo "We will use %llf."
9181 ;;
9182 esac
9183 fi
9184fi
9185
9186if $test X"$sPRIfldbl" = X; then
9187 $cat >try.c <<'EOCP'
9188#include <sys/types.h>
9189#include <stdio.h>
9190int main() {
9191 long double d = 123.456;
9192 printf("%.3lf\n", d);
9193}
9194EOCP
9195 set try
9196 if eval $compile; then
9197 yyy=`$run ./try`
9198 case "$yyy" in
9199 123.456)
9200 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9201 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9202 echo "We will use %lf."
9203 ;;
9204 esac
9205 fi
9206fi
9207
9208if $test X"$sPRIfldbl" = X; then
9209 echo "Cannot figure out how to print long doubles." >&4
9210else
9211 sSCNfldbl=$sPRIfldbl # expect consistency
9212fi
9213
9214$rm -f try try.*
9215
9216fi # d_longdbl
9217
9218case "$sPRIfldbl" in
9219'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9220 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9221 d_SCNfldbl="$undef";
9222 ;;
9223*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9224 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9225 d_SCNfldbl="$define";
9226 ;;
9227esac
9228
b4eb6b3d 9229: Check how to convert floats to strings.
a5b10d80
YST
9230
9231if test "X$d_Gconvert" = X; then
9232
b4eb6b3d
JH
9233echo " "
9234echo "Checking for an efficient way to convert floats to strings."
9235echo " " > try.c
9236case "$uselongdouble" in
9237"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9238esac
9239case "$d_longdbl" in
9240"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9241esac
9242case "$d_PRIgldbl" in
9243"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9244esac
9245$cat >>try.c <<EOP
9246#ifdef TRY_gconvert
9247#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9248char *myname = "gconvert";
9249#endif
9250#ifdef TRY_gcvt
9251#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9252char *myname = "gcvt";
9253#endif
9254#ifdef TRY_qgcvt
9255#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9256char *myname = "qgcvt";
9257#define DOUBLETYPE long double
9258#endif
9259#ifdef TRY_sprintf
a5b10d80
YST
9260#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9261#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9262#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9263#else
a5b10d80
YST
9264#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9265#endif
9266#else
b4eb6b3d
JH
9267#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9268#endif
9269char *myname = "sprintf";
9270#endif
9271
9272#ifndef DOUBLETYPE
9273#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9274#define DOUBLETYPE long double
9275#else
9276#define DOUBLETYPE double
9277#endif
9278#endif
9279
9280#include <stdio.h>
9281
9282#define I_STDLIB $i_stdlib
9283#ifdef I_STDLIB
9284#include <stdlib.h>
9285#endif
9286
9287int
9288checkit(expect, got)
9289char *expect;
9290char *got;
9291{
9292 if (strcmp(expect, got)) {
9293 printf("%s oddity: Expected %s, got %s\n",
9294 myname, expect, got);
9295 exit(1);
9296 }
9297}
9298
9299int main()
9300{
9301 char buf[64];
9302 buf[63] = '\0';
9303
9304 /* This must be 1st test on (which?) platform */
9305 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9306 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9307 checkit("0.1", buf);
9308
a5b10d80
YST
9309 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9310 checkit("0.01", buf);
9311
9312 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9313 checkit("0.001", buf);
9314
9315 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9316 checkit("0.0001", buf);
9317
9318 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9319 if (strlen(buf) > 5)
9320 checkit("9e-005", buf); /* for Microsoft ?? */
9321 else
9322 checkit("9e-05", buf);
9323
b4eb6b3d
JH
9324 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9325 checkit("1", buf);
9326
9327 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9328 checkit("1.1", buf);
9329
9330 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9331 checkit("1.01", buf);
9332
9333 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9334 checkit("1.001", buf);
9335
9336 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9337 checkit("1.0001", buf);
9338
9339 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9340 checkit("1.00001", buf);
9341
9342 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9343 checkit("1.000001", buf);
9344
9345 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9346 checkit("0", buf);
9347
9348 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9349 checkit("-1", buf);
9350
9351 /* Some Linux gcvt's give 1.e+5 here. */
9352 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9353 checkit("100000", buf);
9354
9355 /* Some Linux gcvt's give -1.e+5 here. */
9356 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9357 checkit("-100000", buf);
9358
9359 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9360 checkit("123.456", buf);
9361
ab6ca9f4 9362 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9363 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9364 /* 34 should be enough to scare even long double
9365 * places into using the e notation. */
ab6ca9f4 9366 if (strlen(buf) > 5)
94b339ad 9367 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9368 else
94b339ad 9369 checkit("1e+34", buf);
8e2a5ede 9370
d1eb8299
YST
9371 /* For Perl, if you add additional tests here, also add them to
9372 * t/base/num.t for benefit of platforms not using Configure or
9373 * overriding d_Gconvert */
9374
b4eb6b3d
JH
9375 exit(0);
9376}
9377EOP
ab6ca9f4 9378: first add preferred functions to our list
a5b10d80 9379xxx_list=""
ab6ca9f4 9380for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9381 case $xxx_convert in
9382 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9383 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
a5b10d80
YST
9384 esac
9385done
9386: then add any others
9387for xxx_convert in gconvert gcvt sprintf; do
9388 case "$xxx_list" in
9389 *$xxx_convert*) ;;
9390 *) xxx_list="$xxx_list $xxx_convert" ;;
9391 esac
9392done
9393
9394case "$d_longdbl$uselongdouble" in
9395"$define$define")
9396 : again, add prefered functions to our list first
9397 xxx_ld_list=""
ab6ca9f4 9398 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9399 case $xxx_convert in
9400 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9401 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9402 esac
9403 done
9404 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9405 for xxx_convert in qgcvt sprintf $xxx_list; do
9406 case "$xxx_ld_list" in
9407 $xxx_convert*|*" $xxx_convert"*) ;;
9408 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9409 esac
9410 done
9411 : if sprintf cannot do long doubles, move it to the end
9412 if test "$d_PRIgldbl" != "$define"; then
9413 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9414 fi
9415 : if no qgcvt, remove it
9416 if test "$d_qgcvt" != "$define"; then
9417 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9418 fi
9419 : use the ld_list
9420 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9421 ;;
9422esac
9423
9424for xxx_convert in $xxx_list; do
9425 echo "Trying $xxx_convert..."
9426 $rm -f try try$_o
9427 set try -DTRY_$xxx_convert
9428 if eval $compile; then
9429 echo "$xxx_convert() found." >&4
5440bc8e 9430 if $run ./try; then
b4eb6b3d
JH
9431 echo "I'll use $xxx_convert to convert floats into a string." >&4
9432 break;
9433 else
9434 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9435 xxx_convert=''
b4eb6b3d
JH
9436 fi
9437 else
9438 echo "$xxx_convert NOT found." >&4
9439 fi
9440done
ab6ca9f4 9441
a5b10d80
YST
9442if test X$xxx_convert = X; then
9443 echo "*** WHOA THERE!!! ***" >&4
9444 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9445 xxx_convert=sprintf
9446fi
9447
b4eb6b3d
JH
9448case "$xxx_convert" in
9449gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9450gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9451qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9452*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9453 "$define$define$define")
9454 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9455 "$define$define$undef")
9456 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9457 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9458 esac
9459 ;;
9460esac
9461
a5b10d80
YST
9462fi
9463
74cac757
JH
9464: see if _fwalk exists
9465set fwalk d__fwalk
9466eval $inlibc
9467
b4eb6b3d
JH
9468: Initialize h_fcntl
9469h_fcntl=false
9470
9471: Initialize h_sysfile
9472h_sysfile=false
9473
9474: access call always available on UNIX
9475set access d_access
9476eval $inlibc
9477
9478: locate the flags for 'access()'
9479case "$d_access" in
9480"$define")
9481 echo " "
55954f19 9482 $cat >access.c <<EOCP
b4eb6b3d
JH
9483#include <sys/types.h>
9484#ifdef I_FCNTL
9485#include <fcntl.h>
9486#endif
9487#ifdef I_SYS_FILE
9488#include <sys/file.h>
9489#endif
9490#ifdef I_UNISTD
9491#include <unistd.h>
9492#endif
55954f19
JH
9493#$i_stdlib I_STDLIB
9494#ifdef I_STDLIB
9495#include <stdlib.h>
9496#endif
b4eb6b3d
JH
9497int main() {
9498 exit(R_OK);
9499}
9500EOCP
9501 : check sys/file.h first, no particular reason here
9502 if $test `./findhdr sys/file.h` && \
7a282f6d 9503 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9504 h_sysfile=true;
9505 echo "<sys/file.h> defines the *_OK access constants." >&4
9506 elif $test `./findhdr fcntl.h` && \
7a282f6d 9507 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9508 h_fcntl=true;
9509 echo "<fcntl.h> defines the *_OK access constants." >&4
9510 elif $test `./findhdr unistd.h` && \
7a282f6d 9511 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9512 echo "<unistd.h> defines the *_OK access constants." >&4
9513 else
9514 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9515 fi
9516 ;;
9517esac
9518$rm -f access*
9519
9520: see if accessx exists
9521set accessx d_accessx
9522eval $inlibc
9523
89ce900e
JH
9524: see if aintl exists
9525set aintl d_aintl
9526eval $inlibc
9527
b4eb6b3d
JH
9528: see if alarm exists
9529set alarm d_alarm
9530eval $inlibc
9531
a9dade78
JH
9532: see if POSIX threads are available
9533set pthread.h i_pthread
9534eval $inhdr
9535
10bc17b6
JH
9536: define a fucntion to check prototypes
9537$cat > protochk <<EOSH
9538$startsh
9539cc="$cc"
9540optimize="$optimize"
9541ccflags="$ccflags"
9542prototype="$prototype"
9543define="$define"
9544rm=$rm
a9dade78
JH
9545usethreads=$usethreads
9546i_pthread=$i_pthread
9547pthread_h_first=$pthread_h_first
10bc17b6
JH
9548EOSH
9549
9550$cat >> protochk <<'EOSH'
9551
9552$rm -f try.c
9553foo="$1"
9554shift
9555while test $# -ge 2; do
9556 case "$1" in
9557 $define) echo "#include <$2>" >> try.c ;;
9558 literal) echo "$2" >> try.c ;;
9559 esac
cce6a207
MB
9560 # Extra magic for the benefit of systems that need pthread.h
9561 # to be included early to correctly detect threadsafe functions.
9562 # Such functions must guarantee themselves, though, that the usethreads
9563 # and i_pthread have been defined, before calling protochk.
9564 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9565 echo "#include <pthread.h>" >> try.c
9566 pthread_h_done=yes
9567 fi
10bc17b6
JH
9568 shift 2
9569done
9570test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
9571cat >> try.c <<'EOCP'
9572#ifdef CAN_PROTOTYPE
9573#define _(args) args
9574#else
9575#define _(args) ()
9576#endif
9577EOCP
9578echo "$foo" >> try.c
9579echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9580$cc $optimize $ccflags -c try.c > /dev/null 2>&1
9581status=$?
9582$rm -f try.[co]
9583exit $status
9584EOSH
9585chmod +x protochk
9586$eunicefix protochk
9587
89ce900e
JH
9588hasproto='varname=$1; func=$2; shift; shift;
9589while $test $# -ge 2; do
9590 case "$1" in
9591 $define) echo "#include <$2>";;
9592 esac ;
9593 shift 2;
9594done > try.c;
9595$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9596if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9597 echo "$func() prototype found.";
9598 val="$define";
9599else
9600 echo "$func() prototype NOT found.";
9601 val="$undef";
9602fi;
9603set $varname;
9604eval $setvar;
9605$rm -f try.c tryout.c'
9606
10bc17b6
JH
9607: see if sys/types.h has to be included
9608set sys/types.h i_systypes
9609eval $inhdr
9610
9611: see if sys/select.h has to be included
9612set sys/select.h i_sysselct
9613eval $inhdr
9614
9615hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9616while $test $# -ge 2; do
9617 case "$1" in
9618 $define) echo "#include <$2>";;
9619 esac ;
9620 shift 2;
9621done > try.c;
9622echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9623set try;
9624if eval $compile; then
9625 val="$define";
9626else
9627 val="$undef";
9628fi;
9629set $varname;
9630eval $setvar;
9631$rm -f try.c try.o'
9632
9633: see if we should include time.h, sys/time.h, or both
9634echo " "
9635if test "X$timeincl" = X; then
9636 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9637 $echo $n "I'm now running the test program...$c"
55954f19 9638 $cat >try.c <<EOCP
10bc17b6
JH
9639#include <sys/types.h>
9640#ifdef I_TIME
9641#include <time.h>
9642#endif
9643#ifdef I_SYSTIME
9644#ifdef SYSTIMEKERNEL
9645#define KERNEL
9646#endif
9647#include <sys/time.h>
9648#endif
9649#ifdef I_SYSSELECT
9650#include <sys/select.h>
9651#endif
55954f19
JH
9652#$i_stdlib I_STDLIB
9653#ifdef I_STDLIB
9654#include <stdlib.h>
9655#endif
10bc17b6
JH
9656int main()
9657{
9658 struct tm foo;
9659#ifdef S_TIMEVAL
9660 struct timeval bar;
9661#endif
9662#ifdef S_TIMEZONE
9663 struct timezone tzp;
9664#endif
9665 if (foo.tm_sec == foo.tm_sec)
9666 exit(0);
9667#ifdef S_TIMEVAL
9668 if (bar.tv_sec == bar.tv_sec)
9669 exit(0);
9670#endif
9671 exit(1);
9672}
9673EOCP
9674 flags=''
9675 for s_timezone in '-DS_TIMEZONE' ''; do
9676 sysselect=''
9677 for s_timeval in '-DS_TIMEVAL' ''; do
9678 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9679 for i_time in '' '-DI_TIME'; do
9680 for i_systime in '-DI_SYSTIME' ''; do
9681 case "$flags" in
9682 '') $echo $n ".$c"
9683 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9684 if eval $compile; then
9685 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9686 shift
9687 flags="$*"
9688 echo " "
9689 $echo $n "Succeeded with $flags$c"
9690 fi
9691 ;;
9692 esac
9693 done
9694 done
9695 done
9696 done
9697 done
9698 timeincl=''
9699 echo " "
9700 case "$flags" in
9701 *SYSTIMEKERNEL*) i_systimek="$define"
9702 timeincl=`./findhdr sys/time.h`
9703 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9704 *) i_systimek="$undef";;
9705 esac
9706 case "$flags" in
9707 *I_TIME*) i_time="$define"
9708 timeincl=`./findhdr time.h`" $timeincl"
9709 echo "We'll include <time.h>." >&4;;
9710 *) i_time="$undef";;
9711 esac
9712 case "$flags" in
9713 *I_SYSTIME*) i_systime="$define"
9714 timeincl=`./findhdr sys/time.h`" $timeincl"
9715 echo "We'll include <sys/time.h>." >&4;;
9716 *) i_systime="$undef";;
9717 esac
9718 $rm -f try.c try
9719fi
9720: see if struct tm knows about tm_zone
9721case "$i_systime$i_time" in
9722*$define*)
9723 echo " "
9724 echo "Checking to see if your struct tm has tm_zone field..." >&4
9725 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9726 eval $hasfield
9727 ;;
9728*) val="$undef"
9729 set d_tm_tm_zone
9730 eval $setvar
9731 ;;
9732esac
9733case "$d_tm_tm_zone" in
9734"$define") echo "Yes, it does." ;;
9735*) echo "No, it doesn't." ;;
9736esac
9737: see if struct tm knows about tm_gmtoff
9738case "$i_systime$i_time" in
9739*$define*)
9740 echo " "
9741 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9742 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9743 eval $hasfield
9744 ;;
9745*) val="$undef"
9746 set d_tm_tm_gmtoff
9747 eval $setvar
9748 ;;
9749esac
9750case "$d_tm_tm_gmtoff" in
9751"$define") echo "Yes, it does." ;;
9752*) echo "No, it doesn't." ;;
9753esac
9754
9755: see if asctime_r exists
9756set asctime_r d_asctime_r
9757eval $inlibc
9758case "$d_asctime_r" in
9759"$define")
d63eadf0 9760 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
9761 case "$d_asctime_r_proto:$usethreads" in
9762 ":define") d_asctime_r_proto=define
a48ec845
JH
9763 set d_asctime_r_proto asctime_r $hdrs
9764 eval $hasproto ;;
9765 *) ;;
9766 esac
9767 case "$d_asctime_r_proto" in
9768 define)
10bc17b6
JH
9769 case "$asctime_r_proto" in
9770 ''|0) try='char* asctime_r(const struct tm*, char*);'
9771 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9772 esac
9773 case "$asctime_r_proto" in
9774 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9775 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9776 esac
9777 case "$asctime_r_proto" in
9778 ''|0) try='int asctime_r(const struct tm*, char*);'
9779 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9780 esac
9781 case "$asctime_r_proto" in
9782 ''|0) try='int asctime_r(const struct tm*, char*, int);'
9783 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9784 esac
9785 case "$asctime_r_proto" in
90e831dc 9786 ''|0) d_asctime_r=undef
10bc17b6 9787 asctime_r_proto=0
a48ec845 9788 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
9789 * ) case "$asctime_r_proto" in
9790 REENTRANT_PROTO*) ;;
9791 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9792 esac
9793 echo "Prototype: $try" ;;
9794 esac
9795 ;;
c18e646a
JH
9796 *) case "$usethreads" in
9797 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9798 esac
90e831dc
SB
9799 d_asctime_r=undef
9800 asctime_r_proto=0
c18e646a 9801 ;;
a48ec845
JH
9802 esac
9803 ;;
10bc17b6
JH
9804*) asctime_r_proto=0
9805 ;;
9806esac
9807
b4eb6b3d
JH
9808: see if atolf exists
9809set atolf d_atolf
9810eval $inlibc
9811
9812: see if atoll exists
9813set atoll d_atoll
9814eval $inlibc
9815
9816: Look for GNU-cc style attribute checking
9817echo " "
9818echo "Checking whether your compiler can handle __attribute__ ..." >&4
9819$cat >attrib.c <<'EOCP'
9820#include <stdio.h>
04fa0c70 9821void croak (char* pat,...) __attribute__((__format__(__printf__,1,2),noreturn));
b4eb6b3d
JH
9822EOCP
9823if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9824 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9825 echo "Your C compiler doesn't fully support __attribute__."
9826 val="$undef"
9827 else
9828 echo "Your C compiler supports __attribute__."
9829 val="$define"
9830 fi
9831else
9832 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9833 val="$undef"
9834fi
9835set d_attribut
9836eval $setvar
9837$rm -f attrib*
9838
9839: see if bcmp exists
9840set bcmp d_bcmp
9841eval $inlibc
9842
9843: see if bcopy exists
9844set bcopy d_bcopy
9845eval $inlibc
9846
9847: see if this is a unistd.h system
9848set unistd.h i_unistd
9849eval $inhdr
9850
9851: see if getpgrp exists
9852set getpgrp d_getpgrp
9853eval $inlibc
9854
9855case "$d_getpgrp" in
9856"$define")
9857 echo " "
9858 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 9859 $cat >try.c <<EOP
b4eb6b3d
JH
9860#$i_unistd I_UNISTD
9861#include <sys/types.h>
9862#ifdef I_UNISTD
9863# include <unistd.h>
9864#endif
55954f19
JH
9865#$i_stdlib I_STDLIB
9866#ifdef I_STDLIB
9867#include <stdlib.h>
9868#endif
b4eb6b3d
JH
9869int main()
9870{
9871 if (getuid() == 0) {
9872 printf("(I see you are running Configure as super-user...)\n");
9873 setuid(1);
9874 }
9875#ifdef TRY_BSD_PGRP
9876 if (getpgrp(1) == 0)
9877 exit(0);
9878#else
9879 if (getpgrp() > 0)
9880 exit(0);
9881#endif
9882 exit(1);
9883}
9884EOP
5440bc8e 9885 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9886 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9887 val="$define"
5440bc8e 9888 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9889 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9890 val="$undef"
9891 else
9892 echo "I can't seem to compile and run the test program."
9893 if ./usg; then
9894 xxx="a USG one, i.e. you use getpgrp()."
9895 else
9896 # SVR4 systems can appear rather BSD-ish.
9897 case "$i_unistd" in
9898 $undef)
9899 xxx="a BSD one, i.e. you use getpgrp(pid)."
9900 val="$define"
9901 ;;
9902 $define)
9903 xxx="probably a USG one, i.e. you use getpgrp()."
9904 val="$undef"
9905 ;;
9906 esac
9907 fi
9908 echo "Assuming your getpgrp is $xxx" >&4
9909 fi
9910 ;;
9911*) val="$undef";;
9912esac
9913set d_bsdgetpgrp
9914eval $setvar
5440bc8e 9915$rm -f try try.*
b4eb6b3d
JH
9916
9917: see if setpgrp exists
9918set setpgrp d_setpgrp
9919eval $inlibc
9920
9921case "$d_setpgrp" in
9922"$define")
9923 echo " "
9924 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 9925 $cat >try.c <<EOP
b4eb6b3d
JH
9926#$i_unistd I_UNISTD
9927#include <sys/types.h>
9928#ifdef I_UNISTD
9929# include <unistd.h>
9930#endif
55954f19
JH
9931#$i_stdlib I_STDLIB
9932#ifdef I_STDLIB
9933#include <stdlib.h>
9934#endif
b4eb6b3d
JH
9935int main()
9936{
9937 if (getuid() == 0) {
9938 printf("(I see you are running Configure as super-user...)\n");
9939 setuid(1);
9940 }
9941#ifdef TRY_BSD_PGRP
9942 if (-1 == setpgrp(1, 1))
9943 exit(0);
9944#else
9945 if (setpgrp() != -1)
9946 exit(0);
9947#endif
9948 exit(1);
9949}
9950EOP
5440bc8e 9951 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9952 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9953 val="$define"
5440bc8e 9954 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9955 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9956 val="$undef"
9957 else
9958 echo "(I can't seem to compile and run the test program.)"
9959 if ./usg; then
9960 xxx="a USG one, i.e. you use setpgrp()."
9961 else
9962 # SVR4 systems can appear rather BSD-ish.
9963 case "$i_unistd" in
9964 $undef)
9965 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9966 val="$define"
9967 ;;
9968 $define)
9969 xxx="probably a USG one, i.e. you use setpgrp()."
9970 val="$undef"
9971 ;;
9972 esac
9973 fi
9974 echo "Assuming your setpgrp is $xxx" >&4
9975 fi
9976 ;;
9977*) val="$undef";;
9978esac
9979set d_bsdsetpgrp
9980eval $setvar
5440bc8e 9981$rm -f try try.*
b4eb6b3d
JH
9982: see if bzero exists
9983set bzero d_bzero
9984eval $inlibc
9985
9986: see if signal is declared as pointer to function returning int or void
9987echo " "
9988xxx=`./findhdr signal.h`
9989$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9990if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
9991 echo "You have int (*signal())() instead of void." >&4
9992 val="$undef"
9993elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
9994 echo "You have void (*signal())()." >&4
9995 val="$define"
9996elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9997 echo "You have int (*signal())() instead of void." >&4
9998 val="$undef"
9999elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10000 echo "You have void (*signal())()." >&4
10001 val="$define"
10002else
10003 case "$d_voidsig" in
10004 '')
10005 echo "I can't determine whether signal handler returns void or int..." >&4
10006 dflt=void
10007 rp="What type does your signal handler return?"
10008 . ./myread
10009 case "$ans" in
10010 v*) val="$define";;
10011 *) val="$undef";;
10012 esac;;
10013 "$define")
10014 echo "As you already told me, signal handler returns void." >&4
10015 val="$define"
10016 ;;
10017 *) echo "As you already told me, signal handler returns int." >&4
10018 val="$undef"
10019 ;;
10020 esac
10021fi
10022set d_voidsig
10023eval $setvar
10024case "$d_voidsig" in
10025"$define") signal_t="void";;
10026*) signal_t="int";;
10027esac
10028$rm -f $$.tmp
10029
10030: check for ability to cast large floats to 32-bit ints.
10031echo " "
10032echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10033if $test "$intsize" -ge 4; then
10034 xxx=int
10035else
10036 xxx=long
10037fi
10038$cat >try.c <<EOCP
10039#include <stdio.h>
d1daaddf
JH
10040#$i_stdlib I_STDLIB
10041#ifdef I_STDLIB
10042#include <stdlib.h>
10043#endif
b4eb6b3d
JH
10044#include <sys/types.h>
10045#include <signal.h>
10046$signal_t blech(s) int s; { exit(3); }
10047int main()
10048{
10049 $xxx i32;
10050 double f, g;
10051 int result = 0;
10052 char str[16];
10053 signal(SIGFPE, blech);
10054
10055 /* Don't let compiler optimize the test away. Store the number
10056 in a writable string for gcc to pass to sscanf under HP/UX.
10057 */
10058 sprintf(str, "2147483647");
10059 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10060 g = 10 * f;
10061 i32 = ($xxx) g;
10062
10063 /* x86 processors will probably give 0x8000 0000, which is a
10064 sign change. We don't want that. We want to mimic SPARC
10065 behavior here, which is to preserve the sign and give
10066 back 0x7fff ffff.
10067 */
10068 if (i32 != ($xxx) f)
10069 result |= 1;
10070 exit(result);
10071}
10072EOCP
10073set try
10074if eval $compile_ok; then
5440bc8e 10075 $run ./try
b4eb6b3d
JH
10076 yyy=$?
10077else
10078 echo "(I can't seem to compile the test program--assuming it can't)"
10079 yyy=1
10080fi
10081case "$yyy" in
100820) val="$define"
10083 echo "Yup, it can."
10084 ;;
10085*) val="$undef"
10086 echo "Nope, it can't."
10087 ;;
10088esac
10089set d_casti32
10090eval $setvar
10091$rm -f try try.*
10092
10093: check for ability to cast negative floats to unsigned
10094echo " "
10095echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10096$cat >try.c <<EOCP
10097#include <stdio.h>
d1daaddf
JH
10098#$i_stdlib I_STDLIB
10099#ifdef I_STDLIB
10100#include <stdlib.h>
10101#endif
b4eb6b3d
JH
10102#include <sys/types.h>
10103#include <signal.h>
10104$signal_t blech(s) int s; { exit(7); }
10105$signal_t blech_in_list(s) int s; { exit(4); }
10106unsigned long dummy_long(p) unsigned long p; { return p; }
10107unsigned int dummy_int(p) unsigned int p; { return p; }
10108unsigned short dummy_short(p) unsigned short p; { return p; }
10109int main()
10110{
10111 double f;
10112 unsigned long along;
10113 unsigned int aint;
10114 unsigned short ashort;
10115 int result = 0;
10116 char str[16];
10117
10118 /* Frustrate gcc-2.7.2's optimizer which failed this test with
10119 a direct f = -123. assignment. gcc-2.8.0 reportedly
10120 optimized the whole file away
10121 */
10122 /* Store the number in a writable string for gcc to pass to
10123 sscanf under HP/UX.
10124 */
10125 sprintf(str, "-123");
10126 sscanf(str, "%lf", &f); /* f = -123.; */
10127
10128 signal(SIGFPE, blech);
10129 along = (unsigned long)f;
10130 aint = (unsigned int)f;
10131 ashort = (unsigned short)f;
10132 if (along != (unsigned long)-123)
10133 result |= 1;
10134 if (aint != (unsigned int)-123)
10135 result |= 1;
10136 if (ashort != (unsigned short)-123)
10137 result |= 1;
10138 sprintf(str, "1073741824.");
10139 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10140 f = f + f;
10141 along = 0;
10142 along = (unsigned long)f;
10143 if (along != 0x80000000)
10144 result |= 2;
10145 f -= 1.;
10146 along = 0;
10147 along = (unsigned long)f;
10148 if (along != 0x7fffffff)
10149 result |= 1;
10150 f += 2.;
10151 along = 0;
10152 along = (unsigned long)f;
10153 if (along != 0x80000001)
10154 result |= 2;
10155 if (result)
10156 exit(result);
10157 signal(SIGFPE, blech_in_list);
10158 sprintf(str, "123.");
10159 sscanf(str, "%lf", &f); /* f = 123.; */
10160 along = dummy_long((unsigned long)f);
10161 aint = dummy_int((unsigned int)f);
10162 ashort = dummy_short((unsigned short)f);
10163 if (along != (unsigned long)123)
10164 result |= 4;
10165 if (aint != (unsigned int)123)
10166 result |= 4;
10167 if (ashort != (unsigned short)123)
10168 result |= 4;
10169 exit(result);
10170
10171}
10172EOCP
10173set try
10174if eval $compile_ok; then
5440bc8e 10175 $run ./try
b4eb6b3d
JH
10176 castflags=$?
10177else
10178 echo "(I can't seem to compile the test program--assuming it can't)"
10179 castflags=7
10180fi
10181case "$castflags" in
101820) val="$define"
10183 echo "Yup, it can."
10184 ;;
10185*) val="$undef"
10186 echo "Nope, it can't."
10187 ;;
10188esac
10189set d_castneg
10190eval $setvar
10191$rm -f try.*
10192
10193: see if vprintf exists
10194echo " "
10195if set vprintf val -f d_vprintf; eval $csym; $val; then
10196 echo 'vprintf() found.' >&4
10197 val="$define"
55954f19 10198 $cat >try.c <<EOF
b4eb6b3d 10199#include <varargs.h>
55954f19
JH
10200#$i_stdlib I_STDLIB
10201#ifdef I_STDLIB
10202#include <stdlib.h>
10203#endif
b4eb6b3d
JH
10204
10205int main() { xxx("foo"); }
10206
10207xxx(va_alist)
10208va_dcl
10209{
10210 va_list args;
10211 char buf[10];
10212
10213 va_start(args);
10214 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10215}
10216EOF
5440bc8e
JH
10217 set try
10218 if eval $compile && $run ./try; then
b4eb6b3d
JH
10219 echo "Your vsprintf() returns (int)." >&4
10220 val2="$undef"
10221 else
10222 echo "Your vsprintf() returns (char*)." >&4
10223 val2="$define"
10224 fi
10225else
10226 echo 'vprintf() NOT found.' >&4
10227 val="$undef"
10228 val2="$undef"
10229fi
5440bc8e 10230$rm -f try try.*
b4eb6b3d
JH
10231set d_vprintf
10232eval $setvar
10233val=$val2
10234set d_charvspr
10235eval $setvar
10236
10237: see if chown exists
10238set chown d_chown
10239eval $inlibc
10240
10241: see if chroot exists
10242set chroot d_chroot
10243eval $inlibc
10244
10245: see if chsize exists
10246set chsize d_chsize
10247eval $inlibc
10248
758a5d79
JH
10249: see if class exists
10250set class d_class
10251eval $inlibc
10252
4e0554ec
JH
10253hasstruct='varname=$1; struct=$2; shift; shift;
10254while $test $# -ge 2; do
10255 case "$1" in
10256 $define) echo "#include <$2>";;
10257 esac ;
10258 shift 2;
10259done > try.c;
10260echo "int main () { struct $struct foo; }" >> try.c;
10261set try;
10262if eval $compile; then
10263 val="$define";
10264else
10265 val="$undef";
10266fi;
10267set $varname;
10268eval $setvar;
10269$rm -f try.c try.o'
10270
4e0554ec
JH
10271socketlib=''
10272sockethdr=''
10273: see whether socket exists
10274echo " "
10275$echo $n "Hmm... $c" >&4
10276if set socket val -f d_socket; eval $csym; $val; then
10277 echo "Looks like you have Berkeley networking support." >&4
10278 d_socket="$define"
10279 if set setsockopt val -f; eval $csym; $val; then
10280 d_oldsock="$undef"
10281 else
10282 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10283 d_oldsock="$define"
10284 fi
10285else
10286 if $contains socklib libc.list >/dev/null 2>&1; then
10287 echo "Looks like you have Berkeley networking support." >&4
10288 d_socket="$define"
10289 : we will have to assume that it supports the 4.2 BSD interface
10290 d_oldsock="$undef"
10291 else
10292 echo "You don't have Berkeley networking in libc$_a..." >&4
10293 if test "X$d_socket" = "X$define"; then
10294 echo "...but you seem to believe that you have sockets." >&4
10295 else
10296 for net in net socket
10297 do
10298 if test -f /usr/lib/lib$net$_a; then
10299 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
10300 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10301 if $contains socket libc.list >/dev/null 2>&1; then
10302 d_socket="$define"
10303 socketlib="-l$net"
10304 case "$net" in
10305 net)
10306 echo "...but the Wollongong group seems to have hacked it in." >&4
10307 sockethdr="-I/usr/netinclude"
10308 ;;
10309 esac
3c728e00 10310 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
10311 if $contains setsockopt libc.list >/dev/null 2>&1; then
10312 d_oldsock="$undef"
10313 else
10314 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10315 d_oldsock="$define"
10316 fi
10317 break
10318 fi
10319 fi
10320 done
10321 if test "X$d_socket" != "X$define"; then
10322 echo "or anywhere else I see." >&4
10323 d_socket="$undef"
10324 d_oldsock="$undef"
10325 fi
10326 fi
10327 fi
10328fi
10329
10330: see if socketpair exists
10331set socketpair d_sockpair
10332eval $inlibc
10333
10334
10335echo " "
3c728e00 10336echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
10337for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10338 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10339 $cat >try.c <<EOF
10340#include <sys/types.h>
10341#include <sys/socket.h>
10342int main() {
10343 int i = $ENUM;
10344}
10345EOF
10346 val="$undef"
10347 set try; if eval $compile; then
10348 val="$define"
10349 fi
10350 set d_${enum}; eval $setvar
10351 $rm -f try.c try
10352done
10353
10354: see if this is a sys/uio.h system
10355set sys/uio.h i_sysuio
10356eval $inhdr
10357
10358
10359echo " "
10360echo "Checking to see if your system supports struct cmsghdr..." >&4
10361set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10362eval $hasstruct
10363case "$d_cmsghdr_s" in
10364"$define") echo "Yes, it does." ;;
10365*) echo "No, it doesn't." ;;
10366esac
10367
10368
b4eb6b3d
JH
10369: check for const keyword
10370echo " "
10371echo 'Checking to see if your C compiler knows about "const"...' >&4
10372$cat >const.c <<'EOCP'
10373typedef struct spug { int drokk; } spug;
76f47787 10374int main()
b4eb6b3d
JH
10375{
10376 const char *foo;
10377 const spug y;
10378}
10379EOCP
10380if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10381 val="$define"
10382 echo "Yup, it does."
10383else
10384 val="$undef"
10385 echo "Nope, it doesn't."
10386fi
10387set d_const
10388eval $setvar
10389
89ce900e
JH
10390: see if copysignl exists
10391set copysignl d_copysignl
10392eval $inlibc
10393
b4eb6b3d
JH
10394: see if crypt exists
10395echo " "
a5a94ea5
JH
10396set crypt d_crypt
10397eval $inlibc
10398case "$d_crypt" in
10399$define) cryptlib='' ;;
10400*) if set crypt val -f d_crypt; eval $csym; $val; then
10401 echo 'crypt() found.' >&4
b4eb6b3d 10402 val="$define"
a5a94ea5
JH
10403 cryptlib=''
10404 else
10405 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10406 if $test -z "$cryptlib"; then
10407 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10408 else
10409 cryptlib=-lcrypt
10410 fi
10411 if $test -z "$cryptlib"; then
10412 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10413 else
10414 cryptlib=-lcrypt
10415 fi
10416 if $test -z "$cryptlib"; then
10417 cryptlib=`./loc libcrypt$_a "" $libpth`
10418 else
10419 cryptlib=-lcrypt
10420 fi
10421 if $test -z "$cryptlib"; then
10422 echo 'crypt() NOT found.' >&4
10423 val="$undef"
10424 else
10425 val="$define"
10426 fi
b4eb6b3d 10427 fi
a5a94ea5
JH
10428 set d_crypt
10429 eval $setvar
10430 ;;
10431esac
b4eb6b3d 10432
10bc17b6
JH
10433: see if this is a crypt.h system
10434set crypt.h i_crypt
10435eval $inhdr
10436
10437: see if crypt_r exists
10438set crypt_r d_crypt_r
10439eval $inlibc
10440case "$d_crypt_r" in
10441"$define")
10442 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
10443 case "$d_crypt_r_proto:$usethreads" in
10444 ":define") d_crypt_r_proto=define
a48ec845
JH
10445 set d_crypt_r_proto crypt_r $hdrs
10446 eval $hasproto ;;
10447 *) ;;
10448 esac
10449 case "$d_crypt_r_proto" in
10450 define)
10bc17b6
JH
10451 case "$crypt_r_proto" in
10452 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10453 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10454 esac
10455 case "$crypt_r_proto" in
b430fd04
JH
10456 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10457 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10458 esac
10459 case "$crypt_r_proto" in
90e831dc 10460 ''|0) d_crypt_r=undef
10bc17b6 10461 crypt_r_proto=0
a48ec845 10462 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10463 * ) case "$crypt_r_proto" in
10464 REENTRANT_PROTO*) ;;
10465 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10466 esac
10467 echo "Prototype: $try" ;;
10468 esac
10469 ;;
c18e646a
JH
10470 *) case "$usethreads" in
10471 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10472 esac
90e831dc
SB
10473 d_crypt_r=undef
10474 crypt_r_proto=0
c18e646a 10475 ;;
a48ec845
JH
10476 esac
10477 ;;
10bc17b6
JH
10478*) crypt_r_proto=0
10479 ;;
10480esac
10481
b4eb6b3d
JH
10482: get csh whereabouts
10483case "$csh" in
10484'csh') val="$undef" ;;
10485*) val="$define" ;;
10486esac
10487set d_csh
10488eval $setvar
10489: Respect a hint or command line value for full_csh.
10490case "$full_csh" in
10491'') full_csh=$csh ;;
10492esac
10493
10bc17b6
JH
10494: see if ctermid_r exists
10495set ctermid_r d_ctermid_r
10496eval $inlibc
10497case "$d_ctermid_r" in
10498"$define")
31ee0cb7 10499 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
10500 case "$d_ctermid_r_proto:$usethreads" in
10501 ":define") d_ctermid_r_proto=define
a48ec845
JH
10502 set d_ctermid_r_proto ctermid_r $hdrs
10503 eval $hasproto ;;
10504 *) ;;
10505 esac
10506 case "$d_ctermid_r_proto" in
10507 define)
10bc17b6
JH
10508 case "$ctermid_r_proto" in
10509 ''|0) try='char* ctermid_r(char*);'
10510 ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10511 esac
10512 case "$ctermid_r_proto" in
90e831dc 10513 ''|0) d_ctermid_r=undef
10bc17b6 10514 ctermid_r_proto=0
a48ec845 10515 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10516 * ) case "$ctermid_r_proto" in
10517 REENTRANT_PROTO*) ;;
10518 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10519 esac
10520 echo "Prototype: $try" ;;
10521 esac
10522 ;;
c18e646a
JH
10523 *) case "$usethreads" in
10524 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10525 esac
90e831dc
SB
10526 d_ctermid_r=undef
10527 ctermid_r_proto=0
c18e646a 10528 ;;
a48ec845
JH
10529 esac
10530 ;;
10bc17b6
JH
10531*) ctermid_r_proto=0
10532 ;;
10533esac
10534
10535: see if ctime_r exists
10536set ctime_r d_ctime_r
10537eval $inlibc
10538case "$d_ctime_r" in
10539"$define")
d63eadf0 10540 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
10541 case "$d_ctime_r_proto:$usethreads" in
10542 ":define") d_ctime_r_proto=define
a48ec845
JH
10543 set d_ctime_r_proto ctime_r $hdrs
10544 eval $hasproto ;;
10545 *) ;;
10546 esac
10547 case "$d_ctime_r_proto" in
10548 define)
10bc17b6
JH
10549 case "$ctime_r_proto" in
10550 ''|0) try='char* ctime_r(const time_t*, char*);'
10551 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10552 esac
10553 case "$ctime_r_proto" in
10554 ''|0) try='char* ctime_r(const time_t*, char*, int);'
10555 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10556 esac
10557 case "$ctime_r_proto" in
10558 ''|0) try='int ctime_r(const time_t*, char*);'
10559 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10560 esac
10561 case "$ctime_r_proto" in
10562 ''|0) try='int ctime_r(const time_t*, char*, int);'
10563 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10564 esac
10565 case "$ctime_r_proto" in
90e831dc 10566 ''|0) d_ctime_r=undef
10bc17b6 10567 ctime_r_proto=0
a48ec845 10568 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10569 * ) case "$ctime_r_proto" in
10570 REENTRANT_PROTO*) ;;
10571 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10572 esac
10573 echo "Prototype: $try" ;;
10574 esac
10575 ;;
c18e646a
JH
10576 *) case "$usethreads" in
10577 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10578 esac
90e831dc
SB
10579 d_ctime_r=undef
10580 ctime_r_proto=0
c18e646a 10581 ;;
a48ec845
JH
10582 esac
10583 ;;
10bc17b6
JH
10584*) ctime_r_proto=0
10585 ;;
10586esac
10587
b4eb6b3d
JH
10588: see if cuserid exists
10589set cuserid d_cuserid
10590eval $inlibc
10591
10592: see if this is a limits.h system
10593set limits.h i_limits
10594eval $inhdr
10595
10596: see if this is a float.h system
10597set float.h i_float
10598eval $inhdr
10599
10600: See if number of significant digits in a double precision number is known
10601echo " "
10602$cat >dbl_dig.c <<EOM
10603#$i_limits I_LIMITS
10604#$i_float I_FLOAT
10605#ifdef I_LIMITS
10606#include <limits.h>
10607#endif
10608#ifdef I_FLOAT
10609#include <float.h>
10610#endif
10611#ifdef DBL_DIG
10612printf("Contains DBL_DIG");
10613#endif
10614EOM
10615$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10616if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10617 echo "DBL_DIG found." >&4
10618 val="$define"
10619else
10620 echo "DBL_DIG NOT found." >&4
10621 val="$undef"
10622fi
10623$rm -f dbl_dig.?
10624set d_dbl_dig
10625eval $setvar
10626
2ef53570
JH
10627: see if dbm.h is available
10628: see if dbmclose exists
10629set dbmclose d_dbmclose
10630eval $inlibc
10631
10632case "$d_dbmclose" in
10633$define)
10634 set dbm.h i_dbm
10635 eval $inhdr
10636 case "$i_dbm" in
10637 $define)
10638 val="$undef"
10639 set i_rpcsvcdbm
10640 eval $setvar
10641 ;;
10642 *) set rpcsvc/dbm.h i_rpcsvcdbm
10643 eval $inhdr
10644 ;;
10645 esac
10646 ;;
10647*) echo "We won't be including <dbm.h>"
10648 val="$undef"
10649 set i_dbm
10650 eval $setvar
10651 val="$undef"
10652 set i_rpcsvcdbm
10653 eval $setvar
10654 ;;
10655esac
10656
10657: see if prototype for dbminit is available
10658echo " "
10659set d_dbminitproto dbminit $i_dbm dbm.h
10660eval $hasproto
10661
b4eb6b3d
JH
10662: see if difftime exists
10663set difftime d_difftime
10664eval $inlibc
10665
10666: see if this is a dirent system
10667echo " "
10668if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10669 val="$define"
10670 echo "<dirent.h> found." >&4
10671else
10672 val="$undef"
10673 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10674 echo "<sys/dir.h> found." >&4
10675 echo " "
10676 else
10677 xinc=`./findhdr sys/ndir.h`
10678 fi
10679 echo "<dirent.h> NOT found." >&4
10680fi
10681set i_dirent
10682eval $setvar
10683
10684: Look for type of directory structure.
10685echo " "
10686$cppstdin $cppflags $cppminus < "$xinc" > try.c
10687
10688case "$direntrytype" in
10689''|' ')
10690 case "$i_dirent" in
10691 $define) guess1='struct dirent' ;;
10692 *) guess1='struct direct' ;;
10693 esac
10694 ;;
10695*) guess1="$direntrytype"
10696 ;;
10697esac
10698
10699case "$guess1" in
10700'struct dirent') guess2='struct direct' ;;
10701*) guess2='struct dirent' ;;
10702esac
10703
10704if $contains "$guess1" try.c >/dev/null 2>&1; then
10705 direntrytype="$guess1"
10706 echo "Your directory entries are $direntrytype." >&4
10707elif $contains "$guess2" try.c >/dev/null 2>&1; then
10708 direntrytype="$guess2"
10709 echo "Your directory entries seem to be $direntrytype." >&4
10710else
10711 echo "I don't recognize your system's directory entries." >&4
10712 rp="What type is used for directory entries on this system?"
10713 dflt="$guess1"
10714 . ./myread
10715 direntrytype="$ans"
10716fi
10717$rm -f try.c
10718
10719
10720: see if the directory entry stores field length
10721echo " "
10722$cppstdin $cppflags $cppminus < "$xinc" > try.c
10723if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10724 echo "Good, your directory entry keeps length information in d_namlen." >&4
10725 val="$define"
10726else
10727 echo "Your directory entry does not know about the d_namlen field." >&4
10728 val="$undef"
10729fi
10730set d_dirnamlen
10731eval $setvar
10732$rm -f try.c
10733
ae0e3d3b
JH
10734: see if this is an sysdir system
10735set sys/dir.h i_sysdir
10736eval $inhdr
10737
10738: see if this is an sysndir system
10739set sys/ndir.h i_sysndir
10740eval $inhdr
10741
10742: Look for dirfd
10743echo " "
10744$cat >dirfd.c <<EOM
10745#include <stdio.h>
55954f19
JH
10746#$i_stdlib I_STDLIB
10747#ifdef I_STDLIB
10748#include <stdlib.h>
10749#endif
ae0e3d3b
JH
10750#$i_dirent I_DIRENT /**/
10751#$i_sysdir I_SYS_DIR /**/
10752#$i_sysndir I_SYS_NDIR /**/
10753#$i_systypes I_SYS_TYPES /**/
10754#if defined(I_SYS_TYPES)
10755#include <sys/types.h>
10756#endif
10757#if defined(I_DIRENT)
10758#include <dirent.h>
10759#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10760#include <sys/dir.h>
10761#endif
10762#else
10763#ifdef I_SYS_NDIR
10764#include <sys/ndir.h>
10765#else
10766#ifdef I_SYS_DIR
10767#ifdef hp9000s500
10768#include <ndir.h> /* may be wrong in the future */
10769#else
10770#include <sys/dir.h>
10771#endif
10772#endif
10773#endif
10774#endif
10775int main() {
10776 DIR *dirp = opendir(".");
10777 if (dirfd(dirp) >= 0)
10778 exit(0);
10779 else
10780 exit(1);
10781}
10782EOM
10783set dirfd
10784if eval $compile; then
10785 val="$define"
10786fi
10787case "$val" in
10788$define) echo "dirfd() found." >&4 ;;
10789*) echo "dirfd() NOT found." >&4 ;;
10790esac
10791set d_dirfd
10792eval $setvar
10793$rm -f dirfd*
10794
b4eb6b3d
JH
10795: see if dlerror exists
10796xxx_runnm="$runnm"
10797runnm=false
10798set dlerror d_dlerror
10799eval $inlibc
10800runnm="$xxx_runnm"
10801
10802: see if dlfcn is available
10803set dlfcn.h i_dlfcn
10804eval $inhdr
10805
10806case "$usedl" in
10807$define|y|true)
10808 $cat << EOM
10809
10810On a few systems, the dynamically loaded modules that perl generates and uses
10811will need a different extension than shared libs. The default will probably
10812be appropriate.
10813
10814EOM
10815 case "$dlext" in
10816 '') dflt="$so" ;;
10817 *) dflt="$dlext" ;;
10818 esac
10819 rp='What is the extension of dynamically loaded modules'
10820 . ./myread
10821 dlext="$ans"
10822 ;;
10823*)
10824 dlext="none"
10825 ;;
10826esac
10827
10828: Check if dlsym need a leading underscore
10829echo " "
10830val="$undef"
10831
10832case "$dlsrc" in
10833dl_dlopen.xs)
10834 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10835 $cat >dyna.c <<'EOM'
10836fred () { }
10837EOM
10838
10839$cat >fred.c<<EOM
10840
10841#include <stdio.h>
55954f19
JH
10842#$i_stdlib I_STDLIB
10843#ifdef I_STDLIB
10844#include <stdlib.h>
10845#endif
b4eb6b3d
JH
10846#$i_dlfcn I_DLFCN
10847#ifdef I_DLFCN
5440bc8e 10848#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
10849#else
10850#include <sys/types.h>
10851#include <nlist.h>
10852#include <link.h>
10853#endif
10854
10855extern int fred() ;
10856
10857int main()
10858{
10859 void * handle ;
10860 void * symbol ;
10861#ifndef RTLD_LAZY
10862 int mode = 1 ;
10863#else
10864 int mode = RTLD_LAZY ;
10865#endif
10866 handle = dlopen("./dyna.$dlext", mode) ;
10867 if (handle == NULL) {
10868 printf ("1\n") ;
10869 fflush (stdout) ;
10870 exit(0);
10871 }
10872 symbol = dlsym(handle, "fred") ;
10873 if (symbol == NULL) {
10874 /* try putting a leading underscore */
10875 symbol = dlsym(handle, "_fred") ;
10876 if (symbol == NULL) {
10877 printf ("2\n") ;
10878 fflush (stdout) ;
10879 exit(0);
10880 }
10881 printf ("3\n") ;
10882 }
10883 else
10884 printf ("4\n") ;
10885 fflush (stdout) ;
10886 exit(0);
10887}
10888EOM
10889 : Call the object file tmp-dyna.o in case dlext=o.
10890 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
10891 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 10892 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
10893 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10894 xxx=`$run ./fred`
b4eb6b3d
JH
10895 case $xxx in
10896 1) echo "Test program failed using dlopen." >&4
10897 echo "Perhaps you should not use dynamic loading." >&4;;
10898 2) echo "Test program failed using dlsym." >&4
10899 echo "Perhaps you should not use dynamic loading." >&4;;
10900 3) echo "dlsym needs a leading underscore" >&4
10901 val="$define" ;;
10902 4) echo "dlsym doesn't need a leading underscore." >&4;;
10903 esac
10904 else
10905 echo "I can't compile and run the test program." >&4
10906 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10907 fi
10908 ;;
10909esac
10910
3c728e00 10911$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
10912
10913set d_dlsymun
10914eval $setvar
10915
10bc17b6
JH
10916: see if drand48_r exists
10917set drand48_r d_drand48_r
10918eval $inlibc
10919case "$d_drand48_r" in
10920"$define")
10921 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
10922 case "$d_drand48_r_proto:$usethreads" in
10923 ":define") d_drand48_r_proto=define
a48ec845
JH
10924 set d_drand48_r_proto drand48_r $hdrs
10925 eval $hasproto ;;
10926 *) ;;
10927 esac
10928 case "$d_drand48_r_proto" in
10929 define)
10bc17b6
JH
10930 case "$drand48_r_proto" in
10931 ''|0) try='int drand48_r(struct drand48_data*, double*);'
10932 ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10933 esac
10934 case "$drand48_r_proto" in
90e831dc 10935 ''|0) d_drand48_r=undef
10bc17b6 10936 drand48_r_proto=0
a48ec845 10937 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10938 * ) case "$drand48_r_proto" in
10939 REENTRANT_PROTO*) ;;
10940 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10941 esac
10942 echo "Prototype: $try" ;;
10943 esac
10944 ;;
c18e646a
JH
10945 *) case "$usethreads" in
10946 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10947 esac
90e831dc
SB
10948 d_drand48_r=undef
10949 drand48_r_proto=0
c18e646a 10950 ;;
a48ec845
JH
10951 esac
10952 ;;
10bc17b6
JH
10953*) drand48_r_proto=0
10954 ;;
10955esac
10956
10957: see if prototype for drand48 is available
10958echo " "
10959set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10960eval $hasproto
10961
b4eb6b3d
JH
10962: see if dup2 exists
10963set dup2 d_dup2
10964eval $inlibc
10965
10966: see if eaccess exists
10967set eaccess d_eaccess
10968eval $inlibc
10969
10970: see if endgrent exists
10971set endgrent d_endgrent
10972eval $inlibc
10973
10bc17b6
JH
10974: see if this is an grp system
10975set grp.h i_grp
10976eval $inhdr
10977
10978case "$i_grp" in
10979$define)
10980 xxx=`./findhdr grp.h`
10981 $cppstdin $cppflags $cppminus < $xxx >$$.h
10982
10983 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10984 val="$define"
10985 else
10986 val="$undef"
10987 fi
10988 set d_grpasswd
10989 eval $setvar
10990
10991 $rm -f $$.h
10992 ;;
10993*)
10994 val="$undef";
10995 set d_grpasswd; eval $setvar
10996 ;;
10997esac
10998
10999: see if endgrent_r exists
11000set endgrent_r d_endgrent_r
11001eval $inlibc
11002case "$d_endgrent_r" in
11003"$define")
11004 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11005 case "$d_endgrent_r_proto:$usethreads" in
11006 ":define") d_endgrent_r_proto=define
a48ec845
JH
11007 set d_endgrent_r_proto endgrent_r $hdrs
11008 eval $hasproto ;;
11009 *) ;;
11010 esac
11011 case "$d_endgrent_r_proto" in
11012 define)
10bc17b6
JH
11013 case "$endgrent_r_proto" in
11014 ''|0) try='int endgrent_r(FILE**);'
11015 ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11016 esac
11017 case "$endgrent_r_proto" in
11018 ''|0) try='void endgrent_r(FILE**);'
11019 ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11020 esac
11021 case "$endgrent_r_proto" in
90e831dc 11022 ''|0) d_endgrent_r=undef
10bc17b6 11023 endgrent_r_proto=0
a48ec845 11024 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11025 * ) case "$endgrent_r_proto" in
11026 REENTRANT_PROTO*) ;;
11027 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11028 esac
11029 echo "Prototype: $try" ;;
11030 esac
11031 ;;
c18e646a
JH
11032 *) case "$usethreads" in
11033 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11034 esac
90e831dc
SB
11035 d_endgrent_r=undef
11036 endgrent_r_proto=0
c18e646a 11037 ;;
a48ec845
JH
11038 esac
11039 ;;
10bc17b6
JH
11040*) endgrent_r_proto=0
11041 ;;
11042esac
11043
b4eb6b3d
JH
11044: see if endhostent exists
11045set endhostent d_endhent
11046eval $inlibc
11047
10bc17b6
JH
11048: see if this is a netdb.h system
11049set netdb.h i_netdb
11050eval $inhdr
11051
11052: see if endhostent_r exists
11053set endhostent_r d_endhostent_r
11054eval $inlibc
11055case "$d_endhostent_r" in
11056"$define")
11057 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11058 case "$d_endhostent_r_proto:$usethreads" in
11059 ":define") d_endhostent_r_proto=define
a48ec845
JH
11060 set d_endhostent_r_proto endhostent_r $hdrs
11061 eval $hasproto ;;
11062 *) ;;
11063 esac
11064 case "$d_endhostent_r_proto" in
11065 define)
10bc17b6
JH
11066 case "$endhostent_r_proto" in
11067 ''|0) try='int endhostent_r(struct hostent_data*);'
31ee0cb7 11068 ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
11069 esac
11070 case "$endhostent_r_proto" in
11071 ''|0) try='void endhostent_r(struct hostent_data*);'
31ee0cb7 11072 ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
11073 esac
11074 case "$endhostent_r_proto" in
90e831dc 11075 ''|0) d_endhostent_r=undef
10bc17b6 11076 endhostent_r_proto=0
a48ec845 11077 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11078 * ) case "$endhostent_r_proto" in
11079 REENTRANT_PROTO*) ;;
11080 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11081 esac
11082 echo "Prototype: $try" ;;
11083 esac
11084 ;;
c18e646a
JH
11085 *) case "$usethreads" in
11086 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11087 esac
90e831dc
SB
11088 d_endhostent_r=undef
11089 endhostent_r_proto=0
c18e646a 11090 ;;
a48ec845
JH
11091 esac
11092 ;;
10bc17b6
JH
11093*) endhostent_r_proto=0
11094 ;;
11095esac
11096
b4eb6b3d
JH
11097: see if endnetent exists
11098set endnetent d_endnent
11099eval $inlibc
11100
10bc17b6
JH
11101: see if endnetent_r exists
11102set endnetent_r d_endnetent_r
11103eval $inlibc
11104case "$d_endnetent_r" in
11105"$define")
11106 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11107 case "$d_endnetent_r_proto:$usethreads" in
11108 ":define") d_endnetent_r_proto=define
a48ec845
JH
11109 set d_endnetent_r_proto endnetent_r $hdrs
11110 eval $hasproto ;;
11111 *) ;;
11112 esac
11113 case "$d_endnetent_r_proto" in
11114 define)
10bc17b6
JH
11115 case "$endnetent_r_proto" in
11116 ''|0) try='int endnetent_r(struct netent_data*);'
31ee0cb7 11117 ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
11118 esac
11119 case "$endnetent_r_proto" in
11120 ''|0) try='void endnetent_r(struct netent_data*);'
31ee0cb7 11121 ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
11122 esac
11123 case "$endnetent_r_proto" in
90e831dc 11124 ''|0) d_endnetent_r=undef
10bc17b6 11125 endnetent_r_proto=0
a48ec845 11126 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11127 * ) case "$endnetent_r_proto" in
11128 REENTRANT_PROTO*) ;;
11129 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11130 esac
11131 echo "Prototype: $try" ;;
11132 esac
11133 ;;
c18e646a
JH
11134 *) case "$usethreads" in
11135 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11136 esac
90e831dc
SB
11137 d_endnetent_r=undef
11138 endnetent_r_proto=0
c18e646a 11139 ;;
a48ec845
JH
11140 esac
11141 ;;
10bc17b6
JH
11142*) endnetent_r_proto=0
11143 ;;
11144esac
11145
b4eb6b3d
JH
11146: see if endprotoent exists
11147set endprotoent d_endpent
11148eval $inlibc
11149
10bc17b6
JH
11150: see if endprotoent_r exists
11151set endprotoent_r d_endprotoent_r
11152eval $inlibc
11153case "$d_endprotoent_r" in
11154"$define")
11155 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11156 case "$d_endprotoent_r_proto:$usethreads" in
11157 ":define") d_endprotoent_r_proto=define
a48ec845
JH
11158 set d_endprotoent_r_proto endprotoent_r $hdrs
11159 eval $hasproto ;;
11160 *) ;;
11161 esac
11162 case "$d_endprotoent_r_proto" in
11163 define)
10bc17b6
JH
11164 case "$endprotoent_r_proto" in
11165 ''|0) try='int endprotoent_r(struct protoent_data*);'
31ee0cb7 11166 ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
11167 esac
11168 case "$endprotoent_r_proto" in
11169 ''|0) try='void endprotoent_r(struct protoent_data*);'
31ee0cb7 11170 ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
11171 esac
11172 case "$endprotoent_r_proto" in
90e831dc 11173 ''|0) d_endprotoent_r=undef
10bc17b6 11174 endprotoent_r_proto=0
a48ec845 11175 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11176 * ) case "$endprotoent_r_proto" in
11177 REENTRANT_PROTO*) ;;
11178 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11179 esac
11180 echo "Prototype: $try" ;;
11181 esac
11182 ;;
c18e646a
JH
11183 *) case "$usethreads" in
11184 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11185 esac
90e831dc
SB
11186 d_endprotoent_r=undef
11187 endprotoent_r_proto=0
c18e646a 11188 ;;
a48ec845
JH
11189 esac
11190 ;;
10bc17b6
JH
11191*) endprotoent_r_proto=0
11192 ;;
11193esac
11194
b4eb6b3d
JH
11195: see if endpwent exists
11196set endpwent d_endpwent
11197eval $inlibc
11198
10bc17b6
JH
11199: see if this is a pwd.h system
11200set pwd.h i_pwd
11201eval $inhdr
11202
11203case "$i_pwd" in
11204$define)
11205 xxx=`./findhdr pwd.h`
11206 $cppstdin $cppflags $cppminus < $xxx >$$.h
11207
11208 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11209 val="$define"
11210 else
11211 val="$undef"
11212 fi
11213 set d_pwquota
11214 eval $setvar
11215
11216 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11217 val="$define"
11218 else
11219 val="$undef"
11220 fi
11221 set d_pwage
11222 eval $setvar
11223
11224 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11225 val="$define"
11226 else
11227 val="$undef"
11228 fi
11229 set d_pwchange
11230 eval $setvar
11231
11232 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11233 val="$define"
11234 else
11235 val="$undef"
11236 fi
11237 set d_pwclass
11238 eval $setvar
11239
11240 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11241 val="$define"
11242 else
11243 val="$undef"
11244 fi
11245 set d_pwexpire
11246 eval $setvar
11247
11248 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11249 val="$define"
11250 else
11251 val="$undef"
11252 fi
11253 set d_pwcomment
11254 eval $setvar
11255
11256 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11257 val="$define"
11258 else
11259 val="$undef"
11260 fi
11261 set d_pwgecos
11262 eval $setvar
11263
11264 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11265 val="$define"
11266 else
11267 val="$undef"
11268 fi
11269 set d_pwpasswd
11270 eval $setvar
11271
11272 $rm -f $$.h
11273 ;;
11274*)
11275 val="$undef";
11276 set d_pwquota; eval $setvar
11277 set d_pwage; eval $setvar
11278 set d_pwchange; eval $setvar
11279 set d_pwclass; eval $setvar
11280 set d_pwexpire; eval $setvar
11281 set d_pwcomment; eval $setvar
11282 set d_pwgecos; eval $setvar
11283 set d_pwpasswd; eval $setvar
11284 ;;
11285esac
11286
11287: see if endpwent_r exists
11288set endpwent_r d_endpwent_r
11289eval $inlibc
11290case "$d_endpwent_r" in
11291"$define")
11292 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
11293 case "$d_endpwent_r_proto:$usethreads" in
11294 ":define") d_endpwent_r_proto=define
a48ec845
JH
11295 set d_endpwent_r_proto endpwent_r $hdrs
11296 eval $hasproto ;;
11297 *) ;;
11298 esac
11299 case "$d_endpwent_r_proto" in
11300 define)
10bc17b6
JH
11301 case "$endpwent_r_proto" in
11302 ''|0) try='int endpwent_r(FILE**);'
11303 ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11304 esac
11305 case "$endpwent_r_proto" in
11306 ''|0) try='void endpwent_r(FILE**);'
11307 ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11308 esac
11309 case "$endpwent_r_proto" in
90e831dc 11310 ''|0) d_endpwent_r=undef
10bc17b6 11311 endpwent_r_proto=0
a48ec845 11312 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11313 * ) case "$endpwent_r_proto" in
11314 REENTRANT_PROTO*) ;;
11315 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11316 esac
11317 echo "Prototype: $try" ;;
11318 esac
11319 ;;
c18e646a
JH
11320 *) case "$usethreads" in
11321 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11322 esac
90e831dc
SB
11323 d_endpwent_r=undef
11324 endpwent_r_proto=0
c18e646a 11325 ;;
a48ec845
JH
11326 esac
11327 ;;
10bc17b6
JH
11328*) endpwent_r_proto=0
11329 ;;
11330esac
11331
b4eb6b3d
JH
11332: see if endservent exists
11333set endservent d_endsent
11334eval $inlibc
11335
10bc17b6
JH
11336: see if endservent_r exists
11337set endservent_r d_endservent_r
11338eval $inlibc
11339case "$d_endservent_r" in
11340"$define")
11341 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11342 case "$d_endservent_r_proto:$usethreads" in
11343 ":define") d_endservent_r_proto=define
a48ec845
JH
11344 set d_endservent_r_proto endservent_r $hdrs
11345 eval $hasproto ;;
11346 *) ;;
11347 esac
11348 case "$d_endservent_r_proto" in
11349 define)
10bc17b6
JH
11350 case "$endservent_r_proto" in
11351 ''|0) try='int endservent_r(struct servent_data*);'
31ee0cb7 11352 ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
11353 esac
11354 case "$endservent_r_proto" in
11355 ''|0) try='void endservent_r(struct servent_data*);'
31ee0cb7 11356 ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
11357 esac
11358 case "$endservent_r_proto" in
90e831dc 11359 ''|0) d_endservent_r=undef
10bc17b6 11360 endservent_r_proto=0
a48ec845 11361 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11362 * ) case "$endservent_r_proto" in
11363 REENTRANT_PROTO*) ;;
11364 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11365 esac
11366 echo "Prototype: $try" ;;
11367 esac
11368 ;;
c18e646a
JH
11369 *) case "$usethreads" in
11370 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11371 esac
90e831dc
SB
11372 d_endservent_r=undef
11373 endservent_r_proto=0
c18e646a 11374 ;;
a48ec845
JH
11375 esac
11376 ;;
10bc17b6
JH
11377*) endservent_r_proto=0
11378 ;;
11379esac
11380
b4eb6b3d
JH
11381: Locate the flags for 'open()'
11382echo " "
55954f19 11383$cat >try.c <<EOCP
b4eb6b3d
JH
11384#include <sys/types.h>
11385#ifdef I_FCNTL
11386#include <fcntl.h>
11387#endif
11388#ifdef I_SYS_FILE
11389#include <sys/file.h>
11390#endif
55954f19
JH
11391#$i_stdlib I_STDLIB
11392#ifdef I_STDLIB
11393#include <stdlib.h>
11394#endif
b4eb6b3d
JH
11395int main() {
11396 if(O_RDONLY);
11397#ifdef O_TRUNC
11398 exit(0);
11399#else
11400 exit(1);
11401#endif
11402}
11403EOCP
11404: check sys/file.h first to get FREAD on Sun
11405if $test `./findhdr sys/file.h` && \
5440bc8e 11406 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
11407 h_sysfile=true;
11408 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 11409 if $run ./try; then
b4eb6b3d
JH
11410 echo "and you have the 3 argument form of open()." >&4
11411 val="$define"
11412 else
11413 echo "but not the 3 argument form of open(). Oh, well." >&4
11414 val="$undef"
11415 fi
11416elif $test `./findhdr fcntl.h` && \
5440bc8e 11417 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
11418 h_fcntl=true;
11419 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 11420 if $run ./try; then
b4eb6b3d
JH
11421 echo "and you have the 3 argument form of open()." >&4
11422 val="$define"
11423 else
11424 echo "but not the 3 argument form of open(). Oh, well." >&4
11425 val="$undef"
11426 fi
11427else
11428 val="$undef"
11429 echo "I can't find the O_* constant definitions! You got problems." >&4
11430fi
11431set d_open3
11432eval $setvar
5440bc8e 11433$rm -f try try.*
b4eb6b3d
JH
11434
11435: see which of string.h or strings.h is needed
11436echo " "
11437strings=`./findhdr string.h`
11438if $test "$strings" && $test -r "$strings"; then
11439 echo "Using <string.h> instead of <strings.h>." >&4
11440 val="$define"
11441else
11442 val="$undef"
11443 strings=`./findhdr strings.h`
11444 if $test "$strings" && $test -r "$strings"; then
11445 echo "Using <strings.h> instead of <string.h>." >&4
11446 else
11447 echo "No string header found -- You'll surely have problems." >&4
11448 fi
11449fi
11450set i_string
11451eval $setvar
11452case "$i_string" in
11453"$undef") strings=`./findhdr strings.h`;;
11454*) strings=`./findhdr string.h`;;
11455esac
11456
3c728e00
JH
11457: see if this is a sys/file.h system
11458val=''
11459set sys/file.h val
11460eval $inhdr
11461
11462: do we need to include sys/file.h ?
11463case "$val" in
11464"$define")
11465 echo " "
11466 if $h_sysfile; then
11467 val="$define"
11468 echo "We'll be including <sys/file.h>." >&4
11469 else
11470 val="$undef"
11471 echo "We won't be including <sys/file.h>." >&4
11472 fi
11473 ;;
11474*)
11475 h_sysfile=false
11476 ;;
11477esac
11478set i_sysfile
11479eval $setvar
11480
11481: see if fcntl.h is there
11482val=''
11483set fcntl.h val
11484eval $inhdr
11485
11486: see if we can include fcntl.h
11487case "$val" in
11488"$define")
11489 echo " "
11490 if $h_fcntl; then
11491 val="$define"
11492 echo "We'll be including <fcntl.h>." >&4
11493 else
11494 val="$undef"
11495 if $h_sysfile; then
11496 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11497 else
11498 echo "We won't be including <fcntl.h>." >&4
11499 fi
11500 fi
11501 ;;
11502*)
11503 h_fcntl=false
11504 val="$undef"
11505 ;;
11506esac
11507set i_fcntl
11508eval $setvar
11509
b4eb6b3d
JH
11510: check for non-blocking I/O stuff
11511case "$h_sysfile" in
a0acbdc3
JH
11512true) echo "#include <sys/file.h>" > head.c;;
11513*)
11514 case "$h_fcntl" in
11515 true) echo "#include <fcntl.h>" > head.c;;
11516 *) echo "#include <sys/fcntl.h>" > head.c;;
11517 esac
11518 ;;
b4eb6b3d
JH
11519esac
11520echo " "
11521echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11522case "$o_nonblock" in
11523'')
11524 $cat head.c > try.c
3c728e00 11525 $cat >>try.c <<EOCP
b4eb6b3d 11526#include <stdio.h>
55954f19
JH
11527#$i_stdlib I_STDLIB
11528#ifdef I_STDLIB
80b3ef99 11529#include <stdlib.h>
55954f19 11530#endif
3c728e00
JH
11531#$i_fcntl I_FCNTL
11532#ifdef I_FCNTL
11533#include <fcntl.h>
11534#endif
b4eb6b3d
JH
11535int main() {
11536#ifdef O_NONBLOCK
11537 printf("O_NONBLOCK\n");
11538 exit(0);
11539#endif
11540#ifdef O_NDELAY
11541 printf("O_NDELAY\n");
11542 exit(0);
11543#endif
11544#ifdef FNDELAY
11545 printf("FNDELAY\n");
11546 exit(0);
11547#endif
11548 exit(0);
11549}
11550EOCP
11551 set try
11552 if eval $compile_ok; then
5440bc8e 11553 o_nonblock=`$run ./try`
b4eb6b3d
JH
11554 case "$o_nonblock" in
11555 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11556 *) echo "Seems like we can use $o_nonblock.";;
11557 esac
11558 else
11559 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11560 fi
11561 ;;
11562*) echo "Using $hint value $o_nonblock.";;
11563esac
11564$rm -f try try.* .out core
11565
11566echo " "
11567echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11568case "$eagain" in
11569'')
11570 $cat head.c > try.c
11571 $cat >>try.c <<EOCP
11572#include <errno.h>
11573#include <sys/types.h>
11574#include <signal.h>
11575#include <stdio.h>
55954f19
JH
11576#$i_stdlib I_STDLIB
11577#ifdef I_STDLIB
11578#include <stdlib.h>
11579#endif
1deb0a86
JH
11580#$i_fcntl I_FCNTL
11581#ifdef I_FCNTL
11582#include <fcntl.h>
11583#endif
b4eb6b3d
JH
11584#define MY_O_NONBLOCK $o_nonblock
11585#ifndef errno /* XXX need better Configure test */
11586extern int errno;
11587#endif
11588#$i_unistd I_UNISTD
11589#ifdef I_UNISTD
11590#include <unistd.h>
11591#endif
11592#$i_string I_STRING
11593#ifdef I_STRING
11594#include <string.h>
11595#else
11596#include <strings.h>
11597#endif
11598$signal_t blech(x) int x; { exit(3); }
11599EOCP
11600 $cat >> try.c <<'EOCP'
11601int main()
11602{
11603 int pd[2];
11604 int pu[2];
11605 char buf[1];
11606 char string[100];
11607
11608 pipe(pd); /* Down: child -> parent */
11609 pipe(pu); /* Up: parent -> child */
11610 if (0 != fork()) {
11611 int ret;
11612 close(pd[1]); /* Parent reads from pd[0] */
11613 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 11614#ifdef F_SETFL
b4eb6b3d
JH
11615 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11616 exit(1);
a0acbdc3
JH
11617#else
11618 exit(4);
11619#endif
b4eb6b3d
JH
11620 signal(SIGALRM, blech);
11621 alarm(5);
11622 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
11623 exit(2);
11624 sprintf(string, "%d\n", ret);
11625 write(2, string, strlen(string));
11626 alarm(0);
11627#ifdef EAGAIN
11628 if (errno == EAGAIN) {
11629 printf("EAGAIN\n");
11630 goto ok;
11631 }
11632#endif
11633#ifdef EWOULDBLOCK
11634 if (errno == EWOULDBLOCK)
11635 printf("EWOULDBLOCK\n");
11636#endif
11637 ok:
11638 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
11639 sleep(2); /* Give it time to close our pipe */
11640 alarm(5);
11641 ret = read(pd[0], buf, 1); /* Should read EOF */
11642 alarm(0);
11643 sprintf(string, "%d\n", ret);
868439a2 11644 write(4, string, strlen(string));
b4eb6b3d
JH
11645 exit(0);
11646 }
11647
11648 close(pd[0]); /* We write to pd[1] */
11649 close(pu[1]); /* We read from pu[0] */
11650 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
11651 close(pd[1]); /* Pipe pd is now fully closed! */
11652 exit(0); /* Bye bye, thank you for playing! */
11653}
11654EOCP
11655 set try
11656 if eval $compile_ok; then
11657 echo "$startsh" >mtry
868439a2 11658 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
11659 chmod +x mtry
11660 ./mtry >/dev/null 2>&1
11661 case $? in
11662 0) eagain=`$cat try.out`;;
11663 1) echo "Could not perform non-blocking setting!";;
11664 2) echo "I did a successful read() for something that was not there!";;
11665 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 11666 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
11667 *) echo "Something terribly wrong happened during testing.";;
11668 esac
11669 rd_nodata=`$cat try.ret`
11670 echo "A read() system call with no data present returns $rd_nodata."
11671 case "$rd_nodata" in
11672 0|-1) ;;
11673 *)
11674 echo "(That's peculiar, fixing that to be -1.)"
11675 rd_nodata=-1
11676 ;;
11677 esac
11678 case "$eagain" in
11679 '')
11680 echo "Forcing errno EAGAIN on read() with no data available."
11681 eagain=EAGAIN
11682 ;;
11683 *)
11684 echo "Your read() sets errno to $eagain when no data is available."
11685 ;;
11686 esac
11687 status=`$cat try.err`
11688 case "$status" in
11689 0) echo "And it correctly returns 0 to signal EOF.";;
11690 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11691 *) echo "However, your read() returns '$status' on EOF??";;
11692 esac
11693 val="$define"
11694 if test "$status" = "$rd_nodata"; then
11695 echo "WARNING: you can't distinguish between EOF and no data!"
11696 val="$undef"
11697 fi
11698 else
11699 echo "I can't compile the test program--assuming errno EAGAIN will do."
11700 eagain=EAGAIN
11701 fi
11702 set d_eofnblk
11703 eval $setvar
11704 ;;
11705*)
11706 echo "Using $hint value $eagain."
11707 echo "Your read() returns $rd_nodata when no data is present."
11708 case "$d_eofnblk" in
11709 "$define") echo "And you can see EOF because read() returns 0.";;
11710 "$undef") echo "But you can't see EOF status from read() returned value.";;
11711 *)
11712 echo "(Assuming you can't see EOF status from read anyway.)"
11713 d_eofnblk=$undef
11714 ;;
11715 esac
11716 ;;
11717esac
11718$rm -f try try.* .out core head.c mtry
11719
15b61c98
JH
11720: see if _ptr and _cnt from stdio act std
11721echo " "
b4eb6b3d 11722
15b61c98
JH
11723if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11724 echo "(Looks like you have stdio.h from BSD.)"
11725 case "$stdio_ptr" in
11726 '') stdio_ptr='((fp)->_p)'
11727 ptr_lval=$define
11728 ;;
11729 *) ptr_lval=$d_stdio_ptr_lval;;
11730 esac
11731 case "$stdio_cnt" in
11732 '') stdio_cnt='((fp)->_r)'
11733 cnt_lval=$define
11734 ;;
11735 *) cnt_lval=$d_stdio_cnt_lval;;
11736 esac
11737 case "$stdio_base" in
11738 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11739 esac
11740 case "$stdio_bufsiz" in
11741 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11742 esac
11743elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11744 echo "(Looks like you have stdio.h from Linux.)"
11745 case "$stdio_ptr" in
11746 '') stdio_ptr='((fp)->_IO_read_ptr)'
11747 ptr_lval=$define
11748 ;;
11749 *) ptr_lval=$d_stdio_ptr_lval;;
11750 esac
11751 case "$stdio_cnt" in
11752 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11753 cnt_lval=$undef
11754 ;;
11755 *) cnt_lval=$d_stdio_cnt_lval;;
11756 esac
11757 case "$stdio_base" in
11758 '') stdio_base='((fp)->_IO_read_base)';;
11759 esac
11760 case "$stdio_bufsiz" in
11761 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11762 esac
11763else
11764 case "$stdio_ptr" in
11765 '') stdio_ptr='((fp)->_ptr)'
11766 ptr_lval=$define
11767 ;;
11768 *) ptr_lval=$d_stdio_ptr_lval;;
11769 esac
11770 case "$stdio_cnt" in
11771 '') stdio_cnt='((fp)->_cnt)'
11772 cnt_lval=$define
11773 ;;
11774 *) cnt_lval=$d_stdio_cnt_lval;;
11775 esac
11776 case "$stdio_base" in
11777 '') stdio_base='((fp)->_base)';;
11778 esac
11779 case "$stdio_bufsiz" in
11780 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11781 esac
11782fi
b4eb6b3d 11783
15b61c98
JH
11784: test whether _ptr and _cnt really work
11785echo "Checking how std your stdio is..." >&4
11786$cat >try.c <<EOP
11787#include <stdio.h>
55954f19
JH
11788#$i_stdlib I_STDLIB
11789#ifdef I_STDLIB
9d9004a9 11790#include <stdlib.h>
55954f19 11791#endif
15b61c98
JH
11792#define FILE_ptr(fp) $stdio_ptr
11793#define FILE_cnt(fp) $stdio_cnt
9d9004a9 11794int main() {
15b61c98
JH
11795 FILE *fp = fopen("try.c", "r");
11796 char c = getc(fp);
11797 if (
11798 18 <= FILE_cnt(fp) &&
11799 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11800 )
11801 exit(0);
11802 exit(1);
9d9004a9 11803}
15b61c98
JH
11804EOP
11805val="$undef"
11806set try
11807if eval $compile && $to try.c; then
11808 if $run ./try; then
11809 echo "Your stdio acts pretty std."
11810 val="$define"
9d9004a9 11811 else
15b61c98 11812 echo "Your stdio isn't very std."
9d9004a9 11813 fi
15b61c98
JH
11814else
11815 echo "Your stdio doesn't appear very std."
11816fi
11817$rm -f try.c try
11818
11819# glibc 2.2.90 and above apparently change stdio streams so Perl's
11820# direct buffer manipulation no longer works. The Configure tests
11821# should be changed to correctly detect this, but until then,
11822# the following check should at least let perl compile and run.
11823# (This quick fix should be updated before 5.8.1.)
11824# To be defensive, reject all unknown versions, and all versions > 2.2.9.
11825# A. Dougherty, June 3, 2002.
11826case "$d_gnulibc" in
11827$define)
11828 case "$gnulibc_version" in
11829 2.[01]*) ;;
11830 2.2) ;;
11831 2.2.[0-9]) ;;
11832 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
11833 val="$undef"
11834 ;;
11835 esac
9d9004a9
AD
11836 ;;
11837esac
15b61c98 11838set d_stdstdio
9d9004a9 11839eval $setvar
9d9004a9 11840
15b61c98
JH
11841: Can _ptr be used as an lvalue?
11842case "$d_stdstdio$ptr_lval" in
11843$define$define) val=$define ;;
11844*) val=$undef ;;
11845esac
11846set d_stdio_ptr_lval
11847eval $setvar
9d9004a9 11848
15b61c98
JH
11849: Can _cnt be used as an lvalue?
11850case "$d_stdstdio$cnt_lval" in
11851$define$define) val=$define ;;
11852*) val=$undef ;;
11853esac
11854set d_stdio_cnt_lval
11855eval $setvar
b4eb6b3d 11856
15b61c98
JH
11857
11858: test whether setting _ptr sets _cnt as a side effect
11859d_stdio_ptr_lval_sets_cnt="$undef"
11860d_stdio_ptr_lval_nochange_cnt="$undef"
11861case "$d_stdio_ptr_lval$d_stdstdio" in
11862$define$define)
11863 echo "Checking to see what happens if we set the stdio ptr..." >&4
11864$cat >try.c <<EOP
11865#include <stdio.h>
11866/* Can we scream? */
11867/* Eat dust sed :-) */
11868/* In the buffer space, no one can hear you scream. */
55954f19
JH
11869#$i_stdlib I_STDLIB
11870#ifdef I_STDLIB
11871#include <stdlib.h>
11872#endif
15b61c98
JH
11873#define FILE_ptr(fp) $stdio_ptr
11874#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 11875#include <sys/types.h>
b4eb6b3d 11876int main() {
15b61c98
JH
11877 FILE *fp = fopen("try.c", "r");
11878 int c;
11879 char *ptr;
11880 size_t cnt;
11881 if (!fp) {
11882 puts("Fail even to read");
11883 exit(1);
11884 }
11885 c = getc(fp); /* Read away the first # */
11886 if (c == EOF) {
11887 puts("Fail even to read");
11888 exit(1);
11889 }
11890 if (!(
11891 18 <= FILE_cnt(fp) &&
11892 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11893 )) {
11894 puts("Fail even to read");
11895 exit (1);
11896 }
11897 ptr = (char*) FILE_ptr(fp);
11898 cnt = (size_t)FILE_cnt(fp);
11899
11900 FILE_ptr(fp) += 42;
11901
11902 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
11903 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11904 exit (1);
11905 }
11906 if (FILE_cnt(fp) <= 20) {
11907 printf ("Fail (<20 chars to test)");
11908 exit (1);
11909 }
11910 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11911 puts("Fail compare");
11912 exit (1);
11913 }
11914 if (cnt == FILE_cnt(fp)) {
11915 puts("Pass_unchanged");
11916 exit (0);
11917 }
11918 if (FILE_cnt(fp) == (cnt - 42)) {
11919 puts("Pass_changed");
11920 exit (0);
11921 }
11922 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11923 return 1;
11924
11925}
11926EOP
11927 set try
11928 if eval $compile && $to try.c; then
11929 case `$run ./try` in
11930 Pass_changed)
11931 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
11932 d_stdio_ptr_lval_sets_cnt="$define" ;;
11933 Pass_unchanged)
11934 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
11935 d_stdio_ptr_lval_nochange_cnt="$define" ;;
11936 Fail*)
11937 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
11938 *)
11939 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11940 esac
11941 else
11942 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
11943 fi
11944 $rm -f try.c try
11945 ;;
11946esac
11947
11948: see if _base is also standard
11949val="$undef"
11950case "$d_stdstdio" in
11951$define)
11952 $cat >try.c <<EOP
11953#include <stdio.h>
11954#$i_stdlib I_STDLIB
11955#ifdef I_STDLIB
11956#include <stdlib.h>
11957#endif
11958#define FILE_base(fp) $stdio_base
11959#define FILE_bufsiz(fp) $stdio_bufsiz
11960int main() {
11961 FILE *fp = fopen("try.c", "r");
11962 char c = getc(fp);
11963 if (
11964 19 <= FILE_bufsiz(fp) &&
11965 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11966 )
11967 exit(0);
11968 exit(1);
11969}
11970EOP
11971 set try
11972 if eval $compile && $to try.c; then
11973 if $run ./try; then
11974 echo "And its _base field acts std."
11975 val="$define"
11976 else
11977 echo "But its _base field isn't std."
11978 fi
11979 else
11980 echo "However, it seems to be lacking the _base field."
11981 fi
11982 $rm -f try.c try
11983 ;;
11984esac
11985set d_stdiobase
11986eval $setvar
11987
11988: see if fast_stdio exists
11989val="$undef"
11990case "$d_stdstdio:$d_stdio_ptr_lval" in
11991"$define:$define")
11992 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
11993 *$define*)
11994 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
11995 val="$define"
11996 ;;
11997 esac
11998 ;;
11999esac
12000set d_faststdio
12001eval $setvar
12002
12003
12004
12005: see if fchdir exists
12006set fchdir d_fchdir
12007eval $inlibc
12008
12009: see if fchmod exists
12010set fchmod d_fchmod
12011eval $inlibc
12012
12013: see if fchown exists
12014set fchown d_fchown
12015eval $inlibc
12016
12017: see if this is an fcntl system
12018set fcntl d_fcntl
12019eval $inlibc
12020
12021echo " "
12022: See if fcntl-based locking works.
12023$cat >try.c <<EOCP
12024#$i_stdlib I_STDLIB
12025#ifdef I_STDLIB
12026#include <stdlib.h>
12027#endif
12028#include <unistd.h>
12029#include <fcntl.h>
12030#include <signal.h>
12031$signal_t blech(x) int x; { exit(3); }
12032int main() {
12033#if defined(F_SETLK) && defined(F_SETLKW)
12034 struct flock flock;
12035 int retval, fd;
12036 fd = open("try.c", O_RDONLY);
12037 flock.l_type = F_RDLCK;
12038 flock.l_whence = SEEK_SET;
12039 flock.l_start = flock.l_len = 0;
12040 signal(SIGALRM, blech);
12041 alarm(10);
12042 retval = fcntl(fd, F_SETLK, &flock);
12043 close(fd);
12044 (retval < 0 ? exit(2) : exit(0));
12045#else
12046 exit(2);
12047#endif
12048}
12049EOCP
12050echo "Checking if fcntl-based file locking works... "
12051case "$d_fcntl" in
12052"$define")
12053 set try
12054 if eval $compile_ok; then
12055 if $run ./try; then
12056 echo "Yes, it seems to work."
12057 val="$define"
12058 else
12059 echo "Nope, it didn't work."
12060 val="$undef"
12061 case "$?" in
12062 3) $cat >&4 <<EOM
12063***
12064*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12065*** This is (almost) impossible.
12066*** If your NFS lock daemons are not feeling well, something like
12067*** this may happen, please investigate. Cannot continue, aborting.
12068***
12069EOM
12070 exit 1
12071 ;;
12072 esac
12073 fi
12074 else
12075 echo "I'm unable to compile the test program, so I'll assume not."
12076 val="$undef"
12077 fi
12078 ;;
12079*) val="$undef";
12080 echo "Nope, since you don't even have fcntl()."
12081 ;;
12082esac
12083set d_fcntl_can_lock
12084eval $setvar
12085$rm -f try*
12086
12087
12088: check for fd_set items
12089$cat <<EOM
12090
12091Checking to see how well your C compiler handles fd_set and friends ...
12092EOM
12093$cat >try.c <<EOCP
12094#$i_stdlib I_STDLIB
12095#ifdef I_STDLIB
12096#include <stdlib.h>
12097#endif
12098#$i_systime I_SYS_TIME
12099#$i_sysselct I_SYS_SELECT
12100#$d_socket HAS_SOCKET
12101#include <sys/types.h>
12102#ifdef HAS_SOCKET
12103#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12104#endif
12105#ifdef I_SYS_TIME
12106#include <sys/time.h>
12107#endif
12108#ifdef I_SYS_SELECT
12109#include <sys/select.h>
12110#endif
12111int main() {
12112 fd_set fds;
12113
12114#ifdef TRYBITS
12115 if(fds.fds_bits);
12116#endif
12117
12118#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12119 exit(0);
12120#else
12121 exit(1);
12122#endif
12123}
12124EOCP
12125set try -DTRYBITS
12126if eval $compile; then
12127 d_fds_bits="$define"
12128 d_fd_set="$define"
12129 echo "Well, your system knows about the normal fd_set typedef..." >&4
12130 if $run ./try; then
b4eb6b3d
JH
12131 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12132 d_fd_macros="$define"
12133 else
12134 $cat >&4 <<'EOM'
12135but not the normal fd_set macros! Gaaack! I'll have to cover for you.
12136EOM
12137 d_fd_macros="$undef"
12138 fi
12139else
12140 $cat <<'EOM'
12141Hmm, your compiler has some difficulty with fd_set. Checking further...
12142EOM
5440bc8e 12143 set try
b4eb6b3d
JH
12144 if eval $compile; then
12145 d_fds_bits="$undef"
12146 d_fd_set="$define"
12147 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 12148 if $run ./try; then
b4eb6b3d
JH
12149 echo "and you have the normal fd_set macros." >&4
12150 d_fd_macros="$define"
12151 else
12152 $cat <<'EOM'
12153but not the normal fd_set macros! Gross! More work for me...
12154EOM
12155 d_fd_macros="$undef"
12156 fi
12157 else
12158 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
12159 d_fd_set="$undef"
12160 d_fds_bits="$undef"
12161 d_fd_macros="$undef"
12162 fi
12163fi
5440bc8e 12164$rm -f try try.*
b4eb6b3d
JH
12165
12166: see if fgetpos exists
12167set fgetpos d_fgetpos
12168eval $inlibc
12169
758a5d79
JH
12170: see if finite exists
12171set finite d_finite
12172eval $inlibc
12173
12174: see if finitel exists
12175set finitel d_finitel
12176eval $inlibc
12177
b4eb6b3d
JH
12178: see if flock exists
12179set flock d_flock
12180eval $inlibc
12181
2ef53570
JH
12182: see if prototype for flock is available
12183echo " "
12184set d_flockproto flock $i_sysfile sys/file.h
12185eval $hasproto
12186
b4eb6b3d
JH
12187: see if fork exists
12188set fork d_fork
12189eval $inlibc
12190
758a5d79
JH
12191: see if fp_class exists
12192set fp_class d_fp_class
12193eval $inlibc
12194
b4eb6b3d
JH
12195: see if pathconf exists
12196set pathconf d_pathconf
12197eval $inlibc
12198
12199: see if fpathconf exists
12200set fpathconf d_fpathconf
12201eval $inlibc
12202
758a5d79
JH
12203: see if fpclass exists
12204set fpclass d_fpclass
12205eval $inlibc
12206
12207: see if fpclassify exists
12208set fpclassify d_fpclassify
12209eval $inlibc
12210
12211: see if fpclassl exists
12212set fpclassl d_fpclassl
12213eval $inlibc
12214
b4eb6b3d
JH
12215
12216: check for fpos64_t
12217echo " "
12218echo "Checking to see if you have fpos64_t..." >&4
12219$cat >try.c <<EOCP
12220#include <stdio.h>
12221int main() { fpos64_t x = 7; }
12222EOCP
12223set try
12224if eval $compile; then
12225 val="$define"
12226 echo "You have fpos64_t."
12227else
12228 val="$undef"
12229 echo "You do not have fpos64_t."
12230 case "$fpossize" in
12231 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12232 esac
12233fi
12234$rm -f try.* try
12235set d_fpos64_t
12236eval $setvar
12237
12238: see if frexpl exists
12239set frexpl d_frexpl
12240eval $inlibc
12241
b4eb6b3d
JH
12242: see if this is a sys/param system
12243set sys/param.h i_sysparam
12244eval $inhdr
12245
12246: see if this is a sys/mount.h system
12247set sys/mount.h i_sysmount
12248eval $inhdr
12249
b4eb6b3d
JH
12250
12251echo " "
12252echo "Checking to see if your system supports struct fs_data..." >&4
12253set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12254eval $hasstruct
12255case "$d_fs_data_s" in
12256"$define") echo "Yes, it does." ;;
12257*) echo "No, it doesn't." ;;
12258esac
12259
12260: see if fseeko exists
12261set fseeko d_fseeko
12262eval $inlibc
12263case "$longsize" in
122648) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12265esac
12266
12267: see if fsetpos exists
12268set fsetpos d_fsetpos
12269eval $inlibc
12270
12271
12272: see if fstatfs exists
12273set fstatfs d_fstatfs
12274eval $inlibc
12275
12276
12277: see if statvfs exists
12278set statvfs d_statvfs
12279eval $inlibc
12280
12281: see if fstatvfs exists
12282set fstatvfs d_fstatvfs
12283eval $inlibc
12284
12285
411ab01c
JH
12286: see if fsync exists
12287set fsync d_fsync
12288eval $inlibc
12289
b4eb6b3d
JH
12290: see if ftello exists
12291set ftello d_ftello
12292eval $inlibc
12293case "$longsize" in
122948) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12295esac
12296
12297: see if getcwd exists
12298set getcwd d_getcwd
12299eval $inlibc
12300
12301: see if getespwnam exists
12302set getespwnam d_getespwnam
12303eval $inlibc
12304
12305
12306: see if getfsstat exists
12307set getfsstat d_getfsstat
12308eval $inlibc
12309
12310: see if getgrent exists
12311set getgrent d_getgrent
12312eval $inlibc
12313
10bc17b6
JH
12314: see if getgrent_r exists
12315set getgrent_r d_getgrent_r
12316eval $inlibc
12317case "$d_getgrent_r" in
12318"$define")
12319 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12320 case "$d_getgrent_r_proto:$usethreads" in
12321 ":define") d_getgrent_r_proto=define
a48ec845
JH
12322 set d_getgrent_r_proto getgrent_r $hdrs
12323 eval $hasproto ;;
12324 *) ;;
12325 esac
12326 case "$d_getgrent_r_proto" in
12327 define)
10bc17b6
JH
12328 case "$getgrent_r_proto" in
12329 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12330 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12331 esac
12332 case "$getgrent_r_proto" in
12333 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12334 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12335 esac
12336 case "$getgrent_r_proto" in
12337 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12338 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12339 esac
12340 case "$getgrent_r_proto" in
12341 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12342 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12343 esac
12344 case "$getgrent_r_proto" in
12345 ''|0) try='int getgrent_r(struct group*, char*, int);'
12346 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12347 esac
12348 case "$getgrent_r_proto" in
12349 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12350 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12351 esac
12352 case "$getgrent_r_proto" in
90e831dc 12353 ''|0) d_getgrent_r=undef
10bc17b6 12354 getgrent_r_proto=0
a48ec845 12355 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12356 * ) case "$getgrent_r_proto" in
12357 REENTRANT_PROTO*) ;;
12358 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12359 esac
12360 echo "Prototype: $try" ;;
12361 esac
12362 ;;
c18e646a
JH
12363 *) case "$usethreads" in
12364 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12365 esac
90e831dc
SB
12366 d_getgrent_r=undef
12367 getgrent_r_proto=0
c18e646a 12368 ;;
a48ec845
JH
12369 esac
12370 ;;
10bc17b6
JH
12371*) getgrent_r_proto=0
12372 ;;
12373esac
12374
12375: see if getgrgid_r exists
12376set getgrgid_r d_getgrgid_r
12377eval $inlibc
12378case "$d_getgrgid_r" in
12379"$define")
12380 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12381 case "$d_getgrgid_r_proto:$usethreads" in
12382 ":define") d_getgrgid_r_proto=define
a48ec845
JH
12383 set d_getgrgid_r_proto getgrgid_r $hdrs
12384 eval $hasproto ;;
12385 *) ;;
12386 esac
12387 case "$d_getgrgid_r_proto" in
12388 define)
10bc17b6
JH
12389 case "$getgrgid_r_proto" in
12390 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12391 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12392 esac
12393 case "$getgrgid_r_proto" in
12394 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12395 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12396 esac
12397 case "$getgrgid_r_proto" in
12398 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12399 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12400 esac
12401 case "$getgrgid_r_proto" in
12402 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12403 ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12404 esac
12405 case "$getgrgid_r_proto" in
90e831dc 12406 ''|0) d_getgrgid_r=undef
10bc17b6 12407 getgrgid_r_proto=0
a48ec845 12408 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12409 * ) case "$getgrgid_r_proto" in
12410 REENTRANT_PROTO*) ;;
12411 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12412 esac
12413 echo "Prototype: $try" ;;
12414 esac
12415 ;;
c18e646a
JH
12416 *) case "$usethreads" in
12417 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12418 esac
90e831dc
SB
12419 d_getgrgid_r=undef
12420 getgrgid_r_proto=0
c18e646a 12421 ;;
a48ec845
JH
12422 esac
12423 ;;
10bc17b6
JH
12424*) getgrgid_r_proto=0
12425 ;;
12426esac
12427
12428: see if getgrnam_r exists
12429set getgrnam_r d_getgrnam_r
12430eval $inlibc
12431case "$d_getgrnam_r" in
12432"$define")
12433 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12434 case "$d_getgrnam_r_proto:$usethreads" in
12435 ":define") d_getgrnam_r_proto=define
a48ec845
JH
12436 set d_getgrnam_r_proto getgrnam_r $hdrs
12437 eval $hasproto ;;
12438 *) ;;
12439 esac
12440 case "$d_getgrnam_r_proto" in
12441 define)
10bc17b6
JH
12442 case "$getgrnam_r_proto" in
12443 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12444 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12445 esac
12446 case "$getgrnam_r_proto" in
12447 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12448 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12449 esac
12450 case "$getgrnam_r_proto" in
12451 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12452 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12453 esac
12454 case "$getgrnam_r_proto" in
12455 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12456 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12457 esac
12458 case "$getgrnam_r_proto" in
12459 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12460 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12461 esac
12462 case "$getgrnam_r_proto" in
90e831dc 12463 ''|0) d_getgrnam_r=undef
10bc17b6 12464 getgrnam_r_proto=0
a48ec845 12465 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12466 * ) case "$getgrnam_r_proto" in
12467 REENTRANT_PROTO*) ;;
12468 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12469 esac
12470 echo "Prototype: $try" ;;
12471 esac
12472 ;;
c18e646a
JH
12473 *) case "$usethreads" in
12474 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12475 esac
90e831dc
SB
12476 d_getgrnam_r=undef
12477 getgrnam_r_proto=0
c18e646a 12478 ;;
a48ec845
JH
12479 esac
12480 ;;
10bc17b6
JH
12481*) getgrnam_r_proto=0
12482 ;;
12483esac
12484
b4eb6b3d
JH
12485: see if gethostbyaddr exists
12486set gethostbyaddr d_gethbyaddr
12487eval $inlibc
12488
12489: see if gethostbyname exists
12490set gethostbyname d_gethbyname
12491eval $inlibc
12492
12493: see if gethostent exists
12494set gethostent d_gethent
12495eval $inlibc
12496
12497: see how we will look up host name
12498echo " "
12499call=''
12500if set gethostname val -f d_gethname; eval $csym; $val; then
12501 echo 'gethostname() found.' >&4
12502 d_gethname="$define"
12503 call=gethostname
12504fi
12505if set uname val -f d_uname; eval $csym; $val; then
12506 if ./xenix; then
12507 $cat <<'EOM'
12508uname() was found, but you're running xenix, and older versions of xenix
12509have a broken uname(). If you don't really know whether your xenix is old
12510enough to have a broken system call, use the default answer.
12511
12512EOM
12513 dflt=y
12514 case "$d_uname" in
12515 "$define") dflt=n;;
12516 esac
12517 rp='Is your uname() broken?'
12518 . ./myread
12519 case "$ans" in
12520 n*) d_uname="$define"; call=uname;;
12521 esac
12522 else
12523 echo 'uname() found.' >&4
12524 d_uname="$define"
12525 case "$call" in
12526 '') call=uname ;;
12527 esac
12528 fi
12529fi
12530case "$d_gethname" in
12531'') d_gethname="$undef";;
12532esac
12533case "$d_uname" in
12534'') d_uname="$undef";;
12535esac
12536case "$d_uname$d_gethname" in
12537*define*)
12538 dflt=n
12539 cat <<EOM
12540
12541Every now and then someone has a $call() that lies about the hostname
12542but can't be fixed for political or economic reasons. If you wish, I can
12543pretend $call() isn't there and maybe compute hostname at run-time
12544thanks to the '$phostname' command.
12545
12546EOM
12547 rp="Shall I ignore $call() from now on?"
12548 . ./myread
12549 case "$ans" in
12550 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12551 esac;;
12552esac
12553case "$phostname" in
12554'') aphostname='';;
12555*) case "$aphostname" in
12556 /*) ;;
12557 *) set X $phostname
12558 shift
12559 file=$1
12560 shift
12561 file=`./loc $file $file $pth`
12562 aphostname=`echo $file $*`
12563 ;;
12564 esac
12565 ;;
12566esac
12567case "$d_uname$d_gethname" in
12568*define*) ;;
12569*)
12570 case "$phostname" in
12571 '')
12572 echo "There will be no way for $package to get your hostname." >&4;;
12573 *)
12574 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12575 ;;
12576 esac;;
12577esac
12578case "$d_phostname" in
12579'') d_phostname="$undef";;
12580esac
12581
10bc17b6
JH
12582: see if gethostbyaddr_r exists
12583set gethostbyaddr_r d_gethostbyaddr_r
12584eval $inlibc
12585case "$d_gethostbyaddr_r" in
12586"$define")
12587 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12588 case "$d_gethostbyaddr_r_proto:$usethreads" in
12589 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
12590 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12591 eval $hasproto ;;
12592 *) ;;
12593 esac
12594 case "$d_gethostbyaddr_r_proto" in
12595 define)
10bc17b6
JH
12596 case "$gethostbyaddr_r_proto" in
12597 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12598 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12599 esac
12600 case "$gethostbyaddr_r_proto" in
12601 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12602 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12603 esac
12604 case "$gethostbyaddr_r_proto" in
12605 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12606 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12607 esac
12608 case "$gethostbyaddr_r_proto" in
12609 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12610 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12611 esac
12612 case "$gethostbyaddr_r_proto" in
12613 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12614 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12615 esac
12616 case "$gethostbyaddr_r_proto" in
12617 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12618 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12619 esac
12620 case "$gethostbyaddr_r_proto" in
12621 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12622 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12623 esac
12624 case "$gethostbyaddr_r_proto" in
12625 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12626 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12627 esac
12628 case "$gethostbyaddr_r_proto" in
12629 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12630 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12631 esac
12632 case "$gethostbyaddr_r_proto" in
12633 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12634 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12635 esac
12636 case "$gethostbyaddr_r_proto" in
a845a0d4
JH
12637 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12638 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12639 esac
12640 case "$gethostbyaddr_r_proto" in
90e831dc 12641 ''|0) d_gethostbyaddr_r=undef
10bc17b6 12642 gethostbyaddr_r_proto=0
a48ec845 12643 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12644 * ) case "$gethostbyaddr_r_proto" in
12645 REENTRANT_PROTO*) ;;
12646 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12647 esac
12648 echo "Prototype: $try" ;;
12649 esac
12650 ;;
c18e646a
JH
12651 *) case "$usethreads" in
12652 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12653 esac
90e831dc
SB
12654 d_gethostbyaddr_r=undef
12655 gethostbyaddr_r_proto=0
c18e646a 12656 ;;
a48ec845
JH
12657 esac
12658 ;;
10bc17b6
JH
12659*) gethostbyaddr_r_proto=0
12660 ;;
12661esac
12662
12663: see if gethostbyname_r exists
12664set gethostbyname_r d_gethostbyname_r
12665eval $inlibc
12666case "$d_gethostbyname_r" in
12667"$define")
12668 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12669 case "$d_gethostbyname_r_proto:$usethreads" in
12670 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
12671 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12672 eval $hasproto ;;
12673 *) ;;
12674 esac
12675 case "$d_gethostbyname_r_proto" in
12676 define)
10bc17b6
JH
12677 case "$gethostbyname_r_proto" in
12678 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12679 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12680 esac
12681 case "$gethostbyname_r_proto" in
12682 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12683 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12684 esac
12685 case "$gethostbyname_r_proto" in
12686 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12687 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12688 esac
12689 case "$gethostbyname_r_proto" in
90e831dc 12690 ''|0) d_gethostbyname_r=undef
10bc17b6 12691 gethostbyname_r_proto=0
a48ec845 12692 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12693 * ) case "$gethostbyname_r_proto" in
12694 REENTRANT_PROTO*) ;;
12695 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12696 esac
12697 echo "Prototype: $try" ;;
12698 esac
12699 ;;
c18e646a
JH
12700 *) case "$usethreads" in
12701 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12702 esac
90e831dc
SB
12703 d_gethostbyname_r=undef
12704 gethostbyname_r_proto=0
c18e646a 12705 ;;
a48ec845
JH
12706 esac
12707 ;;
10bc17b6
JH
12708*) gethostbyname_r_proto=0
12709 ;;
12710esac
12711
12712: see if gethostent_r exists
12713set gethostent_r d_gethostent_r
12714eval $inlibc
12715case "$d_gethostent_r" in
12716"$define")
12717 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12718 case "$d_gethostent_r_proto:$usethreads" in
12719 ":define") d_gethostent_r_proto=define
a48ec845
JH
12720 set d_gethostent_r_proto gethostent_r $hdrs
12721 eval $hasproto ;;
12722 *) ;;
12723 esac
12724 case "$d_gethostent_r_proto" in
12725 define)
10bc17b6
JH
12726 case "$gethostent_r_proto" in
12727 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12728 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12729 esac
12730 case "$gethostent_r_proto" in
12731 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12732 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12733 esac
12734 case "$gethostent_r_proto" in
12735 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12736 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12737 esac
12738 case "$gethostent_r_proto" in
12739 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12740 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12741 esac
12742 case "$gethostent_r_proto" in
12743 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12744 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12745 esac
12746 case "$gethostent_r_proto" in
12747 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12748 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12749 esac
12750 case "$gethostent_r_proto" in
90e831dc 12751 ''|0) d_gethostent_r=undef
10bc17b6 12752 gethostent_r_proto=0
a48ec845 12753 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12754 * ) case "$gethostent_r_proto" in
12755 REENTRANT_PROTO*) ;;
12756 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
12757 esac
12758 echo "Prototype: $try" ;;
12759 esac
12760 ;;
c18e646a
JH
12761 *) case "$usethreads" in
12762 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12763 esac
90e831dc
SB
12764 d_gethostent_r=undef
12765 gethostent_r_proto=0
c18e646a 12766 ;;
a48ec845
JH
12767 esac
12768 ;;
10bc17b6
JH
12769*) gethostent_r_proto=0
12770 ;;
12771esac
b4eb6b3d
JH
12772
12773: see if prototypes for various gethostxxx netdb.h functions are available
12774echo " "
12775set d_gethostprotos gethostent $i_netdb netdb.h
12776eval $hasproto
12777
4e0554ec
JH
12778: see if getitimer exists
12779set getitimer d_getitimer
12780eval $inlibc
12781
b4eb6b3d
JH
12782: see if getlogin exists
12783set getlogin d_getlogin
12784eval $inlibc
12785
10bc17b6
JH
12786: see if getlogin_r exists
12787set getlogin_r d_getlogin_r
12788eval $inlibc
12789case "$d_getlogin_r" in
12790"$define")
12791 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
12792 case "$d_getlogin_r_proto:$usethreads" in
12793 ":define") d_getlogin_r_proto=define
a48ec845
JH
12794 set d_getlogin_r_proto getlogin_r $hdrs
12795 eval $hasproto ;;
12796 *) ;;
12797 esac
12798 case "$d_getlogin_r_proto" in
12799 define)
10bc17b6
JH
12800 case "$getlogin_r_proto" in
12801 ''|0) try='int getlogin_r(char*, size_t);'
12802 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12803 esac
12804 case "$getlogin_r_proto" in
12805 ''|0) try='int getlogin_r(char*, int);'
12806 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12807 esac
12808 case "$getlogin_r_proto" in
12809 ''|0) try='char* getlogin_r(char*, size_t);'
12810 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12811 esac
12812 case "$getlogin_r_proto" in
12813 ''|0) try='char* getlogin_r(char*, int);'
12814 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12815 esac
12816 case "$getlogin_r_proto" in
90e831dc 12817 ''|0) d_getlogin_r=undef
10bc17b6 12818 getlogin_r_proto=0
a48ec845 12819 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12820 * ) case "$getlogin_r_proto" in
12821 REENTRANT_PROTO*) ;;
12822 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12823 esac
12824 echo "Prototype: $try" ;;
12825 esac
12826 ;;
c18e646a
JH
12827 *) case "$usethreads" in
12828 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12829 esac
90e831dc
SB
12830 d_getlogin_r=undef
12831 getlogin_r_proto=0
c18e646a 12832 ;;
a48ec845
JH
12833 esac
12834 ;;
10bc17b6
JH
12835*) getlogin_r_proto=0
12836 ;;
12837esac
12838
b4eb6b3d
JH
12839: see if getmnt exists
12840set getmnt d_getmnt
12841eval $inlibc
12842
12843: see if getmntent exists
12844set getmntent d_getmntent
12845eval $inlibc
12846
12847: see if getnetbyaddr exists
12848set getnetbyaddr d_getnbyaddr
12849eval $inlibc
12850
12851: see if getnetbyname exists
12852set getnetbyname d_getnbyname
12853eval $inlibc
12854
12855: see if getnetent exists
12856set getnetent d_getnent
12857eval $inlibc
12858
10bc17b6
JH
12859: see if getnetbyaddr_r exists
12860set getnetbyaddr_r d_getnetbyaddr_r
12861eval $inlibc
12862case "$d_getnetbyaddr_r" in
12863"$define")
12864 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12865 case "$d_getnetbyaddr_r_proto:$usethreads" in
12866 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
12867 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12868 eval $hasproto ;;
12869 *) ;;
12870 esac
12871 case "$d_getnetbyaddr_r_proto" in
12872 define)
10bc17b6
JH
12873 case "$getnetbyaddr_r_proto" in
12874 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12875 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12876 esac
12877 case "$getnetbyaddr_r_proto" in
12878 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12879 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12880 esac
12881 case "$getnetbyaddr_r_proto" in
12882 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12883 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12884 esac
12885 case "$getnetbyaddr_r_proto" in
12886 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12887 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12888 esac
12889 case "$getnetbyaddr_r_proto" in
12890 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12891 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12892 esac
12893 case "$getnetbyaddr_r_proto" in
12894 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12895 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12896 esac
12897 case "$getnetbyaddr_r_proto" in
12898 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12899 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12900 esac
12901 case "$getnetbyaddr_r_proto" in
a845a0d4
JH
12902 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
12903 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
12904 esac
12905 case "$getnetbyaddr_r_proto" in
90e831dc 12906 ''|0) d_getnetbyaddr_r=undef
10bc17b6 12907 getnetbyaddr_r_proto=0
a48ec845 12908 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12909 * ) case "$getnetbyaddr_r_proto" in
12910 REENTRANT_PROTO*) ;;
12911 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12912 esac
12913 echo "Prototype: $try" ;;
12914 esac
12915 ;;
c18e646a
JH
12916 *) case "$usethreads" in
12917 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12918 esac
90e831dc
SB
12919 d_getnetbyaddr_r=undef
12920 getnetbyaddr_r_proto=0
c18e646a 12921 ;;
a48ec845
JH
12922 esac
12923 ;;
10bc17b6
JH
12924*) getnetbyaddr_r_proto=0
12925 ;;
12926esac
12927
12928: see if getnetbyname_r exists
12929set getnetbyname_r d_getnetbyname_r
12930eval $inlibc
12931case "$d_getnetbyname_r" in
12932"$define")
12933 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12934 case "$d_getnetbyname_r_proto:$usethreads" in
12935 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
12936 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12937 eval $hasproto ;;
12938 *) ;;
12939 esac
12940 case "$d_getnetbyname_r_proto" in
12941 define)
10bc17b6
JH
12942 case "$getnetbyname_r_proto" in
12943 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12944 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12945 esac
12946 case "$getnetbyname_r_proto" in
12947 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12948 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12949 esac
12950 case "$getnetbyname_r_proto" in
12951 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12952 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12953 esac
12954 case "$getnetbyname_r_proto" in
12955 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12956 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12957 esac
12958 case "$getnetbyname_r_proto" in
90e831dc 12959 ''|0) d_getnetbyname_r=undef
10bc17b6 12960 getnetbyname_r_proto=0
a48ec845 12961 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12962 * ) case "$getnetbyname_r_proto" in
12963 REENTRANT_PROTO*) ;;
12964 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12965 esac
12966 echo "Prototype: $try" ;;
12967 esac
12968 ;;
c18e646a
JH
12969 *) case "$usethreads" in
12970 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12971 esac
90e831dc
SB
12972 d_getnetbyname_r=undef
12973 getnetbyname_r_proto=0
c18e646a 12974 ;;
a48ec845
JH
12975 esac
12976 ;;
10bc17b6
JH
12977*) getnetbyname_r_proto=0
12978 ;;
12979esac
12980
12981: see if getnetent_r exists
12982set getnetent_r d_getnetent_r
12983eval $inlibc
12984case "$d_getnetent_r" in
12985"$define")
12986 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12987 case "$d_getnetent_r_proto:$usethreads" in
12988 ":define") d_getnetent_r_proto=define
a48ec845
JH
12989 set d_getnetent_r_proto getnetent_r $hdrs
12990 eval $hasproto ;;
12991 *) ;;
12992 esac
12993 case "$d_getnetent_r_proto" in
12994 define)
10bc17b6
JH
12995 case "$getnetent_r_proto" in
12996 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12997 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12998 esac
12999 case "$getnetent_r_proto" in
13000 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13001 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13002 esac
13003 case "$getnetent_r_proto" in
13004 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13005 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13006 esac
13007 case "$getnetent_r_proto" in
13008 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13009 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13010 esac
13011 case "$getnetent_r_proto" in
13012 ''|0) try='int getnetent_r(struct netent*, char*, int);'
13013 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13014 esac
13015 case "$getnetent_r_proto" in
13016 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13017 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13018 esac
13019 case "$getnetent_r_proto" in
90e831dc 13020 ''|0) d_getnetent_r=undef
10bc17b6 13021 getnetent_r_proto=0
a48ec845 13022 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13023 * ) case "$getnetent_r_proto" in
13024 REENTRANT_PROTO*) ;;
13025 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13026 esac
13027 echo "Prototype: $try" ;;
13028 esac
13029 ;;
c18e646a
JH
13030 *) case "$usethreads" in
13031 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13032 esac
90e831dc
SB
13033 d_getnetent_r=undef
13034 getnetent_r_proto=0
c18e646a 13035 ;;
a48ec845
JH
13036 esac
13037 ;;
10bc17b6
JH
13038*) getnetent_r_proto=0
13039 ;;
13040esac
13041
b4eb6b3d
JH
13042: see if prototypes for various getnetxxx netdb.h functions are available
13043echo " "
13044set d_getnetprotos getnetent $i_netdb netdb.h
13045eval $hasproto
13046
0c0643d0
JH
13047: see if getpagesize exists
13048set getpagesize d_getpagsz
13049eval $inlibc
13050
b4eb6b3d
JH
13051
13052: see if getprotobyname exists
13053set getprotobyname d_getpbyname
13054eval $inlibc
13055
13056: see if getprotobynumber exists
13057set getprotobynumber d_getpbynumber
13058eval $inlibc
13059
13060: see if getprotoent exists
13061set getprotoent d_getpent
13062eval $inlibc
13063
13064: see if getpgid exists
13065set getpgid d_getpgid
13066eval $inlibc
13067
13068: see if getpgrp2 exists
13069set getpgrp2 d_getpgrp2
13070eval $inlibc
13071
13072: see if getppid exists
13073set getppid d_getppid
13074eval $inlibc
13075
13076: see if getpriority exists
13077set getpriority d_getprior
13078eval $inlibc
13079
10bc17b6
JH
13080: see if getprotobyname_r exists
13081set getprotobyname_r d_getprotobyname_r
13082eval $inlibc
13083case "$d_getprotobyname_r" in
13084"$define")
13085 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13086 case "$d_getprotobyname_r_proto:$usethreads" in
13087 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
13088 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13089 eval $hasproto ;;
13090 *) ;;
13091 esac
13092 case "$d_getprotobyname_r_proto" in
13093 define)
10bc17b6
JH
13094 case "$getprotobyname_r_proto" in
13095 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13096 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13097 esac
13098 case "$getprotobyname_r_proto" in
13099 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13100 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13101 esac
13102 case "$getprotobyname_r_proto" in
13103 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13104 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13105 esac
13106 case "$getprotobyname_r_proto" in
90e831dc 13107 ''|0) d_getprotobyname_r=undef
10bc17b6 13108 getprotobyname_r_proto=0
a48ec845 13109 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13110 * ) case "$getprotobyname_r_proto" in
13111 REENTRANT_PROTO*) ;;
13112 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13113 esac
13114 echo "Prototype: $try" ;;
13115 esac
13116 ;;
c18e646a
JH
13117 *) case "$usethreads" in
13118 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13119 esac
90e831dc
SB
13120 d_getprotobyname_r=undef
13121 getprotobyname_r_proto=0
c18e646a 13122 ;;
a48ec845
JH
13123 esac
13124 ;;
10bc17b6
JH
13125*) getprotobyname_r_proto=0
13126 ;;
13127esac
13128
13129: see if getprotobynumber_r exists
13130set getprotobynumber_r d_getprotobynumber_r
13131eval $inlibc
13132case "$d_getprotobynumber_r" in
13133"$define")
13134 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13135 case "$d_getprotobynumber_r_proto:$usethreads" in
13136 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
13137 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13138 eval $hasproto ;;
13139 *) ;;
13140 esac
13141 case "$d_getprotobynumber_r_proto" in
13142 define)
10bc17b6
JH
13143 case "$getprotobynumber_r_proto" in
13144 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13145 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13146 esac
13147 case "$getprotobynumber_r_proto" in
13148 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13149 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13150 esac
13151 case "$getprotobynumber_r_proto" in
13152 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13153 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13154 esac
13155 case "$getprotobynumber_r_proto" in
90e831dc 13156 ''|0) d_getprotobynumber_r=undef
10bc17b6 13157 getprotobynumber_r_proto=0
a48ec845 13158 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13159 * ) case "$getprotobynumber_r_proto" in
13160 REENTRANT_PROTO*) ;;
13161 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13162 esac
13163 echo "Prototype: $try" ;;
13164 esac
13165 ;;
c18e646a
JH
13166 *) case "$usethreads" in
13167 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13168 esac
90e831dc
SB
13169 d_getprotobynumber_r=undef
13170 getprotobynumber_r_proto=0
c18e646a 13171 ;;
a48ec845
JH
13172 esac
13173 ;;
10bc17b6
JH
13174*) getprotobynumber_r_proto=0
13175 ;;
13176esac
13177
13178: see if getprotoent_r exists
13179set getprotoent_r d_getprotoent_r
13180eval $inlibc
13181case "$d_getprotoent_r" in
13182"$define")
13183 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13184 case "$d_getprotoent_r_proto:$usethreads" in
13185 ":define") d_getprotoent_r_proto=define
a48ec845
JH
13186 set d_getprotoent_r_proto getprotoent_r $hdrs
13187 eval $hasproto ;;
13188 *) ;;
13189 esac
13190 case "$d_getprotoent_r_proto" in
13191 define)
10bc17b6
JH
13192 case "$getprotoent_r_proto" in
13193 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13194 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13195 esac
13196 case "$getprotoent_r_proto" in
13197 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13198 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13199 esac
13200 case "$getprotoent_r_proto" in
13201 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13202 ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13203 esac
13204 case "$getprotoent_r_proto" in
13205 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13206 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13207 esac
13208 case "$getprotoent_r_proto" in
90e831dc 13209 ''|0) d_getprotoent_r=undef
10bc17b6 13210 getprotoent_r_proto=0
a48ec845 13211 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13212 * ) case "$getprotoent_r_proto" in
13213 REENTRANT_PROTO*) ;;
13214 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13215 esac
13216 echo "Prototype: $try" ;;
13217 esac
13218 ;;
c18e646a
JH
13219 *) case "$usethreads" in
13220 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13221 esac
90e831dc
SB
13222 d_getprotoent_r=undef
13223 getprotoent_r_proto=0
c18e646a 13224 ;;
a48ec845
JH
13225 esac
13226 ;;
10bc17b6
JH
13227*) getprotoent_r_proto=0
13228 ;;
13229esac
13230
b4eb6b3d
JH
13231: see if prototypes for various getprotoxxx netdb.h functions are available
13232echo " "
13233set d_getprotoprotos getprotoent $i_netdb netdb.h
13234eval $hasproto
13235
13236: see if getprpwnam exists
13237set getprpwnam d_getprpwnam
13238eval $inlibc
13239
13240: see if getpwent exists
13241set getpwent d_getpwent
13242eval $inlibc
13243
10bc17b6
JH
13244: see if getpwent_r exists
13245set getpwent_r d_getpwent_r
13246eval $inlibc
13247case "$d_getpwent_r" in
13248"$define")
13249 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13250 case "$d_getpwent_r_proto:$usethreads" in
13251 ":define") d_getpwent_r_proto=define
a48ec845
JH
13252 set d_getpwent_r_proto getpwent_r $hdrs
13253 eval $hasproto ;;
13254 *) ;;
13255 esac
13256 case "$d_getpwent_r_proto" in
13257 define)
10bc17b6
JH
13258 case "$getpwent_r_proto" in
13259 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13260 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13261 esac
13262 case "$getpwent_r_proto" in
13263 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13264 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13265 esac
13266 case "$getpwent_r_proto" in
13267 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13268 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13269 esac
13270 case "$getpwent_r_proto" in
13271 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13272 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13273 esac
13274 case "$getpwent_r_proto" in
13275 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13276 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13277 esac
13278 case "$getpwent_r_proto" in
13279 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13280 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13281 esac
13282 case "$getpwent_r_proto" in
90e831dc 13283 ''|0) d_getpwent_r=undef
10bc17b6 13284 getpwent_r_proto=0
a48ec845 13285 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13286 * ) case "$getpwent_r_proto" in
13287 REENTRANT_PROTO*) ;;
13288 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13289 esac
13290 echo "Prototype: $try" ;;
13291 esac
13292 ;;
c18e646a
JH
13293 *) case "$usethreads" in
13294 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13295 esac
90e831dc
SB
13296 d_getpwent_r=undef
13297 getpwent_r_proto=0
c18e646a 13298 ;;
a48ec845
JH
13299 esac
13300 ;;
10bc17b6
JH
13301*) getpwent_r_proto=0
13302 ;;
13303esac
13304
13305: see if getpwnam_r exists
13306set getpwnam_r d_getpwnam_r
13307eval $inlibc
13308case "$d_getpwnam_r" in
13309"$define")
13310 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13311 case "$d_getpwnam_r_proto:$usethreads" in
13312 ":define") d_getpwnam_r_proto=define
a48ec845
JH
13313 set d_getpwnam_r_proto getpwnam_r $hdrs
13314 eval $hasproto ;;
13315 *) ;;
13316 esac
13317 case "$d_getpwnam_r_proto" in
13318 define)
10bc17b6
JH
13319 case "$getpwnam_r_proto" in
13320 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13321 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13322 esac
13323 case "$getpwnam_r_proto" in
13324 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13325 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13326 esac
13327 case "$getpwnam_r_proto" in
13328 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13329 ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13330 esac
13331 case "$getpwnam_r_proto" in
13332 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13333 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13334 esac
13335 case "$getpwnam_r_proto" in
90e831dc 13336 ''|0) d_getpwnam_r=undef
10bc17b6 13337 getpwnam_r_proto=0
a48ec845 13338 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13339 * ) case "$getpwnam_r_proto" in
13340 REENTRANT_PROTO*) ;;
13341 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13342 esac
13343 echo "Prototype: $try" ;;
13344 esac
13345 ;;
c18e646a
JH
13346 *) case "$usethreads" in
13347 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13348 esac
90e831dc
SB
13349 d_getpwnam_r=undef
13350 getpwnam_r_proto=0
c18e646a 13351 ;;
a48ec845
JH
13352 esac
13353 ;;
10bc17b6
JH
13354*) getpwnam_r_proto=0
13355 ;;
13356esac
13357
13358: see if getpwuid_r exists
13359set getpwuid_r d_getpwuid_r
13360eval $inlibc
13361case "$d_getpwuid_r" in
13362"$define")
13363 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13364 case "$d_getpwuid_r_proto:$usethreads" in
13365 ":define") d_getpwuid_r_proto=define
a48ec845
JH
13366 set d_getpwuid_r_proto getpwuid_r $hdrs
13367 eval $hasproto ;;
13368 *) ;;
13369 esac
13370 case "$d_getpwuid_r_proto" in
13371 define)
10bc17b6
JH
13372 case "$getpwuid_r_proto" in
13373 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13374 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13375 esac
13376 case "$getpwuid_r_proto" in
13377 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13378 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13379 esac
13380 case "$getpwuid_r_proto" in
13381 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13382 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13383 esac
13384 case "$getpwuid_r_proto" in
13385 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13386 ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13387 esac
13388 case "$getpwuid_r_proto" in
90e831dc 13389 ''|0) d_getpwuid_r=undef
10bc17b6 13390 getpwuid_r_proto=0
a48ec845 13391 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13392 * ) case "$getpwuid_r_proto" in
13393 REENTRANT_PROTO*) ;;
13394 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13395 esac
13396 echo "Prototype: $try" ;;
13397 esac
13398 ;;
c18e646a
JH
13399 *) case "$usethreads" in
13400 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13401 esac
90e831dc
SB
13402 d_getpwuid_r=undef
13403 getpwuid_r_proto=0
c18e646a 13404 ;;
a48ec845
JH
13405 esac
13406 ;;
10bc17b6
JH
13407*) getpwuid_r_proto=0
13408 ;;
13409esac
13410
b4eb6b3d
JH
13411
13412: see if getservbyname exists
13413set getservbyname d_getsbyname
13414eval $inlibc
13415
13416: see if getservbyport exists
13417set getservbyport d_getsbyport
13418eval $inlibc
13419
13420: see if getservent exists
13421set getservent d_getsent
13422eval $inlibc
13423
10bc17b6
JH
13424: see if getservbyname_r exists
13425set getservbyname_r d_getservbyname_r
13426eval $inlibc
13427case "$d_getservbyname_r" in
13428"$define")
13429 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13430 case "$d_getservbyname_r_proto:$usethreads" in
13431 ":define") d_getservbyname_r_proto=define
a48ec845
JH
13432 set d_getservbyname_r_proto getservbyname_r $hdrs
13433 eval $hasproto ;;
13434 *) ;;
13435 esac
13436 case "$d_getservbyname_r_proto" in
13437 define)
10bc17b6
JH
13438 case "$getservbyname_r_proto" in
13439 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13440 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13441 esac
13442 case "$getservbyname_r_proto" in
13443 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13444 ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13445 esac
13446 case "$getservbyname_r_proto" in
13447 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13448 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13449 esac
13450 case "$getservbyname_r_proto" in
90e831dc 13451 ''|0) d_getservbyname_r=undef
10bc17b6 13452 getservbyname_r_proto=0
a48ec845 13453 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13454 * ) case "$getservbyname_r_proto" in
13455 REENTRANT_PROTO*) ;;
13456 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13457 esac
13458 echo "Prototype: $try" ;;
13459 esac
13460 ;;
c18e646a
JH
13461 *) case "$usethreads" in
13462 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13463 esac
90e831dc
SB
13464 d_getservbyname_r=undef
13465 getservbyname_r_proto=0
c18e646a 13466 ;;
a48ec845
JH
13467 esac
13468 ;;
10bc17b6
JH
13469*) getservbyname_r_proto=0
13470 ;;
13471esac
13472
13473: see if getservbyport_r exists
13474set getservbyport_r d_getservbyport_r
13475eval $inlibc
13476case "$d_getservbyport_r" in
13477"$define")
13478 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13479 case "$d_getservbyport_r_proto:$usethreads" in
13480 ":define") d_getservbyport_r_proto=define
a48ec845
JH
13481 set d_getservbyport_r_proto getservbyport_r $hdrs
13482 eval $hasproto ;;
13483 *) ;;
13484 esac
13485 case "$d_getservbyport_r_proto" in
13486 define)
10bc17b6
JH
13487 case "$getservbyport_r_proto" in
13488 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13489 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13490 esac
13491 case "$getservbyport_r_proto" in
13492 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13493 ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13494 esac
13495 case "$getservbyport_r_proto" in
13496 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13497 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13498 esac
13499 case "$getservbyport_r_proto" in
90e831dc 13500 ''|0) d_getservbyport_r=undef
10bc17b6 13501 getservbyport_r_proto=0
a48ec845 13502 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13503 * ) case "$getservbyport_r_proto" in
13504 REENTRANT_PROTO*) ;;
13505 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13506 esac
13507 echo "Prototype: $try" ;;
13508 esac
13509 ;;
c18e646a
JH
13510 *) case "$usethreads" in
13511 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13512 esac
90e831dc
SB
13513 d_getservbyport_r=undef
13514 getservbyport_r_proto=0
c18e646a 13515 ;;
a48ec845
JH
13516 esac
13517 ;;
10bc17b6
JH
13518*) getservbyport_r_proto=0
13519 ;;
13520esac
13521
13522: see if getservent_r exists
13523set getservent_r d_getservent_r
13524eval $inlibc
13525case "$d_getservent_r" in
13526"$define")
13527 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13528 case "$d_getservent_r_proto:$usethreads" in
13529 ":define") d_getservent_r_proto=define
a48ec845
JH
13530 set d_getservent_r_proto getservent_r $hdrs
13531 eval $hasproto ;;
13532 *) ;;
13533 esac
13534 case "$d_getservent_r_proto" in
13535 define)
10bc17b6
JH
13536 case "$getservent_r_proto" in
13537 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13538 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13539 esac
13540 case "$getservent_r_proto" in
13541 ''|0) try='int getservent_r(struct servent*, char*, int);'
13542 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13543 esac
13544 case "$getservent_r_proto" in
13545 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13546 ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13547 esac
13548 case "$getservent_r_proto" in
13549 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13550 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13551 esac
13552 case "$getservent_r_proto" in
90e831dc 13553 ''|0) d_getservent_r=undef
10bc17b6 13554 getservent_r_proto=0
a48ec845 13555 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13556 * ) case "$getservent_r_proto" in
13557 REENTRANT_PROTO*) ;;
13558 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13559 esac
13560 echo "Prototype: $try" ;;
13561 esac
13562 ;;
c18e646a
JH
13563 *) case "$usethreads" in
13564 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13565 esac
90e831dc
SB
13566 d_getservent_r=undef
13567 getservent_r_proto=0
c18e646a 13568 ;;
a48ec845
JH
13569 esac
13570 ;;
10bc17b6
JH
13571*) getservent_r_proto=0
13572 ;;
13573esac
13574
b4eb6b3d
JH
13575: see if prototypes for various getservxxx netdb.h functions are available
13576echo " "
13577set d_getservprotos getservent $i_netdb netdb.h
13578eval $hasproto
13579
13580: see if getspnam exists
13581set getspnam d_getspnam
13582eval $inlibc
13583
10bc17b6
JH
13584: see if this is a shadow.h system
13585set shadow.h i_shadow
13586eval $inhdr
13587
13588: see if getspnam_r exists
13589set getspnam_r d_getspnam_r
13590eval $inlibc
13591case "$d_getspnam_r" in
13592"$define")
13593 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
13594 case "$d_getspnam_r_proto:$usethreads" in
13595 ":define") d_getspnam_r_proto=define
a48ec845
JH
13596 set d_getspnam_r_proto getspnam_r $hdrs
13597 eval $hasproto ;;
13598 *) ;;
13599 esac
13600 case "$d_getspnam_r_proto" in
13601 define)
10bc17b6
JH
13602 case "$getspnam_r_proto" in
13603 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13604 ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13605 esac
13606 case "$getspnam_r_proto" in
13607 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13608 ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13609 esac
13610 case "$getspnam_r_proto" in
90e831dc 13611 ''|0) d_getspnam_r=undef
10bc17b6 13612 getspnam_r_proto=0
a48ec845 13613 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13614 * ) case "$getspnam_r_proto" in
13615 REENTRANT_PROTO*) ;;
13616 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13617 esac
13618 echo "Prototype: $try" ;;
13619 esac
13620 ;;
c18e646a
JH
13621 *) case "$usethreads" in
13622 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13623 esac
90e831dc
SB
13624 d_getspnam_r=undef
13625 getspnam_r_proto=0
c18e646a 13626 ;;
a48ec845
JH
13627 esac
13628 ;;
10bc17b6
JH
13629*) getspnam_r_proto=0
13630 ;;
13631esac
13632
b4eb6b3d
JH
13633: see if gettimeofday or ftime exists
13634set gettimeofday d_gettimeod
13635eval $inlibc
13636case "$d_gettimeod" in
13637"$undef")
13638 set ftime d_ftime
13639 eval $inlibc
13640 ;;
13641*)
13642 val="$undef"; set d_ftime; eval $setvar
13643 ;;
13644esac
13645case "$d_gettimeod$d_ftime" in
13646"$undef$undef")
13647 echo " "
13648 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13649 ;;
13650esac
13651
10bc17b6
JH
13652: see if gmtime_r exists
13653set gmtime_r d_gmtime_r
13654eval $inlibc
13655case "$d_gmtime_r" in
13656"$define")
d63eadf0 13657 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
13658 case "$d_gmtime_r_proto:$usethreads" in
13659 ":define") d_gmtime_r_proto=define
a48ec845
JH
13660 set d_gmtime_r_proto gmtime_r $hdrs
13661 eval $hasproto ;;
13662 *) ;;
13663 esac
13664 case "$d_gmtime_r_proto" in
13665 define)
10bc17b6
JH
13666 case "$gmtime_r_proto" in
13667 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13668 ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13669 esac
13670 case "$gmtime_r_proto" in
13671 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13672 ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13673 esac
13674 case "$gmtime_r_proto" in
90e831dc 13675 ''|0) d_gmtime_r=undef
10bc17b6 13676 gmtime_r_proto=0
a48ec845 13677 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13678 * ) case "$gmtime_r_proto" in
13679 REENTRANT_PROTO*) ;;
13680 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13681 esac
13682 echo "Prototype: $try" ;;
13683 esac
b4eb6b3d 13684 ;;
c18e646a
JH
13685 *) case "$usethreads" in
13686 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13687 esac
90e831dc
SB
13688 d_gmtime_r=undef
13689 gmtime_r_proto=0
c18e646a 13690 ;;
a48ec845
JH
13691 esac
13692 ;;
10bc17b6 13693*) gmtime_r_proto=0
b4eb6b3d
JH
13694 ;;
13695esac
13696
13697: see if hasmntopt exists
13698set hasmntopt d_hasmntopt
13699eval $inlibc
13700
13701: see if this is a netinet/in.h or sys/in.h system
13702set netinet/in.h i_niin sys/in.h i_sysin
13703eval $inhdr
13704
13705: see if arpa/inet.h has to be included
13706set arpa/inet.h i_arpainet
13707eval $inhdr
13708
13709: see if htonl --and friends-- exists
13710val=''
13711set htonl val
13712eval $inlibc
13713
13714: Maybe they are macros.
13715case "$val" in
13716$undef)
13717 $cat >htonl.c <<EOM
13718#include <stdio.h>
13719#include <sys/types.h>
13720#$i_niin I_NETINET_IN
13721#$i_sysin I_SYS_IN
13722#$i_arpainet I_ARPA_INET
13723#ifdef I_NETINET_IN
13724#include <netinet/in.h>
13725#endif
13726#ifdef I_SYS_IN
13727#include <sys/in.h>
13728#endif
13729#ifdef I_ARPA_INET
13730#include <arpa/inet.h>
13731#endif
13732#ifdef htonl
13733printf("Defined as a macro.");
13734#endif
13735EOM
13736 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13737 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13738 val="$define"
13739 echo "But it seems to be defined as a macro." >&4
13740 fi
13741 $rm -f htonl.?
13742 ;;
13743esac
13744set d_htonl
13745eval $setvar
13746
36adc09b
JH
13747: see if ilogbl exists
13748set ilogbl d_ilogbl
13749eval $inlibc
13750
b4eb6b3d
JH
13751: index or strchr
13752echo " "
13753if set index val -f; eval $csym; $val; then
13754 if set strchr val -f d_strchr; eval $csym; $val; then
13755 if $contains strchr "$strings" >/dev/null 2>&1 ; then
13756 val="$define"
13757 vali="$undef"
13758 echo "strchr() found." >&4
13759 else
13760 val="$undef"
13761 vali="$define"
13762 echo "index() found." >&4
13763 fi
13764 else
13765 val="$undef"
13766 vali="$define"
8dfa8df9
JH
13767 echo "index() found." >&4
13768 fi
b4eb6b3d 13769else
8dfa8df9
JH
13770 if set strchr val -f d_strchr; eval $csym; $val; then
13771 val="$define"
13772 vali="$undef"
13773 echo "strchr() found." >&4
13774 else
13775 echo "No index() or strchr() found!" >&4
13776 val="$undef"
13777 vali="$undef"
13778 fi
b4eb6b3d 13779fi
8dfa8df9
JH
13780set d_strchr; eval $setvar
13781val="$vali"
13782set d_index; eval $setvar
13783
13784: check whether inet_aton exists
13785set inet_aton d_inetaton
13786eval $inlibc
b4eb6b3d
JH
13787
13788: Look for isascii
13789echo " "
36adc09b 13790$cat >isascii.c <<EOCP
b4eb6b3d
JH
13791#include <stdio.h>
13792#include <ctype.h>
55954f19
JH
13793#$i_stdlib I_STDLIB
13794#ifdef I_STDLIB
13795#include <stdlib.h>
13796#endif
b4eb6b3d
JH
13797int main() {
13798 int c = 'A';
13799 if (isascii(c))
13800 exit(0);
13801 else
13802 exit(1);
13803}
13804EOCP
13805set isascii
13806if eval $compile; then
13807 echo "isascii() found." >&4
13808 val="$define"
13809else
13810 echo "isascii() NOT found." >&4
13811 val="$undef"
13812fi
13813set d_isascii
13814eval $setvar
13815$rm -f isascii*
13816
758a5d79
JH
13817: see if isfinite exists
13818set isfinite d_isfinite
13819eval $inlibc
13820
13821: see if isinf exists
13822set isinf d_isinf
13823eval $inlibc
13824
b4eb6b3d
JH
13825: see if isnan exists
13826set isnan d_isnan
13827eval $inlibc
13828
13829: see if isnanl exists
13830set isnanl d_isnanl
13831eval $inlibc
13832
13833: see if killpg exists
13834set killpg d_killpg
13835eval $inlibc
13836
13837: see if lchown exists
13838echo " "
13839$cat > try.c <<'EOCP'
13840/* System header to define __stub macros and hopefully few prototypes,
13841 which can conflict with char lchown(); below. */
13842#include <assert.h>
13843/* Override any gcc2 internal prototype to avoid an error. */
13844/* We use char because int might match the return type of a gcc2
13845 builtin and then its argument prototype would still apply. */
13846char lchown();
13847int main() {
13848 /* The GNU C library defines this for functions which it implements
13849 to always fail with ENOSYS. Some functions are actually named
13850 something starting with __ and the normal name is an alias. */
13851#if defined (__stub_lchown) || defined (__stub___lchown)
13852choke me
13853#else
13854lchown();
13855#endif
13856; return 0; }
13857EOCP
13858set try
13859if eval $compile; then
13860 $echo "lchown() found." >&4
13861 val="$define"
13862else
13863 $echo "lchown() NOT found." >&4
13864 val="$undef"
13865fi
13866set d_lchown
13867eval $setvar
13868
13869: See if number of significant digits in a double precision number is known
13870echo " "
13871$cat >ldbl_dig.c <<EOM
13872#$i_limits I_LIMITS
13873#$i_float I_FLOAT
13874#ifdef I_LIMITS
13875#include <limits.h>
13876#endif
13877#ifdef I_FLOAT
13878#include <float.h>
13879#endif
13880#ifdef LDBL_DIG
13881printf("Contains LDBL_DIG");
13882#endif
13883EOM
13884$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13885if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13886 echo "LDBL_DIG found." >&4
13887 val="$define"
13888else
13889 echo "LDBL_DIG NOT found." >&4
13890 val="$undef"
13891fi
13892$rm -f ldbl_dig.?
13893set d_ldbl_dig
13894eval $setvar
13895
13896: see if link exists
13897set link d_link
13898eval $inlibc
13899
10bc17b6
JH
13900: see if localtime_r exists
13901set localtime_r d_localtime_r
13902eval $inlibc
13903case "$d_localtime_r" in
13904"$define")
d63eadf0 13905 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
13906 case "$d_localtime_r_proto:$usethreads" in
13907 ":define") d_localtime_r_proto=define
a48ec845
JH
13908 set d_localtime_r_proto localtime_r $hdrs
13909 eval $hasproto ;;
13910 *) ;;
13911 esac
13912 case "$d_localtime_r_proto" in
13913 define)
10bc17b6
JH
13914 case "$localtime_r_proto" in
13915 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13916 ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13917 esac
13918 case "$localtime_r_proto" in
13919 ''|0) try='int localtime_r(const time_t*, struct tm*);'
13920 ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13921 esac
13922 case "$localtime_r_proto" in
90e831dc 13923 ''|0) d_localtime_r=undef
10bc17b6 13924 localtime_r_proto=0
a48ec845 13925 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13926 * ) case "$localtime_r_proto" in
13927 REENTRANT_PROTO*) ;;
13928 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13929 esac
13930 echo "Prototype: $try" ;;
13931 esac
13932 ;;
c18e646a
JH
13933 *) case "$usethreads" in
13934 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13935 esac
90e831dc
SB
13936 d_localtime_r=undef
13937 localtime_r_proto=0
c18e646a 13938 ;;
a48ec845
JH
13939 esac
13940 ;;
10bc17b6
JH
13941*) localtime_r_proto=0
13942 ;;
13943esac
13944
b4eb6b3d
JH
13945: see if localeconv exists
13946set localeconv d_locconv
13947eval $inlibc
13948
13949: see if lockf exists
13950set lockf d_lockf
13951eval $inlibc
13952
b4eb6b3d
JH
13953: see if prototype for lseek is available
13954echo " "
4786929f 13955set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
13956eval $hasproto
13957
13958: see if lstat exists
13959set lstat d_lstat
13960eval $inlibc
13961
13962: see if madvise exists
13963set madvise d_madvise
13964eval $inlibc
13965
13966: see if mblen exists
13967set mblen d_mblen
13968eval $inlibc
13969
13970: see if mbstowcs exists
13971set mbstowcs d_mbstowcs
13972eval $inlibc
13973
13974: see if mbtowc exists
13975set mbtowc d_mbtowc
13976eval $inlibc
13977
13978: see if memchr exists
13979set memchr d_memchr
13980eval $inlibc
13981
13982: see if memcmp exists
13983set memcmp d_memcmp
13984eval $inlibc
13985
13986: see if memcpy exists
13987set memcpy d_memcpy
13988eval $inlibc
13989
13990: see if memmove exists
13991set memmove d_memmove
13992eval $inlibc
13993
13994: see if memset exists
13995set memset d_memset
13996eval $inlibc
13997
13998: see if mkdir exists
13999set mkdir d_mkdir
14000eval $inlibc
14001
14002: see if mkdtemp exists
14003set mkdtemp d_mkdtemp
14004eval $inlibc
14005
14006: see if mkfifo exists
14007set mkfifo d_mkfifo
14008eval $inlibc
14009
14010: see if mkstemp exists
14011set mkstemp d_mkstemp
14012eval $inlibc
14013
14014: see if mkstemps exists
14015set mkstemps d_mkstemps
14016eval $inlibc
14017
14018: see if mktime exists
14019set mktime d_mktime
14020eval $inlibc
14021
14022: see if this is a sys/mman.h system
14023set sys/mman.h i_sysmman
14024eval $inhdr
14025
14026: see if mmap exists
14027set mmap d_mmap
14028eval $inlibc
14029: see what shmat returns
14030: default to something harmless
14031mmaptype='void *'
14032case "$i_sysmman$d_mmap" in
14033"$define$define")
14034 $cat >mmap.c <<'END'
14035#include <sys/mman.h>
14036void *mmap();
14037END
14038 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14039 mmaptype='void *'
14040 else
14041 mmaptype='caddr_t'
14042 fi
14043 echo "and it returns ($mmaptype)." >&4
14044 ;;
14045esac
14046
14047
14048
89ce900e
JH
14049: see if sqrtl exists
14050set sqrtl d_sqrtl
14051eval $inlibc
14052
af1ff193
JH
14053: see if scalbnl exists
14054set scalbnl d_scalbnl
14055eval $inlibc
14056
89ce900e
JH
14057: see if modfl exists
14058set modfl d_modfl
14059eval $inlibc
14060
14061: see if prototype for modfl is available
14062echo " "
14063set d_modflproto modfl math.h
14064eval $hasproto
14065
14066d_modfl_pow32_bug="$undef"
14067
14068case "$d_longdbl$d_modfl" in
14069$define$define)
14070 $cat <<EOM
14071Checking to see whether your modfl() is okay for large values...
14072EOM
14073$cat >try.c <<EOCP
14074#include <math.h>
14075#include <stdio.h>
14076EOCP
14077if $test "X$d_modflproto" != "X$define"; then
14078 $cat >>try.c <<EOCP
14079/* Sigh. many current glibcs provide the function, but do not prototype it. */
14080long double modfl (long double, long double *);
14081EOCP
14082fi
14083$cat >>try.c <<EOCP
14084int main() {
14085 long double nv = 4294967303.15;
14086 long double v, w;
14087 v = modfl(nv, &w);
14088#ifdef __GLIBC__
14089 printf("glibc");
14090#endif
14091 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14092 return 0;
14093}
14094EOCP
14095 case "$osname:$gccversion" in
14096 aix:) saveccflags="$ccflags"
14097 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14098 esac
14099 set try
14100 if eval $compile; then
14101 foo=`$run ./try`
14102 case "$foo" in
14103 *" 4294967303.150000 1.150000 4294967302.000000")
14104 echo >&4 "Your modfl() is broken for large values."
14105 d_modfl_pow32_bug="$define"
14106 case "$foo" in
14107 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14108 ;;
14109 esac
14110 ;;
14111 *" 4294967303.150000 0.150000 4294967303.000000")
14112 echo >&4 "Your modfl() seems okay for large values."
14113 ;;
14114 *) echo >&4 "I don't understand your modfl() at all."
14115 d_modfl="$undef"
14116 ;;
14117 esac
14118 $rm -f try.* try core core.try.*
14119 else
14120 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14121 d_modfl="$undef"
14122 fi
14123 case "$osname:$gccversion" in
14124 aix:) ccflags="$saveccflags" ;; # restore
14125 esac
14126 ;;
14127esac
14128
14129if $test "$uselongdouble" = "$define"; then
af1ff193
JH
14130 message=""
14131 if $test "$d_sqrtl" != "$define"; then
14132 message="$message sqrtl"
14133 fi
14134 if $test "$d_modfl" != "$define"; then
89ce900e
JH
14135 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14136 echo "You have both aintl and copysignl, so I can emulate modfl."
14137 else
af1ff193 14138 message="$message modfl"
89ce900e 14139 fi
af1ff193
JH
14140 fi
14141 if $test "$d_frexpl" != "$define"; then
14142 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14143 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14144 else
14145 message="$message frexpl"
14146 fi
14147 fi
89ce900e 14148
af1ff193 14149 if $test "$message" != ""; then
89ce900e
JH
14150 $cat <<EOM >&4
14151
14152*** You requested the use of long doubles but you do not seem to have
af1ff193
JH
14153*** the following mathematical functions needed for long double support:
14154*** $message
fe63a0b4
JH
14155*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14156*** Cannot continue, aborting.
89ce900e
JH
14157
14158EOM
14159
fe63a0b4 14160 exit 1
89ce900e
JH
14161 fi
14162fi
14163
b4eb6b3d
JH
14164: see if mprotect exists
14165set mprotect d_mprotect
14166eval $inlibc
14167
14168: see if msgctl exists
14169set msgctl d_msgctl
14170eval $inlibc
14171
14172: see if msgget exists
14173set msgget d_msgget
14174eval $inlibc
14175
14176: see if msgsnd exists
14177set msgsnd d_msgsnd
14178eval $inlibc
14179
14180: see if msgrcv exists
14181set msgrcv d_msgrcv
14182eval $inlibc
14183
14184: see how much of the 'msg*(2)' library is present.
14185h_msg=true
14186echo " "
14187case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14188*"$undef"*) h_msg=false;;
14189esac
14190case "$osname" in
14191freebsd)
14192 case "`ipcs 2>&1`" in
14193 "SVID messages"*"not configured"*)
14194 echo "Your $osname does not have the msg*(2) configured." >&4
14195 h_msg=false
14196 val="$undef"
14197 set msgctl d_msgctl
14198 eval $setvar
14199 set msgget d_msgget
14200 eval $setvar
14201 set msgsnd d_msgsnd
14202 eval $setvar
14203 set msgrcv d_msgrcv
14204 eval $setvar
14205 ;;
14206 esac
14207 ;;
14208esac
14209: we could also check for sys/ipc.h ...
14210if $h_msg && $test `./findhdr sys/msg.h`; then
14211 echo "You have the full msg*(2) library." >&4
14212 val="$define"
14213else
14214 echo "You don't have the full msg*(2) library." >&4
14215 val="$undef"
14216fi
14217set d_msg
14218eval $setvar
14219
4e0554ec
JH
14220
14221echo " "
14222echo "Checking to see if your system supports struct msghdr..." >&4
14223set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14224eval $hasstruct
14225case "$d_msghdr_s" in
14226"$define") echo "Yes, it does." ;;
14227*) echo "No, it doesn't." ;;
14228esac
14229
14230
b4eb6b3d
JH
14231: see if msync exists
14232set msync d_msync
14233eval $inlibc
14234
14235: see if munmap exists
14236set munmap d_munmap
14237eval $inlibc
14238
14239: see if nice exists
14240set nice d_nice
14241eval $inlibc
14242
2765b840
JH
14243: see if this is a langinfo.h system
14244set langinfo.h i_langinfo
14245eval $inhdr
14246
14247: see if nl_langinfo exists
14248set nl_langinfo d_nl_langinfo
14249eval $inlibc
14250
b4eb6b3d
JH
14251: check for length of character
14252echo " "
14253case "$charsize" in
14254'')
14255 echo "Checking to see how big your characters are (hey, you never know)..." >&4
74d00865 14256 $cat >try.c <<EOCP
b4eb6b3d 14257#include <stdio.h>
d1daaddf
JH
14258#$i_stdlib I_STDLIB
14259#ifdef I_STDLIB
14260#include <stdlib.h>
14261#endif
b4eb6b3d
JH
14262int main()
14263{
14264 printf("%d\n", (int)sizeof(char));
14265 exit(0);
14266}
14267EOCP
14268 set try
14269 if eval $compile_ok; then
5440bc8e 14270 dflt=`$run ./try`
b4eb6b3d
JH
14271 else
14272 dflt='1'
14273 echo "(I can't seem to compile the test program. Guessing...)"
14274 fi
14275 ;;
14276*)
14277 dflt="$charsize"
14278 ;;
14279esac
14280rp="What is the size of a character (in bytes)?"
14281. ./myread
14282charsize="$ans"
14283$rm -f try.c try
14284
1d1be0dc
NC
14285: check for volatile keyword
14286echo " "
14287echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14288$cat >try.c <<'EOCP'
76f47787 14289int main()
1d1be0dc
NC
14290{
14291 typedef struct _goo_struct goo_struct;
14292 goo_struct * volatile goo = ((goo_struct *)0);
14293 struct _goo_struct {
14294 long long_int;
14295 int reg_int;
14296 char char_var;
14297 };
14298 typedef unsigned short foo_t;
14299 char *volatile foo;
14300 volatile int bar;
14301 volatile foo_t blech;
14302 foo = foo;
14303}
14304EOCP
14305if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14306 val="$define"
14307 echo "Yup, it does."
14308else
14309 val="$undef"
14310 echo "Nope, it doesn't."
14311fi
14312set d_volatile
14313eval $setvar
14314$rm -f try.*
14315
b4eb6b3d
JH
14316
14317echo " "
14318$echo "Choosing the C types to be used for Perl's internal types..." >&4
14319
14320case "$use64bitint:$d_quad:$quadtype" in
14321define:define:?*)
14322 ivtype="$quadtype"
14323 uvtype="$uquadtype"
14324 ivsize=8
14325 uvsize=8
14326 ;;
14327*) ivtype="long"
14328 uvtype="unsigned long"
14329 ivsize=$longsize
14330 uvsize=$longsize
14331 ;;
14332esac
14333
14334case "$uselongdouble:$d_longdbl" in
14335define:define)
14336 nvtype="long double"
14337 nvsize=$longdblsize
14338 ;;
14339*) nvtype=double
14340 nvsize=$doublesize
14341 ;;
14342esac
14343
14344$echo "(IV will be "$ivtype", $ivsize bytes)"
14345$echo "(UV will be "$uvtype", $uvsize bytes)"
14346$echo "(NV will be "$nvtype", $nvsize bytes)"
14347
14348$cat >try.c <<EOCP
14349#$i_inttypes I_INTTYPES
14350#ifdef I_INTTYPES
14351#include <inttypes.h>
14352#endif
14353#include <stdio.h>
14354int main() {
14355#ifdef INT8
14356 int8_t i = INT8_MAX;
14357 uint8_t u = UINT8_MAX;
14358 printf("int8_t\n");
14359#endif
14360#ifdef INT16
14361 int16_t i = INT16_MAX;
14362 uint16_t i = UINT16_MAX;
14363 printf("int16_t\n");
14364#endif
14365#ifdef INT32
14366 int32_t i = INT32_MAX;
14367 uint32_t u = UINT32_MAX;
14368 printf("int32_t\n");
14369#endif
14370}
14371EOCP
14372
14373case "$i8type" in
14374'') case "$charsize" in
14375 1) i8type=char
14376 u8type="unsigned char"
14377 i8size=$charsize
14378 u8size=$charsize
14379 ;;
14380 esac
14381 ;;
14382esac
14383case "$i8type" in
14384'') set try -DINT8
14385 if eval $compile; then
5440bc8e 14386 case "`$run ./try`" in
b4eb6b3d
JH
14387 int8_t) i8type=int8_t
14388 u8type=uint8_t
14389 i8size=1
14390 u8size=1
14391 ;;
14392 esac
14393 fi
14394 ;;
14395esac
14396case "$i8type" in
14397'') if $test $charsize -ge 1; then
14398 i8type=char
14399 u8type="unsigned char"
14400 i8size=$charsize
14401 u8size=$charsize
14402 fi
14403 ;;
14404esac
14405
14406case "$i16type" in
14407'') case "$shortsize" in
14408 2) i16type=short
14409 u16type="unsigned short"
14410 i16size=$shortsize
14411 u16size=$shortsize
14412 ;;
14413 esac
14414 ;;
14415esac
14416case "$i16type" in
14417'') set try -DINT16
14418 if eval $compile; then
5440bc8e 14419 case "`$run ./try`" in
b4eb6b3d
JH
14420 int16_t)
14421 i16type=int16_t
14422 u16type=uint16_t
14423 i16size=2
14424 u16size=2
14425 ;;
14426 esac
14427 fi
14428 ;;
14429esac
14430case "$i16type" in
14431'') if $test $shortsize -ge 2; then
14432 i16type=short
14433 u16type="unsigned short"
14434 i16size=$shortsize
14435 u16size=$shortsize
14436 fi
14437 ;;
14438esac
14439
14440case "$i32type" in
14441'') case "$longsize" in
14442 4) i32type=long
14443 u32type="unsigned long"
14444 i32size=$longsize
14445 u32size=$longsize
14446 ;;
14447 *) case "$intsize" in
14448 4) i32type=int
14449 u32type="unsigned int"
14450 i32size=$intsize
14451 u32size=$intsize
14452 ;;
14453 esac
14454 ;;
14455 esac
14456 ;;
14457esac
14458case "$i32type" in
14459'') set try -DINT32
14460 if eval $compile; then
5440bc8e 14461 case "`$run ./try`" in
b4eb6b3d
JH
14462 int32_t)
14463 i32type=int32_t
14464 u32type=uint32_t
14465 i32size=4
14466 u32size=4
14467 ;;
14468 esac
14469 fi
14470 ;;
14471esac
14472case "$i32type" in
14473'') if $test $intsize -ge 4; then
14474 i32type=int
14475 u32type="unsigned int"
14476 i32size=$intsize
14477 u32size=$intsize
14478 fi
14479 ;;
14480esac
14481
14482case "$i64type" in
14483'') case "$d_quad:$quadtype" in
14484 define:?*)
14485 i64type="$quadtype"
14486 u64type="$uquadtype"
14487 i64size=8
14488 u64size=8
14489 ;;
14490 esac
14491 ;;
14492esac
14493
1d1be0dc
NC
14494$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14495: volatile so that the compiler has to store it out to memory.
14496if test X"$d_volatile" = X"$define"; then
14497 volatile=volatile
14498fi
b4eb6b3d
JH
14499$cat <<EOP >try.c
14500#include <stdio.h>
55954f19
JH
14501#$i_stdlib I_STDLIB
14502#ifdef I_STDLIB
14503#include <stdlib.h>
14504#endif
1d1be0dc
NC
14505#include <sys/types.h>
14506#include <signal.h>
14507#ifdef SIGFPE
14508$volatile int bletched = 0;
14509$signal_t blech(s) int s; { bletched = 1; }
14510#endif
b4eb6b3d
JH
14511int main() {
14512 $uvtype u = 0;
1d1be0dc 14513 $nvtype d;
b4eb6b3d
JH
14514 int n = 8 * $uvsize;
14515 int i;
1d1be0dc
NC
14516#ifdef SIGFPE
14517 signal(SIGFPE, blech);
14518#endif
14519
b4eb6b3d
JH
14520 for (i = 0; i < n; i++) {
14521 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
14522 d = ($nvtype)u;
14523 if (($uvtype)d != u)
b4eb6b3d 14524 break;
1d1be0dc
NC
14525 if (d <= 0)
14526 break;
14527 d = ($nvtype)(u - 1);
14528 if (($uvtype)d != (u - 1))
14529 break;
14530#ifdef SIGFPE
14531 if (bletched) {
14532 break;
14533#endif
14534 }
b4eb6b3d 14535 }
efd1522b 14536 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
14537 exit(0);
14538}
14539EOP
1d1be0dc
NC
14540set try
14541
14542d_nv_preserves_uv="$undef"
14543if eval $compile; then
53133ed1 14544 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 14545fi
53133ed1 14546case "$nv_preserves_uv_bits" in
1d1be0dc 14547\-[1-9]*)
53133ed1
NC
14548 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14549 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 14550 d_nv_preserves_uv="$define"
b4eb6b3d 14551 ;;
53133ed1 14552[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
14553 d_nv_preserves_uv="$undef" ;;
14554*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
53133ed1 14555 nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
14556esac
14557
1d1be0dc
NC
14558$rm -f try.* try
14559
b4eb6b3d
JH
14560
14561: check for off64_t
14562echo " "
14563echo "Checking to see if you have off64_t..." >&4
14564$cat >try.c <<EOCP
14565#include <sys/types.h>
14566#include <unistd.h>
14567int main() { off64_t x = 7; }
14568EOCP
14569set try
14570if eval $compile; then
14571 val="$define"
14572 echo "You have off64_t."
14573else
14574 val="$undef"
14575 echo "You do not have off64_t."
14576 case "$lseeksize" in
14577 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
14578 esac
14579fi
14580$rm -f try.* try
14581set d_off64_t
14582eval $setvar
14583
b4eb6b3d
JH
14584: how to create joinable pthreads
14585if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
14586 echo " "
14587 echo "Checking what constant to use for creating joinable pthreads..." >&4
14588 $cat >try.c <<'EOCP'
14589#include <pthread.h>
14590int main() {
14591 int detachstate = JOINABLE;
14592}
14593EOCP
14594 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
14595 if eval $compile; then
14596 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
14597 val="$undef" # Yes, undef.
14598 set d_old_pthread_create_joinable
14599 eval $setvar
14600 val=""
14601 set old_pthread_create_joinable
14602 eval $setvar
14603 else
14604 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
14605 if eval $compile; then
14606 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
14607 val="$define"
14608 set d_old_pthread_create_joinable
14609 eval $setvar
14610 val=PTHREAD_CREATE_UNDETACHED
14611 set old_pthread_create_joinable
14612 eval $setvar
14613 else
14614 set try -DJOINABLE=__UNDETACHED
14615 if eval $compile; then
14616 echo "You seem to use __UNDETACHED." >&4
14617 val="$define"
14618 set d_old_pthread_create_joinable
14619 eval $setvar
14620 val=__UNDETACHED
14621 set old_pthread_create_joinable
14622 eval $setvar
14623 else
14624 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
14625 val="$define"
14626 set d_old_pthread_create_joinable
14627 eval $setvar
14628 val=0
14629 set old_pthread_create_joinable
14630 eval $setvar
14631 fi
14632 fi
14633 fi
14634 $rm -f try try.*
14635else
14636 d_old_pthread_create_joinable="$undef"
14637 old_pthread_create_joinable=""
14638fi
14639
14640: see if pause exists
14641set pause d_pause
14642eval $inlibc
14643
14644: see if pipe exists
14645set pipe d_pipe
14646eval $inlibc
14647
14648: see if poll exists
14649set poll d_poll
14650eval $inlibc
14651
c7aff470
NIS
14652: see if readlink exists
14653set readlink d_readlink
14654eval $inlibc
14655
14656echo " "
f24dbf84 14657procselfexe=''
c7aff470 14658val="$undef"
a33c94aa
JH
14659case "$d_readlink" in
14660"$define")
c7aff470
NIS
14661 if $issymlink /proc/self/exe ; then
14662 $ls -l /proc/self/exe > reflect
51660ed5 14663 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 14664 echo "You have Linux-like /proc/self/exe."
92236451 14665 procselfexe='"/proc/self/exe"'
f24dbf84 14666 val="$define"
f24dbf84
JH
14667 fi
14668 fi
14669 if $issymlink /proc/curproc/file ; then
14670 $ls -l /proc/curproc/file > reflect
14671 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14672 echo "You have BSD-like /proc/curproc/file."
92236451 14673 procselfexe='"/proc/curproc/file"'
f24dbf84 14674 val="$define"
c7aff470 14675 fi
c7aff470 14676 fi
a33c94aa
JH
14677 ;;
14678esac
428dc699 14679$rm -f reflect
c7aff470
NIS
14680set d_procselfexe
14681eval $setvar
14682
263fee3f
JH
14683: see whether the pthread_atfork exists
14684$cat >try.c <<EOP
14685#include <pthread.h>
14686#include <stdio.h>
14687int main() {
14688#ifdef PTHREAD_ATFORK
14689 pthread_atfork(NULL,NULL,NULL);
14690#endif
14691}
14692EOP
14693
d6483fcc 14694: see if pthread_atfork exists
263fee3f
JH
14695set try -DPTHREAD_ATFORK
14696if eval $compile; then
14697 val="$define"
14698else
14699 val="$undef"
14700fi
14701case "$usethreads" in
14702$define)
14703 case "$val" in
14704 $define) echo 'pthread_atfork found.' >&4 ;;
14705 *) echo 'pthread_atfork NOT found.' >&4 ;;
14706 esac
14707esac
14708set d_pthread_atfork
14709eval $setvar
d6483fcc 14710
58d975c3
JH
14711: see if pthread_attr_setscope exists
14712set pthread_attr_setscope d_pthread_attr_setscope
14713eval $inlibc
14714
b4eb6b3d
JH
14715
14716: see whether the various POSIXish _yields exist
14717$cat >try.c <<EOP
14718#include <pthread.h>
14719#include <stdio.h>
14720int main() {
14721#ifdef SCHED_YIELD
14722 sched_yield();
14723#else
14724#ifdef PTHREAD_YIELD
14725 pthread_yield();
14726#else
14727#ifdef PTHREAD_YIELD_NULL
14728 pthread_yield(NULL);
14729#endif
14730#endif
14731#endif
14732}
14733EOP
14734: see if sched_yield exists
14735set try -DSCHED_YIELD
14736if eval $compile; then
14737 val="$define"
14738 sched_yield='sched_yield()'
14739else
14740 val="$undef"
14741fi
14742case "$usethreads" in
14743$define)
14744 case "$val" in
14745 $define) echo 'sched_yield() found.' >&4 ;;
14746 *) echo 'sched_yield() NOT found.' >&4 ;;
14747 esac
14748esac
10bc17b6
JH
14749set d_sched_yield
14750eval $setvar
b4eb6b3d 14751
10bc17b6
JH
14752: see if pthread_yield exists
14753set try -DPTHREAD_YIELD
14754if eval $compile; then
14755 val="$define"
14756 case "$sched_yield" in
14757 '') sched_yield='pthread_yield()' ;;
14758 esac
14759else
14760 set try -DPTHREAD_YIELD_NULL
14761 if eval $compile; then
14762 val="$define"
14763 case "$sched_yield" in
14764 '') sched_yield='pthread_yield(NULL)' ;;
14765 esac
14766 else
14767 val="$undef"
14768 fi
14769fi
14770case "$usethreads" in
14771$define)
14772 case "$val" in
14773 $define) echo 'pthread_yield() found.' >&4 ;;
14774 *) echo 'pthread_yield() NOT found.' >&4 ;;
14775 esac
14776 ;;
14777esac
14778set d_pthread_yield
14779eval $setvar
b4eb6b3d 14780
10bc17b6
JH
14781case "$sched_yield" in
14782'') sched_yield=undef ;;
14783esac
b4eb6b3d 14784
10bc17b6
JH
14785$rm -f try try.*
14786
14787: see if random_r exists
14788set random_r d_random_r
14789eval $inlibc
14790case "$d_random_r" in
14791"$define")
14792 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
14793 case "$d_random_r_proto:$usethreads" in
14794 ":define") d_random_r_proto=define
a48ec845
JH
14795 set d_random_r_proto random_r $hdrs
14796 eval $hasproto ;;
14797 *) ;;
14798 esac
14799 case "$d_random_r_proto" in
14800 define)
10bc17b6
JH
14801 case "$random_r_proto" in
14802 ''|0) try='int random_r(int*, struct random_data*);'
a845a0d4
JH
14803 ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
14804 esac
14805 case "$random_r_proto" in
14806 ''|0) try='int random_r(long*, struct random_data*);'
14807 ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
14808 esac
14809 case "$random_r_proto" in
14810 ''|0) try='int random_r(struct random_data*, int32_t*);'
14811 ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
14812 esac
14813 case "$random_r_proto" in
90e831dc 14814 ''|0) d_random_r=undef
10bc17b6 14815 random_r_proto=0
a48ec845 14816 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14817 * ) case "$random_r_proto" in
14818 REENTRANT_PROTO*) ;;
14819 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
14820 esac
14821 echo "Prototype: $try" ;;
14822 esac
b4eb6b3d 14823 ;;
c18e646a
JH
14824 *) case "$usethreads" in
14825 define) echo "random_r has no prototype, not using it." >&4 ;;
14826 esac
90e831dc
SB
14827 d_random_r=undef
14828 random_r_proto=0
c18e646a 14829 ;;
a48ec845
JH
14830 esac
14831 ;;
10bc17b6 14832*) random_r_proto=0
b4eb6b3d
JH
14833 ;;
14834esac
14835
14836: see if readdir and friends exist
14837set readdir d_readdir
14838eval $inlibc
14839set seekdir d_seekdir
14840eval $inlibc
14841set telldir d_telldir
14842eval $inlibc
14843set rewinddir d_rewinddir
14844eval $inlibc
14845
10bc17b6
JH
14846: see if readdir64_r exists
14847set readdir64_r d_readdir64_r
14848eval $inlibc
14849case "$d_readdir64_r" in
14850"$define")
14851 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
14852 case "$d_readdir64_r_proto:$usethreads" in
14853 ":define") d_readdir64_r_proto=define
a48ec845
JH
14854 set d_readdir64_r_proto readdir64_r $hdrs
14855 eval $hasproto ;;
14856 *) ;;
14857 esac
14858 case "$d_readdir64_r_proto" in
14859 define)
10bc17b6
JH
14860 case "$readdir64_r_proto" in
14861 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
14862 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
14863 esac
14864 case "$readdir64_r_proto" in
14865 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
14866 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
14867 esac
14868 case "$readdir64_r_proto" in
90e831dc 14869 ''|0) d_readdir64_r=undef
10bc17b6 14870 readdir64_r_proto=0
a48ec845 14871 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14872 * ) case "$readdir64_r_proto" in
14873 REENTRANT_PROTO*) ;;
14874 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
14875 esac
14876 echo "Prototype: $try" ;;
14877 esac
14878 ;;
c18e646a
JH
14879 *) case "$usethreads" in
14880 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
14881 esac
90e831dc
SB
14882 d_readdir64_r=undef
14883 readdir64_r_proto=0
c18e646a 14884 ;;
a48ec845
JH
14885 esac
14886 ;;
10bc17b6
JH
14887*) readdir64_r_proto=0
14888 ;;
14889esac
14890
14891: see if readdir_r exists
14892set readdir_r d_readdir_r
14893eval $inlibc
14894case "$d_readdir_r" in
14895"$define")
14896 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
14897 case "$d_readdir_r_proto:$usethreads" in
14898 ":define") d_readdir_r_proto=define
a48ec845
JH
14899 set d_readdir_r_proto readdir_r $hdrs
14900 eval $hasproto ;;
14901 *) ;;
14902 esac
14903 case "$d_readdir_r_proto" in
14904 define)
10bc17b6
JH
14905 case "$readdir_r_proto" in
14906 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14907 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14908 esac
14909 case "$readdir_r_proto" in
14910 ''|0) try='int readdir_r(DIR*, struct dirent*);'
14911 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
14912 esac
14913 case "$readdir_r_proto" in
90e831dc 14914 ''|0) d_readdir_r=undef
10bc17b6 14915 readdir_r_proto=0
a48ec845 14916 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14917 * ) case "$readdir_r_proto" in
14918 REENTRANT_PROTO*) ;;
14919 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
14920 esac
14921 echo "Prototype: $try" ;;
14922 esac
14923 ;;
c18e646a
JH
14924 *) case "$usethreads" in
14925 define) echo "readdir_r has no prototype, not using it." >&4 ;;
14926 esac
90e831dc
SB
14927 d_readdir_r=undef
14928 readdir_r_proto=0
c18e646a 14929 ;;
a48ec845
JH
14930 esac
14931 ;;
10bc17b6
JH
14932*) readdir_r_proto=0
14933 ;;
14934esac
14935
4e0554ec
JH
14936: see if readv exists
14937set readv d_readv
14938eval $inlibc
14939
14940: see if recvmsg exists
14941set recvmsg d_recvmsg
14942eval $inlibc
14943
b4eb6b3d
JH
14944: see if rename exists
14945set rename d_rename
14946eval $inlibc
14947
14948: see if rmdir exists
14949set rmdir d_rmdir
14950eval $inlibc
14951
14952: see if memory.h is available.
14953val=''
14954set memory.h val
14955eval $inhdr
14956
14957: See if it conflicts with string.h
14958case "$val" in
14959$define)
14960 case "$strings" in
14961 '') ;;
14962 *)
14963 $cppstdin $cppflags $cppminus < $strings > mem.h
14964 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14965 echo " "
14966 echo "We won't be including <memory.h>."
14967 val="$undef"
14968 fi
14969 $rm -f mem.h
14970 ;;
14971 esac
14972esac
14973set i_memory
14974eval $setvar
14975
14976: can bcopy handle overlapping blocks?
b6cc3bc4 14977echo " "
b4eb6b3d 14978val="$undef"
b6cc3bc4
AD
14979case "$d_memmove" in
14980"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14981*) case "$d_bcopy" in
14982 "$define")
14983 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14984 $cat >try.c <<EOCP
b4eb6b3d
JH
14985#$i_memory I_MEMORY
14986#$i_stdlib I_STDLIB
14987#$i_string I_STRING
14988#$i_unistd I_UNISTD
14989EOCP
14990 $cat >>try.c <<'EOCP'
14991#include <stdio.h>
14992#ifdef I_MEMORY
14993# include <memory.h>
14994#endif
14995#ifdef I_STDLIB
14996# include <stdlib.h>
14997#endif
14998#ifdef I_STRING
14999# include <string.h>
15000#else
15001# include <strings.h>
15002#endif
15003#ifdef I_UNISTD
15004# include <unistd.h> /* Needed for NetBSD */
15005#endif
15006int main()
15007{
15008char buf[128], abc[128];
15009char *b;
15010int len;
15011int off;
15012int align;
15013
b6cc3bc4
AD
15014/* Copy "abcde..." string to char abc[] so that gcc doesn't
15015 try to store the string in read-only memory. */
b4eb6b3d
JH
15016bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15017
15018for (align = 7; align >= 0; align--) {
15019 for (len = 36; len; len--) {
15020 b = buf+align;
15021 bcopy(abc, b, len);
15022 for (off = 1; off <= len; off++) {
15023 bcopy(b, b+off, len);
15024 bcopy(b+off, b, len);
15025 if (bcmp(b, abc, len))
15026 exit(1);
15027 }
15028 }
15029}
15030exit(0);
15031}
15032EOCP
b6cc3bc4
AD
15033 set try
15034 if eval $compile_ok; then
15035 if ./try 2>/dev/null; then
15036 echo "Yes, it can."
15037 val="$define"
15038 else
15039 echo "It can't, sorry."
15040 fi
b4eb6b3d 15041 else
b6cc3bc4 15042 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15043 fi
b6cc3bc4
AD
15044 ;;
15045 esac
15046 $rm -f try.* try core
b4eb6b3d
JH
15047 ;;
15048esac
b4eb6b3d
JH
15049set d_safebcpy
15050eval $setvar
15051
15052: can memcpy handle overlapping blocks?
b6cc3bc4 15053echo " "
b4eb6b3d 15054val="$undef"
b6cc3bc4
AD
15055case "$d_memmove" in
15056"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15057*) case "$d_memcpy" in
15058 "$define")
15059 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15060 $cat >try.c <<EOCP
b4eb6b3d
JH
15061#$i_memory I_MEMORY
15062#$i_stdlib I_STDLIB
15063#$i_string I_STRING
15064#$i_unistd I_UNISTD
15065EOCP
15066 $cat >>try.c <<'EOCP'
15067#include <stdio.h>
15068#ifdef I_MEMORY
15069# include <memory.h>
15070#endif
15071#ifdef I_STDLIB
15072# include <stdlib.h>
15073#endif
15074#ifdef I_STRING
15075# include <string.h>
15076#else
15077# include <strings.h>
15078#endif
15079#ifdef I_UNISTD
15080# include <unistd.h> /* Needed for NetBSD */
15081#endif
15082int main()
15083{
15084char buf[128], abc[128];
15085char *b;
15086int len;
15087int off;
15088int align;
15089
15090/* Copy "abcde..." string to char abc[] so that gcc doesn't
15091 try to store the string in read-only memory. */
15092memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15093
15094for (align = 7; align >= 0; align--) {
15095 for (len = 36; len; len--) {
15096 b = buf+align;
15097 memcpy(b, abc, len);
15098 for (off = 1; off <= len; off++) {
15099 memcpy(b+off, b, len);
15100 memcpy(b, b+off, len);
15101 if (memcmp(b, abc, len))
15102 exit(1);
15103 }
15104 }
15105}
15106exit(0);
15107}
15108EOCP
b6cc3bc4
AD
15109 set try
15110 if eval $compile_ok; then
15111 if ./try 2>/dev/null; then
15112 echo "Yes, it can."
15113 val="$define"
15114 else
15115 echo "It can't, sorry."
15116 fi
b4eb6b3d 15117 else
b6cc3bc4 15118 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15119 fi
b6cc3bc4
AD
15120 ;;
15121 esac
15122 $rm -f try.* try core
b4eb6b3d
JH
15123 ;;
15124esac
b4eb6b3d
JH
15125set d_safemcpy
15126eval $setvar
15127
15128: can memcmp be trusted to compare relative magnitude?
15129val="$undef"
15130case "$d_memcmp" in
15131"$define")
15132 echo " "
15133 echo "Checking if your memcmp() can compare relative magnitude..." >&4
15134 $cat >try.c <<EOCP
15135#$i_memory I_MEMORY
15136#$i_stdlib I_STDLIB
15137#$i_string I_STRING
15138#$i_unistd I_UNISTD
15139EOCP
15140 $cat >>try.c <<'EOCP'
15141#include <stdio.h>
15142#ifdef I_MEMORY
15143# include <memory.h>
15144#endif
15145#ifdef I_STDLIB
36adc09b 15146# include <stdlib.h>
b4eb6b3d
JH
15147#endif
15148#ifdef I_STRING
15149# include <string.h>
15150#else
15151# include <strings.h>
15152#endif
15153#ifdef I_UNISTD
15154# include <unistd.h> /* Needed for NetBSD */
15155#endif
15156int main()
15157{
15158char a = -1;
15159char b = 0;
15160if ((a < b) && memcmp(&a, &b, 1) < 0)
15161 exit(1);
15162exit(0);
15163}
15164EOCP
15165 set try
15166 if eval $compile_ok; then
5440bc8e 15167 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
15168 echo "Yes, it can."
15169 val="$define"
15170 else
15171 echo "No, it can't (it uses signed chars)."
15172 fi
15173 else
15174 echo "(I can't compile the test program, so we'll assume not...)"
15175 fi
15176 ;;
15177esac
15178$rm -f try.* try core
15179set d_sanemcmp
15180eval $setvar
15181
ef9f17be
JH
15182: see if prototype for sbrk is available
15183echo " "
15184set d_sbrkproto sbrk $i_unistd unistd.h
15185eval $hasproto
15186
b4eb6b3d
JH
15187: see if select exists
15188set select d_select
15189eval $inlibc
15190
15191: see if semctl exists
15192set semctl d_semctl
15193eval $inlibc
15194
15195: see if semget exists
15196set semget d_semget
15197eval $inlibc
15198
15199: see if semop exists
15200set semop d_semop
15201eval $inlibc
15202
15203: see how much of the 'sem*(2)' library is present.
15204h_sem=true
15205echo " "
15206case "$d_semctl$d_semget$d_semop" in
15207*"$undef"*) h_sem=false;;
15208esac
15209case "$osname" in
15210freebsd)
15211 case "`ipcs 2>&1`" in
15212 "SVID messages"*"not configured"*)
15213 echo "Your $osname does not have the sem*(2) configured." >&4
15214 h_sem=false
15215 val="$undef"
15216 set semctl d_semctl
15217 eval $setvar
15218 set semget d_semget
15219 eval $setvar
15220 set semop d_semop
15221 eval $setvar
15222 ;;
15223 esac
15224 ;;
15225esac
15226: we could also check for sys/ipc.h ...
15227if $h_sem && $test `./findhdr sys/sem.h`; then
15228 echo "You have the full sem*(2) library." >&4
15229 val="$define"
15230else
15231 echo "You don't have the full sem*(2) library." >&4
15232 val="$undef"
15233fi
15234set d_sem
15235eval $setvar
15236
15237: see whether sys/sem.h defines union semun
15238echo " "
15239$cat > try.c <<'END'
15240#include <sys/types.h>
15241#include <sys/ipc.h>
15242#include <sys/sem.h>
15243int main () { union semun semun; semun.buf = 0; }
15244END
15245set try
15246if eval $compile; then
15247 echo "You have union semun in <sys/sem.h>." >&4
15248 val="$define"
15249else
15250 echo "You do not have union semun in <sys/sem.h>." >&4
15251 val="$undef"
15252fi
15253$rm -f try try.c try.h
15254set d_union_semun
15255eval $setvar
15256
15257: see how to do semctl IPC_STAT
15258case "$d_sem" in
15259$define)
15260 : see whether semctl IPC_STAT can use union semun
15261 echo " "
15262 $cat > try.h <<END
15263#ifndef S_IRUSR
15264# ifdef S_IREAD
15265# define S_IRUSR S_IREAD
15266# define S_IWUSR S_IWRITE
15267# define S_IXUSR S_IEXEC
15268# else
15269# define S_IRUSR 0400
15270# define S_IWUSR 0200
15271# define S_IXUSR 0100
15272# endif
15273# define S_IRGRP (S_IRUSR>>3)
15274# define S_IWGRP (S_IWUSR>>3)
15275# define S_IXGRP (S_IXUSR>>3)
15276# define S_IROTH (S_IRUSR>>6)
15277# define S_IWOTH (S_IWUSR>>6)
15278# define S_IXOTH (S_IXUSR>>6)
15279#endif
15280#ifndef S_IRWXU
15281# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15282# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15283# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15284#endif
15285END
15286
15287 $cat > try.c <<END
15288#include <sys/types.h>
15289#include <sys/ipc.h>
15290#include <sys/sem.h>
15291#include <sys/stat.h>
15292#include <stdio.h>
15293#include <errno.h>
15294#include "try.h"
15295#ifndef errno
15296extern int errno;
15297#endif
15298#$d_union_semun HAS_UNION_SEMUN
15299int main() {
15300 union semun
15301#ifndef HAS_UNION_SEMUN
15302 {
15303 int val;
15304 struct semid_ds *buf;
15305 unsigned short *array;
15306 }
15307#endif
15308 arg;
15309 int sem, st;
15310
15311#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15312 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15313 if (sem > -1) {
15314 struct semid_ds argbuf;
15315 arg.buf = &argbuf;
15316# ifdef IPC_STAT
15317 st = semctl(sem, 0, IPC_STAT, arg);
15318 if (st == 0)
15319 printf("semun\n");
15320 else
15321# endif /* IPC_STAT */
15322 printf("semctl IPC_STAT failed: errno = %d\n", errno);
15323# ifdef IPC_RMID
15324 if (semctl(sem, 0, IPC_RMID, arg) != 0)
15325# endif /* IPC_RMID */
15326 printf("semctl IPC_RMID failed: errno = %d\n", errno);
15327 } else
15328#endif /* IPC_PRIVATE && ... */
15329 printf("semget failed: errno = %d\n", errno);
15330 return 0;
15331}
15332END
15333 val="$undef"
15334 set try
15335 if eval $compile; then
5440bc8e 15336 xxx=`$run ./try`
b4eb6b3d
JH
15337 case "$xxx" in
15338 semun) val="$define" ;;
15339 esac
15340 fi
15341 $rm -f try try.c
15342 set d_semctl_semun
15343 eval $setvar
15344 case "$d_semctl_semun" in
15345 $define)
15346 echo "You can use union semun for semctl IPC_STAT." >&4
15347 also='also'
15348 ;;
15349 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
15350 also=''
15351 ;;
15352 esac
15353
15354 : see whether semctl IPC_STAT can use struct semid_ds pointer
15355 $cat > try.c <<'END'
15356#include <sys/types.h>
15357#include <sys/ipc.h>
15358#include <sys/sem.h>
15359#include <sys/stat.h>
15360#include "try.h"
15361#include <stdio.h>
15362#include <errno.h>
15363#ifndef errno
15364extern int errno;
15365#endif
15366int main() {
15367 struct semid_ds arg;
15368 int sem, st;
15369
15370#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15371 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15372 if (sem > -1) {
15373# ifdef IPC_STAT
15374 st = semctl(sem, 0, IPC_STAT, &arg);
15375 if (st == 0)
15376 printf("semid_ds\n");
15377 else
15378# endif /* IPC_STAT */
15379 printf("semctl IPC_STAT failed: errno = %d\n", errno);
15380# ifdef IPC_RMID
15381 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15382# endif /* IPC_RMID */
15383 printf("semctl IPC_RMID failed: errno = %d\n", errno);
15384 } else
15385#endif /* IPC_PRIVATE && ... */
15386 printf("semget failed: errno = %d\n", errno);
15387
15388 return 0;
15389}
15390END
15391 val="$undef"
15392 set try
15393 if eval $compile; then
5440bc8e 15394 xxx=`$run ./try`
b4eb6b3d
JH
15395 case "$xxx" in
15396 semid_ds) val="$define" ;;
15397 esac
15398 fi
15399 $rm -f try try.c
15400 set d_semctl_semid_ds
15401 eval $setvar
15402 case "$d_semctl_semid_ds" in
15403 $define)
15404 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15405 ;;
15406 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15407 ;;
15408 esac
15409 $rm -f try.h
15410 ;;
15411*) val="$undef"
15412
15413 # We do not have the full sem*(2) library, so assume we can not
15414 # use either.
15415
15416 set d_semctl_semun
15417 eval $setvar
15418
15419 set d_semctl_semid_ds
15420 eval $setvar
15421 ;;
15422esac
15423
4e0554ec
JH
15424: see if sendmsg exists
15425set sendmsg d_sendmsg
15426eval $inlibc
15427
b4eb6b3d
JH
15428: see if setegid exists
15429set setegid d_setegid
15430eval $inlibc
15431
15432: see if seteuid exists
15433set seteuid d_seteuid
15434eval $inlibc
15435
15436: see if setgrent exists
15437set setgrent d_setgrent
15438eval $inlibc
15439
10bc17b6
JH
15440: see if setgrent_r exists
15441set setgrent_r d_setgrent_r
15442eval $inlibc
15443case "$d_setgrent_r" in
15444"$define")
15445 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
15446 case "$d_setgrent_r_proto:$usethreads" in
15447 ":define") d_setgrent_r_proto=define
a48ec845
JH
15448 set d_setgrent_r_proto setgrent_r $hdrs
15449 eval $hasproto ;;
15450 *) ;;
15451 esac
15452 case "$d_setgrent_r_proto" in
15453 define)
10bc17b6
JH
15454 case "$setgrent_r_proto" in
15455 ''|0) try='int setgrent_r(FILE**);'
15456 ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15457 esac
15458 case "$setgrent_r_proto" in
15459 ''|0) try='void setgrent_r(FILE**);'
15460 ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15461 esac
15462 case "$setgrent_r_proto" in
90e831dc 15463 ''|0) d_setgrent_r=undef
10bc17b6 15464 setgrent_r_proto=0
a48ec845 15465 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15466 * ) case "$setgrent_r_proto" in
15467 REENTRANT_PROTO*) ;;
15468 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15469 esac
15470 echo "Prototype: $try" ;;
15471 esac
15472 ;;
c18e646a
JH
15473 *) case "$usethreads" in
15474 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15475 esac
90e831dc
SB
15476 d_setgrent_r=undef
15477 setgrent_r_proto=0
c18e646a 15478 ;;
a48ec845
JH
15479 esac
15480 ;;
10bc17b6
JH
15481*) setgrent_r_proto=0
15482 ;;
15483esac
15484
b4eb6b3d
JH
15485: see if sethostent exists
15486set sethostent d_sethent
15487eval $inlibc
15488
10bc17b6
JH
15489: see if sethostent_r exists
15490set sethostent_r d_sethostent_r
15491eval $inlibc
15492case "$d_sethostent_r" in
15493"$define")
15494 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
15495 case "$d_sethostent_r_proto:$usethreads" in
15496 ":define") d_sethostent_r_proto=define
a48ec845
JH
15497 set d_sethostent_r_proto sethostent_r $hdrs
15498 eval $hasproto ;;
15499 *) ;;
15500 esac
15501 case "$d_sethostent_r_proto" in
15502 define)
10bc17b6
JH
15503 case "$sethostent_r_proto" in
15504 ''|0) try='int sethostent_r(int, struct hostent_data*);'
15505 ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15506 esac
15507 case "$sethostent_r_proto" in
15508 ''|0) try='void sethostent_r(int, struct hostent_data*);'
15509 ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15510 esac
15511 case "$sethostent_r_proto" in
90e831dc 15512 ''|0) d_sethostent_r=undef
10bc17b6 15513 sethostent_r_proto=0
a48ec845 15514 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15515 * ) case "$sethostent_r_proto" in
15516 REENTRANT_PROTO*) ;;
15517 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15518 esac
15519 echo "Prototype: $try" ;;
15520 esac
15521 ;;
c18e646a
JH
15522 *) case "$usethreads" in
15523 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15524 esac
90e831dc
SB
15525 d_sethostent_r=undef
15526 sethostent_r_proto=0
c18e646a 15527 ;;
a48ec845
JH
15528 esac
15529 ;;
10bc17b6
JH
15530*) sethostent_r_proto=0
15531 ;;
15532esac
15533
4e0554ec
JH
15534: see if setitimer exists
15535set setitimer d_setitimer
15536eval $inlibc
15537
b4eb6b3d
JH
15538: see if setlinebuf exists
15539set setlinebuf d_setlinebuf
15540eval $inlibc
15541
15542: see if setlocale exists
15543set setlocale d_setlocale
15544eval $inlibc
15545
10bc17b6
JH
15546: see if locale.h is available
15547set locale.h i_locale
15548eval $inhdr
15549
15550: see if setlocale_r exists
15551set setlocale_r d_setlocale_r
15552eval $inlibc
15553case "$d_setlocale_r" in
15554"$define")
15555 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
15556 case "$d_setlocale_r_proto:$usethreads" in
15557 ":define") d_setlocale_r_proto=define
a48ec845
JH
15558 set d_setlocale_r_proto setlocale_r $hdrs
15559 eval $hasproto ;;
15560 *) ;;
15561 esac
15562 case "$d_setlocale_r_proto" in
15563 define)
10bc17b6
JH
15564 case "$setlocale_r_proto" in
15565 ''|0) try='int setlocale_r(int, const char*, char*, int);'
15566 ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
15567 esac
15568 case "$setlocale_r_proto" in
90e831dc 15569 ''|0) d_setlocale_r=undef
10bc17b6 15570 setlocale_r_proto=0
a48ec845 15571 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15572 * ) case "$setlocale_r_proto" in
15573 REENTRANT_PROTO*) ;;
15574 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
15575 esac
15576 echo "Prototype: $try" ;;
15577 esac
15578 ;;
c18e646a
JH
15579 *) case "$usethreads" in
15580 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
15581 esac
90e831dc
SB
15582 d_setlocale_r=undef
15583 setlocale_r_proto=0
c18e646a 15584 ;;
a48ec845
JH
15585 esac
15586 ;;
10bc17b6
JH
15587*) setlocale_r_proto=0
15588 ;;
15589esac
15590
b4eb6b3d
JH
15591: see if setnetent exists
15592set setnetent d_setnent
15593eval $inlibc
15594
10bc17b6
JH
15595: see if setnetent_r exists
15596set setnetent_r d_setnetent_r
15597eval $inlibc
15598case "$d_setnetent_r" in
15599"$define")
15600 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
15601 case "$d_setnetent_r_proto:$usethreads" in
15602 ":define") d_setnetent_r_proto=define
a48ec845
JH
15603 set d_setnetent_r_proto setnetent_r $hdrs
15604 eval $hasproto ;;
15605 *) ;;
15606 esac
15607 case "$d_setnetent_r_proto" in
15608 define)
10bc17b6
JH
15609 case "$setnetent_r_proto" in
15610 ''|0) try='int setnetent_r(int, struct netent_data*);'
15611 ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
15612 esac
15613 case "$setnetent_r_proto" in
15614 ''|0) try='void setnetent_r(int, struct netent_data*);'
15615 ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
15616 esac
15617 case "$setnetent_r_proto" in
90e831dc 15618 ''|0) d_setnetent_r=undef
10bc17b6 15619 setnetent_r_proto=0
a48ec845 15620 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15621 * ) case "$setnetent_r_proto" in
15622 REENTRANT_PROTO*) ;;
15623 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
15624 esac
15625 echo "Prototype: $try" ;;
15626 esac
15627 ;;
c18e646a
JH
15628 *) case "$usethreads" in
15629 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
15630 esac
90e831dc
SB
15631 d_setnetent_r=undef
15632 setnetent_r_proto=0
c18e646a 15633 ;;
a48ec845
JH
15634 esac
15635 ;;
10bc17b6
JH
15636*) setnetent_r_proto=0
15637 ;;
15638esac
15639
b4eb6b3d
JH
15640: see if setprotoent exists
15641set setprotoent d_setpent
15642eval $inlibc
15643
15644: see if setpgid exists
15645set setpgid d_setpgid
15646eval $inlibc
15647
15648: see if setpgrp2 exists
15649set setpgrp2 d_setpgrp2
15650eval $inlibc
15651
15652: see if setpriority exists
15653set setpriority d_setprior
15654eval $inlibc
15655
15656: see if setproctitle exists
15657set setproctitle d_setproctitle
15658eval $inlibc
15659
10bc17b6
JH
15660: see if setprotoent_r exists
15661set setprotoent_r d_setprotoent_r
15662eval $inlibc
15663case "$d_setprotoent_r" in
15664"$define")
15665 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
15666 case "$d_setprotoent_r_proto:$usethreads" in
15667 ":define") d_setprotoent_r_proto=define
a48ec845
JH
15668 set d_setprotoent_r_proto setprotoent_r $hdrs
15669 eval $hasproto ;;
15670 *) ;;
15671 esac
15672 case "$d_setprotoent_r_proto" in
15673 define)
10bc17b6
JH
15674 case "$setprotoent_r_proto" in
15675 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
15676 ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
15677 esac
15678 case "$setprotoent_r_proto" in
15679 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
15680 ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
15681 esac
15682 case "$setprotoent_r_proto" in
90e831dc 15683 ''|0) d_setprotoent_r=undef
10bc17b6 15684 setprotoent_r_proto=0
a48ec845 15685 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15686 * ) case "$setprotoent_r_proto" in
15687 REENTRANT_PROTO*) ;;
15688 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
15689 esac
15690 echo "Prototype: $try" ;;
15691 esac
15692 ;;
c18e646a
JH
15693 *) case "$usethreads" in
15694 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
15695 esac
90e831dc
SB
15696 d_setprotoent_r=undef
15697 setprotoent_r_proto=0
c18e646a 15698 ;;
a48ec845
JH
15699 esac
15700 ;;
10bc17b6
JH
15701*) setprotoent_r_proto=0
15702 ;;
15703esac
15704
b4eb6b3d
JH
15705: see if setpwent exists
15706set setpwent d_setpwent
15707eval $inlibc
15708
10bc17b6
JH
15709: see if setpwent_r exists
15710set setpwent_r d_setpwent_r
15711eval $inlibc
15712case "$d_setpwent_r" in
15713"$define")
15714 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
15715 case "$d_setpwent_r_proto:$usethreads" in
15716 ":define") d_setpwent_r_proto=define
a48ec845
JH
15717 set d_setpwent_r_proto setpwent_r $hdrs
15718 eval $hasproto ;;
15719 *) ;;
15720 esac
15721 case "$d_setpwent_r_proto" in
15722 define)
10bc17b6
JH
15723 case "$setpwent_r_proto" in
15724 ''|0) try='int setpwent_r(FILE**);'
15725 ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
15726 esac
15727 case "$setpwent_r_proto" in
15728 ''|0) try='void setpwent_r(FILE**);'
15729 ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
15730 esac
15731 case "$setpwent_r_proto" in
90e831dc 15732 ''|0) d_setpwent_r=undef
10bc17b6 15733 setpwent_r_proto=0
a48ec845 15734 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15735 * ) case "$setpwent_r_proto" in
15736 REENTRANT_PROTO*) ;;
15737 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
15738 esac
15739 echo "Prototype: $try" ;;
15740 esac
15741 ;;
c18e646a
JH
15742 *) case "$usethreads" in
15743 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
15744 esac
90e831dc
SB
15745 d_setpwent_r=undef
15746 setpwent_r_proto=0
c18e646a 15747 ;;
a48ec845
JH
15748 esac
15749 ;;
10bc17b6
JH
15750*) setpwent_r_proto=0
15751 ;;
15752esac
15753
b4eb6b3d
JH
15754: see if setregid exists
15755set setregid d_setregid
15756eval $inlibc
15757set setresgid d_setresgid
15758eval $inlibc
15759
15760: see if setreuid exists
15761set setreuid d_setreuid
15762eval $inlibc
15763set setresuid d_setresuid
15764eval $inlibc
15765
15766: see if setrgid exists
15767set setrgid d_setrgid
15768eval $inlibc
15769
15770: see if setruid exists
15771set setruid d_setruid
15772eval $inlibc
15773
15774: see if setservent exists
15775set setservent d_setsent
15776eval $inlibc
15777
10bc17b6
JH
15778: see if setservent_r exists
15779set setservent_r d_setservent_r
15780eval $inlibc
15781case "$d_setservent_r" in
15782"$define")
15783 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
15784 case "$d_setservent_r_proto:$usethreads" in
15785 ":define") d_setservent_r_proto=define
a48ec845
JH
15786 set d_setservent_r_proto setservent_r $hdrs
15787 eval $hasproto ;;
15788 *) ;;
15789 esac
15790 case "$d_setservent_r_proto" in
15791 define)
10bc17b6
JH
15792 case "$setservent_r_proto" in
15793 ''|0) try='int setservent_r(int, struct servent_data*);'
15794 ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
15795 esac
15796 case "$setservent_r_proto" in
15797 ''|0) try='void setservent_r(int, struct servent_data*);'
15798 ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
15799 esac
15800 case "$setservent_r_proto" in
90e831dc 15801 ''|0) d_setservent_r=undef
10bc17b6 15802 setservent_r_proto=0
a48ec845 15803 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15804 * ) case "$setservent_r_proto" in
15805 REENTRANT_PROTO*) ;;
15806 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
15807 esac
15808 echo "Prototype: $try" ;;
15809 esac
15810 ;;
c18e646a
JH
15811 *) case "$usethreads" in
15812 define) echo "setservent_r has no prototype, not using it." >&4 ;;
15813 esac
90e831dc
SB
15814 d_setservent_r=undef
15815 setservent_r_proto=0
c18e646a 15816 ;;
a48ec845
JH
15817 esac
15818 ;;
10bc17b6
JH
15819*) setservent_r_proto=0
15820 ;;
15821esac
15822
b4eb6b3d
JH
15823: see if setsid exists
15824set setsid d_setsid
15825eval $inlibc
15826
15827: see if setvbuf exists
15828set setvbuf d_setvbuf
15829eval $inlibc
15830
15831: see if sfio.h is available
15832set sfio.h i_sfio
15833eval $inhdr
15834
15835
15836: see if sfio library is available
15837case "$i_sfio" in
15838$define)
15839 val=''
15840 set sfreserve val
15841 eval $inlibc
15842 ;;
15843*)
15844 val="$undef"
15845 ;;
15846esac
15847: Ok, but do we want to use it.
15848case "$val" in
15849$define)
15850 case "$usesfio" in
15851 true|$define|[yY]*) dflt='y';;
15852 *) dflt='n';;
15853 esac
15854 echo "$package can use the sfio library, but it is experimental."
15855 case "$useperlio" in
15856 "$undef")
15857 echo "For sfio also the PerlIO abstraction layer is needed."
15858 echo "Earlier you said you wouldn't want that."
15859 ;;
15860 esac
15861 rp="You seem to have sfio available, do you want to try using it?"
15862 . ./myread
15863 case "$ans" in
15864 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
15865 useperlio="$define"
15866 val="$define"
15867 ;;
15868 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
15869 val="$undef"
b4eb6b3d
JH
15870 ;;
15871 esac
15872 ;;
15873*) case "$usesfio" in
15874 true|$define|[yY]*)
15875 echo "Sorry, cannot find sfio on this machine." >&4
15876 echo "Ignoring your setting of usesfio=$usesfio." >&4
15877 val="$undef"
15878 ;;
15879 esac
15880 ;;
15881esac
15882set d_sfio
15883eval $setvar
15884case "$d_sfio" in
15885$define) usesfio='true';;
15886*) usesfio='false';;
15887esac
3659ebf1
JH
15888case "$d_sfio" in
15889$define) ;;
15890*) : Remove sfio from list of libraries to use
7483f793
JH
15891 case "$libs" in
15892 *-lsfio*)
15893 echo "Removing unneeded -lsfio from library list" >&4
15894 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
15895 shift
15896 libs="$*"
15897 echo "libs = $libs" >&4
15898 ;;
15899 esac
3659ebf1
JH
15900;;
15901esac
15902
b4eb6b3d
JH
15903
15904: see if shmctl exists
15905set shmctl d_shmctl
15906eval $inlibc
15907
15908: see if shmget exists
15909set shmget d_shmget
15910eval $inlibc
15911
15912: see if shmat exists
15913set shmat d_shmat
15914eval $inlibc
15915: see what shmat returns
15916case "$d_shmat" in
15917"$define")
15918 $cat >shmat.c <<'END'
15919#include <sys/shm.h>
15920void *shmat();
15921END
15922 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15923 shmattype='void *'
15924 else
15925 shmattype='char *'
15926 fi
15927 echo "and it returns ($shmattype)." >&4
15928 : see if a prototype for shmat is available
15929 xxx=`./findhdr sys/shm.h`
15930 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15931 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15932 val="$define"
15933 else
15934 val="$undef"
15935 fi
15936 $rm -f shmat.[co]
15937 ;;
15938*)
15939 val="$undef"
15940 ;;
15941esac
15942set d_shmatprototype
15943eval $setvar
15944
15945: see if shmdt exists
15946set shmdt d_shmdt
15947eval $inlibc
15948
15949: see how much of the 'shm*(2)' library is present.
15950h_shm=true
15951echo " "
15952case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15953*"$undef"*) h_shm=false;;
15954esac
15955case "$osname" in
15956freebsd)
15957 case "`ipcs 2>&1`" in
15958 "SVID shared memory"*"not configured"*)
15959 echo "Your $osname does not have the shm*(2) configured." >&4
15960 h_shm=false
15961 val="$undef"
15962 set shmctl d_shmctl
15963 evat $setvar
15964 set shmget d_shmget
15965 evat $setvar
15966 set shmat d_shmat
15967 evat $setvar
15968 set shmdt d_shmdt
15969 evat $setvar
15970 ;;
15971 esac
15972 ;;
15973esac
15974: we could also check for sys/ipc.h ...
15975if $h_shm && $test `./findhdr sys/shm.h`; then
15976 echo "You have the full shm*(2) library." >&4
15977 val="$define"
15978else
15979 echo "You don't have the full shm*(2) library." >&4
15980 val="$undef"
15981fi
15982set d_shm
15983eval $setvar
15984
15985echo " "
15986: see if we have sigaction
15987if set sigaction val -f d_sigaction; eval $csym; $val; then
15988 echo 'sigaction() found.' >&4
073b6de5 15989 $cat > try.c <<EOP
b4eb6b3d
JH
15990#include <stdio.h>
15991#include <sys/types.h>
15992#include <signal.h>
073b6de5
JH
15993#$i_stdlib I_STDLIB
15994#ifdef I_STDLIB
15995#include <stdlib.h>
15996#endif
b4eb6b3d
JH
15997int main()
15998{
15999 struct sigaction act, oact;
16000 act.sa_flags = 0;
16001 oact.sa_handler = 0;
16002 /* so that act and oact are used */
16003 exit(act.sa_flags == 0 && oact.sa_handler == 0);
16004}
16005EOP
16006 set try
16007 if eval $compile_ok; then
16008 val="$define"
16009 else
16010 echo "But you don't seem to have a useable struct sigaction." >&4
16011 val="$undef"
16012 fi
16013else
16014 echo 'sigaction NOT found.' >&4
16015 val="$undef"
16016fi
16017set d_sigaction; eval $setvar
16018$rm -f try try$_o try.c
16019
983dbef6
JH
16020: see if sigprocmask exists
16021set sigprocmask d_sigprocmask
16022eval $inlibc
16023
b4eb6b3d
JH
16024: see if sigsetjmp exists
16025echo " "
16026case "$d_sigsetjmp" in
16027'')
c727eafa 16028 $cat >try.c <<EOP
b4eb6b3d 16029#include <setjmp.h>
d1daaddf
JH
16030#$i_stdlib I_STDLIB
16031#ifdef I_STDLIB
16032#include <stdlib.h>
16033#endif
b4eb6b3d
JH
16034sigjmp_buf env;
16035int set = 1;
16036int main()
16037{
16038 if (sigsetjmp(env,1))
16039 exit(set);
16040 set = 0;
16041 siglongjmp(env, 1);
16042 exit(1);
16043}
16044EOP
16045 set try
16046 if eval $compile; then
5440bc8e 16047 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
16048 echo "POSIX sigsetjmp found." >&4
16049 val="$define"
16050 else
16051 $cat >&4 <<EOM
16052Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16053I'll ignore them.
16054EOM
16055 val="$undef"
16056 fi
16057 else
16058 echo "sigsetjmp not found." >&4
16059 val="$undef"
16060 fi
16061 ;;
16062*) val="$d_sigsetjmp"
16063 case "$d_sigsetjmp" in
16064 $define) echo "POSIX sigsetjmp found." >&4;;
16065 $undef) echo "sigsetjmp not found." >&4;;
16066 esac
16067 ;;
16068esac
16069set d_sigsetjmp
16070eval $setvar
16071$rm -f try.c try
16072
49a78c82
JH
16073: see if sockatmark exists
16074set sockatmark d_sockatmark
16075eval $inlibc
16076
2ef53570
JH
16077: see if prototype for sockatmark is available
16078echo " "
16079set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16080eval $hasproto
16081
b4eb6b3d
JH
16082: see if socks5_init exists
16083set socks5_init d_socks5_init
16084eval $inlibc
16085
10bc17b6
JH
16086: see if srand48_r exists
16087set srand48_r d_srand48_r
16088eval $inlibc
16089case "$d_srand48_r" in
16090"$define")
16091 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16092 case "$d_srand48_r_proto:$usethreads" in
16093 ":define") d_srand48_r_proto=define
a48ec845
JH
16094 set d_srand48_r_proto srand48_r $hdrs
16095 eval $hasproto ;;
16096 *) ;;
16097 esac
16098 case "$d_srand48_r_proto" in
16099 define)
10bc17b6
JH
16100 case "$srand48_r_proto" in
16101 ''|0) try='int srand48_r(long, struct drand48_data*);'
16102 ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16103 esac
16104 case "$srand48_r_proto" in
90e831dc 16105 ''|0) d_srand48_r=undef
10bc17b6 16106 srand48_r_proto=0
a48ec845 16107 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16108 * ) case "$srand48_r_proto" in
16109 REENTRANT_PROTO*) ;;
16110 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16111 esac
16112 echo "Prototype: $try" ;;
16113 esac
16114 ;;
c18e646a
JH
16115 *) case "$usethreads" in
16116 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16117 esac
90e831dc
SB
16118 d_srand48_r=undef
16119 srand48_r_proto=0
c18e646a 16120 ;;
a48ec845
JH
16121 esac
16122 ;;
10bc17b6
JH
16123*) srand48_r_proto=0
16124 ;;
16125esac
16126
16127: see if srandom_r exists
16128set srandom_r d_srandom_r
16129eval $inlibc
16130case "$d_srandom_r" in
16131"$define")
16132 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16133 case "$d_srandom_r_proto:$usethreads" in
16134 ":define") d_srandom_r_proto=define
a48ec845
JH
16135 set d_srandom_r_proto srandom_r $hdrs
16136 eval $hasproto ;;
16137 *) ;;
16138 esac
16139 case "$d_srandom_r_proto" in
16140 define)
10bc17b6
JH
16141 case "$srandom_r_proto" in
16142 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16143 ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16144 esac
16145 case "$srandom_r_proto" in
90e831dc 16146 ''|0) d_srandom_r=undef
10bc17b6 16147 srandom_r_proto=0
a48ec845 16148 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16149 * ) case "$srandom_r_proto" in
16150 REENTRANT_PROTO*) ;;
16151 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16152 esac
16153 echo "Prototype: $try" ;;
16154 esac
16155 ;;
c18e646a
JH
16156 *) case "$usethreads" in
16157 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16158 esac
90e831dc
SB
16159 d_srandom_r=undef
16160 srandom_r_proto=0
c18e646a 16161 ;;
a48ec845
JH
16162 esac
16163 ;;
10bc17b6
JH
16164*) srandom_r_proto=0
16165 ;;
16166esac
16167
eef837ea
JH
16168: see if prototype for setresgid is available
16169echo " "
16170set d_sresgproto setresgid $i_unistd unistd.h
16171eval $hasproto
16172
640374d0
JH
16173: see if prototype for setresuid is available
16174echo " "
16175set d_sresuproto setresuid $i_unistd unistd.h
16176eval $hasproto
16177
b4eb6b3d
JH
16178: see if sys/stat.h is available
16179set sys/stat.h i_sysstat
16180eval $inhdr
16181
16182
16183: see if stat knows about block sizes
16184echo " "
16185echo "Checking to see if your struct stat has st_blocks field..." >&4
16186set d_statblks stat st_blocks $i_sysstat sys/stat.h
16187eval $hasfield
16188
16189
16190: see if this is a sys/vfs.h system
16191set sys/vfs.h i_sysvfs
16192eval $inhdr
16193
16194
16195: see if this is a sys/statfs.h system
16196set sys/statfs.h i_sysstatfs
16197eval $inhdr
16198
16199
16200echo " "
16201echo "Checking to see if your system supports struct statfs..." >&4
16202set 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
16203eval $hasstruct
16204case "$d_statfs_s" in
16205"$define") echo "Yes, it does." ;;
16206*) echo "No, it doesn't." ;;
16207esac
16208
16209
16210
16211: see if struct statfs knows about f_flags
16212case "$d_statfs_s" in
16213define)
16214 echo " "
16215 echo "Checking to see if your struct statfs has f_flags field..." >&4
16216 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
16217 eval $hasfield
16218 ;;
16219*) val="$undef"
16220 set d_statfs_f_flags
16221 eval $setvar
16222 ;;
16223esac
16224case "$d_statfs_f_flags" in
16225"$define") echo "Yes, it does." ;;
16226*) echo "No, it doesn't." ;;
16227esac
16228
b4eb6b3d
JH
16229$cat >&4 <<EOM
16230Checking how to access stdio streams by file descriptor number...
16231EOM
16232case "$stdio_stream_array" in
16233'') $cat >try.c <<EOCP
16234#include <stdio.h>
16235int main() {
16236 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16237 printf("yes\n");
16238}
16239EOCP
16240 for s in _iob __iob __sF
16241 do
16242 set try -DSTDIO_STREAM_ARRAY=$s
16243 if eval $compile; then
5440bc8e 16244 case "`$run ./try`" in
b4eb6b3d
JH
16245 yes) stdio_stream_array=$s; break ;;
16246 esac
16247 fi
16248 done
16249 $rm -f try.* try$exe_ext
16250esac
16251case "$stdio_stream_array" in
16252'') $cat >&4 <<EOM
16253I can't figure out how to access stdio streams by file descriptor number.
16254EOM
16255 d_stdio_stream_array="$undef"
16256 ;;
16257*) $cat >&4 <<EOM
16258You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16259EOM
16260 d_stdio_stream_array="$define"
16261 ;;
16262esac
16263
16264: see if strcoll exists
16265set strcoll d_strcoll
16266eval $inlibc
16267
16268: check for structure copying
16269echo " "
16270echo "Checking to see if your C compiler can copy structs..." >&4
16271$cat >try.c <<'EOCP'
76f47787 16272int main()
b4eb6b3d
JH
16273{
16274 struct blurfl {
16275 int dyick;
16276 } foo, bar;
16277
16278 foo = bar;
16279}
16280EOCP
16281if $cc -c try.c >/dev/null 2>&1 ; then
16282 val="$define"
16283 echo "Yup, it can."
16284else
16285 val="$undef"
16286 echo "Nope, it can't."
16287fi
16288set d_strctcpy
16289eval $setvar
16290$rm -f try.*
16291
16292: see if strerror and/or sys_errlist[] exist
16293echo " "
16294if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16295 if set strerror val -f d_strerror; eval $csym; $val; then
16296 echo 'strerror() found.' >&4
16297 d_strerror="$define"
16298 d_strerrm='strerror(e)'
16299 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16300 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
16301 d_syserrlst="$define"
16302 else
16303 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16304 d_syserrlst="$undef"
16305 fi
16306 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16307 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16308 echo 'strerror() found in string header.' >&4
16309 d_strerror="$define"
16310 d_strerrm='strerror(e)'
16311 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16312 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16313 d_syserrlst="$define"
16314 else
16315 echo "(You don't appear to have any sys_errlist[], how can this be?)"
16316 d_syserrlst="$undef"
16317 fi
16318 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16319 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16320 d_strerror="$undef"
16321 d_syserrlst="$define"
16322 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16323 else
16324 echo 'strerror() and sys_errlist[] NOT found.' >&4
16325 d_strerror="$undef"
16326 d_syserrlst="$undef"
16327 d_strerrm='"unknown"'
16328 fi
16329fi
16330
10bc17b6
JH
16331: see if strerror_r exists
16332set strerror_r d_strerror_r
16333eval $inlibc
16334case "$d_strerror_r" in
16335"$define")
16336 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
16337 case "$d_strerror_r_proto:$usethreads" in
16338 ":define") d_strerror_r_proto=define
a48ec845
JH
16339 set d_strerror_r_proto strerror_r $hdrs
16340 eval $hasproto ;;
16341 *) ;;
16342 esac
16343 case "$d_strerror_r_proto" in
16344 define)
10bc17b6
JH
16345 case "$strerror_r_proto" in
16346 ''|0) try='int strerror_r(int, char*, size_t);'
16347 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16348 esac
16349 case "$strerror_r_proto" in
16350 ''|0) try='int strerror_r(int, char*, int);'
16351 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16352 esac
16353 case "$strerror_r_proto" in
16354 ''|0) try='char* strerror_r(int, char*, size_t);'
16355 ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16356 esac
16357 case "$strerror_r_proto" in
90e831dc 16358 ''|0) d_strerror_r=undef
10bc17b6 16359 strerror_r_proto=0
a48ec845 16360 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16361 * ) case "$strerror_r_proto" in
16362 REENTRANT_PROTO*) ;;
16363 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16364 esac
16365 echo "Prototype: $try" ;;
16366 esac
16367 ;;
c18e646a
JH
16368 *) case "$usethreads" in
16369 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16370 esac
90e831dc
SB
16371 d_strerror_r=undef
16372 strerror_r_proto=0
c18e646a 16373 ;;
a48ec845
JH
16374 esac
16375 ;;
10bc17b6
JH
16376*) strerror_r_proto=0
16377 ;;
16378esac
16379
b3c85772
JH
16380: see if strftime exists
16381set strftime d_strftime
16382eval $inlibc
16383
b4eb6b3d
JH
16384: see if strtod exists
16385set strtod d_strtod
16386eval $inlibc
16387
16388: see if strtol exists
16389set strtol d_strtol
16390eval $inlibc
16391
16392: see if strtold exists
16393set strtold d_strtold
16394eval $inlibc
16395
16396: see if strtoll exists
16397set strtoll d_strtoll
16398eval $inlibc
16399
16400case "$d_longlong-$d_strtoll" in
16401"$define-$define")
16402 $cat <<EOM
16403Checking whether your strtoll() works okay...
16404EOM
16405 $cat >try.c <<'EOCP'
16406#include <errno.h>
16407#ifdef __hpux
16408#define strtoll __strtoll
16409#endif
e75931a7
YST
16410#ifdef __EMX__
16411#define strtoll _strtoll
16412#endif
b4eb6b3d
JH
16413#include <stdio.h>
16414extern long long int strtoll(char *s, char **, int);
16415static int bad = 0;
16416int check(char *s, long long ell, int een) {
16417 long long gll;
16418 errno = 0;
16419 gll = strtoll(s, 0, 10);
16420 if (!((gll == ell) && (errno == een)))
16421 bad++;
16422}
16423int main() {
16424 check(" 1", 1LL, 0);
16425 check(" 0", 0LL, 0);
16426 check("-1", -1LL, 0);
16427 check("-9223372036854775808", -9223372036854775808LL, 0);
16428 check("-9223372036854775808", -9223372036854775808LL, 0);
16429 check(" 9223372036854775807", 9223372036854775807LL, 0);
16430 check("-9223372036854775808", -9223372036854775808LL, 0);
16431 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
16432 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16433 if (!bad)
16434 printf("ok\n");
16435}
16436EOCP
16437 set try
16438 if eval $compile; then
5440bc8e 16439 yyy=`$run ./try`
e75931a7 16440 case "$yyy" in
b4eb6b3d
JH
16441 ok) echo "Your strtoll() seems to be working okay." ;;
16442 *) cat <<EOM >&4
16443Your strtoll() doesn't seem to be working okay.
16444EOM
16445 d_strtoll="$undef"
16446 ;;
69eadf66 16447 esac
e75931a7
YST
16448 else
16449 echo "(I can't seem to compile the test program--assuming it doesn't)"
16450 d_strtoll="$undef"
b4eb6b3d
JH
16451 fi
16452 ;;
16453esac
16454
28e5dec8
JH
16455: see if strtoq exists
16456set strtoq d_strtoq
16457eval $inlibc
16458
b4eb6b3d
JH
16459: see if strtoul exists
16460set strtoul d_strtoul
16461eval $inlibc
16462
d0e6d399
NC
16463case "$d_strtoul" in
16464"$define")
16465 $cat <<EOM
16466Checking whether your strtoul() works okay...
16467EOM
16468 $cat >try.c <<'EOCP'
16469#include <errno.h>
16470#include <stdio.h>
16471extern unsigned long int strtoul(char *s, char **, int);
16472static int bad = 0;
16473void check(char *s, unsigned long eul, int een) {
16474 unsigned long gul;
16475 errno = 0;
16476 gul = strtoul(s, 0, 10);
16477 if (!((gul == eul) && (errno == een)))
16478 bad++;
16479}
16480int main() {
16481 check(" 1", 1L, 0);
16482 check(" 0", 0L, 0);
16483EOCP
16484 case "$longsize" in
16485 8)
16486 $cat >>try.c <<'EOCP'
09c0d2c4
JH
16487 check("18446744073709551615", 18446744073709551615UL, 0);
16488 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 16489#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 16490 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
16491 check("-18446744073709551614", 2, 0);
16492 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
16493 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16494 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 16495#endif
d0e6d399
NC
16496EOCP
16497 ;;
16498 4)
16499 $cat >>try.c <<'EOCP'
16500 check("4294967295", 4294967295UL, 0);
16501 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 16502#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
16503 check("-1", 4294967295UL, 0);
16504 check("-4294967294", 2, 0);
16505 check("-4294967295", 1, 0);
16506 check("-4294967296", 4294967295UL, ERANGE);
16507 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 16508#endif
d0e6d399
NC
16509EOCP
16510 ;;
16511 *)
16512: Should we write these tests to be more portable by sprintf-ing
16513: ~0 and then manipulating that char string as input for strtol?
16514 ;;
16515 esac
16516 $cat >>try.c <<'EOCP'
16517 if (!bad)
16518 printf("ok\n");
16519 return 0;
16520}
16521EOCP
16522 set try
16523 if eval $compile; then
5440bc8e 16524 case "`$run ./try`" in
d0e6d399
NC
16525 ok) echo "Your strtoul() seems to be working okay." ;;
16526 *) cat <<EOM >&4
16527Your strtoul() doesn't seem to be working okay.
16528EOM
16529 d_strtoul="$undef"
16530 ;;
16531 esac
16532 fi
16533 ;;
16534esac
16535
b4eb6b3d
JH
16536: see if strtoull exists
16537set strtoull d_strtoull
16538eval $inlibc
16539
16540case "$d_longlong-$d_strtoull" in
16541"$define-$define")
16542 $cat <<EOM
16543Checking whether your strtoull() works okay...
16544EOM
16545 $cat >try.c <<'EOCP'
16546#include <errno.h>
16547#ifdef __hpux
16548#define strtoull __strtoull
16549#endif
16550#include <stdio.h>
16551extern unsigned long long int strtoull(char *s, char **, int);
16552static int bad = 0;
16553int check(char *s, long long eull, int een) {
16554 long long gull;
16555 errno = 0;
16556 gull = strtoull(s, 0, 10);
16557 if (!((gull == eull) && (errno == een)))
16558 bad++;
16559}
16560int main() {
d0e6d399
NC
16561 check(" 1", 1LL, 0);
16562 check(" 0", 0LL, 0);
16563 check("18446744073709551615", 18446744073709551615ULL, 0);
16564 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 16565#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
16566 check("-1", 18446744073709551615ULL, 0);
16567 check("-18446744073709551614", 2LL, 0);
16568 check("-18446744073709551615", 1LL, 0);
16569 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16570 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 16571#endif
b4eb6b3d
JH
16572 if (!bad)
16573 printf("ok\n");
16574}
16575EOCP
16576 set try
16577 if eval $compile; then
5440bc8e 16578 case "`$run ./try`" in
b4eb6b3d
JH
16579 ok) echo "Your strtoull() seems to be working okay." ;;
16580 *) cat <<EOM >&4
16581Your strtoull() doesn't seem to be working okay.
16582EOM
16583 d_strtoull="$undef"
16584 ;;
16585 esac
16586 fi
16587 ;;
16588esac
16589
16590: see if strtouq exists
16591set strtouq d_strtouq
16592eval $inlibc
16593
d0e6d399
NC
16594case "$d_strtouq" in
16595"$define")
16596 $cat <<EOM
16597Checking whether your strtouq() works okay...
16598EOM
16599 $cat >try.c <<'EOCP'
16600#include <errno.h>
16601#include <stdio.h>
16602extern unsigned long long int strtouq(char *s, char **, int);
16603static int bad = 0;
16604void check(char *s, unsigned long long eull, int een) {
16605 unsigned long long gull;
16606 errno = 0;
16607 gull = strtouq(s, 0, 10);
16608 if (!((gull == eull) && (errno == een)))
16609 bad++;
16610}
16611int main() {
16612 check(" 1", 1LL, 0);
16613 check(" 0", 0LL, 0);
16614 check("18446744073709551615", 18446744073709551615ULL, 0);
16615 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 16616#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
16617 check("-1", 18446744073709551615ULL, 0);
16618 check("-18446744073709551614", 2LL, 0);
16619 check("-18446744073709551615", 1LL, 0);
16620 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16621 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 16622#endif
d0e6d399
NC
16623 if (!bad)
16624 printf("ok\n");
16625 return 0;
16626}
16627EOCP
16628 set try
16629 if eval $compile; then
5440bc8e 16630 case "`$run ./try`" in
d0e6d399
NC
16631 ok) echo "Your strtouq() seems to be working okay." ;;
16632 *) cat <<EOM >&4
16633Your strtouq() doesn't seem to be working okay.
16634EOM
16635 d_strtouq="$undef"
16636 ;;
16637 esac
16638 fi
16639 ;;
16640esac
16641
b4eb6b3d
JH
16642: see if strxfrm exists
16643set strxfrm d_strxfrm
16644eval $inlibc
16645
16646: see if symlink exists
16647set symlink d_symlink
16648eval $inlibc
16649
16650: see if syscall exists
16651set syscall d_syscall
16652eval $inlibc
16653
2ef53570
JH
16654: see if prototype for syscall is available
16655echo " "
16656set d_syscallproto syscall $i_unistd unistd.h
16657eval $hasproto
16658
b4eb6b3d
JH
16659: see if sysconf exists
16660set sysconf d_sysconf
16661eval $inlibc
16662
16663: see if system exists
16664set system d_system
16665eval $inlibc
16666
16667: see if tcgetpgrp exists
16668set tcgetpgrp d_tcgetpgrp
16669eval $inlibc
16670
16671: see if tcsetpgrp exists
16672set tcsetpgrp d_tcsetpgrp
16673eval $inlibc
16674
16675: see if prototype for telldir is available
16676echo " "
16677set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16678eval $hasproto
16679
ad493445
MB
16680: see if time exists
16681echo " "
16682if test "X$d_time" = X -o X"$timetype" = X; then
16683 if set time val -f d_time; eval $csym; $val; then
16684 echo 'time() found.' >&4
16685 val="$define"
16686 rp="What is the type returned by time() on this system?"
16687 set time_t timetype long stdio.h sys/types.h
16688 eval $typedef_ask
16689 else
16690 echo 'time() not found, hope that will do.' >&4
16691 val="$undef"
16692 timetype='int';
16693 fi
16694 set d_time
16695 eval $setvar
16696fi
16697
b4eb6b3d
JH
16698: see if this is a sys/times.h system
16699set sys/times.h i_systimes
16700eval $inhdr
16701
16702: see if times exists
16703echo " "
16704if set times val -f d_times; eval $csym; $val; then
16705 echo 'times() found.' >&4
16706 d_times="$define"
16707 inc=''
16708 case "$i_systimes" in
16709 "$define") inc='sys/times.h';;
16710 esac
16711 rp="What is the type returned by times() on this system?"
16712 set clock_t clocktype long stdio.h sys/types.h $inc
16713 eval $typedef_ask
16714else
16715 echo 'times() NOT found, hope that will do.' >&4
16716 d_times="$undef"
16717 clocktype='int'
16718fi
16719
10bc17b6
JH
16720: see if tmpnam_r exists
16721set tmpnam_r d_tmpnam_r
16722eval $inlibc
16723case "$d_tmpnam_r" in
16724"$define")
31ee0cb7 16725 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
16726 case "$d_tmpnam_r_proto:$usethreads" in
16727 ":define") d_tmpnam_r_proto=define
a48ec845
JH
16728 set d_tmpnam_r_proto tmpnam_r $hdrs
16729 eval $hasproto ;;
16730 *) ;;
16731 esac
16732 case "$d_tmpnam_r_proto" in
16733 define)
10bc17b6
JH
16734 case "$tmpnam_r_proto" in
16735 ''|0) try='char* tmpnam_r(char*);'
16736 ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16737 esac
16738 case "$tmpnam_r_proto" in
90e831dc 16739 ''|0) d_tmpnam_r=undef
10bc17b6 16740 tmpnam_r_proto=0
a48ec845 16741 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16742 * ) case "$tmpnam_r_proto" in
16743 REENTRANT_PROTO*) ;;
16744 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16745 esac
16746 echo "Prototype: $try" ;;
16747 esac
16748 ;;
c18e646a
JH
16749 *) case "$usethreads" in
16750 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16751 esac
90e831dc
SB
16752 d_tmpnam_r=undef
16753 tmpnam_r_proto=0
c18e646a 16754 ;;
a48ec845
JH
16755 esac
16756 ;;
10bc17b6
JH
16757*) tmpnam_r_proto=0
16758 ;;
16759esac
16760
b4eb6b3d
JH
16761: see if truncate exists
16762set truncate d_truncate
16763eval $inlibc
16764
10bc17b6
JH
16765: see if ttyname_r exists
16766set ttyname_r d_ttyname_r
16767eval $inlibc
16768case "$d_ttyname_r" in
16769"$define")
16770 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
16771 case "$d_ttyname_r_proto:$usethreads" in
16772 ":define") d_ttyname_r_proto=define
a48ec845
JH
16773 set d_ttyname_r_proto ttyname_r $hdrs
16774 eval $hasproto ;;
16775 *) ;;
16776 esac
16777 case "$d_ttyname_r_proto" in
16778 define)
10bc17b6
JH
16779 case "$ttyname_r_proto" in
16780 ''|0) try='int ttyname_r(int, char*, size_t);'
16781 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16782 esac
16783 case "$ttyname_r_proto" in
16784 ''|0) try='int ttyname_r(int, char*, int);'
16785 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16786 esac
16787 case "$ttyname_r_proto" in
16788 ''|0) try='char* ttyname_r(int, char*, int);'
16789 ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16790 esac
16791 case "$ttyname_r_proto" in
90e831dc 16792 ''|0) d_ttyname_r=undef
10bc17b6 16793 ttyname_r_proto=0
a48ec845 16794 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16795 * ) case "$ttyname_r_proto" in
16796 REENTRANT_PROTO*) ;;
16797 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16798 esac
16799 echo "Prototype: $try" ;;
16800 esac
16801 ;;
c18e646a
JH
16802 *) case "$usethreads" in
16803 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16804 esac
90e831dc
SB
16805 d_ttyname_r=undef
16806 ttyname_r_proto=0
c18e646a 16807 ;;
a48ec845
JH
16808 esac
16809 ;;
10bc17b6
JH
16810*) ttyname_r_proto=0
16811 ;;
16812esac
16813
b4eb6b3d
JH
16814: see if tzname[] exists
16815echo " "
16816if set tzname val -a d_tzname; eval $csym; $val; then
16817 val="$define"
16818 echo 'tzname[] found.' >&4
16819else
16820 val="$undef"
16821 echo 'tzname[] NOT found.' >&4
16822fi
16823set d_tzname
16824eval $setvar
16825
4e0554ec
JH
16826case "$osname" in
16827next|rhapsody|darwin) multiarch="$define" ;;
16828esac
16829case "$multiarch" in
16830''|[nN]*) multiarch="$undef" ;;
16831esac
16832
24412007 16833: check for ordering of bytes in a UV
4e0554ec 16834echo " "
5440bc8e 16835case "$usecrosscompile$multiarch" in
4e0554ec
JH
16836*$define*)
16837 $cat <<EOM
16838You seem to be either cross-compiling or doing a multiarchitecture build,
16839skipping the byteorder check.
16840
16841EOM
5440bc8e 16842 byteorder='ffff'
4e0554ec
JH
16843 ;;
16844*)
16845 case "$byteorder" in
16846 '')
16847 $cat <<'EOM'
16848In the following, larger digits indicate more significance. A big-endian
16849machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16850little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16851machines may have weird orders like 3412. A Cray will report 87654321,
16852an Alpha will report 12345678. If the test program works the default is
16853probably right.
16854I'm now running the test program...
16855EOM
24412007 16856 $cat >try.c <<EOCP
4e0554ec 16857#include <stdio.h>
55954f19
JH
16858#$i_stdlib I_STDLIB
16859#ifdef I_STDLIB
16860#include <stdlib.h>
16861#endif
24412007
JH
16862#include <sys/types.h>
16863typedef $uvtype UV;
4e0554ec
JH
16864int main()
16865{
16866 int i;
16867 union {
24412007
JH
16868 UV l;
16869 char c[$uvsize];
4e0554ec
JH
16870 } u;
16871
24412007 16872 if ($uvsize > 4)
b5ded3e5 16873 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 16874 else
a4c53327 16875 u.l = (UV)0x04030201;
24412007 16876 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
16877 printf("%c", u.c[i]+'0');
16878 printf("\n");
16879 exit(0);
16880}
16881EOCP
16882 xxx_prompt=y
16883 set try
16884 if eval $compile && ./try > /dev/null; then
5440bc8e 16885 dflt=`$run ./try`
4e0554ec
JH
16886 case "$dflt" in
16887 [1-4][1-4][1-4][1-4]|12345678|87654321)
16888 echo "(The test program ran ok.)"
16889 echo "byteorder=$dflt"
16890 xxx_prompt=n
16891 ;;
16892 ????|????????) echo "(The test program ran ok.)" ;;
16893 *) echo "(The test program didn't run right for some reason.)" ;;
16894 esac
16895 else
16896 dflt='4321'
16897 cat <<'EOM'
16898(I can't seem to compile the test program. Guessing big-endian...)
16899EOM
16900 fi
16901 case "$xxx_prompt" in
16902 y)
24412007 16903 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
16904 . ./myread
16905 byteorder="$ans"
16906 ;;
16907 *) byteorder=$dflt
16908 ;;
16909 esac
16910 ;;
16911 esac
16912 $rm -f try.c try
16913 ;;
16914esac
16915
16916
16917$cat <<EOM
16918
16919Checking to see whether you can access character data unalignedly...
16920EOM
dc7b0a4f
JH
16921case "$d_u32align" in
16922'') $cat >try.c <<EOCP
4e0554ec 16923#include <stdio.h>
d1daaddf
JH
16924#$i_stdlib I_STDLIB
16925#ifdef I_STDLIB
16926#include <stdlib.h>
16927#endif
4e0554ec 16928#define U32 $u32type
d308175a
JH
16929#define BYTEORDER 0x$byteorder
16930#define U8 $u8type
9958dc3c
JH
16931#include <signal.h>
16932#ifdef SIGBUS
16933$signal_t bletch(s) int s; { exit(4); }
16934#endif
4e0554ec
JH
16935int main() {
16936#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
8906a23e 16937 U8 buf[8];
4e0554ec
JH
16938 U32 *up;
16939 int i;
16940
16941 if (sizeof(U32) != 4) {
16942 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16943 exit(1);
16944 }
16945
16946 fflush(stdout);
16947
9958dc3c
JH
16948#ifdef SIGBUS
16949 signal(SIGBUS, bletch);
16950#endif
16951
8906a23e
JH
16952 buf[0] = 0;
16953 buf[1] = 0;
16954 buf[2] = 0;
16955 buf[3] = 1;
16956 buf[5] = 0;
16957 buf[6] = 0;
16958 buf[7] = 0;
16959 buf[8] = 1;
16960
4e0554ec
JH
16961 for (i = 0; i < 4; i++) {
16962 up = (U32*)(buf + i);
16963 if (! ((*up == 1 << (8*i)) || /* big-endian */
16964 (*up == 1 << (8*(3-i))) /* little-endian */
16965 )
16966 )
16967 {
16968 printf("read failed (%x)\n", *up);
16969 exit(2);
16970 }
16971 }
16972
16973 /* write test */
16974 for (i = 0; i < 4; i++) {
16975 up = (U32*)(buf + i);
16976 *up = 0xBeef;
16977 if (*up != 0xBeef) {
16978 printf("write failed (%x)\n", *up);
16979 exit(3);
16980 }
16981 }
16982
16983 exit(0);
16984#else
16985 printf("1\n");
16986 exit(1);
16987#endif
16988 return 0;
16989}
16990EOCP
16991set try
16992if eval $compile_ok; then
d308175a 16993 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 16994 $run ./try 2>&1 >/dev/null
4e0554ec
JH
16995 case "$?" in
16996 0) cat >&4 <<EOM
16997You can access character data pretty unalignedly.
16998EOM
16999 d_u32align="$undef"
17000 ;;
17001 *) cat >&4 <<EOM
17002It seems that you must access character data in an aligned manner.
17003EOM
17004 d_u32align="$define"
17005 ;;
17006 esac
4e0554ec
JH
17007else
17008 rp='Can you access character data at unaligned addresses?'
17009 dflt='n'
17010 . ./myread
17011 case "$ans" in
17012 [yY]*) d_u32align="$undef" ;;
17013 *) d_u32align="$define" ;;
17014 esac
17015fi
e36b5403 17016$rm -f core core.try.* try.core
dc7b0a4f
JH
17017;;
17018esac
4e0554ec
JH
17019
17020: see if ualarm exists
17021set ualarm d_ualarm
17022eval $inlibc
17023
b4eb6b3d
JH
17024: see if umask exists
17025set umask d_umask
17026eval $inlibc
17027
758a5d79
JH
17028: see if unordered exists
17029set unordered d_unordered
17030eval $inlibc
17031
4e0554ec
JH
17032: see if usleep exists
17033set usleep d_usleep
17034eval $inlibc
17035
2ef53570
JH
17036: see if prototype for usleep is available
17037echo " "
17038set d_usleepproto usleep $i_unistd unistd.h
17039eval $hasproto
17040
b4eb6b3d
JH
17041: see if ustat exists
17042set ustat d_ustat
17043eval $inlibc
17044
17045: backward compatibility for d_hvfork
17046if test X$d_hvfork != X; then
17047 d_vfork="$d_hvfork"
17048 d_hvfork=''
17049fi
17050: see if there is a vfork
17051val=''
17052set vfork val
17053eval $inlibc
17054
17055: Ok, but do we want to use it. vfork is reportedly unreliable in
17056: perl on Solaris 2.x, and probably elsewhere.
17057case "$val" in
17058$define)
17059 echo " "
17060 case "$usevfork" in
17061 false) dflt='n';;
17062 *) dflt='y';;
17063 esac
17064 cat <<'EOM'
17065
17066Perl can only use a vfork() that doesn't suffer from strict
17067restrictions on calling functions or modifying global data in
17068the child. For example, glibc-2.1 contains such a vfork()
17069that is unsuitable. If your system provides a proper fork()
17070call, chances are that you do NOT want perl to use vfork().
17071
17072EOM
17073 rp="Do you still want to use vfork()?"
17074 . ./myread
17075 case "$ans" in
17076 y|Y) ;;
17077 *)
17078 echo "Ok, we won't use vfork()."
17079 val="$undef"
17080 ;;
17081 esac
17082 ;;
17083esac
17084set d_vfork
17085eval $setvar
17086case "$d_vfork" in
17087$define) usevfork='true';;
17088*) usevfork='false';;
17089esac
17090
b4eb6b3d
JH
17091: see if closedir exists
17092set closedir d_closedir
17093eval $inlibc
17094
17095case "$d_closedir" in
17096"$define")
17097 echo " "
17098 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 17099 cat > try.c <<EOM
b4eb6b3d
JH
17100#$i_dirent I_DIRENT /**/
17101#$i_sysdir I_SYS_DIR /**/
17102#$i_sysndir I_SYS_NDIR /**/
17103#$i_systypes I_SYS_TYPES /**/
17104
17105#if defined(I_SYS_TYPES)
17106#include <sys/types.h>
17107#endif
17108#if defined(I_DIRENT)
17109#include <dirent.h>
17110#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17111#include <sys/dir.h>
17112#endif
17113#else
17114#ifdef I_SYS_NDIR
17115#include <sys/ndir.h>
17116#else
17117#ifdef I_SYS_DIR
17118#ifdef hp9000s500
17119#include <ndir.h> /* may be wrong in the future */
17120#else
17121#include <sys/dir.h>
17122#endif
17123#endif
17124#endif
17125#endif
17126int main() { return closedir(opendir(".")); }
17127EOM
5440bc8e 17128 set try
b4eb6b3d 17129 if eval $compile_ok; then
5440bc8e 17130 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
17131 echo "Yes, it does."
17132 val="$undef"
17133 else
17134 echo "No, it doesn't."
17135 val="$define"
17136 fi
17137 else
17138 echo "(I can't seem to compile the test program--assuming it doesn't)"
17139 val="$define"
17140 fi
17141 ;;
17142*)
17143 val="$undef";
17144 ;;
17145esac
17146set d_void_closedir
17147eval $setvar
5440bc8e 17148$rm -f try try.*
b4eb6b3d
JH
17149: see if there is a wait4
17150set wait4 d_wait4
17151eval $inlibc
17152
17153: see if waitpid exists
17154set waitpid d_waitpid
17155eval $inlibc
17156
17157: see if wcstombs exists
17158set wcstombs d_wcstombs
17159eval $inlibc
17160
17161: see if wctomb exists
17162set wctomb d_wctomb
17163eval $inlibc
17164
4e0554ec
JH
17165: see if writev exists
17166set writev d_writev
17167eval $inlibc
17168
b4eb6b3d
JH
17169: preserve RCS keywords in files with variable substitution, grrr
17170Date='$Date'
17171Id='$Id'
17172Log='$Log'
17173RCSfile='$RCSfile'
17174Revision='$Revision'
17175
b4eb6b3d
JH
17176: check for alignment requirements
17177echo " "
5440bc8e 17178case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
17179*$define*)
17180 $cat <<EOM
17181You seem to be either cross-compiling or doing a multiarchitecture build,
17182skipping the memory alignment check.
17183
17184EOM
17185 case "$alignbytes" in
17186 '') alignbytes=8 ;;
17187 esac
17188 ;;
17189*)
17190 case "$alignbytes" in
17191 '') echo "Checking alignment constraints..." >&4
17192 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17193 $cat >try.c <<'EOCP'
17194typedef long double NV;
17195EOCP
17196 else
17197 $cat >try.c <<'EOCP'
17198typedef double NV;
17199EOCP
17200 fi
17201 $cat >>try.c <<'EOCP'
17202#include <stdio.h>
17203struct foobar {
17204 char foo;
17205 NV bar;
17206} try_algn;
17207int main()
17208{
17209 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17210 return(0);
17211}
17212EOCP
17213 set try
17214 if eval $compile_ok; then
5440bc8e 17215 dflt=`$run ./try`
b4eb6b3d
JH
17216 else
17217 dflt='8'
17218 echo "(I can't seem to compile the test program...)"
17219 fi
17220 ;;
17221 *) dflt="$alignbytes"
17222 ;;
17223 esac
17224 rp="Doubles must be aligned on a how-many-byte boundary?"
17225 . ./myread
17226 alignbytes="$ans"
17227 $rm -f try.c try
17228 ;;
17229esac
17230
17231
17232: set the base revision
17233baserev=5.0
17234
3099fc99 17235: how do we concatenate cpp tokens here?
b4eb6b3d 17236echo " "
3099fc99 17237echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
17238$cat >cpp_stuff.c <<'EOCP'
17239#define RCAT(a,b)a/**/b
17240#define ACAT(a,b)a ## b
17241RCAT(Rei,ser)
17242ACAT(Cir,cus)
17243EOCP
17244$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17245if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17246 echo "Oh! Smells like ANSI's been here." >&4
17247 echo "We can catify or stringify, separately or together!"
17248 cpp_stuff=42
17249elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17250 echo "Ah, yes! The good old days!" >&4
17251 echo "However, in the good old days we don't know how to stringify and"
17252 echo "catify at the same time."
17253 cpp_stuff=1
17254else
17255 $cat >&4 <<EOM
3099fc99
CW
17256Hmm, I don't seem to be able to concatenate tokens with your cpp.
17257You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
17258EOM
17259 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17260fi
17261$rm -f cpp_stuff.*
17262
17263: see if this is a db.h system
17264set db.h i_db
17265eval $inhdr
17266
17267case "$i_db" in
17268$define)
17269 : Check db version.
17270 echo " "
17271 echo "Checking Berkeley DB version ..." >&4
17272 $cat >try.c <<EOCP
17273#$d_const HASCONST
17274#ifndef HASCONST
17275#define const
17276#endif
17277#include <sys/types.h>
17278#include <stdio.h>
55954f19
JH
17279#$i_stdlib I_STDLIB
17280#ifdef I_STDLIB
17281#include <stdlib.h>
17282#endif
b4eb6b3d 17283#include <db.h>
640374d0 17284int main(int argc, char *argv[])
b4eb6b3d
JH
17285{
17286#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17287 int Major, Minor, Patch ;
17288 unsigned long Version ;
17289 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
17290 if (argc == 2) {
17291 printf("%d %d %d %d %d %d\n",
17292 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17293 Major, Minor, Patch);
17294 exit(0);
17295 }
17296 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
17297
17298 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17299 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17300 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17301 Major, Minor, Patch) ;
17302
17303 /* check that db.h & libdb are compatible */
17304 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 17305 printf("db.h and libdb are incompatible.\n") ;
b4eb6b3d
JH
17306 exit(3);
17307 }
17308
640374d0 17309 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
17310
17311 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17312 + DB_VERSION_PATCH ;
17313
17314 /* needs to be >= 2.3.4 */
17315 if (Version < 2003004) {
17316 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 17317 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
b4eb6b3d
JH
17318 exit(2);
17319 }
17320
17321 exit(0);
17322#else
17323#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
17324 if (argc == 2) {
17325 printf("1 0 0\n");
17326 exit(0);
17327 }
17328 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
17329 exit(0); /* DB version < 2: the coast is clear. */
17330#else
17331 exit(1); /* <db.h> not Berkeley DB? */
17332#endif
17333#endif
17334}
17335EOCP
17336 set try
5440bc8e 17337 if eval $compile_ok && $run ./try; then
b4eb6b3d 17338 echo 'Looks OK.' >&4
5440bc8e 17339 set `$run ./try 1`
640374d0
JH
17340 db_version_major=$1
17341 db_version_minor=$2
17342 db_version_patch=$3
b4eb6b3d
JH
17343 else
17344 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
17345 i_db=$undef
17346 case " $libs " in
17347 *"-ldb "*)
17348 : Remove db from list of libraries to use
17349 echo "Removing unusable -ldb from library list" >&4
17350 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17351 shift
17352 libs="$*"
17353 echo "libs = $libs" >&4
17354 ;;
17355 esac
17356 fi
17357 $rm -f try.*
17358 ;;
17359esac
17360
17361case "$i_db" in
17362define)
17363 : Check the return type needed for hash
17364 echo " "
17365 echo "Checking return type needed for hash for Berkeley DB ..." >&4
17366 $cat >try.c <<EOCP
17367#$d_const HASCONST
17368#ifndef HASCONST
17369#define const
17370#endif
17371#include <sys/types.h>
17372#include <db.h>
17373
17374#ifndef DB_VERSION_MAJOR
17375u_int32_t hash_cb (ptr, size)
17376const void *ptr;
17377size_t size;
17378{
17379}
17380HASHINFO info;
17381int main()
17382{
17383 info.hash = hash_cb;
17384}
17385#endif
17386EOCP
17387 if $cc $ccflags -c try.c >try.out 2>&1 ; then
17388 if $contains warning try.out >>/dev/null 2>&1 ; then
17389 db_hashtype='int'
17390 else
17391 db_hashtype='u_int32_t'
17392 fi
17393 else
17394 : XXX Maybe we should just give up here.
17395 db_hashtype=u_int32_t
17396 $cat try.out >&4
17397 echo "Help: I can't seem to compile the db test program." >&4
17398 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17399 fi
17400 $rm -f try.*
17401 echo "Your version of Berkeley DB uses $db_hashtype for hash."
17402 ;;
17403*) db_hashtype=u_int32_t
17404 ;;
17405esac
17406case "$i_db" in
17407define)
17408 : Check the return type needed for prefix
17409 echo " "
17410 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17411 cat >try.c <<EOCP
17412#$d_const HASCONST
17413#ifndef HASCONST
17414#define const
17415#endif
17416#include <sys/types.h>
17417#include <db.h>
17418
17419#ifndef DB_VERSION_MAJOR
17420size_t prefix_cb (key1, key2)
17421const DBT *key1;
17422const DBT *key2;
17423{
17424}
17425BTREEINFO info;
17426int main()
17427{
17428 info.prefix = prefix_cb;
17429}
17430#endif
17431EOCP
17432 if $cc $ccflags -c try.c >try.out 2>&1 ; then
17433 if $contains warning try.out >>/dev/null 2>&1 ; then
17434 db_prefixtype='int'
17435 else
17436 db_prefixtype='size_t'
17437 fi
17438 else
17439 db_prefixtype='size_t'
17440 : XXX Maybe we should just give up here.
17441 $cat try.out >&4
17442 echo "Help: I can't seem to compile the db test program." >&4
17443 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17444 fi
17445 $rm -f try.*
17446 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17447 ;;
17448*) db_prefixtype='size_t'
17449 ;;
17450esac
17451
b4eb6b3d
JH
17452
17453: How can we generate normalized random numbers ?
17454echo " "
17455echo "Looking for a random number function..." >&4
17456case "$randfunc" in
17457'')
17458 if set drand48 val -f; eval $csym; $val; then
17459 dflt="drand48"
17460 echo "Good, found drand48()." >&4
17461 elif set random val -f; eval $csym; $val; then
17462 dflt="random"
17463 echo "OK, found random()." >&4
17464 else
17465 dflt="rand"
17466 echo "Yick, looks like I have to use rand()." >&4
17467 fi
17468 echo " "
17469 ;;
17470*)
17471 dflt="$randfunc"
17472 ;;
17473esac
17474cont=true
17475
17476case "$ccflags" in
17477*-Dmy_rand=*|*-Dmy_srand=*)
17478 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17479 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17480 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17481 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17482 ;;
17483esac
17484
17485while $test "$cont"; do
17486 rp="Use which function to generate random numbers?"
17487 . ./myread
17488 if $test "$ans" = "$dflt"; then
17489 : null
17490 else
17491 randbits=''
17492 fi
17493 randfunc="$ans"
17494 if set $ans val -f; eval $csym; $val; then
17495 cont=''
17496 else
17497 dflt=y
17498 rp="I cannot find function $ans. Use that name anyway?"
17499 . ./myread
17500 dflt=rand
17501 case "$ans" in
17502 [yY]*) cont='';;
17503 esac
17504 fi
17505 case "$cont" in
17506 '')
17507 case "$randfunc" in
17508 drand48)
17509 drand01="drand48()"
17510 seedfunc="srand48"
17511 randbits=48
17512 randseedtype=long
17513 ;;
17514 rand|random)
17515 case "$randbits" in
17516 '')
17517echo "Checking to see how many bits your $randfunc() function produces..." >&4
17518 $cat >try.c <<EOCP
17519#$i_unistd I_UNISTD
17520#$i_stdlib I_STDLIB
17521#include <stdio.h>
17522#ifdef I_UNISTD
17523# include <unistd.h>
17524#endif
17525#ifdef I_STDLIB
17526# include <stdlib.h>
17527#endif
17528int main()
17529{
17530 register int i;
17531 register unsigned long tmp;
17532 register unsigned long max = 0L;
17533
17534 for (i = 1000; i; i--) {
17535 tmp = (unsigned long) $randfunc();
17536 if (tmp > max) max = tmp;
17537 }
17538 for (i = 0; max; i++)
17539 max /= 2;
17540 printf("%d\n",i);
17541}
17542EOCP
17543 set try
17544 if eval $compile_ok; then
17545 dflt=`try`
17546 else
17547 dflt='?'
17548 echo "(I can't seem to compile the test program...)"
17549 fi
17550 ;;
17551 *)
17552 dflt="$randbits"
17553 ;;
17554 esac
17555 rp="How many bits does your $randfunc() function produce?"
17556 . ./myread
17557 randbits="$ans"
17558 $rm -f try.c try
17559 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17560 seedfunc="s$randfunc"
17561 randseedtype=unsigned
17562 ;;
17563 *)
17564 dflt="31"
17565 rp="How many bits does your $randfunc() function produce?"
17566 . ./myread
17567 randbits="$ans"
17568 seedfunc="s$randfunc"
17569 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17570 if set $seedfunc val -f; eval $csym; $val; then
17571 echo "(Using $seedfunc() to seed random generator)"
17572 else
17573 echo "(Warning: no $seedfunc() to seed random generator)"
17574 seedfunc=rand
17575 fi
17576 randseedtype=unsigned
17577 ;;
17578 esac
17579 ;;
17580 esac
17581done
17582
17583echo " "
17584echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 17585$cat >try.c <<'EOM'
b4eb6b3d
JH
17586int main()
17587{
17588 if ('M'==0xd4) return 0;
17589 return 1;
17590}
17591EOM
17592
17593val=$undef
5440bc8e 17594set try
b4eb6b3d 17595if eval $compile_ok; then
5440bc8e 17596 if $run ./try; then
b4eb6b3d
JH
17597 echo "You seem to speak EBCDIC." >&4
17598 val="$define"
17599 else
5440bc8e 17600 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
17601 fi
17602else
17603 echo "I'm unable to compile the test program." >&4
17604 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
17605fi
5440bc8e 17606$rm -f try try.*
b4eb6b3d
JH
17607set ebcdic
17608eval $setvar
17609
17610echo " "
17611$cat >&4 <<EOM
17612Checking how to flush all pending stdio output...
17613EOM
17614# I only know how to find the first 32 possibly open files on SunOS.
17615# See also hints/sunos_4_1.sh and util.c --AD
17616case "$osname" in
17617sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
17618esac
17619$cat >>try.c <<EOCP
17620#include <stdio.h>
55954f19
JH
17621#$i_stdlib I_STDLIB
17622#ifdef I_STDLIB
17623#include <stdlib.h>
17624#endif
b4eb6b3d
JH
17625#$i_unistd I_UNISTD
17626#ifdef I_UNISTD
17627# include <unistd.h>
17628#endif
17629#$d_sysconf HAS_SYSCONF
17630#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
17631#ifdef HAS_STDIO_STREAM_ARRAY
17632# define STDIO_STREAM_ARRAY $stdio_stream_array
17633#endif
17634int main() {
5440bc8e
JH
17635 FILE* p;
17636 unlink("try.out");
17637 p = fopen("try.out", "w");
b4eb6b3d
JH
17638#ifdef TRY_FPUTC
17639 fputc('x', p);
17640#else
17641# ifdef TRY_FPRINTF
17642 fprintf(p, "x");
17643# endif
17644#endif
17645#ifdef TRY_FFLUSH_NULL
17646 fflush(NULL);
17647#endif
17648#ifdef TRY_FFLUSH_ALL
17649 {
17650 long open_max = -1;
17651# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
17652 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
17653# else
17654# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
17655 open_max = sysconf(_SC_OPEN_MAX);
17656# else
17657# ifdef FOPEN_MAX
17658 open_max = FOPEN_MAX;
17659# else
17660# ifdef OPEN_MAX
17661 open_max = OPEN_MAX;
17662# else
17663# ifdef _NFILE
17664 open_max = _NFILE;
17665# endif
17666# endif
17667# endif
17668# endif
17669# endif
17670# ifdef HAS_STDIO_STREAM_ARRAY
17671 if (open_max > 0) {
17672 long i;
17673 for (i = 0; i < open_max; i++)
17674 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17675 STDIO_STREAM_ARRAY[i]._file < open_max &&
17676 STDIO_STREAM_ARRAY[i]._flag)
17677 fflush(&STDIO_STREAM_ARRAY[i]);
17678 }
17679 }
17680# endif
17681#endif
17682 _exit(42);
17683}
17684EOCP
17685: first we have to find out how _not_ to flush
5440bc8e 17686$to try.c
b4eb6b3d
JH
17687if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17688 output=''
17689 set try -DTRY_FPUTC
17690 if eval $compile; then
fbe73d74 17691 $run ./try 2>/dev/null
28f5ac64 17692 code="$?"
5440bc8e 17693 $from try.out
28f5ac64 17694 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
17695 output=-DTRY_FPUTC
17696 fi
17697 fi
17698 case "$output" in
17699 '')
17700 set try -DTRY_FPRINTF
b4eb6b3d 17701 if eval $compile; then
fbe73d74 17702 $run ./try 2>/dev/null
28f5ac64 17703 code="$?"
5440bc8e 17704 $from try.out
28f5ac64 17705 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
17706 output=-DTRY_FPRINTF
17707 fi
17708 fi
17709 ;;
17710 esac
17711fi
17712: check for fflush NULL behaviour
17713case "$fflushNULL" in
17714'') set try -DTRY_FFLUSH_NULL $output
17715 if eval $compile; then
5440bc8e 17716 $run ./try 2>/dev/null
b4eb6b3d 17717 code="$?"
5440bc8e 17718 $from try.out
b4eb6b3d
JH
17719 if $test -s try.out -a "X$code" = X42; then
17720 fflushNULL="`$cat try.out`"
17721 else
17722 if $test "X$code" != X42; then
17723 $cat >&4 <<EOM
17724(If this test failed, don't worry, we'll try another method shortly.)
17725EOM
17726 fi
17727 fi
17728 fi
17729 $rm -f core try.core core.try.*
17730 case "$fflushNULL" in
17731 x) $cat >&4 <<EOM
17732Your fflush(NULL) works okay for output streams.
17733Let's see if it clobbers input pipes...
17734EOM
17735# As of mid-March 2000 all versions of Solaris appear to have a stdio
17736# bug that improperly flushes the input end of pipes. So we avoid the
17737# autoflush on fork/system/exec support for now. :-(
17738$cat >tryp.c <<EOCP
17739#include <stdio.h>
17740int
17741main(int argc, char **argv)
17742{
17743 char buf[1024];
17744 int i;
17745 char *bp = buf;
17746 while (1) {
17747 while ((i = getc(stdin)) != -1
17748 && (*bp++ = i) != '\n'
17749 && bp < &buf[1024])
17750 /* DO NOTHING */ ;
17751 *bp = '\0';
17752 fprintf(stdout, "%s", buf);
17753 fflush(NULL);
17754 if (i == -1)
17755 return 0;
17756 bp = buf;
17757 }
17758}
17759EOCP
17760 fflushNULL="$define"
17761 set tryp
17762 if eval $compile; then
17763 $rm -f tryp.out
5440bc8e 17764 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
17765 if cmp tryp.c tryp.out >/dev/null 2>&1; then
17766 $cat >&4 <<EOM
17767fflush(NULL) seems to behave okay with input streams.
17768EOM
17769 fflushNULL="$define"
17770 else
17771 $cat >&4 <<EOM
17772Ouch, fflush(NULL) clobbers input pipes! We will not use it.
17773EOM
17774 fflushNULL="$undef"
17775 fi
17776 fi
17777 $rm -f core tryp.c tryp.core core.tryp.*
17778 ;;
17779 '') $cat >&4 <<EOM
17780Your fflush(NULL) isn't working (contrary to ANSI C).
17781EOM
17782 fflushNULL="$undef"
17783 ;;
17784 *) $cat >&4 <<EOM
17785Cannot figure out whether your fflush(NULL) works or not.
17786I'm assuming it doesn't (contrary to ANSI C).
17787EOM
17788 fflushNULL="$undef"
17789 ;;
17790 esac
17791 ;;
17792$define|true|[yY]*)
17793 fflushNULL="$define"
17794 ;;
17795*)
17796 fflushNULL="$undef"
17797 ;;
17798esac
17799: check explicit looping only if NULL did not work, and if the pipe
17800: bug does not show up on an explicit flush too
17801case "$fflushNULL" in
17802"$undef")
17803 $cat >tryp.c <<EOCP
17804#include <stdio.h>
17805int
17806main(int argc, char **argv)
17807{
17808 char buf[1024];
17809 int i;
17810 char *bp = buf;
17811 while (1) {
17812 while ((i = getc(stdin)) != -1
17813 && (*bp++ = i) != '\n'
17814 && bp < &buf[1024])
17815 /* DO NOTHING */ ;
17816 *bp = '\0';
17817 fprintf(stdout, "%s", buf);
17818 fflush(stdin);
17819 if (i == -1)
17820 return 0;
17821 bp = buf;
17822 }
17823}
17824EOCP
17825 set tryp
17826 if eval $compile; then
17827 $rm -f tryp.out
5440bc8e 17828 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
17829 if cmp tryp.c tryp.out >/dev/null 2>&1; then
17830 $cat >&4 <<EOM
17831Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17832EOM
17833 : now check for fflushall behaviour
17834 case "$fflushall" in
17835 '') set try -DTRY_FFLUSH_ALL $output
17836 if eval $compile; then
17837 $cat >&4 <<EOM
17838(Now testing the other method--but note that this also may fail.)
17839EOM
5440bc8e 17840 $run ./try 2>/dev/null
28f5ac64 17841 code=$?
fbe73d74 17842 $from try.out
28f5ac64 17843 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
17844 fflushall="`$cat try.out`"
17845 fi
17846 fi
17847 $rm -f core try.core core.try.*
17848 case "$fflushall" in
17849 x) $cat >&4 <<EOM
17850Whew. Flushing explicitly all the stdio streams works.
17851EOM
17852 fflushall="$define"
17853 ;;
17854 '') $cat >&4 <<EOM
17855Sigh. Flushing explicitly all the stdio streams doesn't work.
17856EOM
17857 fflushall="$undef"
17858 ;;
17859 *) $cat >&4 <<EOM
17860Cannot figure out whether flushing stdio streams explicitly works or not.
17861I'm assuming it doesn't.
17862EOM
17863 fflushall="$undef"
17864 ;;
17865 esac
17866 ;;
17867 "$define"|true|[yY]*)
17868 fflushall="$define"
17869 ;;
17870 *)
17871 fflushall="$undef"
17872 ;;
17873 esac
17874 else
17875 $cat >&4 <<EOM
17876All is futile. Even fflush(stdin) clobbers input pipes!
17877EOM
17878 fflushall="$undef"
17879 fi
17880 else
17881 fflushall="$undef"
17882 fi
17883 $rm -f core tryp.c tryp.core core.tryp.*
17884 ;;
17885*) fflushall="$undef"
17886 ;;
17887esac
17888
17889case "$fflushNULL$fflushall" in
17890undefundef)
17891 $cat <<EOM
17892OK, I give up. I cannot figure out how to flush pending stdio output.
17893We won't be flushing handles at all before fork/exec/popen.
17894EOM
17895 ;;
17896esac
17897$rm -f try.* try$exe_ext
17898
17899: Store the full pathname to the ar program for use in the C program
17900: Respect a hint or command line value for full_ar.
17901case "$full_ar" in
17902'') full_ar=$ar ;;
17903esac
17904
17905: Store the full pathname to the sed program for use in the C program
17906full_sed=$sed
17907
17908: see what type gids are declared as in the kernel
17909echo " "
17910echo "Looking for the type for group ids returned by getgid()."
17911set gid_t gidtype xxx stdio.h sys/types.h
17912eval $typedef
17913case "$gidtype" in
17914xxx)
17915 xxx=`./findhdr sys/user.h`
17916 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17917 case $1 in
17918 unsigned) dflt="$1 $2" ;;
17919 *) dflt="$1" ;;
17920 esac
17921 ;;
17922*) dflt="$gidtype";;
17923esac
17924case "$gidtype" in
17925gid_t) echo "gid_t found." ;;
17926*) rp="What is the type for group ids returned by getgid()?"
17927 . ./myread
17928 gidtype="$ans"
17929 ;;
17930esac
17931
17932echo " "
17933case "$gidtype" in
17934*_t) zzz="$gidtype" ;;
17935*) zzz="gid" ;;
17936esac
17937echo "Checking the size of $zzz..." >&4
17938cat > try.c <<EOCP
17939#include <sys/types.h>
17940#include <stdio.h>
d1daaddf
JH
17941#$i_stdlib I_STDLIB
17942#ifdef I_STDLIB
17943#include <stdlib.h>
17944#endif
b4eb6b3d
JH
17945int main() {
17946 printf("%d\n", (int)sizeof($gidtype));
17947 exit(0);
17948}
17949EOCP
17950set try
17951if eval $compile_ok; then
5440bc8e 17952 yyy=`$run ./try`
b4eb6b3d
JH
17953 case "$yyy" in
17954 '') gidsize=4
17955 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17956 ;;
17957 *) gidsize=$yyy
17958 echo "Your $zzz is $gidsize bytes long."
17959 ;;
17960 esac
17961else
17962 gidsize=4
17963 echo "(I can't compile the test program--guessing $gidsize.)" >&4
17964fi
17965
17966
17967echo " "
17968case "$gidtype" in
17969*_t) zzz="$gidtype" ;;
17970*) zzz="gid" ;;
17971esac
17972echo "Checking the sign of $zzz..." >&4
17973cat > try.c <<EOCP
17974#include <sys/types.h>
17975#include <stdio.h>
17976int main() {
17977 $gidtype foo = -1;
17978 if (foo < 0)
17979 printf("-1\n");
17980 else
17981 printf("1\n");
17982}
17983EOCP
17984set try
17985if eval $compile; then
5440bc8e 17986 yyy=`$run ./try`
b4eb6b3d
JH
17987 case "$yyy" in
17988 '') gidsign=1
17989 echo "(I can't execute the test program--guessing unsigned.)" >&4
17990 ;;
17991 *) gidsign=$yyy
17992 case "$gidsign" in
17993 1) echo "Your $zzz is unsigned." ;;
17994 -1) echo "Your $zzz is signed." ;;
17995 esac
17996 ;;
17997 esac
17998else
17999 gidsign=1
18000 echo "(I can't compile the test program--guessing unsigned.)" >&4
18001fi
18002
18003
18004echo " "
18005
18006if $test X"$quadtype" != X; then
18007
18008echo "Checking how to print 64-bit integers..." >&4
18009
18010if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18011 $cat >try.c <<'EOCP'
18012#include <sys/types.h>
18013#include <stdio.h>
18014int main() {
18015 int q = 12345678901;
18016 printf("%ld\n", q);
18017}
18018EOCP
18019 set try
18020 if eval $compile; then
5440bc8e 18021 yyy=`$run ./try`
b4eb6b3d
JH
18022 case "$yyy" in
18023 12345678901)
18024 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18025 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18026 echo "We will use %d."
18027 ;;
18028 esac
18029 fi
18030fi
18031
18032if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18033 $cat >try.c <<'EOCP'
18034#include <sys/types.h>
18035#include <stdio.h>
18036int main() {
18037 long q = 12345678901;
18038 printf("%ld\n", q);
18039}
18040EOCP
18041 set try
18042 if eval $compile; then
5440bc8e 18043 yyy=`$run ./try`
b4eb6b3d
JH
18044 case "$yyy" in
18045 12345678901)
18046 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18047 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18048 echo "We will use %ld."
18049 ;;
18050 esac
18051 fi
18052fi
18053
18054if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18055 $cat >try.c <<'EOCP'
18056#include <sys/types.h>
18057#include <inttypes.h>
18058#include <stdio.h>
18059int main() {
18060 int64_t q = 12345678901;
18061 printf("%" PRId64 "\n", q);
18062}
18063EOCP
18064 set try
18065 if eval $compile; then
5440bc8e 18066 yyy=`$run ./try`
b4eb6b3d
JH
18067 case "$yyy" in
18068 12345678901)
18069 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18070 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18071 echo "We will use the C9X style."
18072 ;;
18073 esac
18074 fi
18075fi
18076
2ef53570
JH
18077if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18078 $cat >try.c <<EOCP
b4eb6b3d
JH
18079#include <sys/types.h>
18080#include <stdio.h>
18081int main() {
2ef53570
JH
18082 $quadtype q = 12345678901;
18083 printf("%Ld\n", q);
b4eb6b3d
JH
18084}
18085EOCP
18086 set try
18087 if eval $compile; then
5440bc8e 18088 yyy=`$run ./try`
b4eb6b3d
JH
18089 case "$yyy" in
18090 12345678901)
2ef53570
JH
18091 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18092 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18093 echo "We will use %Ld."
b4eb6b3d
JH
18094 ;;
18095 esac
18096 fi
18097fi
18098
2ef53570
JH
18099if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18100 $cat >try.c <<'EOCP'
b4eb6b3d
JH
18101#include <sys/types.h>
18102#include <stdio.h>
18103int main() {
2ef53570
JH
18104 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18105 printf("%lld\n", q);
b4eb6b3d
JH
18106}
18107EOCP
18108 set try
18109 if eval $compile; then
5440bc8e 18110 yyy=`$run ./try`
b4eb6b3d
JH
18111 case "$yyy" in
18112 12345678901)
2ef53570
JH
18113 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18114 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18115 echo "We will use the %lld style."
b4eb6b3d
JH
18116 ;;
18117 esac
18118 fi
18119fi
18120
18121if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18122 $cat >try.c <<EOCP
18123#include <sys/types.h>
18124#include <stdio.h>
18125int main() {
18126 $quadtype q = 12345678901;
18127 printf("%qd\n", q);
18128}
18129EOCP
18130 set try
18131 if eval $compile; then
5440bc8e 18132 yyy=`$run ./try`
b4eb6b3d
JH
18133 case "$yyy" in
18134 12345678901)
18135 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18136 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18137 echo "We will use %qd."
18138 ;;
18139 esac
18140 fi
18141fi
18142
18143if $test X"$sPRId64" = X; then
18144 echo "Cannot figure out how to print 64-bit integers." >&4
18145fi
18146
18147$rm -f try try.*
18148
18149fi
18150
18151case "$sPRId64" in
18152'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
18153 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
18154 ;;
18155*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
18156 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
18157 ;;
18158esac
18159
18160
18161echo " "
18162$echo "Checking the format strings to be used for Perl's internal types..." >&4
18163
18164if $test X"$ivsize" = X8; then
18165 ivdformat="$sPRId64"
18166 uvuformat="$sPRIu64"
18167 uvoformat="$sPRIo64"
18168 uvxformat="$sPRIx64"
18169 uvXUformat="$sPRIXU64"
18170else
18171 if $test X"$ivsize" = X"$longsize"; then
18172 ivdformat='"ld"'
18173 uvuformat='"lu"'
18174 uvoformat='"lo"'
18175 uvxformat='"lx"'
18176 uvXUformat='"lX"'
18177 else
18178 if $test X"$ivsize" = X"$intsize"; then
18179 ivdformat='"d"'
18180 uvuformat='"u"'
18181 uvoformat='"o"'
18182 uvxformat='"x"'
18183 uvXUformat='"X"'
18184 else
18185 : far out
18186 if $test X"$ivsize" = X"$shortsize"; then
18187 ivdformat='"hd"'
18188 uvuformat='"hu"'
18189 uvoformat='"ho"'
18190 uvxformat='"hx"'
18191 uvXUformat='"hX"'
18192 fi
18193 fi
18194 fi
18195fi
18196
18197if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18198 nveformat="$sPRIeldbl"
18199 nvfformat="$sPRIfldbl"
18200 nvgformat="$sPRIgldbl"
18201 nvEUformat="$sPRIEUldbl"
18202 nvFUformat="$sPRIFUldbl"
18203 nvGUformat="$sPRIGUldbl"
18204else
18205 nveformat='"e"'
18206 nvfformat='"f"'
18207 nvgformat='"g"'
18208 nvEUformat='"E"'
18209 nvFUformat='"F"'
18210 nvGUformat='"G"'
18211fi
18212
18213case "$ivdformat" in
3c728e00 18214'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
18215 exit 1
18216 ;;
18217esac
18218
18219
18220echo " "
18221$echo "Checking the format string to be used for gids..." >&4
18222
18223case "$gidsign" in
18224-1) if $test X"$gidsize" = X"$ivsize"; then
18225 gidformat="$ivdformat"
18226 else
18227 if $test X"$gidsize" = X"$longsize"; then
18228 gidformat='"ld"'
18229 else
18230 if $test X"$gidsize" = X"$intsize"; then
18231 gidformat='"d"'
18232 else
18233 if $test X"$gidsize" = X"$shortsize"; then
18234 gidformat='"hd"'
18235 fi
18236 fi
18237 fi
18238 fi
18239 ;;
18240*) if $test X"$gidsize" = X"$uvsize"; then
18241 gidformat="$uvuformat"
18242 else
18243 if $test X"$gidsize" = X"$longsize"; then
18244 gidformat='"lu"'
18245 else
18246 if $test X"$gidsize" = X"$intsize"; then
18247 gidformat='"u"'
18248 else
18249 if $test X"$gidsize" = X"$shortsize"; then
18250 gidformat='"hu"'
18251 fi
18252 fi
18253 fi
18254 fi
18255 ;;
18256esac
18257
18258: see if getgroups exists
18259set getgroups d_getgrps
18260eval $inlibc
18261
18262: see if setgroups exists
18263set setgroups d_setgrps
18264eval $inlibc
18265
18266
18267: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18268echo " "
18269case "$d_getgrps$d_setgrps" in
18270*define*)
18271 case "$groupstype" in
18272 '') dflt="$gidtype" ;;
18273 *) dflt="$groupstype" ;;
18274 esac
18275 $cat <<EOM
18276What type of pointer is the second argument to getgroups() and setgroups()?
18277Usually this is the same as group ids, $gidtype, but not always.
18278
18279EOM
18280 rp='What type pointer is the second argument to getgroups() and setgroups()?'
18281 . ./myread
18282 groupstype="$ans"
18283 ;;
18284*) groupstype="$gidtype";;
18285esac
18286
18287echo " "
18288echo "Checking if your $make program sets \$(MAKE)..." >&4
18289case "$make_set_make" in
18290'')
18291 $sed 's/^X //' > testmake.mak << 'EOF'
18292Xall:
18293X @echo 'maketemp="$(MAKE)"'
18294EOF
18295 case "`$make -f testmake.mak 2>/dev/null`" in
18296 *maketemp=*) make_set_make='#' ;;
18297 *) make_set_make="MAKE=$make" ;;
18298 esac
18299 $rm -f testmake.mak
18300 ;;
18301esac
18302case "$make_set_make" in
18303'#') echo "Yup, it does.";;
18304*) echo "Nope, it doesn't.";;
18305esac
18306
18307: see what type is used for mode_t
18308rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18309set mode_t modetype int stdio.h sys/types.h
18310eval $typedef_ask
18311
2cc61e15
DD
18312: see if stdarg is available
18313echo " "
18314if $test `./findhdr stdarg.h`; then
18315 echo "<stdarg.h> found." >&4
18316 valstd="$define"
18317else
18318 echo "<stdarg.h> NOT found." >&4
18319 valstd="$undef"
18320fi
18321
18322: see if varags is available
18323echo " "
18324if $test `./findhdr varargs.h`; then
18325 echo "<varargs.h> found." >&4
18326else
18327 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18328fi
18329
18330: set up the varargs testing programs
18331$cat > varargs.c <<EOP
18332#ifdef I_STDARG
18333#include <stdarg.h>
18334#endif
18335#ifdef I_VARARGS
18336#include <varargs.h>
18337#endif
18338
18339#ifdef I_STDARG
18340int f(char *p, ...)
18341#else
18342int f(va_alist)
18343va_dcl
18344#endif
18345{
18346 va_list ap;
18347#ifndef I_STDARG
18348 char *p;
18349#endif
18350#ifdef I_STDARG
18351 va_start(ap,p);
18352#else
18353 va_start(ap);
18354 p = va_arg(ap, char *);
18355#endif
18356 va_end(ap);
18357}
18358EOP
18359$cat > varargs <<EOP
18360$startsh
18361if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18362 echo "true"
18363else
18364 echo "false"
18365fi
18366$rm -f varargs$_o
18367EOP
18368chmod +x varargs
18369
18370: now check which varargs header should be included
18371echo " "
18372i_varhdr=''
18373case "$valstd" in
18374"$define")
18375 if `./varargs I_STDARG`; then
18376 val='stdarg.h'
18377 elif `./varargs I_VARARGS`; then
18378 val='varargs.h'
18379 fi
18380 ;;
18381*)
18382 if `./varargs I_VARARGS`; then
18383 val='varargs.h'
18384 fi
18385 ;;
18386esac
18387case "$val" in
18388'')
18389echo "I could not find the definition for va_dcl... You have problems..." >&4
18390 val="$undef"; set i_stdarg; eval $setvar
18391 val="$undef"; set i_varargs; eval $setvar
18392 ;;
18393*)
18394 set i_varhdr
18395 eval $setvar
18396 case "$i_varhdr" in
18397 stdarg.h)
18398 val="$define"; set i_stdarg; eval $setvar
18399 val="$undef"; set i_varargs; eval $setvar
18400 ;;
18401 varargs.h)
18402 val="$undef"; set i_stdarg; eval $setvar
18403 val="$define"; set i_varargs; eval $setvar
18404 ;;
18405 esac
18406 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18407esac
18408$rm -f varargs*
18409
18410: see if we need va_copy
18411echo " "
18412case "$i_stdarg" in
18413"$define")
18414 $cat >try.c <<EOCP
18415#include <stdarg.h>
18416#include <stdio.h>
85c8a686
DD
18417#$i_stdlib I_STDLIB
18418#ifdef I_STDLIB
18419#include <stdlib.h>
18420#endif
18421#include <signal.h>
2cc61e15
DD
18422
18423int
18424ivfprintf(FILE *f, const char *fmt, va_list *valp)
18425{
18426 return vfprintf(f, fmt, *valp);
18427}
18428
18429int
18430myvfprintf(FILE *f, const char *fmt, va_list val)
18431{
18432 return ivfprintf(f, fmt, &val);
18433}
18434
18435int
18436myprintf(char *fmt, ...)
18437{
18438 va_list val;
18439 va_start(val, fmt);
18440 return myvfprintf(stdout, fmt, val);
18441}
18442
18443int
18444main(int ac, char **av)
18445{
85c8a686
DD
18446 signal(SIGSEGV, exit);
18447
2cc61e15
DD
18448 myprintf("%s%cs all right, then\n", "that", '\'');
18449 exit(0);
18450}
18451EOCP
18452 set try
5440bc8e
JH
18453 if eval $compile && $run ./try 2>&1 >/dev/null; then
18454 case "`$run ./try`" in
2cc61e15
DD
18455 "that's all right, then")
18456 okay=yes
18457 ;;
18458 esac
18459 fi
18460 case "$okay" in
18461 yes) echo "It seems that you don't need va_copy()." >&4
18462 need_va_copy="$undef"
18463 ;;
18464 *) echo "It seems that va_copy() or similar will be needed." >&4
18465 need_va_copy="$define"
18466 ;;
18467 esac
18468 $rm -f try.* core core.* *.core *.core.*
18469 ;;
18470*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18471 ;;
18472esac
18473
b4eb6b3d
JH
18474: see what type is used for size_t
18475rp="What is the type used for the length parameter for string functions?"
18476set size_t sizetype 'unsigned int' stdio.h sys/types.h
18477eval $typedef_ask
18478
18479: check for type of arguments to gethostbyaddr.
18480if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18481 case "$d_gethbyaddr" in
18482 $define)
18483 $cat <<EOM
18484
18485Checking to see what type of arguments are accepted by gethostbyaddr().
18486EOM
18487 hdrs="$define sys/types.h
18488 $d_socket sys/socket.h
18489 $i_niin netinet/in.h
18490 $i_netdb netdb.h
18491 $i_unistd unistd.h"
18492 : The first arg can 'char *' or 'void *'
18493 : The second arg is some of integral type
18494 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18495 for yyy in size_t long int; do
18496 case "$netdb_host_type" in
18497 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18498 if ./protochk "$try" $hdrs; then
18499 echo "Your system accepts $xxx for the first arg."
18500 echo "...and $yyy for the second arg."
18501 netdb_host_type="$xxx"
18502 netdb_hlen_type="$yyy"
18503 fi
18504 ;;
18505 esac
18506 done
18507 done
18508 : In case none of those worked, prompt the user.
18509 case "$netdb_host_type" in
18510 '') rp='What is the type for the 1st argument to gethostbyaddr?'
18511 dflt='char *'
18512 . ./myread
18513 netdb_host_type=$ans
18514 rp='What is the type for the 2nd argument to gethostbyaddr?'
18515 dflt="$sizetype"
18516 . ./myread
18517 netdb_hlen_type=$ans
18518 ;;
18519 esac
18520 ;;
18521 *) : no gethostbyaddr, so pick harmless defaults
18522 netdb_host_type='char *'
18523 netdb_hlen_type="$sizetype"
18524 ;;
18525 esac
18526 # Remove the "const" if needed. -- but then we'll have a
18527 # prototype clash!
18528 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18529fi
18530
18531: check for type of argument to gethostbyname.
18532if test "X$netdb_name_type" = X ; then
18533 case "$d_gethbyname" in
18534 $define)
18535 $cat <<EOM
18536
18537Checking to see what type of argument is accepted by gethostbyname().
18538EOM
18539 hdrs="$define sys/types.h
18540 $d_socket sys/socket.h
18541 $i_niin netinet/in.h
18542 $i_netdb netdb.h
18543 $i_unistd unistd.h"
18544 for xxx in "const char *" "char *"; do
18545 case "$netdb_name_type" in
18546 '') try="extern struct hostent *gethostbyname($xxx);"
18547 if ./protochk "$try" $hdrs; then
18548 echo "Your system accepts $xxx."
18549 netdb_name_type="$xxx"
18550 fi
18551 ;;
18552 esac
18553 done
18554 : In case none of those worked, prompt the user.
18555 case "$netdb_name_type" in
18556 '') rp='What is the type for the 1st argument to gethostbyname?'
18557 dflt='char *'
18558 . ./myread
18559 netdb_name_type=$ans
18560 ;;
18561 esac
18562 ;;
18563 *) : no gethostbyname, so pick harmless default
18564 netdb_name_type='char *'
18565 ;;
18566 esac
18567fi
18568
18569: check for type of 1st argument to getnetbyaddr.
18570if test "X$netdb_net_type" = X ; then
18571 case "$d_getnbyaddr" in
18572 $define)
18573 $cat <<EOM
18574
18575Checking to see what type of 1st argument is accepted by getnetbyaddr().
18576EOM
18577 hdrs="$define sys/types.h
18578 $d_socket sys/socket.h
18579 $i_niin netinet/in.h
18580 $i_netdb netdb.h
18581 $i_unistd unistd.h"
18582 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
18583 case "$netdb_net_type" in
18584 '') try="extern struct netent *getnetbyaddr($xxx, int);"
18585 if ./protochk "$try" $hdrs; then
18586 echo "Your system accepts $xxx."
18587 netdb_net_type="$xxx"
18588 fi
18589 ;;
18590 esac
18591 done
18592 : In case none of those worked, prompt the user.
18593 case "$netdb_net_type" in
18594 '') rp='What is the type for the 1st argument to getnetbyaddr?'
18595 dflt='long'
18596 . ./myread
18597 netdb_net_type=$ans
18598 ;;
18599 esac
18600 ;;
18601 *) : no getnetbyaddr, so pick harmless default
18602 netdb_net_type='long'
18603 ;;
18604 esac
18605fi
18606: locate the preferred pager for this system
d604bb53 18607fn=f/
b4eb6b3d
JH
18608case "$pager" in
18609'')
18610 dflt=''
18611 case "$pg" in
18612 /*) dflt=$pg;;
18613 [a-zA-Z]:/*) dflt=$pg;;
18614 esac
18615 case "$more" in
18616 /*) dflt=$more;;
18617 [a-zA-Z]:/*) dflt=$more;;
18618 esac
18619 case "$less" in
18620 /*) dflt=$less;;
18621 [a-zA-Z]:/*) dflt=$less;;
18622 esac
18623 case "$dflt" in
18624 '') dflt=/usr/ucb/more;;
18625 esac
18626 ;;
d604bb53
JH
18627*) dflt="$pager"
18628 : Instruct ./getfile to trust the hinted or previous pager value,
18629 : even if it does not begin with a slash. For example, on os2,
18630 : pager might be cmd /c more. See comments in UU/getfile.
18631 fn="f/($pager)"
18632 ;;
b4eb6b3d
JH
18633esac
18634echo " "
b4eb6b3d
JH
18635rp='What pager is used on your system?'
18636. ./getfile
18637pager="$ans"
18638
18639: see what type pids are declared as in the kernel
18640rp="What is the type of process ids on this system?"
18641set pid_t pidtype int stdio.h sys/types.h
18642eval $typedef_ask
18643
18644: Find earliest binary compatible site_perl subdirectory perl can use.
d953f698 18645xs_apiversion=$version # The current site_perl version.
b4eb6b3d
JH
18646: Find earliest pure perl site_perl subdirectory perl can use.
18647: The versioned directories started at 5.005.
18648pm_apiversion='5.005'
18649
b4eb6b3d
JH
18650: see if ar generates random libraries by itself
18651echo " "
18652echo "Checking how to generate random libraries on your machine..." >&4
18653echo 'int bar1() { return bar2(); }' > bar1.c
18654echo 'int bar2() { return 2; }' > bar2.c
55954f19
JH
18655$cat > foo.c <<EOP
18656#$i_stdlib I_STDLIB
18657#ifdef I_STDLIB
18658#include <stdlib.h>
18659#endif
b4eb6b3d
JH
18660int main() { printf("%d\n", bar1()); exit(0); }
18661EOP
18662$cc $ccflags -c bar1.c >/dev/null 2>&1
18663$cc $ccflags -c bar2.c >/dev/null 2>&1
18664$cc $ccflags -c foo.c >/dev/null 2>&1
18665$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 18666if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 18667 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
18668 echo "$ar appears to generate random libraries itself."
18669 orderlib=false
18670 ranlib=":"
18671elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 18672 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 18673 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
18674 echo "a table of contents needs to be added with '$ar ts'."
18675 orderlib=false
18676 ranlib="$ar ts"
18677else
18678 case "$ranlib" in
18679 :) ranlib='';;
18680 '')
18681 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18682 $test -f $ranlib || ranlib=''
18683 ;;
18684 esac
18685 if $test -n "$ranlib"; then
18686 echo "your system has '$ranlib'; we'll use that."
18687 orderlib=false
18688 else
18689 echo "your system doesn't seem to support random libraries"
18690 echo "so we'll use lorder and tsort to order the libraries."
18691 orderlib=true
18692 ranlib=":"
18693 fi
18694fi
18695$rm -f foo* bar*
18696
18697: check for type of arguments to select.
18698case "$selecttype" in
18699'') case "$d_select" in
18700 $define)
18701 echo " "
18702 $cat <<EOM
18703Checking to see what type of arguments are accepted by select().
18704EOM
18705 hdrs="$define sys/types.h
18706 $i_systime sys/time.h
18707 $i_sysselct sys/select.h
18708 $d_socket sys/socket.h"
18709 : The first arg can be int, unsigned, or size_t
18710 : The last arg may or may not be 'const'
18711 val=''
18712 : void pointer has been seen but using that
18713 : breaks the selectminbits test
18714 for xxx in 'fd_set *' 'int *'; do
18715 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18716 for tmo in 'struct timeval *' 'const struct timeval *'; do
18717 case "$val" in
18718 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18719 if ./protochk "$try" $hdrs; then
18720 echo "Your system accepts $xxx."
18721 val="$xxx"
18722 fi
18723 ;;
18724 esac
18725 done
18726 done
18727 done
18728 case "$val" in
18729 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18730 case "$d_fd_set" in
18731 $define) dflt="fd_set *" ;;
18732 *) dflt="int *" ;;
18733 esac
18734 . ./myread
18735 val=$ans
18736 ;;
18737 esac
18738 selecttype="$val"
18739 ;;
18740 *) : no select, so pick a harmless default
18741 selecttype='int *'
18742 ;;
18743 esac
18744 ;;
18745esac
18746
18747: check for the select 'width'
18748case "$selectminbits" in
e6e7e605
JH
18749'') safebits=`expr $ptrsize \* 8`
18750 case "$d_select" in
b4eb6b3d
JH
18751 $define)
18752 $cat <<EOM
18753
18754Checking to see on how many bits at a time your select() operates...
18755EOM
18756 $cat >try.c <<EOCP
18757#include <sys/types.h>
18758#$i_time I_TIME
18759#$i_systime I_SYS_TIME
18760#$i_systimek I_SYS_TIME_KERNEL
18761#ifdef I_TIME
18762# include <time.h>
18763#endif
18764#ifdef I_SYS_TIME
18765# ifdef I_SYS_TIME_KERNEL
18766# define KERNEL
18767# endif
18768# include <sys/time.h>
18769# ifdef I_SYS_TIME_KERNEL
18770# undef KERNEL
18771# endif
18772#endif
18773#$i_sysselct I_SYS_SELECT
18774#ifdef I_SYS_SELECT
18775#include <sys/select.h>
18776#endif
18777#$d_socket HAS_SOCKET
18778#ifdef HAS_SOCKET
18779# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18780#endif
18781#include <stdio.h>
d1daaddf
JH
18782#$i_stdlib I_STDLIB
18783#ifdef I_STDLIB
18784#include <stdlib.h>
18785#endif
b4eb6b3d
JH
18786$selecttype b;
18787#define S sizeof(*(b))
18788#define MINBITS 64
18789#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18790#define NBITS (NBYTES * 8)
18791int main() {
e6e7e605 18792 char *s = malloc(NBYTES);
b4eb6b3d
JH
18793 struct timeval t;
18794 int i;
18795 FILE* fp;
18796 int fd;
18797
e6e7e605
JH
18798 if (!s)
18799 exit(1);
b4eb6b3d
JH
18800 fclose(stdin);
18801 fp = fopen("try.c", "r");
18802 if (fp == 0)
e6e7e605 18803 exit(2);
b4eb6b3d
JH
18804 fd = fileno(fp);
18805 if (fd < 0)
e6e7e605 18806 exit(3);
b4eb6b3d
JH
18807 b = ($selecttype)s;
18808 for (i = 0; i < NBITS; i++)
18809 FD_SET(i, b);
18810 t.tv_sec = 0;
18811 t.tv_usec = 0;
18812 select(fd + 1, b, 0, 0, &t);
18813 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
e6e7e605 18814 free(s);
b4eb6b3d
JH
18815 printf("%d\n", i + 1);
18816 return 0;
18817}
18818EOCP
18819 set try
18820 if eval $compile_ok; then
5440bc8e 18821 selectminbits=`$run ./try`
b4eb6b3d
JH
18822 case "$selectminbits" in
18823 '') cat >&4 <<EOM
18824Cannot figure out on how many bits at a time your select() operates.
e6e7e605 18825I'll play safe and guess it is $safebits bits.
b4eb6b3d 18826EOM
e6e7e605
JH
18827 selectminbits=$safebits
18828 bits="$safebits bits"
b4eb6b3d
JH
18829 ;;
18830 1) bits="1 bit" ;;
18831 *) bits="$selectminbits bits" ;;
18832 esac
18833 echo "Your select() operates on $bits at a time." >&4
18834 else
18835 rp='What is the minimum number of bits your select() operates on?'
18836 case "$byteorder" in
e6e7e605
JH
18837 12345678) dflt=64 ;;
18838 1234) dflt=32 ;;
b4eb6b3d
JH
18839 *) dflt=1 ;;
18840 esac
18841 . ./myread
18842 val=$ans
18843 selectminbits="$val"
18844 fi
18845 $rm -f try.* try
18846 ;;
18847 *) : no select, so pick a harmless default
e6e7e605 18848 selectminbits=$safebits
b4eb6b3d
JH
18849 ;;
18850 esac
18851 ;;
18852esac
18853
18854: Trace out the files included by signal.h, then look for SIGxxx names.
18855: Remove SIGARRAYSIZE used by HPUX.
18856: Remove SIGSTKSIZE used by Linux.
18857: Remove SIGSTKSZ used by Posix.
18858: Remove SIGTYP void lines used by OS2.
18859: Some cpps, like os390, dont give the file name anywhere
18860if [ "X$fieldn" = X ]; then
18861 : Just make some guesses. We check them later.
18862 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18863else
18864 xxx=`echo '#include <signal.h>' |
18865 $cppstdin $cppminus $cppflags 2>/dev/null |
18866 $grep '^[ ]*#.*include' |
a938a3bb 18867 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
18868fi
18869: Check this list of files to be sure we have parsed the cpp output ok.
18870: This will also avoid potentially non-existent files, such
18871: as ../foo/bar.h
18872xxxfiles=''
18873for xx in $xxx /dev/null ; do
18874 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18875done
18876: If we have found no files, at least try signal.h
18877case "$xxxfiles" in
18878'') xxxfiles=`./findhdr signal.h` ;;
18879esac
18880xxx=`awk '
18881$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18882 print substr($2, 4, 20)
18883}
18884$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18885 print substr($3, 4, 20)
18886}' $xxxfiles`
18887: Append some common names just in case the awk scan failed.
18888xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18889xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18890xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18891xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18892xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18893
18894: generate a few handy files for later
55954f19 18895$cat > signal.c <<EOCP
b4eb6b3d
JH
18896#include <sys/types.h>
18897#include <signal.h>
55954f19
JH
18898#$i_stdlib I_STDLIB
18899#ifdef I_STDLIB
18900#include <stdlib.h>
18901#endif
b4eb6b3d
JH
18902#include <stdio.h>
18903int main() {
18904
18905/* Strange style to avoid deeply-nested #if/#else/#endif */
18906#ifndef NSIG
18907# ifdef _NSIG
18908# define NSIG (_NSIG)
18909# endif
18910#endif
18911
18912#ifndef NSIG
18913# ifdef SIGMAX
18914# define NSIG (SIGMAX+1)
18915# endif
18916#endif
18917
18918#ifndef NSIG
18919# ifdef SIG_MAX
18920# define NSIG (SIG_MAX+1)
18921# endif
18922#endif
18923
18924#ifndef NSIG
18925# ifdef MAXSIG
18926# define NSIG (MAXSIG+1)
18927# endif
18928#endif
18929
18930#ifndef NSIG
18931# ifdef MAX_SIG
18932# define NSIG (MAX_SIG+1)
18933# endif
18934#endif
18935
18936#ifndef NSIG
18937# ifdef SIGARRAYSIZE
18938# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18939# endif
18940#endif
18941
18942#ifndef NSIG
18943# ifdef _sys_nsig
18944# define NSIG (_sys_nsig) /* Solaris 2.5 */
18945# endif
18946#endif
18947
18948/* Default to some arbitrary number that's big enough to get most
18949 of the common signals.
18950*/
18951#ifndef NSIG
18952# define NSIG 50
18953#endif
18954
18955printf("NSIG %d\n", NSIG);
18956
18957#ifndef JUST_NSIG
18958
18959EOCP
18960
18961echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18962{
18963 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 18964 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
18965 printf $1; printf ");\n"
18966 printf "#endif\n"
18967}
18968END {
18969 printf "#endif /* JUST_NSIG */\n";
18970 printf "exit(0);\n}\n";
18971}
18972' >>signal.c
18973$cat >signal.awk <<'EOP'
18974BEGIN { ndups = 0 }
65197d93 18975$1 ~ /^NSIG$/ { nsig = $2 }
1ebe1ffb 18976($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
18977 if ($2 > maxsig) { maxsig = $2 }
18978 if (sig_name[$2]) {
18979 dup_name[ndups] = $1
18980 dup_num[ndups] = $2
b4eb6b3d
JH
18981 ndups++
18982 }
1ebe1ffb 18983 else {
65197d93
JH
18984 sig_name[$2] = $1
18985 sig_num[$2] = $2
b4eb6b3d
JH
18986 }
18987}
18988END {
18989 if (nsig == 0) {
18990 nsig = maxsig + 1
18991 }
18992 printf("NSIG %d\n", nsig);
18993 for (n = 1; n < nsig; n++) {
18994 if (sig_name[n]) {
18995 printf("%s %d\n", sig_name[n], sig_num[n])
18996 }
18997 else {
18998 printf("NUM%d %d\n", n, n)
18999 }
19000 }
19001 for (n = 0; n < ndups; n++) {
19002 printf("%s %d\n", dup_name[n], dup_num[n])
19003 }
19004}
19005EOP
19006$cat >signal_cmd <<EOS
19007$startsh
19008if $test -s signal.lst; then
19009 echo "Using your existing signal.lst file"
19010 exit 0
19011fi
19012xxx="$xxx"
19013EOS
19014$cat >>signal_cmd <<'EOS'
19015
19016set signal
19017if eval $compile_ok; then
1eb9ad5b 19018 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
19019else
19020 echo "(I can't seem be able to compile the whole test program)" >&4
19021 echo "(I'll try it in little pieces.)" >&4
19022 set signal -DJUST_NSIG
19023 if eval $compile_ok; then
5440bc8e 19024 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
19025 $cat signal.nsg
19026 else
19027 echo "I can't seem to figure out how many signals you have." >&4
19028 echo "Guessing 50." >&4
19029 echo 'NSIG 50' > signal.nsg
19030 fi
19031 : Now look at all the signal names, one at a time.
19032 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19033 $cat > signal.c <<EOCP
19034#include <sys/types.h>
19035#include <signal.h>
19036#include <stdio.h>
19037int main() {
19038printf("$xx %d\n", SIG${xx});
19039return 0;
19040}
19041EOCP
19042 set signal
19043 if eval $compile; then
19044 echo "SIG${xx} found."
5440bc8e 19045 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
19046 else
19047 echo "SIG${xx} NOT found."
19048 fi
19049 done
19050 if $test -s signal.ls1; then
19051 $cat signal.nsg signal.ls1 |
65197d93 19052 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
19053 fi
19054
19055fi
19056if $test -s signal.lst; then
19057 :
19058else
19059 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19060 echo 'kill -l' >signal
19061 set X `csh -f <signal`
19062 $rm -f signal
19063 shift
19064 case $# in
19065 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19066 esac
19067 echo $@ | $tr ' ' $trnl | \
19068 $awk '{ printf "%s %d\n", $1, ++s; }
19069 END { printf "NSIG %d\n", ++s }' >signal.lst
19070fi
19071$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19072EOS
19073chmod a+x signal_cmd
19074$eunicefix signal_cmd
19075
19076: generate list of signal names
19077echo " "
19078case "$sig_name_init" in
19079'') doinit=yes ;;
19080*) case "$sig_num_init" in
19081 ''|*,*) doinit=yes ;;
19082 esac ;;
19083esac
19084case "$doinit" in
19085yes)
19086 echo "Generating a list of signal names and numbers..." >&4
19087 . ./signal_cmd
19088 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19089 sig_name=`$awk 'BEGIN { printf "ZERO " }
19090 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19091 sig_num=`$awk 'BEGIN { printf "0 " }
19092 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19093 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
19094 !/^NSIG/ { printf "\"%s\", ", $1 }
19095 END { printf "0\n" }' signal.lst`
19096 sig_num_init=`$awk 'BEGIN { printf "0, " }
19097 !/^NSIG/ { printf "%d, ", $2}
19098 END { printf "0\n"}' signal.lst`
19099 ;;
19100esac
19101echo "The following $sig_count signals are available:"
19102echo " "
19103echo $sig_name | $awk \
19104'BEGIN { linelen = 0 }
19105{
19106 for (i = 1; i <= NF; i++) {
19107 name = "SIG" $i " "
19108 linelen = linelen + length(name)
19109 if (linelen > 70) {
19110 printf "\n"
19111 linelen = length(name)
19112 }
19113 printf "%s", name
19114 }
19115 printf "\n"
19116}'
76d3c696 19117sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
19118$rm -f signal signal.c signal.awk signal.lst signal_cmd
19119
19120echo " "
19121case "$sizetype" in
19122*_t) zzz="$sizetype" ;;
19123*) zzz="filesize" ;;
19124esac
19125echo "Checking the size of $zzz..." >&4
19126cat > try.c <<EOCP
19127#include <sys/types.h>
19128#include <stdio.h>
d1daaddf
JH
19129#$i_stdlib I_STDLIB
19130#ifdef I_STDLIB
19131#include <stdlib.h>
19132#endif
b4eb6b3d
JH
19133int main() {
19134 printf("%d\n", (int)sizeof($sizetype));
19135 exit(0);
19136}
19137EOCP
19138set try
19139if eval $compile_ok; then
5440bc8e 19140 yyy=`$run ./try`
b4eb6b3d
JH
19141 case "$yyy" in
19142 '') sizesize=4
19143 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19144 ;;
19145 *) sizesize=$yyy
19146 echo "Your $zzz size is $sizesize bytes."
19147 ;;
19148 esac
19149else
19150 sizesize=4
19151 echo "(I can't compile the test program--guessing $sizesize.)" >&4
19152fi
19153
19154
19155: check for socklen_t
19156echo " "
19157echo "Checking to see if you have socklen_t..." >&4
19158$cat >try.c <<EOCP
19159#include <sys/types.h>
19160#$d_socket HAS_SOCKET
19161#ifdef HAS_SOCKET
19162#include <sys/socket.h>
19163#endif
19164int main() { socklen_t x = 16; }
19165EOCP
19166set try
19167if eval $compile; then
19168 val="$define"
19169 echo "You have socklen_t."
19170else
19171 val="$undef"
19172 echo "You do not have socklen_t."
19173 case "$sizetype" in
19174 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19175 esac
19176fi
19177$rm -f try try.*
19178set d_socklen_t
19179eval $setvar
19180
a7710f8d
JH
19181: see if this is a socks.h system
19182set socks.h i_socks
19183eval $inhdr
19184
b4eb6b3d
JH
19185: check for type of the size argument to socket calls
19186case "$d_socket" in
19187"$define")
19188 $cat <<EOM
19189
19190Checking to see what type is the last argument of accept().
19191EOM
b4eb6b3d
JH
19192 yyy=''
19193 case "$d_socklen_t" in
19194 "$define") yyy="$yyy socklen_t"
19195 esac
19196 yyy="$yyy $sizetype int long unsigned"
19197 for xxx in $yyy; do
19198 case "$socksizetype" in
19199 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
19200 case "$usesocks" in
19201 "$define")
19202 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19203 echo "Your system accepts '$xxx *' for the last argument of accept()."
19204 socksizetype="$xxx"
19205 fi
19206 ;;
19207 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
19208 echo "Your system accepts '$xxx *' for the last argument of accept()."
19209 socksizetype="$xxx"
19210 fi
19211 ;;
19212 esac
b4eb6b3d
JH
19213 ;;
19214 esac
19215 done
19216: In case none of those worked, prompt the user.
19217 case "$socksizetype" in
19218 '') rp='What is the type for socket address structure sizes?'
19219 dflt='int'
19220 . ./myread
19221 socksizetype=$ans
19222 ;;
19223 esac
19224 ;;
19225*) : no sockets, so pick relatively harmless default
19226 socksizetype='int'
19227 ;;
19228esac
19229
19230: see what type is used for signed size_t
19231set ssize_t ssizetype int stdio.h sys/types.h
19232eval $typedef
19233dflt="$ssizetype"
5440bc8e 19234$cat > try.c <<EOM
b4eb6b3d 19235#include <stdio.h>
d1daaddf
JH
19236#$i_stdlib I_STDLIB
19237#ifdef I_STDLIB
19238#include <stdlib.h>
19239#endif
b4eb6b3d
JH
19240#include <sys/types.h>
19241#define Size_t $sizetype
19242#define SSize_t $dflt
19243int main()
19244{
19245 if (sizeof(Size_t) == sizeof(SSize_t))
19246 printf("$dflt\n");
19247 else if (sizeof(Size_t) == sizeof(int))
19248 printf("int\n");
19249 else
19250 printf("long\n");
19251 exit(0);
19252}
19253EOM
19254echo " "
5440bc8e
JH
19255set try
19256if eval $compile_ok && $run ./try > /dev/null; then
19257 ssizetype=`$run ./try`
b4eb6b3d
JH
19258 echo "I'll be using $ssizetype for functions returning a byte count." >&4
19259else
19260 $cat >&4 <<EOM
19261Help! I can't compile and run the ssize_t test program: please enlighten me!
19262(This is probably a misconfiguration in your system or libraries, and
19263you really ought to fix it. Still, I'll try anyway.)
19264
19265I need a type that is the same size as $sizetype, but is guaranteed to
19266be signed. Common values are ssize_t, int and long.
19267
19268EOM
19269 rp="What signed type is the same size as $sizetype?"
19270 . ./myread
19271 ssizetype="$ans"
19272fi
5440bc8e 19273$rm -f try try.*
b4eb6b3d
JH
19274
19275: see what type of char stdio uses.
19276echo " "
aa517f50
JH
19277echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
19278if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
19279 echo "Your stdio uses unsigned chars." >&4
19280 stdchar="unsigned char"
19281else
aa517f50
JH
19282 echo "Your stdio uses signed chars." >&4
19283 stdchar="char"
b4eb6b3d 19284fi
aa517f50
JH
19285$rm -f stdioh
19286
19287
b4eb6b3d 19288
b4eb6b3d
JH
19289: see what type uids are declared as in the kernel
19290echo " "
19291echo "Looking for the type for user ids returned by getuid()."
19292set uid_t uidtype xxx stdio.h sys/types.h
19293eval $typedef
19294case "$uidtype" in
19295xxx)
19296 xxx=`./findhdr sys/user.h`
19297 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19298 case $1 in
19299 unsigned) dflt="$1 $2" ;;
19300 *) dflt="$1" ;;
19301 esac
19302 ;;
19303*) dflt="$uidtype";;
19304esac
19305case "$uidtype" in
19306uid_t) echo "uid_t found." ;;
19307*) rp="What is the type for user ids returned by getuid()?"
19308 . ./myread
19309 uidtype="$ans"
19310 ;;
19311esac
19312
19313echo " "
19314case "$uidtype" in
19315*_t) zzz="$uidtype" ;;
19316*) zzz="uid" ;;
19317esac
19318echo "Checking the size of $zzz..." >&4
19319cat > try.c <<EOCP
19320#include <sys/types.h>
19321#include <stdio.h>
d1daaddf
JH
19322#$i_stdlib I_STDLIB
19323#ifdef I_STDLIB
19324#include <stdlib.h>
19325#endif
b4eb6b3d
JH
19326int main() {
19327 printf("%d\n", (int)sizeof($uidtype));
19328 exit(0);
19329}
19330EOCP
19331set try
19332if eval $compile_ok; then
5440bc8e 19333 yyy=`$run ./try`
b4eb6b3d
JH
19334 case "$yyy" in
19335 '') uidsize=4
19336 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19337 ;;
19338 *) uidsize=$yyy
19339 echo "Your $zzz is $uidsize bytes long."
19340 ;;
19341 esac
19342else
19343 uidsize=4
19344 echo "(I can't compile the test program--guessing $uidsize.)" >&4
19345fi
19346
19347echo " "
19348case "$uidtype" in
19349*_t) zzz="$uidtype" ;;
19350*) zzz="uid" ;;
19351esac
19352echo "Checking the sign of $zzz..." >&4
19353cat > try.c <<EOCP
19354#include <sys/types.h>
19355#include <stdio.h>
19356int main() {
19357 $uidtype foo = -1;
19358 if (foo < 0)
19359 printf("-1\n");
19360 else
19361 printf("1\n");
19362}
19363EOCP
19364set try
19365if eval $compile; then
5440bc8e 19366 yyy=`$run ./try`
b4eb6b3d
JH
19367 case "$yyy" in
19368 '') uidsign=1
19369 echo "(I can't execute the test program--guessing unsigned.)" >&4
19370 ;;
19371 *) uidsign=$yyy
19372 case "$uidsign" in
19373 1) echo "Your $zzz is unsigned." ;;
19374 -1) echo "Your $zzz is signed." ;;
19375 esac
19376 ;;
19377 esac
19378else
19379 uidsign=1
19380 echo "(I can't compile the test program--guessing unsigned.)" >&4
19381fi
19382
19383
19384
19385echo " "
19386$echo "Checking the format string to be used for uids..." >&4
19387
19388case "$uidsign" in
19389-1) if $test X"$uidsize" = X"$ivsize"; then
19390 uidformat="$ivdformat"
19391 else
19392 if $test X"$uidsize" = X"$longsize"; then
19393 uidformat='"ld"'
19394 else
19395 if $test X"$uidsize" = X"$intsize"; then
19396 uidformat='"d"'
19397 else
19398 if $test X"$uidsize" = X"$shortsize"; then
19399 uidformat='"hd"'
19400 fi
19401 fi
19402 fi
19403 fi
19404 ;;
19405*) if $test X"$uidsize" = X"$uvsize"; then
19406 uidformat="$uvuformat"
19407 else
19408 if $test X"$uidsize" = X"$longsize"; then
19409 uidformat='"lu"'
19410 else
19411 if $test X"$uidsize" = X"$intsize"; then
19412 uidformat='"u"'
19413 else
19414 if $test X"$uidsize" = X"$shortsize"; then
19415 uidformat='"hu"'
19416 fi
19417 fi
19418 fi
19419 fi
19420 ;;
19421esac
19422
3659ebf1
JH
19423: determine compiler compiler
19424case "$yacc" in
19425'')
19426 dflt=yacc;;
19427*)
19428 dflt="$yacc";;
19429esac
19430echo " "
19431comp='yacc'
3c728e00 19432if $test -f "$byacc$_exe"; then
3659ebf1
JH
19433 dflt="$byacc"
19434 comp="byacc or $comp"
19435fi
3c728e00 19436if $test -f "$bison$_exe"; then
3659ebf1
JH
19437 comp="$comp or bison -y"
19438fi
19439rp="Which compiler compiler ($comp) shall I use?"
19440. ./myread
19441yacc="$ans"
19442case "$yacc" in
19443*bis*)
19444 case "$yacc" in
19445 *-y*) ;;
19446 *)
19447 yacc="$yacc -y"
19448 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19449 ;;
19450 esac
19451 ;;
19452esac
19453
758a5d79
JH
19454: see if this is a fp.h system
19455set fp.h i_fp
19456eval $inhdr
19457
19458: see if this is a fp_class.h system
19459set fp_class.h i_fp_class
19460eval $inhdr
19461
b4eb6b3d 19462: see if this is a ieeefp.h system
b5b9f165
JH
19463case "$i_ieeefp" in
19464'' ) set ieeefp.h i_ieeefp
19465 eval $inhdr
19466 ;;
19467esac
b4eb6b3d
JH
19468
19469: see if this is a libutil.h system
19470set libutil.h i_libutil
19471eval $inhdr
19472
b4eb6b3d
JH
19473: see if mach cthreads are available
19474if test "X$usethreads" = "X$define"; then
19475 set mach/cthreads.h i_machcthr
19476 eval $inhdr
19477else
19478 i_machcthr="$undef"
19479fi
19480
19481
19482
19483: see if this is a math.h system
19484set math.h i_math
19485eval $inhdr
19486
19487: see if this is a mntent.h system
19488set mntent.h i_mntent
19489eval $inhdr
19490
19491: see if ndbm.h is available
19492set ndbm.h t_ndbm
19493eval $inhdr
1c6861ad
JS
19494
19495case "$t_ndbm" in
19496$undef)
19497 # Some Linux distributions such as RedHat 7.1 put the
19498 # ndbm.h header in /usr/include/gdbm/ndbm.h.
19499 if $test -f /usr/include/gdbm/ndbm.h; then
d11b91bf 19500 echo '<gdbm/ndbm.h> found.'
1c6861ad
JS
19501 ccflags="$ccflags -I/usr/include/gdbm"
19502 cppflags="$cppflags -I/usr/include/gdbm"
19503 t_ndbm=$define
19504 fi
19505 ;;
19506esac
19507
b4eb6b3d
JH
19508case "$t_ndbm" in
19509$define)
19510 : see if dbm_open exists
19511 set dbm_open d_dbm_open
19512 eval $inlibc
19513 case "$d_dbm_open" in
19514 $undef)
19515 t_ndbm="$undef"
19516 echo "We won't be including <ndbm.h>"
19517 ;;
19518 esac
19519 ;;
19520esac
19521val="$t_ndbm"
19522set i_ndbm
19523eval $setvar
19524
19525: see if net/errno.h is available
19526val=''
19527set net/errno.h val
19528eval $inhdr
19529
19530: Unfortunately, it causes problems on some systems. Arrgh.
19531case "$val" in
19532$define)
19533 cat > try.c <<'EOM'
19534#include <stdio.h>
19535#include <errno.h>
19536#include <net/errno.h>
19537int func()
19538{
19539 return ENOTSOCK;
19540}
19541EOM
19542 if $cc $ccflags -c try.c >/dev/null 2>&1; then
19543 echo "We'll be including <net/errno.h>." >&4
19544 else
19545 echo "We won't be including <net/errno.h>." >&4
19546 val="$undef"
19547 fi
19548 $rm -f try.* try
19549 ;;
19550esac
19551set i_neterrno
19552eval $setvar
19553
19554: see if netinet/tcp.h is available
19555set netinet/tcp.h i_netinettcp
19556eval $inhdr
19557
19558: see if this is a poll.h system
19559set poll.h i_poll
19560eval $inhdr
19561
19562: see if this is a prot.h system
19563set prot.h i_prot
19564eval $inhdr
19565
19566echo " "
19567$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
19568$cat <<'EOSH' > Cppsym.know
19569a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
19570AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
d46c9a2d
JH
19571alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
19572ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
19573BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
19574BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
19575bull c cadmus clipper CMU COFF COMPILER_VERSION
19576concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
19577CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
19578Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
19579FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
19580GLIBC GLIBC_MINOR
19581GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
19582H3050R H3050RX hbullx20 hcx host_mips
19583hp200 hp300 hp700 HP700 hp800 hp9000
19584hp9000s200 hp9000s300 hp9000s400 hp9000s500
19585hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
19586i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 19587IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
19588INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
19589LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
19590LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
19591Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
19592LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
19593M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
19594M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
19595M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
19596MATH_HAS_NO_SIDE_EFFECTS
19597mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
19598mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
19599mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
19600MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
19601mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
19602NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 19603news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
19604ns32016 ns32332 ns32k nsc32000
19605OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
19606pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
19607pc532 pdp11 PGC PIC plexus PORTAR posix
19608POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
19609POSIX_C_SOURCE POSIX_SOURCE POWER
19610PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 19611riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
19612SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
19613sony sony_news sonyrisc sparc sparclite spectrum
19614stardent stdc STDC_EXT stratos sun sun3 sun386
19615Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
19616SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
19617SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
19618sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 19619TM3200 TM5400 TM5600
b4eb6b3d
JH
19620tower tower32 tower32_200 tower32_600 tower32_700
19621tower32_800 tower32_850 tss
19622u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
19623ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
19624unix UNIX95 UNIX99 unixpc unos
19625USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
19626USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
19627USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
19628USGr4 USGr4_2
b4eb6b3d
JH
19629Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
19630XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
19631XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
19632z8000
19633EOSH
19634# Maybe put other stuff here too.
19635cat <<EOSH >>Cppsym.know
19636$osname
19637EOSH
19638./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
19639./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
19640$cat Cppsym.know > Cppsym.c
381aa1ff 19641$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
19642$rm -f Cppsym.a Cppsym.b Cppsym.c
19643cat <<EOSH > Cppsym
19644$startsh
19645if $test \$# -gt 0; then
19646 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
19647 if $test -s Cppsym.got; then
19648 $rm -f Cppsym.got
19649 exit 0
19650 fi
19651 $rm -f Cppsym.got
19652 exit 1
19653else
19654 $tr " " "$trnl" | ./Cppsym.try
19655 exit 0
19656fi
19657EOSH
19658chmod +x Cppsym
19659$eunicefix Cppsym
19660cat <<EOSH > Cppsym.try
19661$startsh
19662cat <<'EOCP' > try.c
19663#include <stdio.h>
19664int main() {
19665EOCP
19666$awk \\
19667EOSH
19668cat <<'EOSH' >> Cppsym.try
19669'length($1) > 0 {
2ef53570
JH
19670 printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19671 printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19672 printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19673 printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", (long)__%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
b4eb6b3d 19674}' >> try.c
2ef53570 19675echo 'return 0;}' >> try.c
b4eb6b3d
JH
19676EOSH
19677cat <<EOSH >> Cppsym.try
19678ccflags="$ccflags"
19679case "$osname-$gccversion" in
19680irix-) ccflags="\$ccflags -woff 1178" ;;
19681os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
19682esac
5440bc8e 19683$cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
b4eb6b3d
JH
19684EOSH
19685chmod +x Cppsym.try
19686$eunicefix Cppsym.try
19687./Cppsym < Cppsym.know > Cppsym.true
19688: now check the C compiler for additional symbols
19689postprocess_cc_v=''
19690case "$osname" in
19691aix) postprocess_cc_v="|$tr , ' '" ;;
19692esac
19693$cat >ccsym <<EOS
19694$startsh
19695$cat >tmp.c <<EOF
19696extern int foo;
19697EOF
19698for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19699do
19700 case "\$i" in
19701 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 19702 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
19703 esac
19704done
19705$rm -f try.c
19706EOS
19707postprocess_cc_v=''
19708chmod +x ccsym
19709$eunicefix ccsym
19710./ccsym > ccsym1.raw
19711if $test -s ccsym1.raw; then
19712 $sort ccsym1.raw | $uniq >ccsym.raw
19713else
19714 mv ccsym1.raw ccsym.raw
19715fi
19716
19717$awk '/\=/ { print $0; next }
19718 { print $0"=1" }' ccsym.raw >ccsym.list
19719$awk '/\=/ { print $0; next }
19720 { print $0"=1" }' Cppsym.true >ccsym.true
19721$comm -13 ccsym.true ccsym.list >ccsym.own
19722$comm -12 ccsym.true ccsym.list >ccsym.com
19723$comm -23 ccsym.true ccsym.list >ccsym.cpp
19724also=''
19725if $test -z ccsym.raw; then
19726 echo "Your C compiler doesn't seem to define any symbols!" >&4
19727 echo " "
19728 echo "However, your C preprocessor defines the following symbols:"
19729 $cat Cppsym.true
19730 ccsymbols=''
19731 cppsymbols=`$cat Cppsym.true`
19732 cppsymbols=`echo $cppsymbols`
19733 cppccsymbols="$cppsymbols"
19734else
19735 if $test -s ccsym.com; then
19736 echo "Your C compiler and pre-processor define these symbols:"
19737 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19738 also='also '
19739 symbols='ones'
19740 cppccsymbols=`$cat ccsym.com`
19741 cppccsymbols=`echo $cppccsymbols`
19742 $test "$silent" || sleep 1
19743 fi
19744 if $test -s ccsym.cpp; then
19745 $test "$also" && echo " "
19746 echo "Your C pre-processor ${also}defines the following symbols:"
19747 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19748 also='further '
19749 cppsymbols=`$cat ccsym.cpp`
19750 cppsymbols=`echo $cppsymbols`
19751 $test "$silent" || sleep 1
19752 fi
19753 if $test -s ccsym.own; then
19754 $test "$also" && echo " "
19755 echo "Your C compiler ${also}defines the following cpp symbols:"
19756 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19757 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19758 ccsymbols=`$cat ccsym.own`
19759 ccsymbols=`echo $ccsymbols`
19760 $test "$silent" || sleep 1
19761 fi
19762fi
b4eb6b3d
JH
19763
19764: see if this is a termio system
19765val="$undef"
19766val2="$undef"
19767val3="$undef"
19768if $test `./findhdr termios.h`; then
19769 set tcsetattr i_termios
19770 eval $inlibc
19771 val3="$i_termios"
19772fi
19773echo " "
19774case "$val3" in
19775"$define") echo "You have POSIX termios.h... good!" >&4;;
19776*) if ./Cppsym pyr; then
19777 case "`/bin/universe`" in
19778 ucb) if $test `./findhdr sgtty.h`; then
19779 val2="$define"
19780 echo "<sgtty.h> found." >&4
19781 else
19782 echo "System is pyramid with BSD universe."
19783 echo "<sgtty.h> not found--you could have problems." >&4
19784 fi;;
19785 *) if $test `./findhdr termio.h`; then
19786 val="$define"
19787 echo "<termio.h> found." >&4
19788 else
19789 echo "System is pyramid with USG universe."
19790 echo "<termio.h> not found--you could have problems." >&4
19791 fi;;
19792 esac
19793 elif ./usg; then
19794 if $test `./findhdr termio.h`; then
19795 echo "<termio.h> found." >&4
19796 val="$define"
19797 elif $test `./findhdr sgtty.h`; then
19798 echo "<sgtty.h> found." >&4
19799 val2="$define"
19800 else
19801echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19802 fi
19803 else
19804 if $test `./findhdr sgtty.h`; then
19805 echo "<sgtty.h> found." >&4
19806 val2="$define"
19807 elif $test `./findhdr termio.h`; then
19808 echo "<termio.h> found." >&4
19809 val="$define"
19810 else
19811echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19812 fi
19813 fi;;
19814esac
19815set i_termio; eval $setvar
19816val=$val2; set i_sgtty; eval $setvar
19817val=$val3; set i_termios; eval $setvar
19818
b4eb6b3d
JH
19819: see if stddef is available
19820set stddef.h i_stddef
19821eval $inhdr
923fc586 19822
b4eb6b3d
JH
19823: see if this is a sunmath.h system
19824set sunmath.h i_sunmath
19825eval $inhdr
5f80c64f 19826
b4eb6b3d
JH
19827: see if sys/access.h is available
19828set sys/access.h i_sysaccess
19829eval $inhdr
19830
19831: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19832set sys/filio.h i_sysfilio
19833eval $inhdr
19834echo " "
19835if $test `./findhdr sys/ioctl.h`; then
19836 val="$define"
19837 echo '<sys/ioctl.h> found.' >&4
19838else
19839 val="$undef"
19840 if $test $i_sysfilio = "$define"; then
19841 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 19842 else
b4eb6b3d
JH
19843 $test $i_sgtty = "$define" && xxx="sgtty.h"
19844 $test $i_termio = "$define" && xxx="termio.h"
19845 $test $i_termios = "$define" && xxx="termios.h"
19846echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19847 fi
19848fi
19849set i_sysioctl
19850eval $setvar
19851
49a78c82
JH
19852: see if socket ioctl defs are in sys/sockio.h
19853echo " "
19854xxx=`./findhdr sys/sockio.h`
19855if $test "$xxx"; then
19856 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19857 val="$define"
19858 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19859 else
19860 val="$undef"
19861 echo "No socket ioctls found in <sys/sockio.h>." >&4
19862 fi
19863else
19864 val="$undef"
19865 $cat <<EOM
19866<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19867EOM
19868fi
19869set i_syssockio
19870eval $setvar
19871
b4eb6b3d
JH
19872
19873: see if this is a syslog.h system
19874set syslog.h i_syslog
19875eval $inhdr
19876
19877
19878: see if this is a sys/mode.h system
19879set sys/mode.h i_sysmode
19880eval $inhdr
19881
19882: see if sys/resource.h has to be included
19883set sys/resource.h i_sysresrc
19884eval $inhdr
19885
19886: see if sys/security.h is available
19887set sys/security.h i_syssecrt
19888eval $inhdr
19889
19890: see if this is a sys/statvfs.h system
19891set sys/statvfs.h i_sysstatvfs
19892eval $inhdr
19893
b4eb6b3d
JH
19894: see if this is a sys/un.h system
19895set sys/un.h i_sysun
19896eval $inhdr
19897
19898
19899: see if this is a sys/utsname.h system
19900set sys/utsname.h i_sysutsname
19901eval $inhdr
19902
19903: see if this is a syswait system
19904set sys/wait.h i_syswait
19905eval $inhdr
19906
19907: see if this is a ustat.h system
19908set ustat.h i_ustat
19909eval $inhdr
19910
19911: see if this is an utime system
19912set utime.h i_utime
19913eval $inhdr
19914
19915: see if this is a values.h system
19916set values.h i_values
19917eval $inhdr
19918
19919: see if this is a vfork system
19920case "$d_vfork" in
19921"$define")
19922 set vfork.h i_vfork
19923 eval $inhdr
19924 ;;
19925*)
19926 i_vfork="$undef"
19927 ;;
19928esac
19929
19930: see if gdbm.h is available
19931set gdbm.h t_gdbm
19932eval $inhdr
19933case "$t_gdbm" in
19934$define)
19935 : see if gdbm_open exists
19936 set gdbm_open d_gdbm_open
19937 eval $inlibc
19938 case "$d_gdbm_open" in
19939 $undef)
19940 t_gdbm="$undef"
19941 echo "We won't be including <gdbm.h>"
5f80c64f 19942 ;;
b4eb6b3d
JH
19943 esac
19944 ;;
19945esac
19946val="$t_gdbm"
19947set i_gdbm
19948eval $setvar
19949
19950echo " "
19951echo "Looking for extensions..." >&4
19952: If we are using the old config.sh, known_extensions may contain
19953: old or inaccurate or duplicate values.
19954known_extensions=''
19955nonxs_extensions=''
19956: We do not use find because it might not be available.
19957: We do not just use MANIFEST because the user may have dropped
19958: some additional extensions into the source tree and expect them
19959: to be built.
19960
19961: Function to recursively find available extensions, ignoring DynaLoader
19962: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19963find_extensions='
19964 for xxx in *; do
19965 case "$xxx" in
19966 DynaLoader|dynaload) ;;
19967 *)
19968 if $test -f $xxx/$xxx.xs; then
19969 known_extensions="$known_extensions $1$xxx";
19970 elif $test -f $xxx/Makefile.PL; then
19971 nonxs_extensions="$nonxs_extensions $1$xxx";
19972 else
19973 if $test -d $xxx -a $# -lt 10; then
19974 set $1$xxx/ $*;
6904989c 19975 cd "$xxx";
b4eb6b3d
JH
19976 eval $find_extensions;
19977 cd ..;
19978 shift;
19979 fi;
19980 fi
19981 ;;
19982 esac;
19983 done'
19984tdir=`pwd`
6904989c 19985cd "$rsrc/ext"
b4eb6b3d
JH
19986set X
19987shift
19988eval $find_extensions
4e1a6d26
AD
19989# Special case: Add in threads/shared since it is not picked up by the
19990# recursive find above (and adding in general recursive finding breaks
19991# SDBM_File/sdbm). A.D. 10/25/2001.
998b396c 19992known_extensions="$known_extensions threads/shared"
b4eb6b3d
JH
19993set X $nonxs_extensions
19994shift
19995nonxs_extensions="$*"
19996set X $known_extensions
19997shift
19998known_extensions="$*"
6904989c 19999cd "$tdir"
b4eb6b3d
JH
20000
20001: Now see which are supported on this system.
20002avail_ext=''
20003for xxx in $known_extensions ; do
20004 case "$xxx" in
20005 DB_File|db_file)
20006 case "$i_db" in
20007 $define) avail_ext="$avail_ext $xxx" ;;
20008 esac
20009 ;;
20010 GDBM_File|gdbm_fil)
20011 case "$i_gdbm" in
20012 $define) avail_ext="$avail_ext $xxx" ;;
20013 esac
20014 ;;
1d59c593 20015 I18N/Langinfo|i18n_lan)
4bbcc6e8
JH
20016 case "$i_langinfo$d_nl_langinfo" in
20017 $define$define) avail_ext="$avail_ext $xxx" ;;
20018 esac
20019 ;;
b4eb6b3d
JH
20020 NDBM_File|ndbm_fil)
20021 case "$i_ndbm" in
20022 $define)
20023 case "$osname-$use64bitint" in
0be9fa5d 20024 hpux-define)
b4eb6b3d
JH
20025 case "$libs" in
20026 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20027 esac
20028 ;;
20029 *) avail_ext="$avail_ext $xxx" ;;
20030 esac
20031 ;;
20032 esac
20033 ;;
20034 ODBM_File|odbm_fil)
20035 case "${i_dbm}${i_rpcsvcdbm}" in
20036 *"${define}"*)
20037 case "$osname-$use64bitint" in
0be9fa5d 20038 hpux-define)
b4eb6b3d
JH
20039 case "$libs" in
20040 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20041 esac
20042 ;;
20043 *) avail_ext="$avail_ext $xxx" ;;
20044 esac
20045 ;;
20046 esac
20047 ;;
20048 POSIX|posix)
20049 case "$useposix" in
20050 true|define|y) avail_ext="$avail_ext $xxx" ;;
20051 esac
20052 ;;
20053 Opcode|opcode)
20054 case "$useopcode" in
20055 true|define|y) avail_ext="$avail_ext $xxx" ;;
20056 esac
20057 ;;
20058 Socket|socket)
20059 case "$d_socket" in
4a9f028c
JH
20060 true|$define|y)
20061 case "$osname" in
20062 beos) ;; # not unless BONE
20063 *) avail_ext="$avail_ext $xxx" ;;
20064 esac
20065 ;;
b4eb6b3d
JH
20066 esac
20067 ;;
20068 Sys/Syslog|sys/syslog)
20069 : XXX syslog requires socket
20070 case "$d_socket" in
20071 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20072 esac
20073 ;;
20074 Thread|thread)
b00ec89b
AB
20075 case "$usethreads" in
20076 true|$define|y)
20077 case "$useithreads" in
20078 $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20079 esac
b4eb6b3d
JH
20080 esac
20081 ;;
f9b6ed1c
AD
20082 XS/APItest|xs/apitest)
20083 # This is just for testing. Skip it unless we have dynamic loading.
20084
20085 case "$usedl" in
20086 $define) avail_ext="$avail_ext $xxx" ;;
20087 esac
20088 ;;
20089 XS/Typemap|xs/typemap)
20090 # This is just for testing. Skip it unless we have dynamic loading.
20091 case "$usedl" in
20092 $define) avail_ext="$avail_ext $xxx" ;;
20093 esac
20094 ;;
7deadc5f 20095 threads|threads/shared)
73e09c8f
JH
20096 # threads and threads::shared are special cases.
20097 # To stop people from asking "Perl 5.8.0 was supposed
20098 # to have this new fancy threads implementation but my
20099 # perl doesn't have it" and from people trying to
20100 # (re)install the threads module using CPAN.pm and
20101 # CPAN.pm then offering to reinstall Perl 5.8.0,
20102 # the threads.pm and threads/shared.pm will always be
20103 # there, croaking informatively ("you need to rebuild
20104 # all of Perl with threads, sorry") when threads haven't
20105 # been compiled in.
20106 # --jhi
20107 avail_ext="$avail_ext $xxx"
1dca008a 20108 ;;
b4eb6b3d
JH
20109 IPC/SysV|ipc/sysv)
20110 : XXX Do we need a useipcsysv variable here
20111 case "${d_msg}${d_sem}${d_shm}" in
20112 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20113 esac
20114 ;;
20115 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
20116 ;;
20117 esac
b4eb6b3d 20118done
5f80c64f 20119
b4eb6b3d
JH
20120set X $avail_ext
20121shift
20122avail_ext="$*"
5f80c64f 20123
ef0c5be8
JH
20124case "$onlyextensions" in
20125'') ;;
20126*) keepextensions=''
20127 echo "You have requested that only certains extensions be included..." >&4
20128 for i in $onlyextensions; do
20129 case " $avail_ext " in
20130 *" $i "*)
20131 echo "Keeping extension $i."
20132 keepextensions="$keepextensions $i"
20133 ;;
20134 *) echo "Ignoring extension $i." ;;
20135 esac
20136 done
20137 avail_ext="$keepextensions"
20138 ;;
20139esac
20140
20141case "$noextensions" in
20142'') ;;
20143*) keepextensions=''
20144 echo "You have requested that certain extensions be ignored..." >&4
20145 for i in $avail_ext; do
c3dadc13
AD
20146 case " $noextensions " in
20147 *" $i "*) echo "Ignoring extension $i." ;;
ef0c5be8
JH
20148 *) echo "Keeping extension $i.";
20149 keepextensions="$keepextensions $i"
20150 ;;
20151 esac
20152 done
20153 avail_ext="$keepextensions"
20154 ;;
20155esac
20156
b4eb6b3d
JH
20157: Now see which nonxs extensions are supported on this system.
20158: For now assume all are.
20159nonxs_ext=''
20160for xxx in $nonxs_extensions ; do
20161 case "$xxx" in
20162 *) nonxs_ext="$nonxs_ext $xxx"
20163 ;;
20164 esac
20165done
5f80c64f 20166
b4eb6b3d
JH
20167set X $nonxs_ext
20168shift
20169nonxs_ext="$*"
20170
20171case $usedl in
20172$define)
20173 $cat <<EOM
20174A number of extensions are supplied with $package. You may choose to
20175compile these extensions for dynamic loading (the default), compile
20176them into the $package executable (static loading), or not include
20177them at all. Answer "none" to include no extensions.
20178Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
20179
20180EOM
b4eb6b3d 20181 case "$dynamic_ext" in
736accd3
YST
20182 '')
20183 : Exclude those listed in static_ext
20184 dflt=''
20185 for xxx in $avail_ext; do
20186 case " $static_ext " in
20187 *" $xxx "*) ;;
20188 *) dflt="$dflt $xxx" ;;
20189 esac
20190 done
20191 set X $dflt
20192 shift
20193 dflt="$*"
20194 ;;
b4eb6b3d
JH
20195 *) dflt="$dynamic_ext"
20196 # Perhaps we are reusing an old out-of-date config.sh.
20197 case "$hint" in
20198 previous)
20199 if test X"$dynamic_ext" != X"$avail_ext"; then
20200 $cat <<EOM
20201NOTICE: Your previous config.sh list may be incorrect.
20202The extensions now available to you are
20203 ${avail_ext}
20204but the default list from your previous config.sh is
20205 ${dynamic_ext}
9c839522 20206
b4eb6b3d
JH
20207EOM
20208 fi
9c839522
PM
20209 ;;
20210 esac
b4eb6b3d
JH
20211 ;;
20212 esac
5f80c64f 20213 case "$dflt" in
b4eb6b3d
JH
20214 '') dflt=none;;
20215 esac
20216 rp="What extensions do you wish to load dynamically?"
20217 . ./myread
20218 case "$ans" in
20219 none) dynamic_ext=' ' ;;
20220 *) dynamic_ext="$ans" ;;
5f80c64f 20221 esac
5f80c64f 20222
b4eb6b3d
JH
20223 case "$static_ext" in
20224 '')
20225 : Exclude those already listed in dynamic linking
20226 dflt=''
20227 for xxx in $avail_ext; do
20228 case " $dynamic_ext " in
20229 *" $xxx "*) ;;
20230 *) dflt="$dflt $xxx" ;;
20231 esac
20232 done
20233 set X $dflt
20234 shift
20235 dflt="$*"
20236 ;;
20237 *) dflt="$static_ext"
20238 ;;
20239 esac
9c839522 20240
b4eb6b3d
JH
20241 case "$dflt" in
20242 '') dflt=none;;
20243 esac
20244 rp="What extensions do you wish to load statically?"
20245 . ./myread
20246 case "$ans" in
20247 none) static_ext=' ' ;;
20248 *) static_ext="$ans" ;;
20249 esac
20250 ;;
20251*)
20252 $cat <<EOM
20253A number of extensions are supplied with $package. Answer "none"
20254to include no extensions.
20255Note that DynaLoader is always built and need not be mentioned here.
9c839522 20256
b4eb6b3d
JH
20257EOM
20258 case "$static_ext" in
20259 '') dflt="$avail_ext" ;;
20260 *) dflt="$static_ext"
20261 # Perhaps we are reusing an old out-of-date config.sh.
20262 case "$hint" in
20263 previous)
20264 if test X"$static_ext" != X"$avail_ext"; then
20265 $cat <<EOM
20266NOTICE: Your previous config.sh list may be incorrect.
20267The extensions now available to you are
20268 ${avail_ext}
20269but the default list from your previous config.sh is
20270 ${static_ext}
5f80c64f
JH
20271
20272EOM
b4eb6b3d
JH
20273 fi
20274 ;;
20275 esac
20276 ;;
20277 esac
20278 : Exclude those that are not xs extensions
20279 case "$dflt" in
20280 '') dflt=none;;
20281 esac
20282 rp="What extensions do you wish to include?"
20283 . ./myread
20284 case "$ans" in
20285 none) static_ext=' ' ;;
20286 *) static_ext="$ans" ;;
20287 esac
20288 ;;
5f80c64f 20289esac
f1f6834f
AD
20290#
20291# Encode is a special case. If we are building Encode as a static
20292# extension, we need to explicitly list its subextensions as well.
20293# For other nested extensions, this is handled automatically by
20294# the appropriate Makefile.PL.
20295case " $static_ext " in
20296 *" Encode "*) # Add the subextensions of Encode
20297 cd "$rsrc/ext"
20298 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20299 static_ext="$static_ext Encode/$xxx"
20300 done
20301 cd "$tdir"
20302 ;;
20303esac
5f80c64f 20304
b4eb6b3d
JH
20305set X $dynamic_ext $static_ext $nonxs_ext
20306shift
20307extensions="$*"
20308
93a2cd18
AD
20309# Sanity check: We require an extension suitable for use with
20310# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
20311# should show up as failures in the test suite, but it's helpful to
20312# catch them now.) The 'extensions' list is normally sorted
20313# alphabetically, so we need to accept either
20314# DB_File ... Fcntl ... IO ....
20315# or something like
20316# Fcntl ... NDBM_File ... IO ....
42fde7b2
JH
20317case " $extensions" in
20318*"_File "*" Fcntl "*" IO "*) ;; # DB_File
20319*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
20320*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
7a8675bc
JH
20321*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
20322 echo "WARNING: The Perl you are building will be quite crippled." >& 4
20323 ;;
20324esac
20325
9c839522
PM
20326: Remove libraries needed only for extensions
20327: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
20328: The exception is SunOS 4.x, which needs them.
20329case "${osname}X${osvers}" in
20330sunos*X4*)
20331 perllibs="$libs"
20332 ;;
20333*) case "$usedl" in
20334 $define|true|[yY]*)
20335 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
20336 shift
20337 perllibs="$*"
20338 ;;
20339 *) perllibs="$libs"
20340 ;;
20341 esac
20342 ;;
9c839522 20343esac
5f80c64f
JH
20344
20345: Remove build directory name from cppstdin so it can be used from
20346: either the present location or the final installed location.
20347echo " "
20348: Get out of the UU directory to get correct path name.
20349cd ..
20350case "$cppstdin" in
20351`pwd`/cppstdin)
20352 echo "Stripping down cppstdin path name"
20353 cppstdin=cppstdin
20354 ;;
20355esac
20356cd UU
20357
20358: end of configuration questions
20359echo " "
20360echo "End of configuration questions."
20361echo " "
20362
20363: back to where it started
20364if test -d ../UU; then
20365 cd ..
20366fi
20367
48370efc
JH
20368: configuration may be patched via a 'config.arch' file
20369if $test -f config.arch; then
20370 echo "I see a config.arch file, loading it."
20371 . ./config.arch
20372fi
20373
5f80c64f
JH
20374: configuration may be patched via a 'config.over' file
20375if $test -f config.over; then
20376 echo " "
20377 dflt=y
20378 rp='I see a config.over file. Do you wish to load it?'
20379 . UU/myread
20380 case "$ans" in
20381 n*) echo "OK, I'll ignore it.";;
20382 *) . ./config.over
20383 echo "Configuration override changes have been loaded."
20384 ;;
20385 esac
20386fi
20387
20388: in case they want portability, strip down executable paths
20389case "$d_portable" in
20390"$define")
20391 echo " "
20392 echo "Stripping down executable paths..." >&4
20393 for file in $loclist $trylist; do
534ac15a
JH
20394 eval temp=\$$file
20395 eval $file=`basename $temp`
5f80c64f
JH
20396 done
20397 ;;
20398esac
20399
20400: create config.sh file
20401echo " "
20402echo "Creating config.sh..." >&4
20403$spitshell <<EOT >config.sh
20404$startsh
20405#
20406# This file was produced by running the Configure script. It holds all the
20407# definitions figured out by Configure. Should you modify one of these values,
20408# do not forget to propagate your changes by running "Configure -der". You may
20409# instead choose to run each of the .SH files by yourself, or "Configure -S".
20410#
20411
20412# Package name : $package
20413# Source directory : $src
20414# Configuration time: $cf_time
20415# Configured by : $cf_by
20416# Target system : $myuname
20417
20418Author='$Author'
20419Date='$Date'
20420Header='$Header'
20421Id='$Id'
20422Locker='$Locker'
20423Log='$Log'
20424Mcc='$Mcc'
20425RCSfile='$RCSfile'
20426Revision='$Revision'
20427Source='$Source'
20428State='$State'
20429_a='$_a'
20430_exe='$_exe'
20431_o='$_o'
b4eb6b3d 20432afs='$afs'
a6d26a0d 20433afsroot='$afsroot'
b4eb6b3d
JH
20434alignbytes='$alignbytes'
20435ansi2knr='$ansi2knr'
20436aphostname='$aphostname'
20437api_revision='$api_revision'
20438api_subversion='$api_subversion'
20439api_version='$api_version'
20440api_versionstring='$api_versionstring'
5f80c64f 20441ar='$ar'
b4eb6b3d
JH
20442archlib='$archlib'
20443archlibexp='$archlibexp'
20444archname64='$archname64'
20445archname='$archname'
5f80c64f 20446archobjs='$archobjs'
10bc17b6 20447asctime_r_proto='$asctime_r_proto'
5f80c64f 20448awk='$awk'
b4eb6b3d 20449baserev='$baserev'
5f80c64f 20450bash='$bash'
b4eb6b3d 20451bin='$bin'
b4eb6b3d 20452binexp='$binexp'
5f80c64f
JH
20453bison='$bison'
20454byacc='$byacc'
b4eb6b3d 20455byteorder='$byteorder'
5f80c64f 20456c='$c'
b4eb6b3d 20457castflags='$castflags'
5f80c64f
JH
20458cat='$cat'
20459cc='$cc'
20460cccdlflags='$cccdlflags'
20461ccdlflags='$ccdlflags'
20462ccflags='$ccflags'
b4eb6b3d 20463ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 20464ccname='$ccname'
b4eb6b3d 20465ccsymbols='$ccsymbols'
6b356c8e 20466ccversion='$ccversion'
5f80c64f 20467cf_by='$cf_by'
b4eb6b3d 20468cf_email='$cf_email'
5f80c64f 20469cf_time='$cf_time'
b4eb6b3d 20470charsize='$charsize'
5f80c64f
JH
20471chgrp='$chgrp'
20472chmod='$chmod'
20473chown='$chown'
b4eb6b3d 20474clocktype='$clocktype'
5f80c64f
JH
20475comm='$comm'
20476compress='$compress'
20477contains='$contains'
20478cp='$cp'
20479cpio='$cpio'
20480cpp='$cpp'
b4eb6b3d
JH
20481cpp_stuff='$cpp_stuff'
20482cppccsymbols='$cppccsymbols'
5f80c64f
JH
20483cppflags='$cppflags'
20484cpplast='$cpplast'
20485cppminus='$cppminus'
20486cpprun='$cpprun'
20487cppstdin='$cppstdin'
b4eb6b3d 20488cppsymbols='$cppsymbols'
10bc17b6 20489crypt_r_proto='$crypt_r_proto'
b4eb6b3d 20490cryptlib='$cryptlib'
5f80c64f 20491csh='$csh'
10bc17b6
JH
20492ctermid_r_proto='$ctermid_r_proto'
20493ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
20494d_Gconvert='$d_Gconvert'
20495d_PRIEUldbl='$d_PRIEUldbl'
20496d_PRIFUldbl='$d_PRIFUldbl'
20497d_PRIGUldbl='$d_PRIGUldbl'
20498d_PRIXU64='$d_PRIXU64'
20499d_PRId64='$d_PRId64'
20500d_PRIeldbl='$d_PRIeldbl'
20501d_PRIfldbl='$d_PRIfldbl'
20502d_PRIgldbl='$d_PRIgldbl'
20503d_PRIi64='$d_PRIi64'
20504d_PRIo64='$d_PRIo64'
20505d_PRIu64='$d_PRIu64'
20506d_PRIx64='$d_PRIx64'
20507d_SCNfldbl='$d_SCNfldbl'
74cac757 20508d__fwalk='$d__fwalk'
b4eb6b3d
JH
20509d_access='$d_access'
20510d_accessx='$d_accessx'
55954f19 20511d_aintl='$d_aintl'
b4eb6b3d
JH
20512d_alarm='$d_alarm'
20513d_archlib='$d_archlib'
10bc17b6 20514d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
20515d_atolf='$d_atolf'
20516d_atoll='$d_atoll'
20517d_attribut='$d_attribut'
20518d_bcmp='$d_bcmp'
20519d_bcopy='$d_bcopy'
5f80c64f 20520d_bsd='$d_bsd'
b4eb6b3d
JH
20521d_bsdgetpgrp='$d_bsdgetpgrp'
20522d_bsdsetpgrp='$d_bsdsetpgrp'
20523d_bzero='$d_bzero'
20524d_casti32='$d_casti32'
20525d_castneg='$d_castneg'
20526d_charvspr='$d_charvspr'
20527d_chown='$d_chown'
20528d_chroot='$d_chroot'
20529d_chsize='$d_chsize'
758a5d79 20530d_class='$d_class'
b4eb6b3d 20531d_closedir='$d_closedir'
4e0554ec 20532d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 20533d_const='$d_const'
55954f19 20534d_copysignl='$d_copysignl'
b4eb6b3d 20535d_crypt='$d_crypt'
10bc17b6 20536d_crypt_r='$d_crypt_r'
b4eb6b3d 20537d_csh='$d_csh'
10bc17b6
JH
20538d_ctermid_r='$d_ctermid_r'
20539d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
20540d_cuserid='$d_cuserid'
20541d_dbl_dig='$d_dbl_dig'
2ef53570 20542d_dbminitproto='$d_dbminitproto'
b4eb6b3d 20543d_difftime='$d_difftime'
ae0e3d3b 20544d_dirfd='$d_dirfd'
b4eb6b3d
JH
20545d_dirnamlen='$d_dirnamlen'
20546d_dlerror='$d_dlerror'
5f80c64f 20547d_dlopen='$d_dlopen'
b4eb6b3d
JH
20548d_dlsymun='$d_dlsymun'
20549d_dosuid='$d_dosuid'
10bc17b6 20550d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
20551d_drand48proto='$d_drand48proto'
20552d_dup2='$d_dup2'
20553d_eaccess='$d_eaccess'
20554d_endgrent='$d_endgrent'
10bc17b6 20555d_endgrent_r='$d_endgrent_r'
b4eb6b3d 20556d_endhent='$d_endhent'
10bc17b6 20557d_endhostent_r='$d_endhostent_r'
b4eb6b3d 20558d_endnent='$d_endnent'
10bc17b6 20559d_endnetent_r='$d_endnetent_r'
b4eb6b3d 20560d_endpent='$d_endpent'
10bc17b6 20561d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 20562d_endpwent='$d_endpwent'
10bc17b6 20563d_endpwent_r='$d_endpwent_r'
b4eb6b3d 20564d_endsent='$d_endsent'
10bc17b6 20565d_endservent_r='$d_endservent_r'
b4eb6b3d 20566d_eofnblk='$d_eofnblk'
5f80c64f 20567d_eunice='$d_eunice'
15b61c98 20568d_faststdio='$d_faststdio'
b363b713 20569d_fchdir='$d_fchdir'
b4eb6b3d
JH
20570d_fchmod='$d_fchmod'
20571d_fchown='$d_fchown'
20572d_fcntl='$d_fcntl'
9d9004a9 20573d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
20574d_fd_macros='$d_fd_macros'
20575d_fd_set='$d_fd_set'
20576d_fds_bits='$d_fds_bits'
20577d_fgetpos='$d_fgetpos'
758a5d79
JH
20578d_finite='$d_finite'
20579d_finitel='$d_finitel'
b4eb6b3d
JH
20580d_flexfnam='$d_flexfnam'
20581d_flock='$d_flock'
2ef53570 20582d_flockproto='$d_flockproto'
b4eb6b3d 20583d_fork='$d_fork'
758a5d79 20584d_fp_class='$d_fp_class'
b4eb6b3d 20585d_fpathconf='$d_fpathconf'
758a5d79
JH
20586d_fpclass='$d_fpclass'
20587d_fpclassify='$d_fpclassify'
20588d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
20589d_fpos64_t='$d_fpos64_t'
20590d_frexpl='$d_frexpl'
20591d_fs_data_s='$d_fs_data_s'
20592d_fseeko='$d_fseeko'
20593d_fsetpos='$d_fsetpos'
20594d_fstatfs='$d_fstatfs'
20595d_fstatvfs='$d_fstatvfs'
411ab01c 20596d_fsync='$d_fsync'
b4eb6b3d
JH
20597d_ftello='$d_ftello'
20598d_ftime='$d_ftime'
20599d_getcwd='$d_getcwd'
20600d_getespwnam='$d_getespwnam'
20601d_getfsstat='$d_getfsstat'
20602d_getgrent='$d_getgrent'
10bc17b6
JH
20603d_getgrent_r='$d_getgrent_r'
20604d_getgrgid_r='$d_getgrgid_r'
20605d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
20606d_getgrps='$d_getgrps'
20607d_gethbyaddr='$d_gethbyaddr'
20608d_gethbyname='$d_gethbyname'
20609d_gethent='$d_gethent'
20610d_gethname='$d_gethname'
10bc17b6
JH
20611d_gethostbyaddr_r='$d_gethostbyaddr_r'
20612d_gethostbyname_r='$d_gethostbyname_r'
20613d_gethostent_r='$d_gethostent_r'
b4eb6b3d 20614d_gethostprotos='$d_gethostprotos'
4e0554ec 20615d_getitimer='$d_getitimer'
b4eb6b3d 20616d_getlogin='$d_getlogin'
10bc17b6 20617d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
20618d_getmnt='$d_getmnt'
20619d_getmntent='$d_getmntent'
20620d_getnbyaddr='$d_getnbyaddr'
20621d_getnbyname='$d_getnbyname'
20622d_getnent='$d_getnent'
10bc17b6
JH
20623d_getnetbyaddr_r='$d_getnetbyaddr_r'
20624d_getnetbyname_r='$d_getnetbyname_r'
20625d_getnetent_r='$d_getnetent_r'
b4eb6b3d 20626d_getnetprotos='$d_getnetprotos'
0c0643d0 20627d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
20628d_getpbyname='$d_getpbyname'
20629d_getpbynumber='$d_getpbynumber'
20630d_getpent='$d_getpent'
20631d_getpgid='$d_getpgid'
20632d_getpgrp2='$d_getpgrp2'
20633d_getpgrp='$d_getpgrp'
20634d_getppid='$d_getppid'
20635d_getprior='$d_getprior'
10bc17b6
JH
20636d_getprotobyname_r='$d_getprotobyname_r'
20637d_getprotobynumber_r='$d_getprotobynumber_r'
20638d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
20639d_getprotoprotos='$d_getprotoprotos'
20640d_getprpwnam='$d_getprpwnam'
20641d_getpwent='$d_getpwent'
10bc17b6
JH
20642d_getpwent_r='$d_getpwent_r'
20643d_getpwnam_r='$d_getpwnam_r'
20644d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
20645d_getsbyname='$d_getsbyname'
20646d_getsbyport='$d_getsbyport'
20647d_getsent='$d_getsent'
10bc17b6
JH
20648d_getservbyname_r='$d_getservbyname_r'
20649d_getservbyport_r='$d_getservbyport_r'
20650d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
20651d_getservprotos='$d_getservprotos'
20652d_getspnam='$d_getspnam'
10bc17b6 20653d_getspnam_r='$d_getspnam_r'
b4eb6b3d 20654d_gettimeod='$d_gettimeod'
10bc17b6 20655d_gmtime_r='$d_gmtime_r'
5f80c64f 20656d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
20657d_grpasswd='$d_grpasswd'
20658d_hasmntopt='$d_hasmntopt'
20659d_htonl='$d_htonl'
55954f19 20660d_ilogbl='$d_ilogbl'
b4eb6b3d
JH
20661d_index='$d_index'
20662d_inetaton='$d_inetaton'
20663d_int64_t='$d_int64_t'
20664d_isascii='$d_isascii'
758a5d79
JH
20665d_isfinite='$d_isfinite'
20666d_isinf='$d_isinf'
b4eb6b3d
JH
20667d_isnan='$d_isnan'
20668d_isnanl='$d_isnanl'
20669d_killpg='$d_killpg'
20670d_lchown='$d_lchown'
20671d_ldbl_dig='$d_ldbl_dig'
20672d_link='$d_link'
10bc17b6 20673d_localtime_r='$d_localtime_r'
b4eb6b3d
JH
20674d_locconv='$d_locconv'
20675d_lockf='$d_lockf'
20676d_longdbl='$d_longdbl'
20677d_longlong='$d_longlong'
20678d_lseekproto='$d_lseekproto'
20679d_lstat='$d_lstat'
20680d_madvise='$d_madvise'
20681d_mblen='$d_mblen'
20682d_mbstowcs='$d_mbstowcs'
20683d_mbtowc='$d_mbtowc'
20684d_memchr='$d_memchr'
20685d_memcmp='$d_memcmp'
20686d_memcpy='$d_memcpy'
20687d_memmove='$d_memmove'
20688d_memset='$d_memset'
20689d_mkdir='$d_mkdir'
20690d_mkdtemp='$d_mkdtemp'
20691d_mkfifo='$d_mkfifo'
20692d_mkstemp='$d_mkstemp'
20693d_mkstemps='$d_mkstemps'
20694d_mktime='$d_mktime'
20695d_mmap='$d_mmap'
20696d_modfl='$d_modfl'
e67aeab1 20697d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 20698d_modflproto='$d_modflproto'
b4eb6b3d
JH
20699d_mprotect='$d_mprotect'
20700d_msg='$d_msg'
20701d_msg_ctrunc='$d_msg_ctrunc'
20702d_msg_dontroute='$d_msg_dontroute'
20703d_msg_oob='$d_msg_oob'
20704d_msg_peek='$d_msg_peek'
20705d_msg_proxy='$d_msg_proxy'
20706d_msgctl='$d_msgctl'
20707d_msgget='$d_msgget'
4e0554ec 20708d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
20709d_msgrcv='$d_msgrcv'
20710d_msgsnd='$d_msgsnd'
20711d_msync='$d_msync'
20712d_munmap='$d_munmap'
20713d_mymalloc='$d_mymalloc'
20714d_nice='$d_nice'
2765b840 20715d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 20716d_nv_preserves_uv='$d_nv_preserves_uv'
b4eb6b3d
JH
20717d_off64_t='$d_off64_t'
20718d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
20719d_oldpthreads='$d_oldpthreads'
20720d_oldsock='$d_oldsock'
20721d_open3='$d_open3'
20722d_pathconf='$d_pathconf'
20723d_pause='$d_pause'
20724d_perl_otherlibdirs='$d_perl_otherlibdirs'
20725d_phostname='$d_phostname'
20726d_pipe='$d_pipe'
20727d_poll='$d_poll'
5f80c64f 20728d_portable='$d_portable'
c7aff470 20729d_procselfexe='$d_procselfexe'
d6483fcc 20730d_pthread_atfork='$d_pthread_atfork'
58d975c3 20731d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
20732d_pthread_yield='$d_pthread_yield'
20733d_pwage='$d_pwage'
20734d_pwchange='$d_pwchange'
20735d_pwclass='$d_pwclass'
20736d_pwcomment='$d_pwcomment'
20737d_pwexpire='$d_pwexpire'
20738d_pwgecos='$d_pwgecos'
20739d_pwpasswd='$d_pwpasswd'
20740d_pwquota='$d_pwquota'
20741d_qgcvt='$d_qgcvt'
20742d_quad='$d_quad'
10bc17b6
JH
20743d_random_r='$d_random_r'
20744d_readdir64_r='$d_readdir64_r'
b4eb6b3d 20745d_readdir='$d_readdir'
10bc17b6 20746d_readdir_r='$d_readdir_r'
b4eb6b3d 20747d_readlink='$d_readlink'
4e0554ec
JH
20748d_readv='$d_readv'
20749d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
20750d_rename='$d_rename'
20751d_rewinddir='$d_rewinddir'
20752d_rmdir='$d_rmdir'
20753d_safebcpy='$d_safebcpy'
20754d_safemcpy='$d_safemcpy'
20755d_sanemcmp='$d_sanemcmp'
ef9f17be 20756d_sbrkproto='$d_sbrkproto'
55954f19 20757d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
20758d_sched_yield='$d_sched_yield'
20759d_scm_rights='$d_scm_rights'
20760d_seekdir='$d_seekdir'
20761d_select='$d_select'
20762d_sem='$d_sem'
20763d_semctl='$d_semctl'
20764d_semctl_semid_ds='$d_semctl_semid_ds'
20765d_semctl_semun='$d_semctl_semun'
20766d_semget='$d_semget'
20767d_semop='$d_semop'
4e0554ec 20768d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
20769d_setegid='$d_setegid'
20770d_seteuid='$d_seteuid'
20771d_setgrent='$d_setgrent'
10bc17b6 20772d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
20773d_setgrps='$d_setgrps'
20774d_sethent='$d_sethent'
10bc17b6 20775d_sethostent_r='$d_sethostent_r'
4e0554ec 20776d_setitimer='$d_setitimer'
b4eb6b3d
JH
20777d_setlinebuf='$d_setlinebuf'
20778d_setlocale='$d_setlocale'
10bc17b6 20779d_setlocale_r='$d_setlocale_r'
b4eb6b3d 20780d_setnent='$d_setnent'
10bc17b6 20781d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
20782d_setpent='$d_setpent'
20783d_setpgid='$d_setpgid'
20784d_setpgrp2='$d_setpgrp2'
20785d_setpgrp='$d_setpgrp'
20786d_setprior='$d_setprior'
20787d_setproctitle='$d_setproctitle'
10bc17b6 20788d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 20789d_setpwent='$d_setpwent'
10bc17b6 20790d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
20791d_setregid='$d_setregid'
20792d_setresgid='$d_setresgid'
20793d_setresuid='$d_setresuid'
20794d_setreuid='$d_setreuid'
20795d_setrgid='$d_setrgid'
20796d_setruid='$d_setruid'
20797d_setsent='$d_setsent'
10bc17b6 20798d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
20799d_setsid='$d_setsid'
20800d_setvbuf='$d_setvbuf'
20801d_sfio='$d_sfio'
20802d_shm='$d_shm'
20803d_shmat='$d_shmat'
20804d_shmatprototype='$d_shmatprototype'
20805d_shmctl='$d_shmctl'
20806d_shmdt='$d_shmdt'
20807d_shmget='$d_shmget'
20808d_sigaction='$d_sigaction'
983dbef6 20809d_sigprocmask='$d_sigprocmask'
b4eb6b3d 20810d_sigsetjmp='$d_sigsetjmp'
49a78c82 20811d_sockatmark='$d_sockatmark'
2ef53570 20812d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
20813d_socket='$d_socket'
20814d_socklen_t='$d_socklen_t'
20815d_sockpair='$d_sockpair'
20816d_socks5_init='$d_socks5_init'
20817d_sqrtl='$d_sqrtl'
10bc17b6
JH
20818d_srand48_r='$d_srand48_r'
20819d_srandom_r='$d_srandom_r'
eef837ea 20820d_sresgproto='$d_sresgproto'
640374d0 20821d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
20822d_statblks='$d_statblks'
20823d_statfs_f_flags='$d_statfs_f_flags'
20824d_statfs_s='$d_statfs_s'
20825d_statvfs='$d_statvfs'
20826d_stdio_cnt_lval='$d_stdio_cnt_lval'
20827d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
20828d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20829d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
20830d_stdio_stream_array='$d_stdio_stream_array'
20831d_stdiobase='$d_stdiobase'
20832d_stdstdio='$d_stdstdio'
20833d_strchr='$d_strchr'
20834d_strcoll='$d_strcoll'
20835d_strctcpy='$d_strctcpy'
20836d_strerrm='$d_strerrm'
20837d_strerror='$d_strerror'
10bc17b6 20838d_strerror_r='$d_strerror_r'
b3c85772 20839d_strftime='$d_strftime'
b4eb6b3d
JH
20840d_strtod='$d_strtod'
20841d_strtol='$d_strtol'
20842d_strtold='$d_strtold'
20843d_strtoll='$d_strtoll'
28e5dec8 20844d_strtoq='$d_strtoq'
b4eb6b3d
JH
20845d_strtoul='$d_strtoul'
20846d_strtoull='$d_strtoull'
20847d_strtouq='$d_strtouq'
20848d_strxfrm='$d_strxfrm'
20849d_suidsafe='$d_suidsafe'
20850d_symlink='$d_symlink'
20851d_syscall='$d_syscall'
2ef53570 20852d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
20853d_sysconf='$d_sysconf'
20854d_sysernlst='$d_sysernlst'
20855d_syserrlst='$d_syserrlst'
20856d_system='$d_system'
20857d_tcgetpgrp='$d_tcgetpgrp'
20858d_tcsetpgrp='$d_tcsetpgrp'
20859d_telldir='$d_telldir'
20860d_telldirproto='$d_telldirproto'
20861d_time='$d_time'
20862d_times='$d_times'
14b90194
JH
20863d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20864d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 20865d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 20866d_truncate='$d_truncate'
10bc17b6 20867d_ttyname_r='$d_ttyname_r'
b4eb6b3d 20868d_tzname='$d_tzname'
4e0554ec
JH
20869d_u32align='$d_u32align'
20870d_ualarm='$d_ualarm'
b4eb6b3d
JH
20871d_umask='$d_umask'
20872d_uname='$d_uname'
20873d_union_semun='$d_union_semun'
758a5d79 20874d_unordered='$d_unordered'
4e0554ec 20875d_usleep='$d_usleep'
2ef53570 20876d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
20877d_ustat='$d_ustat'
20878d_vendorarch='$d_vendorarch'
20879d_vendorbin='$d_vendorbin'
20880d_vendorlib='$d_vendorlib'
6e1038e0 20881d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
20882d_vfork='$d_vfork'
20883d_void_closedir='$d_void_closedir'
20884d_voidsig='$d_voidsig'
20885d_voidtty='$d_voidtty'
20886d_volatile='$d_volatile'
20887d_vprintf='$d_vprintf'
20888d_wait4='$d_wait4'
20889d_waitpid='$d_waitpid'
20890d_wcstombs='$d_wcstombs'
20891d_wctomb='$d_wctomb'
4e0554ec 20892d_writev='$d_writev'
5f80c64f
JH
20893d_xenix='$d_xenix'
20894date='$date'
b4eb6b3d
JH
20895db_hashtype='$db_hashtype'
20896db_prefixtype='$db_prefixtype'
640374d0
JH
20897db_version_major='$db_version_major'
20898db_version_minor='$db_version_minor'
20899db_version_patch='$db_version_patch'
b4eb6b3d
JH
20900defvoidused='$defvoidused'
20901direntrytype='$direntrytype'
20902dlext='$dlext'
5f80c64f 20903dlsrc='$dlsrc'
b4eb6b3d
JH
20904doublesize='$doublesize'
20905drand01='$drand01'
10bc17b6 20906drand48_r_proto='$drand48_r_proto'
b4eb6b3d
JH
20907dynamic_ext='$dynamic_ext'
20908eagain='$eagain'
20909ebcdic='$ebcdic'
5f80c64f
JH
20910echo='$echo'
20911egrep='$egrep'
20912emacs='$emacs'
10bc17b6
JH
20913endgrent_r_proto='$endgrent_r_proto'
20914endhostent_r_proto='$endhostent_r_proto'
20915endnetent_r_proto='$endnetent_r_proto'
20916endprotoent_r_proto='$endprotoent_r_proto'
20917endpwent_r_proto='$endpwent_r_proto'
20918endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
20919eunicefix='$eunicefix'
20920exe_ext='$exe_ext'
20921expr='$expr'
b4eb6b3d 20922extensions='$extensions'
6fcddf3b 20923extras='$extras'
b4eb6b3d
JH
20924fflushNULL='$fflushNULL'
20925fflushall='$fflushall'
5f80c64f
JH
20926find='$find'
20927firstmakefile='$firstmakefile'
20928flex='$flex'
b4eb6b3d
JH
20929fpossize='$fpossize'
20930fpostype='$fpostype'
20931freetype='$freetype'
5440bc8e 20932from='$from'
b4eb6b3d
JH
20933full_ar='$full_ar'
20934full_csh='$full_csh'
20935full_sed='$full_sed'
2d736872 20936gccansipedantic='$gccansipedantic'
5b463ca7 20937gccosandvers='$gccosandvers'
5f80c64f 20938gccversion='$gccversion'
10bc17b6
JH
20939getgrent_r_proto='$getgrent_r_proto'
20940getgrgid_r_proto='$getgrgid_r_proto'
20941getgrnam_r_proto='$getgrnam_r_proto'
20942gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20943gethostbyname_r_proto='$gethostbyname_r_proto'
20944gethostent_r_proto='$gethostent_r_proto'
20945getlogin_r_proto='$getlogin_r_proto'
20946getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20947getnetbyname_r_proto='$getnetbyname_r_proto'
20948getnetent_r_proto='$getnetent_r_proto'
20949getprotobyname_r_proto='$getprotobyname_r_proto'
20950getprotobynumber_r_proto='$getprotobynumber_r_proto'
20951getprotoent_r_proto='$getprotoent_r_proto'
20952getpwent_r_proto='$getpwent_r_proto'
20953getpwnam_r_proto='$getpwnam_r_proto'
20954getpwuid_r_proto='$getpwuid_r_proto'
20955getservbyname_r_proto='$getservbyname_r_proto'
20956getservbyport_r_proto='$getservbyport_r_proto'
20957getservent_r_proto='$getservent_r_proto'
20958getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
20959gidformat='$gidformat'
20960gidsign='$gidsign'
20961gidsize='$gidsize'
20962gidtype='$gidtype'
5f80c64f 20963glibpth='$glibpth'
3c728e00 20964gmake='$gmake'
10bc17b6 20965gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 20966gnulibc_version='$gnulibc_version'
5f80c64f 20967grep='$grep'
b4eb6b3d
JH
20968groupcat='$groupcat'
20969groupstype='$groupstype'
5f80c64f 20970gzip='$gzip'
b4eb6b3d
JH
20971h_fcntl='$h_fcntl'
20972h_sysfile='$h_sysfile'
5f80c64f 20973hint='$hint'
b4eb6b3d 20974hostcat='$hostcat'
6e1038e0
MB
20975html1dir='$html1dir'
20976html1direxp='$html1direxp'
20977html3dir='$html3dir'
20978html3direxp='$html3direxp'
b4eb6b3d
JH
20979i16size='$i16size'
20980i16type='$i16type'
20981i32size='$i32size'
20982i32type='$i32type'
20983i64size='$i64size'
20984i64type='$i64type'
20985i8size='$i8size'
20986i8type='$i8type'
20987i_arpainet='$i_arpainet'
20988i_bsdioctl='$i_bsdioctl'
10bc17b6 20989i_crypt='$i_crypt'
b4eb6b3d
JH
20990i_db='$i_db'
20991i_dbm='$i_dbm'
20992i_dirent='$i_dirent'
5f80c64f 20993i_dld='$i_dld'
b4eb6b3d
JH
20994i_dlfcn='$i_dlfcn'
20995i_fcntl='$i_fcntl'
20996i_float='$i_float'
758a5d79
JH
20997i_fp='$i_fp'
20998i_fp_class='$i_fp_class'
b4eb6b3d
JH
20999i_gdbm='$i_gdbm'
21000i_grp='$i_grp'
b4eb6b3d
JH
21001i_ieeefp='$i_ieeefp'
21002i_inttypes='$i_inttypes'
2765b840 21003i_langinfo='$i_langinfo'
b4eb6b3d
JH
21004i_libutil='$i_libutil'
21005i_limits='$i_limits'
21006i_locale='$i_locale'
21007i_machcthr='$i_machcthr'
21008i_malloc='$i_malloc'
21009i_math='$i_math'
21010i_memory='$i_memory'
21011i_mntent='$i_mntent'
21012i_ndbm='$i_ndbm'
21013i_netdb='$i_netdb'
21014i_neterrno='$i_neterrno'
21015i_netinettcp='$i_netinettcp'
21016i_niin='$i_niin'
21017i_poll='$i_poll'
21018i_prot='$i_prot'
21019i_pthread='$i_pthread'
21020i_pwd='$i_pwd'
21021i_rpcsvcdbm='$i_rpcsvcdbm'
21022i_sfio='$i_sfio'
21023i_sgtty='$i_sgtty'
21024i_shadow='$i_shadow'
21025i_socks='$i_socks'
21026i_stdarg='$i_stdarg'
21027i_stddef='$i_stddef'
21028i_stdlib='$i_stdlib'
21029i_string='$i_string'
21030i_sunmath='$i_sunmath'
21031i_sysaccess='$i_sysaccess'
21032i_sysdir='$i_sysdir'
21033i_sysfile='$i_sysfile'
21034i_sysfilio='$i_sysfilio'
21035i_sysin='$i_sysin'
21036i_sysioctl='$i_sysioctl'
21037i_syslog='$i_syslog'
21038i_sysmman='$i_sysmman'
21039i_sysmode='$i_sysmode'
21040i_sysmount='$i_sysmount'
21041i_sysndir='$i_sysndir'
21042i_sysparam='$i_sysparam'
21043i_sysresrc='$i_sysresrc'
21044i_syssecrt='$i_syssecrt'
21045i_sysselct='$i_sysselct'
21046i_syssockio='$i_syssockio'
21047i_sysstat='$i_sysstat'
21048i_sysstatfs='$i_sysstatfs'
21049i_sysstatvfs='$i_sysstatvfs'
21050i_systime='$i_systime'
21051i_systimek='$i_systimek'
21052i_systimes='$i_systimes'
21053i_systypes='$i_systypes'
21054i_sysuio='$i_sysuio'
21055i_sysun='$i_sysun'
21056i_sysutsname='$i_sysutsname'
21057i_sysvfs='$i_sysvfs'
21058i_syswait='$i_syswait'
21059i_termio='$i_termio'
21060i_termios='$i_termios'
21061i_time='$i_time'
21062i_unistd='$i_unistd'
21063i_ustat='$i_ustat'
21064i_utime='$i_utime'
21065i_values='$i_values'
21066i_varargs='$i_varargs'
21067i_varhdr='$i_varhdr'
21068i_vfork='$i_vfork'
5f80c64f 21069ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
21070inc_version_list='$inc_version_list'
21071inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
21072incpath='$incpath'
21073inews='$inews'
b4eb6b3d
JH
21074installarchlib='$installarchlib'
21075installbin='$installbin'
6e1038e0
MB
21076installhtml1dir='$installhtml1dir'
21077installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
21078installman1dir='$installman1dir'
21079installman3dir='$installman3dir'
21080installprefix='$installprefix'
21081installprefixexp='$installprefixexp'
21082installprivlib='$installprivlib'
21083installscript='$installscript'
21084installsitearch='$installsitearch'
21085installsitebin='$installsitebin'
6e1038e0
MB
21086installsitehtml1='$installsitehtml1'
21087installsitehtml3='$installsitehtml3'
b4eb6b3d 21088installsitelib='$installsitelib'
6e1038e0
MB
21089installsiteman1='$installsiteman1'
21090installsiteman3='$installsiteman3'
21091installsitescript='$installsitescript'
b4eb6b3d
JH
21092installstyle='$installstyle'
21093installusrbinperl='$installusrbinperl'
21094installvendorarch='$installvendorarch'
21095installvendorbin='$installvendorbin'
6e1038e0
MB
21096installvendorhtml1='$installvendorhtml1'
21097installvendorhtml3='$installvendorhtml3'
b4eb6b3d 21098installvendorlib='$installvendorlib'
6e1038e0
MB
21099installvendorman1='$installvendorman1'
21100installvendorman3='$installvendorman3'
21101installvendorscript='$installvendorscript'
b4eb6b3d 21102intsize='$intsize'
4b661809 21103issymlink='$issymlink'
b4eb6b3d
JH
21104ivdformat='$ivdformat'
21105ivsize='$ivsize'
21106ivtype='$ivtype'
21107known_extensions='$known_extensions'
5f80c64f 21108ksh='$ksh'
5f80c64f
JH
21109ld='$ld'
21110lddlflags='$lddlflags'
21111ldflags='$ldflags'
b4eb6b3d
JH
21112ldflags_uselargefiles='$ldflags_uselargefiles'
21113ldlibpthname='$ldlibpthname'
5f80c64f
JH
21114less='$less'
21115lib_ext='$lib_ext'
21116libc='$libc'
b4eb6b3d 21117libperl='$libperl'
5f80c64f
JH
21118libpth='$libpth'
21119libs='$libs'
43999f95
JH
21120libsdirs='$libsdirs'
21121libsfiles='$libsfiles'
21122libsfound='$libsfound'
13b3f787 21123libspath='$libspath'
5f80c64f 21124libswanted='$libswanted'
b4eb6b3d 21125libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
21126line='$line'
21127lint='$lint'
21128lkflags='$lkflags'
21129ln='$ln'
21130lns='$lns'
10bc17b6 21131localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
21132locincpth='$locincpth'
21133loclibpth='$loclibpth'
b4eb6b3d
JH
21134longdblsize='$longdblsize'
21135longlongsize='$longlongsize'
21136longsize='$longsize'
5f80c64f
JH
21137lp='$lp'
21138lpr='$lpr'
21139ls='$ls'
b4eb6b3d
JH
21140lseeksize='$lseeksize'
21141lseektype='$lseektype'
5f80c64f
JH
21142mail='$mail'
21143mailx='$mailx'
21144make='$make'
21145make_set_make='$make_set_make'
b4eb6b3d
JH
21146mallocobj='$mallocobj'
21147mallocsrc='$mallocsrc'
21148malloctype='$malloctype'
21149man1dir='$man1dir'
21150man1direxp='$man1direxp'
21151man1ext='$man1ext'
21152man3dir='$man3dir'
21153man3direxp='$man3direxp'
21154man3ext='$man3ext'
5f80c64f 21155mips_type='$mips_type'
5129fff4 21156mistrustnm='$mistrustnm'
5f80c64f 21157mkdir='$mkdir'
b4eb6b3d
JH
21158mmaptype='$mmaptype'
21159modetype='$modetype'
5f80c64f 21160more='$more'
b4eb6b3d 21161multiarch='$multiarch'
5f80c64f 21162mv='$mv'
b4eb6b3d
JH
21163myarchname='$myarchname'
21164mydomain='$mydomain'
21165myhostname='$myhostname'
5f80c64f
JH
21166myuname='$myuname'
21167n='$n'
2cc61e15 21168need_va_copy='$need_va_copy'
b4eb6b3d
JH
21169netdb_hlen_type='$netdb_hlen_type'
21170netdb_host_type='$netdb_host_type'
21171netdb_name_type='$netdb_name_type'
21172netdb_net_type='$netdb_net_type'
5f80c64f
JH
21173nm='$nm'
21174nm_opt='$nm_opt'
21175nm_so_opt='$nm_so_opt'
b4eb6b3d 21176nonxs_ext='$nonxs_ext'
5f80c64f 21177nroff='$nroff'
b4eb6b3d
JH
21178nvEUformat='$nvEUformat'
21179nvFUformat='$nvFUformat'
21180nvGUformat='$nvGUformat'
53133ed1 21181nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
21182nveformat='$nveformat'
21183nvfformat='$nvfformat'
21184nvgformat='$nvgformat'
21185nvsize='$nvsize'
21186nvtype='$nvtype'
21187o_nonblock='$o_nonblock'
5f80c64f 21188obj_ext='$obj_ext'
b4eb6b3d 21189old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 21190optimize='$optimize'
b4eb6b3d 21191orderlib='$orderlib'
5f80c64f
JH
21192osname='$osname'
21193osvers='$osvers'
b4eb6b3d 21194otherlibdirs='$otherlibdirs'
5f80c64f 21195package='$package'
b4eb6b3d
JH
21196pager='$pager'
21197passcat='$passcat'
21198patchlevel='$patchlevel'
5f80c64f 21199path_sep='$path_sep'
b4eb6b3d 21200perl5='$perl5'
5f80c64f 21201perl='$perl'
151e6568 21202perl_patchlevel='$perl_patchlevel'
b4eb6b3d 21203perladmin='$perladmin'
9c839522 21204perllibs='$perllibs'
b4eb6b3d 21205perlpath='$perlpath'
5f80c64f 21206pg='$pg'
b4eb6b3d
JH
21207phostname='$phostname'
21208pidtype='$pidtype'
5f80c64f 21209plibpth='$plibpth'
b4eb6b3d 21210pm_apiversion='$pm_apiversion'
5f80c64f
JH
21211pmake='$pmake'
21212pr='$pr'
b4eb6b3d
JH
21213prefix='$prefix'
21214prefixexp='$prefixexp'
21215privlib='$privlib'
21216privlibexp='$privlibexp'
f24dbf84 21217procselfexe='$procselfexe'
b4eb6b3d
JH
21218prototype='$prototype'
21219ptrsize='$ptrsize'
21220quadkind='$quadkind'
21221quadtype='$quadtype'
21222randbits='$randbits'
21223randfunc='$randfunc'
10bc17b6 21224random_r_proto='$random_r_proto'
b4eb6b3d
JH
21225randseedtype='$randseedtype'
21226ranlib='$ranlib'
21227rd_nodata='$rd_nodata'
10bc17b6
JH
21228readdir64_r_proto='$readdir64_r_proto'
21229readdir_r_proto='$readdir_r_proto'
b4eb6b3d 21230revision='$revision'
5f80c64f
JH
21231rm='$rm'
21232rmail='$rmail'
5440bc8e 21233run='$run'
5f80c64f 21234runnm='$runnm'
b4eb6b3d
JH
21235sPRIEUldbl='$sPRIEUldbl'
21236sPRIFUldbl='$sPRIFUldbl'
21237sPRIGUldbl='$sPRIGUldbl'
21238sPRIXU64='$sPRIXU64'
21239sPRId64='$sPRId64'
21240sPRIeldbl='$sPRIeldbl'
21241sPRIfldbl='$sPRIfldbl'
21242sPRIgldbl='$sPRIgldbl'
21243sPRIi64='$sPRIi64'
21244sPRIo64='$sPRIo64'
21245sPRIu64='$sPRIu64'
21246sPRIx64='$sPRIx64'
21247sSCNfldbl='$sSCNfldbl'
21248sched_yield='$sched_yield'
21249scriptdir='$scriptdir'
21250scriptdirexp='$scriptdirexp'
5f80c64f 21251sed='$sed'
b4eb6b3d
JH
21252seedfunc='$seedfunc'
21253selectminbits='$selectminbits'
21254selecttype='$selecttype'
5f80c64f 21255sendmail='$sendmail'
10bc17b6
JH
21256setgrent_r_proto='$setgrent_r_proto'
21257sethostent_r_proto='$sethostent_r_proto'
21258setlocale_r_proto='$setlocale_r_proto'
21259setnetent_r_proto='$setnetent_r_proto'
21260setprotoent_r_proto='$setprotoent_r_proto'
21261setpwent_r_proto='$setpwent_r_proto'
21262setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
21263sh='$sh'
21264shar='$shar'
21265sharpbang='$sharpbang'
b4eb6b3d
JH
21266shmattype='$shmattype'
21267shortsize='$shortsize'
21268shrpenv='$shrpenv'
5f80c64f 21269shsharp='$shsharp'
b4eb6b3d
JH
21270sig_count='$sig_count'
21271sig_name='$sig_name'
21272sig_name_init='$sig_name_init'
21273sig_num='$sig_num'
21274sig_num_init='$sig_num_init'
76d3c696 21275sig_size='$sig_size'
b4eb6b3d
JH
21276signal_t='$signal_t'
21277sitearch='$sitearch'
21278sitearchexp='$sitearchexp'
21279sitebin='$sitebin'
21280sitebinexp='$sitebinexp'
6e1038e0
MB
21281sitehtml1='$sitehtml1'
21282sitehtml1exp='$sitehtml1exp'
21283sitehtml3='$sitehtml3'
21284sitehtml3exp='$sitehtml3exp'
b4eb6b3d
JH
21285sitelib='$sitelib'
21286sitelib_stem='$sitelib_stem'
21287sitelibexp='$sitelibexp'
6e1038e0
MB
21288siteman1='$siteman1'
21289siteman1exp='$siteman1exp'
21290siteman3='$siteman3'
21291siteman3exp='$siteman3exp'
b4eb6b3d
JH
21292siteprefix='$siteprefix'
21293siteprefixexp='$siteprefixexp'
6e1038e0
MB
21294sitescript='$sitescript'
21295sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
21296sizesize='$sizesize'
21297sizetype='$sizetype'
5f80c64f
JH
21298sleep='$sleep'
21299smail='$smail'
5f80c64f 21300so='$so'
b4eb6b3d
JH
21301sockethdr='$sockethdr'
21302socketlib='$socketlib'
21303socksizetype='$socksizetype'
5f80c64f
JH
21304sort='$sort'
21305spackage='$spackage'
21306spitshell='$spitshell'
10bc17b6
JH
21307srand48_r_proto='$srand48_r_proto'
21308srandom_r_proto='$srandom_r_proto'
5f80c64f 21309src='$src'
b4eb6b3d
JH
21310ssizetype='$ssizetype'
21311startperl='$startperl'
5f80c64f 21312startsh='$startsh'
b4eb6b3d
JH
21313static_ext='$static_ext'
21314stdchar='$stdchar'
21315stdio_base='$stdio_base'
21316stdio_bufsiz='$stdio_bufsiz'
21317stdio_cnt='$stdio_cnt'
21318stdio_filbuf='$stdio_filbuf'
21319stdio_ptr='$stdio_ptr'
21320stdio_stream_array='$stdio_stream_array'
10bc17b6 21321strerror_r_proto='$strerror_r_proto'
b4eb6b3d 21322strings='$strings'
5f80c64f 21323submit='$submit'
b4eb6b3d
JH
21324subversion='$subversion'
21325sysman='$sysman'
5f80c64f
JH
21326tail='$tail'
21327tar='$tar'
5440bc8e 21328targetarch='$targetarch'
5f80c64f
JH
21329tbl='$tbl'
21330tee='$tee'
21331test='$test'
b4eb6b3d
JH
21332timeincl='$timeincl'
21333timetype='$timetype'
10bc17b6 21334tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 21335to='$to'
5f80c64f
JH
21336touch='$touch'
21337tr='$tr'
21338trnl='$trnl'
21339troff='$troff'
10bc17b6 21340ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
21341u16size='$u16size'
21342u16type='$u16type'
21343u32size='$u32size'
21344u32type='$u32type'
21345u64size='$u64size'
21346u64type='$u64type'
21347u8size='$u8size'
21348u8type='$u8type'
21349uidformat='$uidformat'
21350uidsign='$uidsign'
21351uidsize='$uidsize'
21352uidtype='$uidtype'
5f80c64f
JH
21353uname='$uname'
21354uniq='$uniq'
b4eb6b3d
JH
21355uquadtype='$uquadtype'
21356use5005threads='$use5005threads'
21357use64bitall='$use64bitall'
21358use64bitint='$use64bitint'
5440bc8e 21359usecrosscompile='$usecrosscompile'
5f80c64f 21360usedl='$usedl'
15b61c98 21361usefaststdio='$usefaststdio'
b4eb6b3d
JH
21362useithreads='$useithreads'
21363uselargefiles='$uselargefiles'
21364uselongdouble='$uselongdouble'
21365usemorebits='$usemorebits'
21366usemultiplicity='$usemultiplicity'
21367usemymalloc='$usemymalloc'
5f80c64f 21368usenm='$usenm'
b4eb6b3d
JH
21369useopcode='$useopcode'
21370useperlio='$useperlio'
21371useposix='$useposix'
9514c62b 21372usereentrant='$usereentrant'
b4eb6b3d
JH
21373usesfio='$usesfio'
21374useshrplib='$useshrplib'
29209bc5 21375usesocks='$usesocks'
b4eb6b3d
JH
21376usethreads='$usethreads'
21377usevendorprefix='$usevendorprefix'
21378usevfork='$usevfork'
5f80c64f
JH
21379usrinc='$usrinc'
21380uuname='$uuname'
b4eb6b3d
JH
21381uvXUformat='$uvXUformat'
21382uvoformat='$uvoformat'
21383uvsize='$uvsize'
21384uvtype='$uvtype'
21385uvuformat='$uvuformat'
21386uvxformat='$uvxformat'
21387vendorarch='$vendorarch'
21388vendorarchexp='$vendorarchexp'
21389vendorbin='$vendorbin'
21390vendorbinexp='$vendorbinexp'
6e1038e0
MB
21391vendorhtml1='$vendorhtml1'
21392vendorhtml1exp='$vendorhtml1exp'
21393vendorhtml3='$vendorhtml3'
21394vendorhtml3exp='$vendorhtml3exp'
b4eb6b3d
JH
21395vendorlib='$vendorlib'
21396vendorlib_stem='$vendorlib_stem'
21397vendorlibexp='$vendorlibexp'
6e1038e0
MB
21398vendorman1='$vendorman1'
21399vendorman1exp='$vendorman1exp'
21400vendorman3='$vendorman3'
21401vendorman3exp='$vendorman3exp'
b4eb6b3d
JH
21402vendorprefix='$vendorprefix'
21403vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
21404vendorscript='$vendorscript'
21405vendorscriptexp='$vendorscriptexp'
b4eb6b3d 21406version='$version'
861eb78d 21407version_patchlevel_string='$version_patchlevel_string'
d56c5707 21408versiononly='$versiononly'
5f80c64f 21409vi='$vi'
b4eb6b3d 21410voidflags='$voidflags'
5f80c64f 21411xlibpth='$xlibpth'
b4eb6b3d 21412xs_apiversion='$xs_apiversion'
3659ebf1
JH
21413yacc='$yacc'
21414yaccflags='$yaccflags'
5f80c64f
JH
21415zcat='$zcat'
21416zip='$zip'
21417EOT
21418
21419: Add in command line options if available
21420$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21421
21422: add special variables
21423$test -f $src/patchlevel.h && \
d00b958f 21424awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 21425echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 21426echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
21427
21428: propagate old symbols
21429if $test -f UU/config.sh; then
381aa1ff 21430 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 21431 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 21432 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
21433 set X `cat UU/oldsyms`
21434 shift
21435 case $# in
21436 0) ;;
21437 *)
21438 cat <<EOM
21439Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21440EOM
21441 echo "# Variables propagated from previous config.sh file." >>config.sh
21442 for sym in `cat UU/oldsyms`; do
21443 echo " Propagating $hint variable "'$'"$sym..."
21444 eval 'tmp="$'"${sym}"'"'
21445 echo "$tmp" | \
21446 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21447 done
21448 ;;
21449 esac
21450fi
21451
21452: Finish up by extracting the .SH files
21453case "$alldone" in
21454exit)
21455 $rm -rf UU
24ccb310 21456 echo "Extraction done."
5f80c64f
JH
21457 exit 0
21458 ;;
21459cont)
21460 ;;
21461'')
21462 dflt=''
21463 nostick=true
21464 $cat <<EOM
21465
21466If you'd like to make any changes to the config.sh file before I begin
21467to configure things, do it as a shell escape now (e.g. !vi config.sh).
21468
21469EOM
21470 rp="Press return or use a shell escape to edit config.sh:"
21471 . UU/myread
21472 nostick=''
21473 case "$ans" in
21474 '') ;;
21475 *) : in case they cannot read
21476 sh 1>&4 -c "$ans";;
21477 esac
21478 ;;
21479esac
21480
21481: if this fails, just run all the .SH files by hand
21482. ./config.sh
21483
21484echo " "
21485exec 1>&4
a43e8593 21486pwd=`pwd`
5f80c64f 21487. ./UU/extract
6904989c 21488cd "$pwd"
5f80c64f
JH
21489
21490if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
21491 dflt=y
21492 case "$silent" in
21493 true) ;;
21494 *)
21495 $cat <<EOM
21496
21497Now you need to generate make dependencies by running "$make depend".
21498You might prefer to run it in background: "$make depend > makedepend.out &"
21499It can take a while, so you might not want to run it right now.
21500
21501EOM
21502 ;;
21503 esac
21504 rp="Run $make depend now?"
21505 . UU/myread
21506 case "$ans" in
21507 y*)
3d5d58b1 21508 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
21509 ;;
21510 *)
21511 echo "You must run '$make depend' then '$make'."
21512 ;;
21513 esac
21514elif test -f [Mm]akefile; then
21515 echo " "
21516 echo "Now you must run a $make."
21517else
24ccb310 21518 echo "Configure done."
5f80c64f
JH
21519fi
21520
21521if $test -f Policy.sh; then
21522 $cat <<EOM
21523
21524If you compile $package on a different machine or from a different object
21525directory, copy the Policy.sh file from this object directory to the
21526new one before you run Configure -- this will help you with most of
21527the policy defaults.
21528
21529EOM
21530fi
21531if $test -f config.msg; then
21532 echo "Hmm. I also noted the following information while running:"
21533 echo " "
21534 $cat config.msg >&4
21535 $rm -f config.msg
21536fi
21537$rm -f kit*isdone ark*isdone
21538$rm -rf UU
21539
21540: End of Configure
21541