This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate:
[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#
3bf3851b 23# Generated on Sun Apr 24 14:17:04 CEST 2005 [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
a868f49f 50if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
2ea5368e
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 :-]
8257dec7 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]'`
8257dec7 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 93paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
066079d9 94paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
232e078e
AD
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=''
bd43df42 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=''
5a29c6bc 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=''
5a29c6bc 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=''
ff0950a8 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=''
5a29c6bc 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=''
a663fd0a 528d_libm_lib_version=''
b4eb6b3d 529d_link=''
10bc17b6
JH
530d_localtime_r=''
531localtime_r_proto=''
b4eb6b3d
JH
532d_locconv=''
533d_lockf=''
534d_longdbl=''
535longdblsize=''
536d_longlong=''
537longlongsize=''
538d_lseekproto=''
539d_lstat=''
540d_madvise=''
541d_mblen=''
542d_mbstowcs=''
543d_mbtowc=''
544d_memchr=''
545d_memcmp=''
546d_memcpy=''
547d_memmove=''
548d_memset=''
549d_mkdir=''
550d_mkdtemp=''
551d_mkfifo=''
552d_mkstemp=''
553d_mkstemps=''
554d_mktime=''
555d_mmap=''
556mmaptype=''
557d_modfl=''
e67aeab1 558d_modfl_pow32_bug=''
bc9a1b2c 559d_modflproto=''
b4eb6b3d
JH
560d_mprotect=''
561d_msg=''
562d_msgctl=''
563d_msgget=''
4e0554ec 564d_msghdr_s=''
b4eb6b3d
JH
565d_msgrcv=''
566d_msgsnd=''
567d_msync=''
568d_munmap=''
569d_nice=''
2765b840 570d_nl_langinfo=''
b4eb6b3d
JH
571d_off64_t=''
572d_open3=''
573d_fpathconf=''
574d_pathconf=''
575d_pause=''
576d_pipe=''
577d_poll=''
2304df62 578d_portable=''
a33c94aa 579d_procselfexe=''
f24dbf84 580procselfexe=''
b4eb6b3d
JH
581d_old_pthread_create_joinable=''
582old_pthread_create_joinable=''
d6483fcc 583d_pthread_atfork=''
16c773f9 584d_pthread_attr_setscope=''
b4eb6b3d
JH
585d_pthread_yield=''
586d_sched_yield=''
587sched_yield=''
588d_qgcvt=''
10bc17b6
JH
589d_random_r=''
590random_r_proto=''
591d_readdir64_r=''
592readdir64_r_proto=''
b4eb6b3d
JH
593d_readdir=''
594d_rewinddir=''
595d_seekdir=''
596d_telldir=''
10bc17b6
JH
597d_readdir_r=''
598readdir_r_proto=''
b4eb6b3d 599d_readlink=''
4e0554ec
JH
600d_readv=''
601d_recvmsg=''
b4eb6b3d
JH
602d_rename=''
603d_rmdir=''
604d_safebcpy=''
605d_safemcpy=''
606d_sanemcmp=''
ef9f17be 607d_sbrkproto=''
5a29c6bc 608d_scalbnl=''
b4eb6b3d
JH
609d_select=''
610d_sem=''
611d_semctl=''
612d_semget=''
613d_semop=''
4e0554ec 614d_sendmsg=''
b4eb6b3d
JH
615d_setegid=''
616d_seteuid=''
617d_setgrent=''
10bc17b6
JH
618d_setgrent_r=''
619setgrent_r_proto=''
b4eb6b3d
JH
620d_setgrps=''
621d_sethent=''
10bc17b6
JH
622d_sethostent_r=''
623sethostent_r_proto=''
4e0554ec 624d_setitimer=''
b4eb6b3d
JH
625d_setlinebuf=''
626d_setlocale=''
10bc17b6
JH
627d_setlocale_r=''
628setlocale_r_proto=''
b4eb6b3d 629d_setnent=''
10bc17b6
JH
630d_setnetent_r=''
631setnetent_r_proto=''
b4eb6b3d
JH
632d_setpent=''
633d_setpgid=''
634d_setpgrp2=''
635d_bsdsetpgrp=''
636d_setpgrp=''
637d_setprior=''
638d_setproctitle=''
10bc17b6
JH
639d_setprotoent_r=''
640setprotoent_r_proto=''
b4eb6b3d 641d_setpwent=''
10bc17b6
JH
642d_setpwent_r=''
643setpwent_r_proto=''
b4eb6b3d
JH
644d_setregid=''
645d_setresgid=''
646d_setresuid=''
647d_setreuid=''
648d_setrgid=''
649d_setruid=''
650d_setsent=''
10bc17b6
JH
651d_setservent_r=''
652setservent_r_proto=''
b4eb6b3d
JH
653d_setsid=''
654d_setvbuf=''
655d_sfio=''
656usesfio=''
657d_shm=''
658d_shmat=''
659d_shmatprototype=''
660shmattype=''
661d_shmctl=''
662d_shmdt=''
663d_shmget=''
664d_sigaction=''
983dbef6 665d_sigprocmask=''
b4eb6b3d 666d_sigsetjmp=''
5d39362b 667usesitecustomize=''
49a78c82 668d_sockatmark=''
2ef53570 669d_sockatmarkproto=''
b4eb6b3d
JH
670d_msg_ctrunc=''
671d_msg_dontroute=''
672d_msg_oob=''
673d_msg_peek=''
674d_msg_proxy=''
675d_oldsock=''
676d_scm_rights=''
677d_socket=''
678d_sockpair=''
679sockethdr=''
680socketlib=''
681d_socklen_t=''
682d_socks5_init=''
683d_sqrtl=''
10bc17b6
JH
684d_srand48_r=''
685srand48_r_proto=''
686d_srandom_r=''
687srandom_r_proto=''
eef837ea 688d_sresgproto=''
640374d0 689d_sresuproto=''
b4eb6b3d
JH
690d_statblks=''
691d_statfs_f_flags=''
692d_statfs_s=''
693d_fstatvfs=''
694d_statvfs=''
695d_stdio_cnt_lval=''
696d_stdio_ptr_lval=''
a7ffa9b9
NC
697d_stdio_ptr_lval_nochange_cnt=''
698d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
699d_stdiobase=''
700d_stdstdio=''
701stdio_base=''
702stdio_bufsiz=''
703stdio_cnt=''
704stdio_filbuf=''
705stdio_ptr=''
706d_index=''
707d_strchr=''
708d_strcoll=''
709d_strctcpy=''
710d_strerrm=''
711d_strerror=''
712d_sysernlst=''
713d_syserrlst=''
10bc17b6
JH
714d_strerror_r=''
715strerror_r_proto=''
b3c85772 716d_strftime=''
84baed4c
CB
717d_strlcat=''
718d_strlcpy=''
b4eb6b3d
JH
719d_strtod=''
720d_strtol=''
721d_strtold=''
722d_strtoll=''
28e5dec8 723d_strtoq=''
b4eb6b3d
JH
724d_strtoul=''
725d_strtoull=''
726d_strtouq=''
727d_strxfrm=''
728d_symlink=''
729d_syscall=''
2ef53570 730d_syscallproto=''
b4eb6b3d
JH
731d_sysconf=''
732d_system=''
733d_tcgetpgrp=''
734d_tcsetpgrp=''
735d_telldirproto=''
736d_time=''
737timetype=''
738clocktype=''
739d_times=''
10bc17b6
JH
740d_tmpnam_r=''
741tmpnam_r_proto=''
b4eb6b3d 742d_truncate=''
10bc17b6
JH
743d_ttyname_r=''
744ttyname_r_proto=''
b4eb6b3d 745d_tzname=''
4e0554ec
JH
746d_u32align=''
747d_ualarm=''
b4eb6b3d
JH
748d_umask=''
749d_semctl_semid_ds=''
750d_semctl_semun=''
751d_union_semun=''
758a5d79 752d_unordered=''
4e0554ec 753d_usleep=''
2ef53570 754d_usleepproto=''
b4eb6b3d
JH
755d_ustat=''
756d_vfork=''
757usevfork=''
758d_voidsig=''
759signal_t=''
760d_volatile=''
761d_charvspr=''
762d_vprintf=''
763d_wait4=''
764d_waitpid=''
765d_wcstombs=''
766d_wctomb=''
4e0554ec 767d_writev=''
b4eb6b3d 768dlext=''
85e6fe83
LW
769cccdlflags=''
770ccdlflags=''
2304df62 771dlsrc=''
232e078e 772ld=''
85e6fe83 773lddlflags=''
2304df62 774usedl=''
b4eb6b3d
JH
775doublesize=''
776ebcdic=''
777fflushNULL=''
778fflushall=''
779fpossize=''
780fpostype=''
2d736872 781gccansipedantic=''
5b463ca7 782gccosandvers=''
8a27cf78 783gccversion=''
b4eb6b3d
JH
784gidformat=''
785gidsign=''
786gidsize=''
787gidtype=''
788groupstype=''
789h_fcntl=''
790h_sysfile=''
6e1038e0
MB
791html1dir=''
792html1direxp=''
793installhtml1dir=''
794html3dir=''
795html3direxp=''
796installhtml3dir=''
b4eb6b3d 797i_arpainet=''
10bc17b6 798i_crypt=''
b4eb6b3d
JH
799db_hashtype=''
800db_prefixtype=''
640374d0
JH
801db_version_major=''
802db_version_minor=''
803db_version_patch=''
b4eb6b3d
JH
804i_db=''
805i_dbm=''
806i_rpcsvcdbm=''
807d_dirnamlen=''
808direntrytype=''
809i_dirent=''
a0d0e21e 810i_dld=''
b4eb6b3d
JH
811i_dlfcn=''
812i_fcntl=''
813i_float=''
758a5d79
JH
814i_fp=''
815i_fp_class=''
b4eb6b3d
JH
816i_gdbm=''
817d_grpasswd=''
818i_grp=''
b4eb6b3d
JH
819i_ieeefp=''
820i_inttypes=''
2765b840 821i_langinfo=''
b4eb6b3d
JH
822i_libutil=''
823i_limits=''
824i_locale=''
825i_machcthr=''
826i_malloc=''
827i_math=''
828i_memory=''
829i_mntent=''
830i_ndbm=''
831i_netdb=''
832i_neterrno=''
833i_netinettcp=''
834i_niin=''
835i_sysin=''
836i_poll=''
837i_prot=''
838i_pthread=''
839d_pwage=''
840d_pwchange=''
841d_pwclass=''
842d_pwcomment=''
843d_pwexpire=''
844d_pwgecos=''
845d_pwpasswd=''
846d_pwquota=''
847i_pwd=''
848i_sfio=''
849i_shadow=''
850i_socks=''
851i_stddef=''
852i_stdlib=''
853i_string=''
854strings=''
855i_sunmath=''
856i_sysaccess=''
857i_sysdir=''
858i_sysfile=''
859d_voidtty=''
860i_bsdioctl=''
861i_sysfilio=''
862i_sysioctl=''
863i_syssockio=''
864i_syslog=''
865i_sysmman=''
866i_sysmode=''
867i_sysmount=''
868i_sysndir=''
869i_sysparam=''
870i_sysresrc=''
871i_syssecrt=''
872i_sysselct=''
873i_sysstat=''
874i_sysstatfs=''
875i_sysstatvfs=''
876i_systimes=''
877i_systypes=''
878i_sysuio=''
879i_sysun=''
880i_sysutsname=''
881i_sysvfs=''
882i_syswait=''
883i_sgtty=''
884i_termio=''
885i_termios=''
14b90194
JH
886d_tm_tm_gmtoff=''
887d_tm_tm_zone=''
b4eb6b3d
JH
888i_systime=''
889i_systimek=''
890i_time=''
891timeincl=''
892i_unistd=''
893i_ustat=''
894i_utime=''
895i_values=''
896i_stdarg=''
897i_varargs=''
898i_varhdr=''
899i_vfork=''
900inc_version_list=''
901inc_version_list_init=''
902installprefix=''
903installprefixexp=''
904installstyle=''
905installusrbinperl=''
906intsize=''
907longsize=''
908shortsize=''
4b661809 909issymlink=''
2304df62 910libc=''
b4eb6b3d
JH
911ldlibpthname=''
912libperl=''
913shrpenv=''
914useshrplib=''
a0d0e21e 915glibpth=''
2304df62 916libpth=''
8e07c86e 917loclibpth=''
2304df62
AD
918plibpth=''
919xlibpth=''
1cfa4ec7 920ignore_versioned_solibs=''
2304df62 921libs=''
43999f95
JH
922libsdirs=''
923libsfiles=''
924libsfound=''
13b3f787 925libspath=''
85e6fe83 926lns=''
b4eb6b3d
JH
927d_PRIEUldbl=''
928d_PRIFUldbl=''
929d_PRIGUldbl=''
930d_PRIeldbl=''
931d_PRIfldbl=''
932d_PRIgldbl=''
933d_SCNfldbl=''
934sPRIEUldbl=''
935sPRIFUldbl=''
936sPRIGUldbl=''
937sPRIeldbl=''
938sPRIfldbl=''
939sPRIgldbl=''
940sSCNfldbl=''
941lseeksize=''
942lseektype=''
8ff267be 943make_set_make=''
b4eb6b3d
JH
944d_mymalloc=''
945freetype=''
946mallocobj=''
947mallocsrc=''
948malloctype=''
1c6118a4 949usemallocwrap=''
b4eb6b3d
JH
950usemymalloc=''
951installman1dir=''
952man1dir=''
953man1direxp=''
954man1ext=''
955installman3dir=''
956man3dir=''
957man3direxp=''
958man3ext=''
959modetype=''
960multiarch=''
961mydomain=''
962myhostname=''
963phostname=''
2304df62
AD
964c=''
965n=''
b4eb6b3d
JH
966d_eofnblk=''
967eagain=''
968o_nonblock=''
969rd_nodata=''
2cc61e15 970need_va_copy=''
b4eb6b3d
JH
971netdb_hlen_type=''
972netdb_host_type=''
973netdb_name_type=''
974netdb_net_type=''
975groupcat=''
976hostcat=''
977passcat=''
978orderlib=''
979ranlib=''
980d_perl_otherlibdirs=''
981otherlibdirs=''
2304df62
AD
982package=''
983spackage=''
b4eb6b3d
JH
984pager=''
985api_revision=''
986api_subversion=''
987api_version=''
988api_versionstring=''
989patchlevel=''
151e6568 990perl_patchlevel=''
b4eb6b3d
JH
991revision=''
992subversion=''
993version=''
861eb78d 994version_patchlevel_string=''
b4eb6b3d
JH
995perl5=''
996perladmin=''
997perlpath=''
998d_nv_preserves_uv=''
b4eb6b3d
JH
999i16size=''
1000i16type=''
1001i32size=''
1002i32type=''
1003i64size=''
1004i64type=''
1005i8size=''
1006i8type=''
1007ivsize=''
1008ivtype=''
53133ed1 1009nv_preserves_uv_bits=''
b4eb6b3d
JH
1010nvsize=''
1011nvtype=''
1012u16size=''
1013u16type=''
1014u32size=''
1015u32type=''
1016u64size=''
1017u64type=''
1018u8size=''
1019u8type=''
1020uvsize=''
1021uvtype=''
1022ivdformat=''
1023nvEUformat=''
1024nvFUformat=''
1025nvGUformat=''
1026nveformat=''
1027nvfformat=''
1028nvgformat=''
1029uvXUformat=''
1030uvoformat=''
1031uvuformat=''
1032uvxformat=''
1033pidtype=''
1034prefix=''
1035prefixexp=''
1036installprivlib=''
1037privlib=''
1038privlibexp=''
1039prototype=''
1040ptrsize=''
1041d_PRIXU64=''
1042d_PRId64=''
1043d_PRIi64=''
1044d_PRIo64=''
1045d_PRIu64=''
1046d_PRIx64=''
1047sPRIXU64=''
1048sPRId64=''
1049sPRIi64=''
1050sPRIo64=''
1051sPRIu64=''
1052sPRIx64=''
1053d_quad=''
1054quadkind=''
1055quadtype=''
1056uquadtype=''
1057drand01=''
1058randbits=''
1059randfunc=''
1060randseedtype=''
1061seedfunc=''
1062installscript=''
1063scriptdir=''
1064scriptdirexp=''
1065selectminbits=''
1066selecttype=''
8ff267be 1067sh=''
b4eb6b3d
JH
1068sig_count=''
1069sig_name=''
1070sig_name_init=''
1071sig_num=''
1072sig_num_init=''
76d3c696 1073sig_size=''
b4eb6b3d
JH
1074installsitearch=''
1075sitearch=''
1076sitearchexp=''
1077installsitebin=''
1078sitebin=''
1079sitebinexp=''
3bb95762
JH
1080installsitehtml1dir=''
1081sitehtml1dir=''
1082sitehtml1direxp=''
1083installsitehtml3dir=''
1084sitehtml3dir=''
1085sitehtml3direxp=''
b4eb6b3d
JH
1086installsitelib=''
1087sitelib=''
1088sitelib_stem=''
1089sitelibexp=''
3bb95762
JH
1090installsiteman1dir=''
1091siteman1dir=''
1092siteman1direxp=''
1093installsiteman3dir=''
1094siteman3dir=''
1095siteman3direxp=''
b4eb6b3d
JH
1096siteprefix=''
1097siteprefixexp=''
6e1038e0
MB
1098installsitescript=''
1099sitescript=''
1100sitescriptexp=''
b4eb6b3d
JH
1101sizesize=''
1102sizetype=''
a0d0e21e 1103so=''
b4eb6b3d 1104socksizetype=''
2304df62
AD
1105sharpbang=''
1106shsharp=''
1107spitshell=''
dfe9444c 1108src=''
b4eb6b3d
JH
1109ssizetype=''
1110startperl=''
2304df62 1111startsh=''
b4eb6b3d
JH
1112stdchar=''
1113d_stdio_stream_array=''
1114stdio_stream_array=''
1115sysman=''
5ff3f7a4 1116trnl=''
b4eb6b3d
JH
1117uidformat=''
1118uidsign=''
1119uidsize=''
1120uidtype=''
1121archname64=''
1122use64bitall=''
1123use64bitint=''
ff0950a8 1124usefaststdio=''
b4eb6b3d
JH
1125ccflags_uselargefiles=''
1126ldflags_uselargefiles=''
1127libswanted_uselargefiles=''
1128uselargefiles=''
1129uselongdouble=''
1130usemorebits=''
1131usemultiplicity=''
2304df62 1132nm_opt=''
40a7a20a 1133nm_so_opt=''
2304df62
AD
1134runnm=''
1135usenm=''
b4eb6b3d 1136useperlio=''
29209bc5 1137usesocks=''
b4eb6b3d
JH
1138d_oldpthreads=''
1139use5005threads=''
1140useithreads=''
9514c62b 1141usereentrant=''
b4eb6b3d 1142usethreads=''
2304df62 1143incpath=''
2304df62
AD
1144mips_type=''
1145usrinc=''
b4eb6b3d
JH
1146d_vendorarch=''
1147installvendorarch=''
1148vendorarch=''
1149vendorarchexp=''
1150d_vendorbin=''
1151installvendorbin=''
1152vendorbin=''
1153vendorbinexp=''
3bb95762
JH
1154installvendorhtml1dir=''
1155vendorhtml1dir=''
1156vendorhtml1direxp=''
1157installvendorhtml3dir=''
1158vendorhtml3dir=''
1159vendorhtml3direxp=''
b4eb6b3d
JH
1160d_vendorlib=''
1161installvendorlib=''
1162vendorlib=''
1163vendorlib_stem=''
1164vendorlibexp=''
3bb95762
JH
1165installvendorman1dir=''
1166vendorman1dir=''
1167vendorman1direxp=''
1168installvendorman3dir=''
1169vendorman3dir=''
1170vendorman3direxp=''
b4eb6b3d
JH
1171usevendorprefix=''
1172vendorprefix=''
1173vendorprefixexp=''
6e1038e0
MB
1174d_vendorscript=''
1175installvendorscript=''
1176vendorscript=''
1177vendorscriptexp=''
d56c5707 1178versiononly=''
b4eb6b3d
JH
1179defvoidused=''
1180voidflags=''
3659ebf1
JH
1181yacc=''
1182yaccflags=''
2304df62
AD
1183CONFIG=''
1184
ecfc5424
AD
1185define='define'
1186undef='undef'
1187smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1188rmlist=''
1189
1190: We must find out about Eunice early
1191eunicefix=':'
1192if test -f /etc/unixtovms; then
1193 eunicefix=/etc/unixtovms
1194fi
1195if test -f /etc/unixtovms.exe; then
1196 eunicefix=/etc/unixtovms.exe
1197fi
1198
cfb04860 1199: Set executable suffix now -- needed before hints available
6153ba32
PG
1200if test -f "/libs/version.library"; then
1201: Amiga OS
1202 _exe=""
1203elif test -f "/system/gnu_library/bin/ar.pm"; then
1204: Stratus VOS
cfb04860 1205 _exe=".pm"
6153ba32
PG
1206elif test -n "$DJGPP"; then
1207: DOS DJGPP
cfb04860 1208 _exe=".exe"
8257dec7 1209elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1210: OS/2 or cygwin
ba863942
JH
1211 _exe=".exe"
1212fi
868439a2 1213
b4eb6b3d 1214i_whoami=''
6bd2d01f
NC
1215ccname=''
1216ccversion=''
1217perllibs=''
1218: set useposix=false in your hint file to disable the POSIX extension.
1219useposix=true
1220: set useopcode=false in your hint file to disable the Opcode extension.
1221useopcode=true
1222: Trailing extension. Override this in a hint file, if needed.
1223: Extra object files, if any, needed on this platform.
1224archobjs=''
1225archname=''
ff935051
JH
1226: Possible local include directories to search.
1227: Set locincpth to "" in a hint file to defeat local include searches.
1228locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1229locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1230:
1231: no include file wanted by default
1232inclwanted=''
1233
b4eb6b3d 1234groupstype=''
64615a5e 1235libnames=''
732c9516
JH
1236: change the next line if compiling for Xenix/286 on Xenix/386
1237xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1238: Possible local library directories to search.
1239loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1240loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1241
1242: general looking path for locating libraries
5869b1f1 1243glibpth="/lib /usr/lib $xlibpth"
732c9516 1244glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1245test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1246test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1247
1248: Private path used by Configure to find libraries. Its value
1249: is prepended to libpth. This variable takes care of special
1250: machines, like the mips. Usually, it should be empty.
1251plibpth=''
1252
1cfa4ec7
GS
1253: default library list
1254libswanted=''
921b2963 1255: some systems want to use only the non-versioned libso:s
1cfa4ec7 1256ignore_versioned_solibs=''
6bd2d01f
NC
1257siteman1dir=''
1258siteman3dir=''
1259sitescript=''
b4eb6b3d
JH
1260archname64=''
1261ccflags_uselargefiles=''
1262ldflags_uselargefiles=''
1263libswanted_uselargefiles=''
1264: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1265: set usesocks on the Configure command line to enable socks.
b4eb6b3d 1266: set usethreads on the Configure command line to enable threads.
cd040c5e 1267usereentrant='undef'
6bd2d01f
NC
1268: full support for void wanted by default
1269defvoidused=15
1270
ecfc5424 1271: List of libraries we want.
406c4b1e
JH
1272: If anyone needs extra -lxxx, put those in a hint file.
1273libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1274libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1275: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1276: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1277glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1278glibpth="/usr/shlib $glibpth"
1279: Do not use vfork unless overridden by a hint file.
1280usevfork=false
1281
8ff267be 1282: Find the basic shell for Bourne shell scripts
1283case "$sh" in
1284'')
8ff267be 1285 case "$SYSTYPE" in
1286 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1287 *) xxx='/bin/sh';;
1288 esac
1289 if test -f "$xxx"; then
1290 sh="$xxx"
1291 else
1292 : Build up a list and do a single loop so we can 'break' out.
1293 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1294 for xxx in sh bash ksh pdksh ash; do
1295 for p in $pth; do
1296 try="$try ${p}/${xxx}"
1297 done
1298 done
1299 for xxx in $try; do
1300 if test -f "$xxx"; then
1301 sh="$xxx";
8ff267be 1302 break
a5a94ea5
JH
1303 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1304 sh="$xxx";
1305 break
8ff267be 1306 elif test -f "$xxx.exe"; then
1307 sh="$xxx";
8ff267be 1308 break
1309 fi
1310 done
1311 fi
1312 ;;
1313esac
1314
1315case "$sh" in
a33c94aa 1316'') cat >&2 <<EOM
8ff267be 1317$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1318
8ff267be 1319Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1320Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1321we'll try to straighten this all out.
8ff267be 1322EOM
1323 exit 1
1324 ;;
1325esac
1326
760ac839 1327: see if sh knows # comments
73614538 1328if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1329 shsharp=true
1330 spitshell=cat
760ac839 1331 xcat=/bin/cat
a931254c
JH
1332 test -f $xcat$_exe || xcat=/usr/bin/cat
1333 if test ! -f $xcat$_exe; then
4bdb8fb5 1334 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1335 if test -f $p/cat$_exe; then
1deb0a86 1336 xcat=$p/cat
3c728e00
JH
1337 break
1338 fi
1339 done
1deb0a86
JH
1340 if test ! -f $xcat$_exe; then
1341 echo "Can't find cat anywhere!"
3c728e00
JH
1342 exit 1
1343 fi
1344 fi
5440bc8e
JH
1345 echo "#!$xcat" >sharp
1346 $eunicefix sharp
1347 chmod +x sharp
1348 ./sharp > today
760ac839 1349 if test -s today; then
760ac839
LW
1350 sharpbang='#!'
1351 else
5440bc8e
JH
1352 echo "#! $xcat" > sharp
1353 $eunicefix sharp
1354 chmod +x sharp
1355 ./sharp > today
760ac839 1356 if test -s today; then
760ac839
LW
1357 sharpbang='#! '
1358 else
760ac839
LW
1359 sharpbang=': use '
1360 fi
1361 fi
1362else
dfe9444c 1363 echo " "
8ff267be 1364 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1365 shsharp=false
1366 cd ..
1367 echo "exec grep -v '^[ ]*#'" >spitshell
1368 chmod +x spitshell
1369 $eunicefix spitshell
1370 spitshell=`pwd`/spitshell
1371 cd UU
1372 echo "I presume that if # doesn't work, #! won't work either!"
1373 sharpbang=': use '
1374fi
5440bc8e 1375rm -f sharp today
760ac839
LW
1376
1377: figure out how to guarantee sh startup
8ff267be 1378case "$startsh" in
1379'') startsh=${sharpbang}${sh} ;;
1380*)
760ac839 1381esac
5440bc8e 1382cat >sharp <<EOSS
760ac839
LW
1383$startsh
1384set abc
1385test "$?abc" != 1
1386EOSS
1387
5440bc8e
JH
1388chmod +x sharp
1389$eunicefix sharp
1390if ./sharp; then
8ff267be 1391 : echo "Yup, it does."
760ac839 1392else
dfe9444c
AD
1393 echo "Hmm... '$startsh' does not guarantee sh startup..."
1394 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1395fi
5440bc8e 1396rm -f sharp
760ac839 1397
aebf16e7
AD
1398
1399: Save command line options in file UU/cmdline.opt for later use in
1400: generating config.sh.
1401cat > cmdline.opt <<EOSH
1402# Configure command line arguments.
1403config_arg0='$0'
1404config_args='$*'
1405config_argc=$#
1406EOSH
1407argn=1
ee45ea83
IZ
1408args_exp=''
1409args_sep=''
aebf16e7
AD
1410for arg in "$@"; do
1411 cat >>cmdline.opt <<EOSH
1412config_arg$argn='$arg'
1413EOSH
ee45ea83
IZ
1414 # Extreme backslashitis: replace each ' by '"'"'
1415 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1416$arg
1417EOC
1418 arg_exp=`cat cmdl.opt`
1419 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1420 argn=`expr $argn + 1`
ee45ea83 1421 args_sep=' '
aebf16e7 1422done
ee45ea83
IZ
1423# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1424# used by ./hints/os2.sh
1425rm -f cmdl.opt
aebf16e7 1426
2304df62
AD
1427: produce awk script to parse command line options
1428cat >options.awk <<'EOF'
1429BEGIN {
02e93a22 1430 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1431
1432 len = length(optstr);
1433 for (i = 1; i <= len; i++) {
1434 c = substr(optstr, i, 1);
1435 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1436 if (a == ":") {
1437 arg[c] = 1;
1438 i++;
1439 }
1440 opt[c] = 1;
1441 }
1442}
1443{
1444 expect = 0;
1445 str = $0;
1446 if (substr(str, 1, 1) != "-") {
1447 printf("'%s'\n", str);
1448 next;
1449 }
1450 len = length($0);
1451 for (i = 2; i <= len; i++) {
1452 c = substr(str, i, 1);
1453 if (!opt[c]) {
1454 printf("-%s\n", substr(str, i));
1455 next;
1456 }
1457 printf("-%s\n", c);
1458 if (arg[c]) {
1459 if (i < len)
1460 printf("'%s'\n", substr(str, i + 1));
1461 else
1462 expect = 1;
1463 next;
1464 }
1465 }
1466}
1467END {
1468 if (expect)
1469 print "?";
1470}
1471EOF
1472
1473: process the command line options
4633a7c4
LW
1474set X `for arg in "$@"; do echo "X$arg"; done |
1475 sed -e s/X// | awk -f options.awk`
2304df62
AD
1476eval "set $*"
1477shift
1478rm -f options.awk
1479
1480: set up default values
1481fastread=''
1482reuseval=false
1483config_sh=''
1484alldone=''
1485error=''
1486silent=''
1487extractsh=''
ecfc5424 1488override=''
16d20bd9 1489knowitall=''
02e93a22 1490rm -f optdef.sh posthint.sh
28757baa 1491cat >optdef.sh <<EOS
1492$startsh
1493EOS
2304df62 1494
dfe9444c 1495
2304df62
AD
1496: option parsing
1497while test $# -gt 0; do
1498 case "$1" in
1499 -d) shift; fastread=yes;;
1500 -e) shift; alldone=cont;;
1501 -f)
1502 shift
1503 cd ..
1504 if test -r "$1"; then
1505 config_sh="$1"
1506 else
a0d0e21e 1507 echo "$me: cannot read config file $1." >&2
2304df62
AD
1508 error=true
1509 fi
1510 cd UU
1511 shift;;
1512 -h) shift; error=true;;
1513 -r) shift; reuseval=true;;
dfe9444c 1514 -s) shift; silent=true; realsilent=true;;
2304df62 1515 -E) shift; alldone=exit;;
16d20bd9 1516 -K) shift; knowitall=true;;
ecfc5424 1517 -O) shift; override=true;;
dfe9444c 1518 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1519 -D)
1520 shift
1521 case "$1" in
1522 *=)
1523 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1524 echo "$me: ignoring -D $1" >&2
1525 ;;
ecfc5424 1526 *=*) echo "$1" | \
1aef975c
AD
1527 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1528 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1529 esac
1530 shift
1531 ;;
1532 -U)
1533 shift
1534 case "$1" in
1aef975c 1535 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1536 *=*)
1537 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1538 echo "$me: ignoring -U $1" >&2
1539 ;;
1aef975c 1540 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1541 esac
1542 shift
1543 ;;
02e93a22
JH
1544 -A)
1545 shift
1546 xxx=''
1547 yyy="$1"
02e93a22 1548 zzz=''
5f83a3e9 1549 uuu=undef
02e93a22 1550 case "$yyy" in
f7c31117 1551 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1552 case "$zzz" in
1553 *:*) zzz='' ;;
1554 *) xxx=append
f7c31117
JH
1555 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1556 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1557 esac
1558 ;;
1559 esac
1560 case "$xxx" in
1561 '') case "$yyy" in
f7c31117
JH
1562 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1563 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1564 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1565 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1566 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1567 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9
JH
1568 esac
1569 ;;
1570 esac
02e93a22
JH
1571 case "$xxx" in
1572 append)
5f83a3e9 1573 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1574 clear)
5f83a3e9 1575 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1576 define)
1577 case "$zzz" in
1578 '') zzz=define ;;
1579 esac
5f83a3e9 1580 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1581 eval)
5f83a3e9 1582 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1583 prepend)
5f83a3e9 1584 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1585 undef)
1586 case "$zzz" in
1587 '') zzz="$uuu" ;;
1588 esac
5f83a3e9
JH
1589 echo "$yyy=$zzz" >> posthint.sh ;;
1590 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1591 esac
bde6b06b 1592 shift
02e93a22 1593 ;;
dfe9444c 1594 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1595 exit 0;;
2304df62 1596 --) break;;
a0d0e21e 1597 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1598 *) break;;
1599 esac
1600done
1601
1602case "$error" in
1603true)
1604 cat >&2 <<EOM
2afac517 1605Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1606 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1607 -d : use defaults for all answers.
1608 -e : go on without questioning past the production of config.sh.
1609 -f : specify an alternate default configuration file.
1610 -h : print this help message and exit (with an error status).
1611 -r : reuse C symbols value if possible (skips costly nm extraction).
1612 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1613 -D : define symbol to have some value:
1614 -D symbol symbol gets the value 'define'
1615 -D symbol=value symbol gets the value 'value'
2304df62 1616 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1617 -K : do not use unless you know what you are doing.
ecfc5424 1618 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1619 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1620 -U : undefine symbol:
1621 -U symbol symbol gets the value 'undef'
1622 -U symbol= symbol gets completely empty
02e93a22 1623 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1624 -A symbol=value append " "value to symbol
02e93a22
JH
1625 -A append:symbol=value append value to symbol
1626 -A define:symbol=value define symbol to have value
02e93a22
JH
1627 -A clear:symbol define symbol to be ''
1628 -A define:symbol define symbol to be 'define'
1629 -A eval:symbol=value define symbol to be eval of value
1630 -A prepend:symbol=value prepend value to symbol
1631 -A undef:symbol define symbol to be 'undef'
1632 -A undef:symbol= define symbol to be ''
2304df62
AD
1633 -V : print version number and exit (with a zero status).
1634EOM
1635 exit 1
1636 ;;
1637esac
1638
dfe9444c
AD
1639: Sanity checks
1640case "$fastread$alldone" in
1641yescont|yesexit) ;;
1642*)
aaeb8e51
GS
1643 case "$extractsh" in
1644 true) ;;
1645 *)
1646 if test ! -t 0; then
1647 echo "Say 'sh Configure', not 'sh <Configure'"
1648 exit 1
1649 fi
1650 ;;
1651 esac
dfe9444c
AD
1652 ;;
1653esac
1654
2304df62
AD
1655exec 4>&1
1656case "$silent" in
1657true) exec 1>/dev/null;;
1658esac
1659
ecfc5424 1660: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1661touch optdef.sh
1662. ./optdef.sh
02e93a22
JH
1663: create the posthint manipulation script and leave the file out there...
1664touch posthint.sh
a0d0e21e 1665
2304df62 1666: set package name
85e6fe83 1667package=perl5
b4eb6b3d
JH
1668first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1669last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1670case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1671ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1672*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1673esac
2304df62 1674
2304df62
AD
1675: Some greps do not return status, grrr.
1676echo "grimblepritz" >grimble
1677if grep blurfldyick grimble >/dev/null 2>&1 ; then
1678 contains=contains
1679elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1680 contains=grep
1681else
1682 contains=contains
1683fi
1684rm -f grimble
1685: the following should work in any shell
1686case "$contains" in
1687contains*)
1688 echo " "
1689 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1690 cat >contains <<'EOSS'
1691grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1692EOSS
1693chmod +x contains
1694esac
1695
dfe9444c
AD
1696: Find the path to the source tree
1697case "$src" in
1698'') case "$0" in
b233458b
JH
1699 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1700 case "$src" in
1701 /*) ;;
8504afb7 1702 .) ;;
b233458b
JH
1703 *) src=`cd ../$src && pwd` ;;
1704 esac
1705 ;;
dfe9444c
AD
1706 *) src='.';;
1707 esac;;
1708esac
1709case "$src" in
1710'') src=/
1711 rsrc=/
1712 ;;
1713/*) rsrc="$src";;
1714*) rsrc="../$src";;
1715esac
1716if test -f $rsrc/Configure && \
1717 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1718then
1719 : found it, so we are ok.
1720else
1721 rsrc=''
1722 for src in . .. ../.. ../../.. ../../../..; do
1723 if test -f ../$src/Configure && \
1724 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1725 then
1726 rsrc=../$src
1727 break
1728 fi
1729 done
1730fi
1731case "$rsrc" in
1732'')
1733 cat <<EOM >&4
1734
1735Sorry, I can't seem to locate the source dir for $package. Please start
1736Configure with an explicit path -- i.e. /some/path/Configure.
1737
1738EOM
1739 exit 1
1740 ;;
1741../.) rsrc='..';;
1742*)
1743 echo " "
1744 echo "Sources for $package found in \"$src\"." >&4
1745 ;;
1746esac
1747
1748: script used to extract .SH files with variable substitutions
1749cat >extract <<'EOS'
a02608de 1750PERL_CONFIG_SH=true
dfe9444c 1751echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1752if test -f MANIFEST; then
1753 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1754else
1755 echo "(Looking for .SH files under the source directory.)"
6904989c 1756 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1757fi
1758shift
1759case $# in
6904989c 17600) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1761esac
6904989c 1762if test ! -f "$src/$1"; then
dfe9444c
AD
1763 shift
1764fi
1765mkdir_p='
1766name=$1;
1767create="";
1768while test $name; do
1769 if test ! -d "$name"; then
1770 create="$name $create";
1771 name=`echo $name | sed -e "s|^[^/]*$||"`;
1772 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1773 else
1774 name="";
1775 fi;
1776done;
1777for file in $create; do
1778 mkdir $file;
1779done
1780'
1781for file in $*; do
1782 case "$src" in
1783 ".")
1784 case "$file" in
1785 */*)
1786 dir=`expr X$file : 'X\(.*\)/'`
1787 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1788 (cd "$dir" && . ./$file)
dfe9444c
AD
1789 ;;
1790 *)
1791 . ./$file
1792 ;;
1793 esac
1794 ;;
1795 *)
1796 case "$file" in
1797 */*)
1798 dir=`expr X$file : 'X\(.*\)/'`
1799 file=`expr X$file : 'X.*/\(.*\)'`
1800 (set x $dir; shift; eval $mkdir_p)
6904989c 1801 sh <"$src/$dir/$file"
dfe9444c
AD
1802 ;;
1803 *)
6904989c 1804 sh <"$src/$file"
dfe9444c
AD
1805 ;;
1806 esac
1807 ;;
1808 esac
1809done
6904989c 1810if test -f "$src/config_h.SH"; then
dfe9444c
AD
1811 if test ! -f config.h; then
1812 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1813 . "$src/config_h.SH"
dfe9444c
AD
1814 fi
1815fi
1816EOS
1817
1818: extract files and exit if asked to do so
1819case "$extractsh" in
1820true)
1821 case "$realsilent" in
1822 true) ;;
1823 *) exec 1>&4;;
1824 esac
1825 case "$config_sh" in
1826 '') config_sh='config.sh';;
1827 esac
1828 echo " "
1829 echo "Fetching answers from $config_sh..."
1830 cd ..
1831 . $config_sh
1832 test "$override" && . ./optdef.sh
1833 echo " "
1834 . UU/extract
1835 rm -rf UU
24ccb310 1836 echo "Extraction done."
dfe9444c
AD
1837 exit 0
1838 ;;
1839esac
1840
1841: Eunice requires " " instead of "", can you believe it
1842echo " "
1843: Here we go...
1844echo "Beginning of configuration questions for $package."
1845
1846trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1847
2304df62
AD
1848: first determine how to suppress newline on echo command
1849echo " "
1850echo "Checking echo to see how to suppress newlines..."
1851(echo "hi there\c" ; echo " ") >.echotmp
1852if $contains c .echotmp >/dev/null 2>&1 ; then
1853 echo "...using -n."
1854 n='-n'
1855 c=''
1856else
1857 cat <<'EOM'
1858...using \c
1859EOM
1860 n=''
1861 c='\c'
1862fi
1863echo $n "The star should be here-->$c"
1864echo '*'
1865rm -f .echotmp
1866
1867: Now test for existence of everything in MANIFEST
1868echo " "
6904989c 1869if test -f "$rsrc/MANIFEST"; then
2304df62 1870 echo "First let's make sure your kit is complete. Checking..." >&4
4242830c 1871 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
2304df62 1872 rm -f missing
dfe9444c 1873 tmppwd=`pwd`
2304df62 1874 for filelist in x??; do
6904989c 1875 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1876 done
1877 if test -s missing; then
1878 cat missing >&4
1879 cat >&4 <<'EOM'
1880
1881THIS PACKAGE SEEMS TO BE INCOMPLETE.
1882
1883You have the option of continuing the configuration process, despite the
1884distinct possibility that your kit is damaged, by typing 'y'es. If you
1885do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1886and contact the author (perlbug@perl.org).
2304df62
AD
1887
1888EOM
1889 echo $n "Continue? [n] $c" >&4
1890 read ans
1891 case "$ans" in
1892 y*)
1893 echo "Continuing..." >&4
1894 rm -f missing
1895 ;;
1896 *)
1897 echo "ABORTING..." >&4
1898 kill $$
1899 ;;
1900 esac
1901 else
dfe9444c 1902 echo "Looks good..."
2304df62
AD
1903 fi
1904else
1905 echo "There is no MANIFEST file. I hope your kit is complete !"
1906fi
1907rm -f missing x??
1908
5ff3f7a4
GS
1909echo " "
1910: Find the appropriate value for a newline for tr
1911if test -n "$DJGPP"; then
1912 trnl='\012'
1913fi
1914if test X"$trnl" = X; then
1915 case "`echo foo|tr '\n' x 2>/dev/null`" in
1916 foox) trnl='\n' ;;
1917 esac
1918fi
1919if test X"$trnl" = X; then
1920 case "`echo foo|tr '\012' x 2>/dev/null`" in
1921 foox) trnl='\012' ;;
1922 esac
1923fi
1924if test X"$trnl" = X; then
8be2c24c
JH
1925 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1926 fooxy) trnl='\n\r' ;;
1927 esac
1928fi
1929if test X"$trnl" = X; then
5ff3f7a4
GS
1930 cat <<EOM >&2
1931
1932$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1933
1934EOM
1935 exit 1
1936fi
1937
2304df62
AD
1938: compute the number of columns on the terminal for proper question formatting
1939case "$COLUMNS" in
1940'') COLUMNS='80';;
1941esac
1942
1943: set up the echo used in my read
1944myecho="case \"\$xxxm\" in
1945'') echo $n \"\$rp $c\" >&4;;
1946*) case \"\$rp\" in
1947 '') echo $n \"[\$xxxm] $c\";;
1948 *)
1949 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1950 echo \"\$rp\" >&4
1951 echo $n \"[\$xxxm] $c\" >&4
1952 else
1953 echo $n \"\$rp [\$xxxm] $c\" >&4
1954 fi
1955 ;;
1956 esac;;
1957esac"
1958
1959: now set up to do reads with possible shell escape and default assignment
1960cat <<EOSC >myread
28757baa 1961$startsh
2304df62
AD
1962xxxm=\$dflt
1963$myecho
1964ans='!'
1965case "\$fastread" in
1966yes) case "\$dflt" in
1967 '') ;;
1968 *) ans='';
1969 case "\$silent-\$rp" in
1970 true-) ;;
1971 *) echo " " >&4;;
1972 esac;;
1973 esac;;
1974*) case "\$silent" in
1975 true) case "\$rp" in
1976 '') ans='';;
1977 esac;;
1978 esac;;
1979esac
1980while expr "X\$ans" : "X!" >/dev/null; do
1981 read answ
1982 set x \$xxxm
1983 shift
dfe9444c 1984 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1985 case "\$answ" in
dfe9444c
AD
1986 "!")
1987 sh 1>&4
1988 echo " "
1989 $myecho
1990 ;;
1991 !*)
1992 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1993 shift
1994 sh 1>&4 -c "\$*"
1995 echo " "
1996 $myecho
1997 ;;
2304df62
AD
1998 "\$ans")
1999 case "\$ans" in
ecfc5424
AD
2000 \\&*)
2001 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2002 shift
2003 case "\$1" in
2004 -d)
2005 fastread=yes
40a7a20a 2006 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2007 ;;
2008 -*)
40a7a20a 2009 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2010 ;;
2011 esac
2012 $myecho
2013 ans=!
2014 ;;
2304df62
AD
2015 esac;;
2016 *)
2017 case "\$aok" in
2018 y)
2019 echo "*** Substitution done -- please confirm."
2020 xxxm="\$ans"
c9795ab7 2021 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2022 xxxm="\$ans"
2023 ans=!
2024 ;;
2025 *)
2026 echo "*** Error -- try again."
2027 ans=!
2028 ;;
2029 esac
2030 $myecho
2031 ;;
2032 esac
2033 case "\$ans\$xxxm\$nostick" in
2034 '')
2035 ans=!
2036 $myecho
2037 ;;
2038 esac
2039done
2040case "\$ans" in
2041'') ans="\$xxxm";;
2042esac
2043EOSC
2044
2045: create .config dir to save info across Configure sessions
2046test -d ../.config || mkdir ../.config
2047cat >../.config/README <<EOF
2048This directory created by Configure to save information that should
dfe9444c 2049persist across sessions for $package.
2304df62
AD
2050
2051You may safely delete it if you wish.
2052EOF
2053
9507cadf 2054xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2055case "$usedevel" in
0107c034 2056$define|true|[yY]*) ;;
9507cadf 2057*) case "$xversion" in
0107c034
JH
2058 *[13579])
2059 cat >&4 <<EOH
2060*** WHOA THERE!!! ***
2061
2062 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2063 The version of this $package distribution is $xversion, that is, odd,
2064 (as opposed to even) and that signifies a development release.
3d5d58b1 2065 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2066
2067 Do ***NOT*** install this into production use.
2068 Data corruption and crashes are possible.
2069
2070 It is most seriously suggested that you do not continue any further
2071 unless you want to help in developing and debugging Perl.
2072
6adc6a45
JH
2073 If you *still* want to build perl, you can answer 'y' now,
2074 or pass -Dusedevel to Configure.
2075
0107c034
JH
2076EOH
2077 rp='Do you really want to continue?'
2078 dflt='n'
2079 . ./myread
2080 case "$ans" in
8feeef0e
JH
2081 [yY]) echo >&4 "Okay, continuing."
2082 usedevel="$define" ;;
0107c034
JH
2083 *) echo >&4 "Okay, bye."
2084 exit 1
2085 ;;
2086 esac
2087 ;;
2088 esac
2089 ;;
2090esac
8feeef0e
JH
2091case "$usedevel" in
2092$define|true|[yY]*)
2093 case "$versiononly" in
2094 '') versiononly="$define" ;;
2095 esac
2096 case "$installusrbinperl" in
2097 '') installusrbinperl="$undef" ;;
2098 esac
2099 ;;
2100esac
0107c034 2101
2304df62
AD
2102: general instructions
2103needman=true
2104firsttime=true
760ac839 2105user=`(logname) 2>/dev/null`
dfe9444c
AD
2106case "$user" in
2107'') user=`whoami 2>&1`;;
760ac839 2108esac
2304df62
AD
2109if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2110 firsttime=false
2111 echo " "
2112 rp='Would you like to see the instructions?'
2113 dflt=n
2114 . ./myread
2115 case "$ans" in
2116 [yY]*) ;;
2117 *) needman=false;;
2118 esac
2119fi
2120if $needman; then
2121 cat <<EOH
4e2a5f63 2122
2304df62 2123This installation shell script will examine your system and ask you questions
a0d0e21e 2124to determine how the perl5 package should be installed. If you get
2304df62
AD
2125stuck on a question, you may use a ! shell escape to start a subshell or
2126execute a command. Many of the questions will have default answers in square
2127brackets; typing carriage return will give you the default.
2128
2129On some of the questions which ask for file or directory names you are allowed
2130to use the ~name construct to specify the login directory belonging to "name",
2131even if you don't have a shell which knows about that. Questions where this is
2132allowed will be marked "(~name ok)".
2133
2134EOH
2135 rp=''
2136 dflt='Type carriage return to continue'
2137 . ./myread
2138 cat <<'EOH'
2139
2140The prompter used in this script allows you to use shell variables and
2141backticks in your answers. You may use $1, $2, etc... to refer to the words
2142in the default answer, as if the default line was a set of arguments given to a
2143script shell. This means you may also use $* to repeat the whole default line,
2144so you do not have to re-type everything to add something to the default.
2145
2146Everytime there is a substitution, you will have to confirm. If there is an
2147error (e.g. an unmatched backtick), the default answer will remain unchanged
2148and you will be prompted again.
2149
2150If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2151the questions and use the computed defaults (or the previous answers if there
2152was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2153You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2154on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2155
2156EOH
2157 . ./myread
2158 cat <<EOH
2159
2160Much effort has been expended to ensure that this shell script will run on any
2161Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2162Configure and run it again. If you can't run Configure for some reason,
2163you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2164have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2165
2166This installation script affects things in two ways:
2167
21681) it may do direct variable substitutions on some of the files included
2169 in this kit.
21702) it builds a config.h file for inclusion in C programs. You may edit
2171 any of these files as the need arises after running this script.
2172
2173If you make a mistake on a question, there is no easy way to back up to it
2174currently. The easiest thing to do is to edit config.sh and rerun all the SH
2175files. Configure will offer to let you do this before it runs the SH files.
2176
2177EOH
2178 dflt='Type carriage return to continue'
2179 . ./myread
2180 case "$firsttime" in
2181 true) echo $user >>../.config/instruct;;
2182 esac
2183fi
2184
2304df62
AD
2185: find out where common programs are
2186echo " "
2187echo "Locating common programs..." >&4
2188cat <<EOSC >loc
2189$startsh
2190case \$# in
21910) exit 1;;
2192esac
2193thing=\$1
2194shift
2195dflt=\$1
2196shift
2197for dir in \$*; do
2198 case "\$thing" in
2199 .)
2200 if test -d \$dir/\$thing; then
2201 echo \$dir
2202 exit 0
2203 fi
2204 ;;
2205 *)
a0d0e21e 2206 for thisthing in \$dir/\$thing; do
ecfc5424 2207 : just loop through to pick last item
a0d0e21e 2208 done
25f94b33 2209 if test -f \$thisthing; then
a0d0e21e 2210 echo \$thisthing
2304df62 2211 exit 0
a5a94ea5
JH
2212 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2213 echo \$thisthing
2214 exit 0
2304df62 2215 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2216 if test -n "$DJGPP"; then
2217 echo \$dir/\$thing.exe
5b7ea690 2218 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2219 : on Eunice apparently
2220 echo \$dir/\$thing
5b7ea690 2221 exit 0
c4f23d77 2222 fi
2d736872 2223 exit 0
2304df62
AD
2224 fi
2225 ;;
2226 esac
2227done
2228echo \$dflt
2229exit 1
2230EOSC
2231chmod +x loc
2232$eunicefix loc
2233loclist="
2234awk
2235cat
f8006fac 2236chmod
b4eb6b3d
JH
2237comm
2238cp
2304df62
AD
2239echo
2240expr
2241grep
a0d0e21e 2242ls
b4eb6b3d 2243mkdir
2304df62
AD
2244rm
2245sed
b4eb6b3d 2246sort
85e6fe83 2247touch
2304df62 2248tr
b4eb6b3d 2249uniq
2304df62
AD
2250"
2251trylist="
2252Mcc
dfe9444c 2253ar
3659ebf1 2254bison
b4eb6b3d 2255byacc
2304df62 2256cpp
b4eb6b3d 2257csh
2304df62
AD
2258date
2259egrep
1fef16b3 2260gmake
8ff267be 2261gzip
b4eb6b3d 2262less
8ff267be 2263ln
3c728e00 2264make
b4eb6b3d 2265more
693762b4 2266nm
b4eb6b3d
JH
2267nroff
2268pg
2304df62
AD
2269test
2270uname
8ff267be 2271zip
2304df62 2272"
8e07c86e 2273pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2274pth="$pth /lib /usr/lib"
2275for file in $loclist; do
dfe9444c
AD
2276 eval xxx=\$$file
2277 case "$xxx" in
2278 /*|?:[\\/]*)
2279 if test -f "$xxx"; then
2280 : ok
2281 else
2282 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2283 xxx=`./loc $file $file $pth`
2284 fi
2285 ;;
2286 '') xxx=`./loc $file $file $pth`;;
2287 *) xxx=`./loc $xxx $xxx $pth`;;
2288 esac
a5a94ea5 2289 eval $file=$xxx$_exe
2304df62
AD
2290 eval _$file=$xxx
2291 case "$xxx" in
2292 /*)
2293 echo $file is in $xxx.
2294 ;;
8e07c86e
AD
2295 ?:[\\/]*)
2296 echo $file is in $xxx.
2297 ;;
2304df62 2298 *)
25f94b33
AD
2299 echo "I don't know where '$file' is, and my life depends on it." >&4
2300 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2301 exit 1
2304df62
AD
2302 ;;
2303 esac
2304done
2305echo " "
2306echo "Don't worry if any of the following aren't found..."
2307say=offhand
2308for file in $trylist; do
dfe9444c
AD
2309 eval xxx=\$$file
2310 case "$xxx" in
2311 /*|?:[\\/]*)
2312 if test -f "$xxx"; then
2313 : ok
2314 else
2315 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2316 xxx=`./loc $file $file $pth`
2317 fi
2318 ;;
2319 '') xxx=`./loc $file $file $pth`;;
2320 *) xxx=`./loc $xxx $xxx $pth`;;
2321 esac
306a8474 2322 eval $file=$xxx$_exe
2304df62
AD
2323 eval _$file=$xxx
2324 case "$xxx" in
2325 /*)
2326 echo $file is in $xxx.
2327 ;;
8e07c86e
AD
2328 ?:[\\/]*)
2329 echo $file is in $xxx.
2330 ;;
2304df62
AD
2331 *)
2332 echo "I don't see $file out there, $say."
2333 say=either
2334 ;;
2335 esac
2336done
2337case "$egrep" in
1fef16b3 2338egrep)
2304df62
AD
2339 echo "Substituting grep for egrep."
2340 egrep=$grep
868439a2 2341 _egrep=$grep
2304df62
AD
2342 ;;
2343esac
8ff267be 2344case "$ln" in
1fef16b3 2345ln)
8ff267be 2346 echo "Substituting cp for ln."
2347 ln=$cp
868439a2 2348 _ln=$cp
8ff267be 2349 ;;
2350esac
2e26f1d5
JH
2351case "$make" in
2352make)
2353 case "$gmake" in
2354 gmake)
2355 echo "I can't find make or gmake, and my life depends on it." >&4
2356 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2357 exit 1
2358 ;;
2359 esac
2360 ;;
2361esac
2362case "$gmake" in
2363gmake) ;;
2364*) # We can't have osname yet.
1fef16b3
JH
2365 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2366 # Assume that gmake, if found, is definitely GNU make
2367 # and prefer it over the system make.
2368 echo "Substituting gmake for make."
2369 make=$gmake
868439a2 2370 _make=$gmake
1fef16b3
JH
2371 fi
2372 ;;
a5a94ea5 2373esac
2304df62
AD
2374case "$test" in
2375test)
2376 echo "Hopefully test is built into your sh."
2377 ;;
2378*)
73614538 2379 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2380 echo "Using the test built into your sh."
2304df62
AD
2381 test=test
2382 _test=test
2383 fi
2384 ;;
2385esac
2386case "$echo" in
2387echo)
2388 echo "Hopefully echo is built into your sh."
2389 ;;
2390'') ;;
2391*)
2392 echo " "
2393echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2394 $echo $n "hi there$c" >foo1
2395 echo $n "hi there$c" >foo2
2396 if cmp foo1 foo2 >/dev/null 2>&1; then
2397 echo "They are compatible. In fact, they may be identical."
2398 else
2399 case "$n" in
2400 '-n') n='' c='\c';;
2401 *) n='-n' c='';;
2402 esac
2403 cat <<FOO
2404They are not compatible! You are probably running ksh on a non-USG system.
2405I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2406have echo built in and we may have to run some Bourne shell scripts. That
2407means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2408
2409FOO
2410 $echo $n "The star should be here-->$c"
2411 $echo "*"
2412 fi
2413 $rm -f foo1 foo2
2414 ;;
2415esac
2416
6b769f8f 2417cat <<EOS >trygcc
2573c5f9
JH
2418$startsh
2419EOS
6b769f8f 2420cat <<'EOSC' >>trygcc
2573c5f9
JH
2421case "$cc" in
2422'') ;;
2423*) $rm -f try try.*
2424 $cat >try.c <<EOM
2425int main(int argc, char *argv[]) {
2426 return 0;
2427}
2428EOM
e4778687 2429 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2430 :
2431 else
2432 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2433 despair=yes
2434 trygcc=yes
2435 case "$cc" in
2436 *gcc*) trygcc=no ;;
2437 esac
2438 case "`$cc -v -c try.c 2>&1`" in
2439 *gcc*) trygcc=no ;;
2440 esac
2441 if $test X"$trygcc" = Xyes; then
2442 if gcc -o try -c try.c; then
2443 echo " "
2444 echo "You seem to have a working gcc, though." >&4
2445 rp="Would you like to use it?"
2446 dflt=y
2447 if $test -f myread; then
2448 . ./myread
2449 else
2450 if $test -f UU/myread; then
2451 . ./UU/myread
2452 else
2453 echo "Cannot find myread, sorry. Aborting." >&2
2454 exit 1
2455 fi
2456 fi
2457 case "$ans" in
6371411c
RB
2458 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2459 if $test -f usethreads.cbu; then
2460 $cat >&4 <<EOM
2461
2462*** However, any setting of the C compiler flags (e.g. for thread support)
2463*** has been lost. It may be necessary to pass -Dcc=gcc to Configure
2464*** (together with e.g. -Dusethreads).
2465
2466EOM
2467 fi;;
2573c5f9
JH
2468 esac
2469 fi
2470 fi
6b769f8f
RB
2471 fi
2472 $rm -f try try.*
2473 ;;
2474esac
2475EOSC
2476
2477cat <<EOS >checkcc
2478$startsh
2479EOS
2480cat <<'EOSC' >>checkcc
2481case "$cc" in
2482'') ;;
2483*) $rm -f try try.*
2484 $cat >try.c <<EOM
2485int main(int argc, char *argv[]) {
2486 return 0;
2487}
2488EOM
2489 if $cc -o try $ccflags $ldflags try.c; then
2490 :
2491 else
2573c5f9 2492 if $test X"$despair" = Xyes; then
6b769f8f
RB
2493 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2494 fi
2495 $cat >&4 <<EOM
5dd4fbdf
MB
2496You need to find a working C compiler.
2497Either (purchase and) install the C compiler supplied by your OS vendor,
2498or for a free C compiler try http://gcc.gnu.org/
2499I cannot continue any further, aborting.
2500EOM
6b769f8f 2501 exit 1
2573c5f9
JH
2502 fi
2503 $rm -f try try.*
2504 ;;
2505esac
2506EOSC
2507
a0d0e21e
LW
2508: determine whether symbolic links are supported
2509echo " "
2510$touch blurfl
2511if $ln -s blurfl sym > /dev/null 2>&1 ; then
2512 echo "Symbolic links are supported." >&4
818f00be 2513 lns="$ln -s"
a0d0e21e
LW
2514else
2515 echo "Symbolic links are NOT supported." >&4
2516 lns="$ln"
2517fi
2518$rm -f blurfl sym
2519
dafca956
JH
2520: determine whether symbolic links are supported
2521echo " "
2522case "$lns" in
18ea2752 2523*"ln"*" -s")
dafca956
JH
2524 echo "Checking how to test for symbolic links..." >&4
2525 $lns blurfl sym
4b661809 2526 if $test "X$issymlink" = X; then
2e2a97a6
JH
2527 case "$newsh" in
2528 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2529 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2530 esac
5d644a95
MB
2531 if test $? = 0; then
2532 issymlink="test -h"
2e2a97a6
JH
2533 else
2534 echo "Your builtin 'test -h' may be broken." >&4
2535 case "$test" in
2536 /*) ;;
2537 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2538 for p in $pth
2539 do
2540 if test -f "$p/$test"; then
2541 test="$p/$test"
2542 break
2543 fi
2544 done
2545 ;;
2546 esac
2547 case "$test" in
2548 /*)
2549 echo "Trying external '$test -h'." >&4
2550 issymlink="$test -h"
2551 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2552 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2553 issymlink=''
2554 fi
2555 ;;
2556 *) issymlink='' ;;
2557 esac
5d644a95
MB
2558 fi
2559 fi
4b661809 2560 if $test "X$issymlink" = X; then
dafca956 2561 if $test -L sym 2>/dev/null; then
5d644a95 2562 issymlink="$test -L"
2e2a97a6 2563 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2564 fi
2565 fi
4b661809 2566 if $test "X$issymlink" != X; then
5d644a95 2567 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2568 else
2569 echo "I do not know how you can test for symbolic links." >&4
2570 fi
2571 $rm -f blurfl sym
2572 ;;
2573*) echo "No symbolic links, so not testing for their testing..." >&4
2574 ;;
2575esac
2576echo " "
2577
2578
2579case "$mksymlinks" in
2580$define|true|[yY]*)
2581 case "$src" in
2582 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2583 exit 1
2584 ;;
4b661809 2585 *) case "$lns:$issymlink" in
f314eb9f 2586 *"ln"*" -s:"*"test -"?)
dafca956
JH
2587 echo "Creating the symbolic links..." >&4
2588 echo "(First creating the subdirectories...)" >&4
2589 cd ..
2590 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2591 read directory
2592 test -z "$directory" && break
2593 mkdir -p $directory
2594 done
2595 # Sanity check 1.
2596 if test ! -d t/base; then
2597 echo "Failed to create the subdirectories. Aborting." >&4
2598 exit 1
2599 fi
2600 echo "(Then creating the symlinks...)" >&4
2601 awk '{print $1}' $src/MANIFEST | while true; do
2602 read filename
2603 test -z "$filename" && break
2604 if test -f $filename; then
5d644a95 2605 if $issymlink $filename; then
dafca956
JH
2606 rm -f $filename
2607 fi
2608 fi
2609 if test -f $filename; then
2610 echo "$filename already exists, not symlinking."
2611 else
2612 ln -s $src/$filename $filename
2613 fi
2614 done
2615 # Sanity check 2.
a0d24b8a
JH
2616 if test ! -f t/base/lex.t; then
2617 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2618 exit 1
2619 fi
2620 cd UU
2621 ;;
2622 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2623 ;;
2624 esac
2625 ;;
2626 esac
2627 ;;
2628esac
2629
5440bc8e
JH
2630
2631case "$usecrosscompile" in
2632$define|true|[yY]*)
93bc48fa 2633 $echo "Cross-compiling..."
5440bc8e
JH
2634 croak=''
2635 case "$cc" in
2636 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2637 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2638 ar=$targetarch-ar
2639 # leave out ld, choosing it is more complex
2640 nm=$targetarch-nm
2641 ranlib=$targetarch-ranlib
93bc48fa 2642 $echo 'extern int foo;' > try.c
f8006fac 2643 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2644 shift
2645 if $test $# -gt 0; then
2646 incpth="$incpth $*"
f8006fac
JH
2647 incpth="`$echo $incpth|$sed 's/^ //'`"
2648 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2649 for i in $*; do
f8006fac 2650 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2651 if $test -d $j; then
2652 libpth="$libpth $j"
2653 fi
2654 done
f8006fac
JH
2655 libpth="`$echo $libpth|$sed 's/^ //'`"
2656 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2657 fi
2658 $rm -f try.c
5440bc8e
JH
2659 ;;
2660 esac
2661 case "$targetarch" in
93bc48fa
JH
2662 '') echo "Targetarch not defined." >&4; croak=y ;;
2663 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2664 esac
2665 case "$incpth" in
93bc48fa 2666 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2667 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2668 esac
2669 case "$libpth" in
93bc48fa 2670 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2671 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2672 esac
93bc48fa
JH
2673 case "$usrinc" in
2674 '') for i in $incpth; do
2675 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2676 usrinc=$i
2677 echo "Guessing usrinc $usrinc." >&4
2678 break
2679 fi
2680 done
2681 case "$usrinc" in
2682 '') echo "Usrinc not defined." >&4; croak=y ;;
2683 esac
2684 ;;
2685 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2686 esac
93bc48fa
JH
2687 case "$targethost" in
2688 '') echo "Targethost not defined." >&4; croak=y ;;
2689 *) echo "Using targethost $targethost." >&4
5440bc8e 2690 esac
93bc48fa
JH
2691 locincpth=' '
2692 loclibpth=' '
5440bc8e 2693 case "$croak" in
93bc48fa 2694 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2695 esac
2696 case "$src" in
2697 /*) run=$src/Cross/run
93c0359c 2698 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2699 to=$src/Cross/to
2700 from=$src/Cross/from
2701 ;;
93bc48fa 2702 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2703 run=$pwd/Cross/run
f8006fac 2704 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2705 to=$pwd/Cross/to
2706 from=$pwd/Cross/from
2707 ;;
2708 esac
2709 case "$targetrun" in
2710 '') targetrun=ssh ;;
2711 esac
2712 case "$targetto" in
2713 '') targetto=scp ;;
2714 esac
2715 case "$targetfrom" in
2716 '') targetfrom=scp ;;
2717 esac
2718 run=$run-$targetrun
2719 to=$to-$targetto
2720 from=$from-$targetfrom
93bc48fa
JH
2721 case "$targetdir" in
2722 '') targetdir=/tmp
2723 echo "Guessing targetdir $targetdir." >&4
2724 ;;
2725 esac
5440bc8e 2726 case "$targetuser" in
93bc48fa
JH
2727 '') targetuser=root
2728 echo "Guessing targetuser $targetuser." >&4
2729 ;;
5440bc8e
JH
2730 esac
2731 case "$targetfrom" in
2732 scp) q=-q ;;
2733 *) q='' ;;
2734 esac
2735 case "$targetrun" in
2736 ssh|rsh)
2737 cat >$run <<EOF
2738#!/bin/sh
93c0359c
JH
2739case "\$1" in
2740-cwd)
2741 shift
2742 cwd=\$1
2743 shift
2744 ;;
2745esac
2746case "\$cwd" in
2747'') cwd=$targetdir ;;
2748esac
5440bc8e
JH
2749exe=\$1
2750shift
93c0359c
JH
2751if $test ! -f \$exe.xok; then
2752 $to \$exe
2753 $touch \$exe.xok
2754fi
2755$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2756EOF
2757 ;;
93bc48fa 2758 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2759 exit 1
2760 ;;
2761 esac
93c0359c
JH
2762 case "$targetmkdir" in
2763 */Cross/mkdir)
2764 cat >$targetmkdir <<EOF
2765#!/bin/sh
2766$targetrun -l $targetuser $targethost "mkdir -p \$@"
2767EOF
f8006fac 2768 $chmod a+rx $targetmkdir
93c0359c
JH
2769 ;;
2770 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2771 exit 1
2772 ;;
2773 esac
5440bc8e
JH
2774 case "$targetto" in
2775 scp|rcp)
2776 cat >$to <<EOF
2777#!/bin/sh
2778for f in \$@
2779do
93c0359c
JH
2780 case "\$f" in
2781 /*)
2782 $targetmkdir \`dirname \$f\`
2783 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2784 ;;
2785 *)
2786 $targetmkdir $targetdir/\`dirname \$f\`
2787 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2788 ;;
2789 esac
5440bc8e
JH
2790done
2791exit 0
2792EOF
2793 ;;
2794 cp) cat >$to <<EOF
2795#!/bin/sh
93c0359c
JH
2796for f in \$@
2797do
2798 case "\$f" in
2799 /*)
2800 $mkdir -p $targetdir/\`dirname \$f\`
2801 $cp \$f $targetdir/\$f || exit 1
2802 ;;
2803 *)
2804 $targetmkdir $targetdir/\`dirname \$f\`
2805 $cp \$f $targetdir/\$f || exit 1
2806 ;;
2807 esac
2808done
2809exit 0
5440bc8e
JH
2810EOF
2811 ;;
93bc48fa 2812 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2813 exit 1
2814 ;;
2815 esac
2816 case "$targetfrom" in
2817 scp|rcp)
2818 cat >$from <<EOF
2819#!/bin/sh
2820for f in \$@
2821do
93c0359c 2822 $rm -f \$f
5440bc8e
JH
2823 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2824done
2825exit 0
2826EOF
2827 ;;
2828 cp) cat >$from <<EOF
2829#!/bin/sh
2830for f in \$@
2831do
93c0359c 2832 $rm -f \$f
5440bc8e
JH
2833 cp $targetdir/\$f . || exit 1
2834done
2835exit 0
2836EOF
2837 ;;
93bc48fa 2838 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2839 exit 1
2840 ;;
2841 esac
93bc48fa
JH
2842 if $test ! -f $run; then
2843 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2844 else
f8006fac 2845 $chmod a+rx $run
5440bc8e 2846 fi
93bc48fa
JH
2847 if $test ! -f $to; then
2848 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2849 else
f8006fac 2850 $chmod a+rx $to
5440bc8e 2851 fi
93bc48fa
JH
2852 if $test ! -f $from; then
2853 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2854 else
f8006fac 2855 $chmod a+rx $from
5440bc8e 2856 fi
93bc48fa 2857 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2858 exit 1
2859 fi
2860 cat >&4 <<EOF
f8006fac
JH
2861Using '$run' for remote execution,
2862and '$from' and '$to'
93bc48fa 2863for remote file transfer.
5440bc8e
JH
2864EOF
2865 ;;
2866*) run=''
2867 to=:
2868 from=:
2869 usecrosscompile='undef'
2870 targetarch=''
2871 ;;
2872esac
2873
ecfc5424
AD
2874: see whether [:lower:] and [:upper:] are supported character classes
2875echo " "
ecfc5424
AD
2876case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2877ABYZ)
2878 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2879 up='[:upper:]'
2880 low='[:lower:]'
2881 ;;
c931d01c
NC
2882*) # There is a discontinuity in EBCDIC between 'R' and 'S'
2883 # (0xd9 and 0xe2), therefore that is a nice testing point.
2884 if test "X$up" = X -o "X$low" = X; then
2885 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2886 rs) up='[A-Z]'
2887 low='[a-z]'
28e8609d
JH
2888 ;;
2889 esac
c931d01c 2890 fi
28e8609d 2891 if test "X$up" = X -o "X$low" = X; then
c931d01c
NC
2892 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2893 rs) up='A-Z'
28e8609d
JH
2894 low='a-z'
2895 ;;
2896 esac
c931d01c 2897 fi
28e8609d 2898 if test "X$up" = X -o "X$low" = X; then
c931d01c
NC
2899 case "`echo RS | od -x 2>/dev/null`" in
2900 *D9E2*|*d9e2*)
28e8609d
JH
2901 echo "Hey, this might be EBCDIC." >&4
2902 if test "X$up" = X -o "X$low" = X; then
c931d01c
NC
2903 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2904 rs) up='[A-IJ-RS-Z]'
2905 low='[a-ij-rs-z]'
28e8609d
JH
2906 ;;
2907 esac
2908 fi
2909 if test "X$up" = X -o "X$low" = X; then
c931d01c
NC
2910 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2911 rs) up='A-IJ-RS-Z'
2912 low='a-ij-rs-z'
28e8609d
JH
2913 ;;
2914 esac
2915 fi
2916 ;;
2917 esac
2918 fi
2919esac
c931d01c
NC
2920case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2921rs)
28e8609d
JH
2922 echo "Using $up and $low to convert case." >&4
2923 ;;
ecfc5424 2924*)
28e8609d
JH
2925 echo "I don't know how to translate letters from upper to lower case." >&4
2926 echo "Your tr is not acting any way I know of." >&4
2927 exit 1
2928 ;;
ecfc5424
AD
2929esac
2930: set up the translation script tr, must be called with ./tr of course
2931cat >tr <<EOSC
2932$startsh
2933case "\$1\$2" in
2934'[A-Z][a-z]') exec $tr '$up' '$low';;
2935'[a-z][A-Z]') exec $tr '$low' '$up';;
2936esac
2937exec $tr "\$@"
2938EOSC
2939chmod +x tr
2940$eunicefix tr
2941
2304df62
AD
2942: Try to determine whether config.sh was made on this system
2943case "$config_sh" in
2944'')
43999f95
JH
2945myuname=`$uname -a 2>/dev/null`
2946$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2947# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2948# because the A-Z/a-z are not consecutive.
a0d0e21e 2949myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2950 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2951newmyuname="$myuname"
2304df62 2952dflt=n
16d20bd9
AD
2953case "$knowitall" in
2954'')
2955 if test -f ../config.sh; then
2956 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2957 eval "`grep myuname= ../config.sh`"
2958 fi
2959 if test "X$myuname" = "X$newmyuname"; then
2960 dflt=y
2961 fi
2304df62 2962 fi
16d20bd9
AD
2963 ;;
2964*) dflt=y;;
2965esac
2304df62
AD
2966
2967: Get old answers from old config file if Configure was run on the
2968: same system, otherwise use the hints.
2969hint=default
2970cd ..
2971if test -f config.sh; then
16d20bd9
AD
2972 echo " "
2973 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2974 . UU/myread
2975 case "$ans" in
f83701cd
AD
2976 n*|N*) echo "OK, I'll ignore it."
2977 mv config.sh config.sh.old
2978 myuname="$newmyuname"
2979 ;;
2304df62 2980 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2981 tmp_n="$n"
2982 tmp_c="$c"
85cad39c 2983 tmp_sh="$sh"
2304df62
AD
2984 . ./config.sh
2985 cp config.sh UU
ecfc5424
AD
2986 n="$tmp_n"
2987 c="$tmp_c"
85cad39c 2988 : Older versions did not always set $sh. Catch re-use of such
2989 : an old config.sh.
2990 case "$sh" in
2991 '') sh="$tmp_sh" ;;
2992 esac
2304df62
AD
2993 hint=previous
2994 ;;
2995 esac
2996fi
2573c5f9 2997. ./UU/checkcc
2304df62
AD
2998if test ! -f config.sh; then
2999 $cat <<EOM
3000
4e2a5f63
AD
3001First time through, eh? I have some defaults handy for some systems
3002that need some extra help getting the Configure answers right:
2304df62
AD
3003
3004EOM
dfe9444c 3005 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3006 dflt=''
3007 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3008 : tests or hints, please send them to perlbug@perl.org
2304df62 3009 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3010 $test -f /irix && osname=irix
85e6fe83
LW
3011 $test -f /xenix && osname=sco_xenix
3012 $test -f /dynix && osname=dynix
3013 $test -f /dnix && osname=dnix
5f05dabc 3014 $test -f /lynx.os && osname=lynxos
3015 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3016 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3017 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3018 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3019 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3020 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3021 $test -d /usr/apollo/bin && osname=apollo
3022 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3023 $test -d /usr/include/minix && osname=minix
d54344fc 3024 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3025 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3026 osname=machten
4633a7c4 3027 if $test -x /sbin/version; then
dfe9444c 3028 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3029 $sed -e 's/[A-Za-z]$//'`
3030 elif $test -x /usr/etc/version; then
dfe9444c 3031 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3032 $sed -e 's/[A-Za-z]$//'`
3033 else
3034 osvers="$2.$3"
3035 fi
3036 fi
aaacdc8b
GS
3037
3038 $test -f /sys/posix.dll &&
3039 $test -f /usr/bin/what &&
3040 set X `/usr/bin/what /sys/posix.dll` &&
3041 $test "$3" = UWIN &&
3042 osname=uwin &&
3043 osvers="$5"
3044
2304df62
AD
3045 if $test -f $uname; then
3046 set X $myuname
3047 shift
3048
2304df62 3049 case "$5" in
85e6fe83 3050 fps*) osname=fps ;;
2304df62
AD
3051 mips*)
3052 case "$4" in
85e6fe83
LW
3053 umips) osname=umips ;;
3054 *) osname=mips ;;
2304df62 3055 esac;;
85e6fe83
LW
3056 [23]100) osname=mips ;;
3057 next*) osname=next ;;
ecfc5424 3058 i386*)
c6912327
JH
3059 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3060 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3061 osname='sco'
3062 osvers=$tmp
3063 elif $test -f /etc/kconfig; then
ecfc5424 3064 osname=isc
bd628c73 3065 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3066 osvers=4
3067 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3068 osvers=3
2304df62 3069 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3070 osvers=2
ecfc5424
AD
3071 fi
3072 fi
2000072c 3073 tmp=''
ecfc5424 3074 ;;
c4f23d77
AD
3075 pc*)
3076 if test -n "$DJGPP"; then
3077 osname=dos
3078 osvers=djgpp
3079 fi
3080 ;;
2304df62
AD
3081 esac
3082
3083 case "$1" in
a0d0e21e
LW
3084 aix) osname=aix
3085 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3086 case "$tmp" in
066079d9
NC
3087 # oslevel can fail with:
3088 # oslevel: Unable to acquire lock.
3089 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3090 '<3240'|'<>3240') osvers=3.2.0 ;;
3091 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3092 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3093 *) osvers=$tmp;;
a0d0e21e
LW
3094 esac
3095 ;;
aaacdc8b
GS
3096 bsd386) osname=bsd386
3097 osvers=`$uname -r`
3098 ;;
3099 cygwin*) osname=cygwin
3100 osvers="$3"
3101 ;;
23f87696
SZ
3102 *dc.osx) osname=dcosx
3103 osvers="$3"
3104 ;;
a0d0e21e
LW
3105 dnix) osname=dnix
3106 osvers="$3"
3107 ;;
3108 domainos) osname=apollo
3109 osvers="$3"
3110 ;;
54b41212 3111 dgux) osname=dgux
a0d0e21e
LW
3112 osvers="$3"
3113 ;;
760ac839 3114 dynixptx*) osname=dynixptx
e58e581d 3115 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3116 ;;
a0d0e21e
LW
3117 freebsd) osname=freebsd
3118 osvers="$3" ;;
54b41212
NC
3119 genix) osname=genix ;;
3120 gnu) osname=gnu
3121 osvers="$3" ;;
3122 hp*) osname=hpux
bfb7748a 3123 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3124 ;;
54b41212 3125 irix*) osname=irix
a0d0e21e
LW
3126 case "$3" in
3127 4*) osvers=4 ;;
3128 5*) osvers=5 ;;
ecfc5424 3129 *) osvers="$3" ;;
a0d0e21e
LW
3130 esac
3131 ;;
54b41212 3132 linux) osname=linux
a0d0e21e 3133 case "$3" in
a0d0e21e
LW
3134 *) osvers="$3" ;;
3135 esac
3136 ;;
54b41212 3137 MiNT) osname=mint
28e8609d
JH
3138 ;;
3139 netbsd*) osname=netbsd
ecfc5424
AD
3140 osvers="$3"
3141 ;;
4e81affe
MM
3142 news-os) osvers="$3"
3143 case "$3" in
3144 4*) osname=newsos4 ;;
3145 *) osname=newsos ;;
3146 esac
3147 ;;
aaacdc8b 3148 next*) osname=next ;;
28bb1e2c 3149 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3150 openbsd) osname=openbsd
3151 osvers="$3"
3152 ;;
8257dec7
IZ
3153 os2) osname=os2
3154 osvers="$4"
3155 ;;
aaacdc8b
GS
3156 POSIX-BC | posix-bc ) osname=posix-bc
3157 osvers="$3"
a0d0e21e 3158 ;;
ae3afa4e
TH
3159 powerux | power_ux | powermax_os | powermaxos | \
3160 powerunix | power_unix) osname=powerux
3161 osvers="$3"
3162 ;;
aaacdc8b
GS
3163 qnx) osname=qnx
3164 osvers="$4"
3165 ;;
a0d0e21e
LW
3166 solaris) osname=solaris
3167 case "$3" in
3168 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3169 *) osvers="$3" ;;
a0d0e21e
LW
3170 esac
3171 ;;
85e6fe83
LW
3172 sunos) osname=sunos
3173 case "$3" in
85e6fe83
LW
3174 5*) osname=solaris
3175 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3176 *) osvers="$3" ;;
2304df62
AD
3177 esac
3178 ;;
a0d0e21e 3179 titanos) osname=titanos
85e6fe83 3180 case "$3" in
a0d0e21e
LW
3181 1*) osvers=1 ;;
3182 2*) osvers=2 ;;
3183 3*) osvers=3 ;;
3184 4*) osvers=4 ;;
ecfc5424 3185 *) osvers="$3" ;;
2304df62
AD
3186 esac
3187 ;;
85e6fe83 3188 ultrix) osname=ultrix
ecfc5424 3189 osvers="$3"
2304df62 3190 ;;
28757baa 3191 osf1|mls+) case "$5" in
fed7345c
AD
3192 alpha)
3193 osname=dec_osf
c0e211e2 3194 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3195 case "$osvers" in
3196 [1-9].[0-9]*) ;;
3197 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3198 esac
ecfc5424
AD
3199 ;;
3200 hp*) osname=hp_osf1 ;;
3201 mips) osname=mips_osf1 ;;
85e6fe83
LW
3202 esac
3203 ;;
bfd7eeef
JH
3204 # UnixWare 7.1.2 is known as Open UNIX 8
3205 openunix|unixware) osname=svr5
0337d152
BG
3206 osvers="$4"
3207 ;;
3c728e00 3208 uts) osname=uts
a0d0e21e
LW
3209 osvers="$3"
3210 ;;
3c728e00
JH
3211 vos) osvers="$3"
3212 ;;
85e6fe83 3213 $2) case "$osname" in
2304df62 3214 *isc*) ;;
a0d0e21e 3215 *freebsd*) ;;
5f05dabc 3216 svr*)
a0d0e21e
LW
3217 : svr4.x or possibly later
3218 case "svr$3" in
3219 ${osname}*)
3220 osname=svr$3
3221 osvers=$4
3222 ;;
3223 esac
3224 case "$osname" in
3225 svr4.0)
3226 : Check for ESIX
3227 if test -f /stand/boot ; then
3228 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3229 if test -n "$INITPROG" -a -f "$INITPROG"; then
3230 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3231 if test -n "$isesix"; then
a0d0e21e
LW
3232 osname=esix4
3233 fi
3234 fi
3235 fi
3236 ;;
3237 esac
3238 ;;
2304df62 3239 *) if test -f /etc/systemid; then
a0d0e21e
LW
3240 osname=sco
3241 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3242 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3243 osvers=$1.$2.$3
c4f23d77 3244 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3245 osvers=$1.$2
c4f23d77 3246 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3247 osvers=$1
2304df62 3248 fi
a0d0e21e
LW
3249 else
3250 case "$osname" in
3251 '') : Still unknown. Probably a generic Sys V.
3252 osname="sysv"
3253 osvers="$3"
3254 ;;
3255 esac
2304df62
AD
3256 fi
3257 ;;
3258 esac
3259 ;;
a0d0e21e
LW
3260 *) case "$osname" in
3261 '') : Still unknown. Probably a generic BSD.
3262 osname="$1"
3263 osvers="$3"
3264 ;;
3265 esac
3266 ;;
2304df62
AD
3267 esac
3268 else
dfe9444c
AD
3269 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3270 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3271 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3272 osname=news_os
2304df62 3273 fi
dfe9444c 3274 $rm -f UU/kernel.what
8257dec7 3275 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3276 set X $myuname
3277 osname=os2
3278 osvers="$5"
2304df62
AD
3279 fi
3280 fi
85e6fe83 3281
5440bc8e
JH
3282 case "$targetarch" in
3283 '') ;;
3284 *) hostarch=$osname
3285 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3286 osvers=''
3287 ;;
3288 esac
3289
a0d0e21e
LW
3290 : Now look for a hint file osname_osvers, unless one has been
3291 : specified already.
3292 case "$hintfile" in
3293 ''|' ')
1e127011 3294 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3295 : Also try without trailing minor version numbers.
1e127011
DD
3296 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3297 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3298 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3299 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3300 case "$file" in
3301 '') dflt=none ;;
3302 *) case "$osvers" in
3303 '') dflt=$file
3304 ;;
dfe9444c 3305 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3306 dflt=$file
dfe9444c 3307 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3308 dflt=$xfile
dfe9444c 3309 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3310 dflt=$xxfile
dfe9444c 3311 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3312 dflt=$xxxfile
dfe9444c 3313 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3314 dflt=$xxxxfile
dfe9444c 3315 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3316 dflt="${osname}"
3317 else
3318 dflt=none
3319 fi
3320 ;;
3321 esac
85e6fe83
LW
3322 ;;
3323 esac
4e2a5f63
AD
3324 if $test -f Policy.sh ; then
3325 case "$dflt" in
3326 *Policy*) ;;
3327 none) dflt="Policy" ;;
3328 *) dflt="Policy $dflt" ;;
3329 esac
3330 fi
85e6fe83 3331 ;;
a0d0e21e 3332 *)
ecfc5424 3333 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3334 ;;
2304df62 3335 esac
1aef975c 3336
4e2a5f63
AD
3337 if $test -f Policy.sh ; then
3338 $cat <<EOM
3339
3340There's also a Policy hint file available, which should make the
3341site-specific (policy) questions easier to answer.
3342EOM
3343
3344 fi
3345
2304df62
AD
3346 $cat <<EOM
3347
3348You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 3349A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 3350is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
3351
3352EOM
4e2a5f63 3353
2304df62 3354 rp="Which of these apply, if any?"
dfe9444c 3355 . UU/myread
85e6fe83
LW
3356 tans=$ans
3357 for file in $tans; do
4e2a5f63
AD
3358 if $test X$file = XPolicy -a -f Policy.sh; then
3359 . Policy.sh
3360 $cat Policy.sh >> UU/config.sh
3361 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3362 . $src/hints/$file.sh
3363 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3364 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3365 : nothing
3366 else
85e6fe83
LW
3367 : Give one chance to correct a possible typo.
3368 echo "$file.sh does not exist"
3369 dflt=$file
3370 rp="hint to use instead?"
dfe9444c 3371 . UU/myread
85e6fe83 3372 for file in $ans; do
dfe9444c
AD
3373 if $test -f "$src/hints/$file.sh"; then
3374 . $src/hints/$file.sh
3375 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3376 elif $test X$ans = X -o X$ans = Xnone ; then
3377 : nothing
3378 else
3379 echo "$file.sh does not exist -- ignored."
3380 fi
3381 done
2304df62
AD
3382 fi
3383 done
85e6fe83 3384
2304df62 3385 hint=recommended
85e6fe83 3386 : Remember our hint file for later.
dfe9444c 3387 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3388 hintfile="$file"
85e6fe83 3389 else
a0d0e21e 3390 hintfile=''
85e6fe83 3391 fi
2304df62
AD
3392fi
3393cd UU
3394;;
3395*)
3396 echo " "
3397 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3398 tmp_n="$n"
3399 tmp_c="$c"
2304df62
AD
3400 cd ..
3401 cp $config_sh config.sh 2>/dev/null
a78b0d02 3402 chmod +w config.sh
2304df62
AD
3403 . ./config.sh
3404 cd UU
3405 cp ../config.sh .
ecfc5424
AD
3406 n="$tmp_n"
3407 c="$tmp_c"
2304df62
AD
3408 hint=previous
3409 ;;
3410esac
1aef975c 3411test "$override" && . ./optdef.sh
2304df62
AD
3412
3413: Restore computed paths
3414for file in $loclist $trylist; do
3415 eval $file="\$_$file"
3416done
3417
85e6fe83 3418cat << EOM
a0d0e21e 3419
85e6fe83 3420Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3421The default value is probably right if the name rings a bell. Otherwise,
3422since spelling matters for me, either accept the default or answer "none"
3423to leave it blank.
a0d0e21e 3424
85e6fe83 3425EOM
85e6fe83 3426case "$osname" in
a0d0e21e 3427 ''|' ')
85e6fe83 3428 case "$hintfile" in
a0d0e21e 3429 ''|' '|none) dflt=none ;;
ecfc5424 3430 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3431 esac
3432 ;;
3433 *) dflt="$osname" ;;
3434esac
3435rp="Operating system name?"
3436. ./myread
3437case "$ans" in
ecfc5424
AD
3438none) osname='' ;;
3439*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3440esac
8ff267be 3441echo " "
3442case "$osvers" in
3443 ''|' ')
3444 case "$hintfile" in
3445 ''|' '|none) dflt=none ;;
3446 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3447 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3448 case "$dflt" in
3449 ''|' ') dflt=none ;;
3450 esac
3451 ;;
3452 esac
3453 ;;
3454 *) dflt="$osvers" ;;
3455esac
3456rp="Operating system version?"
3457. ./myread
3458case "$ans" in
3459none) osvers='' ;;
3460*) osvers="$ans" ;;
3461esac
3462
02e93a22
JH
3463
3464. ./posthint.sh
3465
2304df62 3466: who configured the system
59b83a6f 3467cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3468case "$cf_by" in
3469"")
3d46c0ef 3470 cf_by=`(logname) 2>/dev/null`
dfe9444c 3471 case "$cf_by" in
3d46c0ef
NC
3472 "")
3473 cf_by=`(whoami) 2>/dev/null`
3474 case "$cf_by" in
3475 "") cf_by=unknown ;;
3476 esac ;;
8ff267be 3477 esac ;;
3478esac
2304df62 3479
b4eb6b3d
JH
3480: set up the script used to warn in case of inconsistency
3481cat <<EOS >whoa
3482$startsh
3483EOS
3484cat <<'EOSC' >>whoa
3485dflt=y
3486echo " "
3487echo "*** WHOA THERE!!! ***" >&4
3488echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3489rp=" Keep the $hint value?"
3490. ./myread
3491case "$ans" in
3492y) td=$was; tu=$was;;
3493esac
3494EOSC
3495
3496: function used to set $1 to $val
3497setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3498case "$val$was" in
3499$define$undef) . ./whoa; eval "$var=\$td";;
3500$undef$define) . ./whoa; eval "$var=\$tu";;
3501*) eval "$var=$val";;
3502esac'
3503
b29b105d
JH
3504case "$usesocks" in
3505$define|true|[yY]*) dflt='y';;
3506*) dflt='n';;
3507esac
3508cat <<EOM
3509
3510Perl can be built to use the SOCKS proxy protocol library. To do so,
3511Configure must be run with -Dusesocks. If you use SOCKS you also need
3512to use the PerlIO abstraction layer, this will be implicitly selected.
3513
3514If this doesn't make any sense to you, just accept the default '$dflt'.
3515EOM
3516rp='Build Perl for SOCKS?'
3517. ./myread
3518case "$ans" in
3519y|Y) val="$define" ;;
3520*) val="$undef" ;;
3521esac
3522set usesocks
3523eval $setvar
3524
3525case "$usesocks" in
3526$define|true|[yY]*) useperlio="$define";;
3527esac
3528
3529case "$useperlio" in
3530$define|true|[yY]*|'') dflt='y';;
3531*) dflt='n';;
3532esac
3533cat <<EOM
3534
3535Previous version of $package used the standard IO mechanisms as
3536defined in <stdio.h>. Versions 5.003_02 and later of $package allow
3537alternate IO mechanisms via the PerlIO abstraction layer, but the
3538stdio mechanism is still available if needed. The abstraction layer
3539can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3540Using PerlIO with sfio may cause problems with some extension modules.
3541
3542If this doesn't make any sense to you, just accept the default '$dflt'.
3543EOM
3544rp='Use the PerlIO abstraction layer?'
3545. ./myread
3546case "$ans" in
3547y|Y)
3548 val="$define"
3549 ;;
3550*)
3551 echo "Ok, doing things the stdio way."
3552 val="$undef"
3553 ;;
3554esac
3555set useperlio
3556eval $setvar
3557
3558case "$usesocks" in
3559$define|true|[yY]*)
3560 case "$useperlio" in
3561 $define|true|[yY]*) ;;
3562 *) cat >&4 <<EOM
3563
3564You are using the SOCKS proxy protocol library which means that you
3565should also use the PerlIO layer. You may be headed for trouble.
3566
3567EOM
3568 ;;
3569 esac
3570 ;;
3571esac
3572
3573
b4eb6b3d
JH
3574case "$usethreads" in
3575$define|true|[yY]*) dflt='y';;
8e285145
AD
3576*) # Catch case where user specified ithreads or 5005threads but
3577 # forgot -Dusethreads (A.D. 4/2002)
3578 case "$useithreads$use5005threads" in
b29b105d
JH
3579 *$define*)
3580 case "$useperlio" in
3581 "$define") dflt='y' ;;
3582 *) dflt='n' ;;
3583 esac
3584 ;;
3585 *) dflt='n';;
8e285145
AD
3586 esac
3587 ;;
b4eb6b3d
JH
3588esac
3589cat <<EOM
3590
3591Perl can be built to take advantage of threads on some systems.
3592To do so, Configure can be run with -Dusethreads.
3593
bfce6503
DM
3594Note that Perl built with threading support runs slightly slower
3595and uses more memory than plain Perl. The current implementation
3596is believed to be stable, but it is fairly new, and so should be
3597treated with caution.
b4eb6b3d
JH
3598
3599If this doesn't make any sense to you, just accept the default '$dflt'.
3600EOM
3601rp='Build a threading Perl?'
3602. ./myread
3603case "$ans" in
3604y|Y) val="$define" ;;
3605*) val="$undef" ;;
3606esac
3607set usethreads
3608eval $setvar
3609
3610case "$usethreads" in
3611$define)
3612 $cat <<EOM
3613
bfce6503
DM
3614Since release 5.6, Perl has had two different threading implementations,
3615the newer interpreter-based version (ithreads) with one interpreter per
3616thread, and the older 5.005 version (5005threads).
3617The 5005threads version is effectively unmaintained and will probably be
3618removed in Perl 5.10, so there should be no need to build a Perl using it
3619unless needed for backwards compatibility with some existing 5.005threads
3620code.
b4eb6b3d 3621
b4eb6b3d
JH
3622EOM
3623 : Default to ithreads unless overridden on command line or with
3624 : old config.sh
3625 dflt='y'
3626 case "$use5005threads" in
3627 $define|true|[yY]*) dflt='n';;
3628 esac
3629 case "$useithreads" in
3630 $undef|false|[nN]*) dflt='n';;
3631 esac
bfce6503 3632 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
3633 . ./myread
3634 case "$ans" in
3635 y|Y) val="$define" ;;
3636 *) val="$undef" ;;
3637 esac
3638 set useithreads
3639 eval $setvar
3640 : Now set use5005threads to the opposite value.
3641 case "$useithreads" in
3642 $define) val="$undef" ;;
3643 *) val="$define" ;;
3644 esac
3645 set use5005threads
3646 eval $setvar
3647 ;;
3648*)
3649 useithreads="$undef"
3650 use5005threads="$undef"
3651 ;;
3652esac
3653
c915ce7f
JH
3654case "$useithreads$use5005threads" in
3655"$define$define")
3656 $cat >&4 <<EOM
3657
3658You cannot have both the ithreads and the 5.005 threads enabled
3659at the same time. Disabling the 5.005 threads since they are
3660much less stable than the ithreads.
3661
3662EOM
3663 use5005threads="$undef"
3664 ;;
3665esac
3666
b29b105d
JH
3667if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3668 cat >&4 <<EOF
3669***
3670*** To build with ithreads you must also use the PerlIO layer.
3671*** Cannot continue, aborting.
3672***
3673EOF
3674 exit 1
3675fi
3676
b4eb6b3d
JH
3677case "$d_oldpthreads" in
3678'') : Configure tests would be welcome here. For now, assume undef.
3679 val="$undef" ;;
3680*) val="$d_oldpthreads" ;;
3681esac
3682set d_oldpthreads
3683eval $setvar
3684
3685
b4eb6b3d
JH
3686: Look for a hint-file generated 'call-back-unit'. If the
3687: user has specified that a threading perl is to be built,
3688: we may need to set or change some other defaults.
6bd2d01f
NC
3689if $test -f usethreads.cbu; then
3690 echo "Your platform has some specific hints regarding threaded builds, using them..."
3691 . ./usethreads.cbu
3692else
3693 case "$usethreads" in
3694 "$define"|true|[yY]*)
b4eb6b3d 3695 $cat <<EOM
6bd2d01f 3696(Your platform does not have any specific hints for threaded builds.
b4eb6b3d
JH
3697 Assuming POSIX threads, then.)
3698EOM
b4eb6b3d 3699 ;;
6bd2d01f
NC
3700 esac
3701fi
b4eb6b3d
JH
3702
3703cat <<EOM
3704
3705Perl can be built so that multiple Perl interpreters can coexist
3706within the same Perl executable.
3707EOM
3708
3709case "$useithreads" in
3710$define)
3711 cat <<EOM
3712This multiple interpreter support is required for interpreter-based threads.
3713EOM
3714 val="$define"
3715 ;;
3716*) case "$usemultiplicity" in
3717 $define|true|[yY]*) dflt='y';;
3718 *) dflt='n';;
3719 esac
3720 echo " "
3721 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3722 rp='Build Perl for multiplicity?'
3723 . ./myread
3724 case "$ans" in
3725 y|Y) val="$define" ;;
3726 *) val="$undef" ;;
3727 esac
3728 ;;
3729esac
3730set usemultiplicity
3731eval $setvar
3732
96056487
JH
3733
3734case "$usemorebits" in
3735"$define"|true|[yY]*)
3736 use64bitint="$define"
3737 uselongdouble="$define"
3738 usemorebits="$define"
3739 ;;
3740*) usemorebits="$undef"
3741 ;;
3742esac
3743
e5e20432
JH
3744: make some quick guesses about what we are up against
3745echo " "
3746$echo $n "Hmm... $c"
3747echo exit 1 >bsd
3748echo exit 1 >usg
3749echo exit 1 >v7
3750echo exit 1 >osf1
3751echo exit 1 >eunice
3752echo exit 1 >xenix
3753echo exit 1 >venix
3754echo exit 1 >os2
3755d_bsd="$undef"
3756$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3757if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3758then
3759 echo "Looks kind of like an OSF/1 system, but we'll see..."
3760 echo exit 0 >osf1
381aa1ff 3761elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3762 xxx=`./loc addbib blurfl $pth`
3763 if $test -f $xxx; then
3764 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3765 echo exit 0 >bsd
3766 echo exit 0 >usg
3767 else
3768 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3769 echo "Looks kind of like an extended USG system, but we'll see..."
3770 else
3771 echo "Looks kind of like a USG system, but we'll see..."
3772 fi
3773 echo exit 0 >usg
3774 fi
3775elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3776 echo "Looks kind of like a BSD system, but we'll see..."
3777 d_bsd="$define"
3778 echo exit 0 >bsd
3779else
3780 echo "Looks kind of like a Version 7 system, but we'll see..."
3781 echo exit 0 >v7
3782fi
3783case "$eunicefix" in
3784*unixtovms*)
3785 $cat <<'EOI'
3786There is, however, a strange, musty smell in the air that reminds me of
3787something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3788EOI
3789 echo exit 0 >eunice
3790 d_eunice="$define"
3791: it so happens the Eunice I know will not run shell scripts in Unix format
3792 ;;
3793*)
3794 echo " "
3795 echo "Congratulations. You aren't running Eunice."
3796 d_eunice="$undef"
3797 ;;
3798esac
3799: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3800: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3801: semicolon as a patch separator
e5e20432
JH
3802case "$p_" in
3803:) ;;
3804*)
3805 $cat <<'EOI'
3806I have the feeling something is not exactly right, however...don't tell me...
3807lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3808(Or you may be running DOS with DJGPP.)
e5e20432
JH
3809EOI
3810 echo exit 0 >os2
3811 ;;
3812esac
3813if test -f /xenix; then
3814 echo "Actually, this looks more like a XENIX system..."
3815 echo exit 0 >xenix
3816 d_xenix="$define"
3817else
3818 echo " "
3819 echo "It's not Xenix..."
3820 d_xenix="$undef"
3821fi
3822chmod +x xenix
3823$eunicefix xenix
3824if test -f /venix; then
3825 echo "Actually, this looks more like a VENIX system..."
3826 echo exit 0 >venix
3827else
3828 echo " "
3829 if ./xenix; then
3830 : null
3831 else
3832 echo "Nor is it Venix..."
3833 fi
3834fi
3835chmod +x bsd usg v7 osf1 eunice xenix venix os2
3836$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3837$rm -f foo
3838
5869b1f1
JH
3839case "$cc" in
3840'') dflt=cc;;
3841*) dflt="$cc";;
3842esac
3843rp="Use which C compiler?"
3844. ./myread
3845cc="$ans"
6b769f8f
RB
3846
3847: See if they have not cc but they do have gcc
3848. ./trygcc
e5e20432
JH
3849: Look for a hint-file generated 'call-back-unit'. Now that the
3850: user has specified the compiler, we may need to set or change some
3851: other defaults.
3852if $test -f cc.cbu; then
3853 . ./cc.cbu
3854fi
2573c5f9 3855. ./checkcc
8a27cf78 3856
e5e20432
JH
3857echo " "
3858echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 3859$cat >try.c <<EOM
e5e20432
JH
3860#include <stdio.h>
3861int main() {
3862#ifdef __GNUC__
3863#ifdef __VERSION__
3864 printf("%s\n", __VERSION__);
3865#else
3866 printf("%s\n", "1");
3867#endif
3868#endif
c04fee9e 3869 return(0);
e5e20432
JH
3870}
3871EOM
5440bc8e
JH
3872if $cc -o try $ccflags $ldflags try.c; then
3873 gccversion=`$run ./try`
e5e20432
JH
3874 case "$gccversion" in
3875 '') echo "You are not using GNU cc." ;;
fc68435e 3876 *) echo "You are using GNU cc $gccversion."
2493591f 3877 ccname=gcc
fc68435e 3878 ;;
e5e20432
JH
3879 esac
3880else
3881 echo " "
3882 echo "*** WHOA THERE!!! ***" >&4
3883 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3884 case "$knowitall" in
3885 '')
3886 echo " You'd better start hunting for one and let me know about it." >&4
3887 exit 1
3888 ;;
3889 esac
3890fi
5440bc8e 3891$rm -f try try.*
e5e20432
JH
3892case "$gccversion" in
38931*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3894esac
5b463ca7
KS
3895case "$gccversion" in
3896'') gccosandvers='' ;;
10b4ebb5
JH
3897*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3898 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3899 gccshortvers=''
5b463ca7 3900 case "$gccosandvers" in
02903077
JH
3901 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3902 $osname$osvers) ;; # looking good
5b463ca7
KS
3903 $osname*) cat <<EOM >&4
3904
3905*** WHOA THERE!!! ***
3906
3907 Your gcc has not been compiled for the exact release of
3908 your operating system ($gccosandvers versus $osname$osvers).
3909
3910 In general it is a good idea to keep gcc synchronized with
3911 the operating system because otherwise serious problems
3912 may ensue when trying to compile software, like Perl.
3913
3914 I'm trying to be optimistic here, though, and will continue.
3915 If later during the configuration and build icky compilation
02903077
JH
3916 problems appear (headerfile conflicts being the most common
3917 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3918 your operating system release.
3919
3920EOM
3921 ;;
81575342 3922 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3923 esac
3924 ;;
3925esac
e723fc21
JH
3926case "$ccname" in
3927'') ccname="$cc" ;;
3928esac
e5e20432 3929
5b7ea690 3930# gcc 3.* complain about adding -Idirectories that they already know about,
76589481
JH
3931# so we will take those off from locincpth.
3932case "$gccversion" in
39333*)
3934 echo "main(){}">try.c
5b7ea690
JH
3935 for incdir in $locincpth; do
3936 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
2493591f 3937 grep '^c[cp]p*[01]: warning: changing search order '`
5b7ea690 3938 if test "X$warn" != X; then
44b94491 3939 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
5b7ea690 3940 fi
76589481
JH
3941 done
3942 $rm -f try try.*
3943esac
640374d0 3944
bd9b35c9
JH
3945: decide how portable to be. Allow command line overrides.
3946case "$d_portable" in
3947"$undef") ;;
3948*) d_portable="$define" ;;
104d25b7 3949esac
85ab1d1d 3950
bd9b35c9
JH
3951: set up shell script to do ~ expansion
3952cat >filexp <<EOSS
3953$startsh
3954: expand filename
3955case "\$1" in
3956 ~/*|~)
3957 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3958 ;;
3959 ~*)
3960 if $test -f /bin/csh; then
3961 /bin/csh -f -c "glob \$1"
3962 failed=\$?
3963 echo ""
3964 exit \$failed
e5e20432 3965 else
bd9b35c9
JH
3966 name=\`$expr x\$1 : '..\([^/]*\)'\`
3967 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3968 if $test ! -d "\$dir"; then
3969 me=\`basename \$0\`
3970 echo "\$me: can't locate home directory for: \$name" >&2
3971 exit 1
3972 fi
3973 case "\$1" in
3974 */*)
3975 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3976 ;;
3977 *)
3978 echo \$dir
e5e20432
JH
3979 ;;
3980 esac
3981 fi
b691c02f 3982 ;;
4633a7c4 3983*)
bd9b35c9 3984 echo \$1
2304df62
AD
3985 ;;
3986esac
4633a7c4
LW
3987EOSS
3988chmod +x filexp
3989$eunicefix filexp
2304df62
AD
3990
3991: now set up to get a file name
28757baa 3992cat <<EOS >getfile
3993$startsh
3994EOS
3995cat <<'EOSC' >>getfile
2304df62
AD
3996tilde=''
3997fullpath=''
3998already=''
3999skip=''
4000none_ok=''
4001exp_file=''
a0d0e21e 4002nopath_ok=''
2304df62
AD
4003orig_rp="$rp"
4004orig_dflt="$dflt"
b233458b
JH
4005case "$gfpth" in
4006'') gfpth='.' ;;
4007esac
2304df62
AD
4008
4009case "$fn" in
ecfc5424 4010*\(*)
d604bb53
JH
4011 : getfile will accept an answer from the comma-separated list
4012 : enclosed in parentheses even if it does not meet other criteria.
4013 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
4014 fn=`echo $fn | sed 's/(.*)//'`
4015 ;;
4016esac
4017
4018case "$fn" in
a0d0e21e
LW
4019*:*)
4020 loc_file=`expr $fn : '.*:\(.*\)'`
4021 fn=`expr $fn : '\(.*\):.*'`
4022 ;;
4023esac
4024
4025case "$fn" in
2304df62
AD
4026*~*) tilde=true;;
4027esac
4028case "$fn" in
4029*/*) fullpath=true;;
4030esac
4031case "$fn" in
4032*+*) skip=true;;
4033esac
4034case "$fn" in
4035*n*) none_ok=true;;
4036esac
4037case "$fn" in
4038*e*) exp_file=true;;
4039esac
a0d0e21e
LW
4040case "$fn" in
4041*p*) nopath_ok=true;;
4042esac
2304df62
AD
4043
4044case "$fn" in
4045*f*) type='File';;
4046*d*) type='Directory';;
a0d0e21e 4047*l*) type='Locate';;
2304df62
AD
4048esac
4049
4050what="$type"
4051case "$what" in
4052Locate) what='File';;
4053esac
4054
4055case "$exp_file" in
4056'')
4057 case "$d_portable" in
4058 "$define") ;;
4059 *) exp_file=true;;
4060 esac
4061 ;;
4062esac
4063
4064cd ..
4065while test "$type"; do
4066 redo=''
4067 rp="$orig_rp"
4068 dflt="$orig_dflt"
4069 case "$tilde" in
4070 true) rp="$rp (~name ok)";;
4071 esac
4072 . UU/myread
ecfc5424
AD
4073 if test -f UU/getfile.ok && \
4074 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4075 then
4076 value="$ans"
4077 ansexp="$ans"
4078 break
4079 fi
2304df62
AD
4080 case "$ans" in
4081 none)
4082 value=''
4083 ansexp=''
4084 case "$none_ok" in
4085 true) type='';;
4086 esac
4087 ;;
4088 *)
4089 case "$tilde" in
4090 '') value="$ans"
4091 ansexp="$ans";;
4092 *)
4093 value=`UU/filexp $ans`
4094 case $? in
4095 0)
4096 if test "$ans" != "$value"; then
ecfc5424 4097 echo "(That expands to $value on this system.)"
2304df62
AD
4098 fi
4099 ;;
4100 *) value="$ans";;
4101 esac
4102 ansexp="$value"
4103 case "$exp_file" in
4104 '') value="$ans";;
4105 esac
4106 ;;
4107 esac
4108 case "$fullpath" in
4109 true)
4110 case "$ansexp" in
4111 /*) value="$ansexp" ;;
23da6c43 4112 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
4113 *)
4114 redo=true
4115 case "$already" in
4116 true)
4117 echo "I shall only accept a full path name, as in /bin/ls." >&4
4118 echo "Use a ! shell escape if you wish to check pathnames." >&4
4119 ;;
4120 *)
4121 echo "Please give a full path name, starting with slash." >&4
4122 case "$tilde" in
4123 true)
4124 echo "Note that using ~name is ok provided it expands well." >&4
4125 already=true
4126 ;;
4127 esac
4128 esac
4129 ;;
4130 esac
4131 ;;
4132 esac
4133 case "$redo" in
4134 '')
4135 case "$type" in
4136 File)
b233458b
JH
4137 for fp in $gfpth; do
4138 if test "X$fp" = X.; then
4139 pf="$ansexp"
4140 else
4141 pf="$fp/$ansexp"
4142 fi
4143 if test -f "$pf"; then
4144 type=''
4145 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4146 then
4147 echo "($value is not a plain file, but that's ok.)"
4148 type=''
4149 fi
4150 if test X"$type" = X; then
4151 value="$pf"
4152 break
4153 fi
4154 done
2304df62
AD
4155 ;;
4156 Directory)
b233458b
JH
4157 for fp in $gfpth; do
4158 if test "X$fp" = X.; then
f78bfc9c
JH
4159 dir="$ans"
4160 direxp="$ansexp"
b233458b 4161 else
dd858076 4162 dir="$fp/$ansexp"
f78bfc9c 4163 direxp="$fp/$ansexp"
b233458b 4164 fi
f78bfc9c 4165 if test -d "$direxp"; then
b233458b 4166 type=''
f78bfc9c 4167 value="$dir"
b233458b
JH
4168 break
4169 fi
4170 done
2304df62
AD
4171 ;;
4172 Locate)
40000a8c 4173 if test -d "$ansexp"; then
a0d0e21e
LW
4174 echo "(Looking for $loc_file in directory $value.)"
4175 value="$value/$loc_file"
40000a8c 4176 ansexp="$ansexp/$loc_file"
2304df62 4177 fi
40000a8c 4178 if test -f "$ansexp"; then
2304df62
AD
4179 type=''
4180 fi
a0d0e21e
LW
4181 case "$nopath_ok" in
4182 true) case "$value" in
4183 */*) ;;
4184 *) echo "Assuming $value will be in people's path."
4185 type=''
4186 ;;
4187 esac
4188 ;;
4189 esac
2304df62
AD
4190 ;;
4191 esac
4192
4193 case "$skip" in
4194 true) type='';
4195 esac
4196
4197 case "$type" in
4198 '') ;;
4199 *)
4200 if test "$fastread" = yes; then
4201 dflt=y
4202 else
4203 dflt=n
4204 fi
4205 rp="$what $value doesn't exist. Use that name anyway?"
4206 . UU/myread
4207 dflt=''
4208 case "$ans" in
4209 y*) type='';;
4210 *) echo " ";;
4211 esac
4212 ;;
4213 esac
4214 ;;
4215 esac
4216 ;;
4217 esac
4218done
4219cd UU
4220ans="$value"
4221rp="$orig_rp"
4222dflt="$orig_dflt"
ecfc5424 4223rm -f getfile.ok
b233458b 4224test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
4225EOSC
4226
bd9b35c9
JH
4227: What should the include directory be ?
4228echo " "
4229$echo $n "Hmm... $c"
4230dflt='/usr/include'
4231incpath=''
4232mips_type=''
4233if $test -f /bin/mips && /bin/mips; then
4234 echo "Looks like a MIPS system..."
4235 $cat >usr.c <<'EOCP'
4236#ifdef SYSTYPE_BSD43
4237/bsd43
4238#endif
4239EOCP
8a27cf78 4240 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4241 dflt='/bsd43/usr/include'
4242 incpath='/bsd43'
4243 mips_type='BSD 4.3'
4244 else
4245 mips_type='System V'
4246 fi
4247 $rm -f usr.c usr.out
4248 echo "and you're compiling with the $mips_type compiler and libraries."
4249 xxx_prompt=y
4250 echo "exit 0" >mips
4251else
4252 echo "Doesn't look like a MIPS system."
4253 xxx_prompt=n
4254 echo "exit 1" >mips
4255fi
4256chmod +x mips
4257$eunicefix mips
4258case "$usrinc" in
4259'') ;;
4260*) dflt="$usrinc";;
4261esac
4262case "$xxx_prompt" in
4263y) fn=d/
4264 echo " "
4265 rp='Where are the include files you want to use?'
4266 . ./getfile
4267 usrinc="$ans"
8e07c86e 4268 ;;
bd9b35c9 4269*) usrinc="$dflt"
8e07c86e
AD
4270 ;;
4271esac
2304df62 4272
96056487
JH
4273: see how we invoke the C preprocessor
4274echo " "
4275echo "Now, how can we feed standard input to your C preprocessor..." >&4
4276cat <<'EOT' >testcpp.c
4277#define ABC abc
4278#define XYZ xyz
4279ABC.XYZ
4280EOT
4281cd ..
4282if test ! -f cppstdin; then
4283 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4284 # AIX cc -E doesn't show the absolute headerfile
4285 # locations but we'll cheat by using the -M flag.
4286 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
4287 else
4288 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4289 fi
4290else
4291 echo "Keeping your $hint cppstdin wrapper."
4292fi
4293chmod 755 cppstdin
4294wrapper=`pwd`/cppstdin
4295ok='false'
4296cd UU
4297
4298if $test "X$cppstdin" != "X" && \
4299 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4300 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4301then
4302 echo "You used to use $cppstdin $cppminus so we'll use that again."
4303 case "$cpprun" in
4304 '') echo "But let's see if we can live without a wrapper..." ;;
4305 *)
4306 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4307 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4308 then
4309 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4310 ok='true'
4311 else
4312 echo "(However, $cpprun $cpplast does not work, let's see...)"
4313 fi
4314 ;;
4315 esac
4316else
4317 case "$cppstdin" in
4318 '') ;;
4319 *)
4320 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4321 ;;
4322 esac
4323fi
4324
4325if $ok; then
4326 : nothing
4327elif echo 'Maybe "'"$cc"' -E" will work...'; \
4328 $cc -E <testcpp.c >testcpp.out 2>&1; \
4329 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4330 echo "Yup, it does."
4331 x_cpp="$cc -E"
4332 x_minus='';
4333elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4334 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4335 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4336 echo "Yup, it does."
4337 x_cpp="$cc -E"
4338 x_minus='-';
4339elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4340 $cc -P <testcpp.c >testcpp.out 2>&1; \
4341 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4342 echo "Yipee, that works!"
4343 x_cpp="$cc -P"
4344 x_minus='';
4345elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4346 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4347 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4348 echo "At long last!"
4349 x_cpp="$cc -P"
4350 x_minus='-';
4351elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4352 $cpp <testcpp.c >testcpp.out 2>&1; \
4353 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4354 echo "It works!"
4355 x_cpp="$cpp"
4356 x_minus='';
4357elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4358 $cpp - <testcpp.c >testcpp.out 2>&1; \
4359 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4360 echo "Hooray, it works! I was beginning to wonder."
4361 x_cpp="$cpp"
4362 x_minus='-';
4363elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4364 $wrapper <testcpp.c >testcpp.out 2>&1; \
4365 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4366 x_cpp="$wrapper"
4367 x_minus=''
4368 echo "Eureka!"
4369else
4370 dflt=''
4371 rp="No dice. I can't find a C preprocessor. Name one:"
4372 . ./myread
4373 x_cpp="$ans"
4374 x_minus=''
4375 $x_cpp <testcpp.c >testcpp.out 2>&1
4376 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4377 echo "OK, that will do." >&4
4378 else
4379echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4380 exit 1
4381 fi
4382fi
4383
4384case "$ok" in
4385false)
4386 cppstdin="$x_cpp"
4387 cppminus="$x_minus"
4388 cpprun="$x_cpp"
4389 cpplast="$x_minus"
4390 set X $x_cpp
4391 shift
4392 case "$1" in
4393 "$cpp")
4394 echo "Perhaps can we force $cc -E using a wrapper..."
4395 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4396 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4397 then
4398 echo "Yup, we can."
4399 cppstdin="$wrapper"
4400 cppminus='';
4401 else
4402 echo "Nope, we'll have to live without it..."
4403 fi
4404 ;;
4405 esac
4406 case "$cpprun" in
4407 "$wrapper")
4408 cpprun=''
4409 cpplast=''
4410 ;;
4411 esac
4412 ;;
4413esac
4414
4415case "$cppstdin" in
4416"$wrapper"|'cppstdin') ;;
4417*) $rm -f $wrapper;;
4418esac
4419$rm -f testcpp.c testcpp.out
4420
bd9b35c9
JH
4421: Set private lib path
4422case "$plibpth" in
4423'') if ./mips; then
4424 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4425 fi;;
4426esac
4427case "$libpth" in
4428' ') dlist='';;
4429'') dlist="$loclibpth $plibpth $glibpth";;
4430*) dlist="$libpth";;
4431esac
4432
4433: Now check and see which directories actually exist, avoiding duplicates
4434libpth=''
4435for xxx in $dlist
4436do
4437 if $test -d $xxx; then
4438 case " $libpth " in
4439 *" $xxx "*) ;;
4440 *) libpth="$libpth $xxx";;
4441 esac
4442 fi
4443done
4444$cat <<'EOM'
4445
4446Some systems have incompatible or broken versions of libraries. Among
4447the directories listed in the question below, please remove any you
4448know not to be holding relevant libraries, and add any that are needed.
4449Say "none" for none.
8e07c86e
AD
4450
4451EOM
bd9b35c9
JH
4452case "$libpth" in
4453'') dflt='none';;
8e07c86e 4454*)
bd9b35c9
JH
4455 set X $libpth
4456 shift
4457 dflt=${1+"$@"}
8e07c86e 4458 ;;
a0d0e21e 4459esac
bd9b35c9
JH
4460rp="Directories to use for library searches?"
4461. ./myread
4462case "$ans" in
4463none) libpth=' ';;
4464*) libpth="$ans";;
4465esac
a0d0e21e 4466
bd9b35c9
JH
4467: compute shared library extension
4468case "$so" in
4469'')
4470 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4471 dflt='sl'
dd4e71fd 4472 else
bd9b35c9 4473 dflt='so'
dd4e71fd
JH
4474 fi
4475 ;;
bd9b35c9 4476*) dflt="$so";;
dd4e71fd 4477esac
dd4e71fd
JH
4478$cat <<EOM
4479
bd9b35c9 4480On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4481you want to suppress searching of shared libraries for the remainder
bd9b35c9 4482of this configuration.
dd4e71fd
JH
4483
4484EOM
bd9b35c9
JH
4485rp='What is the file extension used for shared libraries?'
4486. ./myread
4487so="$ans"
dd4e71fd 4488
bd9b35c9
JH
4489: Define several unixisms.
4490: Hints files or command line option can be used to override them.
4491: The convoluted testing is in case hints files set either the old
4492: or the new name.
4493case "$_exe" in
4494'') case "$exe_ext" in
1fef16b3 4495 '') ;;
bd9b35c9 4496 *) _exe="$exe_ext" ;;
dd4e71fd 4497 esac
bd9b35c9 4498 ;;
bfb7748a 4499esac
bd9b35c9
JH
4500case "$_a" in
4501'') case "$lib_ext" in
4502 '') _a='.a';;
4503 *) _a="$lib_ext" ;;
dd4e71fd
JH
4504 esac
4505 ;;
dd4e71fd 4506esac
bd9b35c9
JH
4507case "$_o" in
4508'') case "$obj_ext" in
4509 '') _o='.o';;
4510 *) _o="$obj_ext";;
4511 esac
4512 ;;
4513esac
4514case "$p_" in
4515'') case "$path_sep" in
4516 '') p_=':';;
4517 *) p_="$path_sep";;
4518 esac
4519 ;;
4520esac
4521exe_ext=$_exe
4522lib_ext=$_a
4523obj_ext=$_o
4524path_sep=$p_
dd4e71fd 4525
b4eb6b3d
JH
4526: Which makefile gets called first. This is used by make depend.
4527case "$firstmakefile" in
4528'') firstmakefile='makefile';;
4633a7c4 4529esac
4633a7c4 4530
5a29c6bc
JH
4531case "$ccflags" in
4532*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4533esac
4534
4535case "$uselongdouble" in
4536$define|true|[yY]*) dflt='y';;
4537*) dflt='n';;
4538esac
4539cat <<EOM
4540
4541Perl can be built to take advantage of long doubles which
4542(if available) may give more accuracy and range for floating point numbers.
4543
4544If this doesn't make any sense to you, just accept the default '$dflt'.
4545EOM
4546rp='Try to use long doubles if available?'
4547. ./myread
4548case "$ans" in
4549y|Y) val="$define" ;;
4550*) val="$undef" ;;
4551esac
4552set uselongdouble
4553eval $setvar
4554
4555case "$uselongdouble" in
4556true|[yY]*) uselongdouble="$define" ;;
4557esac
4558
5a29c6bc
JH
4559: Look for a hint-file generated 'call-back-unit'. If the
4560: user has specified that long doubles should be used,
4561: we may need to set or change some other defaults.
6bd2d01f
NC
4562if $test -f uselongdouble.cbu; then
4563 echo "Your platform has some specific hints regarding long doubles, using them..."
4564 . ./uselongdouble.cbu
4565else
4566 case "$uselongdouble" in
4567 $define)
5a29c6bc 4568 $cat <<EOM
6bd2d01f 4569(Your platform does not have any specific hints for long doubles.)
5a29c6bc 4570EOM
5a29c6bc 4571 ;;
6bd2d01f
NC
4572 esac
4573fi
5a29c6bc 4574
bd9b35c9
JH
4575: Looking for optional libraries
4576echo " "
4577echo "Checking for optional libraries..." >&4
4578case "$libs" in
4579' '|'') dflt='';;
4580*) dflt="$libs";;
4581esac
4582case "$libswanted" in
4583'') libswanted='c_s';;
4584esac
4585case "$usesocks" in
923fc586 4586"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4587esac
68435ea7
JH
4588libsfound=''
4589libsfiles=''
4590libsdirs=''
13b3f787
JH
4591libspath=''
4592for thisdir in $libpth $xlibpth; do
4593 test -d $thisdir && libspath="$libspath $thisdir"
4594done
bd9b35c9 4595for thislib in $libswanted; do
13b3f787 4596 for thisdir in $libspath; do
f7dd4e7f
JH
4597 xxx=''
4598 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4599 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4600 $test -f "$xxx" && eval $libscheck
4601 $test -f "$xxx" && libstyle=shared
4602 fi
4603 if test ! -f "$xxx"; then
4604 xxx=$thisdir/lib$thislib.$so
4605 $test -f "$xxx" && eval $libscheck
4606 $test -f "$xxx" && libstyle=shared
4607 fi
4608 if test ! -f "$xxx"; then
4609 xxx=$thisdir/lib$thislib$_a
4610 $test -f "$xxx" && eval $libscheck
4611 $test -f "$xxx" && libstyle=static
4612 fi
4613 if test ! -f "$xxx"; then
4614 xxx=$thisdir/$thislib$_a
4615 $test -f "$xxx" && eval $libscheck
4616 $test -f "$xxx" && libstyle=static
4617 fi
4618 if test ! -f "$xxx"; then
4619 xxx=$thisdir/lib${thislib}_s$_a
4620 $test -f "$xxx" && eval $libscheck
4621 $test -f "$xxx" && libstyle=static
09ea5ba9 4622 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4623 fi
4624 if test ! -f "$xxx"; then
4625 xxx=$thisdir/Slib$thislib$_a
4626 $test -f "$xxx" && eval $libscheck
4627 $test -f "$xxx" && libstyle=static
4628 fi
4629 if $test -f "$xxx"; then
43999f95 4630 case "$libstyle" in
f7dd4e7f
JH
4631 shared) echo "Found -l$thislib (shared)." ;;
4632 static) echo "Found -l$thislib." ;;
4633 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4634 esac
bd9b35c9
JH
4635 case " $dflt " in
4636 *"-l$thislib "*);;
f7dd4e7f 4637 *) dflt="$dflt -l$thislib"
43999f95
JH
4638 libsfound="$libsfound $xxx"
4639 yyy=`basename $xxx`
4640 libsfiles="$libsfiles $yyy"
1e127011 4641 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4642 case " $libsdirs " in
4643 *" $yyy "*) ;;
4644 *) libsdirs="$libsdirs $yyy" ;;
4645 esac
4646 ;;
bd9b35c9 4647 esac
f7dd4e7f
JH
4648 break
4649 fi
4650 done
4651 if $test ! -f "$xxx"; then
4652 echo "No -l$thislib."
bd9b35c9
JH
4653 fi
4654done
4655set X $dflt
4656shift
4657dflt="$*"
4658case "$libs" in
4659'') dflt="$dflt";;
4660*) dflt="$libs";;
4661esac
4662case "$dflt" in
4663' '|'') dflt='none';;
4664esac
4633a7c4 4665
bd9b35c9 4666$cat <<EOM
4633a7c4 4667
bd9b35c9
JH
4668In order to compile $package on your machine, a number of libraries
4669are usually needed. Include any other special libraries here as well.
4670Say "none" for none. The default list is almost always right.
8e07c86e 4671EOM
8e07c86e 4672
bd9b35c9
JH
4673echo " "
4674rp="What libraries to use?"
4675. ./myread
4676case "$ans" in
4677none) libs=' ';;
4678*) libs="$ans";;
4679esac
d71b2b6b 4680
bd9b35c9
JH
4681: determine optimization, if desired, or use for debug flag also
4682case "$optimize" in
4683' '|$undef) dflt='none';;
4684'') dflt='-O';;
4685*) dflt="$optimize";;
4686esac
4687$cat <<EOH
d71b2b6b 4688
bd9b35c9
JH
4689By default, $package compiles with the -O flag to use the optimizer.
4690Alternately, you might want to use the symbolic debugger, which uses
4691the -g flag (on traditional Unix systems). Either flag can be
4692specified here. To use neither flag, specify the word "none".
d71b2b6b 4693
bd9b35c9
JH
4694EOH
4695rp="What optimizer/debugger flag should be used?"
4696. ./myread
4697optimize="$ans"
4698case "$optimize" in
4699'none') optimize=" ";;
4700esac
4701
4702dflt=''
4703: We will not override a previous value, but we might want to
4704: augment a hint file
4705case "$hint" in
4706default|recommended)
4707 case "$gccversion" in
4708 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 4709 esac
bd9b35c9
JH
4710 case "$optimize" in
4711 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 4712 esac
bd9b35c9
JH
4713 case "$gccversion" in
4714 2*) if test -d /etc/conf/kconfig.d &&
4715 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4716 then
7db0018a 4717 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
4718 dflt="$dflt -posix"
4719 fi
f0d04425 4720 ;;
bd9b35c9
JH
4721 esac
4722 case "$gccversion" in
4723 1*) ;;
4724 2.[0-8]*) ;;
4725 ?*) echo " "
4726 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4727 echo 'int main(void) { return 0; }' > gcctest.c
4728 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4729 echo "Yes, it does." 2>&1
4730 case "$ccflags" in
7db0018a 4731 *strict-aliasing*)
bd9b35c9
JH
4732 echo "Leaving current flags $ccflags alone." 2>&1
4733 ;;
4734 *) dflt="$dflt -fno-strict-aliasing" ;;
4735 esac
4736 else
4737 echo "Nope, it doesn't, but that's ok." 2>&1
4738 fi
f0d04425 4739 ;;
e5e20432 4740 esac
7db0018a
AD
4741 # For gcc, adding -pipe speeds up compilations for some, but apparently
4742 # some assemblers can't read from stdin. (It also slows down compilations
4743 # in other cases, but those are apparently rarer these days.) AD 5/2004.
4744 case "$gccversion" in
4745 ?*) echo " "
4746 echo "Checking if your compiler accepts -pipe" 2>&1
4747 echo 'int main(void) { return 0; }' > gcctest.c
3bf3851b 4748 if $cc -pipe -o gcctest gcctest.c; then
7db0018a
AD
4749 echo "Yes, it does." 2>&1
4750 case "$ccflags" in
4751 *-pipe*)
4752 echo "Leaving current flags $ccflags alone." 2>&1
4753 ;;
4754 *) dflt="$dflt -pipe" ;;
4755 esac
4756 else
4757 echo "Nope, it doesn't, but that's ok." 2>&1
4758 fi
3bf3851b
NC
4759
4760 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4761 echo 'int main(void) { return 0; }' > gcctest.c
4762 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4763 echo "Yes, it does." 2>&1
4764 case "$ccflags" in
4765 *-Wdeclaration-after-statement*)
4766 echo "Leaving current flags $ccflags alone." 2>&1
4767 ;;
4768 *) dflt="$dflt -Wdeclaration-after-statement" ;;
4769 esac
4770 else
4771 echo "Nope, it doesn't, but that's ok." 2>&1
4772 fi
7db0018a
AD
4773 ;;
4774 esac
e5e20432
JH
4775 ;;
4776esac
4777
bd9b35c9
JH
4778case "$mips_type" in
4779*BSD*|'') inclwanted="$locincpth $usrinc";;
4780*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4781esac
4782for thisincl in $inclwanted; do
4783 if $test -d $thisincl; then
4784 if $test x$thisincl != x$usrinc; then
4785 case "$dflt" in
7db0018a
AD
4786 *" -I$thisincl "*);;
4787 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
4788 esac
4789 fi
4790 fi
4791done
40a7a20a 4792
bd9b35c9
JH
4793inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4794 xxx=true;
4795elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4796 xxx=true;
4797else
4798 xxx=false;
4799fi;
4800if $xxx; then
4801 case "$dflt" in
4802 *$2*);;
4803 *) dflt="$dflt -D$2";;
4804 esac;
4805fi'
40a7a20a 4806
bd9b35c9 4807set signal.h LANGUAGE_C; eval $inctest
40a7a20a 4808
bd9b35c9
JH
4809case "$usesocks" in
4810$define)
4811 ccflags="$ccflags -DSOCKS"
4812 ;;
4813esac
40a7a20a 4814
bd9b35c9
JH
4815case "$hint" in
4816default|recommended) dflt="$ccflags $dflt" ;;
4817*) dflt="$ccflags";;
4818esac
40a7a20a 4819
bd9b35c9
JH
4820case "$dflt" in
4821''|' ') dflt=none;;
4822esac
422af00a 4823
bd9b35c9 4824$cat <<EOH
40a7a20a 4825
bd9b35c9
JH
4826Your C compiler may want other flags. For this question you should include
4827-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4828but you should NOT include libraries or ld flags like -lwhatever. If you
4829want $package to honor its debug switch, you should include -DDEBUGGING here.
4830Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 4831
bd9b35c9 4832To use no flags, specify the word "none".
40a7a20a 4833
bd9b35c9
JH
4834EOH
4835set X $dflt
4836shift
4837dflt=${1+"$@"}
4838rp="Any additional cc flags?"
4839. ./myread
4840case "$ans" in
4841none) ccflags='';;
4842*) ccflags="$ans";;
4843esac
8e07c86e 4844
bd9b35c9 4845: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
4846case "$cppflags" in
4847'') cppflags="$ccflags" ;;
4848*) cppflags="$cppflags $ccflags" ;;
4849esac
bd9b35c9
JH
4850case "$gccversion" in
48511*) cppflags="$cppflags -D__GNUC__"
4633a7c4 4852esac
bd9b35c9
JH
4853case "$mips_type" in
4854'');;
4855*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4856esac
4857case "$cppflags" in
4858'');;
4859*)
4860 echo " "
4861 echo "Let me guess what the preprocessor flags are..." >&4
4862 set X $cppflags
4863 shift
4864 cppflags=''
4865 $cat >cpp.c <<'EOM'
4866#define BLURFL foo
8e07c86e 4867
bd9b35c9
JH
4868BLURFL xx LFRULB
4869EOM
4870 previous=''
4871 for flag in $*
4872 do
4873 case "$flag" in
4874 -*) ftry="$flag";;
4875 *) ftry="$previous $flag";;
4876 esac
4877 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4878 >cpp1.out 2>/dev/null && \
4879 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4880 >cpp2.out 2>/dev/null && \
4881 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4882 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4883 then
4884 cppflags="$cppflags $ftry"
4885 previous=''
4886 else
4887 previous="$flag"
4888 fi
4889 done
4890 set X $cppflags
4891 shift
4892 cppflags=${1+"$@"}
4893 case "$cppflags" in
4894 *-*) echo "They appear to be: $cppflags";;
4895 esac
4896 $rm -f cpp.c cpp?.out
2afac517 4897 ;;
4898esac
8e07c86e 4899
bd9b35c9
JH
4900: flags used in final linking phase
4901case "$ldflags" in
4902'') if ./venix; then
4903 dflt='-i -z'
10a23457 4904 else
bd9b35c9 4905 dflt=''
10a23457 4906 fi
bd9b35c9
JH
4907 case "$ccflags" in
4908 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 4909 esac
bd9b35c9
JH
4910 ;;
4911*) dflt="$ldflags";;
4912esac
4913
4914: Try to guess additional flags to pick up local libraries.
4915for thislibdir in $libpth; do
4916 case " $loclibpth " in
4917 *" $thislibdir "*)
7db0018a 4918 case "$dflt " in
bd9b35c9
JH
4919 *"-L$thislibdir "*) ;;
4920 *) dflt="$dflt -L$thislibdir" ;;
4921 esac
c4f23d77
AD
4922 ;;
4923 esac
bd9b35c9 4924done
c4f23d77 4925
bd9b35c9
JH
4926case "$dflt" in
4927'') dflt='none' ;;
4928esac
c4f23d77 4929
bd9b35c9
JH
4930$cat <<EOH
4931
4932Your C linker may need flags. For this question you should
4933include -L/whatever and any other flags used by the C linker, but you
4934should NOT include libraries like -lwhatever.
4935
4936Make sure you include the appropriate -L/path flags if your C linker
4937does not normally search all of the directories you specified above,
4938namely
4939 $libpth
4940To use no flags, specify the word "none".
4941
4942EOH
4943
4944rp="Any additional ld flags (NOT including libraries)?"
4945. ./myread
4946case "$ans" in
4947none) ldflags='';;
4948*) ldflags="$ans";;
4949esac
4950rmlist="$rmlist pdp11"
4951
4952: coherency check
4953echo " "
4954echo "Checking your choice of C compiler and flags for coherency..." >&4
4955$cat > try.c <<'EOF'
4956#include <stdio.h>
5a29c6bc 4957int main() { printf("Ok\n"); return(0); }
bd9b35c9 4958EOF
7a282f6d 4959set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
4960shift
4961$cat >try.msg <<'EOM'
4962I've tried to compile and run the following simple program:
4963
4964EOM
4965$cat try.c >> try.msg
4966
4967$cat >> try.msg <<EOM
4968
4969I used the command:
4970
4971 $*
5440bc8e 4972 $run ./try
bd9b35c9
JH
4973
4974and I got the following output:
4975
4976EOM
4977dflt=y
73614538 4978if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5440bc8e
JH
4979 if $sh -c "$run ./try" >>try.msg 2>&1; then
4980 xxx=`$run ./try`
bd9b35c9
JH
4981 case "$xxx" in
4982 "Ok") dflt=n ;;
4983 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4984 case " $libs " in
4985 *" -lsfio "*)
4986 cat >> try.msg <<'EOQS'
4987If $libs contains -lsfio, and sfio is mis-configured, then it
4988sometimes (apparently) runs and exits with a 0 status, but with no
4989output! It may have to do with sfio's use of _exit vs. exit.
4990
4991EOQS
4992 rp="You have a big problem. Shall I abort Configure"
4993 dflt=y
4994 ;;
4995 esac
4996 ;;
4997 esac
4998 else
4999 echo "The program compiled OK, but exited with status $?." >>try.msg
5000 rp="You have a problem. Shall I abort Configure"
5001 dflt=y
5002 fi
5003else
5004 echo "I can't compile the test program." >>try.msg
5005 rp="You have a BIG problem. Shall I abort Configure"
5006 dflt=y
5007fi
5008case "$dflt" in
5009y)
5010 $cat try.msg >&4
5011 case "$knowitall" in
5012 '')
5013 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5014 ;;
bd9b35c9 5015 *) dflt=n;;
c4f23d77 5016 esac
bd9b35c9
JH
5017 echo " "
5018 . ./myread
5019 case "$ans" in
5020 n*|N*) ;;
5021 *) echo "Ok. Stopping Configure." >&4
5022 exit 1
c4f23d77
AD
5023 ;;
5024 esac
5025 ;;
bd9b35c9 5026n) echo "OK, that should do.";;
c4f23d77 5027esac
bd9b35c9 5028$rm -f try try.* core
c4f23d77 5029
bd9b35c9
JH
5030: define a shorthand compile call
5031compile='
5032mc_file=$1;
5033shift;
08413ebc 5034$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5035: define a shorthand compile call for compilations that should be ok.
5036compile_ok='
5037mc_file=$1;
5038shift;
7a282f6d 5039$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5040
8dfa8df9
JH
5041: determine filename position in cpp output
5042echo " "
5043echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5044case "$osname" in
5045vos) testaccess=-e ;;
5046*) testaccess=-r ;;
5047esac
8dfa8df9
JH
5048echo '#include <stdio.h>' > foo.c
5049$cat >fieldn <<EOF
5050$startsh
5051$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5052$grep '^[ ]*#.*stdio\.h' | \
5053while read cline; do
5054 pos=1
5055 set \$cline
5056 while $test \$# -gt 0; do
a5a94ea5 5057 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5058 echo "\$pos"
5059 exit 0
5060 fi
5061 shift
5062 pos=\`expr \$pos + 1\`
5063 done
5064done
5065EOF
5066chmod +x fieldn
5067fieldn=`./fieldn`
5068$rm -f foo.c fieldn
5069case $fieldn in
5070'') pos='???';;
50711) pos=first;;
50722) pos=second;;
50733) pos=third;;
5074*) pos="${fieldn}th";;
5075esac
5076echo "Your cpp writes the filename in the $pos field of the line."
5077
3c728e00
JH
5078case "$osname" in
5079vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
8257dec7 5080os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5081*) cppfilter='' ;;
5082esac
8dfa8df9
JH
5083: locate header file
5084$cat >findhdr <<EOF
5085$startsh
5086wanted=\$1
5087name=''
5088for usrincdir in $usrinc
5089do
5090 if test -f \$usrincdir/\$wanted; then
5091 echo "\$usrincdir/\$wanted"
5092 exit 0
5093 fi
5094done
5095awkprg='{ print \$$fieldn }'
5096echo "#include <\$wanted>" > foo\$\$.c
5097$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5098$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5099while read cline; do
5100 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5101 case "\$name" in
5102 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5103 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5104 *) exit 2;;
5105 esac;
5106done;
5107#
5108# status = 0: grep returned 0 lines, case statement not executed
5109# status = 1: headerfile found
5110# status = 2: while loop executed, no headerfile found
5111#
5112status=\$?
5113$rm -f foo\$\$.c;
5114if test \$status -eq 1; then
5115 exit 0;
5116fi
5117exit 1
5118EOF
5119chmod +x findhdr
5120
5121: define an alternate in-header-list? function
5122inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5123cont=true; xxf="echo \"<\$1> found.\" >&4";
5124case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5125*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5126esac;
5127case $# in 4) instead=instead;; *) instead="at last";; esac;
5128while $test "$cont"; do
5129 xxx=`./findhdr $1`
5130 var=$2; eval "was=\$$2";
5131 if $test "$xxx" && $test -r "$xxx";
5132 then eval $xxf;
5133 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5134 cont="";
5135 else eval $xxnf;
5136 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5137 set $yyy; shift; shift; yyy=$@;
5138 case $# in 0) cont="";;
5139 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5140 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5141 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5142 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5143 esac;
5144done;
5145while $test "$yyy";
5146do set $yyy; var=$2; eval "was=\$$2";
5147 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5148 set $yyy; shift; shift; yyy=$@;
5149done'
5150
5ed858ef
JH
5151: see if stdlib is available
5152set stdlib.h i_stdlib
5153eval $inhdr
5154
5155: check for lengths of integral types
5156echo " "
5157case "$intsize" in
5158'')
5159 echo "Checking to see how big your integers are..." >&4
2376c703 5160 $cat >try.c <<EOCP
5ed858ef
JH
5161#include <stdio.h>
5162#$i_stdlib I_STDLIB
5163#ifdef I_STDLIB
5164#include <stdlib.h>
5165#endif
5166int main()
5167{
5168 printf("intsize=%d;\n", (int)sizeof(int));
5169 printf("longsize=%d;\n", (int)sizeof(long));
5170 printf("shortsize=%d;\n", (int)sizeof(short));
5171 exit(0);
5172}
5173EOCP
5174 set try
5175 if eval $compile_ok && $run ./try > /dev/null; then
5176 eval `$run ./try`
5177 echo "Your integers are $intsize bytes long."
5178 echo "Your long integers are $longsize bytes long."
5179 echo "Your short integers are $shortsize bytes long."
5180 else
5181 $cat >&4 <<EOM
5182!
5183Help! I can't compile and run the intsize test program: please enlighten me!
5184(This is probably a misconfiguration in your system or libraries, and
5185you really ought to fix it. Still, I'll try anyway.)
5186!
5187EOM
5188 dflt=4
5189 rp="What is the size of an integer (in bytes)?"
5190 . ./myread
5191 intsize="$ans"
5192 dflt=$intsize
5193 rp="What is the size of a long integer (in bytes)?"
5194 . ./myread
5195 longsize="$ans"
5196 dflt=2
5197 rp="What is the size of a short integer (in bytes)?"
5198 . ./myread
5199 shortsize="$ans"
5200 fi
5201 ;;
5202esac
5203$rm -f try try.*
5204
5205: check for long long
5206echo " "
5207echo "Checking to see if you have long long..." >&4
5208echo 'int main() { long long x = 7; return 0; }' > try.c
5209set try
5210if eval $compile; then
5211 val="$define"
5212 echo "You have long long."
5213else
5214 val="$undef"
5215 echo "You do not have long long."
5216fi
5217$rm try.*
5218set d_longlong
5219eval $setvar
5220
5221: check for length of long long
5222case "${d_longlong}${longlongsize}" in
5223$define)
5224 echo " "
5225 echo "Checking to see how big your long longs are..." >&4
5226 $cat >try.c <<'EOCP'
5227#include <stdio.h>
5228int main()
5229{
5230 printf("%d\n", (int)sizeof(long long));
5231 return(0);
5232}
5233EOCP
5234 set try
5235 if eval $compile_ok; then
5236 longlongsize=`$run ./try`
5237 echo "Your long longs are $longlongsize bytes long."
5238 else
5239 dflt='8'
5240 echo " "
5241 echo "(I can't seem to compile the test program. Guessing...)"
5242 rp="What is the size of a long long (in bytes)?"
5243 . ./myread
5244 longlongsize="$ans"
5245 fi
5246 if $test "X$longsize" = "X$longlongsize"; then
5247 echo "(That isn't any different from an ordinary long.)"
5248 fi
5249 ;;
5250esac
5251$rm -f try.* try
5252
8dfa8df9
JH
5253: see if inttypes.h is available
5254: we want a real compile instead of Inhdr because some systems
5255: have an inttypes.h which includes non-existent headers
5256echo " "
5257$cat >try.c <<EOCP
5258#include <inttypes.h>
5259int main() {
5260 static int32_t foo32 = 0x12345678;
5261}
5262EOCP
5263set try
5264if eval $compile; then
5265 echo "<inttypes.h> found." >&4
5266 val="$define"
5267else
5268 echo "<inttypes.h> NOT found." >&4
5269 val="$undef"
5270fi
5271$rm -f try.c try
5272set i_inttypes
5273eval $setvar
5274
5275: check for int64_t
5276echo " "
5277echo "Checking to see if you have int64_t..." >&4
5278$cat >try.c <<EOCP
5279#include <sys/types.h>
5280#$i_inttypes I_INTTYPES
5281#ifdef I_INTTYPES
5282#include <inttypes.h>
5283#endif
5284int main() { int64_t x = 7; }
5285EOCP
5286set try
5287if eval $compile; then
5288 val="$define"
5289 echo "You have int64_t."
5290else
5291 val="$undef"
5292 echo "You do not have int64_t."
5293fi
5294$rm -f try try.*
5295set d_int64_t
5296eval $setvar
5297
5298
5299echo " "
5300echo "Checking which 64-bit integer type we could use..." >&4
5301
5302case "$intsize" in
53038) val=int
5304 set quadtype
5305 eval $setvar
5306 val='"unsigned int"'
5307 set uquadtype
5308 eval $setvar
5309 quadkind=1
5310 ;;
5311*) case "$longsize" in
5312 8) val=long
5313 set quadtype
5314 eval $setvar
5315 val='"unsigned long"'
5316 set uquadtype
5317 eval $setvar
5318 quadkind=2
5319 ;;
5320 *) case "$d_longlong:$longlongsize" in
5321 define:8)
5322 val='"long long"'
5323 set quadtype
5324 eval $setvar
5325 val='"unsigned long long"'
5326 set uquadtype
5327 eval $setvar
5328 quadkind=3
5329 ;;
5330 *) case "$d_int64_t" in
5331 define)
5332 val=int64_t
5333 set quadtype
5334 eval $setvar
5335 val=uint64_t
5336 set uquadtype
5337 eval $setvar
5338 quadkind=4
5339 ;;
5340 esac
5341 ;;
5342 esac
5343 ;;
5344 esac
5345 ;;
5346esac
5347
5348case "$quadtype" in
5349'') echo "Alas, no 64-bit integer types in sight." >&4
5350 d_quad="$undef"
5351 ;;
5352*) echo "We could use '$quadtype' for 64-bit integers." >&4
5353 d_quad="$define"
5354 ;;
5355esac
5356
b4eb6b3d
JH
5357
5358case "$uselonglong" in
5359"$define"|true|[yY]*)
5360 cat <<EOM >&4
5361
5362*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5363EOM
5364 use64bitint="$define"
5365 ;;
5366esac
5367case "$use64bits" in
5368"$define"|true|[yY]*)
5369 cat <<EOM >&4
5370
5371*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5372EOM
5373 use64bitint="$define"
5374 ;;
5375esac
5376case "$use64bitints" in
5377"$define"|true|[yY]*)
5378 cat <<EOM >&4
5379
5380*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5381EOM
5382 use64bitint="$define"
5383 ;;
5384esac
5385case "$use64bitsint" in
5386"$define"|true|[yY]*)
5387 cat <<EOM >&4
5388
5389*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5390EOM
5391 use64bitint="$define"
5392 ;;
5393esac
5394case "$uselonglongs" in
5395"$define"|true|[yY]*)
5396 cat <<EOM >&4
5397
5398*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5399EOM
5400 use64bitint="$define"
5401 ;;
5402esac
5403case "$use64bitsall" in
5404"$define"|true|[yY]*)
5405 cat <<EOM >&4
5406
5407*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5408EOM
5409 use64bitall="$define"
5410 ;;
5411esac
5412
5413case "$ccflags" in
5414*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5415esac
5416case "$use64bitall" in
5417"$define"|true|[yY]*) use64bitint="$define" ;;
5418esac
5419
5420case "$longsize" in
54218) cat <<EOM
5422
5423You have natively 64-bit long integers.
5424EOM
5425 val="$define"
5426 ;;
5427*) case "$use64bitint" in
5428 "$define"|true|[yY]*) dflt='y';;
5429 *) dflt='n';;
5430 esac
8dfa8df9
JH
5431 case "$d_quad" in
5432 "$define") ;;
5433 *) dflt='n' ;;
5434 esac
b4eb6b3d
JH
5435 cat <<EOM
5436
5437Perl can be built to take advantage of 64-bit integer types
5438on some systems. To do so, Configure can be run with -Duse64bitint.
5439Choosing this option will most probably introduce binary incompatibilities.
5440
5441If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5442(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5443EOM
5444 rp='Try to use 64-bit integers, if available?'
5445 . ./myread
5446 case "$ans" in
5447 [yY]*) val="$define" ;;
5448 *) val="$undef" ;;
5449 esac
5450 ;;
5451esac
5452set use64bitint
5453eval $setvar
5454
5455case "$use64bitall" in
5456"$define"|true|[yY]*) dflt='y' ;;
5457*) case "$longsize" in
5458 8) dflt='y' ;;
5459 *) dflt='n' ;;
5460 esac
5461 ;;
5462esac
5463cat <<EOM
5464
5465You may also choose to try maximal 64-bitness. It means using as much
546664-bitness as possible on the platform. This in turn means even more
5467binary incompatibilities. On the other hand, your platform may not
5468have any more 64-bitness available than what you already have chosen.
5469
5470If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5471(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5472EOM
5473rp='Try to use maximal 64-bit support, if available?'
5474. ./myread
5475case "$ans" in
5476[yY]*) val="$define" ;;
5477*) val="$undef" ;;
5478esac
5479set use64bitall
5480eval $setvar
5481case "$use64bitall" in
5482"$define")
5483 case "$use64bitint" in
5484 "$undef")
5485 cat <<EOM
5486
5487Since you have chosen a maximally 64-bit build, I'm also turning on
5488the use of 64-bit integers.
5489EOM
5490 use64bitint="$define" ;;
5491 esac
5492 ;;
5493esac
5494
b4eb6b3d
JH
5495: Look for a hint-file generated 'call-back-unit'. If the
5496: user has specified that a 64-bit perl is to be built,
5497: we may need to set or change some other defaults.
c53af328 5498if $test -f use64bitint.cbu; then
6bd2d01f 5499 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
c53af328
NC
5500 . ./use64bitint.cbu
5501fi
6bd2d01f
NC
5502case "$use64bitint" in
5503"$define"|true|[yY]*)
b4eb6b3d
JH
5504 case "$longsize" in
5505 4) case "$archname64" in
5506 '') archname64=64int ;;
5507 esac
5508 ;;
5509 esac
5510 ;;
5511esac
5512
b4eb6b3d
JH
5513: Look for a hint-file generated 'call-back-unit'. If the
5514: user has specified that a maximally 64-bit perl is to be built,
5515: we may need to set or change some other defaults.
c53af328 5516if $test -f use64bitall.cbu; then
6bd2d01f 5517 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
c53af328
NC
5518 . ./use64bitall.cbu
5519fi
6bd2d01f
NC
5520case "$use64bitall" in
5521"$define"|true|[yY]*)
b4eb6b3d
JH
5522 case "$longsize" in
5523 4) case "$archname64" in
5524 ''|64int) archname64=64all ;;
5525 esac
5526 ;;
5527 esac
5528 ;;
5529esac
5530
ff0950a8
JH
5531case "$d_quad:$use64bitint" in
5532$undef:$define)
5533 cat >&4 <<EOF
5534
5535*** You have chosen to use 64-bit integers,
c53af328 5536*** but none can be found.
ff0950a8
JH
5537*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5538*** Cannot continue, aborting.
5539
5540EOF
5541 exit 1
5542 ;;
5543esac
5544
5a29c6bc 5545: check for length of double
b4eb6b3d 5546echo " "
5a29c6bc
JH
5547case "$doublesize" in
5548'')
5549 echo "Checking to see how big your double precision numbers are..." >&4
5550 $cat >try.c <<EOCP
b4eb6b3d 5551#include <stdio.h>
5a29c6bc
JH
5552#$i_stdlib I_STDLIB
5553#ifdef I_STDLIB
5554#include <stdlib.h>
b4eb6b3d 5555#endif
5a29c6bc
JH
5556int main()
5557{
5558 printf("%d\n", (int)sizeof(double));
5559 exit(0);
b4eb6b3d 5560}
5f6e0ee4 5561EOCP
5a29c6bc
JH
5562 set try
5563 if eval $compile_ok; then
5564 doublesize=`$run ./try`
5565 echo "Your double is $doublesize bytes long."
5566 else
5567 dflt='8'
5568 echo "(I can't seem to compile the test program. Guessing...)"
5569 rp="What is the size of a double precision number (in bytes)?"
5570 . ./myread
5571 doublesize="$ans"
5572 fi
5573 ;;
5574esac
5575$rm -f try.c try
5576
5577: check for long doubles
5578echo " "
5579echo "Checking to see if you have long double..." >&4
5580echo 'int main() { long double x = 7.0; }' > try.c
5440bc8e 5581set try
5a29c6bc 5582if eval $compile; then
b4eb6b3d 5583 val="$define"
5a29c6bc 5584 echo "You have long double."
b4eb6b3d
JH
5585else
5586 val="$undef"
5a29c6bc 5587 echo "You do not have long double."
b4eb6b3d 5588fi
5a29c6bc
JH
5589$rm try.*
5590set d_longdbl
b4eb6b3d
JH
5591eval $setvar
5592
5a29c6bc
JH
5593: check for length of long double
5594case "${d_longdbl}${longdblsize}" in
5595$define)
5596 echo " "
5597 echo "Checking to see how big your long doubles are..." >&4
5598 $cat >try.c <<'EOCP'
5599#include <stdio.h>
5600int main()
5601{
5602 printf("%d\n", sizeof(long double));
5603}
5604EOCP
5605 set try
5606 set try
5607 if eval $compile; then
5608 longdblsize=`$run ./try`
5609 echo "Your long doubles are $longdblsize bytes long."
c1a7f87b 5610 else
5a29c6bc
JH
5611 dflt='8'
5612 echo " "
5613 echo "(I can't seem to compile the test program. Guessing...)" >&4
5614 rp="What is the size of a long double (in bytes)?"
5615 . ./myread
5616 longdblsize="$ans"
5617 fi
5618 if $test "X$doublesize" = "X$longdblsize"; then
5057be0e
JH
5619 echo "That isn't any different from an ordinary double."
5620 echo "I'll keep your setting anyway, but you may see some"
5621 echo "harmless compilation warnings."
5a29c6bc 5622 fi
c1a7f87b
JH
5623 ;;
5624esac
5a29c6bc 5625$rm -f try.* try
8e07c86e 5626
5a29c6bc 5627: determine the architecture name
c1a7f87b 5628echo " "
5a29c6bc
JH
5629if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5630 tarch=`arch`"-$osname"
5631elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5632 if uname -m > tmparch 2>&1 ; then
5633 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5634 -e 's/$/'"-$osname/" tmparch`
5635 else
5636 tarch="$osname"
5637 fi
5638 $rm -f tmparch
5639else
5640 tarch="$osname"
5641fi
5642case "$myarchname" in
5643''|"$tarch") ;;
5644*)
5645 echo "(Your architecture name used to be $myarchname.)"
5646 archname=''
ff935051
JH
5647 ;;
5648esac
5a29c6bc 5649case "$targetarch" in
c1a7f87b 5650'') ;;
5a29c6bc
JH
5651*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5652esac
5653myarchname="$tarch"
5654case "$archname" in
5655'') dflt="$tarch";;
5656*) dflt="$archname";;
5657esac
5658rp='What is your architecture name'
5659. ./myread
5660archname="$ans"
5661case "$usethreads" in
5662$define)
5663 echo "Threads selected." >&4
5664 case "$archname" in
5665 *-thread*) echo "...and architecture name already has -thread." >&4
5666 ;;
5667 *) archname="$archname-thread"
5668 echo "...setting architecture name to $archname." >&4
5669 ;;
5670 esac
5671 ;;
5672esac
5673case "$usemultiplicity" in
5674$define)
5675 echo "Multiplicity selected." >&4
5676 case "$archname" in
5677 *-multi*) echo "...and architecture name already has -multi." >&4
5678 ;;
5679 *) archname="$archname-multi"
5680 echo "...setting architecture name to $archname." >&4
5681 ;;
5682 esac
5683 ;;
5684esac
5685case "$use64bitint$use64bitall" in
5686*"$define"*)
5687 case "$archname64" in
5688 '')
5689 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
c1a7f87b 5690 ;;
5a29c6bc
JH
5691 *)
5692 case "$use64bitint" in
5693 "$define") echo "64 bit integers selected." >&4 ;;
5694 esac
5695 case "$use64bitall" in
5696 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5697 esac
5698 case "$archname" in
5699 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5700 ;;
5701 *) archname="$archname-$archname64"
5702 echo "...setting architecture name to $archname." >&4
5703 ;;
5704 esac
5705 ;;
5706 esac
5707esac
5708case "$uselongdouble" in
5709$define)
5710 echo "Long doubles selected." >&4
5711 case "$longdblsize" in
5712 $doublesize)
5713 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5714 ;;
5715 *)
5716 case "$archname" in
5717 *-ld*) echo "...and architecture name already has -ld." >&4
5718 ;;
5719 *) archname="$archname-ld"
5720 echo "...setting architecture name to $archname." >&4
5721 ;;
5722 esac
c1a7f87b 5723 ;;
34d1710f 5724 esac
4633a7c4
LW
5725 ;;
5726esac
5a29c6bc
JH
5727case "$useperlio" in
5728$define)
5729 echo "Perlio selected." >&4
c1a7f87b
JH
5730 ;;
5731*)
5a29c6bc
JH
5732 echo "Perlio not selected, using stdio." >&4
5733 case "$archname" in
5734 *-stdio*) echo "...and architecture name already has -stdio." >&4
5735 ;;
5736 *) archname="$archname-stdio"
5737 echo "...setting architecture name to $archname." >&4
5738 ;;
5739 esac
c1a7f87b 5740 ;;
a4f3eea9 5741esac
f3479639
JH
5742if $test -f archname.cbu; then
5743 echo "Your platform has some specific hints for architecture name, using them..."
5744 . ./archname.cbu
5745fi
5a29c6bc
JH
5746
5747: determine root of directory hierarchy where package will be installed.
5748case "$prefix" in
5749'')
5750 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5751 ;;
5752*?/)
5753 dflt=`echo "$prefix" | sed 's/.$//'`
5754 ;;
5755*)
5756 dflt="$prefix"
5757 ;;
5758esac
5759$cat <<EOM
5760
5761By default, $package will be installed in $dflt/bin, manual pages
5762under $dflt/man, etc..., i.e. with $dflt as prefix for all
5763installation directories. Typically this is something like /usr/local.
5764If you wish to have binaries under /usr/bin but other parts of the
5765installation under /usr/local, that's ok: you will be prompted
5766separately for each of the installation directories, the prefix being
5767only used to set the defaults.
5768
5769EOM
5770fn=d~
5771rp='Installation prefix to use?'
5772. ./getfile
5773oldprefix=''
5774case "$prefix" in
5775'') ;;
5776*)
5777 case "$ans" in
5778 "$prefix") ;;
5779 *) oldprefix="$prefix";;
5780 esac
5781 ;;
5782esac
5783prefix="$ans"
5784prefixexp="$ansexp"
5785
5786case "$afsroot" in
5787'') afsroot=/afs ;;
5788*) afsroot=$afsroot ;;
5789esac
5790
5791: is AFS running?
5792echo " "
5793case "$afs" in
5794$define|true) afs=true ;;
5795$undef|false) afs=false ;;
5796*) if test -d $afsroot; then
5797 afs=true
c1a7f87b 5798 else
5a29c6bc 5799 afs=false
c1a7f87b 5800 fi
5a29c6bc
JH
5801 ;;
5802esac
5803if $afs; then
5804 echo "AFS may be running... I'll be extra cautious then..." >&4
5805else
5806 echo "AFS does not seem to be running..." >&4
c1a7f87b 5807fi
a4f3eea9 5808
5a29c6bc
JH
5809: determine installation prefix for where package is to be installed.
5810if $afs; then
5811$cat <<EOM
bd9b35c9 5812
5a29c6bc
JH
5813Since you are running AFS, I need to distinguish the directory in which
5814files will reside from the directory in which they are installed (and from
5815which they are presumably copied to the former directory by occult means).
a4f3eea9 5816
c1a7f87b 5817EOM
5a29c6bc
JH
5818 case "$installprefix" in
5819 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5820 *) dflt="$installprefix";;
5821 esac
5822else
5823$cat <<EOM
29209bc5 5824
5a29c6bc
JH
5825In some special cases, particularly when building $package for distribution,
5826it is convenient to distinguish the directory in which files should be
5827installed from the directory ($prefix) in which they will
5828eventually reside. For most users, these two directories are the same.
b4eb6b3d
JH
5829
5830EOM
5831 case "$installprefix" in
5832 '') dflt=$prefix ;;
5833 *) dflt=$installprefix;;
5834 esac
5835fi
5836fn=d~
5837rp='What installation prefix should I use for installing files?'
5838. ./getfile
5839installprefix="$ans"
5840installprefixexp="$ansexp"
5841
5842: set the prefixit variable, to compute a suitable default value
5843prefixit='case "$3" in
5844""|none)
5845 case "$oldprefix" in
5846 "") eval "$1=\"\$$2\"";;
5847 *)
5848 case "$3" in
5849 "") eval "$1=";;
5850 none)
5851 eval "tp=\"\$$2\"";
5852 case "$tp" in
5853 ""|" ") eval "$1=\"\$$2\"";;
5854 *) eval "$1=";;
5855 esac;;
5856 esac;;
5857 esac;;
5858*)
5859 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5860 case "$tp" in
5861 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5862 /*-$oldprefix/*|\~*-$oldprefix/*)
5863 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5864 *) eval "$1=\"\$$2\"";;
5865 esac;;
5866esac'
5867
b4eb6b3d
JH
5868: get the patchlevel
5869echo " "
5870echo "Getting the current patchlevel..." >&4
5871if $test -r $rsrc/patchlevel.h;then
5872 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5873 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5874 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5875 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5876 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5877 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
151e6568 5878 perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
b4eb6b3d
JH
5879else
5880 revision=0
5881 patchlevel=0
5882 subversion=0
5883 api_revision=0
5884 api_version=0
5885 api_subversion=0
151e6568
MB
5886 perl_patchlevel=0
5887 $echo "(You do not have patchlevel.h. Eek.)"
b4eb6b3d 5888fi
151e6568
MB
5889if $test -r $rsrc/.patch ; then
5890 if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5891 perl_patchlevel=`cat $rsrc/.patch`
5892 fi
5893fi
861eb78d
AD
5894: Define a handy string here to avoid duplication in myconfig.SH and configpm.
5895version_patchlevel_string="version $patchlevel subversion $subversion"
151e6568 5896case "$perl_patchlevel" in
861eb78d
AD
58970|'') ;;
5898*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
151e6568 5899esac
861eb78d
AD
5900
5901$echo "(You have $package $version_patchlevel_string.)"
5902
b4eb6b3d
JH
5903case "$osname" in
5904dos|vms)
5905 : XXX Should be a Configure test for double-dots in filenames.
5906 version=`echo $revision $patchlevel $subversion | \
5907 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5908 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5909 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5910 ;;
5911*)
5912 version=`echo $revision $patchlevel $subversion | \
5913 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5914 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5915 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5916 ;;
5917esac
5918: Special case the 5.005_xx maintenance series, which used 5.005
5919: without any subversion label as a subdirectory in $sitelib
5920if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5921 api_versionstring='5.005'
5922fi
5923
5924: determine installation style
5925: For now, try to deduce it from prefix unless it is already set.
5926: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5927case "$installstyle" in
5928'') case "$prefix" in
5929 *perl*) dflt='lib';;
5930 *) dflt='lib/perl5' ;;
5931 esac
5932 ;;
5933*) dflt="$installstyle" ;;
5934esac
5935: Probably not worth prompting for this since we prompt for all
5936: the directories individually, and the prompt would be too long and
5937: confusing anyway.
5938installstyle=$dflt
5939
5940: determine where private library files go
5941: Usual default is /usr/local/lib/perl5/$version.
5942: Also allow things like /opt/perl/lib/$version, since
5943: /opt/perl/lib/perl5... would be redundant.
5944: The default "style" setting is made in installstyle.U
5945case "$installstyle" in
5946*lib/perl5*) set dflt privlib lib/$package/$version ;;
5947*) set dflt privlib lib/$version ;;
5948esac
5949eval $prefixit
5950$cat <<EOM
5951
5952There are some auxiliary files for $package that need to be put into a
5953private library directory that is accessible by everyone.
5954
5955EOM
5956fn=d~+
5957rp='Pathname where the private library files will reside?'
5958. ./getfile
5959privlib="$ans"
5960privlibexp="$ansexp"
5961: Change installation prefix, if necessary.
5962if $test X"$prefix" != X"$installprefix"; then
5963 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5964else
5965 installprivlib="$privlibexp"
5966fi
5967
5968: set the prefixup variable, to restore leading tilda escape
5969prefixup='case "$prefixexp" in
5970"$prefix") ;;
5971*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5972esac'
5973
5974: determine where public architecture dependent libraries go
5975set archlib archlib
5976eval $prefixit
5977: privlib default is /usr/local/lib/$package/$version
5978: archlib default is /usr/local/lib/$package/$version/$archname
5979: privlib may have an optional trailing /share.
5980tdflt=`echo $privlib | $sed 's,/share$,,'`
5981tdflt=$tdflt/$archname
5982case "$archlib" in
5983'') dflt=$tdflt
5984 ;;
5985*) dflt="$archlib"
5986 ;;
5987esac
5988$cat <<EOM
5989
5990$spackage contains architecture-dependent library files. If you are
5991sharing libraries in a heterogeneous environment, you might store
5992these files in a separate location. Otherwise, you can just include
5993them with the rest of the public library files.
5994
5995EOM
5996fn=d+~
5997rp='Where do you want to put the public architecture-dependent libraries?'
5998. ./getfile
5999archlib="$ans"
6000archlibexp="$ansexp"
6001if $test X"$archlib" = X"$privlib"; then
6002 d_archlib="$undef"
6003else
6004 d_archlib="$define"
6005fi
6006: Change installation prefix, if necessary.
6007if $test X"$prefix" != X"$installprefix"; then
6008 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6009else
6010 installarchlib="$archlibexp"
6011fi
6012
b4eb6b3d
JH
6013: see if setuid scripts can be secure
6014$cat <<EOM
6015
6016Some kernels have a bug that prevents setuid #! scripts from being
6017secure. Some sites have disabled setuid #! scripts because of this.
6018
6019First let's decide if your kernel supports secure setuid #! scripts.
6020(If setuid #! scripts would be secure but have been disabled anyway,
6021don't say that they are secure if asked.)
6022
6023EOM
6024
6025val="$undef"
6026if $test -d /dev/fd; then
6027 echo "#!$ls" >reflect
6028 chmod +x,u+s reflect
6029 ./reflect >flect 2>&1
6030 if $contains "/dev/fd" flect >/dev/null; then
6031 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6032 val="$define"
6033 else
6034 $cat <<EOM
6035If you are not sure if they are secure, I can check but I'll need a
6036username and password different from the one you are using right now.
6037If you don't have such a username or don't want me to test, simply
6038enter 'none'.
6039
6040EOM
6041 rp='Other username to test security of setuid scripts with?'
6042 dflt='none'
6043 . ./myread
6044 case "$ans" in
6045 n|none)
6046 case "$d_suidsafe" in
6047 '') echo "I'll assume setuid scripts are *not* secure." >&4
6048 dflt=n;;
6049 "$undef")
6050 echo "Well, the $hint value is *not* secure." >&4
6051 dflt=n;;
6052 *) echo "Well, the $hint value *is* secure." >&4
6053 dflt=y;;
6054 esac
c1a7f87b 6055 ;;
b4eb6b3d
JH
6056 *)
6057 $rm -f reflect flect
6058 echo "#!$ls" >reflect
6059 chmod +x,u+s reflect
6060 echo >flect
6061 chmod a+w flect
6062 echo '"su" will (probably) prompt you for '"$ans's password."
6063 su $ans -c './reflect >flect'
6064 if $contains "/dev/fd" flect >/dev/null; then
6065 echo "Okay, it looks like setuid scripts are secure." >&4
6066 dflt=y
6067 else
6068 echo "I don't think setuid scripts are secure." >&4
6069 dflt=n
6070 fi
6071 ;;
6072 esac
6073 rp='Does your kernel have *secure* setuid scripts?'
6074 . ./myread
6075 case "$ans" in
6076 [yY]*) val="$define";;
6077 *) val="$undef";;
6078 esac
6079 fi
6080else
6081 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6082 echo "(That's for file descriptors, not floppy disks.)"
6083 val="$undef"
6084fi
6085set d_suidsafe
6086eval $setvar
6087
6088$rm -f reflect flect
6089
6090: now see if they want to do setuid emulation
6091echo " "
6092val="$undef"
6093case "$d_suidsafe" in
6094"$define")
6095 val="$undef"
3c728e00 6096 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d
JH
6097 ;;
6098*)
6099 $cat <<EOM
6100Some systems have disabled setuid scripts, especially systems where
6101setuid scripts cannot be secure. On systems where setuid scripts have
6102been disabled, the setuid/setgid bits on scripts are currently
6103useless. It is possible for $package to detect those bits and emulate
6104setuid/setgid in a secure fashion. This emulation will only work if
6105setuid scripts have been disabled in your kernel.
6106
6107EOM
6108 case "$d_dosuid" in
6109 "$define") dflt=y ;;
6110 *) dflt=n ;;
6111 esac
6112 rp="Do you want to do setuid/setgid emulation?"
6113 . ./myread
6114 case "$ans" in
6115 [yY]*) val="$define";;
6116 *) val="$undef";;
6117 esac
6118 ;;
6119esac
6120set d_dosuid
6121eval $setvar
6122
b4eb6b3d 6123: see if this is a malloc.h system
e290198f
JH
6124: we want a real compile instead of Inhdr because some systems have a
6125: malloc.h that just gives a compile error saying to use stdlib.h instead
6126echo " "
6127$cat >try.c <<EOCP
6128#include <stdlib.h>
6129#include <malloc.h>
6130int main () { return 0; }
6131EOCP
6132set try
6133if eval $compile; then
6134 echo "<malloc.h> found." >&4
6135 val="$define"
6136else
6137 echo "<malloc.h> NOT found." >&4
6138 val="$undef"
6139fi
6140$rm -f try.c try
6141set i_malloc
6142eval $setvar
b4eb6b3d 6143
c8b93cf9
JH
6144: check for void type
6145echo " "
6146echo "Checking to see how well your C compiler groks the void type..." >&4
6147case "$voidflags" in
6148'')
511118e1 6149 $cat >try.c <<EOCP
5ed858ef
JH
6150#$i_stdlib I_STDLIB
6151#ifdef I_STDLIB
6152#include <stdlib.h>
6153#endif
c8b93cf9
JH
6154#if TRY & 1
6155void sub() {
6156#else
6157sub() {
6158#endif
6159 extern void moo(); /* function returning void */
6160 void (*goo)(); /* ptr to func returning void */
6161#if TRY & 8
6162 void *hue; /* generic ptr */
6163#endif
6164#if TRY & 2
6165 void (*foo[10])();
6166#endif
6167
6168#if TRY & 4
6169 if(goo == moo) {
6170 exit(0);
6171 }
6172#endif
6173 exit(0);
6174}
6175int main() { sub(); }
6176EOCP
6177 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6178 voidflags=$defvoidused
6179 echo "Good. It appears to support void to the level $package wants.">&4
6180 if $contains warning .out >/dev/null 2>&1; then
6181 echo "However, you might get some warnings that look like this:"
6182 $cat .out
6183 fi
6184 else
6185echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6186 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6187 echo "It supports 1..."
6188 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6189 echo "It also supports 2..."
6190 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6191 voidflags=7
6192 echo "And it supports 4 but not 8 definitely."
6193 else
6194 echo "It doesn't support 4..."
6195 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6196 voidflags=11
6197 echo "But it supports 8."
6198 else
6199 voidflags=3
6200 echo "Neither does it support 8."
6201 fi
6202 fi
6203 else
6204 echo "It does not support 2..."
6205 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6206 voidflags=13
6207 echo "But it supports 4 and 8."
6208 else
6209 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6210 voidflags=5
6211 echo "And it supports 4 but has not heard about 8."
6212 else
6213 echo "However it supports 8 but not 4."
6214 fi
6215 fi
6216 fi
6217 else
6218 echo "There is no support at all for void."
6219 voidflags=0
6220 fi
6221 fi
6222esac
6223case "$voidflags" in
6224"$defvoidused") ;;
6225*) $cat >&4 <<'EOM'
6226 Support flag bits are:
6227 1: basic void declarations.
6228 2: arrays of pointers to functions returning void.
6229 4: operations between pointers to and addresses of void functions.
6230 8: generic void pointers.
6231EOM
6232 dflt="$voidflags";
6233 rp="Your void support flags add up to what?"
6234 . ./myread
6235 voidflags="$ans"
6236 ;;
6237esac
6238$rm -f try.* .out
6239
6240: check for length of pointer
6241echo " "
6242case "$ptrsize" in
6243'')
6244 echo "Checking to see how big your pointers are..." >&4
6245 if test "$voidflags" -gt 7; then
6246 echo '#define VOID_PTR char *' > try.c
6247 else
6248 echo '#define VOID_PTR void *' > try.c
6249 fi
ada8e391 6250 $cat >>try.c <<EOCP
c8b93cf9 6251#include <stdio.h>
5ed858ef
JH
6252#$i_stdlib I_STDLIB
6253#ifdef I_STDLIB
6254#include <stdlib.h>
6255#endif
c8b93cf9
JH
6256int main()
6257{
6258 printf("%d\n", (int)sizeof(VOID_PTR));
6259 exit(0);
6260}
6261EOCP
6262 set try
6263 if eval $compile_ok; then
6264 ptrsize=`$run ./try`
6265 echo "Your pointers are $ptrsize bytes long."
6266 else
6267 dflt='4'
6268 echo "(I can't seem to compile the test program. Guessing...)" >&4
6269 rp="What is the size of a pointer (in bytes)?"
6270 . ./myread
6271 ptrsize="$ans"
6272 fi
6273 ;;
6274esac
6275$rm -f try.c try
6276case "$use64bitall" in
6277"$define"|true|[yY]*)
6278 case "$ptrsize" in
6279 4) cat <<EOM >&4
6280
ff0950a8
JH
6281*** You have chosen a maximally 64-bit build,
6282*** but your pointers are only 4 bytes wide.
6283*** Please rerun Configure without -Duse64bitall.
c8b93cf9 6284EOM
ff0950a8
JH
6285 case "$d_quad" in
6286 define)
6287 cat <<EOM >&4
6288*** Since you have quads, you could possibly try with -Duse64bitint.
c8b93cf9 6289EOM
c8b93cf9
JH
6290 ;;
6291 esac
ff0950a8
JH
6292 cat <<EOM >&4
6293*** Cannot continue, aborting.
6294
6295EOM
6296
6297 exit 1
c8b93cf9
JH
6298 ;;
6299 esac
6300 ;;
6301esac
6302
c53af328 6303
1c6118a4
JH
6304: determine whether to use malloc wrapping
6305echo " "
6306case "$usemallocwrap" in
6307[yY]*|true|$define) dflt='y' ;;
6308[nN]*|false|$undef) dflt='n' ;;
6309*) case "$usedevel" in
6310 [yY]*|true|$define) dflt='y' ;;
6311 *) dflt='n' ;;
6312 esac
6313 ;;
6314esac
6315rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6316. ./myread
6317usemallocwrap="$ans"
6318case "$ans" in
6319y*|true)
6320 usemallocwrap="$define" ;;
6321*)
6322 usemallocwrap="$undef" ;;
6323esac
c8b93cf9 6324
b4eb6b3d
JH
6325: determine which malloc to compile in
6326echo " "
6327case "$usemymalloc" in
c4163172
JH
6328[yY]*|true|$define) dflt='y' ;;
6329[nN]*|false|$undef) dflt='n' ;;
6330*) case "$ptrsize" in
6331 4) dflt='y' ;;
6332 *) dflt='n' ;;
6333 esac
6334 ;;
8dfa8df9 6335esac
b4eb6b3d
JH
6336rp="Do you wish to attempt to use the malloc that comes with $package?"
6337. ./myread
6338usemymalloc="$ans"
6339case "$ans" in
6340y*|true)
6341 usemymalloc='y'
6342 mallocsrc='malloc.c'
6343 mallocobj="malloc$_o"
6344 d_mymalloc="$define"
6345 case "$libs" in
6346 *-lmalloc*)
6347 : Remove malloc from list of libraries to use
6348 echo "Removing unneeded -lmalloc from library list" >&4
6349 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6350 shift
6351 libs="$*"
6352 echo "libs = $libs" >&4
6353 ;;
6354 esac
6355 ;;
6356*)
6357 usemymalloc='n'
6358 mallocsrc=''
6359 mallocobj=''
6360 d_mymalloc="$undef"
6361 ;;
6362esac
6363
6364: compute the return types of malloc and free
6365echo " "
6366$cat >malloc.c <<END
6367#$i_malloc I_MALLOC
6368#$i_stdlib I_STDLIB
6369#include <stdio.h>
6370#include <sys/types.h>
6371#ifdef I_MALLOC
6372#include <malloc.h>
6373#endif
6374#ifdef I_STDLIB
6375#include <stdlib.h>
6376#endif
6377#ifdef TRY_MALLOC
6378void *malloc();
6379#endif
6380#ifdef TRY_FREE
6381void free();
6382#endif
6383END
6384case "$malloctype" in
6385'')
6386 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6387 malloctype='void *'
6388 else
6389 malloctype='char *'
6390 fi
6391 ;;
6392esac
6393echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6394
6395case "$freetype" in
6396'')
6397 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6398 freetype='void'
6399 else
6400 freetype='int'
6401 fi
6402 ;;
6403esac
6404echo "Your system uses $freetype free(), it would seem." >&4
6405$rm -f malloc.[co]
6406$cat <<EOM
6407
6408After $package is installed, you may wish to install various
6409add-on modules and utilities. Typically, these add-ons will
6410be installed under $prefix with the rest
6411of this package. However, you may wish to install such add-ons
6412elsewhere under a different prefix.
6413
6414If you do not wish to put everything under a single prefix, that's
6415ok. You will be prompted for the individual locations; this siteprefix
6416is only used to suggest the defaults.
6417
6418The default should be fine for most people.
6419
6420EOM
6421fn=d~+
6422rp='Installation prefix to use for add-on modules and utilities?'
6423: XXX Here might be another good place for an installstyle setting.
6424case "$siteprefix" in
6425'') dflt=$prefix ;;
6426*) dflt=$siteprefix ;;
6427esac
6428. ./getfile
6429: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6430oldsiteprefix=''
6431case "$siteprefix" in
6432'') ;;
6433*) case "$ans" in
6434 "$prefix") ;;
6435 *) oldsiteprefix="$prefix";;
6436 esac
6437 ;;
6438esac
6439siteprefix="$ans"
6440siteprefixexp="$ansexp"
6441
6442: determine where site specific libraries go.
6443: Usual default is /usr/local/lib/perl5/site_perl/$version
6444: The default "style" setting is made in installstyle.U
6445: XXX No longer works with Prefixit stuff.
6446prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6447case "$sitelib" in
6448'') case "$installstyle" in
6449 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6450 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6451 esac
6452 ;;
6453*) dflt="$sitelib"
6454 ;;
6455esac
6456$cat <<EOM
6457
6458The installation process will create a directory for
6459site-specific extensions and modules. Most users find it convenient
6460to place all site-specific files in this directory rather than in the
6461main distribution directory.
6462
6463EOM
6464fn=d~+
6465rp='Pathname for the site-specific library files?'
6466. ./getfile
6467sitelib="$ans"
6468sitelibexp="$ansexp"
6469sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6470: Change installation prefix, if necessary.
6471if $test X"$prefix" != X"$installprefix"; then
6472 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6473else
6474 installsitelib="$sitelibexp"
6475fi
6476
6477: determine where site specific architecture-dependent libraries go.
6478: sitelib default is /usr/local/lib/perl5/site_perl/$version
6479: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6480: sitelib may have an optional trailing /share.
6481case "$sitearch" in
6482'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6483 dflt="$dflt/$archname"
6484 ;;
6485*) dflt="$sitearch"
6486 ;;
6487esac
6488set sitearch sitearch none
6489eval $prefixit
6490$cat <<EOM
6491
6492The installation process will also create a directory for
6493architecture-dependent site-specific extensions and modules.
6494
6495EOM
6496fn=d~+
6497rp='Pathname for the site-specific architecture-dependent library files?'
6498. ./getfile
6499sitearch="$ans"
6500sitearchexp="$ansexp"
6501: Change installation prefix, if necessary.
6502if $test X"$prefix" != X"$installprefix"; then
6503 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6504else
6505 installsitearch="$sitearchexp"
6506fi
6507
6508$cat <<EOM
6509
6510The installation process will also create a directory for
6511vendor-supplied add-ons. Vendors who supply perl with their system
6512may find it convenient to place all vendor-supplied files in this
6513directory rather than in the main distribution directory. This will
6514ease upgrades between binary-compatible maintenance versions of perl.
6515
6516Of course you may also use these directories in whatever way you see
6517fit. For example, you might use them to access modules shared over a
6518company-wide network.
6519
6520The default answer should be fine for most people.
6521This causes further questions about vendor add-ons to be skipped
6522and no vendor-specific directories will be configured for perl.
6523
6524EOM
6525rp='Do you want to configure vendor-specific add-on directories?'
6526case "$usevendorprefix" in
6527define|true|[yY]*) dflt=y ;;
6528*) : User may have set vendorprefix directly on Configure command line.
6529 case "$vendorprefix" in
6530 ''|' ') dflt=n ;;
6531 *) dflt=y ;;
6532 esac
6533 ;;
6534esac
6535. ./myread
6536case "$ans" in
6537[yY]*) fn=d~+
6538 rp='Installation prefix to use for vendor-supplied add-ons?'
6539 case "$vendorprefix" in
6540 '') dflt='' ;;
6541 *) dflt=$vendorprefix ;;
6542 esac
6543 . ./getfile
6544 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6545 oldvendorprefix=''
6546 case "$vendorprefix" in
6547 '') ;;
6548 *) case "$ans" in
6549 "$prefix") ;;
6550 *) oldvendorprefix="$prefix";;
6551 esac
6552 ;;
6553 esac
6554 usevendorprefix="$define"
6555 vendorprefix="$ans"
6556 vendorprefixexp="$ansexp"
6557 ;;
6558*) usevendorprefix="$undef"
6559 vendorprefix=''
6560 vendorprefixexp=''
6561 ;;
6562esac
6563
6564case "$vendorprefix" in
6565'') d_vendorlib="$undef"
6566 vendorlib=''
6567 vendorlibexp=''
6568 ;;
6569*) d_vendorlib="$define"
6570 : determine where vendor-supplied modules go.
6571 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6572 case "$vendorlib" in
6573 '')
6574 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6575 case "$installstyle" in
6576 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6577 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6578 esac
6579 ;;
6580 *) dflt="$vendorlib"
6581 ;;
6582 esac
6583 fn=d~+
6584 rp='Pathname for the vendor-supplied library files?'
6585 . ./getfile
6586 vendorlib="$ans"
6587 vendorlibexp="$ansexp"
6588 ;;
6589esac
6590vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6591: Change installation prefix, if necessary.
6592if $test X"$prefix" != X"$installprefix"; then
6593 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6594else
6595 installvendorlib="$vendorlibexp"
6596fi
6597
6598case "$vendorprefix" in
6599'') d_vendorarch="$undef"
6600 vendorarch=''
6601 vendorarchexp=''
6602 ;;
6603*) d_vendorarch="$define"
6604 : determine where vendor-supplied architecture-dependent libraries go.
6605 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6606 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6607 : vendorlib may have an optional trailing /share.
6608 case "$vendorarch" in
6609 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6610 dflt="$dflt/$archname"
6611 ;;
6612 *) dflt="$vendorarch" ;;
6613 esac
6614 fn=d~+
6615 rp='Pathname for vendor-supplied architecture-dependent files?'
6616 . ./getfile
6617 vendorarch="$ans"
6618 vendorarchexp="$ansexp"
6619 ;;
6620esac
6621: Change installation prefix, if necessary.
6622if $test X"$prefix" != X"$installprefix"; then
5a29c6bc
JH
6623 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6624else
6625 installvendorarch="$vendorarchexp"
6626fi
6627
6628: Final catch-all directories to search
6629$cat <<EOM
6630
6631Lastly, you can have perl look in other directories for extensions and
6632modules in addition to those already specified.
6633These directories will be searched after
6634 $sitearch
6635 $sitelib
6636EOM
6637test X"$vendorlib" != "X" && echo ' ' $vendorlib
6638test X"$vendorarch" != "X" && echo ' ' $vendorarch
6639echo ' '
6640case "$otherlibdirs" in
6641''|' ') dflt='none' ;;
6642*) dflt="$otherlibdirs" ;;
6643esac
6644$cat <<EOM
6645Enter a colon-separated set of extra paths to include in perl's @INC
6646search path, or enter 'none' for no extra paths.
6647
6648EOM
6649
6650rp='Colon-separated list of additional directories for perl to search?'
6651. ./myread
6652case "$ans" in
6653' '|''|none) otherlibdirs=' ' ;;
6654*) otherlibdirs="$ans" ;;
6655esac
6656case "$otherlibdirs" in
6657' ') val=$undef ;;
6658*) val=$define ;;
6659esac
6660set d_perl_otherlibdirs
6661eval $setvar
6662
6663: Cruising for prototypes
6664echo " "
6665echo "Checking out function prototypes..." >&4
6666$cat >prototype.c <<EOCP
6667#$i_stdlib I_STDLIB
6668#ifdef I_STDLIB
6669#include <stdlib.h>
6670#endif
6671int main(int argc, char *argv[]) {
6672 exit(0);}
6673EOCP
6674if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6675 echo "Your C compiler appears to support function prototypes."
6676 val="$define"
6677else
6678 echo "Your C compiler doesn't seem to understand function prototypes."
6679 val="$undef"
6680fi
6681set prototype
6682eval $setvar
6683$rm -f prototype*
6684
6685case "$prototype" in
6686"$define") ;;
6687*) ansi2knr='ansi2knr'
6688 echo " "
6689 cat <<EOM >&4
6690
6691$me: FATAL ERROR:
6692This version of $package can only be compiled by a compiler that
6693understands function prototypes. Unfortunately, your C compiler
6694 $cc $ccflags
6695doesn't seem to understand them. Sorry about that.
6696
6697If GNU cc is available for your system, perhaps you could try that instead.
6698
6699Eventually, we hope to support building Perl with pre-ANSI compilers.
6700If you would like to help in that effort, please contact <perlbug@perl.org>.
6701
6702Aborting Configure now.
6703EOM
6704 exit 2
6705 ;;
6706esac
6707
6708: determine where public executables go
6709echo " "
6710set dflt bin bin
6711eval $prefixit
6712fn=d~
6713rp='Pathname where the public executables will reside?'
6714. ./getfile
6715if $test "X$ansexp" != "X$binexp"; then
6716 installbin=''
6717fi
6718bin="$ans"
6719binexp="$ansexp"
6720: Change installation prefix, if necessary.
6721: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6722if $test X"$prefix" != X"$installprefix"; then
6723 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6724else
6725 installbin="$binexp"
6726fi
6727
6728echo " "
6729case "$extras" in
6730'') dflt='n';;
6731*) dflt='y';;
6732esac
6733cat <<EOM
6734Perl can be built with extra modules or bundles of modules which
6735will be fetched from the CPAN and installed alongside Perl.
6736
6737Notice that you will need access to the CPAN; either via the Internet,
6738or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
6739be asked later to configure the CPAN.pm module which will in turn do
6740the installation of the rest of the extra modules or bundles.)
6741
6742Notice also that if the modules require any external software such as
6743libraries and headers (the libz library and the zlib.h header for the
6744Compress::Zlib module, for example) you MUST have any such software
6745already installed, this configuration process will NOT install such
6746things for you.
6747
6748If this doesn't make any sense to you, just accept the default '$dflt'.
6749EOM
6750rp='Install any extra modules (y or n)?'
6751. ./myread
6752case "$ans" in
6753y|Y)
6754 cat <<EOM
6755
6756Please list any extra modules or bundles to be installed from CPAN,
6757with spaces between the names. The names can be in any format the
6758'install' command of CPAN.pm will understand. (Answer 'none',
6759without the quotes, to install no extra modules or bundles.)
6760EOM
6761 rp='Extras?'
6762 dflt="$extras"
6763 . ./myread
6764 extras="$ans"
6765esac
6766case "$extras" in
6767''|'none')
6768 val=''
6769 $rm -f ../extras.lst
6770 ;;
6771*) echo "(Saving the list of extras for later...)"
6772 echo "$extras" > ../extras.lst
6773 val="'$extras'"
6774 ;;
6775esac
6776set extras
6777eval $setvar
6778echo " "
6779
6780: determine where html pages for programs go
6781set html1dir html1dir none
6782eval $prefixit
6783$cat <<EOM
6784
6785If you wish to install html files for programs in $spackage, indicate
6786the appropriate directory here. To skip installing html files,
6787answer "none".
6788EOM
6789case "$html1dir" in
6790''|none|$undef|' ') dflt=none ;;
6791*) dflt=$html1dir ;;
6792esac
6793fn=dn+~
6794rp="Directory for the main $spackage html pages?"
6795. ./getfile
6796html1dir="$ans"
6797html1direxp="$ansexp"
6798: Use ' ' for none so value is preserved next time through Configure
6799$test X"$html1dir" = "X" && html1dir=' '
6800: Change installation prefix, if necessary.
6801if $test X"$prefix" != X"$installprefix"; then
6802 installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
6803else
6804 installhtml1dir="$html1direxp"
6805fi
6806
6807: determine where html pages for libraries and modules go
6808set html3dir html3dir none
6809eval $prefixit
6810$cat <<EOM
6811
6812If you wish to install html files for modules associated with $spackage,
6813indicate the appropriate directory here. To skip installing html files,
6814answer "none".
6815EOM
6816: There is no obvious default. If they have specified html1dir, then
6817: try to key off that, possibly changing .../html1 into .../html3.
6818case "$html3dir" in
6819'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6820*) dflt=$html3dir ;;
6821esac
6822fn=dn+~
6823rp="Directory for the $spackage module html pages?"
6824. ./getfile
6825html3dir="$ans"
6826html3direxp="$ansexp"
6827: Use ' ' for none so value is preserved next time through Configure
6828$test X"$html3dir" = "X" && html3dir=' '
6829: Change installation prefix, if necessary.
6830if $test X"$prefix" != X"$installprefix"; then
6831 installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
b4eb6b3d 6832else
5a29c6bc 6833 installhtml3dir="$html3direxp"
b4eb6b3d
JH
6834fi
6835
5a29c6bc
JH
6836: Find perl5.005 or later.
6837echo "Looking for a previously installed perl5.005 or later... "
6838case "$perl5" in
6839'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6840 : Check if this perl is recent and can load a simple module
6841 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6842 perl5=$tdir/perl
6843 break;
6844 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6845 perl5=$tdir/perl5
6846 break;
6847 fi
6848 done
6849 ;;
6850*) perl5="$perl5"
6851 ;;
6852esac
6853case "$perl5" in
6854'') echo "None found. That's ok.";;
6855*) echo "Using $perl5." ;;
6856esac
b4eb6b3d 6857
5a29c6bc
JH
6858: Determine list of previous versions to include in @INC
6859$cat > getverlist <<EOPL
6860#!$perl5 -w
6861use File::Basename;
6862\$api_versionstring = "$api_versionstring";
6863\$version = "$version";
6864\$stem = "$sitelib_stem";
6865\$archname = "$archname";
6866EOPL
6867 $cat >> getverlist <<'EOPL'
6868# Can't have leading @ because metaconfig interprets it as a command!
6869;@inc_version_list=();
6870# XXX Redo to do opendir/readdir?
6871if (-d $stem) {
6872 chdir($stem);
6873 ;@candidates = glob("5.*");
6874}
6875else {
6876 ;@candidates = ();
6877}
6878
6879# XXX ToDo: These comparisons must be reworked when two-digit
6880# subversions come along, so that 5.7.10 compares as greater than
6881# 5.7.3! By that time, hope that 5.6.x is sufficiently
6882# widespread that we can use the built-in version vectors rather
6883# than reinventing them here. For 5.6.0, however, we must
6884# assume this script will likely be run by 5.005_0x. --AD 1/2000.
6885foreach $d (@candidates) {
6886 if ($d lt $version) {
6887 if ($d ge $api_versionstring) {
6888 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6889 }
6890 elsif ($d ge "5.005") {
6891 unshift(@inc_version_list, grep { -d } $d);
6892 }
6893 }
6894 else {
6895 # Skip newer version. I.e. don't look in
6896 # 5.7.0 if we're installing 5.6.1.
6897 }
6898}
6899
6900if (@inc_version_list) {
6901 print join(' ', @inc_version_list);
6902}
6903else {
6904 # Blank space to preserve value for next Configure run.
6905 print " ";
6906}
6907EOPL
6908chmod +x getverlist
6909case "$inc_version_list" in
6910'') if test -x "$perl5$exe_ext"; then
6911 dflt=`$perl5 getverlist`
6912 else
6913 dflt='none'
6914 fi
6915 ;;
6916$undef) dflt='none' ;;
6917*) eval dflt=\"$inc_version_list\" ;;
6918esac
6919case "$dflt" in
6920''|' ') dflt=none ;;
6921esac
6922case "$dflt" in
69235.005) dflt=none ;;
b4eb6b3d
JH
6924esac
6925$cat <<EOM
b4eb6b3d 6926
5a29c6bc
JH
6927In order to ease the process of upgrading, this version of perl
6928can be configured to use modules built and installed with earlier
6929versions of perl that were installed under $prefix. Specify here
6930the list of earlier versions that this version of perl should check.
6931If Configure detected no earlier versions of perl installed under
6932$prefix, then the list will be empty. Answer 'none' to tell perl
6933to not search earlier versions.
6934
6935The default should almost always be sensible, so if you're not sure,
6936just accept the default.
b4eb6b3d
JH
6937EOM
6938
5a29c6bc 6939rp='List of earlier versions to include in @INC?'
b4eb6b3d
JH
6940. ./myread
6941case "$ans" in
3d46c0ef 6942[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
5a29c6bc 6943*) inc_version_list="$ans" ;;
b4eb6b3d 6944esac
5a29c6bc
JH
6945case "$inc_version_list" in
6946''|' ')
6947 inc_version_list_init='0';;
6948*) inc_version_list_init=`echo $inc_version_list |
6949 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6950 ;;
b4eb6b3d 6951esac
5a29c6bc
JH
6952$rm -f getverlist
6953
6954: determine whether to install perl also as /usr/bin/perl
b4eb6b3d 6955
b4eb6b3d 6956echo " "
5a29c6bc
JH
6957if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6958 $cat <<EOM
6959Many scripts expect perl to be installed as /usr/bin/perl.
b4eb6b3d 6960
5a29c6bc
JH
6961If you want to, I can install the perl you are about to compile
6962as /usr/bin/perl (in addition to $bin/perl).
6963EOM
6964 if test -f /usr/bin/perl; then
6965 $cat <<EOM
b4eb6b3d 6966
5a29c6bc
JH
6967However, please note that because you already have a /usr/bin/perl,
6968overwriting that with a new Perl would very probably cause problems.
6969Therefore I'm assuming you don't want to do that (unless you insist).
b4eb6b3d 6970
5a29c6bc
JH
6971EOM
6972 case "$installusrbinperl" in
6973 "$define"|[yY]*) dflt='y';;
6974 *) dflt='n';;
6975 esac
6976 else
6977 $cat <<EOM
b4eb6b3d 6978
5a29c6bc 6979Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
b4eb6b3d 6980
b4eb6b3d 6981EOM
5a29c6bc
JH
6982 case "$installusrbinperl" in
6983 "$undef"|[nN]*) dflt='n';;
6984 *) dflt='y';;
6985 esac
6986 fi
6987 rp="Do you want to install perl as /usr/bin/perl?"
6988 . ./myread
6989 case "$ans" in
6990 [yY]*) val="$define";;
6991 *) val="$undef" ;;
6992 esac
6993else
6994 val="$undef"
6995fi
6996set installusrbinperl
6997eval $setvar
b4eb6b3d 6998
b4eb6b3d 6999echo " "
5a29c6bc
JH
7000echo "Checking for GNU C Library..." >&4
7001cat >try.c <<'EOCP'
7002/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7003 alone are insufficient to distinguish different versions, such as
7004 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7005 libc version 2.1.0. A. Dougherty, June 3, 2002.
7006*/
7007#include <stdio.h>
7008int main(void)
7009{
7010#ifdef __GLIBC__
7011# ifdef __GLIBC_MINOR__
7012# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7013# include <gnu/libc-version.h>
7014 printf("%s\n", gnu_get_libc_version());
7015# else
7016 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7017# endif
7018# else
7019 printf("%d\n", __GLIBC__);
7020# endif
7021 return 0;
7022#else
7023 return 1;
7024#endif
7025}
7026EOCP
7027set try
7028if eval $compile_ok && $run ./try > glibc.ver; then
7029 val="$define"
7030 gnulibc_version=`$cat glibc.ver`
7031 echo "You are using the GNU C Library version $gnulibc_version"
b4eb6b3d 7032else
5a29c6bc
JH
7033 val="$undef"
7034 gnulibc_version=''
7035 echo "You are not using the GNU C Library"
b4eb6b3d 7036fi
5a29c6bc
JH
7037$rm -f try try.* glibc.ver
7038set d_gnulibc
7039eval $setvar
b4eb6b3d 7040
5a29c6bc
JH
7041: see if nm is to be used to determine whether a symbol is defined or not
7042case "$usenm" in
7043'')
7044 dflt=''
7045 case "$d_gnulibc" in
7046 "$define")
7047 echo " "
7048 echo "nm probably won't work on the GNU C Library." >&4
7049 dflt=n
7050 ;;
7051 esac
7052 case "$dflt" in
7053 '')
7054 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7055 echo " "
7056 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7057 echo "'nm' won't be sufficient on this sytem." >&4
7058 dflt=n
7059 fi
7060 ;;
7061 esac
7062 case "$dflt" in
7063 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7064 if $test $dflt -gt 20; then
7065 dflt=y
7066 else
7067 dflt=n
7068 fi
7069 ;;
7070 esac
7071 ;;
7072*)
7073 case "$usenm" in
7074 true|$define) dflt=y;;
7075 *) dflt=n;;
7076 esac
7077 ;;
6fcddf3b 7078esac
5a29c6bc 7079$cat <<EOM
6fcddf3b 7080
5a29c6bc
JH
7081I can use $nm to extract the symbols from your C libraries. This
7082is a time consuming task which may generate huge output on the disk (up
7083to 3 megabytes) but that should make the symbols extraction faster. The
7084alternative is to skip the 'nm' extraction part and to compile a small
7085test program instead to determine whether each symbol is present. If
7086you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7087this may be the best solution.
6fcddf3b 7088
5a29c6bc 7089You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6fcddf3b 7090
6fcddf3b 7091EOM
5a29c6bc 7092rp="Shall I use $nm to extract C symbols from the libraries?"
6fcddf3b
JH
7093. ./myread
7094case "$ans" in
5a29c6bc
JH
7095[Nn]*) usenm=false;;
7096*) usenm=true;;
6fcddf3b 7097esac
6fcddf3b 7098
5a29c6bc
JH
7099runnm=$usenm
7100case "$reuseval" in
7101true) runnm=false;;
6e1038e0 7102esac
6e1038e0 7103
5a29c6bc
JH
7104: nm options which may be necessary
7105case "$nm_opt" in
7106'') if $test -f /mach_boot; then
7107 nm_opt='' # Mach
7108 elif $test -d /usr/ccs/lib; then
7109 nm_opt='-p' # Solaris (and SunOS?)
7110 elif $test -f /dgux; then
7111 nm_opt='-p' # DG-UX
7112 elif $test -f /lib64/rld; then
7113 nm_opt='-p' # 64-bit Irix
7114 else
7115 nm_opt=''
7116 fi;;
7117esac
6e1038e0 7118
5a29c6bc
JH
7119: nm options which may be necessary for shared libraries but illegal
7120: for archive libraries. Thank you, Linux.
7121case "$nm_so_opt" in
7122'') case "$myuname" in
d20247fd 7123 *linux*|gnu*)
5a29c6bc
JH
7124 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7125 nm_so_opt='--dynamic'
7126 fi
7127 ;;
7128 esac
7129 ;;
6e1038e0 7130esac
6e1038e0 7131
5a29c6bc
JH
7132case "$runnm" in
7133true)
7134: get list of predefined functions in a handy place
7135echo " "
7136case "$libc" in
7137'') libc=unknown
7138 case "$libs" in
7139 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7140 esac
7141 ;;
7142esac
7143case "$libs" in
7144'') ;;
7145*) for thislib in $libs; do
7146 case "$thislib" in
7147 -lc|-lc_s)
7148 : Handle C library specially below.
7149 ;;
7150 -l*)
7151 thislib=`echo $thislib | $sed -e 's/^-l//'`
7152 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7153 :
7154 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7155 :
7156 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7157 :
7158 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7159 :
7160 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7161 :
7162 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7163 :
7164 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7165 :
7166 else
7167 try=''
b4eb6b3d 7168 fi
5a29c6bc
JH
7169 libnames="$libnames $try"
7170 ;;
7171 *) libnames="$libnames $thislib" ;;
7172 esac
7173 done
7174 ;;
7175esac
7176xxx=normal
7177case "$libc" in
7178unknown)
7179 set /lib/libc.$so
7180 for xxx in $libpth; do
7181 $test -r $1 || set $xxx/libc.$so
7182 : The messy sed command sorts on library version numbers.
7183 $test -r $1 || \
7184 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7185 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7186 h
7187 s/[0-9][0-9]*/0000&/g
7188 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7189 G
7190 s/\n/ /' | \
7191 $sort | $sed -e 's/^.* //'`
7192 eval set \$$#
b4eb6b3d 7193 done
5a29c6bc
JH
7194 $test -r $1 || set /usr/ccs/lib/libc.$so
7195 $test -r $1 || set /lib/libsys_s$_a
b4eb6b3d 7196 ;;
5a29c6bc
JH
7197*)
7198 set blurfl
b4eb6b3d
JH
7199 ;;
7200esac
5a29c6bc
JH
7201if $test -r "$1"; then
7202 echo "Your (shared) C library seems to be in $1."
7203 libc="$1"
7204elif $test -r /lib/libc && $test -r /lib/clib; then
7205 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7206 xxx=apollo
7207 libc='/lib/clib /lib/libc'
7208 if $test -r /lib/syslib; then
7209 echo "(Your math library is in /lib/syslib.)"
7210 libc="$libc /lib/syslib"
7211 fi
7212elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7213 echo "Your C library seems to be in $libc, as you said before."
7214elif $test -r $incpath/usr/lib/libc$_a; then
7215 libc=$incpath/usr/lib/libc$_a;
7216 echo "Your C library seems to be in $libc. That's fine."
7217elif $test -r /lib/libc$_a; then
7218 libc=/lib/libc$_a;
7219 echo "Your C library seems to be in $libc. You're normal."
7220else
7221 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7222 :
7223 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7224 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7225 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7226 :
7227 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7228 :
7229 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7230 :
b4eb6b3d 7231 else
5a29c6bc 7232 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
b4eb6b3d 7233 fi
5a29c6bc
JH
7234 if $test -r "$tans"; then
7235 echo "Your C library seems to be in $tans, of all places."
7236 libc=$tans
7237 else
7238 libc='blurfl'
7239 fi
7240fi
7241if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7242 dflt="$libc"
7243 cat <<EOM
b4eb6b3d 7244
5a29c6bc
JH
7245If the guess above is wrong (which it might be if you're using a strange
7246compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7247
b4eb6b3d 7248EOM
5a29c6bc
JH
7249else
7250 dflt=''
7251 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7252 cat >&4 <<EOM
7253I can't seem to find your C library. I've looked in the following places:
b4eb6b3d 7254
5a29c6bc
JH
7255EOM
7256 $sed 's/^/ /' libpath
7257 cat <<EOM
b4eb6b3d 7258
5a29c6bc 7259None of these seems to contain your C library. I need to get its name...
5b7ea690 7260
b4eb6b3d 7261EOM
5a29c6bc
JH
7262fi
7263fn=f
7264rp='Where is your C library?'
7265. ./getfile
7266libc="$ans"
5b7ea690 7267
5a29c6bc
JH
7268echo " "
7269echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7270set X `cat libnames`
7271shift
7272xxx=files
7273case $# in 1) xxx=file; esac
7274echo "Extracting names from the following $xxx for later perusal:" >&4
7275echo " "
7276$sed 's/^/ /' libnames >&4
7277echo " "
7278$echo $n "This may take a while...$c" >&4
5b7ea690 7279
5a29c6bc
JH
7280for file in $*; do
7281 case $file in
7282 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7283 *) $nm $nm_opt $file 2>/dev/null;;
7284 esac
7285done >libc.tmp
7286
7287$echo $n ".$c"
7288$grep fprintf libc.tmp > libc.ptf
7289xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7290xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7291xxx='[ADTSIW]'
f7288ffb 7292if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
5a29c6bc
JH
7293 eval $xscan;\
7294 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7295 eval $xrun
7296elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7297 eval $xscan;\
7298 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7299 eval $xrun
7300elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7301 eval $xscan;\
7302 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7303 eval $xrun
7304elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7305 eval $xscan;\
7306 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7307 eval $xrun
7308elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7309 eval $xscan;\
7310 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7311 eval $xrun
7312elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7313 eval $xscan;\
7314 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7315 eval $xrun
7316elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7317 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7318 eval $xscan;\
7319 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7320 eval $xrun
7321elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7322 eval $xscan;\
7323 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7324 eval $xrun
7325elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7326 eval $xscan;\
7327 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7328 eval $xrun
7329elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7330 eval $xscan;\
7331 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7332 eval $xrun
7333elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7334 eval $xscan;\
7335 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7336 eval $xrun
7337elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7338 eval $xscan;\
7339 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7340 eval $xrun
7341elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7342 eval $xscan;\
7343 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7344 eval $xrun
7345elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7346 eval $xscan;\
7347 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7348 eval $xrun
7349else
7350 $nm -p $* 2>/dev/null >libc.tmp
7351 $grep fprintf libc.tmp > libc.ptf
7352 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7353 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7354 then
7355 nm_opt='-p'
7356 eval $xrun
5b7ea690 7357 else
5a29c6bc
JH
7358 echo " "
7359 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7360 com=''
7361 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7362 for thisname in $libnames $libc; do
7363 $ar t $thisname >>libc.tmp
7364 done
7365 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7366 echo "Ok." >&4
7367 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7368 # Repeat libc to extract forwarders to DLL entries too
7369 for thisname in $libnames $libc; do
7370 $ar tv $thisname >>libc.tmp
7371 # Revision 50 of EMX has bug in $ar.
7372 # it will not extract forwarders to DLL entries
7373 # Use emximp which will extract exactly them.
7374 emximp -o tmp.imp $thisname \
7375 2>/dev/null && \
7376 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7377 < tmp.imp >>libc.tmp
7378 $rm tmp.imp
7379 done
7380 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7381 echo "Ok." >&4
7382 else
7383 echo "$ar didn't seem to work right." >&4
7384 echo "Maybe this is a Cray...trying bld instead..." >&4
7385 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7386 then
7387 for thisname in $libnames; do
7388 bld t $libnames | \
7389 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7390 $ar t $thisname >>libc.tmp
7391 done
7392 echo "Ok." >&4
7393 else
7394 echo "That didn't work either. Giving up." >&4
7395 exit 1
7396 fi
7397 fi
2d736872 7398 fi
b4eb6b3d 7399fi
5a29c6bc
JH
7400nm_extract="$com"
7401case "$PASE" in
7402define)
7403 echo " "
7404 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7405 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7406 ;;
7407*) if $test -f /lib/syscalls.exp; then
7408 echo " "
7409 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7410 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' /lib/syscalls.exp >>libc.list
7411 fi
7412 ;;
7413esac
7414;;
7415esac
7416$rm -f libnames libpath
b4eb6b3d
JH
7417
7418: see if dld is available
7419set dld.h i_dld
7420eval $inhdr
7421
5a29c6bc
JH
7422: is a C symbol defined?
7423csym='tlook=$1;
7424case "$3" in
5057be0e
JH
7425-v) tf=libc.tmp; tdc="";;
7426-a) tf=libc.tmp; tdc="[]";;
7427*) tlook="^$1\$"; tf=libc.list; tdc="()";;
5a29c6bc
JH
7428esac;
7429tx=yes;
7430case "$reuseval-$4" in
7431true-) ;;
7432true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7433esac;
7434case "$tx" in
7435yes)
f7288ffb 7436 tval=false;
bd43df42
JH
7437 if $test "$runnm" = true; then
7438 if $contains $tlook $tf >/dev/null 2>&1; then
f7288ffb 7439 tval=true;
bd43df42 7440 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
5057be0e 7441 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
bd43df42 7442 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
5057be0e
JH
7443 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7444 $rm -f try$_exe try.c core core.* try.core;
5a29c6bc 7445 fi;
bd43df42 7446 else
5057be0e 7447 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
bd43df42 7448 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
5057be0e 7449 $rm -f try$_exe try.c;
f7288ffb
JH
7450 fi;
7451 ;;
5a29c6bc
JH
7452*)
7453 case "$tval" in
7454 $define) tval=true;;
7455 *) tval=false;;
f7288ffb
JH
7456 esac;
7457 ;;
5a29c6bc
JH
7458esac;
7459eval "$2=$tval"'
7460
7461: define an is-in-libc? function
7462inlibc='echo " "; td=$define; tu=$undef;
7463sym=$1; var=$2; eval "was=\$$2";
7464tx=yes;
7465case "$reuseval$was" in
7466true) ;;
7467true*) tx=no;;
7468esac;
7469case "$tx" in
7470yes)
7471 set $sym tres -f;
7472 eval $csym;
7473 case "$tres" in
7474 true)
7475 echo "$sym() found." >&4;
7476 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7477 *)
7478 echo "$sym() NOT found." >&4;
7479 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7480 esac;;
7481*)
7482 case "$was" in
7483 $define) echo "$sym() found." >&4;;
7484 *) echo "$sym() NOT found." >&4;;
7485 esac;;
7486esac'
7487
b4eb6b3d
JH
7488: see if dlopen exists
7489xxx_runnm="$runnm"
7490runnm=false
7491set dlopen d_dlopen
7492eval $inlibc
7493runnm="$xxx_runnm"
7494
7495: determine which dynamic loading, if any, to compile in
7496echo " "
7497dldir="ext/DynaLoader"
7498case "$usedl" in
7499$define|y|true)
7500 dflt='y'
7501 usedl="$define"
7502 ;;
7503$undef|n|false)
7504 dflt='n'
7505 usedl="$undef"
7506 ;;
7507*)
7508 dflt='n'
7509 case "$d_dlopen" in
7510 $define) dflt='y' ;;
7511 esac
7512 case "$i_dld" in
7513 $define) dflt='y' ;;
7514 esac
7515 : Does a dl_xxx.xs file exist for this operating system
7516 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7517 ;;
7518esac
7519rp="Do you wish to use dynamic loading?"
7520. ./myread
7521usedl="$ans"
7522case "$ans" in
7523y*) usedl="$define"
7524 case "$dlsrc" in
7525 '')
7526 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7527 dflt="$dldir/dl_${osname}.xs"
7528 elif $test "$d_dlopen" = "$define" ; then
7529 dflt="$dldir/dl_dlopen.xs"
7530 elif $test "$i_dld" = "$define" ; then
7531 dflt="$dldir/dl_dld.xs"
7532 else
7533 dflt=''
7534 fi
7535 ;;
7536 *) dflt="$dldir/$dlsrc"
7537 ;;
7538 esac
7539 echo "The following dynamic loading files are available:"
7540 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7541 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7542 rp="Source file to use for dynamic loading"
7543 fn="fne"
7544 gfpth="$src"
7545 . ./getfile
7546 usedl="$define"
7547 : emulate basename
7548 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7549
7550 $cat << EOM
7551
7552Some systems may require passing special flags to $cc -c to
7553compile modules that will be used to create a shared library.
7554To use no flags, say "none".
7555
7556EOM
7557 case "$cccdlflags" in
7558 '') case "$gccversion" in
7559 '') case "$osname" in
7560 hpux) dflt='+z' ;;
7561 next) dflt='none' ;;
7562 irix*) dflt='-KPIC' ;;
48bcfe03 7563 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7564 sunos) dflt='-pic' ;;
7565 *) dflt='none' ;;
7566 esac
7567 ;;
7568 *) case "$osname" in
b6cc0f4c 7569 darwin) dflt='none' ;;
48bcfe03 7570 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7571 *) dflt='-fpic' ;;
7572 esac ;;
7573 esac ;;
7574 ' ') dflt='none' ;;
7575 *) dflt="$cccdlflags" ;;
7576 esac
7577 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7578 . ./myread
7579 case "$ans" in
7580 none) cccdlflags=' ' ;;
7581 *) cccdlflags="$ans" ;;
7582 esac
7583
7584 cat << EOM
7585
7586Some systems use ld to create libraries that can be dynamically loaded,
7587while other systems (such as those using ELF) use $cc.
7588
7589EOM
7590 case "$ld" in
5a29c6bc 7591 '') $cat >try.c <<EOM
b4eb6b3d
JH
7592/* Test for whether ELF binaries are produced */
7593#include <fcntl.h>
5a29c6bc
JH
7594#$i_stdlib I_STDLIB
7595#ifdef I_STDLIB
b4eb6b3d 7596#include <stdlib.h>
5a29c6bc 7597#endif
b4eb6b3d
JH
7598int main() {
7599 char b[4];
7600 int i = open("a.out",O_RDONLY);
7601 if(i == -1)
7602 exit(1); /* fail */
7603 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7604 exit(0); /* succeed (yes, it's ELF) */
7605 else
7606 exit(1); /* fail */
7607}
7608EOM
5440bc8e 7609 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7610 cat <<EOM
7611You appear to have ELF support. I'll use $cc to build dynamic libraries.
7612EOM
7613 dflt="$cc"
7614 else
7615 echo "I'll use ld to build dynamic libraries."
7616 dflt='ld'
7617 fi
7618 rm -f try.c a.out
7619 ;;
7620 *) dflt="$ld"
7621 ;;
7622 esac
7623
7624 rp="What command should be used to create dynamic libraries?"
7625 . ./myread
7626 ld="$ans"
7627
7628 cat << EOM
7629
7630Some systems may require passing special flags to $ld to create a
7631library that can be dynamically loaded. If your ld flags include
7632-L/other/path options to locate libraries outside your loader's normal
7633search path, you may need to specify those -L options here as well. To
7634use no flags, say "none".
7635
7636EOM
7637 case "$lddlflags" in
7638 '') case "$osname" in
7639 beos) dflt='-nostart' ;;
7640 hpux) dflt='-b';
7641 case "$gccversion" in
7642 '') dflt="$dflt +vnocompatwarnings" ;;
7643 esac
7644 ;;
d20247fd 7645 linux|irix*|gnu*) dflt='-shared' ;;
b4eb6b3d
JH
7646 next) dflt='none' ;;
7647 solaris) dflt='-G' ;;
7648 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 7649 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
7650 *) dflt='none' ;;
7651 esac
7652 ;;
7653 *) dflt="$lddlflags" ;;
7654 esac
7655
7656 : Try to guess additional flags to pick up local libraries.
7657 : Be careful not to append to a plain 'none'
7658 case "$dflt" in
7659 none) dflt='' ;;
7660 esac
7661 for thisflag in $ldflags; do
7662 case "$thisflag" in
b5b9f165 7663 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
7664 case " $dflt " in
7665 *" $thisflag "*) ;;
7666 *) dflt="$dflt $thisflag" ;;
7667 esac
7668 ;;
7669 esac
7670 done
7671
7672 case "$dflt" in
7673 ''|' ') dflt='none' ;;
7674 esac
7675
7676 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7677 . ./myread
7678 case "$ans" in
7679 none) lddlflags=' ' ;;
7680 *) lddlflags="$ans" ;;
7681 esac
7682
7683 cat <<EOM
7684
7685Some systems may require passing special flags to $cc to indicate that
7686the resulting executable will use dynamic linking. To use no flags,
7687say "none".
7688
7689EOM
7690 case "$ccdlflags" in
7691 '') case "$osname" in
d20247fd 7692 linux|hpux|gnu*) dflt='-Wl,-E' ;;
54b41212
NC
7693 next|sunos) dflt='none' ;;
7694 *) dflt='none' ;;
b4eb6b3d
JH
7695 esac ;;
7696 ' ') dflt='none' ;;
7697 *) dflt="$ccdlflags" ;;
7698 esac
7699 rp="Any special flags to pass to $cc to use dynamic linking?"
7700 . ./myread
7701 case "$ans" in
7702 none) ccdlflags=' ' ;;
7703 *) ccdlflags="$ans" ;;
7704 esac
7705 ;;
7706*) usedl="$undef"
7707 ld='ld'
7708 dlsrc='dl_none.xs'
7709 lddlflags=''
7710 ccdlflags=''
7711 ;;
7712esac
7713
7714also=''
7715case "$usedl" in
7716$undef)
7717 # No dynamic loading being used, so don't bother even to prompt.
7718 useshrplib='false'
7719 ;;
7720*) case "$useshrplib" in
7721 '') case "$osname" in
48bcfe03 7722 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7723 dflt=y
7724 also='Building a shared libperl is required for dynamic loading to work on your system.'
7725 ;;
7726 next*)
7727 case "$osvers" in
7728 4*) dflt=y
7729 also='Building a shared libperl is needed for MAB support.'
7730 ;;
7731 *) dflt=n
7732 ;;
7733 esac
7734 ;;
7735 *) dflt=n
7736 ;;
7737 esac
7738 ;;
7739 $define|true|[Yy]*)
7740 dflt=y
7741 ;;
7742 *) dflt=n
7743 ;;
7744 esac
7745 $cat << EOM
7746
7747The perl executable is normally obtained by linking perlmain.c with
7748libperl${_a}, any static extensions (usually just DynaLoader), and
7749any other libraries needed on this system (such as -lm, etc.). Since
7750your system supports dynamic loading, it is probably possible to build
7751a shared libperl.$so. If you will have more than one executable linked
7752to libperl.$so, this will significantly reduce the size of each
7753executable, but it may have a noticeable affect on performance. The
7754default is probably sensible for your system.
7755$also
7756
7757EOM
7758 rp="Build a shared libperl.$so (y/n)"
7759 . ./myread
7760 case "$ans" in
7761 true|$define|[Yy]*)
7762 useshrplib='true' ;;
7763 *) useshrplib='false' ;;
7764 esac
7765 ;;
7766esac
7767
7768case "$useshrplib" in
7769true)
7770 case "$libperl" in
7771 '')
7772 # Figure out a good name for libperl.so. Since it gets stored in
7773 # a version-specific architecture-dependent library, the version
7774 # number isn't really that important, except for making cc/ld happy.
7775 #
7776 # A name such as libperl.so.3.1
7777 majmin="libperl.$so.$patchlevel.$subversion"
7778 # A name such as libperl.so.301
7779 majonly=`echo $patchlevel $subversion |
7780 $awk '{printf "%d%02d", $1, $2}'`
7781 majonly=libperl.$so.$majonly
7782 # I'd prefer to keep the os-specific stuff here to a minimum, and
7783 # rely on figuring it out from the naming of libc.
7784 case "${osname}${osvers}" in
7785 next4*)
7786 dflt=libperl.5.$so
7787 # XXX How handle the --version stuff for MAB?
7788 ;;
d20247fd 7789 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
7790 dflt=libperl.$so
7791 ;;
b53432e4
GH
7792 cygwin*) # ld links against an importlib
7793 dflt=libperl$lib_ext
b4eb6b3d
JH
7794 ;;
7795 *) # Try to guess based on whether libc has major.minor.
7796 case "$libc" in
7797 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7798 *libc.$so.[0-9]*) dflt=$majonly ;;
7799 *) dflt=libperl.$so ;;
7800 esac
7801 ;;
7802 esac
7803 ;;
7804 *) dflt=$libperl
7805 ;;
7806 esac
7807 cat << EOM
7808
7809I need to select a good name for the shared libperl. If your system uses
7810library names with major and minor numbers, then you might want something
7811like $majmin. Alternatively, if your system uses a single version
7812number for shared libraries, then you might want to use $majonly.
7813Or, your system might be quite happy with a simple libperl.$so.
7814
7815Since the shared libperl will get installed into a version-specific
7816architecture-dependent directory, the version number of the shared perl
7817library probably isn't important, so the default should be o.k.
7818
7819EOM
7820 rp='What name do you want to give to the shared libperl?'
7821 . ./myread
7822 libperl=$ans
7823 echo "Ok, I'll use $libperl"
7824 ;;
7825*)
7826 libperl="libperl${_a}"
7827 ;;
7828esac
7829
7830# Detect old use of shrpdir via undocumented Configure -Dshrpdir
7831case "$shrpdir" in
7832'') ;;
7833*) $cat >&4 <<EOM
7834WARNING: Use of the shrpdir variable for the installation location of
7835the shared $libperl is not supported. It was never documented and
7836will not work in this version. Let me (perlbug@perl.org)
7837know of any problems this may cause.
7838
7839EOM
7840 case "$shrpdir" in
7841 "$archlibexp/CORE")
7842 $cat >&4 <<EOM
7843But your current setting of $shrpdir is
7844the default anyway, so it's harmless.
7845EOM
7846 ;;
7847 *)
7848 $cat >&4 <<EOM
7849Further, your current attempted setting of $shrpdir
7850conflicts with the value of $archlibexp/CORE
7851that installperl will use.
7852EOM
7853 ;;
7854 esac
7855 ;;
7856esac
7857
7858# How will the perl executable find the installed shared $libperl?
7859# Add $xxx to ccdlflags.
7860# If we can't figure out a command-line option, use $shrpenv to
7861# set env LD_RUN_PATH. The main perl makefile uses this.
7862shrpdir=$archlibexp/CORE
7863xxx=''
7864tmp_shrpenv=''
7865if "$useshrplib"; then
7866 case "$osname" in
7867 aix)
7868 # We'll set it in Makefile.SH...
7869 ;;
b5b9f165 7870 solaris)
b4eb6b3d
JH
7871 xxx="-R $shrpdir"
7872 ;;
80512072 7873 freebsd|netbsd|openbsd|interix)
b4eb6b3d
JH
7874 xxx="-Wl,-R$shrpdir"
7875 ;;
d20247fd 7876 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
7877 xxx="-Wl,-rpath,$shrpdir"
7878 ;;
7879 next)
7880 # next doesn't like the default...
7881 ;;
7882 beos)
7883 # beos doesn't like the default, either.
7884 ;;
7885 hpux*)
7886 # hpux doesn't like the default, either.
7887 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7888 ;;
7889 *)
7890 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7891 ;;
7892 esac
7893 case "$xxx" in
7894 '') ;;
7895 *)
7896 # Only add $xxx if it isn't already in ccdlflags.
7897 case " $ccdlflags " in
7898 *" $xxx "*) ;;
7899 *) ccdlflags="$ccdlflags $xxx"
7900 cat <<EOM >&4
7901
7902Adding $xxx to the flags
7903passed to $ld so that the perl executable will find the
7904installed shared $libperl.
7905
7906EOM
7907 ;;
7908 esac
7909 ;;
7910 esac
7911fi
7912# Fix ccdlflags in AIX for building external extensions.
7913# (For building Perl itself bare -bE:perl.exp is needed,
7914# Makefile.SH takes care of this.)
7915case "$osname" in
7916aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7917esac
7918# Respect a hint or command-line value.
7919case "$shrpenv" in
7920'') shrpenv="$tmp_shrpenv" ;;
7921esac
7922case "$ldlibpthname" in
7923'') ldlibpthname=LD_LIBRARY_PATH ;;
7924none) ldlibpthname='' ;;
7925esac
7926
7927: determine where manual pages are on this system
7928echo " "
7929case "$sysman" in
7930'')
4a0a3829
SD
7931 syspath='/usr/share/man/man1 /usr/man/man1'
7932 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7933 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
7934 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7935 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7936 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7937 sysman=`./loc . /usr/man/man1 $syspath`
7938 ;;
7939esac
7940if $test -d "$sysman"; then
7941 echo "System manual is in $sysman." >&4
7942else
7943 echo "Could not find manual pages in source form." >&4
7944fi
7945
7946: determine where manual pages go
7947set man1dir man1dir none
7948eval $prefixit
7949$cat <<EOM
7950
7951$spackage has manual pages available in source form.
7952EOM
7953case "$nroff" in
7954nroff)
7955 echo "However, you don't have nroff, so they're probably useless to you."
7956 case "$man1dir" in
7957 '') man1dir="none";;
7958 esac;;
7959esac
7960echo "If you don't want the manual sources installed, answer 'none'."
7961case "$man1dir" in
7962' ') dflt=none
7963 ;;
7964'')
4a0a3829
SD
7965 lookpath="$prefixexp/share/man/man1"
7966 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
7967 lookpath="$lookpath $prefixexp/man/p_man/man1"
7968 lookpath="$lookpath $prefixexp/man/u_man/man1"
7969 lookpath="$lookpath $prefixexp/man/man.1"
7970 case "$sysman" in
7971 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7972 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7973 esac
7974 set dflt
7975 eval $prefixup
7976 ;;
7977*) dflt="$man1dir"
7978 ;;
7979esac
7980echo " "
7981fn=dn+~
7982rp="Where do the main $spackage manual pages (source) go?"
7983. ./getfile
7984if $test "X$man1direxp" != "X$ansexp"; then
7985 installman1dir=''
7986fi
7987man1dir="$ans"
7988man1direxp="$ansexp"
7989case "$man1dir" in
7990'') man1dir=' '
7991 installman1dir='';;
7992esac
7993
7994: Change installation prefix, if necessary.
7995if $test X"$prefix" != X"$installprefix"; then
7996 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7997else
7998 installman1dir="$man1direxp"
7999fi
8000
8001: What suffix to use on installed man pages
8002
8003case "$man1dir" in
8004' ')
8005 man1ext='0'
8006 ;;
8007*)
8008 rp="What suffix should be used for the main $spackage man pages?"
8009 case "$man1ext" in
8010 '') case "$man1dir" in
8011 *1) dflt=1 ;;
8012 *1p) dflt=1p ;;
8013 *1pm) dflt=1pm ;;
8014 *l) dflt=l;;
8015 *n) dflt=n;;
8016 *o) dflt=o;;
8017 *p) dflt=p;;
8018 *C) dflt=C;;
8019 *L) dflt=L;;
8020 *L1) dflt=L1;;
8021 *) dflt=1;;
8022 esac
8023 ;;
8024 *) dflt="$man1ext";;
8025 esac
8026 . ./myread
8027 man1ext="$ans"
8028 ;;
8029esac
8030
8031: see if we can have long filenames
8032echo " "
8033first=123456789abcdef
8034$rm -f $first
8035if (echo hi >$first) 2>/dev/null; then
8036 if $test -f 123456789abcde; then
8037 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8038 val="$undef"
8039 else
8040 echo 'You can have filenames longer than 14 characters.'>&4
8041 val="$define"
8042 fi
8043else
8044 $cat <<'EOM'
8045You can't have filenames longer than 14 chars.
8046You can't even think about them!
8047EOM
8048 val="$undef"
8049fi
8050set d_flexfnam
8051eval $setvar
8052$rm -rf 123456789abcde*
8053
8054: determine where library module manual pages go
8055set man3dir man3dir none
8056eval $prefixit
8057$cat <<EOM
8058
8059$spackage has manual pages for many of the library modules.
8060EOM
8061
8062case "$nroff" in
8063nroff)
8064 $cat <<'EOM'
8065However, you don't have nroff, so they're probably useless to you.
8066EOM
8067 case "$man3dir" in
8068 '') man3dir="none";;
8069 esac;;
8070esac
8071
8072case "$d_flexfnam" in
8073undef)
8074 $cat <<'EOM'
8075However, your system can't handle the long file names like File::Basename.3.
8076EOM
8077 case "$man3dir" in
8078 '') man3dir="none";;
8079 esac;;
8080esac
8081
8082echo "If you don't want the manual sources installed, answer 'none'."
8083prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8084case "$man3dir" in
8085'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8086 if $test -d "$privlib/man/man3"; then
8087 cat <<EOM >&4
8088
8089WARNING: Previous versions of perl installed man3 pages into
8090$privlib/man/man3. This version will suggest a
8091new default of $dflt.
8092EOM
8093 tdflt=$dflt
8094 dflt='n'
8095 rp='Do you wish to preserve the old behavior?(y/n)'
8096 . ./myread
8097 case "$ans" in
8098 y*) dflt="$privlib/man/man3" ;;
8099 *) dflt=$tdflt ;;
8100 esac
8101 fi
8102 ;;
8103*) dflt="$man3dir" ;;
8104esac
8105case "$dflt" in
8106' ') dflt=none ;;
8107esac
8108echo " "
8109fn=dn+~
8110rp="Where do the $package library man pages (source) go?"
8111. ./getfile
8112man3dir="$ans"
8113man3direxp="$ansexp"
8114case "$man3dir" in
8115'') man3dir=' '
8116 installman3dir='';;
8117esac
8118
8119: Change installation prefix, if necessary.
8120if $test X"$prefix" != X"$installprefix"; then
8121 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8122else
8123 installman3dir="$man3direxp"
8124fi
8125
8126: What suffix to use on installed man pages
8127case "$man3dir" in
8128' ')
8129 man3ext='0'
8130 ;;
8131*)
8132 rp="What suffix should be used for the $package library man pages?"
8133 case "$man3ext" in
8134 '') case "$man3dir" in
8135 *3) dflt=3 ;;
8136 *3p) dflt=3p ;;
8137 *3pm) dflt=3pm ;;
8138 *l) dflt=l;;
8139 *n) dflt=n;;
8140 *o) dflt=o;;
8141 *p) dflt=p;;
8142 *C) dflt=C;;
8143 *L) dflt=L;;
8144 *L3) dflt=L3;;
8145 *) dflt=3;;
8146 esac
8147 ;;
8148 *) dflt="$man3ext";;
8149 esac
8150 . ./myread
8151 man3ext="$ans"
8152 ;;
8153esac
8154
8155: see if we have to deal with yellow pages, now NIS.
0384a54a 8156if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8157 if $test -f /usr/etc/nibindd; then
8158 echo " "
8159 echo "I'm fairly confident you're on a NeXT."
8160 echo " "
8161 rp='Do you get the hosts file via NetInfo?'
8162 dflt=y
8163 case "$hostcat" in
8164 nidump*) ;;
8165 '') ;;
8166 *) dflt=n;;
8167 esac
8168 . ./myread
8169 case "$ans" in
8170 y*) hostcat='nidump hosts .';;
8171 *) case "$hostcat" in
8172 nidump*) hostcat='';;
8173 esac
8174 ;;
8175 esac
8176 fi
8177 case "$hostcat" in
8178 nidump*) ;;
8179 *)
8180 case "$hostcat" in
8181 *ypcat*) dflt=y;;
8182 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8183 dflt=y
8184 else
8185 dflt=n
8186 fi;;
8187 *) dflt=n;;
8188 esac
8189 echo " "
8190 rp='Are you getting the hosts file via yellow pages?'
8191 . ./myread
8192 case "$ans" in
8193 y*) hostcat='ypcat hosts';;
8194 *) hostcat='cat /etc/hosts';;
8195 esac
8196 ;;
8197 esac
8198fi
8199case "$hostcat" in
8200'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8201esac
8202case "$groupcat" in
8203'') test -f /etc/group && groupcat='cat /etc/group';;
8204esac
8205case "$passcat" in
8206'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8207esac
8208
8209: now get the host name
8210echo " "
8211echo "Figuring out host name..." >&4
8212case "$myhostname" in
8213'') cont=true
8214 echo 'Maybe "hostname" will work...'
73614538 8215 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8216 myhostname=$tans
8217 phostname=hostname
8218 cont=''
8219 fi
8220 ;;
8221*) cont='';;
8222esac
8223if $test "$cont"; then
8224 if ./xenix; then
8225 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8226 if tans=`cat /etc/systemid 2>&1` ; then
8227 myhostname=$tans
8228 phostname='cat /etc/systemid'
8229 echo "Whadyaknow. Xenix always was a bit strange..."
8230 cont=''
8231 fi
8232 elif $test -r /etc/systemid; then
8233 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8234 fi
8235fi
8236if $test "$cont"; then
8237 echo 'No, maybe "uuname -l" will work...'
73614538 8238 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8239 myhostname=$tans
8240 phostname='uuname -l'
8241 else
8242 echo 'Strange. Maybe "uname -n" will work...'
73614538 8243 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8244 myhostname=$tans
8245 phostname='uname -n'
8246 else
8247 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8248 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8249 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8250 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8251 else
8252 case "$myhostname" in
8253 '') echo "Does this machine have an identity crisis or something?"
8254 phostname='';;
8255 *)
8256 echo "Well, you said $myhostname before..."
8257 phostname='echo $myhostname';;
8258 esac
8259 fi
8260 fi
8261 fi
8262fi
52a549d0
JH
8263case "$myhostname" in
8264'') myhostname=noname ;;
8265esac
b4eb6b3d
JH
8266: you do not want to know about this
8267set $myhostname
8268myhostname=$1
8269
8270: verify guess
8271if $test "$myhostname" ; then
8272 dflt=y
8273 rp='Your host name appears to be "'$myhostname'".'" Right?"
8274 . ./myread
8275 case "$ans" in
8276 y*) ;;
8277 *) myhostname='';;
8278 esac
8279fi
8280
8281: bad guess or no guess
8282while $test "X$myhostname" = X ; do
8283 dflt=''
8284 rp="Please type the (one word) name of your host:"
8285 . ./myread
8286 myhostname="$ans"
8287done
8288
8289: translate upper to lower if necessary
8290case "$myhostname" in
8291*[A-Z]*)
8292 echo "(Normalizing case in your host name)"
8293 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8294 ;;
8295esac
8296
8297case "$myhostname" in
8298*.*)
8299 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8300 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8301 echo "(Trimming domain name from host name--host name is now $myhostname)"
8302 ;;
8303*) case "$mydomain" in
8304 '')
8305 {
8306 test "X$hostcat" = "Xypcat hosts" &&
8307 ypmatch "$myhostname" hosts 2>/dev/null |\
8308 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8309 $test -s hosts
8310 } || {
8311 test "X$hostcat" != "X" &&
8312 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8313 /[ ]$myhostname[ . ]/p" > hosts
8314 }
8315 tmp_re="[ . ]"
f08cbdd1
PP
8316 if $test -f hosts; then
8317 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8318 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8319 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8320 hosts | $sort | $uniq | \
8321 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8322 case `$echo X$dflt` in
8323 X*\ *) echo "(Several hosts in the database matched hostname)"
8324 dflt=.
8325 ;;
8326 X.) echo "(You do not have fully-qualified names in the hosts database)"
8327 ;;
8328 esac
8329 else
8330 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8331 dflt=.
f08cbdd1 8332 fi
b4eb6b3d
JH
8333 case "$dflt" in
8334 .)
8335 tans=`./loc resolv.conf X /etc /usr/etc`
8336 if $test -f "$tans"; then
8337 echo "(Attempting domain name extraction from $tans)"
8338 dflt=.`$sed -n -e 's/ / /g' \
8339 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
8340 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8341 case "$dflt" in
8342 .) dflt=.`$sed -n -e 's/ / /g' \
8343 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
8344 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8345 ;;
8346 esac
8347 fi
8348 ;;
8349 esac
8350 case "$dflt" in
8351 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8352 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8353 case "$dflt" in
8354 '') dflt='.';;
8355 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8356 esac
8357 ;;
8358 esac
59c9e5d6
PP
8359 case "$dflt$osname" in
8360 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8361 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8362 ;;
8363 esac
b4eb6b3d
JH
8364 case "$dflt" in
8365 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8366 dflt='.nonet'
b4eb6b3d
JH
8367 ;;
8368 esac
8369 $rm -f hosts
8370 ;;
8371 *) dflt="$mydomain";;
8372 esac;;
8373esac
8374echo " "
8375rp="What is your domain name?"
8376. ./myread
8377tans="$ans"
8378case "$ans" in
8379'') ;;
8380.*) ;;
8381*) tans=".$tans";;
8382esac
8383mydomain="$tans"
8384
8385: translate upper to lower if necessary
8386case "$mydomain" in
8387*[A-Z]*)
8388 echo "(Normalizing case in your domain name)"
8389 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8390 ;;
8391esac
8392
8393: a little sanity check here
8394case "$phostname" in
8395'') ;;
8396*)
8397 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8398 $myhostname$mydomain|$myhostname) ;;
8399 *)
8400 case "$phostname" in
8401 sed*)
8402 echo "(That doesn't agree with your whoami.h file, by the way.)"
8403 ;;
8404 *)
8405 echo "(That doesn't agree with your $phostname command, by the way.)"
8406 ;;
8407 esac
8408 ;;
8409 esac
8410 ;;
8411esac
8412
8413$cat <<EOM
8414
8415I need to get your e-mail address in Internet format if possible, i.e.
8416something like user@host.domain. Please answer accurately since I have
8417no easy means to double check it. The default value provided below
8418is most probably close to reality but may not be valid from outside
8419your organization...
8420
8421EOM
8422cont=x
8423while test "$cont"; do
8424 case "$cf_email" in
8425 '') dflt="$cf_by@$myhostname$mydomain";;
8426 *) dflt="$cf_email";;
8427 esac
8428 rp='What is your e-mail address?'
8429 . ./myread
8430 cf_email="$ans"
8431 case "$cf_email" in
8432 *@*.*) cont='' ;;
8433 *)
8434 rp='Address does not look like an Internet one. Use it anyway?'
8435 case "$fastread" in
8436 yes) dflt=y ;;
8437 *) dflt=n ;;
8438 esac
8439 . ./myread
8440 case "$ans" in
8441 y*) cont='' ;;
8442 *) echo " " ;;
8443 esac
8444 ;;
8445 esac
8446done
8447
8448$cat <<EOM
8449
8450If you or somebody else will be maintaining perl at your site, please
8451fill in the correct e-mail address here so that they may be contacted
8452if necessary. Currently, the "perlbug" program included with perl
8453will send mail to this address in addition to perlbug@perl.org. You may
8454enter "none" for no administrator.
8455
8456EOM
8457case "$perladmin" in
8458'') dflt="$cf_email";;
8459*) dflt="$perladmin";;
8460esac
8461rp='Perl administrator e-mail address'
8462. ./myread
8463perladmin="$ans"
8464
674912d7
RB
8465: determine whether to only install version-specific parts.
8466echo " "
8467$cat <<EOM
8468Do you want to install only the version-specific parts of the perl
8469distribution? Usually you do *not* want to do this.
8470EOM
8471case "$versiononly" in
8472"$define"|[Yy]*|true) dflt='y' ;;
8473*) dflt='n';
8474esac
8475rp="Do you want to install only the version-specific parts of perl?"
8476. ./myread
8477case "$ans" in
8478[yY]*) val="$define";;
8479*) val="$undef" ;;
8480esac
8481set versiononly
8482eval $setvar
8483
ad493445
MB
8484case "$versiononly" in
8485"$define") inc_version_list=''
8486 inc_version_list_init=0
8487 ;;
8488esac
8489
b4eb6b3d
JH
8490: figure out how to guarantee perl startup
8491case "$startperl" in
8492'')
8493 case "$sharpbang" in
8494 *!)
8495 $cat <<EOH
8496
8497I can use the #! construct to start perl on your system. This will
8498make startup of perl scripts faster, but may cause problems if you
8499want to share those scripts and perl is not in a standard place
8500($binexp/perl) on all your platforms. The alternative is to force
8501a shell by starting the script with a single ':' character.
8502
8503EOH
674912d7
RB
8504 case "$versiononly" in
8505 "$define") dflt="$binexp/perl$version";;
8506 *) dflt="$binexp/perl";;
8507 esac
b4eb6b3d
JH
8508 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8509 . ./myread
8510 case "$ans" in
8511 none) startperl=": # use perl";;
8512 *) startperl="#!$ans"
8513 if $test 30 -lt `echo "$ans" | wc -c`; then
8514 $cat >&4 <<EOM
8515
8516WARNING: Some systems limit the #! command to 32 characters.
8517If you experience difficulty running Perl scripts with #!, try
8518installing Perl in a directory with a shorter pathname.
8519
8520EOM
8521 fi ;;
8522 esac
8523 ;;
8524 *) startperl=": # use perl"
8525 ;;
8526 esac
8527 ;;
8528esac
8529echo "I'll use $startperl to start perl scripts."
8530
8531: figure best path for perl in scripts
8532case "$perlpath" in
8533'')
5e20a8ca
RGS
8534 case "$versiononly" in
8535 "$define") perlpath="$binexp/perl$version";;
8536 *) perlpath="$binexp/perl";;
8537 esac
b4eb6b3d
JH
8538 case "$startperl" in
8539 *!*) ;;
8540 *)
8541 $cat <<EOH
8542
8543I will use the "eval 'exec'" idiom to start Perl on your system.
8544I can use the full path of your Perl binary for this purpose, but
8545doing so may cause problems if you want to share those scripts and
8546Perl is not always in a standard place ($binexp/perl).
8547
8548EOH
8549 dflt="$binexp/perl"
8550 rp="What path shall I use in \"eval 'exec'\"?"
8551 . ./myread
8552 perlpath="$ans"
8553 ;;
8554 esac
8555 ;;
8556esac
8557case "$startperl" in
8558*!*) ;;
8559*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8560esac
8561
8562: determine where public executable scripts go
8563set scriptdir scriptdir
8564eval $prefixit
8565case "$scriptdir" in
8566'')
8567 dflt="$bin"
8568 : guess some guesses
8569 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8570 $test -d /usr/share/bin && dflt=/usr/share/bin
8571 $test -d /usr/local/script && dflt=/usr/local/script
8572 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8573 $test -d $prefixexp/script && dflt=$prefixexp/script
8574 set dflt
8575 eval $prefixup
8576 ;;
8577*) dflt="$scriptdir"
8578 ;;
8579esac
8580$cat <<EOM
8581
8582Some installations have a separate directory just for executable scripts so
8583that they can mount it across multiple architectures but keep the scripts in
8584one spot. You might, for example, have a subdirectory of /usr/share for this.
8585Or you might just lump your scripts in with all your other executables.
8586
8587EOM
8588fn=d~
8589rp='Where do you keep publicly executable scripts?'
8590. ./getfile
8591if $test "X$ansexp" != "X$scriptdirexp"; then
8592 installscript=''
8593fi
8594scriptdir="$ans"
8595scriptdirexp="$ansexp"
8596: Change installation prefix, if necessary.
8597if $test X"$prefix" != X"$installprefix"; then
8598 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8599else
8600 installscript="$scriptdirexp"
8601fi
8602
8603: determine where add-on public executables go
8604case "$sitebin" in
8605'') dflt=$siteprefix/bin ;;
8606*) dflt=$sitebin ;;
8607esac
8608fn=d~
8609rp='Pathname where the add-on public executables should be installed?'
8610. ./getfile
8611sitebin="$ans"
8612sitebinexp="$ansexp"
8613: Change installation prefix, if necessary.
8614if $test X"$prefix" != X"$installprefix"; then
8615 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8616else
8617 installsitebin="$sitebinexp"
8618fi
8619
6e1038e0 8620: determine where add-on html pages go
3bb95762 8621: There is no standard location, so try to copy the previously-selected
6e1038e0 8622: directory structure for the core html pages.
3bb95762
JH
8623case "$sitehtml1dir" in
8624'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8625*) dflt=$sitehtml1dir ;;
6e1038e0
MB
8626esac
8627case "$dflt" in
8628''|' ') dflt=none ;;
8629esac
8630fn=dn+~
8631rp='Pathname where the site-specific html pages should be installed?'
8632. ./getfile
3bb95762
JH
8633sitehtml1dir="$ans"
8634sitehtml1direxp="$ansexp"
6e1038e0
MB
8635: Change installation prefix, if necessary.
8636if $test X"$prefix" != X"$installprefix"; then
3bb95762 8637 installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 8638else
3bb95762 8639 installsitehtml1dir="$sitehtml1direxp"
6e1038e0
MB
8640fi
8641
8642: determine where add-on library html pages go
8643: There is no standard location, so try to copy the previously-selected
8644: directory structure for the core html pages.
3bb95762
JH
8645case "$sitehtml3dir" in
8646'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8647*) dflt=$sitehtml3dir ;;
6e1038e0
MB
8648esac
8649case "$dflt" in
8650''|' ') dflt=none ;;
8651esac
8652fn=dn+~
8653rp='Pathname where the site-specific library html pages should be installed?'
8654. ./getfile
3bb95762
JH
8655sitehtml3dir="$ans"
8656sitehtml3direxp="$ansexp"
6e1038e0
MB
8657: Change installation prefix, if necessary.
8658if $test X"$prefix" != X"$installprefix"; then
3bb95762 8659 installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 8660else
3bb95762 8661 installsitehtml3dir="$sitehtml3direxp"
6e1038e0
MB
8662fi
8663
8664: determine where add-on manual pages go
3bb95762
JH
8665case "$siteman1dir" in
8666'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8667*) dflt=$siteman1dir ;;
6e1038e0 8668esac
c061b110
JH
8669case "$dflt" in
8670''|' ') dflt=none ;;
8671esac
6e1038e0
MB
8672fn=dn+~
8673rp='Pathname where the site-specific manual pages should be installed?'
8674. ./getfile
3bb95762
JH
8675siteman1dir="$ans"
8676siteman1direxp="$ansexp"
6e1038e0
MB
8677: Change installation prefix, if necessary.
8678if $test X"$prefix" != X"$installprefix"; then
3bb95762 8679 installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 8680else
3bb95762 8681 installsiteman1dir="$siteman1direxp"
6e1038e0
MB
8682fi
8683
8684: determine where add-on library man pages go
3bb95762
JH
8685case "$siteman3dir" in
8686'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8687*) dflt=$siteman3dir ;;
6e1038e0 8688esac
c061b110
JH
8689case "$dflt" in
8690''|' ') dflt=none ;;
8691esac
6e1038e0
MB
8692fn=dn+~
8693rp='Pathname where the site-specific library manual pages should be installed?'
8694. ./getfile
3bb95762
JH
8695siteman3dir="$ans"
8696siteman3direxp="$ansexp"
6e1038e0
MB
8697: Change installation prefix, if necessary.
8698if $test X"$prefix" != X"$installprefix"; then
3bb95762 8699 installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 8700else
3bb95762 8701 installsiteman3dir="$siteman3direxp"
6e1038e0
MB
8702fi
8703
8704: determine where add-on public executable scripts go
8705case "$sitescript" in
8706'') dflt=$siteprefix/script
8707 $test -d $dflt || dflt=$sitebin ;;
8708*) dflt="$sitescript" ;;
8709esac
8710fn=d~+
8711rp='Pathname where add-on public executable scripts should be installed?'
8712. ./getfile
8713sitescript="$ans"
8714sitescriptexp="$ansexp"
8715: Change installation prefix, if necessary.
8716if $test X"$prefix" != X"$installprefix"; then
8717 installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8718else
8719 installsitescript="$sitescriptexp"
8720fi
8721
ff0950a8
JH
8722case "$usefaststdio" in
8723$define|true|[yY]*|'')
8724 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8725 case "$xversion" in
8726 [68]) dflt='y' ;;
8727 *) dflt='n' ;;
8728 esac
8729 ;;
8730*) dflt='n';;
8731esac
8732cat <<EOM
8733
8734Perl can be built to use 'fast stdio', which means using the stdio
8735library but also directly manipulating the stdio buffers to enable
8736faster I/O. Using stdio is better for backward compatibility (especially
8737for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8738interface has been preferred instead of stdio.
8739
8740If this doesn't make any sense to you, just accept the default '$dflt'.
8741EOM
8742rp='Use the "fast stdio" if available?'
8743. ./myread
8744case "$ans" in
8745y|Y) val="$define" ;;
8746*) val="$undef" ;;
8747esac
8748set usefaststdio
8749eval $setvar
8750
8751
96056487
JH
8752: define an is-a-typedef? function
8753typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8754case "$inclist" in
8755"") inclist="sys/types.h";;
8756esac;
8757eval "varval=\$$var";
8758case "$varval" in
8759"")
8760 $rm -f temp.c;
8761 for inc in $inclist; do
8762 echo "#include <$inc>" >>temp.c;
8763 done;
8764 echo "#ifdef $type" >> temp.c;
8765 echo "printf(\"We have $type\");" >> temp.c;
8766 echo "#endif" >> temp.c;
8767 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8768 if $contains $type temp.E >/dev/null 2>&1; then
8769 eval "$var=\$type";
8770 else
8771 eval "$var=\$def";
8772 fi;
8773 $rm -f temp.?;;
8774*) eval "$var=\$varval";;
8775esac'
8776
8777: define an is-a-typedef? function that prompts if the type is not available.
8778typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8779case "$inclist" in
8780"") inclist="sys/types.h";;
8781esac;
8782eval "varval=\$$var";
8783case "$varval" in
8784"")
8785 $rm -f temp.c;
8786 for inc in $inclist; do
8787 echo "#include <$inc>" >>temp.c;
8788 done;
8789 echo "#ifdef $type" >> temp.c;
8790 echo "printf(\"We have $type\");" >> temp.c;
8791 echo "#endif" >> temp.c;
8792 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8793 echo " " ;
8794 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8795 if $contains $type temp.E >/dev/null 2>&1; then
8796 echo "$type found." >&4;
8797 eval "$var=\$type";
8798 else
8799 echo "$type NOT found." >&4;
8800 dflt="$def";
8801 . ./myread ;
8802 eval "$var=\$ans";
8803 fi;
8804 $rm -f temp.?;;
8805*) eval "$var=\$varval";;
8806esac'
8807
8808: see what type lseek is declared as in the kernel
8809rp="What is the type used for lseek's offset on this system?"
8810set off_t lseektype long stdio.h sys/types.h
8811eval $typedef_ask
8812
8813echo " "
8814echo "Checking to see how big your file offsets are..." >&4
8815$cat >try.c <<EOCP
8816#include <sys/types.h>
8817#include <stdio.h>
8818int main()
8819{
8820 printf("%d\n", (int)sizeof($lseektype));
8821 return(0);
8822}
8823EOCP
8824set try
8825if eval $compile_ok; then
8826 lseeksize=`$run ./try`
8827 echo "Your file offsets are $lseeksize bytes long."
8828else
8829 dflt=$longsize
8830 echo " "
8831 echo "(I can't seem to compile the test program. Guessing...)"
8832 rp="What is the size of your file offsets (in bytes)?"
8833 . ./myread
8834 lseeksize="$ans"
8835fi
8836$rm -f try.c try
8837
8838: see what type file positions are declared as in the library
8839rp="What is the type for file position used by fsetpos()?"
8840set fpos_t fpostype long stdio.h sys/types.h
8841eval $typedef_ask
8842
8843echo " "
8844case "$fpostype" in
8845*_t) zzz="$fpostype" ;;
8846*) zzz="fpos_t" ;;
8847esac
8848echo "Checking the size of $zzz..." >&4
8849cat > try.c <<EOCP
8850#include <sys/types.h>
8851#include <stdio.h>
5ed858ef
JH
8852#$i_stdlib I_STDLIB
8853#ifdef I_STDLIB
8854#include <stdlib.h>
8855#endif
96056487
JH
8856int main() {
8857 printf("%d\n", (int)sizeof($fpostype));
8858 exit(0);
8859}
8860EOCP
8861set try
8862if eval $compile_ok; then
8863 yyy=`$run ./try`
8864 case "$yyy" in
8865 '') fpossize=4
8866 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8867 ;;
8868 *) fpossize=$yyy
8869 echo "Your $zzz is $fpossize bytes long."
8870 ;;
8871 esac
8872else
8873 dflt="$longsize"
8874 echo " " >&4
8875 echo "(I can't compile the test program. Guessing...)" >&4
8876 rp="What is the size of your file positions (in bytes)?"
8877 . ./myread
8878 fpossize="$ans"
8879fi
8880
96056487
JH
8881# Backward compatibility (uselfs is deprecated).
8882case "$uselfs" in
8883"$define"|true|[yY]*)
8884 cat <<EOM >&4
8885
8886*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8887EOM
8888 uselargefiles="$define"
8889 ;;
8890esac
8891
8892case "$lseeksize:$fpossize" in
88938:8) cat <<EOM
8894
8895You can have files larger than 2 gigabytes.
8896EOM
8897 val="$define" ;;
8898*) case "$uselargefiles" in
8899 "$undef"|false|[nN]*) dflt='n' ;;
8900 *) dflt='y' ;;
8901 esac
8902 cat <<EOM
8903
8904Perl can be built to understand large files (files larger than 2 gigabytes)
8905on some systems. To do so, Configure can be run with -Duselargefiles.
8906
8907If this doesn't make any sense to you, just accept the default '$dflt'.
8908EOM
8909 rp='Try to understand large files, if available?'
8910 . ./myread
8911 case "$ans" in
8912 y|Y) val="$define" ;;
8913 *) val="$undef" ;;
8914 esac
8915 ;;
8916esac
8917set uselargefiles
8918eval $setvar
96056487
JH
8919: Look for a hint-file generated 'call-back-unit'. If the
8920: user has specified that a large files perl is to be built,
8921: we may need to set or change some other defaults.
6bd2d01f
NC
8922if $test -f uselargefiles.cbu; then
8923 echo "Your platform has some specific hints regarding large file builds, using them..."
8924 . ./uselargefiles.cbu
8925fi
8926case "$uselargefiles" in
8927"$define")
96056487 8928 if $test -f uselargefiles.cbu; then
96056487
JH
8929 echo " "
8930 echo "Rechecking to see how big your file offsets are..." >&4
8931 $cat >try.c <<EOCP
8932#include <sys/types.h>
8933#include <stdio.h>
8934int main()
8935{
8936 printf("%d\n", (int)sizeof($lseektype));
8937 return(0);
8938}
8939EOCP
8940 set try
8941 if eval $compile_ok; then
8942 lseeksize=`$run ./try`
8943 $echo "Your file offsets are now $lseeksize bytes long."
8944 else
8945 dflt="$lseeksize"
8946 echo " "
8947 echo "(I can't seem to compile the test program. Guessing...)"
8948 rp="What is the size of your file offsets (in bytes)?"
8949 . ./myread
8950 lseeksize="$ans"
8951 fi
8952 case "$fpostype" in
8953 *_t) zzz="$fpostype" ;;
8954 *) zzz="fpos_t" ;;
8955 esac
8956 $echo $n "Rechecking the size of $zzz...$c" >&4
8957 $cat > try.c <<EOCP
8958#include <sys/types.h>
8959#include <stdio.h>
5a29c6bc
JH
8960#$i_stdlib I_STDLIB
8961#ifdef I_STDLIB
8962#include <stdlib.h>
8963#endif
96056487
JH
8964int main() {
8965 printf("%d\n", (int)sizeof($fpostype));
c04fee9e 8966 return(0);
96056487
JH
8967}
8968EOCP
8969 set try
8970 if eval $compile_ok; then
8971 yyy=`$run ./try`
8972 dflt="$lseeksize"
8973 case "$yyy" in
8974 '') echo " "
8975 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8976 ;;
8977 *) fpossize=$yyy
8978 echo " $fpossize bytes." >&4
8979 ;;
8980 esac
8981 else
8982 dflt="$fpossize"
8983 echo " "
8984 echo "(I can't compile the test program. Guessing...)" >&4
8985 rp="What is the size of your file positions (in bytes)?"
8986 . ./myread
8987 fpossize="$ans"
8988 fi
8989 $rm -f try.c try
8990 fi
8991 ;;
8992esac
8993
b4eb6b3d
JH
8994case "$vendorprefix" in
8995'') d_vendorbin="$undef"
8996 vendorbin=''
8997 vendorbinexp=''
8998 ;;
8999*) d_vendorbin="$define"
9000 : determine where vendor-supplied executables go.
9001 case "$vendorbin" in
9002 '') dflt=$vendorprefix/bin ;;
9003 *) dflt="$vendorbin" ;;
9004 esac
9005 fn=d~+
9006 rp='Pathname for the vendor-supplied executables directory?'
9007 . ./getfile
9008 vendorbin="$ans"
9009 vendorbinexp="$ansexp"
9010 ;;
9011esac
9012: Change installation prefix, if necessary.
9013if $test X"$prefix" != X"$installprefix"; then
9014 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9015else
9016 installvendorbin="$vendorbinexp"
9017fi
9018
6e1038e0 9019case "$vendorprefix" in
3bb95762
JH
9020'') vendorhtml1dir=''
9021 vendorhtml1direxp=''
6e1038e0
MB
9022 ;;
9023*) : determine where vendor-supplied html pages go.
9024 : There is no standard location, so try to copy the previously-selected
9025 : directory structure for the core html pages.
9026 : XXX Better default suggestions would be welcome.
3bb95762 9027 case "$vendorhtml1dir" in
6e1038e0 9028 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
3bb95762 9029 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9030 esac
9031 case "$dflt" in
9032 ''|' ') dflt=none ;;
9033 esac
9034 fn=dn+~
9035 rp='Pathname for the vendor-supplied html pages?'
9036 . ./getfile
3bb95762
JH
9037 vendorhtml1dir="$ans"
9038 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9039 ;;
9040esac
9041: Use ' ' for none so value is preserved next time through Configure
3bb95762 9042$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
6e1038e0
MB
9043: Change installation prefix, if necessary.
9044if $test X"$prefix" != X"$installprefix"; then
3bb95762 9045 installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 9046else
3bb95762 9047 installvendorhtml1dir="$vendorhtml1direxp"
6e1038e0
MB
9048fi
9049
9050case "$vendorprefix" in
3bb95762
JH
9051'') vendorhtml3dir=''
9052 vendorhtml3direxp=''
6e1038e0
MB
9053 ;;
9054*) : determine where vendor-supplied module html pages go.
9055 : There is no standard location, so try to copy the previously-selected
9056 : directory structure for the core html pages.
9057 : XXX Better default suggestions would be welcome.
3bb95762 9058 case "$vendorhtml3dir" in
6e1038e0 9059 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
3bb95762 9060 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9061 esac
9062 case "$dflt" in
9063 ''|' ') dflt=none ;;
9064 esac
9065 fn=dn+~
9066 rp='Pathname for the vendor-supplied html pages?'
9067 . ./getfile
3bb95762
JH
9068 vendorhtml3dir="$ans"
9069 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9070 ;;
9071esac
9072: Use ' ' for none so value is preserved next time through Configure
3bb95762 9073$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
6e1038e0
MB
9074: Change installation prefix, if necessary.
9075if $test X"$prefix" != X"$installprefix"; then
3bb95762 9076 installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 9077else
3bb95762 9078 installvendorhtml3dir="$vendorhtml3direxp"
6e1038e0
MB
9079fi
9080
9081case "$vendorprefix" in
3bb95762
JH
9082'') vendorman1dir=''
9083 vendorman1direxp=''
6e1038e0
MB
9084 ;;
9085*) : determine where vendor-supplied manual pages go.
3bb95762 9086 case "$vendorman1dir" in
6e1038e0 9087 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
3bb95762 9088 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9089 esac
9090 case "$dflt" in
9091 ''|' ') dflt=none ;;
9092 esac
9093 fn=nd~+
9094 rp='Pathname for the vendor-supplied manual section 1 pages?'
9095 . ./getfile
3bb95762
JH
9096 vendorman1dir="$ans"
9097 vendorman1direxp="$ansexp"
6e1038e0
MB
9098 ;;
9099esac
9100: Use ' ' for none so value is preserved next time through Configure
3bb95762 9101$test X"$vendorman1dir" = "X" && vendorman1dir=' '
6e1038e0
MB
9102: Change installation prefix, if necessary.
9103if $test X"$prefix" != X"$installprefix"; then
3bb95762 9104 installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefix#$installprefix#"`
6e1038e0 9105else
3bb95762 9106 installvendorman1dir="$vendorman1direxp"
6e1038e0
MB
9107fi
9108
9109case "$vendorprefix" in
3bb95762
JH
9110'') vendorman3dir=''
9111 vendorman3direxp=''
6e1038e0
MB
9112 ;;
9113*) : determine where vendor-supplied module manual pages go.
3bb95762 9114 case "$vendorman3dir" in
6e1038e0 9115 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
3bb95762 9116 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9117 esac
9118 case "$dflt" in
9119 ''|' ') dflt=none ;;
9120 esac
9121 fn=nd~+
9122 rp='Pathname for the vendor-supplied manual section 3 pages?'
9123 . ./getfile
3bb95762
JH
9124 vendorman3dir="$ans"
9125 vendorman3direxp="$ansexp"
6e1038e0
MB
9126 ;;
9127esac
9128: Use ' ' for none so value is preserved next time through Configure
3bb95762 9129$test X"$vendorman3dir" = "X" && vendorman3dir=' '
6e1038e0
MB
9130: Change installation prefix, if necessary.
9131if $test X"$prefix" != X"$installprefix"; then
3bb95762 9132 installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefix#$installprefix#"`
6e1038e0 9133else
3bb95762 9134 installvendorman3dir="$vendorman3direxp"
6e1038e0
MB
9135fi
9136
9137case "$vendorprefix" in
9138'') d_vendorscript="$undef"
9139 vendorscript=''
9140 vendorscriptexp=''
9141 ;;
9142*) d_vendorscript="$define"
9143 : determine where vendor-supplied scripts go.
9144 case "$vendorscript" in
9145 '') dflt=$vendorprefix/script
9146 $test -d $dflt || dflt=$vendorbin ;;
9147 *) dflt="$vendorscript" ;;
9148 esac
9149 $cat <<EOM
9150
9151The installation process will create a directory for
9152vendor-supplied scripts.
9153
9154EOM
9155 fn=d~+
9156 rp='Pathname for the vendor-supplied scripts directory?'
9157 . ./getfile
9158 vendorscript="$ans"
9159 vendorscriptexp="$ansexp"
9160 ;;
9161esac
9162: Change installation prefix, if necessary.
9163if $test X"$prefix" != X"$installprefix"; then
9164 installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9165else
5a29c6bc
JH
9166 installvendorscript="$vendorscriptexp"
9167fi
9168
9169: see if qgcvt exists
9170set qgcvt d_qgcvt
9171eval $inlibc
9172
9173echo " "
9174
9175if $test X"$d_longdbl" = X"$define"; then
9176
9177echo "Checking how to print long doubles..." >&4
9178
9179if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9180 $cat >try.c <<'EOCP'
9181#include <sys/types.h>
9182#include <stdio.h>
9183int main() {
9184 double d = 123.456;
9185 printf("%.3f\n", d);
9186}
9187EOCP
9188 set try
9189 if eval $compile; then
9190 yyy=`$run ./try`
9191 case "$yyy" in
9192 123.456)
9193 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9194 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9195 echo "We will use %f."
9196 ;;
9197 esac
9198 fi
9199fi
9200
9201if $test X"$sPRIfldbl" = X; then
9202 $cat >try.c <<'EOCP'
9203#include <sys/types.h>
9204#include <stdio.h>
9205int main() {
9206 long double d = 123.456;
9207 printf("%.3Lf\n", d);
9208}
9209EOCP
9210 set try
9211 if eval $compile; then
9212 yyy=`$run ./try`
9213 case "$yyy" in
9214 123.456)
9215 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9216 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9217 echo "We will use %Lf."
9218 ;;
9219 esac
9220 fi
9221fi
9222
9223if $test X"$sPRIfldbl" = X; then
9224 $cat >try.c <<'EOCP'
9225#include <sys/types.h>
9226#include <stdio.h>
9227int main() {
9228 long double d = 123.456;
9229 printf("%.3llf\n", d);
9230}
9231EOCP
9232 set try
9233 if eval $compile; then
9234 yyy=`$run ./try`
9235 case "$yyy" in
9236 123.456)
9237 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9238 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9239 echo "We will use %llf."
9240 ;;
9241 esac
9242 fi
9243fi
9244
9245if $test X"$sPRIfldbl" = X; then
9246 $cat >try.c <<'EOCP'
9247#include <sys/types.h>
9248#include <stdio.h>
9249int main() {
9250 long double d = 123.456;
9251 printf("%.3lf\n", d);
9252}
9253EOCP
9254 set try
9255 if eval $compile; then
9256 yyy=`$run ./try`
9257 case "$yyy" in
9258 123.456)
9259 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9260 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9261 echo "We will use %lf."
9262 ;;
9263 esac
9264 fi
9265fi
9266
9267if $test X"$sPRIfldbl" = X; then
9268 echo "Cannot figure out how to print long doubles." >&4
9269else
9270 sSCNfldbl=$sPRIfldbl # expect consistency
6e1038e0
MB
9271fi
9272
5a29c6bc
JH
9273$rm -f try try.*
9274
9275fi # d_longdbl
9276
9277case "$sPRIfldbl" in
9278'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9279 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9280 d_SCNfldbl="$undef";
9281 ;;
9282*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9283 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9284 d_SCNfldbl="$define";
9285 ;;
9286esac
b4eb6b3d 9287
b4eb6b3d 9288: Check how to convert floats to strings.
a5b10d80
YST
9289
9290if test "X$d_Gconvert" = X; then
9291
b4eb6b3d
JH
9292echo " "
9293echo "Checking for an efficient way to convert floats to strings."
9294echo " " > try.c
9295case "$uselongdouble" in
9296"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9297esac
9298case "$d_longdbl" in
9299"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9300esac
9301case "$d_PRIgldbl" in
9302"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9303esac
9304$cat >>try.c <<EOP
9305#ifdef TRY_gconvert
9306#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9307char *myname = "gconvert";
9308#endif
9309#ifdef TRY_gcvt
9310#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9311char *myname = "gcvt";
9312#endif
9313#ifdef TRY_qgcvt
9314#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9315char *myname = "qgcvt";
9316#define DOUBLETYPE long double
9317#endif
9318#ifdef TRY_sprintf
a5b10d80
YST
9319#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9320#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9321#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9322#else
a5b10d80
YST
9323#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9324#endif
9325#else
b4eb6b3d
JH
9326#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9327#endif
9328char *myname = "sprintf";
9329#endif
9330
9331#ifndef DOUBLETYPE
9332#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9333#define DOUBLETYPE long double
9334#else
9335#define DOUBLETYPE double
9336#endif
9337#endif
9338
9339#include <stdio.h>
9340
9341#define I_STDLIB $i_stdlib
9342#ifdef I_STDLIB
9343#include <stdlib.h>
9344#endif
9345
9346int
9347checkit(expect, got)
9348char *expect;
9349char *got;
9350{
9351 if (strcmp(expect, got)) {
9352 printf("%s oddity: Expected %s, got %s\n",
9353 myname, expect, got);
9354 exit(1);
9355 }
9356}
9357
9358int main()
9359{
9360 char buf[64];
9361 buf[63] = '\0';
9362
9363 /* This must be 1st test on (which?) platform */
9364 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9365 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9366 checkit("0.1", buf);
9367
a5b10d80
YST
9368 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9369 checkit("0.01", buf);
9370
9371 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9372 checkit("0.001", buf);
9373
9374 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9375 checkit("0.0001", buf);
9376
9377 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9378 if (strlen(buf) > 5)
9379 checkit("9e-005", buf); /* for Microsoft ?? */
9380 else
9381 checkit("9e-05", buf);
9382
b4eb6b3d
JH
9383 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9384 checkit("1", buf);
9385
9386 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9387 checkit("1.1", buf);
9388
9389 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9390 checkit("1.01", buf);
9391
9392 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9393 checkit("1.001", buf);
9394
9395 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9396 checkit("1.0001", buf);
9397
9398 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9399 checkit("1.00001", buf);
9400
9401 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9402 checkit("1.000001", buf);
9403
9404 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9405 checkit("0", buf);
9406
9407 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9408 checkit("-1", buf);
9409
9410 /* Some Linux gcvt's give 1.e+5 here. */
9411 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9412 checkit("100000", buf);
9413
9414 /* Some Linux gcvt's give -1.e+5 here. */
9415 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9416 checkit("-100000", buf);
9417
9418 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9419 checkit("123.456", buf);
9420
ab6ca9f4 9421 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9422 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9423 /* 34 should be enough to scare even long double
9424 * places into using the e notation. */
ab6ca9f4 9425 if (strlen(buf) > 5)
94b339ad 9426 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9427 else
94b339ad 9428 checkit("1e+34", buf);
8e2a5ede 9429
d1eb8299
YST
9430 /* For Perl, if you add additional tests here, also add them to
9431 * t/base/num.t for benefit of platforms not using Configure or
9432 * overriding d_Gconvert */
9433
b4eb6b3d
JH
9434 exit(0);
9435}
9436EOP
ab6ca9f4 9437: first add preferred functions to our list
a5b10d80 9438xxx_list=""
ab6ca9f4 9439for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9440 case $xxx_convert in
9441 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9442 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
a5b10d80
YST
9443 esac
9444done
9445: then add any others
9446for xxx_convert in gconvert gcvt sprintf; do
9447 case "$xxx_list" in
9448 *$xxx_convert*) ;;
9449 *) xxx_list="$xxx_list $xxx_convert" ;;
9450 esac
9451done
9452
9453case "$d_longdbl$uselongdouble" in
9454"$define$define")
9455 : again, add prefered functions to our list first
9456 xxx_ld_list=""
ab6ca9f4 9457 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9458 case $xxx_convert in
9459 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9460 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9461 esac
9462 done
9463 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9464 for xxx_convert in qgcvt sprintf $xxx_list; do
9465 case "$xxx_ld_list" in
9466 $xxx_convert*|*" $xxx_convert"*) ;;
9467 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9468 esac
9469 done
9470 : if sprintf cannot do long doubles, move it to the end
9471 if test "$d_PRIgldbl" != "$define"; then
9472 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9473 fi
9474 : if no qgcvt, remove it
9475 if test "$d_qgcvt" != "$define"; then
9476 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9477 fi
9478 : use the ld_list
9479 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9480 ;;
9481esac
9482
9483for xxx_convert in $xxx_list; do
9484 echo "Trying $xxx_convert..."
9485 $rm -f try try$_o
9486 set try -DTRY_$xxx_convert
9487 if eval $compile; then
9488 echo "$xxx_convert() found." >&4
5440bc8e 9489 if $run ./try; then
b4eb6b3d
JH
9490 echo "I'll use $xxx_convert to convert floats into a string." >&4
9491 break;
9492 else
9493 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9494 xxx_convert=''
b4eb6b3d
JH
9495 fi
9496 else
9497 echo "$xxx_convert NOT found." >&4
9498 fi
9499done
ab6ca9f4 9500
a5b10d80
YST
9501if test X$xxx_convert = X; then
9502 echo "*** WHOA THERE!!! ***" >&4
9503 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9504 xxx_convert=sprintf
9505fi
9506
b4eb6b3d
JH
9507case "$xxx_convert" in
9508gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9509gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9510qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9511*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9512 "$define$define$define")
9513 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9514 "$define$define$undef")
9515 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9516 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9517 esac
9518 ;;
9519esac
9520
a5b10d80
YST
9521fi
9522
74cac757
JH
9523: see if _fwalk exists
9524set fwalk d__fwalk
9525eval $inlibc
9526
b4eb6b3d
JH
9527: Initialize h_fcntl
9528h_fcntl=false
9529
9530: Initialize h_sysfile
9531h_sysfile=false
9532
9533: access call always available on UNIX
9534set access d_access
9535eval $inlibc
9536
9537: locate the flags for 'access()'
9538case "$d_access" in
9539"$define")
9540 echo " "
5a29c6bc 9541 $cat >access.c <<EOCP
b4eb6b3d
JH
9542#include <sys/types.h>
9543#ifdef I_FCNTL
9544#include <fcntl.h>
9545#endif
9546#ifdef I_SYS_FILE
9547#include <sys/file.h>
9548#endif
9549#ifdef I_UNISTD
9550#include <unistd.h>
9551#endif
5a29c6bc
JH
9552#$i_stdlib I_STDLIB
9553#ifdef I_STDLIB
9554#include <stdlib.h>
9555#endif
b4eb6b3d
JH
9556int main() {
9557 exit(R_OK);
9558}
9559EOCP
9560 : check sys/file.h first, no particular reason here
9561 if $test `./findhdr sys/file.h` && \
7a282f6d 9562 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9563 h_sysfile=true;
9564 echo "<sys/file.h> defines the *_OK access constants." >&4
9565 elif $test `./findhdr fcntl.h` && \
7a282f6d 9566 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9567 h_fcntl=true;
9568 echo "<fcntl.h> defines the *_OK access constants." >&4
9569 elif $test `./findhdr unistd.h` && \
7a282f6d 9570 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9571 echo "<unistd.h> defines the *_OK access constants." >&4
9572 else
9573 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9574 fi
9575 ;;
9576esac
9577$rm -f access*
9578
9579: see if accessx exists
9580set accessx d_accessx
9581eval $inlibc
9582
5a29c6bc
JH
9583: see if aintl exists
9584set aintl d_aintl
9585eval $inlibc
9586
b4eb6b3d
JH
9587: see if alarm exists
9588set alarm d_alarm
9589eval $inlibc
9590
a9dade78
JH
9591: see if POSIX threads are available
9592set pthread.h i_pthread
9593eval $inhdr
9594
10bc17b6
JH
9595: define a fucntion to check prototypes
9596$cat > protochk <<EOSH
9597$startsh
9598cc="$cc"
9599optimize="$optimize"
9600ccflags="$ccflags"
9601prototype="$prototype"
9602define="$define"
9603rm=$rm
a9dade78
JH
9604usethreads=$usethreads
9605i_pthread=$i_pthread
9606pthread_h_first=$pthread_h_first
10bc17b6
JH
9607EOSH
9608
9609$cat >> protochk <<'EOSH'
9610
9611$rm -f try.c
9612foo="$1"
9613shift
9614while test $# -ge 2; do
9615 case "$1" in
9616 $define) echo "#include <$2>" >> try.c ;;
9617 literal) echo "$2" >> try.c ;;
9618 esac
cce6a207
MB
9619 # Extra magic for the benefit of systems that need pthread.h
9620 # to be included early to correctly detect threadsafe functions.
9621 # Such functions must guarantee themselves, though, that the usethreads
9622 # and i_pthread have been defined, before calling protochk.
9623 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9624 echo "#include <pthread.h>" >> try.c
9625 pthread_h_done=yes
9626 fi
10bc17b6
JH
9627 shift 2
9628done
9629test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
9630cat >> try.c <<'EOCP'
9631#ifdef CAN_PROTOTYPE
9632#define _(args) args
9633#else
9634#define _(args) ()
9635#endif
9636EOCP
9637echo "$foo" >> try.c
9638echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9639$cc $optimize $ccflags -c try.c > /dev/null 2>&1
9640status=$?
9641$rm -f try.[co]
9642exit $status
9643EOSH
9644chmod +x protochk
9645$eunicefix protochk
9646
5a29c6bc
JH
9647hasproto='varname=$1; func=$2; shift; shift;
9648while $test $# -ge 2; do
9649 case "$1" in
9650 $define) echo "#include <$2>";;
9651 esac ;
9652 shift 2;
9653done > try.c;
9654$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9655if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9656 echo "$func() prototype found.";
9657 val="$define";
9658else
9659 echo "$func() prototype NOT found.";
9660 val="$undef";
9661fi;
9662set $varname;
9663eval $setvar;
9664$rm -f try.c tryout.c'
9665
10bc17b6
JH
9666: see if sys/types.h has to be included
9667set sys/types.h i_systypes
9668eval $inhdr
9669
9670: see if sys/select.h has to be included
9671set sys/select.h i_sysselct
9672eval $inhdr
9673
9674hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9675while $test $# -ge 2; do
9676 case "$1" in
9677 $define) echo "#include <$2>";;
9678 esac ;
9679 shift 2;
9680done > try.c;
9681echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9682set try;
9683if eval $compile; then
9684 val="$define";
9685else
9686 val="$undef";
9687fi;
9688set $varname;
9689eval $setvar;
9690$rm -f try.c try.o'
9691
9692: see if we should include time.h, sys/time.h, or both
9693echo " "
9694if test "X$timeincl" = X; then
9695 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9696 $echo $n "I'm now running the test program...$c"
5a29c6bc 9697 $cat >try.c <<EOCP
10bc17b6
JH
9698#include <sys/types.h>
9699#ifdef I_TIME
9700#include <time.h>
9701#endif
9702#ifdef I_SYSTIME
9703#ifdef SYSTIMEKERNEL
9704#define KERNEL
9705#endif
9706#include <sys/time.h>
9707#endif
9708#ifdef I_SYSSELECT
9709#include <sys/select.h>
9710#endif
5a29c6bc
JH
9711#$i_stdlib I_STDLIB
9712#ifdef I_STDLIB
9713#include <stdlib.h>
9714#endif
10bc17b6
JH
9715int main()
9716{
9717 struct tm foo;
9718#ifdef S_TIMEVAL
9719 struct timeval bar;
9720#endif
9721#ifdef S_TIMEZONE
9722 struct timezone tzp;
9723#endif
9724 if (foo.tm_sec == foo.tm_sec)
9725 exit(0);
9726#ifdef S_TIMEVAL
9727 if (bar.tv_sec == bar.tv_sec)
9728 exit(0);
9729#endif
9730 exit(1);
9731}
9732EOCP
9733 flags=''
9734 for s_timezone in '-DS_TIMEZONE' ''; do
9735 sysselect=''
9736 for s_timeval in '-DS_TIMEVAL' ''; do
9737 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9738 for i_time in '' '-DI_TIME'; do
9739 for i_systime in '-DI_SYSTIME' ''; do
9740 case "$flags" in
9741 '') $echo $n ".$c"
9742 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9743 if eval $compile; then
9744 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9745 shift
9746 flags="$*"
9747 echo " "
9748 $echo $n "Succeeded with $flags$c"
9749 fi
9750 ;;
9751 esac
9752 done
9753 done
9754 done
9755 done
9756 done
9757 timeincl=''
9758 echo " "
9759 case "$flags" in
9760 *SYSTIMEKERNEL*) i_systimek="$define"
9761 timeincl=`./findhdr sys/time.h`
9762 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9763 *) i_systimek="$undef";;
9764 esac
9765 case "$flags" in
9766 *I_TIME*) i_time="$define"
9767 timeincl=`./findhdr time.h`" $timeincl"
9768 echo "We'll include <time.h>." >&4;;
9769 *) i_time="$undef";;
9770 esac
9771 case "$flags" in
9772 *I_SYSTIME*) i_systime="$define"
9773 timeincl=`./findhdr sys/time.h`" $timeincl"
9774 echo "We'll include <sys/time.h>." >&4;;
9775 *) i_systime="$undef";;
9776 esac
9777 $rm -f try.c try
9778fi
9779: see if struct tm knows about tm_zone
9780case "$i_systime$i_time" in
9781*$define*)
9782 echo " "
9783 echo "Checking to see if your struct tm has tm_zone field..." >&4
9784 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9785 eval $hasfield
9786 ;;
9787*) val="$undef"
9788 set d_tm_tm_zone
9789 eval $setvar
9790 ;;
9791esac
9792case "$d_tm_tm_zone" in
9793"$define") echo "Yes, it does." ;;
9794*) echo "No, it doesn't." ;;
9795esac
9796: see if struct tm knows about tm_gmtoff
9797case "$i_systime$i_time" in
9798*$define*)
9799 echo " "
9800 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9801 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9802 eval $hasfield
9803 ;;
9804*) val="$undef"
9805 set d_tm_tm_gmtoff
9806 eval $setvar
9807 ;;
9808esac
9809case "$d_tm_tm_gmtoff" in
9810"$define") echo "Yes, it does." ;;
9811*) echo "No, it doesn't." ;;
9812esac
9813
9814: see if asctime_r exists
9815set asctime_r d_asctime_r
9816eval $inlibc
9817case "$d_asctime_r" in
9818"$define")
d63eadf0 9819 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
9820 case "$d_asctime_r_proto:$usethreads" in
9821 ":define") d_asctime_r_proto=define
a48ec845
JH
9822 set d_asctime_r_proto asctime_r $hdrs
9823 eval $hasproto ;;
9824 *) ;;
9825 esac
9826 case "$d_asctime_r_proto" in
9827 define)
10bc17b6
JH
9828 case "$asctime_r_proto" in
9829 ''|0) try='char* asctime_r(const struct tm*, char*);'
9830 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9831 esac
9832 case "$asctime_r_proto" in
9833 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9834 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9835 esac
9836 case "$asctime_r_proto" in
9837 ''|0) try='int asctime_r(const struct tm*, char*);'
9838 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9839 esac
9840 case "$asctime_r_proto" in
9841 ''|0) try='int asctime_r(const struct tm*, char*, int);'
9842 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9843 esac
9844 case "$asctime_r_proto" in
90e831dc 9845 ''|0) d_asctime_r=undef
10bc17b6 9846 asctime_r_proto=0
a48ec845 9847 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
9848 * ) case "$asctime_r_proto" in
9849 REENTRANT_PROTO*) ;;
9850 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9851 esac
9852 echo "Prototype: $try" ;;
9853 esac
9854 ;;
c18e646a
JH
9855 *) case "$usethreads" in
9856 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9857 esac
90e831dc
SB
9858 d_asctime_r=undef
9859 asctime_r_proto=0
c18e646a 9860 ;;
a48ec845
JH
9861 esac
9862 ;;
10bc17b6
JH
9863*) asctime_r_proto=0
9864 ;;
9865esac
9866
b4eb6b3d
JH
9867: see if atolf exists
9868set atolf d_atolf
9869eval $inlibc
9870
9871: see if atoll exists
9872set atoll d_atoll
9873eval $inlibc
9874
9875: Look for GNU-cc style attribute checking
80512072
NC
9876case "$d_attribut" in
9877'')
b4eb6b3d
JH
9878echo " "
9879echo "Checking whether your compiler can handle __attribute__ ..." >&4
9880$cat >attrib.c <<'EOCP'
9881#include <stdio.h>
f7288ffb 9882void croak (char* pat,...) __attribute__((__format__(__printf__,1,2),noreturn));
b4eb6b3d
JH
9883EOCP
9884if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9885 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9886 echo "Your C compiler doesn't fully support __attribute__."
9887 val="$undef"
9888 else
9889 echo "Your C compiler supports __attribute__."
9890 val="$define"
9891 fi
9892else
9893 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9894 val="$undef"
9895fi
80512072
NC
9896;;
9897*) val="$d_attribut" ;;
9898esac
b4eb6b3d
JH
9899set d_attribut
9900eval $setvar
9901$rm -f attrib*
9902
9903: see if bcmp exists
9904set bcmp d_bcmp
9905eval $inlibc
9906
9907: see if bcopy exists
9908set bcopy d_bcopy
9909eval $inlibc
9910
9911: see if this is a unistd.h system
9912set unistd.h i_unistd
9913eval $inhdr
9914
9915: see if getpgrp exists
9916set getpgrp d_getpgrp
9917eval $inlibc
9918
9919case "$d_getpgrp" in
9920"$define")
9921 echo " "
9922 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 9923 $cat >try.c <<EOP
b4eb6b3d
JH
9924#$i_unistd I_UNISTD
9925#include <sys/types.h>
9926#ifdef I_UNISTD
9927# include <unistd.h>
9928#endif
5a29c6bc
JH
9929#$i_stdlib I_STDLIB
9930#ifdef I_STDLIB
9931#include <stdlib.h>
9932#endif
b4eb6b3d
JH
9933int main()
9934{
9935 if (getuid() == 0) {
9936 printf("(I see you are running Configure as super-user...)\n");
9937 setuid(1);
9938 }
9939#ifdef TRY_BSD_PGRP
9940 if (getpgrp(1) == 0)
9941 exit(0);
9942#else
9943 if (getpgrp() > 0)
9944 exit(0);
9945#endif
9946 exit(1);
9947}
9948EOP
5440bc8e 9949 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9950 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9951 val="$define"
5440bc8e 9952 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
9953 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9954 val="$undef"
9955 else
9956 echo "I can't seem to compile and run the test program."
9957 if ./usg; then
9958 xxx="a USG one, i.e. you use getpgrp()."
9959 else
9960 # SVR4 systems can appear rather BSD-ish.
9961 case "$i_unistd" in
9962 $undef)
9963 xxx="a BSD one, i.e. you use getpgrp(pid)."
9964 val="$define"
9965 ;;
9966 $define)
9967 xxx="probably a USG one, i.e. you use getpgrp()."
9968 val="$undef"
9969 ;;
9970 esac
9971 fi
9972 echo "Assuming your getpgrp is $xxx" >&4
9973 fi
9974 ;;
9975*) val="$undef";;
9976esac
9977set d_bsdgetpgrp
9978eval $setvar
5440bc8e 9979$rm -f try try.*
b4eb6b3d
JH
9980
9981: see if setpgrp exists
9982set setpgrp d_setpgrp
9983eval $inlibc
9984
9985case "$d_setpgrp" in
9986"$define")
9987 echo " "
9988 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 9989 $cat >try.c <<EOP
b4eb6b3d
JH
9990#$i_unistd I_UNISTD
9991#include <sys/types.h>
9992#ifdef I_UNISTD
9993# include <unistd.h>
9994#endif
5a29c6bc
JH
9995#$i_stdlib I_STDLIB
9996#ifdef I_STDLIB
9997#include <stdlib.h>
9998#endif
b4eb6b3d
JH
9999int main()
10000{
10001 if (getuid() == 0) {
10002 printf("(I see you are running Configure as super-user...)\n");
10003 setuid(1);
10004 }
10005#ifdef TRY_BSD_PGRP
10006 if (-1 == setpgrp(1, 1))
10007 exit(0);
10008#else
10009 if (setpgrp() != -1)
10010 exit(0);
10011#endif
10012 exit(1);
10013}
10014EOP
5440bc8e 10015 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10016 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10017 val="$define"
5440bc8e 10018 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10019 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10020 val="$undef"
10021 else
10022 echo "(I can't seem to compile and run the test program.)"
10023 if ./usg; then
10024 xxx="a USG one, i.e. you use setpgrp()."
10025 else
10026 # SVR4 systems can appear rather BSD-ish.
10027 case "$i_unistd" in
10028 $undef)
10029 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10030 val="$define"
10031 ;;
10032 $define)
10033 xxx="probably a USG one, i.e. you use setpgrp()."
10034 val="$undef"
10035 ;;
10036 esac
10037 fi
10038 echo "Assuming your setpgrp is $xxx" >&4
10039 fi
10040 ;;
10041*) val="$undef";;
10042esac
10043set d_bsdsetpgrp
10044eval $setvar
5440bc8e 10045$rm -f try try.*
b4eb6b3d
JH
10046: see if bzero exists
10047set bzero d_bzero
10048eval $inlibc
10049
10050: see if signal is declared as pointer to function returning int or void
10051echo " "
10052xxx=`./findhdr signal.h`
10053$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10054if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10055 echo "You have int (*signal())() instead of void." >&4
10056 val="$undef"
10057elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10058 echo "You have void (*signal())()." >&4
10059 val="$define"
10060elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10061 echo "You have int (*signal())() instead of void." >&4
10062 val="$undef"
10063elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10064 echo "You have void (*signal())()." >&4
10065 val="$define"
10066else
10067 case "$d_voidsig" in
10068 '')
10069 echo "I can't determine whether signal handler returns void or int..." >&4
10070 dflt=void
10071 rp="What type does your signal handler return?"
10072 . ./myread
10073 case "$ans" in
10074 v*) val="$define";;
10075 *) val="$undef";;
10076 esac;;
10077 "$define")
10078 echo "As you already told me, signal handler returns void." >&4
10079 val="$define"
10080 ;;
10081 *) echo "As you already told me, signal handler returns int." >&4
10082 val="$undef"
10083 ;;
10084 esac
10085fi
10086set d_voidsig
10087eval $setvar
10088case "$d_voidsig" in
10089"$define") signal_t="void";;
10090*) signal_t="int";;
10091esac
10092$rm -f $$.tmp
10093
10094: check for ability to cast large floats to 32-bit ints.
10095echo " "
10096echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10097if $test "$intsize" -ge 4; then
10098 xxx=int
10099else
10100 xxx=long
10101fi
10102$cat >try.c <<EOCP
10103#include <stdio.h>
5ed858ef
JH
10104#$i_stdlib I_STDLIB
10105#ifdef I_STDLIB
10106#include <stdlib.h>
10107#endif
b4eb6b3d
JH
10108#include <sys/types.h>
10109#include <signal.h>
10110$signal_t blech(s) int s; { exit(3); }
10111int main()
10112{
10113 $xxx i32;
10114 double f, g;
10115 int result = 0;
10116 char str[16];
10117 signal(SIGFPE, blech);
10118
10119 /* Don't let compiler optimize the test away. Store the number
10120 in a writable string for gcc to pass to sscanf under HP/UX.
10121 */
10122 sprintf(str, "2147483647");
10123 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10124 g = 10 * f;
10125 i32 = ($xxx) g;
10126
10127 /* x86 processors will probably give 0x8000 0000, which is a
7db0018a 10128 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
10129 behavior here, which is to preserve the sign and give
10130 back 0x7fff ffff.
10131 */
10132 if (i32 != ($xxx) f)
10133 result |= 1;
10134 exit(result);
10135}
10136EOCP
10137set try
10138if eval $compile_ok; then
5440bc8e 10139 $run ./try
b4eb6b3d
JH
10140 yyy=$?
10141else
10142 echo "(I can't seem to compile the test program--assuming it can't)"
10143 yyy=1
10144fi
10145case "$yyy" in
101460) val="$define"
10147 echo "Yup, it can."
10148 ;;
10149*) val="$undef"
10150 echo "Nope, it can't."
10151 ;;
10152esac
10153set d_casti32
10154eval $setvar
10155$rm -f try try.*
10156
10157: check for ability to cast negative floats to unsigned
10158echo " "
10159echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10160$cat >try.c <<EOCP
10161#include <stdio.h>
5ed858ef
JH
10162#$i_stdlib I_STDLIB
10163#ifdef I_STDLIB
10164#include <stdlib.h>
10165#endif
b4eb6b3d
JH
10166#include <sys/types.h>
10167#include <signal.h>
10168$signal_t blech(s) int s; { exit(7); }
10169$signal_t blech_in_list(s) int s; { exit(4); }
10170unsigned long dummy_long(p) unsigned long p; { return p; }
10171unsigned int dummy_int(p) unsigned int p; { return p; }
10172unsigned short dummy_short(p) unsigned short p; { return p; }
10173int main()
10174{
10175 double f;
10176 unsigned long along;
10177 unsigned int aint;
10178 unsigned short ashort;
10179 int result = 0;
10180 char str[16];
10181
10182 /* Frustrate gcc-2.7.2's optimizer which failed this test with
10183 a direct f = -123. assignment. gcc-2.8.0 reportedly
10184 optimized the whole file away
10185 */
10186 /* Store the number in a writable string for gcc to pass to
10187 sscanf under HP/UX.
10188 */
10189 sprintf(str, "-123");
10190 sscanf(str, "%lf", &f); /* f = -123.; */
10191
10192 signal(SIGFPE, blech);
10193 along = (unsigned long)f;
10194 aint = (unsigned int)f;
10195 ashort = (unsigned short)f;
10196 if (along != (unsigned long)-123)
10197 result |= 1;
10198 if (aint != (unsigned int)-123)
10199 result |= 1;
10200 if (ashort != (unsigned short)-123)
10201 result |= 1;
10202 sprintf(str, "1073741824.");
10203 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10204 f = f + f;
10205 along = 0;
10206 along = (unsigned long)f;
10207 if (along != 0x80000000)
10208 result |= 2;
10209 f -= 1.;
10210 along = 0;
10211 along = (unsigned long)f;
10212 if (along != 0x7fffffff)
10213 result |= 1;
10214 f += 2.;
10215 along = 0;
10216 along = (unsigned long)f;
10217 if (along != 0x80000001)
10218 result |= 2;
10219 if (result)
10220 exit(result);
10221 signal(SIGFPE, blech_in_list);
10222 sprintf(str, "123.");
10223 sscanf(str, "%lf", &f); /* f = 123.; */
10224 along = dummy_long((unsigned long)f);
10225 aint = dummy_int((unsigned int)f);
10226 ashort = dummy_short((unsigned short)f);
10227 if (along != (unsigned long)123)
10228 result |= 4;
10229 if (aint != (unsigned int)123)
10230 result |= 4;
10231 if (ashort != (unsigned short)123)
10232 result |= 4;
10233 exit(result);
10234
10235}
10236EOCP
10237set try
10238if eval $compile_ok; then
5440bc8e 10239 $run ./try
b4eb6b3d
JH
10240 castflags=$?
10241else
10242 echo "(I can't seem to compile the test program--assuming it can't)"
10243 castflags=7
10244fi
10245case "$castflags" in
102460) val="$define"
10247 echo "Yup, it can."
10248 ;;
10249*) val="$undef"
10250 echo "Nope, it can't."
10251 ;;
10252esac
10253set d_castneg
10254eval $setvar
10255$rm -f try.*
10256
10257: see if vprintf exists
10258echo " "
10259if set vprintf val -f d_vprintf; eval $csym; $val; then
10260 echo 'vprintf() found.' >&4
10261 val="$define"
5a29c6bc 10262 $cat >try.c <<EOF
b4eb6b3d 10263#include <varargs.h>
5a29c6bc
JH
10264#$i_stdlib I_STDLIB
10265#ifdef I_STDLIB
10266#include <stdlib.h>
10267#endif
b4eb6b3d
JH
10268
10269int main() { xxx("foo"); }
10270
10271xxx(va_alist)
10272va_dcl
10273{
10274 va_list args;
10275 char buf[10];
10276
10277 va_start(args);
10278 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10279}
10280EOF
5440bc8e
JH
10281 set try
10282 if eval $compile && $run ./try; then
b4eb6b3d
JH
10283 echo "Your vsprintf() returns (int)." >&4
10284 val2="$undef"
10285 else
10286 echo "Your vsprintf() returns (char*)." >&4
10287 val2="$define"
10288 fi
10289else
10290 echo 'vprintf() NOT found.' >&4
10291 val="$undef"
10292 val2="$undef"
10293fi
5440bc8e 10294$rm -f try try.*
b4eb6b3d
JH
10295set d_vprintf
10296eval $setvar
10297val=$val2
10298set d_charvspr
10299eval $setvar
10300
10301: see if chown exists
10302set chown d_chown
10303eval $inlibc
10304
10305: see if chroot exists
10306set chroot d_chroot
10307eval $inlibc
10308
10309: see if chsize exists
10310set chsize d_chsize
10311eval $inlibc
10312
758a5d79
JH
10313: see if class exists
10314set class d_class
10315eval $inlibc
10316
4e0554ec
JH
10317hasstruct='varname=$1; struct=$2; shift; shift;
10318while $test $# -ge 2; do
10319 case "$1" in
10320 $define) echo "#include <$2>";;
10321 esac ;
10322 shift 2;
10323done > try.c;
10324echo "int main () { struct $struct foo; }" >> try.c;
10325set try;
10326if eval $compile; then
10327 val="$define";
10328else
10329 val="$undef";
10330fi;
10331set $varname;
10332eval $setvar;
10333$rm -f try.c try.o'
10334
4e0554ec
JH
10335socketlib=''
10336sockethdr=''
10337: see whether socket exists
10338echo " "
10339$echo $n "Hmm... $c" >&4
10340if set socket val -f d_socket; eval $csym; $val; then
10341 echo "Looks like you have Berkeley networking support." >&4
10342 d_socket="$define"
10343 if set setsockopt val -f; eval $csym; $val; then
10344 d_oldsock="$undef"
10345 else
10346 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10347 d_oldsock="$define"
10348 fi
10349else
10350 if $contains socklib libc.list >/dev/null 2>&1; then
10351 echo "Looks like you have Berkeley networking support." >&4
10352 d_socket="$define"
10353 : we will have to assume that it supports the 4.2 BSD interface
10354 d_oldsock="$undef"
10355 else
10356 echo "You don't have Berkeley networking in libc$_a..." >&4
10357 if test "X$d_socket" = "X$define"; then
10358 echo "...but you seem to believe that you have sockets." >&4
10359 else
10360 for net in net socket
10361 do
10362 if test -f /usr/lib/lib$net$_a; then
10363 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
10364 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10365 if $contains socket libc.list >/dev/null 2>&1; then
10366 d_socket="$define"
10367 socketlib="-l$net"
10368 case "$net" in
10369 net)
10370 echo "...but the Wollongong group seems to have hacked it in." >&4
10371 sockethdr="-I/usr/netinclude"
10372 ;;
10373 esac
3c728e00 10374 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
10375 if $contains setsockopt libc.list >/dev/null 2>&1; then
10376 d_oldsock="$undef"
10377 else
10378 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10379 d_oldsock="$define"
10380 fi
10381 break
10382 fi
10383 fi
10384 done
10385 if test "X$d_socket" != "X$define"; then
10386 echo "or anywhere else I see." >&4
10387 d_socket="$undef"
10388 d_oldsock="$undef"
10389 fi
10390 fi
10391 fi
10392fi
10393
10394: see if socketpair exists
10395set socketpair d_sockpair
10396eval $inlibc
10397
10398
10399echo " "
3c728e00 10400echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
10401for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10402 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10403 $cat >try.c <<EOF
10404#include <sys/types.h>
10405#include <sys/socket.h>
10406int main() {
10407 int i = $ENUM;
10408}
10409EOF
10410 val="$undef"
10411 set try; if eval $compile; then
10412 val="$define"
10413 fi
10414 set d_${enum}; eval $setvar
10415 $rm -f try.c try
10416done
10417
10418: see if this is a sys/uio.h system
10419set sys/uio.h i_sysuio
10420eval $inhdr
10421
10422
10423echo " "
10424echo "Checking to see if your system supports struct cmsghdr..." >&4
10425set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10426eval $hasstruct
10427case "$d_cmsghdr_s" in
10428"$define") echo "Yes, it does." ;;
10429*) echo "No, it doesn't." ;;
10430esac
10431
10432
b4eb6b3d
JH
10433: check for const keyword
10434echo " "
10435echo 'Checking to see if your C compiler knows about "const"...' >&4
10436$cat >const.c <<'EOCP'
10437typedef struct spug { int drokk; } spug;
10438int main()
10439{
10440 const char *foo;
10441 const spug y;
10442}
10443EOCP
10444if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10445 val="$define"
10446 echo "Yup, it does."
10447else
10448 val="$undef"
10449 echo "Nope, it doesn't."
10450fi
10451set d_const
10452eval $setvar
10453
5a29c6bc
JH
10454: see if copysignl exists
10455set copysignl d_copysignl
10456eval $inlibc
10457
b4eb6b3d
JH
10458: see if crypt exists
10459echo " "
a5a94ea5
JH
10460set crypt d_crypt
10461eval $inlibc
10462case "$d_crypt" in
10463$define) cryptlib='' ;;
10464*) if set crypt val -f d_crypt; eval $csym; $val; then
10465 echo 'crypt() found.' >&4
b4eb6b3d 10466 val="$define"
a5a94ea5
JH
10467 cryptlib=''
10468 else
10469 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10470 if $test -z "$cryptlib"; then
10471 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10472 else
10473 cryptlib=-lcrypt
10474 fi
10475 if $test -z "$cryptlib"; then
10476 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10477 else
10478 cryptlib=-lcrypt
10479 fi
10480 if $test -z "$cryptlib"; then
10481 cryptlib=`./loc libcrypt$_a "" $libpth`
10482 else
10483 cryptlib=-lcrypt
10484 fi
10485 if $test -z "$cryptlib"; then
10486 echo 'crypt() NOT found.' >&4
10487 val="$undef"
10488 else
10489 val="$define"
10490 fi
b4eb6b3d 10491 fi
a5a94ea5
JH
10492 set d_crypt
10493 eval $setvar
10494 ;;
10495esac
b4eb6b3d 10496
10bc17b6
JH
10497: see if this is a crypt.h system
10498set crypt.h i_crypt
10499eval $inhdr
10500
10501: see if crypt_r exists
10502set crypt_r d_crypt_r
10503eval $inlibc
10504case "$d_crypt_r" in
10505"$define")
10506 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
10507 case "$d_crypt_r_proto:$usethreads" in
10508 ":define") d_crypt_r_proto=define
a48ec845
JH
10509 set d_crypt_r_proto crypt_r $hdrs
10510 eval $hasproto ;;
10511 *) ;;
10512 esac
10513 case "$d_crypt_r_proto" in
10514 define)
10bc17b6
JH
10515 case "$crypt_r_proto" in
10516 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10517 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10518 esac
10519 case "$crypt_r_proto" in
b430fd04
JH
10520 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10521 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10522 esac
10523 case "$crypt_r_proto" in
90e831dc 10524 ''|0) d_crypt_r=undef
10bc17b6 10525 crypt_r_proto=0
a48ec845 10526 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10527 * ) case "$crypt_r_proto" in
10528 REENTRANT_PROTO*) ;;
10529 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10530 esac
10531 echo "Prototype: $try" ;;
10532 esac
10533 ;;
c18e646a
JH
10534 *) case "$usethreads" in
10535 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10536 esac
90e831dc
SB
10537 d_crypt_r=undef
10538 crypt_r_proto=0
c18e646a 10539 ;;
a48ec845
JH
10540 esac
10541 ;;
10bc17b6
JH
10542*) crypt_r_proto=0
10543 ;;
10544esac
10545
b4eb6b3d
JH
10546: get csh whereabouts
10547case "$csh" in
10548'csh') val="$undef" ;;
10549*) val="$define" ;;
10550esac
10551set d_csh
10552eval $setvar
10553: Respect a hint or command line value for full_csh.
10554case "$full_csh" in
10555'') full_csh=$csh ;;
10556esac
10557
10bc17b6
JH
10558: see if ctermid_r exists
10559set ctermid_r d_ctermid_r
10560eval $inlibc
10561case "$d_ctermid_r" in
10562"$define")
31ee0cb7 10563 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
10564 case "$d_ctermid_r_proto:$usethreads" in
10565 ":define") d_ctermid_r_proto=define
a48ec845
JH
10566 set d_ctermid_r_proto ctermid_r $hdrs
10567 eval $hasproto ;;
10568 *) ;;
10569 esac
10570 case "$d_ctermid_r_proto" in
10571 define)
10bc17b6
JH
10572 case "$ctermid_r_proto" in
10573 ''|0) try='char* ctermid_r(char*);'
10574 ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10575 esac
10576 case "$ctermid_r_proto" in
90e831dc 10577 ''|0) d_ctermid_r=undef
10bc17b6 10578 ctermid_r_proto=0
a48ec845 10579 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10580 * ) case "$ctermid_r_proto" in
10581 REENTRANT_PROTO*) ;;
10582 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10583 esac
10584 echo "Prototype: $try" ;;
10585 esac
10586 ;;
c18e646a
JH
10587 *) case "$usethreads" in
10588 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10589 esac
90e831dc
SB
10590 d_ctermid_r=undef
10591 ctermid_r_proto=0
c18e646a 10592 ;;
a48ec845
JH
10593 esac
10594 ;;
10bc17b6
JH
10595*) ctermid_r_proto=0
10596 ;;
10597esac
10598
10599: see if ctime_r exists
10600set ctime_r d_ctime_r
10601eval $inlibc
10602case "$d_ctime_r" in
10603"$define")
d63eadf0 10604 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
10605 case "$d_ctime_r_proto:$usethreads" in
10606 ":define") d_ctime_r_proto=define
a48ec845
JH
10607 set d_ctime_r_proto ctime_r $hdrs
10608 eval $hasproto ;;
10609 *) ;;
10610 esac
10611 case "$d_ctime_r_proto" in
10612 define)
10bc17b6
JH
10613 case "$ctime_r_proto" in
10614 ''|0) try='char* ctime_r(const time_t*, char*);'
10615 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10616 esac
10617 case "$ctime_r_proto" in
10618 ''|0) try='char* ctime_r(const time_t*, char*, int);'
10619 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10620 esac
10621 case "$ctime_r_proto" in
10622 ''|0) try='int ctime_r(const time_t*, char*);'
10623 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10624 esac
10625 case "$ctime_r_proto" in
10626 ''|0) try='int ctime_r(const time_t*, char*, int);'
10627 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10628 esac
10629 case "$ctime_r_proto" in
90e831dc 10630 ''|0) d_ctime_r=undef
10bc17b6 10631 ctime_r_proto=0
a48ec845 10632 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10633 * ) case "$ctime_r_proto" in
10634 REENTRANT_PROTO*) ;;
10635 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10636 esac
10637 echo "Prototype: $try" ;;
10638 esac
10639 ;;
c18e646a
JH
10640 *) case "$usethreads" in
10641 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10642 esac
90e831dc
SB
10643 d_ctime_r=undef
10644 ctime_r_proto=0
c18e646a 10645 ;;
a48ec845
JH
10646 esac
10647 ;;
10bc17b6
JH
10648*) ctime_r_proto=0
10649 ;;
10650esac
10651
b4eb6b3d
JH
10652: see if cuserid exists
10653set cuserid d_cuserid
10654eval $inlibc
10655
10656: see if this is a limits.h system
10657set limits.h i_limits
10658eval $inhdr
10659
10660: see if this is a float.h system
10661set float.h i_float
10662eval $inhdr
10663
10664: See if number of significant digits in a double precision number is known
10665echo " "
10666$cat >dbl_dig.c <<EOM
10667#$i_limits I_LIMITS
10668#$i_float I_FLOAT
10669#ifdef I_LIMITS
10670#include <limits.h>
10671#endif
10672#ifdef I_FLOAT
10673#include <float.h>
10674#endif
10675#ifdef DBL_DIG
10676printf("Contains DBL_DIG");
10677#endif
10678EOM
10679$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10680if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10681 echo "DBL_DIG found." >&4
10682 val="$define"
10683else
10684 echo "DBL_DIG NOT found." >&4
10685 val="$undef"
10686fi
10687$rm -f dbl_dig.?
10688set d_dbl_dig
10689eval $setvar
10690
2ef53570
JH
10691: see if dbm.h is available
10692: see if dbmclose exists
10693set dbmclose d_dbmclose
10694eval $inlibc
10695
10696case "$d_dbmclose" in
10697$define)
10698 set dbm.h i_dbm
10699 eval $inhdr
10700 case "$i_dbm" in
10701 $define)
10702 val="$undef"
10703 set i_rpcsvcdbm
10704 eval $setvar
10705 ;;
10706 *) set rpcsvc/dbm.h i_rpcsvcdbm
10707 eval $inhdr
10708 ;;
10709 esac
10710 ;;
10711*) echo "We won't be including <dbm.h>"
10712 val="$undef"
10713 set i_dbm
10714 eval $setvar
10715 val="$undef"
10716 set i_rpcsvcdbm
10717 eval $setvar
10718 ;;
10719esac
10720
10721: see if prototype for dbminit is available
10722echo " "
10723set d_dbminitproto dbminit $i_dbm dbm.h
10724eval $hasproto
10725
b4eb6b3d
JH
10726: see if difftime exists
10727set difftime d_difftime
10728eval $inlibc
10729
10730: see if this is a dirent system
10731echo " "
10732if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10733 val="$define"
10734 echo "<dirent.h> found." >&4
10735else
10736 val="$undef"
10737 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10738 echo "<sys/dir.h> found." >&4
10739 echo " "
10740 else
10741 xinc=`./findhdr sys/ndir.h`
10742 fi
10743 echo "<dirent.h> NOT found." >&4
10744fi
10745set i_dirent
10746eval $setvar
10747
10748: Look for type of directory structure.
10749echo " "
10750$cppstdin $cppflags $cppminus < "$xinc" > try.c
10751
10752case "$direntrytype" in
10753''|' ')
10754 case "$i_dirent" in
10755 $define) guess1='struct dirent' ;;
10756 *) guess1='struct direct' ;;
10757 esac
10758 ;;
10759*) guess1="$direntrytype"
10760 ;;
10761esac
10762
10763case "$guess1" in
10764'struct dirent') guess2='struct direct' ;;
10765*) guess2='struct dirent' ;;
10766esac
10767
10768if $contains "$guess1" try.c >/dev/null 2>&1; then
10769 direntrytype="$guess1"
10770 echo "Your directory entries are $direntrytype." >&4
10771elif $contains "$guess2" try.c >/dev/null 2>&1; then
10772 direntrytype="$guess2"
10773 echo "Your directory entries seem to be $direntrytype." >&4
10774else
10775 echo "I don't recognize your system's directory entries." >&4
10776 rp="What type is used for directory entries on this system?"
10777 dflt="$guess1"
10778 . ./myread
10779 direntrytype="$ans"
10780fi
10781$rm -f try.c
10782
10783
10784: see if the directory entry stores field length
10785echo " "
10786$cppstdin $cppflags $cppminus < "$xinc" > try.c
10787if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10788 echo "Good, your directory entry keeps length information in d_namlen." >&4
10789 val="$define"
10790else
10791 echo "Your directory entry does not know about the d_namlen field." >&4
10792 val="$undef"
10793fi
10794set d_dirnamlen
10795eval $setvar
10796$rm -f try.c
10797
ae0e3d3b
JH
10798: see if this is an sysdir system
10799set sys/dir.h i_sysdir
10800eval $inhdr
10801
10802: see if this is an sysndir system
10803set sys/ndir.h i_sysndir
10804eval $inhdr
10805
10806: Look for dirfd
10807echo " "
10808$cat >dirfd.c <<EOM
10809#include <stdio.h>
5a29c6bc
JH
10810#$i_stdlib I_STDLIB
10811#ifdef I_STDLIB
10812#include <stdlib.h>
10813#endif
ae0e3d3b
JH
10814#$i_dirent I_DIRENT /**/
10815#$i_sysdir I_SYS_DIR /**/
10816#$i_sysndir I_SYS_NDIR /**/
10817#$i_systypes I_SYS_TYPES /**/
10818#if defined(I_SYS_TYPES)
10819#include <sys/types.h>
10820#endif
10821#if defined(I_DIRENT)
10822#include <dirent.h>
10823#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10824#include <sys/dir.h>
10825#endif
10826#else
10827#ifdef I_SYS_NDIR
10828#include <sys/ndir.h>
10829#else
10830#ifdef I_SYS_DIR
10831#ifdef hp9000s500
10832#include <ndir.h> /* may be wrong in the future */
10833#else
10834#include <sys/dir.h>
10835#endif
10836#endif
10837#endif
10838#endif
10839int main() {
10840 DIR *dirp = opendir(".");
10841 if (dirfd(dirp) >= 0)
10842 exit(0);
10843 else
10844 exit(1);
10845}
10846EOM
10847set dirfd
10848if eval $compile; then
10849 val="$define"
10850fi
10851case "$val" in
10852$define) echo "dirfd() found." >&4 ;;
10853*) echo "dirfd() NOT found." >&4 ;;
10854esac
10855set d_dirfd
10856eval $setvar
10857$rm -f dirfd*
10858
b4eb6b3d
JH
10859: see if dlerror exists
10860xxx_runnm="$runnm"
10861runnm=false
10862set dlerror d_dlerror
10863eval $inlibc
10864runnm="$xxx_runnm"
10865
10866: see if dlfcn is available
10867set dlfcn.h i_dlfcn
10868eval $inhdr
10869
10870case "$usedl" in
10871$define|y|true)
10872 $cat << EOM
10873
10874On a few systems, the dynamically loaded modules that perl generates and uses
10875will need a different extension than shared libs. The default will probably
10876be appropriate.
10877
10878EOM
10879 case "$dlext" in
10880 '') dflt="$so" ;;
10881 *) dflt="$dlext" ;;
10882 esac
10883 rp='What is the extension of dynamically loaded modules'
10884 . ./myread
10885 dlext="$ans"
10886 ;;
10887*)
10888 dlext="none"
10889 ;;
10890esac
10891
10892: Check if dlsym need a leading underscore
10893echo " "
10894val="$undef"
10895
10896case "$dlsrc" in
10897dl_dlopen.xs)
10898 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10899 $cat >dyna.c <<'EOM'
10900fred () { }
10901EOM
10902
10903$cat >fred.c<<EOM
10904
10905#include <stdio.h>
5a29c6bc
JH
10906#$i_stdlib I_STDLIB
10907#ifdef I_STDLIB
10908#include <stdlib.h>
10909#endif
b4eb6b3d
JH
10910#$i_dlfcn I_DLFCN
10911#ifdef I_DLFCN
5440bc8e 10912#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
10913#else
10914#include <sys/types.h>
10915#include <nlist.h>
10916#include <link.h>
10917#endif
10918
10919extern int fred() ;
10920
10921int main()
10922{
10923 void * handle ;
10924 void * symbol ;
10925#ifndef RTLD_LAZY
10926 int mode = 1 ;
10927#else
10928 int mode = RTLD_LAZY ;
10929#endif
10930 handle = dlopen("./dyna.$dlext", mode) ;
10931 if (handle == NULL) {
10932 printf ("1\n") ;
10933 fflush (stdout) ;
10934 exit(0);
10935 }
10936 symbol = dlsym(handle, "fred") ;
10937 if (symbol == NULL) {
10938 /* try putting a leading underscore */
10939 symbol = dlsym(handle, "_fred") ;
10940 if (symbol == NULL) {
10941 printf ("2\n") ;
10942 fflush (stdout) ;
10943 exit(0);
10944 }
10945 printf ("3\n") ;
10946 }
10947 else
10948 printf ("4\n") ;
10949 fflush (stdout) ;
10950 exit(0);
10951}
10952EOM
10953 : Call the object file tmp-dyna.o in case dlext=o.
10954 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
10955 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 10956 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
10957 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10958 xxx=`$run ./fred`
b4eb6b3d
JH
10959 case $xxx in
10960 1) echo "Test program failed using dlopen." >&4
10961 echo "Perhaps you should not use dynamic loading." >&4;;
10962 2) echo "Test program failed using dlsym." >&4
10963 echo "Perhaps you should not use dynamic loading." >&4;;
10964 3) echo "dlsym needs a leading underscore" >&4
10965 val="$define" ;;
10966 4) echo "dlsym doesn't need a leading underscore." >&4;;
10967 esac
10968 else
10969 echo "I can't compile and run the test program." >&4
10970 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10971 fi
10972 ;;
10973esac
10974
3c728e00 10975$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
10976
10977set d_dlsymun
10978eval $setvar
10979
10bc17b6
JH
10980: see if drand48_r exists
10981set drand48_r d_drand48_r
10982eval $inlibc
10983case "$d_drand48_r" in
10984"$define")
10985 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
10986 case "$d_drand48_r_proto:$usethreads" in
10987 ":define") d_drand48_r_proto=define
a48ec845
JH
10988 set d_drand48_r_proto drand48_r $hdrs
10989 eval $hasproto ;;
10990 *) ;;
10991 esac
10992 case "$d_drand48_r_proto" in
10993 define)
10bc17b6
JH
10994 case "$drand48_r_proto" in
10995 ''|0) try='int drand48_r(struct drand48_data*, double*);'
10996 ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10997 esac
10998 case "$drand48_r_proto" in
90e831dc 10999 ''|0) d_drand48_r=undef
10bc17b6 11000 drand48_r_proto=0
a48ec845 11001 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11002 * ) case "$drand48_r_proto" in
11003 REENTRANT_PROTO*) ;;
11004 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11005 esac
11006 echo "Prototype: $try" ;;
11007 esac
11008 ;;
c18e646a
JH
11009 *) case "$usethreads" in
11010 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11011 esac
90e831dc
SB
11012 d_drand48_r=undef
11013 drand48_r_proto=0
c18e646a 11014 ;;
a48ec845
JH
11015 esac
11016 ;;
10bc17b6
JH
11017*) drand48_r_proto=0
11018 ;;
11019esac
11020
11021: see if prototype for drand48 is available
11022echo " "
11023set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11024eval $hasproto
11025
b4eb6b3d
JH
11026: see if dup2 exists
11027set dup2 d_dup2
11028eval $inlibc
11029
11030: see if eaccess exists
11031set eaccess d_eaccess
11032eval $inlibc
11033
11034: see if endgrent exists
11035set endgrent d_endgrent
11036eval $inlibc
11037
10bc17b6
JH
11038: see if this is an grp system
11039set grp.h i_grp
11040eval $inhdr
11041
11042case "$i_grp" in
11043$define)
11044 xxx=`./findhdr grp.h`
11045 $cppstdin $cppflags $cppminus < $xxx >$$.h
11046
11047 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11048 val="$define"
11049 else
11050 val="$undef"
11051 fi
11052 set d_grpasswd
11053 eval $setvar
11054
11055 $rm -f $$.h
11056 ;;
11057*)
11058 val="$undef";
11059 set d_grpasswd; eval $setvar
11060 ;;
11061esac
11062
11063: see if endgrent_r exists
11064set endgrent_r d_endgrent_r
11065eval $inlibc
11066case "$d_endgrent_r" in
11067"$define")
11068 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11069 case "$d_endgrent_r_proto:$usethreads" in
11070 ":define") d_endgrent_r_proto=define
a48ec845
JH
11071 set d_endgrent_r_proto endgrent_r $hdrs
11072 eval $hasproto ;;
11073 *) ;;
11074 esac
11075 case "$d_endgrent_r_proto" in
11076 define)
10bc17b6
JH
11077 case "$endgrent_r_proto" in
11078 ''|0) try='int endgrent_r(FILE**);'
11079 ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11080 esac
11081 case "$endgrent_r_proto" in
11082 ''|0) try='void endgrent_r(FILE**);'
11083 ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11084 esac
11085 case "$endgrent_r_proto" in
90e831dc 11086 ''|0) d_endgrent_r=undef
10bc17b6 11087 endgrent_r_proto=0
a48ec845 11088 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11089 * ) case "$endgrent_r_proto" in
11090 REENTRANT_PROTO*) ;;
11091 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11092 esac
11093 echo "Prototype: $try" ;;
11094 esac
11095 ;;
c18e646a
JH
11096 *) case "$usethreads" in
11097 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11098 esac
90e831dc
SB
11099 d_endgrent_r=undef
11100 endgrent_r_proto=0
c18e646a 11101 ;;
a48ec845
JH
11102 esac
11103 ;;
10bc17b6
JH
11104*) endgrent_r_proto=0
11105 ;;
11106esac
11107
b4eb6b3d
JH
11108: see if endhostent exists
11109set endhostent d_endhent
11110eval $inlibc
11111
10bc17b6
JH
11112: see if this is a netdb.h system
11113set netdb.h i_netdb
11114eval $inhdr
11115
11116: see if endhostent_r exists
11117set endhostent_r d_endhostent_r
11118eval $inlibc
11119case "$d_endhostent_r" in
11120"$define")
11121 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11122 case "$d_endhostent_r_proto:$usethreads" in
11123 ":define") d_endhostent_r_proto=define
a48ec845
JH
11124 set d_endhostent_r_proto endhostent_r $hdrs
11125 eval $hasproto ;;
11126 *) ;;
11127 esac
11128 case "$d_endhostent_r_proto" in
11129 define)
10bc17b6
JH
11130 case "$endhostent_r_proto" in
11131 ''|0) try='int endhostent_r(struct hostent_data*);'
31ee0cb7 11132 ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
11133 esac
11134 case "$endhostent_r_proto" in
11135 ''|0) try='void endhostent_r(struct hostent_data*);'
31ee0cb7 11136 ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
11137 esac
11138 case "$endhostent_r_proto" in
90e831dc 11139 ''|0) d_endhostent_r=undef
10bc17b6 11140 endhostent_r_proto=0
a48ec845 11141 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11142 * ) case "$endhostent_r_proto" in
11143 REENTRANT_PROTO*) ;;
11144 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11145 esac
11146 echo "Prototype: $try" ;;
11147 esac
11148 ;;
c18e646a
JH
11149 *) case "$usethreads" in
11150 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11151 esac
90e831dc
SB
11152 d_endhostent_r=undef
11153 endhostent_r_proto=0
c18e646a 11154 ;;
a48ec845
JH
11155 esac
11156 ;;
10bc17b6
JH
11157*) endhostent_r_proto=0
11158 ;;
11159esac
11160
b4eb6b3d
JH
11161: see if endnetent exists
11162set endnetent d_endnent
11163eval $inlibc
11164
10bc17b6
JH
11165: see if endnetent_r exists
11166set endnetent_r d_endnetent_r
11167eval $inlibc
11168case "$d_endnetent_r" in
11169"$define")
11170 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11171 case "$d_endnetent_r_proto:$usethreads" in
11172 ":define") d_endnetent_r_proto=define
a48ec845
JH
11173 set d_endnetent_r_proto endnetent_r $hdrs
11174 eval $hasproto ;;
11175 *) ;;
11176 esac
11177 case "$d_endnetent_r_proto" in
11178 define)
10bc17b6
JH
11179 case "$endnetent_r_proto" in
11180 ''|0) try='int endnetent_r(struct netent_data*);'
31ee0cb7 11181 ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
11182 esac
11183 case "$endnetent_r_proto" in
11184 ''|0) try='void endnetent_r(struct netent_data*);'
31ee0cb7 11185 ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
11186 esac
11187 case "$endnetent_r_proto" in
90e831dc 11188 ''|0) d_endnetent_r=undef
10bc17b6 11189 endnetent_r_proto=0
a48ec845 11190 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11191 * ) case "$endnetent_r_proto" in
11192 REENTRANT_PROTO*) ;;
11193 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11194 esac
11195 echo "Prototype: $try" ;;
11196 esac
11197 ;;
c18e646a
JH
11198 *) case "$usethreads" in
11199 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11200 esac
90e831dc
SB
11201 d_endnetent_r=undef
11202 endnetent_r_proto=0
c18e646a 11203 ;;
a48ec845
JH
11204 esac
11205 ;;
10bc17b6
JH
11206*) endnetent_r_proto=0
11207 ;;
11208esac
11209
b4eb6b3d
JH
11210: see if endprotoent exists
11211set endprotoent d_endpent
11212eval $inlibc
11213
10bc17b6
JH
11214: see if endprotoent_r exists
11215set endprotoent_r d_endprotoent_r
11216eval $inlibc
11217case "$d_endprotoent_r" in
11218"$define")
11219 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11220 case "$d_endprotoent_r_proto:$usethreads" in
11221 ":define") d_endprotoent_r_proto=define
a48ec845
JH
11222 set d_endprotoent_r_proto endprotoent_r $hdrs
11223 eval $hasproto ;;
11224 *) ;;
11225 esac
11226 case "$d_endprotoent_r_proto" in
11227 define)
10bc17b6
JH
11228 case "$endprotoent_r_proto" in
11229 ''|0) try='int endprotoent_r(struct protoent_data*);'
31ee0cb7 11230 ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
11231 esac
11232 case "$endprotoent_r_proto" in
11233 ''|0) try='void endprotoent_r(struct protoent_data*);'
31ee0cb7 11234 ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
11235 esac
11236 case "$endprotoent_r_proto" in
90e831dc 11237 ''|0) d_endprotoent_r=undef
10bc17b6 11238 endprotoent_r_proto=0
a48ec845 11239 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11240 * ) case "$endprotoent_r_proto" in
11241 REENTRANT_PROTO*) ;;
11242 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11243 esac
11244 echo "Prototype: $try" ;;
11245 esac
11246 ;;
c18e646a
JH
11247 *) case "$usethreads" in
11248 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11249 esac
90e831dc
SB
11250 d_endprotoent_r=undef
11251 endprotoent_r_proto=0
c18e646a 11252 ;;
a48ec845
JH
11253 esac
11254 ;;
10bc17b6
JH
11255*) endprotoent_r_proto=0
11256 ;;
11257esac
11258
b4eb6b3d
JH
11259: see if endpwent exists
11260set endpwent d_endpwent
11261eval $inlibc
11262
10bc17b6
JH
11263: see if this is a pwd.h system
11264set pwd.h i_pwd
11265eval $inhdr
11266
11267case "$i_pwd" in
11268$define)
11269 xxx=`./findhdr pwd.h`
11270 $cppstdin $cppflags $cppminus < $xxx >$$.h
11271
11272 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11273 val="$define"
11274 else
11275 val="$undef"
11276 fi
11277 set d_pwquota
11278 eval $setvar
11279
11280 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11281 val="$define"
11282 else
11283 val="$undef"
11284 fi
11285 set d_pwage
11286 eval $setvar
11287
11288 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11289 val="$define"
11290 else
11291 val="$undef"
11292 fi
11293 set d_pwchange
11294 eval $setvar
11295
11296 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11297 val="$define"
11298 else
11299 val="$undef"
11300 fi
11301 set d_pwclass
11302 eval $setvar
11303
11304 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11305 val="$define"
11306 else
11307 val="$undef"
11308 fi
11309 set d_pwexpire
11310 eval $setvar
11311
11312 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11313 val="$define"
11314 else
11315 val="$undef"
11316 fi
11317 set d_pwcomment
11318 eval $setvar
11319
11320 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11321 val="$define"
11322 else
11323 val="$undef"
11324 fi
11325 set d_pwgecos
11326 eval $setvar
11327
11328 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11329 val="$define"
11330 else
11331 val="$undef"
11332 fi
11333 set d_pwpasswd
11334 eval $setvar
11335
11336 $rm -f $$.h
11337 ;;
11338*)
11339 val="$undef";
11340 set d_pwquota; eval $setvar
11341 set d_pwage; eval $setvar
11342 set d_pwchange; eval $setvar
11343 set d_pwclass; eval $setvar
11344 set d_pwexpire; eval $setvar
11345 set d_pwcomment; eval $setvar
11346 set d_pwgecos; eval $setvar
11347 set d_pwpasswd; eval $setvar
11348 ;;
11349esac
11350
11351: see if endpwent_r exists
11352set endpwent_r d_endpwent_r
11353eval $inlibc
11354case "$d_endpwent_r" in
11355"$define")
11356 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
11357 case "$d_endpwent_r_proto:$usethreads" in
11358 ":define") d_endpwent_r_proto=define
a48ec845
JH
11359 set d_endpwent_r_proto endpwent_r $hdrs
11360 eval $hasproto ;;
11361 *) ;;
11362 esac
11363 case "$d_endpwent_r_proto" in
11364 define)
10bc17b6
JH
11365 case "$endpwent_r_proto" in
11366 ''|0) try='int endpwent_r(FILE**);'
11367 ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11368 esac
11369 case "$endpwent_r_proto" in
11370 ''|0) try='void endpwent_r(FILE**);'
11371 ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11372 esac
11373 case "$endpwent_r_proto" in
90e831dc 11374 ''|0) d_endpwent_r=undef
10bc17b6 11375 endpwent_r_proto=0
a48ec845 11376 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11377 * ) case "$endpwent_r_proto" in
11378 REENTRANT_PROTO*) ;;
11379 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11380 esac
11381 echo "Prototype: $try" ;;
11382 esac
11383 ;;
c18e646a
JH
11384 *) case "$usethreads" in
11385 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11386 esac
90e831dc
SB
11387 d_endpwent_r=undef
11388 endpwent_r_proto=0
c18e646a 11389 ;;
a48ec845
JH
11390 esac
11391 ;;
10bc17b6
JH
11392*) endpwent_r_proto=0
11393 ;;
11394esac
11395
b4eb6b3d
JH
11396: see if endservent exists
11397set endservent d_endsent
11398eval $inlibc
11399
10bc17b6
JH
11400: see if endservent_r exists
11401set endservent_r d_endservent_r
11402eval $inlibc
11403case "$d_endservent_r" in
11404"$define")
11405 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11406 case "$d_endservent_r_proto:$usethreads" in
11407 ":define") d_endservent_r_proto=define
a48ec845
JH
11408 set d_endservent_r_proto endservent_r $hdrs
11409 eval $hasproto ;;
11410 *) ;;
11411 esac
11412 case "$d_endservent_r_proto" in
11413 define)
10bc17b6
JH
11414 case "$endservent_r_proto" in
11415 ''|0) try='int endservent_r(struct servent_data*);'
31ee0cb7 11416 ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
11417 esac
11418 case "$endservent_r_proto" in
11419 ''|0) try='void endservent_r(struct servent_data*);'
31ee0cb7 11420 ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
11421 esac
11422 case "$endservent_r_proto" in
90e831dc 11423 ''|0) d_endservent_r=undef
10bc17b6 11424 endservent_r_proto=0
a48ec845 11425 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11426 * ) case "$endservent_r_proto" in
11427 REENTRANT_PROTO*) ;;
11428 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11429 esac
11430 echo "Prototype: $try" ;;
11431 esac
11432 ;;
c18e646a
JH
11433 *) case "$usethreads" in
11434 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11435 esac
90e831dc
SB
11436 d_endservent_r=undef
11437 endservent_r_proto=0
c18e646a 11438 ;;
a48ec845
JH
11439 esac
11440 ;;
10bc17b6
JH
11441*) endservent_r_proto=0
11442 ;;
11443esac
11444
b4eb6b3d
JH
11445: Locate the flags for 'open()'
11446echo " "
5a29c6bc 11447$cat >try.c <<EOCP
b4eb6b3d
JH
11448#include <sys/types.h>
11449#ifdef I_FCNTL
11450#include <fcntl.h>
11451#endif
11452#ifdef I_SYS_FILE
11453#include <sys/file.h>
11454#endif
5a29c6bc
JH
11455#$i_stdlib I_STDLIB
11456#ifdef I_STDLIB
11457#include <stdlib.h>
11458#endif
b4eb6b3d
JH
11459int main() {
11460 if(O_RDONLY);
11461#ifdef O_TRUNC
11462 exit(0);
11463#else
11464 exit(1);
11465#endif
11466}
11467EOCP
11468: check sys/file.h first to get FREAD on Sun
11469if $test `./findhdr sys/file.h` && \
5440bc8e 11470 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
11471 h_sysfile=true;
11472 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 11473 if $run ./try; then
b4eb6b3d
JH
11474 echo "and you have the 3 argument form of open()." >&4
11475 val="$define"
11476 else
11477 echo "but not the 3 argument form of open(). Oh, well." >&4
11478 val="$undef"
11479 fi
11480elif $test `./findhdr fcntl.h` && \
5440bc8e 11481 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
11482 h_fcntl=true;
11483 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 11484 if $run ./try; then
b4eb6b3d
JH
11485 echo "and you have the 3 argument form of open()." >&4
11486 val="$define"
11487 else
11488 echo "but not the 3 argument form of open(). Oh, well." >&4
11489 val="$undef"
11490 fi
11491else
11492 val="$undef"
11493 echo "I can't find the O_* constant definitions! You got problems." >&4
11494fi
11495set d_open3
11496eval $setvar
5440bc8e 11497$rm -f try try.*
b4eb6b3d
JH
11498
11499: see which of string.h or strings.h is needed
11500echo " "
11501strings=`./findhdr string.h`
11502if $test "$strings" && $test -r "$strings"; then
11503 echo "Using <string.h> instead of <strings.h>." >&4
11504 val="$define"
11505else
11506 val="$undef"
11507 strings=`./findhdr strings.h`
11508 if $test "$strings" && $test -r "$strings"; then
11509 echo "Using <strings.h> instead of <string.h>." >&4
11510 else
11511 echo "No string header found -- You'll surely have problems." >&4
11512 fi
11513fi
11514set i_string
11515eval $setvar
11516case "$i_string" in
11517"$undef") strings=`./findhdr strings.h`;;
11518*) strings=`./findhdr string.h`;;
11519esac
11520
3c728e00
JH
11521: see if this is a sys/file.h system
11522val=''
11523set sys/file.h val
11524eval $inhdr
11525
11526: do we need to include sys/file.h ?
11527case "$val" in
11528"$define")
11529 echo " "
11530 if $h_sysfile; then
11531 val="$define"
11532 echo "We'll be including <sys/file.h>." >&4
11533 else
11534 val="$undef"
11535 echo "We won't be including <sys/file.h>." >&4
11536 fi
11537 ;;
11538*)
11539 h_sysfile=false
11540 ;;
11541esac
11542set i_sysfile
11543eval $setvar
11544
11545: see if fcntl.h is there
11546val=''
11547set fcntl.h val
11548eval $inhdr
11549
11550: see if we can include fcntl.h
11551case "$val" in
11552"$define")
11553 echo " "
11554 if $h_fcntl; then
11555 val="$define"
11556 echo "We'll be including <fcntl.h>." >&4
11557 else
11558 val="$undef"
11559 if $h_sysfile; then
11560 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11561 else
11562 echo "We won't be including <fcntl.h>." >&4
11563 fi
11564 fi
11565 ;;
11566*)
11567 h_fcntl=false
11568 val="$undef"
11569 ;;
11570esac
11571set i_fcntl
11572eval $setvar
11573
b4eb6b3d
JH
11574: check for non-blocking I/O stuff
11575case "$h_sysfile" in
a0acbdc3
JH
11576true) echo "#include <sys/file.h>" > head.c;;
11577*)
11578 case "$h_fcntl" in
11579 true) echo "#include <fcntl.h>" > head.c;;
11580 *) echo "#include <sys/fcntl.h>" > head.c;;
11581 esac
11582 ;;
b4eb6b3d
JH
11583esac
11584echo " "
11585echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11586case "$o_nonblock" in
11587'')
11588 $cat head.c > try.c
3c728e00 11589 $cat >>try.c <<EOCP
b4eb6b3d 11590#include <stdio.h>
5a29c6bc
JH
11591#$i_stdlib I_STDLIB
11592#ifdef I_STDLIB
80b3ef99 11593#include <stdlib.h>
5a29c6bc 11594#endif
3c728e00
JH
11595#$i_fcntl I_FCNTL
11596#ifdef I_FCNTL
11597#include <fcntl.h>
11598#endif
b4eb6b3d
JH
11599int main() {
11600#ifdef O_NONBLOCK
11601 printf("O_NONBLOCK\n");
11602 exit(0);
11603#endif
11604#ifdef O_NDELAY
11605 printf("O_NDELAY\n");
11606 exit(0);
11607#endif
11608#ifdef FNDELAY
11609 printf("FNDELAY\n");
11610 exit(0);
11611#endif
11612 exit(0);
11613}
11614EOCP
11615 set try
11616 if eval $compile_ok; then
5440bc8e 11617 o_nonblock=`$run ./try`
b4eb6b3d
JH
11618 case "$o_nonblock" in
11619 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11620 *) echo "Seems like we can use $o_nonblock.";;
11621 esac
11622 else
11623 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11624 fi
11625 ;;
11626*) echo "Using $hint value $o_nonblock.";;
11627esac
11628$rm -f try try.* .out core
11629
11630echo " "
11631echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11632case "$eagain" in
11633'')
11634 $cat head.c > try.c
11635 $cat >>try.c <<EOCP
11636#include <errno.h>
11637#include <sys/types.h>
11638#include <signal.h>
11639#include <stdio.h>
5a29c6bc
JH
11640#$i_stdlib I_STDLIB
11641#ifdef I_STDLIB
11642#include <stdlib.h>
11643#endif
1deb0a86
JH
11644#$i_fcntl I_FCNTL
11645#ifdef I_FCNTL
11646#include <fcntl.h>
11647#endif
b4eb6b3d
JH
11648#define MY_O_NONBLOCK $o_nonblock
11649#ifndef errno /* XXX need better Configure test */
11650extern int errno;
11651#endif
11652#$i_unistd I_UNISTD
11653#ifdef I_UNISTD
11654#include <unistd.h>
11655#endif
11656#$i_string I_STRING
11657#ifdef I_STRING
11658#include <string.h>
11659#else
11660#include <strings.h>
11661#endif
11662$signal_t blech(x) int x; { exit(3); }
11663EOCP
11664 $cat >> try.c <<'EOCP'
11665int main()
11666{
11667 int pd[2];
11668 int pu[2];
11669 char buf[1];
11670 char string[100];
11671
11672 pipe(pd); /* Down: child -> parent */
11673 pipe(pu); /* Up: parent -> child */
11674 if (0 != fork()) {
11675 int ret;
11676 close(pd[1]); /* Parent reads from pd[0] */
11677 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 11678#ifdef F_SETFL
b4eb6b3d
JH
11679 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11680 exit(1);
a0acbdc3
JH
11681#else
11682 exit(4);
11683#endif
b4eb6b3d
JH
11684 signal(SIGALRM, blech);
11685 alarm(5);
11686 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
11687 exit(2);
11688 sprintf(string, "%d\n", ret);
11689 write(2, string, strlen(string));
11690 alarm(0);
11691#ifdef EAGAIN
11692 if (errno == EAGAIN) {
11693 printf("EAGAIN\n");
11694 goto ok;
11695 }
11696#endif
11697#ifdef EWOULDBLOCK
11698 if (errno == EWOULDBLOCK)
11699 printf("EWOULDBLOCK\n");
11700#endif
11701 ok:
11702 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
11703 sleep(2); /* Give it time to close our pipe */
11704 alarm(5);
11705 ret = read(pd[0], buf, 1); /* Should read EOF */
11706 alarm(0);
11707 sprintf(string, "%d\n", ret);
868439a2 11708 write(4, string, strlen(string));
b4eb6b3d
JH
11709 exit(0);
11710 }
11711
11712 close(pd[0]); /* We write to pd[1] */
11713 close(pu[1]); /* We read from pu[0] */
11714 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
11715 close(pd[1]); /* Pipe pd is now fully closed! */
11716 exit(0); /* Bye bye, thank you for playing! */
11717}
11718EOCP
11719 set try
11720 if eval $compile_ok; then
11721 echo "$startsh" >mtry
868439a2 11722 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
11723 chmod +x mtry
11724 ./mtry >/dev/null 2>&1
11725 case $? in
11726 0) eagain=`$cat try.out`;;
11727 1) echo "Could not perform non-blocking setting!";;
11728 2) echo "I did a successful read() for something that was not there!";;
11729 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 11730 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
11731 *) echo "Something terribly wrong happened during testing.";;
11732 esac
11733 rd_nodata=`$cat try.ret`
11734 echo "A read() system call with no data present returns $rd_nodata."
11735 case "$rd_nodata" in
11736 0|-1) ;;
11737 *)
11738 echo "(That's peculiar, fixing that to be -1.)"
11739 rd_nodata=-1
11740 ;;
11741 esac
11742 case "$eagain" in
11743 '')
11744 echo "Forcing errno EAGAIN on read() with no data available."
11745 eagain=EAGAIN
11746 ;;
11747 *)
11748 echo "Your read() sets errno to $eagain when no data is available."
11749 ;;
11750 esac
11751 status=`$cat try.err`
11752 case "$status" in
11753 0) echo "And it correctly returns 0 to signal EOF.";;
11754 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11755 *) echo "However, your read() returns '$status' on EOF??";;
11756 esac
11757 val="$define"
11758 if test "$status" = "$rd_nodata"; then
11759 echo "WARNING: you can't distinguish between EOF and no data!"
11760 val="$undef"
11761 fi
11762 else
11763 echo "I can't compile the test program--assuming errno EAGAIN will do."
11764 eagain=EAGAIN
11765 fi
11766 set d_eofnblk
11767 eval $setvar
11768 ;;
11769*)
11770 echo "Using $hint value $eagain."
11771 echo "Your read() returns $rd_nodata when no data is present."
11772 case "$d_eofnblk" in
11773 "$define") echo "And you can see EOF because read() returns 0.";;
11774 "$undef") echo "But you can't see EOF status from read() returned value.";;
11775 *)
11776 echo "(Assuming you can't see EOF status from read anyway.)"
11777 d_eofnblk=$undef
11778 ;;
11779 esac
11780 ;;
11781esac
11782$rm -f try try.* .out core head.c mtry
11783
ff0950a8
JH
11784: see if _ptr and _cnt from stdio act std
11785echo " "
b4eb6b3d 11786
ff0950a8
JH
11787if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11788 echo "(Looks like you have stdio.h from BSD.)"
11789 case "$stdio_ptr" in
11790 '') stdio_ptr='((fp)->_p)'
11791 ptr_lval=$define
11792 ;;
11793 *) ptr_lval=$d_stdio_ptr_lval;;
11794 esac
11795 case "$stdio_cnt" in
11796 '') stdio_cnt='((fp)->_r)'
11797 cnt_lval=$define
11798 ;;
11799 *) cnt_lval=$d_stdio_cnt_lval;;
11800 esac
11801 case "$stdio_base" in
11802 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11803 esac
11804 case "$stdio_bufsiz" in
11805 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11806 esac
11807elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11808 echo "(Looks like you have stdio.h from Linux.)"
11809 case "$stdio_ptr" in
11810 '') stdio_ptr='((fp)->_IO_read_ptr)'
11811 ptr_lval=$define
11812 ;;
11813 *) ptr_lval=$d_stdio_ptr_lval;;
11814 esac
11815 case "$stdio_cnt" in
11816 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11817 cnt_lval=$undef
11818 ;;
11819 *) cnt_lval=$d_stdio_cnt_lval;;
11820 esac
11821 case "$stdio_base" in
11822 '') stdio_base='((fp)->_IO_read_base)';;
11823 esac
11824 case "$stdio_bufsiz" in
11825 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11826 esac
11827else
11828 case "$stdio_ptr" in
11829 '') stdio_ptr='((fp)->_ptr)'
11830 ptr_lval=$define
11831 ;;
11832 *) ptr_lval=$d_stdio_ptr_lval;;
11833 esac
11834 case "$stdio_cnt" in
11835 '') stdio_cnt='((fp)->_cnt)'
11836 cnt_lval=$define
11837 ;;
11838 *) cnt_lval=$d_stdio_cnt_lval;;
11839 esac
11840 case "$stdio_base" in
11841 '') stdio_base='((fp)->_base)';;
11842 esac
11843 case "$stdio_bufsiz" in
11844 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11845 esac
11846fi
b4eb6b3d 11847
ff0950a8
JH
11848: test whether _ptr and _cnt really work
11849echo "Checking how std your stdio is..." >&4
11850$cat >try.c <<EOP
11851#include <stdio.h>
5a29c6bc
JH
11852#$i_stdlib I_STDLIB
11853#ifdef I_STDLIB
9d9004a9 11854#include <stdlib.h>
5a29c6bc 11855#endif
ff0950a8
JH
11856#define FILE_ptr(fp) $stdio_ptr
11857#define FILE_cnt(fp) $stdio_cnt
9d9004a9 11858int main() {
ff0950a8
JH
11859 FILE *fp = fopen("try.c", "r");
11860 char c = getc(fp);
11861 if (
11862 18 <= FILE_cnt(fp) &&
11863 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11864 )
11865 exit(0);
11866 exit(1);
9d9004a9 11867}
ff0950a8
JH
11868EOP
11869val="$undef"
11870set try
11871if eval $compile && $to try.c; then
11872 if $run ./try; then
11873 echo "Your stdio acts pretty std."
11874 val="$define"
9d9004a9 11875 else
ff0950a8 11876 echo "Your stdio isn't very std."
9d9004a9 11877 fi
ff0950a8
JH
11878else
11879 echo "Your stdio doesn't appear very std."
11880fi
11881$rm -f try.c try
11882
11883# glibc 2.2.90 and above apparently change stdio streams so Perl's
11884# direct buffer manipulation no longer works. The Configure tests
11885# should be changed to correctly detect this, but until then,
11886# the following check should at least let perl compile and run.
11887# (This quick fix should be updated before 5.8.1.)
11888# To be defensive, reject all unknown versions, and all versions > 2.2.9.
11889# A. Dougherty, June 3, 2002.
11890case "$d_gnulibc" in
11891$define)
11892 case "$gnulibc_version" in
11893 2.[01]*) ;;
11894 2.2) ;;
11895 2.2.[0-9]) ;;
11896 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
11897 val="$undef"
11898 ;;
11899 esac
9d9004a9
AD
11900 ;;
11901esac
ff0950a8 11902set d_stdstdio
9d9004a9 11903eval $setvar
9d9004a9 11904
ff0950a8
JH
11905: Can _ptr be used as an lvalue?
11906case "$d_stdstdio$ptr_lval" in
11907$define$define) val=$define ;;
11908*) val=$undef ;;
11909esac
11910set d_stdio_ptr_lval
11911eval $setvar
9d9004a9 11912
ff0950a8
JH
11913: Can _cnt be used as an lvalue?
11914case "$d_stdstdio$cnt_lval" in
11915$define$define) val=$define ;;
11916*) val=$undef ;;
11917esac
11918set d_stdio_cnt_lval
11919eval $setvar
b4eb6b3d 11920
ff0950a8
JH
11921
11922: test whether setting _ptr sets _cnt as a side effect
11923d_stdio_ptr_lval_sets_cnt="$undef"
11924d_stdio_ptr_lval_nochange_cnt="$undef"
11925case "$d_stdio_ptr_lval$d_stdstdio" in
11926$define$define)
11927 echo "Checking to see what happens if we set the stdio ptr..." >&4
11928$cat >try.c <<EOP
11929#include <stdio.h>
11930/* Can we scream? */
11931/* Eat dust sed :-) */
11932/* In the buffer space, no one can hear you scream. */
5a29c6bc
JH
11933#$i_stdlib I_STDLIB
11934#ifdef I_STDLIB
11935#include <stdlib.h>
11936#endif
ff0950a8
JH
11937#define FILE_ptr(fp) $stdio_ptr
11938#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 11939#include <sys/types.h>
ff0950a8
JH
11940int main() {
11941 FILE *fp = fopen("try.c", "r");
11942 int c;
11943 char *ptr;
11944 size_t cnt;
11945 if (!fp) {
11946 puts("Fail even to read");
11947 exit(1);
11948 }
11949 c = getc(fp); /* Read away the first # */
11950 if (c == EOF) {
11951 puts("Fail even to read");
11952 exit(1);
11953 }
11954 if (!(
11955 18 <= FILE_cnt(fp) &&
11956 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11957 )) {
11958 puts("Fail even to read");
11959 exit (1);
11960 }
11961 ptr = (char*) FILE_ptr(fp);
11962 cnt = (size_t)FILE_cnt(fp);
11963
11964 FILE_ptr(fp) += 42;
11965
11966 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
11967 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11968 exit (1);
11969 }
11970 if (FILE_cnt(fp) <= 20) {
11971 printf ("Fail (<20 chars to test)");
11972 exit (1);
11973 }
11974 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11975 puts("Fail compare");
11976 exit (1);
11977 }
11978 if (cnt == FILE_cnt(fp)) {
11979 puts("Pass_unchanged");
11980 exit (0);
11981 }
11982 if (FILE_cnt(fp) == (cnt - 42)) {
11983 puts("Pass_changed");
11984 exit (0);
11985 }
11986 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11987 return 1;
11988
11989}
11990EOP
11991 set try
11992 if eval $compile && $to try.c; then
11993 case `$run ./try` in
11994 Pass_changed)
11995 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
11996 d_stdio_ptr_lval_sets_cnt="$define" ;;
11997 Pass_unchanged)
11998 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
11999 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12000 Fail*)
12001 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12002 *)
12003 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12004 esac
12005 else
12006 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12007 fi
12008 $rm -f try.c try
12009 ;;
12010esac
12011
12012: see if _base is also standard
12013val="$undef"
12014case "$d_stdstdio" in
12015$define)
12016 $cat >try.c <<EOP
12017#include <stdio.h>
12018#$i_stdlib I_STDLIB
12019#ifdef I_STDLIB
12020#include <stdlib.h>
12021#endif
12022#define FILE_base(fp) $stdio_base
12023#define FILE_bufsiz(fp) $stdio_bufsiz
12024int main() {
12025 FILE *fp = fopen("try.c", "r");
12026 char c = getc(fp);
12027 if (
12028 19 <= FILE_bufsiz(fp) &&
12029 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12030 )
12031 exit(0);
12032 exit(1);
12033}
12034EOP
12035 set try
12036 if eval $compile && $to try.c; then
12037 if $run ./try; then
12038 echo "And its _base field acts std."
12039 val="$define"
12040 else
12041 echo "But its _base field isn't std."
12042 fi
12043 else
12044 echo "However, it seems to be lacking the _base field."
12045 fi
12046 $rm -f try.c try
12047 ;;
12048esac
12049set d_stdiobase
12050eval $setvar
12051
12052: see if fast_stdio exists
12053val="$undef"
12054case "$d_stdstdio:$d_stdio_ptr_lval" in
12055"$define:$define")
12056 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12057 *$define*)
12058 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12059 val="$define"
12060 ;;
12061 esac
12062 ;;
12063esac
12064set d_faststdio
12065eval $setvar
12066
12067
12068
12069: see if fchdir exists
12070set fchdir d_fchdir
12071eval $inlibc
12072
12073: see if fchmod exists
12074set fchmod d_fchmod
12075eval $inlibc
12076
12077: see if fchown exists
12078set fchown d_fchown
12079eval $inlibc
12080
12081: see if this is an fcntl system
12082set fcntl d_fcntl
12083eval $inlibc
12084
12085echo " "
12086: See if fcntl-based locking works.
12087$cat >try.c <<EOCP
12088#$i_stdlib I_STDLIB
12089#ifdef I_STDLIB
12090#include <stdlib.h>
12091#endif
12092#include <unistd.h>
12093#include <fcntl.h>
12094#include <signal.h>
12095$signal_t blech(x) int x; { exit(3); }
12096int main() {
12097#if defined(F_SETLK) && defined(F_SETLKW)
12098 struct flock flock;
12099 int retval, fd;
12100 fd = open("try.c", O_RDONLY);
12101 flock.l_type = F_RDLCK;
12102 flock.l_whence = SEEK_SET;
12103 flock.l_start = flock.l_len = 0;
12104 signal(SIGALRM, blech);
12105 alarm(10);
12106 retval = fcntl(fd, F_SETLK, &flock);
12107 close(fd);
12108 (retval < 0 ? exit(2) : exit(0));
12109#else
12110 exit(2);
12111#endif
12112}
12113EOCP
12114echo "Checking if fcntl-based file locking works... "
12115case "$d_fcntl" in
12116"$define")
12117 set try
12118 if eval $compile_ok; then
12119 if $run ./try; then
12120 echo "Yes, it seems to work."
12121 val="$define"
12122 else
12123 echo "Nope, it didn't work."
12124 val="$undef"
12125 case "$?" in
12126 3) $cat >&4 <<EOM
12127***
12128*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12129*** This is (almost) impossible.
12130*** If your NFS lock daemons are not feeling well, something like
12131*** this may happen, please investigate. Cannot continue, aborting.
12132***
12133EOM
12134 exit 1
12135 ;;
12136 esac
12137 fi
12138 else
12139 echo "I'm unable to compile the test program, so I'll assume not."
12140 val="$undef"
12141 fi
12142 ;;
12143*) val="$undef";
12144 echo "Nope, since you don't even have fcntl()."
12145 ;;
12146esac
12147set d_fcntl_can_lock
12148eval $setvar
12149$rm -f try*
12150
12151
12152: check for fd_set items
12153$cat <<EOM
12154
12155Checking to see how well your C compiler handles fd_set and friends ...
12156EOM
12157$cat >try.c <<EOCP
12158#$i_stdlib I_STDLIB
12159#ifdef I_STDLIB
12160#include <stdlib.h>
12161#endif
12162#$i_systime I_SYS_TIME
12163#$i_sysselct I_SYS_SELECT
12164#$d_socket HAS_SOCKET
12165#include <sys/types.h>
12166#ifdef HAS_SOCKET
12167#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12168#endif
12169#ifdef I_SYS_TIME
12170#include <sys/time.h>
12171#endif
12172#ifdef I_SYS_SELECT
12173#include <sys/select.h>
b4eb6b3d
JH
12174#endif
12175int main() {
12176 fd_set fds;
12177
12178#ifdef TRYBITS
12179 if(fds.fds_bits);
12180#endif
12181
12182#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12183 exit(0);
12184#else
12185 exit(1);
12186#endif
12187}
12188EOCP
5440bc8e 12189set try -DTRYBITS
b4eb6b3d
JH
12190if eval $compile; then
12191 d_fds_bits="$define"
12192 d_fd_set="$define"
12193 echo "Well, your system knows about the normal fd_set typedef..." >&4
5440bc8e 12194 if $run ./try; then
b4eb6b3d
JH
12195 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12196 d_fd_macros="$define"
12197 else
12198 $cat >&4 <<'EOM'
12199but not the normal fd_set macros! Gaaack! I'll have to cover for you.
12200EOM
12201 d_fd_macros="$undef"
12202 fi
12203else
12204 $cat <<'EOM'
12205Hmm, your compiler has some difficulty with fd_set. Checking further...
12206EOM
5440bc8e 12207 set try
b4eb6b3d
JH
12208 if eval $compile; then
12209 d_fds_bits="$undef"
12210 d_fd_set="$define"
12211 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 12212 if $run ./try; then
b4eb6b3d
JH
12213 echo "and you have the normal fd_set macros." >&4
12214 d_fd_macros="$define"
12215 else
12216 $cat <<'EOM'
12217but not the normal fd_set macros! Gross! More work for me...
12218EOM
12219 d_fd_macros="$undef"
12220 fi
12221 else
12222 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
12223 d_fd_set="$undef"
12224 d_fds_bits="$undef"
12225 d_fd_macros="$undef"
12226 fi
12227fi
5440bc8e 12228$rm -f try try.*
b4eb6b3d
JH
12229
12230: see if fgetpos exists
12231set fgetpos d_fgetpos
12232eval $inlibc
12233
758a5d79
JH
12234: see if finite exists
12235set finite d_finite
12236eval $inlibc
12237
12238: see if finitel exists
12239set finitel d_finitel
12240eval $inlibc
12241
b4eb6b3d
JH
12242: see if flock exists
12243set flock d_flock
12244eval $inlibc
12245
2ef53570
JH
12246: see if prototype for flock is available
12247echo " "
12248set d_flockproto flock $i_sysfile sys/file.h
12249eval $hasproto
12250
b4eb6b3d
JH
12251: see if fork exists
12252set fork d_fork
12253eval $inlibc
12254
758a5d79
JH
12255: see if fp_class exists
12256set fp_class d_fp_class
12257eval $inlibc
12258
b4eb6b3d
JH
12259: see if pathconf exists
12260set pathconf d_pathconf
12261eval $inlibc
12262
12263: see if fpathconf exists
12264set fpathconf d_fpathconf
12265eval $inlibc
12266
758a5d79
JH
12267: see if fpclass exists
12268set fpclass d_fpclass
12269eval $inlibc
12270
12271: see if fpclassify exists
12272set fpclassify d_fpclassify
12273eval $inlibc
12274
12275: see if fpclassl exists
12276set fpclassl d_fpclassl
12277eval $inlibc
12278
b4eb6b3d
JH
12279
12280: check for fpos64_t
12281echo " "
12282echo "Checking to see if you have fpos64_t..." >&4
12283$cat >try.c <<EOCP
12284#include <stdio.h>
12285int main() { fpos64_t x = 7; }
12286EOCP
12287set try
12288if eval $compile; then
12289 val="$define"
12290 echo "You have fpos64_t."
12291else
12292 val="$undef"
12293 echo "You do not have fpos64_t."
12294 case "$fpossize" in
12295 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12296 esac
12297fi
12298$rm -f try.* try
12299set d_fpos64_t
12300eval $setvar
12301
12302: see if frexpl exists
12303set frexpl d_frexpl
12304eval $inlibc
12305
b4eb6b3d
JH
12306: see if this is a sys/param system
12307set sys/param.h i_sysparam
12308eval $inhdr
12309
12310: see if this is a sys/mount.h system
12311set sys/mount.h i_sysmount
12312eval $inhdr
12313
b4eb6b3d
JH
12314
12315echo " "
12316echo "Checking to see if your system supports struct fs_data..." >&4
12317set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12318eval $hasstruct
12319case "$d_fs_data_s" in
12320"$define") echo "Yes, it does." ;;
12321*) echo "No, it doesn't." ;;
12322esac
12323
12324: see if fseeko exists
12325set fseeko d_fseeko
12326eval $inlibc
12327case "$longsize" in
123288) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12329esac
12330
12331: see if fsetpos exists
12332set fsetpos d_fsetpos
12333eval $inlibc
12334
12335
12336: see if fstatfs exists
12337set fstatfs d_fstatfs
12338eval $inlibc
12339
12340
12341: see if statvfs exists
12342set statvfs d_statvfs
12343eval $inlibc
12344
12345: see if fstatvfs exists
12346set fstatvfs d_fstatvfs
12347eval $inlibc
12348
12349
411ab01c
JH
12350: see if fsync exists
12351set fsync d_fsync
12352eval $inlibc
12353
b4eb6b3d
JH
12354: see if ftello exists
12355set ftello d_ftello
12356eval $inlibc
12357case "$longsize" in
123588) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12359esac
12360
12361: see if getcwd exists
12362set getcwd d_getcwd
12363eval $inlibc
12364
12365: see if getespwnam exists
12366set getespwnam d_getespwnam
12367eval $inlibc
12368
12369
12370: see if getfsstat exists
12371set getfsstat d_getfsstat
12372eval $inlibc
12373
12374: see if getgrent exists
12375set getgrent d_getgrent
12376eval $inlibc
12377
10bc17b6
JH
12378: see if getgrent_r exists
12379set getgrent_r d_getgrent_r
12380eval $inlibc
12381case "$d_getgrent_r" in
12382"$define")
12383 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12384 case "$d_getgrent_r_proto:$usethreads" in
12385 ":define") d_getgrent_r_proto=define
a48ec845
JH
12386 set d_getgrent_r_proto getgrent_r $hdrs
12387 eval $hasproto ;;
12388 *) ;;
12389 esac
12390 case "$d_getgrent_r_proto" in
12391 define)
10bc17b6
JH
12392 case "$getgrent_r_proto" in
12393 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12394 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12395 esac
12396 case "$getgrent_r_proto" in
12397 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12398 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12399 esac
12400 case "$getgrent_r_proto" in
12401 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12402 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12403 esac
12404 case "$getgrent_r_proto" in
12405 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12406 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12407 esac
12408 case "$getgrent_r_proto" in
12409 ''|0) try='int getgrent_r(struct group*, char*, int);'
12410 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12411 esac
12412 case "$getgrent_r_proto" in
12413 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12414 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12415 esac
12416 case "$getgrent_r_proto" in
90e831dc 12417 ''|0) d_getgrent_r=undef
10bc17b6 12418 getgrent_r_proto=0
a48ec845 12419 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12420 * ) case "$getgrent_r_proto" in
12421 REENTRANT_PROTO*) ;;
12422 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12423 esac
12424 echo "Prototype: $try" ;;
12425 esac
12426 ;;
c18e646a
JH
12427 *) case "$usethreads" in
12428 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12429 esac
90e831dc
SB
12430 d_getgrent_r=undef
12431 getgrent_r_proto=0
c18e646a 12432 ;;
a48ec845
JH
12433 esac
12434 ;;
10bc17b6
JH
12435*) getgrent_r_proto=0
12436 ;;
12437esac
12438
12439: see if getgrgid_r exists
12440set getgrgid_r d_getgrgid_r
12441eval $inlibc
12442case "$d_getgrgid_r" in
12443"$define")
12444 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12445 case "$d_getgrgid_r_proto:$usethreads" in
12446 ":define") d_getgrgid_r_proto=define
a48ec845
JH
12447 set d_getgrgid_r_proto getgrgid_r $hdrs
12448 eval $hasproto ;;
12449 *) ;;
12450 esac
12451 case "$d_getgrgid_r_proto" in
12452 define)
10bc17b6
JH
12453 case "$getgrgid_r_proto" in
12454 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12455 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12456 esac
12457 case "$getgrgid_r_proto" in
12458 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12459 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12460 esac
12461 case "$getgrgid_r_proto" in
12462 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12463 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12464 esac
12465 case "$getgrgid_r_proto" in
12466 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12467 ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12468 esac
12469 case "$getgrgid_r_proto" in
90e831dc 12470 ''|0) d_getgrgid_r=undef
10bc17b6 12471 getgrgid_r_proto=0
a48ec845 12472 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12473 * ) case "$getgrgid_r_proto" in
12474 REENTRANT_PROTO*) ;;
12475 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12476 esac
12477 echo "Prototype: $try" ;;
12478 esac
12479 ;;
c18e646a
JH
12480 *) case "$usethreads" in
12481 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12482 esac
90e831dc
SB
12483 d_getgrgid_r=undef
12484 getgrgid_r_proto=0
c18e646a 12485 ;;
a48ec845
JH
12486 esac
12487 ;;
10bc17b6
JH
12488*) getgrgid_r_proto=0
12489 ;;
12490esac
12491
12492: see if getgrnam_r exists
12493set getgrnam_r d_getgrnam_r
12494eval $inlibc
12495case "$d_getgrnam_r" in
12496"$define")
12497 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12498 case "$d_getgrnam_r_proto:$usethreads" in
12499 ":define") d_getgrnam_r_proto=define
a48ec845
JH
12500 set d_getgrnam_r_proto getgrnam_r $hdrs
12501 eval $hasproto ;;
12502 *) ;;
12503 esac
12504 case "$d_getgrnam_r_proto" in
12505 define)
10bc17b6
JH
12506 case "$getgrnam_r_proto" in
12507 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12508 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12509 esac
12510 case "$getgrnam_r_proto" in
12511 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12512 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12513 esac
12514 case "$getgrnam_r_proto" in
12515 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12516 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12517 esac
12518 case "$getgrnam_r_proto" in
12519 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12520 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12521 esac
12522 case "$getgrnam_r_proto" in
12523 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12524 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12525 esac
12526 case "$getgrnam_r_proto" in
90e831dc 12527 ''|0) d_getgrnam_r=undef
10bc17b6 12528 getgrnam_r_proto=0
a48ec845 12529 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12530 * ) case "$getgrnam_r_proto" in
12531 REENTRANT_PROTO*) ;;
12532 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12533 esac
12534 echo "Prototype: $try" ;;
12535 esac
12536 ;;
c18e646a
JH
12537 *) case "$usethreads" in
12538 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12539 esac
90e831dc
SB
12540 d_getgrnam_r=undef
12541 getgrnam_r_proto=0
c18e646a 12542 ;;
a48ec845
JH
12543 esac
12544 ;;
10bc17b6
JH
12545*) getgrnam_r_proto=0
12546 ;;
12547esac
12548
b4eb6b3d
JH
12549: see if gethostbyaddr exists
12550set gethostbyaddr d_gethbyaddr
12551eval $inlibc
12552
12553: see if gethostbyname exists
12554set gethostbyname d_gethbyname
12555eval $inlibc
12556
12557: see if gethostent exists
12558set gethostent d_gethent
12559eval $inlibc
12560
12561: see how we will look up host name
12562echo " "
12563call=''
12564if set gethostname val -f d_gethname; eval $csym; $val; then
12565 echo 'gethostname() found.' >&4
12566 d_gethname="$define"
12567 call=gethostname
12568fi
12569if set uname val -f d_uname; eval $csym; $val; then
12570 if ./xenix; then
12571 $cat <<'EOM'
12572uname() was found, but you're running xenix, and older versions of xenix
12573have a broken uname(). If you don't really know whether your xenix is old
12574enough to have a broken system call, use the default answer.
12575
12576EOM
12577 dflt=y
12578 case "$d_uname" in
12579 "$define") dflt=n;;
12580 esac
12581 rp='Is your uname() broken?'
12582 . ./myread
12583 case "$ans" in
12584 n*) d_uname="$define"; call=uname;;
12585 esac
12586 else
12587 echo 'uname() found.' >&4
12588 d_uname="$define"
12589 case "$call" in
12590 '') call=uname ;;
12591 esac
12592 fi
12593fi
12594case "$d_gethname" in
12595'') d_gethname="$undef";;
12596esac
12597case "$d_uname" in
12598'') d_uname="$undef";;
12599esac
12600case "$d_uname$d_gethname" in
12601*define*)
12602 dflt=n
12603 cat <<EOM
12604
12605Every now and then someone has a $call() that lies about the hostname
12606but can't be fixed for political or economic reasons. If you wish, I can
12607pretend $call() isn't there and maybe compute hostname at run-time
12608thanks to the '$phostname' command.
12609
12610EOM
12611 rp="Shall I ignore $call() from now on?"
12612 . ./myread
12613 case "$ans" in
12614 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12615 esac;;
12616esac
12617case "$phostname" in
12618'') aphostname='';;
12619*) case "$aphostname" in
12620 /*) ;;
12621 *) set X $phostname
12622 shift
12623 file=$1
12624 shift
12625 file=`./loc $file $file $pth`
12626 aphostname=`echo $file $*`
12627 ;;
12628 esac
12629 ;;
12630esac
12631case "$d_uname$d_gethname" in
12632*define*) ;;
12633*)
12634 case "$phostname" in
12635 '')
12636 echo "There will be no way for $package to get your hostname." >&4;;
12637 *)
12638 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12639 ;;
12640 esac;;
12641esac
12642case "$d_phostname" in
12643'') d_phostname="$undef";;
12644esac
12645
10bc17b6
JH
12646: see if gethostbyaddr_r exists
12647set gethostbyaddr_r d_gethostbyaddr_r
12648eval $inlibc
12649case "$d_gethostbyaddr_r" in
12650"$define")
12651 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12652 case "$d_gethostbyaddr_r_proto:$usethreads" in
12653 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
12654 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12655 eval $hasproto ;;
12656 *) ;;
12657 esac
12658 case "$d_gethostbyaddr_r_proto" in
12659 define)
10bc17b6
JH
12660 case "$gethostbyaddr_r_proto" in
12661 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12662 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12663 esac
12664 case "$gethostbyaddr_r_proto" in
12665 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12666 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12667 esac
12668 case "$gethostbyaddr_r_proto" in
12669 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12670 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12671 esac
12672 case "$gethostbyaddr_r_proto" in
12673 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12674 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12675 esac
12676 case "$gethostbyaddr_r_proto" in
12677 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12678 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12679 esac
12680 case "$gethostbyaddr_r_proto" in
12681 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12682 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12683 esac
12684 case "$gethostbyaddr_r_proto" in
12685 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12686 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12687 esac
12688 case "$gethostbyaddr_r_proto" in
12689 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12690 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12691 esac
12692 case "$gethostbyaddr_r_proto" in
12693 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12694 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12695 esac
12696 case "$gethostbyaddr_r_proto" in
12697 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12698 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12699 esac
12700 case "$gethostbyaddr_r_proto" in
c71a3471
JH
12701 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12702 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12703 esac
12704 case "$gethostbyaddr_r_proto" in
90e831dc 12705 ''|0) d_gethostbyaddr_r=undef
10bc17b6 12706 gethostbyaddr_r_proto=0
a48ec845 12707 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12708 * ) case "$gethostbyaddr_r_proto" in
12709 REENTRANT_PROTO*) ;;
12710 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12711 esac
12712 echo "Prototype: $try" ;;
12713 esac
12714 ;;
c18e646a
JH
12715 *) case "$usethreads" in
12716 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12717 esac
90e831dc
SB
12718 d_gethostbyaddr_r=undef
12719 gethostbyaddr_r_proto=0
c18e646a 12720 ;;
a48ec845
JH
12721 esac
12722 ;;
10bc17b6
JH
12723*) gethostbyaddr_r_proto=0
12724 ;;
12725esac
12726
12727: see if gethostbyname_r exists
12728set gethostbyname_r d_gethostbyname_r
12729eval $inlibc
12730case "$d_gethostbyname_r" in
12731"$define")
12732 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12733 case "$d_gethostbyname_r_proto:$usethreads" in
12734 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
12735 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12736 eval $hasproto ;;
12737 *) ;;
12738 esac
12739 case "$d_gethostbyname_r_proto" in
12740 define)
10bc17b6
JH
12741 case "$gethostbyname_r_proto" in
12742 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12743 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12744 esac
12745 case "$gethostbyname_r_proto" in
12746 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12747 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12748 esac
12749 case "$gethostbyname_r_proto" in
12750 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12751 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12752 esac
12753 case "$gethostbyname_r_proto" in
90e831dc 12754 ''|0) d_gethostbyname_r=undef
10bc17b6 12755 gethostbyname_r_proto=0
a48ec845 12756 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12757 * ) case "$gethostbyname_r_proto" in
12758 REENTRANT_PROTO*) ;;
12759 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12760 esac
12761 echo "Prototype: $try" ;;
12762 esac
12763 ;;
c18e646a
JH
12764 *) case "$usethreads" in
12765 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12766 esac
90e831dc
SB
12767 d_gethostbyname_r=undef
12768 gethostbyname_r_proto=0
c18e646a 12769 ;;
a48ec845
JH
12770 esac
12771 ;;
10bc17b6
JH
12772*) gethostbyname_r_proto=0
12773 ;;
12774esac
12775
12776: see if gethostent_r exists
12777set gethostent_r d_gethostent_r
12778eval $inlibc
12779case "$d_gethostent_r" in
12780"$define")
12781 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12782 case "$d_gethostent_r_proto:$usethreads" in
12783 ":define") d_gethostent_r_proto=define
a48ec845
JH
12784 set d_gethostent_r_proto gethostent_r $hdrs
12785 eval $hasproto ;;
12786 *) ;;
12787 esac
12788 case "$d_gethostent_r_proto" in
12789 define)
10bc17b6
JH
12790 case "$gethostent_r_proto" in
12791 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12792 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12793 esac
12794 case "$gethostent_r_proto" in
12795 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12796 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12797 esac
12798 case "$gethostent_r_proto" in
12799 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12800 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12801 esac
12802 case "$gethostent_r_proto" in
12803 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12804 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12805 esac
12806 case "$gethostent_r_proto" in
12807 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12808 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12809 esac
12810 case "$gethostent_r_proto" in
12811 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12812 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12813 esac
12814 case "$gethostent_r_proto" in
90e831dc 12815 ''|0) d_gethostent_r=undef
10bc17b6 12816 gethostent_r_proto=0
a48ec845 12817 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12818 * ) case "$gethostent_r_proto" in
12819 REENTRANT_PROTO*) ;;
12820 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
12821 esac
12822 echo "Prototype: $try" ;;
12823 esac
12824 ;;
c18e646a
JH
12825 *) case "$usethreads" in
12826 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12827 esac
90e831dc
SB
12828 d_gethostent_r=undef
12829 gethostent_r_proto=0
c18e646a 12830 ;;
a48ec845
JH
12831 esac
12832 ;;
10bc17b6
JH
12833*) gethostent_r_proto=0
12834 ;;
12835esac
b4eb6b3d
JH
12836
12837: see if prototypes for various gethostxxx netdb.h functions are available
12838echo " "
12839set d_gethostprotos gethostent $i_netdb netdb.h
12840eval $hasproto
12841
4e0554ec
JH
12842: see if getitimer exists
12843set getitimer d_getitimer
12844eval $inlibc
12845
b4eb6b3d
JH
12846: see if getlogin exists
12847set getlogin d_getlogin
12848eval $inlibc
12849
10bc17b6
JH
12850: see if getlogin_r exists
12851set getlogin_r d_getlogin_r
12852eval $inlibc
12853case "$d_getlogin_r" in
12854"$define")
12855 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
12856 case "$d_getlogin_r_proto:$usethreads" in
12857 ":define") d_getlogin_r_proto=define
a48ec845
JH
12858 set d_getlogin_r_proto getlogin_r $hdrs
12859 eval $hasproto ;;
12860 *) ;;
12861 esac
12862 case "$d_getlogin_r_proto" in
12863 define)
10bc17b6
JH
12864 case "$getlogin_r_proto" in
12865 ''|0) try='int getlogin_r(char*, size_t);'
12866 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12867 esac
12868 case "$getlogin_r_proto" in
12869 ''|0) try='int getlogin_r(char*, int);'
12870 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12871 esac
12872 case "$getlogin_r_proto" in
12873 ''|0) try='char* getlogin_r(char*, size_t);'
12874 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12875 esac
12876 case "$getlogin_r_proto" in
12877 ''|0) try='char* getlogin_r(char*, int);'
12878 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12879 esac
12880 case "$getlogin_r_proto" in
90e831dc 12881 ''|0) d_getlogin_r=undef
10bc17b6 12882 getlogin_r_proto=0
a48ec845 12883 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12884 * ) case "$getlogin_r_proto" in
12885 REENTRANT_PROTO*) ;;
12886 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12887 esac
12888 echo "Prototype: $try" ;;
12889 esac
12890 ;;
c18e646a
JH
12891 *) case "$usethreads" in
12892 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12893 esac
90e831dc
SB
12894 d_getlogin_r=undef
12895 getlogin_r_proto=0
c18e646a 12896 ;;
a48ec845
JH
12897 esac
12898 ;;
10bc17b6
JH
12899*) getlogin_r_proto=0
12900 ;;
12901esac
12902
b4eb6b3d
JH
12903: see if getmnt exists
12904set getmnt d_getmnt
12905eval $inlibc
12906
12907: see if getmntent exists
12908set getmntent d_getmntent
12909eval $inlibc
12910
12911: see if getnetbyaddr exists
12912set getnetbyaddr d_getnbyaddr
12913eval $inlibc
12914
12915: see if getnetbyname exists
12916set getnetbyname d_getnbyname
12917eval $inlibc
12918
12919: see if getnetent exists
12920set getnetent d_getnent
12921eval $inlibc
12922
10bc17b6
JH
12923: see if getnetbyaddr_r exists
12924set getnetbyaddr_r d_getnetbyaddr_r
12925eval $inlibc
12926case "$d_getnetbyaddr_r" in
12927"$define")
12928 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12929 case "$d_getnetbyaddr_r_proto:$usethreads" in
12930 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
12931 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12932 eval $hasproto ;;
12933 *) ;;
12934 esac
12935 case "$d_getnetbyaddr_r_proto" in
12936 define)
10bc17b6
JH
12937 case "$getnetbyaddr_r_proto" in
12938 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12939 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12940 esac
12941 case "$getnetbyaddr_r_proto" in
12942 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12943 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12944 esac
12945 case "$getnetbyaddr_r_proto" in
12946 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12947 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12948 esac
12949 case "$getnetbyaddr_r_proto" in
12950 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12951 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12952 esac
12953 case "$getnetbyaddr_r_proto" in
12954 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12955 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12956 esac
12957 case "$getnetbyaddr_r_proto" in
12958 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12959 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12960 esac
12961 case "$getnetbyaddr_r_proto" in
12962 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12963 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12964 esac
12965 case "$getnetbyaddr_r_proto" in
c71a3471
JH
12966 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
12967 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
12968 esac
12969 case "$getnetbyaddr_r_proto" in
90e831dc 12970 ''|0) d_getnetbyaddr_r=undef
10bc17b6 12971 getnetbyaddr_r_proto=0
a48ec845 12972 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12973 * ) case "$getnetbyaddr_r_proto" in
12974 REENTRANT_PROTO*) ;;
12975 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12976 esac
12977 echo "Prototype: $try" ;;
12978 esac
12979 ;;
c18e646a
JH
12980 *) case "$usethreads" in
12981 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12982 esac
90e831dc
SB
12983 d_getnetbyaddr_r=undef
12984 getnetbyaddr_r_proto=0
c18e646a 12985 ;;
a48ec845
JH
12986 esac
12987 ;;
10bc17b6
JH
12988*) getnetbyaddr_r_proto=0
12989 ;;
12990esac
12991
12992: see if getnetbyname_r exists
12993set getnetbyname_r d_getnetbyname_r
12994eval $inlibc
12995case "$d_getnetbyname_r" in
12996"$define")
12997 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12998 case "$d_getnetbyname_r_proto:$usethreads" in
12999 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
13000 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13001 eval $hasproto ;;
13002 *) ;;
13003 esac
13004 case "$d_getnetbyname_r_proto" in
13005 define)
10bc17b6
JH
13006 case "$getnetbyname_r_proto" in
13007 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13008 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13009 esac
13010 case "$getnetbyname_r_proto" in
13011 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13012 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13013 esac
13014 case "$getnetbyname_r_proto" in
13015 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13016 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13017 esac
13018 case "$getnetbyname_r_proto" in
13019 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13020 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13021 esac
13022 case "$getnetbyname_r_proto" in
90e831dc 13023 ''|0) d_getnetbyname_r=undef
10bc17b6 13024 getnetbyname_r_proto=0
a48ec845 13025 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13026 * ) case "$getnetbyname_r_proto" in
13027 REENTRANT_PROTO*) ;;
13028 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13029 esac
13030 echo "Prototype: $try" ;;
13031 esac
13032 ;;
c18e646a
JH
13033 *) case "$usethreads" in
13034 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13035 esac
90e831dc
SB
13036 d_getnetbyname_r=undef
13037 getnetbyname_r_proto=0
c18e646a 13038 ;;
a48ec845
JH
13039 esac
13040 ;;
10bc17b6
JH
13041*) getnetbyname_r_proto=0
13042 ;;
13043esac
13044
13045: see if getnetent_r exists
13046set getnetent_r d_getnetent_r
13047eval $inlibc
13048case "$d_getnetent_r" in
13049"$define")
13050 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13051 case "$d_getnetent_r_proto:$usethreads" in
13052 ":define") d_getnetent_r_proto=define
a48ec845
JH
13053 set d_getnetent_r_proto getnetent_r $hdrs
13054 eval $hasproto ;;
13055 *) ;;
13056 esac
13057 case "$d_getnetent_r_proto" in
13058 define)
10bc17b6
JH
13059 case "$getnetent_r_proto" in
13060 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13061 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13062 esac
13063 case "$getnetent_r_proto" in
13064 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13065 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13066 esac
13067 case "$getnetent_r_proto" in
13068 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13069 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13070 esac
13071 case "$getnetent_r_proto" in
13072 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13073 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13074 esac
13075 case "$getnetent_r_proto" in
13076 ''|0) try='int getnetent_r(struct netent*, char*, int);'
13077 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13078 esac
13079 case "$getnetent_r_proto" in
13080 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13081 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13082 esac
13083 case "$getnetent_r_proto" in
90e831dc 13084 ''|0) d_getnetent_r=undef
10bc17b6 13085 getnetent_r_proto=0
a48ec845 13086 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13087 * ) case "$getnetent_r_proto" in
13088 REENTRANT_PROTO*) ;;
13089 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13090 esac
13091 echo "Prototype: $try" ;;
13092 esac
13093 ;;
c18e646a
JH
13094 *) case "$usethreads" in
13095 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13096 esac
90e831dc
SB
13097 d_getnetent_r=undef
13098 getnetent_r_proto=0
c18e646a 13099 ;;
a48ec845
JH
13100 esac
13101 ;;
10bc17b6
JH
13102*) getnetent_r_proto=0
13103 ;;
13104esac
13105
b4eb6b3d
JH
13106: see if prototypes for various getnetxxx netdb.h functions are available
13107echo " "
13108set d_getnetprotos getnetent $i_netdb netdb.h
13109eval $hasproto
13110
0c0643d0
JH
13111: see if getpagesize exists
13112set getpagesize d_getpagsz
13113eval $inlibc
13114
b4eb6b3d
JH
13115
13116: see if getprotobyname exists
13117set getprotobyname d_getpbyname
13118eval $inlibc
13119
13120: see if getprotobynumber exists
13121set getprotobynumber d_getpbynumber
13122eval $inlibc
13123
13124: see if getprotoent exists
13125set getprotoent d_getpent
13126eval $inlibc
13127
13128: see if getpgid exists
13129set getpgid d_getpgid
13130eval $inlibc
13131
13132: see if getpgrp2 exists
13133set getpgrp2 d_getpgrp2
13134eval $inlibc
13135
13136: see if getppid exists
13137set getppid d_getppid
13138eval $inlibc
13139
13140: see if getpriority exists
13141set getpriority d_getprior
13142eval $inlibc
13143
10bc17b6
JH
13144: see if getprotobyname_r exists
13145set getprotobyname_r d_getprotobyname_r
13146eval $inlibc
13147case "$d_getprotobyname_r" in
13148"$define")
13149 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13150 case "$d_getprotobyname_r_proto:$usethreads" in
13151 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
13152 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13153 eval $hasproto ;;
13154 *) ;;
13155 esac
13156 case "$d_getprotobyname_r_proto" in
13157 define)
10bc17b6
JH
13158 case "$getprotobyname_r_proto" in
13159 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13160 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13161 esac
13162 case "$getprotobyname_r_proto" in
13163 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13164 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13165 esac
13166 case "$getprotobyname_r_proto" in
13167 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13168 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13169 esac
13170 case "$getprotobyname_r_proto" in
90e831dc 13171 ''|0) d_getprotobyname_r=undef
10bc17b6 13172 getprotobyname_r_proto=0
a48ec845 13173 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13174 * ) case "$getprotobyname_r_proto" in
13175 REENTRANT_PROTO*) ;;
13176 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13177 esac
13178 echo "Prototype: $try" ;;
13179 esac
13180 ;;
c18e646a
JH
13181 *) case "$usethreads" in
13182 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13183 esac
90e831dc
SB
13184 d_getprotobyname_r=undef
13185 getprotobyname_r_proto=0
c18e646a 13186 ;;
a48ec845
JH
13187 esac
13188 ;;
10bc17b6
JH
13189*) getprotobyname_r_proto=0
13190 ;;
13191esac
13192
13193: see if getprotobynumber_r exists
13194set getprotobynumber_r d_getprotobynumber_r
13195eval $inlibc
13196case "$d_getprotobynumber_r" in
13197"$define")
13198 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13199 case "$d_getprotobynumber_r_proto:$usethreads" in
13200 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
13201 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13202 eval $hasproto ;;
13203 *) ;;
13204 esac
13205 case "$d_getprotobynumber_r_proto" in
13206 define)
10bc17b6
JH
13207 case "$getprotobynumber_r_proto" in
13208 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13209 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13210 esac
13211 case "$getprotobynumber_r_proto" in
13212 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13213 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13214 esac
13215 case "$getprotobynumber_r_proto" in
13216 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13217 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13218 esac
13219 case "$getprotobynumber_r_proto" in
90e831dc 13220 ''|0) d_getprotobynumber_r=undef
10bc17b6 13221 getprotobynumber_r_proto=0
a48ec845 13222 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13223 * ) case "$getprotobynumber_r_proto" in
13224 REENTRANT_PROTO*) ;;
13225 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13226 esac
13227 echo "Prototype: $try" ;;
13228 esac
13229 ;;
c18e646a
JH
13230 *) case "$usethreads" in
13231 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13232 esac
90e831dc
SB
13233 d_getprotobynumber_r=undef
13234 getprotobynumber_r_proto=0
c18e646a 13235 ;;
a48ec845
JH
13236 esac
13237 ;;
10bc17b6
JH
13238*) getprotobynumber_r_proto=0
13239 ;;
13240esac
13241
13242: see if getprotoent_r exists
13243set getprotoent_r d_getprotoent_r
13244eval $inlibc
13245case "$d_getprotoent_r" in
13246"$define")
13247 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13248 case "$d_getprotoent_r_proto:$usethreads" in
13249 ":define") d_getprotoent_r_proto=define
a48ec845
JH
13250 set d_getprotoent_r_proto getprotoent_r $hdrs
13251 eval $hasproto ;;
13252 *) ;;
13253 esac
13254 case "$d_getprotoent_r_proto" in
13255 define)
10bc17b6
JH
13256 case "$getprotoent_r_proto" in
13257 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13258 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13259 esac
13260 case "$getprotoent_r_proto" in
13261 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13262 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13263 esac
13264 case "$getprotoent_r_proto" in
13265 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13266 ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13267 esac
13268 case "$getprotoent_r_proto" in
13269 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13270 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13271 esac
13272 case "$getprotoent_r_proto" in
90e831dc 13273 ''|0) d_getprotoent_r=undef
10bc17b6 13274 getprotoent_r_proto=0
a48ec845 13275 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13276 * ) case "$getprotoent_r_proto" in
13277 REENTRANT_PROTO*) ;;
13278 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13279 esac
13280 echo "Prototype: $try" ;;
13281 esac
13282 ;;
c18e646a
JH
13283 *) case "$usethreads" in
13284 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13285 esac
90e831dc
SB
13286 d_getprotoent_r=undef
13287 getprotoent_r_proto=0
c18e646a 13288 ;;
a48ec845
JH
13289 esac
13290 ;;
10bc17b6
JH
13291*) getprotoent_r_proto=0
13292 ;;
13293esac
13294
b4eb6b3d
JH
13295: see if prototypes for various getprotoxxx netdb.h functions are available
13296echo " "
13297set d_getprotoprotos getprotoent $i_netdb netdb.h
13298eval $hasproto
13299
13300: see if getprpwnam exists
13301set getprpwnam d_getprpwnam
13302eval $inlibc
13303
13304: see if getpwent exists
13305set getpwent d_getpwent
13306eval $inlibc
13307
10bc17b6
JH
13308: see if getpwent_r exists
13309set getpwent_r d_getpwent_r
13310eval $inlibc
13311case "$d_getpwent_r" in
13312"$define")
13313 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13314 case "$d_getpwent_r_proto:$usethreads" in
13315 ":define") d_getpwent_r_proto=define
a48ec845
JH
13316 set d_getpwent_r_proto getpwent_r $hdrs
13317 eval $hasproto ;;
13318 *) ;;
13319 esac
13320 case "$d_getpwent_r_proto" in
13321 define)
10bc17b6
JH
13322 case "$getpwent_r_proto" in
13323 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13324 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13325 esac
13326 case "$getpwent_r_proto" in
13327 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13328 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13329 esac
13330 case "$getpwent_r_proto" in
13331 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13332 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13333 esac
13334 case "$getpwent_r_proto" in
13335 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13336 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13337 esac
13338 case "$getpwent_r_proto" in
13339 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13340 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13341 esac
13342 case "$getpwent_r_proto" in
13343 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13344 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13345 esac
13346 case "$getpwent_r_proto" in
90e831dc 13347 ''|0) d_getpwent_r=undef
10bc17b6 13348 getpwent_r_proto=0
a48ec845 13349 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13350 * ) case "$getpwent_r_proto" in
13351 REENTRANT_PROTO*) ;;
13352 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13353 esac
13354 echo "Prototype: $try" ;;
13355 esac
13356 ;;
c18e646a
JH
13357 *) case "$usethreads" in
13358 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13359 esac
90e831dc
SB
13360 d_getpwent_r=undef
13361 getpwent_r_proto=0
c18e646a 13362 ;;
a48ec845
JH
13363 esac
13364 ;;
10bc17b6
JH
13365*) getpwent_r_proto=0
13366 ;;
13367esac
13368
13369: see if getpwnam_r exists
13370set getpwnam_r d_getpwnam_r
13371eval $inlibc
13372case "$d_getpwnam_r" in
13373"$define")
13374 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13375 case "$d_getpwnam_r_proto:$usethreads" in
13376 ":define") d_getpwnam_r_proto=define
a48ec845
JH
13377 set d_getpwnam_r_proto getpwnam_r $hdrs
13378 eval $hasproto ;;
13379 *) ;;
13380 esac
13381 case "$d_getpwnam_r_proto" in
13382 define)
10bc17b6
JH
13383 case "$getpwnam_r_proto" in
13384 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13385 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13386 esac
13387 case "$getpwnam_r_proto" in
13388 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13389 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13390 esac
13391 case "$getpwnam_r_proto" in
13392 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13393 ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13394 esac
13395 case "$getpwnam_r_proto" in
13396 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13397 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13398 esac
13399 case "$getpwnam_r_proto" in
90e831dc 13400 ''|0) d_getpwnam_r=undef
10bc17b6 13401 getpwnam_r_proto=0
a48ec845 13402 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13403 * ) case "$getpwnam_r_proto" in
13404 REENTRANT_PROTO*) ;;
13405 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13406 esac
13407 echo "Prototype: $try" ;;
13408 esac
13409 ;;
c18e646a
JH
13410 *) case "$usethreads" in
13411 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13412 esac
90e831dc
SB
13413 d_getpwnam_r=undef
13414 getpwnam_r_proto=0
c18e646a 13415 ;;
a48ec845
JH
13416 esac
13417 ;;
10bc17b6
JH
13418*) getpwnam_r_proto=0
13419 ;;
13420esac
13421
13422: see if getpwuid_r exists
13423set getpwuid_r d_getpwuid_r
13424eval $inlibc
13425case "$d_getpwuid_r" in
13426"$define")
13427 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13428 case "$d_getpwuid_r_proto:$usethreads" in
13429 ":define") d_getpwuid_r_proto=define
a48ec845
JH
13430 set d_getpwuid_r_proto getpwuid_r $hdrs
13431 eval $hasproto ;;
13432 *) ;;
13433 esac
13434 case "$d_getpwuid_r_proto" in
13435 define)
10bc17b6
JH
13436 case "$getpwuid_r_proto" in
13437 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13438 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13439 esac
13440 case "$getpwuid_r_proto" in
13441 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13442 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13443 esac
13444 case "$getpwuid_r_proto" in
13445 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13446 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13447 esac
13448 case "$getpwuid_r_proto" in
13449 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13450 ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13451 esac
13452 case "$getpwuid_r_proto" in
90e831dc 13453 ''|0) d_getpwuid_r=undef
10bc17b6 13454 getpwuid_r_proto=0
a48ec845 13455 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13456 * ) case "$getpwuid_r_proto" in
13457 REENTRANT_PROTO*) ;;
13458 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13459 esac
13460 echo "Prototype: $try" ;;
13461 esac
13462 ;;
c18e646a
JH
13463 *) case "$usethreads" in
13464 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13465 esac
90e831dc
SB
13466 d_getpwuid_r=undef
13467 getpwuid_r_proto=0
c18e646a 13468 ;;
a48ec845
JH
13469 esac
13470 ;;
10bc17b6
JH
13471*) getpwuid_r_proto=0
13472 ;;
13473esac
13474
b4eb6b3d
JH
13475
13476: see if getservbyname exists
13477set getservbyname d_getsbyname
13478eval $inlibc
13479
13480: see if getservbyport exists
13481set getservbyport d_getsbyport
13482eval $inlibc
13483
13484: see if getservent exists
13485set getservent d_getsent
13486eval $inlibc
13487
10bc17b6
JH
13488: see if getservbyname_r exists
13489set getservbyname_r d_getservbyname_r
13490eval $inlibc
13491case "$d_getservbyname_r" in
13492"$define")
13493 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13494 case "$d_getservbyname_r_proto:$usethreads" in
13495 ":define") d_getservbyname_r_proto=define
a48ec845
JH
13496 set d_getservbyname_r_proto getservbyname_r $hdrs
13497 eval $hasproto ;;
13498 *) ;;
13499 esac
13500 case "$d_getservbyname_r_proto" in
13501 define)
10bc17b6
JH
13502 case "$getservbyname_r_proto" in
13503 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13504 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13505 esac
13506 case "$getservbyname_r_proto" in
13507 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13508 ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13509 esac
13510 case "$getservbyname_r_proto" in
13511 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13512 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13513 esac
13514 case "$getservbyname_r_proto" in
90e831dc 13515 ''|0) d_getservbyname_r=undef
10bc17b6 13516 getservbyname_r_proto=0
a48ec845 13517 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13518 * ) case "$getservbyname_r_proto" in
13519 REENTRANT_PROTO*) ;;
13520 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13521 esac
13522 echo "Prototype: $try" ;;
13523 esac
13524 ;;
c18e646a
JH
13525 *) case "$usethreads" in
13526 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13527 esac
90e831dc
SB
13528 d_getservbyname_r=undef
13529 getservbyname_r_proto=0
c18e646a 13530 ;;
a48ec845
JH
13531 esac
13532 ;;
10bc17b6
JH
13533*) getservbyname_r_proto=0
13534 ;;
13535esac
13536
13537: see if getservbyport_r exists
13538set getservbyport_r d_getservbyport_r
13539eval $inlibc
13540case "$d_getservbyport_r" in
13541"$define")
13542 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13543 case "$d_getservbyport_r_proto:$usethreads" in
13544 ":define") d_getservbyport_r_proto=define
a48ec845
JH
13545 set d_getservbyport_r_proto getservbyport_r $hdrs
13546 eval $hasproto ;;
13547 *) ;;
13548 esac
13549 case "$d_getservbyport_r_proto" in
13550 define)
10bc17b6
JH
13551 case "$getservbyport_r_proto" in
13552 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13553 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13554 esac
13555 case "$getservbyport_r_proto" in
13556 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13557 ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13558 esac
13559 case "$getservbyport_r_proto" in
13560 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13561 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13562 esac
13563 case "$getservbyport_r_proto" in
90e831dc 13564 ''|0) d_getservbyport_r=undef
10bc17b6 13565 getservbyport_r_proto=0
a48ec845 13566 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13567 * ) case "$getservbyport_r_proto" in
13568 REENTRANT_PROTO*) ;;
13569 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13570 esac
13571 echo "Prototype: $try" ;;
13572 esac
13573 ;;
c18e646a
JH
13574 *) case "$usethreads" in
13575 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13576 esac
90e831dc
SB
13577 d_getservbyport_r=undef
13578 getservbyport_r_proto=0
c18e646a 13579 ;;
a48ec845
JH
13580 esac
13581 ;;
10bc17b6
JH
13582*) getservbyport_r_proto=0
13583 ;;
13584esac
13585
13586: see if getservent_r exists
13587set getservent_r d_getservent_r
13588eval $inlibc
13589case "$d_getservent_r" in
13590"$define")
13591 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13592 case "$d_getservent_r_proto:$usethreads" in
13593 ":define") d_getservent_r_proto=define
a48ec845
JH
13594 set d_getservent_r_proto getservent_r $hdrs
13595 eval $hasproto ;;
13596 *) ;;
13597 esac
13598 case "$d_getservent_r_proto" in
13599 define)
10bc17b6
JH
13600 case "$getservent_r_proto" in
13601 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13602 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13603 esac
13604 case "$getservent_r_proto" in
13605 ''|0) try='int getservent_r(struct servent*, char*, int);'
13606 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13607 esac
13608 case "$getservent_r_proto" in
13609 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13610 ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13611 esac
13612 case "$getservent_r_proto" in
13613 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13614 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13615 esac
13616 case "$getservent_r_proto" in
90e831dc 13617 ''|0) d_getservent_r=undef
10bc17b6 13618 getservent_r_proto=0
a48ec845 13619 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13620 * ) case "$getservent_r_proto" in
13621 REENTRANT_PROTO*) ;;
13622 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13623 esac
13624 echo "Prototype: $try" ;;
13625 esac
13626 ;;
c18e646a
JH
13627 *) case "$usethreads" in
13628 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13629 esac
90e831dc
SB
13630 d_getservent_r=undef
13631 getservent_r_proto=0
c18e646a 13632 ;;
a48ec845
JH
13633 esac
13634 ;;
10bc17b6
JH
13635*) getservent_r_proto=0
13636 ;;
13637esac
13638
b4eb6b3d
JH
13639: see if prototypes for various getservxxx netdb.h functions are available
13640echo " "
13641set d_getservprotos getservent $i_netdb netdb.h
13642eval $hasproto
13643
13644: see if getspnam exists
13645set getspnam d_getspnam
13646eval $inlibc
13647
10bc17b6
JH
13648: see if this is a shadow.h system
13649set shadow.h i_shadow
13650eval $inhdr
13651
13652: see if getspnam_r exists
13653set getspnam_r d_getspnam_r
13654eval $inlibc
13655case "$d_getspnam_r" in
13656"$define")
13657 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
13658 case "$d_getspnam_r_proto:$usethreads" in
13659 ":define") d_getspnam_r_proto=define
a48ec845
JH
13660 set d_getspnam_r_proto getspnam_r $hdrs
13661 eval $hasproto ;;
13662 *) ;;
13663 esac
13664 case "$d_getspnam_r_proto" in
13665 define)
10bc17b6
JH
13666 case "$getspnam_r_proto" in
13667 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13668 ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13669 esac
13670 case "$getspnam_r_proto" in
13671 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13672 ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13673 esac
13674 case "$getspnam_r_proto" in
90e831dc 13675 ''|0) d_getspnam_r=undef
10bc17b6 13676 getspnam_r_proto=0
a48ec845 13677 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13678 * ) case "$getspnam_r_proto" in
13679 REENTRANT_PROTO*) ;;
13680 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13681 esac
13682 echo "Prototype: $try" ;;
13683 esac
13684 ;;
c18e646a
JH
13685 *) case "$usethreads" in
13686 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13687 esac
90e831dc
SB
13688 d_getspnam_r=undef
13689 getspnam_r_proto=0
c18e646a 13690 ;;
a48ec845
JH
13691 esac
13692 ;;
10bc17b6
JH
13693*) getspnam_r_proto=0
13694 ;;
13695esac
13696
b4eb6b3d
JH
13697: see if gettimeofday or ftime exists
13698set gettimeofday d_gettimeod
13699eval $inlibc
13700case "$d_gettimeod" in
13701"$undef")
13702 set ftime d_ftime
13703 eval $inlibc
13704 ;;
13705*)
13706 val="$undef"; set d_ftime; eval $setvar
13707 ;;
13708esac
13709case "$d_gettimeod$d_ftime" in
13710"$undef$undef")
13711 echo " "
13712 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13713 ;;
13714esac
13715
10bc17b6
JH
13716: see if gmtime_r exists
13717set gmtime_r d_gmtime_r
13718eval $inlibc
13719case "$d_gmtime_r" in
13720"$define")
d63eadf0 13721 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
13722 case "$d_gmtime_r_proto:$usethreads" in
13723 ":define") d_gmtime_r_proto=define
a48ec845
JH
13724 set d_gmtime_r_proto gmtime_r $hdrs
13725 eval $hasproto ;;
13726 *) ;;
13727 esac
13728 case "$d_gmtime_r_proto" in
13729 define)
10bc17b6
JH
13730 case "$gmtime_r_proto" in
13731 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13732 ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13733 esac
13734 case "$gmtime_r_proto" in
13735 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13736 ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13737 esac
13738 case "$gmtime_r_proto" in
90e831dc 13739 ''|0) d_gmtime_r=undef
10bc17b6 13740 gmtime_r_proto=0
a48ec845 13741 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13742 * ) case "$gmtime_r_proto" in
13743 REENTRANT_PROTO*) ;;
13744 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13745 esac
13746 echo "Prototype: $try" ;;
13747 esac
b4eb6b3d 13748 ;;
c18e646a
JH
13749 *) case "$usethreads" in
13750 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13751 esac
90e831dc
SB
13752 d_gmtime_r=undef
13753 gmtime_r_proto=0
c18e646a 13754 ;;
a48ec845
JH
13755 esac
13756 ;;
10bc17b6 13757*) gmtime_r_proto=0
b4eb6b3d
JH
13758 ;;
13759esac
13760
13761: see if hasmntopt exists
13762set hasmntopt d_hasmntopt
13763eval $inlibc
13764
13765: see if this is a netinet/in.h or sys/in.h system
13766set netinet/in.h i_niin sys/in.h i_sysin
13767eval $inhdr
13768
13769: see if arpa/inet.h has to be included
13770set arpa/inet.h i_arpainet
13771eval $inhdr
13772
13773: see if htonl --and friends-- exists
13774val=''
13775set htonl val
13776eval $inlibc
13777
13778: Maybe they are macros.
13779case "$val" in
13780$undef)
13781 $cat >htonl.c <<EOM
13782#include <stdio.h>
13783#include <sys/types.h>
13784#$i_niin I_NETINET_IN
13785#$i_sysin I_SYS_IN
13786#$i_arpainet I_ARPA_INET
13787#ifdef I_NETINET_IN
13788#include <netinet/in.h>
13789#endif
13790#ifdef I_SYS_IN
13791#include <sys/in.h>
13792#endif
13793#ifdef I_ARPA_INET
13794#include <arpa/inet.h>
13795#endif
13796#ifdef htonl
13797printf("Defined as a macro.");
13798#endif
13799EOM
13800 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13801 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13802 val="$define"
13803 echo "But it seems to be defined as a macro." >&4
13804 fi
13805 $rm -f htonl.?
13806 ;;
13807esac
13808set d_htonl
13809eval $setvar
13810
5a29c6bc
JH
13811: see if ilogbl exists
13812set ilogbl d_ilogbl
13813eval $inlibc
13814
b4eb6b3d
JH
13815: index or strchr
13816echo " "
13817if set index val -f; eval $csym; $val; then
13818 if set strchr val -f d_strchr; eval $csym; $val; then
13819 if $contains strchr "$strings" >/dev/null 2>&1 ; then
13820 val="$define"
13821 vali="$undef"
13822 echo "strchr() found." >&4
13823 else
13824 val="$undef"
13825 vali="$define"
13826 echo "index() found." >&4
13827 fi
13828 else
13829 val="$undef"
13830 vali="$define"
8dfa8df9
JH
13831 echo "index() found." >&4
13832 fi
b4eb6b3d 13833else
8dfa8df9
JH
13834 if set strchr val -f d_strchr; eval $csym; $val; then
13835 val="$define"
13836 vali="$undef"
13837 echo "strchr() found." >&4
13838 else
13839 echo "No index() or strchr() found!" >&4
13840 val="$undef"
13841 vali="$undef"
13842 fi
b4eb6b3d 13843fi
8dfa8df9
JH
13844set d_strchr; eval $setvar
13845val="$vali"
13846set d_index; eval $setvar
13847
13848: check whether inet_aton exists
13849set inet_aton d_inetaton
13850eval $inlibc
b4eb6b3d
JH
13851
13852: Look for isascii
13853echo " "
5a29c6bc 13854$cat >isascii.c <<EOCP
b4eb6b3d
JH
13855#include <stdio.h>
13856#include <ctype.h>
5a29c6bc
JH
13857#$i_stdlib I_STDLIB
13858#ifdef I_STDLIB
13859#include <stdlib.h>
13860#endif
b4eb6b3d
JH
13861int main() {
13862 int c = 'A';
13863 if (isascii(c))
13864 exit(0);
13865 else
13866 exit(1);
13867}
13868EOCP
13869set isascii
13870if eval $compile; then
13871 echo "isascii() found." >&4
13872 val="$define"
13873else
13874 echo "isascii() NOT found." >&4
13875 val="$undef"
13876fi
13877set d_isascii
13878eval $setvar
13879$rm -f isascii*
13880
758a5d79
JH
13881: see if isfinite exists
13882set isfinite d_isfinite
13883eval $inlibc
13884
13885: see if isinf exists
13886set isinf d_isinf
13887eval $inlibc
13888
b4eb6b3d
JH
13889: see if isnan exists
13890set isnan d_isnan
13891eval $inlibc
13892
13893: see if isnanl exists
13894set isnanl d_isnanl
13895eval $inlibc
13896
13897: see if killpg exists
13898set killpg d_killpg
13899eval $inlibc
13900
13901: see if lchown exists
13902echo " "
13903$cat > try.c <<'EOCP'
13904/* System header to define __stub macros and hopefully few prototypes,
13905 which can conflict with char lchown(); below. */
13906#include <assert.h>
13907/* Override any gcc2 internal prototype to avoid an error. */
13908/* We use char because int might match the return type of a gcc2
13909 builtin and then its argument prototype would still apply. */
13910char lchown();
13911int main() {
13912 /* The GNU C library defines this for functions which it implements
13913 to always fail with ENOSYS. Some functions are actually named
13914 something starting with __ and the normal name is an alias. */
13915#if defined (__stub_lchown) || defined (__stub___lchown)
13916choke me
13917#else
13918lchown();
13919#endif
13920; return 0; }
13921EOCP
13922set try
13923if eval $compile; then
13924 $echo "lchown() found." >&4
13925 val="$define"
13926else
13927 $echo "lchown() NOT found." >&4
13928 val="$undef"
13929fi
13930set d_lchown
13931eval $setvar
13932
13933: See if number of significant digits in a double precision number is known
13934echo " "
13935$cat >ldbl_dig.c <<EOM
13936#$i_limits I_LIMITS
13937#$i_float I_FLOAT
13938#ifdef I_LIMITS
13939#include <limits.h>
13940#endif
13941#ifdef I_FLOAT
13942#include <float.h>
13943#endif
13944#ifdef LDBL_DIG
13945printf("Contains LDBL_DIG");
13946#endif
13947EOM
13948$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13949if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13950 echo "LDBL_DIG found." >&4
13951 val="$define"
13952else
13953 echo "LDBL_DIG NOT found." >&4
13954 val="$undef"
13955fi
13956$rm -f ldbl_dig.?
13957set d_ldbl_dig
13958eval $setvar
13959
a663fd0a
AT
13960: see if this is a math.h system
13961set math.h i_math
13962eval $inhdr
13963
13964d_libm_lib_version="$undef"
13965case $i_math in
13966 $define)
13967 : check to see if math.h defines _LIB_VERSION
13968 echo " "
13969 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
13970 $cat >try.c <<EOCP
13971#include <unistd.h>
13972#include <math.h>
13973int main (int argc, char *argv[])
13974{
13975 printf ("%d\n", _LIB_VERSION);
13976 return (0);
13977 } /* main */
13978EOCP
13979 set try
13980 if eval $compile; then
13981 foo=`$run ./try`
13982 echo "Yes, it does ($foo)" >&4
13983 d_libm_lib_version="$define"
13984 else
13985 echo "No, it does not (probably harmless)\n" >&4
13986 fi
13987 $rm -f try.* try core core.try.*
13988 ;;
13989
13990 esac
13991
b4eb6b3d
JH
13992: see if link exists
13993set link d_link
13994eval $inlibc
13995
10bc17b6
JH
13996: see if localtime_r exists
13997set localtime_r d_localtime_r
13998eval $inlibc
13999case "$d_localtime_r" in
14000"$define")
d63eadf0 14001 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14002 case "$d_localtime_r_proto:$usethreads" in
14003 ":define") d_localtime_r_proto=define
a48ec845
JH
14004 set d_localtime_r_proto localtime_r $hdrs
14005 eval $hasproto ;;
14006 *) ;;
14007 esac
14008 case "$d_localtime_r_proto" in
14009 define)
10bc17b6
JH
14010 case "$localtime_r_proto" in
14011 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14012 ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14013 esac
14014 case "$localtime_r_proto" in
14015 ''|0) try='int localtime_r(const time_t*, struct tm*);'
14016 ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14017 esac
14018 case "$localtime_r_proto" in
90e831dc 14019 ''|0) d_localtime_r=undef
10bc17b6 14020 localtime_r_proto=0
a48ec845 14021 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14022 * ) case "$localtime_r_proto" in
14023 REENTRANT_PROTO*) ;;
14024 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14025 esac
14026 echo "Prototype: $try" ;;
14027 esac
14028 ;;
c18e646a
JH
14029 *) case "$usethreads" in
14030 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14031 esac
90e831dc
SB
14032 d_localtime_r=undef
14033 localtime_r_proto=0
c18e646a 14034 ;;
a48ec845
JH
14035 esac
14036 ;;
10bc17b6
JH
14037*) localtime_r_proto=0
14038 ;;
14039esac
14040
b4eb6b3d
JH
14041: see if localeconv exists
14042set localeconv d_locconv
14043eval $inlibc
14044
14045: see if lockf exists
14046set lockf d_lockf
14047eval $inlibc
14048
b4eb6b3d
JH
14049: see if prototype for lseek is available
14050echo " "
4786929f 14051set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
14052eval $hasproto
14053
14054: see if lstat exists
14055set lstat d_lstat
14056eval $inlibc
14057
14058: see if madvise exists
14059set madvise d_madvise
14060eval $inlibc
14061
14062: see if mblen exists
14063set mblen d_mblen
14064eval $inlibc
14065
14066: see if mbstowcs exists
14067set mbstowcs d_mbstowcs
14068eval $inlibc
14069
14070: see if mbtowc exists
14071set mbtowc d_mbtowc
14072eval $inlibc
14073
14074: see if memchr exists
14075set memchr d_memchr
14076eval $inlibc
14077
14078: see if memcmp exists
14079set memcmp d_memcmp
14080eval $inlibc
14081
14082: see if memcpy exists
14083set memcpy d_memcpy
14084eval $inlibc
14085
14086: see if memmove exists
14087set memmove d_memmove
14088eval $inlibc
14089
14090: see if memset exists
14091set memset d_memset
14092eval $inlibc
14093
14094: see if mkdir exists
14095set mkdir d_mkdir
14096eval $inlibc
14097
14098: see if mkdtemp exists
14099set mkdtemp d_mkdtemp
14100eval $inlibc
14101
14102: see if mkfifo exists
14103set mkfifo d_mkfifo
14104eval $inlibc
14105
14106: see if mkstemp exists
14107set mkstemp d_mkstemp
14108eval $inlibc
14109
14110: see if mkstemps exists
14111set mkstemps d_mkstemps
14112eval $inlibc
14113
14114: see if mktime exists
14115set mktime d_mktime
14116eval $inlibc
14117
14118: see if this is a sys/mman.h system
14119set sys/mman.h i_sysmman
14120eval $inhdr
14121
14122: see if mmap exists
14123set mmap d_mmap
14124eval $inlibc
14125: see what shmat returns
14126: default to something harmless
14127mmaptype='void *'
14128case "$i_sysmman$d_mmap" in
14129"$define$define")
14130 $cat >mmap.c <<'END'
14131#include <sys/mman.h>
14132void *mmap();
14133END
14134 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14135 mmaptype='void *'
14136 else
14137 mmaptype='caddr_t'
14138 fi
14139 echo "and it returns ($mmaptype)." >&4
14140 ;;
14141esac
14142
14143
14144
5a29c6bc
JH
14145: see if sqrtl exists
14146set sqrtl d_sqrtl
14147eval $inlibc
14148
f3479639
JH
14149: see if scalbnl exists
14150set scalbnl d_scalbnl
14151eval $inlibc
14152
5a29c6bc
JH
14153: see if modfl exists
14154set modfl d_modfl
14155eval $inlibc
14156
14157: see if prototype for modfl is available
14158echo " "
a663fd0a 14159set d_modflproto modfl $i_math math.h
5a29c6bc
JH
14160eval $hasproto
14161
14162d_modfl_pow32_bug="$undef"
14163
14164case "$d_longdbl$d_modfl" in
14165$define$define)
14166 $cat <<EOM
14167Checking to see whether your modfl() is okay for large values...
14168EOM
14169$cat >try.c <<EOCP
14170#include <math.h>
14171#include <stdio.h>
14172EOCP
14173if $test "X$d_modflproto" != "X$define"; then
14174 $cat >>try.c <<EOCP
14175/* Sigh. many current glibcs provide the function, but do not prototype it. */
14176long double modfl (long double, long double *);
14177EOCP
14178fi
14179$cat >>try.c <<EOCP
14180int main() {
14181 long double nv = 4294967303.15;
14182 long double v, w;
14183 v = modfl(nv, &w);
14184#ifdef __GLIBC__
14185 printf("glibc");
14186#endif
14187 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14188 return 0;
14189}
14190EOCP
14191 case "$osname:$gccversion" in
14192 aix:) saveccflags="$ccflags"
14193 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14194 esac
14195 set try
14196 if eval $compile; then
14197 foo=`$run ./try`
14198 case "$foo" in
14199 *" 4294967303.150000 1.150000 4294967302.000000")
14200 echo >&4 "Your modfl() is broken for large values."
14201 d_modfl_pow32_bug="$define"
14202 case "$foo" in
14203 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14204 ;;
14205 esac
14206 ;;
14207 *" 4294967303.150000 0.150000 4294967303.000000")
14208 echo >&4 "Your modfl() seems okay for large values."
14209 ;;
14210 *) echo >&4 "I don't understand your modfl() at all."
14211 d_modfl="$undef"
14212 ;;
14213 esac
14214 $rm -f try.* try core core.try.*
14215 else
14216 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14217 d_modfl="$undef"
14218 fi
14219 case "$osname:$gccversion" in
14220 aix:) ccflags="$saveccflags" ;; # restore
14221 esac
14222 ;;
14223esac
14224
14225if $test "$uselongdouble" = "$define"; then
f3479639
JH
14226 message=""
14227 if $test "$d_sqrtl" != "$define"; then
14228 message="$message sqrtl"
14229 fi
14230 if $test "$d_modfl" != "$define"; then
5a29c6bc
JH
14231 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14232 echo "You have both aintl and copysignl, so I can emulate modfl."
14233 else
f3479639 14234 message="$message modfl"
5a29c6bc 14235 fi
f3479639
JH
14236 fi
14237 if $test "$d_frexpl" != "$define"; then
14238 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14239 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14240 else
14241 message="$message frexpl"
14242 fi
14243 fi
5a29c6bc 14244
f3479639 14245 if $test "$message" != ""; then
5a29c6bc
JH
14246 $cat <<EOM >&4
14247
14248*** You requested the use of long doubles but you do not seem to have
f3479639
JH
14249*** the following mathematical functions needed for long double support:
14250*** $message
ff0950a8
JH
14251*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14252*** Cannot continue, aborting.
5a29c6bc
JH
14253
14254EOM
14255
ff0950a8 14256 exit 1
5a29c6bc
JH
14257 fi
14258fi
14259
b4eb6b3d
JH
14260: see if mprotect exists
14261set mprotect d_mprotect
14262eval $inlibc
14263
14264: see if msgctl exists
14265set msgctl d_msgctl
14266eval $inlibc
14267
14268: see if msgget exists
14269set msgget d_msgget
14270eval $inlibc
14271
14272: see if msgsnd exists
14273set msgsnd d_msgsnd
14274eval $inlibc
14275
14276: see if msgrcv exists
14277set msgrcv d_msgrcv
14278eval $inlibc
14279
14280: see how much of the 'msg*(2)' library is present.
14281h_msg=true
14282echo " "
14283case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14284*"$undef"*) h_msg=false;;
14285esac
14286case "$osname" in
14287freebsd)
14288 case "`ipcs 2>&1`" in
14289 "SVID messages"*"not configured"*)
14290 echo "Your $osname does not have the msg*(2) configured." >&4
14291 h_msg=false
14292 val="$undef"
14293 set msgctl d_msgctl
14294 eval $setvar
14295 set msgget d_msgget
14296 eval $setvar
14297 set msgsnd d_msgsnd
14298 eval $setvar
14299 set msgrcv d_msgrcv
14300 eval $setvar
14301 ;;
14302 esac
14303 ;;
14304esac
14305: we could also check for sys/ipc.h ...
14306if $h_msg && $test `./findhdr sys/msg.h`; then
14307 echo "You have the full msg*(2) library." >&4
14308 val="$define"
14309else
14310 echo "You don't have the full msg*(2) library." >&4
14311 val="$undef"
14312fi
14313set d_msg
14314eval $setvar
14315
4e0554ec
JH
14316
14317echo " "
14318echo "Checking to see if your system supports struct msghdr..." >&4
14319set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14320eval $hasstruct
14321case "$d_msghdr_s" in
14322"$define") echo "Yes, it does." ;;
14323*) echo "No, it doesn't." ;;
14324esac
14325
14326
b4eb6b3d
JH
14327: see if msync exists
14328set msync d_msync
14329eval $inlibc
14330
14331: see if munmap exists
14332set munmap d_munmap
14333eval $inlibc
14334
14335: see if nice exists
14336set nice d_nice
14337eval $inlibc
14338
2765b840
JH
14339: see if this is a langinfo.h system
14340set langinfo.h i_langinfo
14341eval $inhdr
14342
14343: see if nl_langinfo exists
14344set nl_langinfo d_nl_langinfo
14345eval $inlibc
14346
b4eb6b3d
JH
14347: check for length of character
14348echo " "
14349case "$charsize" in
14350'')
14351 echo "Checking to see how big your characters are (hey, you never know)..." >&4
ada8e391 14352 $cat >try.c <<EOCP
b4eb6b3d 14353#include <stdio.h>
5ed858ef
JH
14354#$i_stdlib I_STDLIB
14355#ifdef I_STDLIB
14356#include <stdlib.h>
14357#endif
b4eb6b3d
JH
14358int main()
14359{
14360 printf("%d\n", (int)sizeof(char));
14361 exit(0);
14362}
14363EOCP
14364 set try
14365 if eval $compile_ok; then
5440bc8e 14366 dflt=`$run ./try`
b4eb6b3d
JH
14367 else
14368 dflt='1'
14369 echo "(I can't seem to compile the test program. Guessing...)"
14370 fi
14371 ;;
14372*)
14373 dflt="$charsize"
14374 ;;
14375esac
14376rp="What is the size of a character (in bytes)?"
14377. ./myread
14378charsize="$ans"
14379$rm -f try.c try
14380
1d1be0dc
NC
14381: check for volatile keyword
14382echo " "
14383echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14384$cat >try.c <<'EOCP'
14385int main()
14386{
14387 typedef struct _goo_struct goo_struct;
14388 goo_struct * volatile goo = ((goo_struct *)0);
14389 struct _goo_struct {
14390 long long_int;
14391 int reg_int;
14392 char char_var;
14393 };
14394 typedef unsigned short foo_t;
14395 char *volatile foo;
14396 volatile int bar;
14397 volatile foo_t blech;
14398 foo = foo;
14399}
14400EOCP
14401if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14402 val="$define"
14403 echo "Yup, it does."
14404else
14405 val="$undef"
14406 echo "Nope, it doesn't."
14407fi
14408set d_volatile
14409eval $setvar
14410$rm -f try.*
14411
b4eb6b3d
JH
14412
14413echo " "
14414$echo "Choosing the C types to be used for Perl's internal types..." >&4
14415
14416case "$use64bitint:$d_quad:$quadtype" in
14417define:define:?*)
14418 ivtype="$quadtype"
14419 uvtype="$uquadtype"
14420 ivsize=8
14421 uvsize=8
14422 ;;
14423*) ivtype="long"
14424 uvtype="unsigned long"
14425 ivsize=$longsize
14426 uvsize=$longsize
14427 ;;
14428esac
14429
14430case "$uselongdouble:$d_longdbl" in
14431define:define)
14432 nvtype="long double"
14433 nvsize=$longdblsize
14434 ;;
14435*) nvtype=double
14436 nvsize=$doublesize
14437 ;;
14438esac
14439
14440$echo "(IV will be "$ivtype", $ivsize bytes)"
14441$echo "(UV will be "$uvtype", $uvsize bytes)"
14442$echo "(NV will be "$nvtype", $nvsize bytes)"
14443
14444$cat >try.c <<EOCP
14445#$i_inttypes I_INTTYPES
14446#ifdef I_INTTYPES
14447#include <inttypes.h>
14448#endif
14449#include <stdio.h>
14450int main() {
14451#ifdef INT8
14452 int8_t i = INT8_MAX;
14453 uint8_t u = UINT8_MAX;
14454 printf("int8_t\n");
14455#endif
14456#ifdef INT16
14457 int16_t i = INT16_MAX;
14458 uint16_t i = UINT16_MAX;
14459 printf("int16_t\n");
14460#endif
14461#ifdef INT32
14462 int32_t i = INT32_MAX;
14463 uint32_t u = UINT32_MAX;
14464 printf("int32_t\n");
14465#endif
14466}
14467EOCP
14468
14469case "$i8type" in
14470'') case "$charsize" in
14471 1) i8type=char
14472 u8type="unsigned char"
14473 i8size=$charsize
14474 u8size=$charsize
14475 ;;
14476 esac
14477 ;;
14478esac
14479case "$i8type" in
14480'') set try -DINT8
14481 if eval $compile; then
5440bc8e 14482 case "`$run ./try`" in
b4eb6b3d
JH
14483 int8_t) i8type=int8_t
14484 u8type=uint8_t
14485 i8size=1
14486 u8size=1
14487 ;;
14488 esac
14489 fi
14490 ;;
14491esac
14492case "$i8type" in
14493'') if $test $charsize -ge 1; then
14494 i8type=char
14495 u8type="unsigned char"
14496 i8size=$charsize
14497 u8size=$charsize
14498 fi
14499 ;;
14500esac
14501
14502case "$i16type" in
14503'') case "$shortsize" in
14504 2) i16type=short
14505 u16type="unsigned short"
14506 i16size=$shortsize
14507 u16size=$shortsize
14508 ;;
14509 esac
14510 ;;
14511esac
14512case "$i16type" in
14513'') set try -DINT16
14514 if eval $compile; then
5440bc8e 14515 case "`$run ./try`" in
b4eb6b3d
JH
14516 int16_t)
14517 i16type=int16_t
14518 u16type=uint16_t
14519 i16size=2
14520 u16size=2
14521 ;;
14522 esac
14523 fi
14524 ;;
14525esac
14526case "$i16type" in
14527'') if $test $shortsize -ge 2; then
14528 i16type=short
14529 u16type="unsigned short"
14530 i16size=$shortsize
14531 u16size=$shortsize
14532 fi
14533 ;;
14534esac
14535
14536case "$i32type" in
14537'') case "$longsize" in
14538 4) i32type=long
14539 u32type="unsigned long"
14540 i32size=$longsize
14541 u32size=$longsize
14542 ;;
14543 *) case "$intsize" in
14544 4) i32type=int
14545 u32type="unsigned int"
14546 i32size=$intsize
14547 u32size=$intsize
14548 ;;
14549 esac
14550 ;;
14551 esac
14552 ;;
14553esac
14554case "$i32type" in
14555'') set try -DINT32
14556 if eval $compile; then
5440bc8e 14557 case "`$run ./try`" in
b4eb6b3d
JH
14558 int32_t)
14559 i32type=int32_t
14560 u32type=uint32_t
14561 i32size=4
14562 u32size=4
14563 ;;
14564 esac
14565 fi
14566 ;;
14567esac
14568case "$i32type" in
14569'') if $test $intsize -ge 4; then
14570 i32type=int
14571 u32type="unsigned int"
14572 i32size=$intsize
14573 u32size=$intsize
14574 fi
14575 ;;
14576esac
14577
14578case "$i64type" in
14579'') case "$d_quad:$quadtype" in
14580 define:?*)
14581 i64type="$quadtype"
14582 u64type="$uquadtype"
14583 i64size=8
14584 u64size=8
14585 ;;
14586 esac
14587 ;;
14588esac
14589
1d1be0dc
NC
14590$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14591: volatile so that the compiler has to store it out to memory.
14592if test X"$d_volatile" = X"$define"; then
14593 volatile=volatile
14594fi
b4eb6b3d
JH
14595$cat <<EOP >try.c
14596#include <stdio.h>
5a29c6bc
JH
14597#$i_stdlib I_STDLIB
14598#ifdef I_STDLIB
14599#include <stdlib.h>
14600#endif
1d1be0dc
NC
14601#include <sys/types.h>
14602#include <signal.h>
14603#ifdef SIGFPE
14604$volatile int bletched = 0;
14605$signal_t blech(s) int s; { bletched = 1; }
14606#endif
b4eb6b3d
JH
14607int main() {
14608 $uvtype u = 0;
1d1be0dc 14609 $nvtype d;
b4eb6b3d
JH
14610 int n = 8 * $uvsize;
14611 int i;
1d1be0dc
NC
14612#ifdef SIGFPE
14613 signal(SIGFPE, blech);
14614#endif
14615
b4eb6b3d
JH
14616 for (i = 0; i < n; i++) {
14617 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
14618 d = ($nvtype)u;
14619 if (($uvtype)d != u)
b4eb6b3d 14620 break;
1d1be0dc
NC
14621 if (d <= 0)
14622 break;
14623 d = ($nvtype)(u - 1);
14624 if (($uvtype)d != (u - 1))
14625 break;
14626#ifdef SIGFPE
14627 if (bletched) {
14628 break;
14629#endif
14630 }
b4eb6b3d 14631 }
efd1522b 14632 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
14633 exit(0);
14634}
14635EOP
1d1be0dc
NC
14636set try
14637
14638d_nv_preserves_uv="$undef"
14639if eval $compile; then
53133ed1 14640 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 14641fi
53133ed1 14642case "$nv_preserves_uv_bits" in
1d1be0dc 14643\-[1-9]*)
53133ed1
NC
14644 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14645 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 14646 d_nv_preserves_uv="$define"
b4eb6b3d 14647 ;;
53133ed1 14648[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
14649 d_nv_preserves_uv="$undef" ;;
14650*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
53133ed1 14651 nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
14652esac
14653
1d1be0dc
NC
14654$rm -f try.* try
14655
b4eb6b3d
JH
14656
14657: check for off64_t
14658echo " "
14659echo "Checking to see if you have off64_t..." >&4
14660$cat >try.c <<EOCP
14661#include <sys/types.h>
14662#include <unistd.h>
14663int main() { off64_t x = 7; }
14664EOCP
14665set try
14666if eval $compile; then
14667 val="$define"
14668 echo "You have off64_t."
14669else
14670 val="$undef"
14671 echo "You do not have off64_t."
14672 case "$lseeksize" in
14673 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
14674 esac
14675fi
14676$rm -f try.* try
14677set d_off64_t
14678eval $setvar
14679
b4eb6b3d
JH
14680: how to create joinable pthreads
14681if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
14682 echo " "
14683 echo "Checking what constant to use for creating joinable pthreads..." >&4
14684 $cat >try.c <<'EOCP'
14685#include <pthread.h>
14686int main() {
14687 int detachstate = JOINABLE;
14688}
14689EOCP
14690 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
14691 if eval $compile; then
14692 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
14693 val="$undef" # Yes, undef.
14694 set d_old_pthread_create_joinable
14695 eval $setvar
14696 val=""
14697 set old_pthread_create_joinable
14698 eval $setvar
14699 else
14700 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
14701 if eval $compile; then
14702 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
14703 val="$define"
14704 set d_old_pthread_create_joinable
14705 eval $setvar
14706 val=PTHREAD_CREATE_UNDETACHED
14707 set old_pthread_create_joinable
14708 eval $setvar
14709 else
14710 set try -DJOINABLE=__UNDETACHED
14711 if eval $compile; then
14712 echo "You seem to use __UNDETACHED." >&4
14713 val="$define"
14714 set d_old_pthread_create_joinable
14715 eval $setvar
14716 val=__UNDETACHED
14717 set old_pthread_create_joinable
14718 eval $setvar
14719 else
14720 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
14721 val="$define"
14722 set d_old_pthread_create_joinable
14723 eval $setvar
14724 val=0
14725 set old_pthread_create_joinable
14726 eval $setvar
14727 fi
14728 fi
14729 fi
14730 $rm -f try try.*
14731else
14732 d_old_pthread_create_joinable="$undef"
14733 old_pthread_create_joinable=""
14734fi
14735
14736: see if pause exists
14737set pause d_pause
14738eval $inlibc
14739
14740: see if pipe exists
14741set pipe d_pipe
14742eval $inlibc
14743
14744: see if poll exists
14745set poll d_poll
14746eval $inlibc
14747
c7aff470
NIS
14748: see if readlink exists
14749set readlink d_readlink
14750eval $inlibc
14751
14752echo " "
f24dbf84 14753procselfexe=''
c7aff470 14754val="$undef"
a33c94aa
JH
14755case "$d_readlink" in
14756"$define")
c7aff470
NIS
14757 if $issymlink /proc/self/exe ; then
14758 $ls -l /proc/self/exe > reflect
51660ed5 14759 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 14760 echo "You have Linux-like /proc/self/exe."
92236451 14761 procselfexe='"/proc/self/exe"'
f24dbf84 14762 val="$define"
f24dbf84
JH
14763 fi
14764 fi
14765 if $issymlink /proc/curproc/file ; then
14766 $ls -l /proc/curproc/file > reflect
14767 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14768 echo "You have BSD-like /proc/curproc/file."
92236451 14769 procselfexe='"/proc/curproc/file"'
f24dbf84 14770 val="$define"
c7aff470 14771 fi
c7aff470 14772 fi
a33c94aa
JH
14773 ;;
14774esac
428dc699 14775$rm -f reflect
c7aff470
NIS
14776set d_procselfexe
14777eval $setvar
14778
263fee3f
JH
14779: see whether the pthread_atfork exists
14780$cat >try.c <<EOP
14781#include <pthread.h>
14782#include <stdio.h>
14783int main() {
14784#ifdef PTHREAD_ATFORK
14785 pthread_atfork(NULL,NULL,NULL);
14786#endif
14787}
14788EOP
14789
d6483fcc 14790: see if pthread_atfork exists
263fee3f
JH
14791set try -DPTHREAD_ATFORK
14792if eval $compile; then
14793 val="$define"
14794else
14795 val="$undef"
14796fi
14797case "$usethreads" in
14798$define)
14799 case "$val" in
14800 $define) echo 'pthread_atfork found.' >&4 ;;
14801 *) echo 'pthread_atfork NOT found.' >&4 ;;
14802 esac
14803esac
14804set d_pthread_atfork
14805eval $setvar
d6483fcc 14806
16c773f9
JH
14807: see if pthread_attr_setscope exists
14808set pthread_attr_setscope d_pthread_attr_setscope
14809eval $inlibc
14810
b4eb6b3d
JH
14811
14812: see whether the various POSIXish _yields exist
14813$cat >try.c <<EOP
14814#include <pthread.h>
14815#include <stdio.h>
14816int main() {
14817#ifdef SCHED_YIELD
14818 sched_yield();
14819#else
14820#ifdef PTHREAD_YIELD
14821 pthread_yield();
14822#else
14823#ifdef PTHREAD_YIELD_NULL
14824 pthread_yield(NULL);
14825#endif
14826#endif
14827#endif
14828}
14829EOP
14830: see if sched_yield exists
14831set try -DSCHED_YIELD
14832if eval $compile; then
14833 val="$define"
14834 sched_yield='sched_yield()'
14835else
14836 val="$undef"
14837fi
14838case "$usethreads" in
14839$define)
14840 case "$val" in
14841 $define) echo 'sched_yield() found.' >&4 ;;
14842 *) echo 'sched_yield() NOT found.' >&4 ;;
14843 esac
14844esac
10bc17b6
JH
14845set d_sched_yield
14846eval $setvar
b4eb6b3d 14847
10bc17b6
JH
14848: see if pthread_yield exists
14849set try -DPTHREAD_YIELD
14850if eval $compile; then
14851 val="$define"
14852 case "$sched_yield" in
14853 '') sched_yield='pthread_yield()' ;;
14854 esac
14855else
14856 set try -DPTHREAD_YIELD_NULL
14857 if eval $compile; then
14858 val="$define"
14859 case "$sched_yield" in
14860 '') sched_yield='pthread_yield(NULL)' ;;
14861 esac
14862 else
14863 val="$undef"
14864 fi
14865fi
14866case "$usethreads" in
14867$define)
14868 case "$val" in
14869 $define) echo 'pthread_yield() found.' >&4 ;;
14870 *) echo 'pthread_yield() NOT found.' >&4 ;;
14871 esac
14872 ;;
14873esac
14874set d_pthread_yield
14875eval $setvar
b4eb6b3d 14876
10bc17b6
JH
14877case "$sched_yield" in
14878'') sched_yield=undef ;;
14879esac
b4eb6b3d 14880
10bc17b6
JH
14881$rm -f try try.*
14882
14883: see if random_r exists
14884set random_r d_random_r
14885eval $inlibc
14886case "$d_random_r" in
14887"$define")
14888 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
14889 case "$d_random_r_proto:$usethreads" in
14890 ":define") d_random_r_proto=define
a48ec845
JH
14891 set d_random_r_proto random_r $hdrs
14892 eval $hasproto ;;
14893 *) ;;
14894 esac
14895 case "$d_random_r_proto" in
14896 define)
10bc17b6
JH
14897 case "$random_r_proto" in
14898 ''|0) try='int random_r(int*, struct random_data*);'
c71a3471
JH
14899 ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
14900 esac
14901 case "$random_r_proto" in
14902 ''|0) try='int random_r(long*, struct random_data*);'
14903 ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
14904 esac
14905 case "$random_r_proto" in
14906 ''|0) try='int random_r(struct random_data*, int32_t*);'
14907 ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
14908 esac
14909 case "$random_r_proto" in
90e831dc 14910 ''|0) d_random_r=undef
10bc17b6 14911 random_r_proto=0
a48ec845 14912 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14913 * ) case "$random_r_proto" in
14914 REENTRANT_PROTO*) ;;
14915 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
14916 esac
14917 echo "Prototype: $try" ;;
14918 esac
b4eb6b3d 14919 ;;
c18e646a
JH
14920 *) case "$usethreads" in
14921 define) echo "random_r has no prototype, not using it." >&4 ;;
14922 esac
90e831dc
SB
14923 d_random_r=undef
14924 random_r_proto=0
c18e646a 14925 ;;
a48ec845
JH
14926 esac
14927 ;;
10bc17b6 14928*) random_r_proto=0
b4eb6b3d
JH
14929 ;;
14930esac
14931
14932: see if readdir and friends exist
14933set readdir d_readdir
14934eval $inlibc
14935set seekdir d_seekdir
14936eval $inlibc
14937set telldir d_telldir
14938eval $inlibc
14939set rewinddir d_rewinddir
14940eval $inlibc
14941
10bc17b6
JH
14942: see if readdir64_r exists
14943set readdir64_r d_readdir64_r
14944eval $inlibc
14945case "$d_readdir64_r" in
14946"$define")
14947 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
14948 case "$d_readdir64_r_proto:$usethreads" in
14949 ":define") d_readdir64_r_proto=define
a48ec845
JH
14950 set d_readdir64_r_proto readdir64_r $hdrs
14951 eval $hasproto ;;
14952 *) ;;
14953 esac
14954 case "$d_readdir64_r_proto" in
14955 define)
10bc17b6
JH
14956 case "$readdir64_r_proto" in
14957 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
14958 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
14959 esac
14960 case "$readdir64_r_proto" in
14961 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
14962 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
14963 esac
14964 case "$readdir64_r_proto" in
90e831dc 14965 ''|0) d_readdir64_r=undef
10bc17b6 14966 readdir64_r_proto=0
a48ec845 14967 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14968 * ) case "$readdir64_r_proto" in
14969 REENTRANT_PROTO*) ;;
14970 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
14971 esac
14972 echo "Prototype: $try" ;;
14973 esac
14974 ;;
c18e646a
JH
14975 *) case "$usethreads" in
14976 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
14977 esac
90e831dc
SB
14978 d_readdir64_r=undef
14979 readdir64_r_proto=0
c18e646a 14980 ;;
a48ec845
JH
14981 esac
14982 ;;
10bc17b6
JH
14983*) readdir64_r_proto=0
14984 ;;
14985esac
14986
14987: see if readdir_r exists
14988set readdir_r d_readdir_r
14989eval $inlibc
14990case "$d_readdir_r" in
14991"$define")
14992 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
14993 case "$d_readdir_r_proto:$usethreads" in
14994 ":define") d_readdir_r_proto=define
a48ec845
JH
14995 set d_readdir_r_proto readdir_r $hdrs
14996 eval $hasproto ;;
14997 *) ;;
14998 esac
14999 case "$d_readdir_r_proto" in
15000 define)
10bc17b6
JH
15001 case "$readdir_r_proto" in
15002 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15003 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15004 esac
15005 case "$readdir_r_proto" in
15006 ''|0) try='int readdir_r(DIR*, struct dirent*);'
15007 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15008 esac
15009 case "$readdir_r_proto" in
90e831dc 15010 ''|0) d_readdir_r=undef
10bc17b6 15011 readdir_r_proto=0
a48ec845 15012 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15013 * ) case "$readdir_r_proto" in
15014 REENTRANT_PROTO*) ;;
15015 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15016 esac
15017 echo "Prototype: $try" ;;
15018 esac
15019 ;;
c18e646a
JH
15020 *) case "$usethreads" in
15021 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15022 esac
90e831dc
SB
15023 d_readdir_r=undef
15024 readdir_r_proto=0
c18e646a 15025 ;;
a48ec845
JH
15026 esac
15027 ;;
10bc17b6
JH
15028*) readdir_r_proto=0
15029 ;;
15030esac
15031
4e0554ec
JH
15032: see if readv exists
15033set readv d_readv
15034eval $inlibc
15035
15036: see if recvmsg exists
15037set recvmsg d_recvmsg
15038eval $inlibc
15039
b4eb6b3d
JH
15040: see if rename exists
15041set rename d_rename
15042eval $inlibc
15043
15044: see if rmdir exists
15045set rmdir d_rmdir
15046eval $inlibc
15047
15048: see if memory.h is available.
15049val=''
15050set memory.h val
15051eval $inhdr
15052
15053: See if it conflicts with string.h
15054case "$val" in
15055$define)
15056 case "$strings" in
15057 '') ;;
15058 *)
15059 $cppstdin $cppflags $cppminus < $strings > mem.h
15060 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15061 echo " "
15062 echo "We won't be including <memory.h>."
15063 val="$undef"
15064 fi
15065 $rm -f mem.h
15066 ;;
15067 esac
15068esac
15069set i_memory
15070eval $setvar
15071
15072: can bcopy handle overlapping blocks?
b6cc3bc4 15073echo " "
b4eb6b3d 15074val="$undef"
b6cc3bc4
AD
15075case "$d_memmove" in
15076"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15077*) case "$d_bcopy" in
15078 "$define")
15079 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15080 $cat >try.c <<EOCP
b4eb6b3d
JH
15081#$i_memory I_MEMORY
15082#$i_stdlib I_STDLIB
15083#$i_string I_STRING
15084#$i_unistd I_UNISTD
15085EOCP
15086 $cat >>try.c <<'EOCP'
15087#include <stdio.h>
15088#ifdef I_MEMORY
15089# include <memory.h>
15090#endif
15091#ifdef I_STDLIB
15092# include <stdlib.h>
15093#endif
15094#ifdef I_STRING
15095# include <string.h>
15096#else
15097# include <strings.h>
15098#endif
15099#ifdef I_UNISTD
15100# include <unistd.h> /* Needed for NetBSD */
15101#endif
15102int main()
15103{
15104char buf[128], abc[128];
15105char *b;
15106int len;
15107int off;
15108int align;
15109
b6cc3bc4
AD
15110/* Copy "abcde..." string to char abc[] so that gcc doesn't
15111 try to store the string in read-only memory. */
b4eb6b3d
JH
15112bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15113
15114for (align = 7; align >= 0; align--) {
15115 for (len = 36; len; len--) {
15116 b = buf+align;
15117 bcopy(abc, b, len);
15118 for (off = 1; off <= len; off++) {
15119 bcopy(b, b+off, len);
15120 bcopy(b+off, b, len);
15121 if (bcmp(b, abc, len))
15122 exit(1);
15123 }
15124 }
15125}
15126exit(0);
15127}
15128EOCP
b6cc3bc4
AD
15129 set try
15130 if eval $compile_ok; then
15131 if ./try 2>/dev/null; then
15132 echo "Yes, it can."
15133 val="$define"
15134 else
15135 echo "It can't, sorry."
15136 fi
b4eb6b3d 15137 else
b6cc3bc4 15138 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15139 fi
b6cc3bc4
AD
15140 ;;
15141 esac
15142 $rm -f try.* try core
b4eb6b3d
JH
15143 ;;
15144esac
b4eb6b3d
JH
15145set d_safebcpy
15146eval $setvar
15147
15148: can memcpy handle overlapping blocks?
b6cc3bc4 15149echo " "
b4eb6b3d 15150val="$undef"
b6cc3bc4
AD
15151case "$d_memmove" in
15152"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15153*) case "$d_memcpy" in
15154 "$define")
15155 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15156 $cat >try.c <<EOCP
b4eb6b3d
JH
15157#$i_memory I_MEMORY
15158#$i_stdlib I_STDLIB
15159#$i_string I_STRING
15160#$i_unistd I_UNISTD
15161EOCP
15162 $cat >>try.c <<'EOCP'
15163#include <stdio.h>
15164#ifdef I_MEMORY
15165# include <memory.h>
15166#endif
15167#ifdef I_STDLIB
15168# include <stdlib.h>
15169#endif
15170#ifdef I_STRING
15171# include <string.h>
15172#else
15173# include <strings.h>
15174#endif
15175#ifdef I_UNISTD
15176# include <unistd.h> /* Needed for NetBSD */
15177#endif
15178int main()
15179{
15180char buf[128], abc[128];
15181char *b;
15182int len;
15183int off;
15184int align;
15185
15186/* Copy "abcde..." string to char abc[] so that gcc doesn't
15187 try to store the string in read-only memory. */
15188memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15189
15190for (align = 7; align >= 0; align--) {
15191 for (len = 36; len; len--) {
15192 b = buf+align;
15193 memcpy(b, abc, len);
15194 for (off = 1; off <= len; off++) {
15195 memcpy(b+off, b, len);
15196 memcpy(b, b+off, len);
15197 if (memcmp(b, abc, len))
15198 exit(1);
15199 }
15200 }
15201}
15202exit(0);
15203}
15204EOCP
b6cc3bc4
AD
15205 set try
15206 if eval $compile_ok; then
15207 if ./try 2>/dev/null; then
15208 echo "Yes, it can."
15209 val="$define"
15210 else
15211 echo "It can't, sorry."
15212 fi
b4eb6b3d 15213 else
b6cc3bc4 15214 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15215 fi
b6cc3bc4
AD
15216 ;;
15217 esac
15218 $rm -f try.* try core
b4eb6b3d
JH
15219 ;;
15220esac
b4eb6b3d
JH
15221set d_safemcpy
15222eval $setvar
15223
15224: can memcmp be trusted to compare relative magnitude?
15225val="$undef"
15226case "$d_memcmp" in
15227"$define")
15228 echo " "
15229 echo "Checking if your memcmp() can compare relative magnitude..." >&4
15230 $cat >try.c <<EOCP
15231#$i_memory I_MEMORY
15232#$i_stdlib I_STDLIB
15233#$i_string I_STRING
15234#$i_unistd I_UNISTD
15235EOCP
15236 $cat >>try.c <<'EOCP'
15237#include <stdio.h>
15238#ifdef I_MEMORY
15239# include <memory.h>
15240#endif
15241#ifdef I_STDLIB
15242# include <stdlib.h>
15243#endif
15244#ifdef I_STRING
15245# include <string.h>
15246#else
15247# include <strings.h>
15248#endif
15249#ifdef I_UNISTD
15250# include <unistd.h> /* Needed for NetBSD */
15251#endif
15252int main()
15253{
15254char a = -1;
15255char b = 0;
15256if ((a < b) && memcmp(&a, &b, 1) < 0)
15257 exit(1);
15258exit(0);
15259}
15260EOCP
15261 set try
15262 if eval $compile_ok; then
5440bc8e 15263 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
15264 echo "Yes, it can."
15265 val="$define"
15266 else
15267 echo "No, it can't (it uses signed chars)."
15268 fi
15269 else
15270 echo "(I can't compile the test program, so we'll assume not...)"
15271 fi
15272 ;;
15273esac
15274$rm -f try.* try core
15275set d_sanemcmp
15276eval $setvar
15277
ef9f17be
JH
15278: see if prototype for sbrk is available
15279echo " "
15280set d_sbrkproto sbrk $i_unistd unistd.h
15281eval $hasproto
15282
b4eb6b3d
JH
15283: see if select exists
15284set select d_select
15285eval $inlibc
15286
15287: see if semctl exists
15288set semctl d_semctl
15289eval $inlibc
15290
15291: see if semget exists
15292set semget d_semget
15293eval $inlibc
15294
15295: see if semop exists
15296set semop d_semop
15297eval $inlibc
15298
15299: see how much of the 'sem*(2)' library is present.
15300h_sem=true
15301echo " "
15302case "$d_semctl$d_semget$d_semop" in
15303*"$undef"*) h_sem=false;;
15304esac
15305case "$osname" in
15306freebsd)
15307 case "`ipcs 2>&1`" in
15308 "SVID messages"*"not configured"*)
15309 echo "Your $osname does not have the sem*(2) configured." >&4
15310 h_sem=false
15311 val="$undef"
15312 set semctl d_semctl
15313 eval $setvar
15314 set semget d_semget
15315 eval $setvar
15316 set semop d_semop
15317 eval $setvar
15318 ;;
15319 esac
15320 ;;
15321esac
15322: we could also check for sys/ipc.h ...
15323if $h_sem && $test `./findhdr sys/sem.h`; then
15324 echo "You have the full sem*(2) library." >&4
15325 val="$define"
15326else
15327 echo "You don't have the full sem*(2) library." >&4
15328 val="$undef"
15329fi
15330set d_sem
15331eval $setvar
15332
15333: see whether sys/sem.h defines union semun
15334echo " "
15335$cat > try.c <<'END'
15336#include <sys/types.h>
15337#include <sys/ipc.h>
15338#include <sys/sem.h>
15339int main () { union semun semun; semun.buf = 0; }
15340END
15341set try
15342if eval $compile; then
15343 echo "You have union semun in <sys/sem.h>." >&4
15344 val="$define"
15345else
15346 echo "You do not have union semun in <sys/sem.h>." >&4
15347 val="$undef"
15348fi
c9569057 15349$rm -f try try.c
b4eb6b3d
JH
15350set d_union_semun
15351eval $setvar
15352
15353: see how to do semctl IPC_STAT
15354case "$d_sem" in
15355$define)
b4eb6b3d
JH
15356 echo " "
15357 $cat > try.h <<END
15358#ifndef S_IRUSR
15359# ifdef S_IREAD
15360# define S_IRUSR S_IREAD
15361# define S_IWUSR S_IWRITE
15362# define S_IXUSR S_IEXEC
15363# else
15364# define S_IRUSR 0400
15365# define S_IWUSR 0200
15366# define S_IXUSR 0100
15367# endif
15368# define S_IRGRP (S_IRUSR>>3)
15369# define S_IWGRP (S_IWUSR>>3)
15370# define S_IXGRP (S_IXUSR>>3)
15371# define S_IROTH (S_IRUSR>>6)
15372# define S_IWOTH (S_IWUSR>>6)
15373# define S_IXOTH (S_IXUSR>>6)
15374#endif
15375#ifndef S_IRWXU
15376# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15377# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15378# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15379#endif
15380END
c9569057
PP
15381 : see whether semctl IPC_STAT can use union semun
15382 val="$undef"
15383 case "$d_semctl_semun" in
15384 '')
15385 $cat > try.c <<END
b4eb6b3d
JH
15386#include <sys/types.h>
15387#include <sys/ipc.h>
15388#include <sys/sem.h>
15389#include <sys/stat.h>
15390#include <stdio.h>
15391#include <errno.h>
15392#include "try.h"
15393#ifndef errno
15394extern int errno;
15395#endif
15396#$d_union_semun HAS_UNION_SEMUN
15397int main() {
15398 union semun
15399#ifndef HAS_UNION_SEMUN
15400 {
15401 int val;
15402 struct semid_ds *buf;
15403 unsigned short *array;
15404 }
15405#endif
15406 arg;
15407 int sem, st;
15408
15409#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15410 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15411 if (sem > -1) {
15412 struct semid_ds argbuf;
15413 arg.buf = &argbuf;
15414# ifdef IPC_STAT
15415 st = semctl(sem, 0, IPC_STAT, arg);
15416 if (st == 0)
15417 printf("semun\n");
15418 else
15419# endif /* IPC_STAT */
15420 printf("semctl IPC_STAT failed: errno = %d\n", errno);
15421# ifdef IPC_RMID
15422 if (semctl(sem, 0, IPC_RMID, arg) != 0)
15423# endif /* IPC_RMID */
15424 printf("semctl IPC_RMID failed: errno = %d\n", errno);
15425 } else
15426#endif /* IPC_PRIVATE && ... */
15427 printf("semget failed: errno = %d\n", errno);
15428 return 0;
15429}
15430END
c9569057
PP
15431 set try
15432 if eval $compile; then
15433 xxx=`$run ./try`
15434 case "$xxx" in
15435 semun) val="$define" ;;
15436 esac
15437 fi
15438 $rm -f try try.c
15439 ;;
15440 esac
b4eb6b3d
JH
15441 set d_semctl_semun
15442 eval $setvar
15443 case "$d_semctl_semun" in
15444 $define)
15445 echo "You can use union semun for semctl IPC_STAT." >&4
15446 also='also'
15447 ;;
15448 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
15449 also=''
15450 ;;
15451 esac
15452
15453 : see whether semctl IPC_STAT can use struct semid_ds pointer
c9569057
PP
15454 val="$undef"
15455 case "$d_semctl_semid_ds" in
15456 '')
15457 $cat > try.c <<'END'
b4eb6b3d
JH
15458#include <sys/types.h>
15459#include <sys/ipc.h>
15460#include <sys/sem.h>
15461#include <sys/stat.h>
15462#include "try.h"
15463#include <stdio.h>
15464#include <errno.h>
15465#ifndef errno
15466extern int errno;
15467#endif
15468int main() {
15469 struct semid_ds arg;
15470 int sem, st;
15471
15472#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15473 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15474 if (sem > -1) {
15475# ifdef IPC_STAT
15476 st = semctl(sem, 0, IPC_STAT, &arg);
15477 if (st == 0)
15478 printf("semid_ds\n");
15479 else
15480# endif /* IPC_STAT */
15481 printf("semctl IPC_STAT failed: errno = %d\n", errno);
15482# ifdef IPC_RMID
15483 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15484# endif /* IPC_RMID */
15485 printf("semctl IPC_RMID failed: errno = %d\n", errno);
15486 } else
15487#endif /* IPC_PRIVATE && ... */
15488 printf("semget failed: errno = %d\n", errno);
15489
15490 return 0;
15491}
15492END
c9569057
PP
15493 set try
15494 if eval $compile; then
15495 xxx=`$run ./try`
15496 case "$xxx" in
15497 semid_ds) val="$define" ;;
15498 esac
15499 fi
15500 $rm -f try try.c
15501 ;;
15502 esac
b4eb6b3d
JH
15503 set d_semctl_semid_ds
15504 eval $setvar
15505 case "$d_semctl_semid_ds" in
15506 $define)
15507 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15508 ;;
15509 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15510 ;;
15511 esac
15512 $rm -f try.h
15513 ;;
15514*) val="$undef"
15515
15516 # We do not have the full sem*(2) library, so assume we can not
15517 # use either.
15518
15519 set d_semctl_semun
15520 eval $setvar
15521
15522 set d_semctl_semid_ds
15523 eval $setvar
15524 ;;
15525esac
15526
4e0554ec
JH
15527: see if sendmsg exists
15528set sendmsg d_sendmsg
15529eval $inlibc
15530
b4eb6b3d
JH
15531: see if setegid exists
15532set setegid d_setegid
15533eval $inlibc
15534
15535: see if seteuid exists
15536set seteuid d_seteuid
15537eval $inlibc
15538
15539: see if setgrent exists
15540set setgrent d_setgrent
15541eval $inlibc
15542
10bc17b6
JH
15543: see if setgrent_r exists
15544set setgrent_r d_setgrent_r
15545eval $inlibc
15546case "$d_setgrent_r" in
15547"$define")
15548 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
15549 case "$d_setgrent_r_proto:$usethreads" in
15550 ":define") d_setgrent_r_proto=define
a48ec845
JH
15551 set d_setgrent_r_proto setgrent_r $hdrs
15552 eval $hasproto ;;
15553 *) ;;
15554 esac
15555 case "$d_setgrent_r_proto" in
15556 define)
10bc17b6
JH
15557 case "$setgrent_r_proto" in
15558 ''|0) try='int setgrent_r(FILE**);'
15559 ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15560 esac
15561 case "$setgrent_r_proto" in
15562 ''|0) try='void setgrent_r(FILE**);'
15563 ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15564 esac
15565 case "$setgrent_r_proto" in
90e831dc 15566 ''|0) d_setgrent_r=undef
10bc17b6 15567 setgrent_r_proto=0
a48ec845 15568 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15569 * ) case "$setgrent_r_proto" in
15570 REENTRANT_PROTO*) ;;
15571 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15572 esac
15573 echo "Prototype: $try" ;;
15574 esac
15575 ;;
c18e646a
JH
15576 *) case "$usethreads" in
15577 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15578 esac
90e831dc
SB
15579 d_setgrent_r=undef
15580 setgrent_r_proto=0
c18e646a 15581 ;;
a48ec845
JH
15582 esac
15583 ;;
10bc17b6
JH
15584*) setgrent_r_proto=0
15585 ;;
15586esac
15587
b4eb6b3d
JH
15588: see if sethostent exists
15589set sethostent d_sethent
15590eval $inlibc
15591
10bc17b6
JH
15592: see if sethostent_r exists
15593set sethostent_r d_sethostent_r
15594eval $inlibc
15595case "$d_sethostent_r" in
15596"$define")
15597 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
15598 case "$d_sethostent_r_proto:$usethreads" in
15599 ":define") d_sethostent_r_proto=define
a48ec845
JH
15600 set d_sethostent_r_proto sethostent_r $hdrs
15601 eval $hasproto ;;
15602 *) ;;
15603 esac
15604 case "$d_sethostent_r_proto" in
15605 define)
10bc17b6
JH
15606 case "$sethostent_r_proto" in
15607 ''|0) try='int sethostent_r(int, struct hostent_data*);'
15608 ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15609 esac
15610 case "$sethostent_r_proto" in
15611 ''|0) try='void sethostent_r(int, struct hostent_data*);'
15612 ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15613 esac
15614 case "$sethostent_r_proto" in
90e831dc 15615 ''|0) d_sethostent_r=undef
10bc17b6 15616 sethostent_r_proto=0
a48ec845 15617 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15618 * ) case "$sethostent_r_proto" in
15619 REENTRANT_PROTO*) ;;
15620 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15621 esac
15622 echo "Prototype: $try" ;;
15623 esac
15624 ;;
c18e646a
JH
15625 *) case "$usethreads" in
15626 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15627 esac
90e831dc
SB
15628 d_sethostent_r=undef
15629 sethostent_r_proto=0
c18e646a 15630 ;;
a48ec845
JH
15631 esac
15632 ;;
10bc17b6
JH
15633*) sethostent_r_proto=0
15634 ;;
15635esac
15636
4e0554ec
JH
15637: see if setitimer exists
15638set setitimer d_setitimer
15639eval $inlibc
15640
b4eb6b3d
JH
15641: see if setlinebuf exists
15642set setlinebuf d_setlinebuf
15643eval $inlibc
15644
15645: see if setlocale exists
15646set setlocale d_setlocale
15647eval $inlibc
15648
10bc17b6
JH
15649: see if locale.h is available
15650set locale.h i_locale
15651eval $inhdr
15652
15653: see if setlocale_r exists
15654set setlocale_r d_setlocale_r
15655eval $inlibc
15656case "$d_setlocale_r" in
15657"$define")
15658 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
15659 case "$d_setlocale_r_proto:$usethreads" in
15660 ":define") d_setlocale_r_proto=define
a48ec845
JH
15661 set d_setlocale_r_proto setlocale_r $hdrs
15662 eval $hasproto ;;
15663 *) ;;
15664 esac
15665 case "$d_setlocale_r_proto" in
15666 define)
10bc17b6
JH
15667 case "$setlocale_r_proto" in
15668 ''|0) try='int setlocale_r(int, const char*, char*, int);'
15669 ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
15670 esac
15671 case "$setlocale_r_proto" in
90e831dc 15672 ''|0) d_setlocale_r=undef
10bc17b6 15673 setlocale_r_proto=0
a48ec845 15674 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15675 * ) case "$setlocale_r_proto" in
15676 REENTRANT_PROTO*) ;;
15677 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
15678 esac
15679 echo "Prototype: $try" ;;
15680 esac
15681 ;;
c18e646a
JH
15682 *) case "$usethreads" in
15683 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
15684 esac
90e831dc
SB
15685 d_setlocale_r=undef
15686 setlocale_r_proto=0
c18e646a 15687 ;;
a48ec845
JH
15688 esac
15689 ;;
10bc17b6
JH
15690*) setlocale_r_proto=0
15691 ;;
15692esac
15693
b4eb6b3d
JH
15694: see if setnetent exists
15695set setnetent d_setnent
15696eval $inlibc
15697
10bc17b6
JH
15698: see if setnetent_r exists
15699set setnetent_r d_setnetent_r
15700eval $inlibc
15701case "$d_setnetent_r" in
15702"$define")
15703 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
15704 case "$d_setnetent_r_proto:$usethreads" in
15705 ":define") d_setnetent_r_proto=define
a48ec845
JH
15706 set d_setnetent_r_proto setnetent_r $hdrs
15707 eval $hasproto ;;
15708 *) ;;
15709 esac
15710 case "$d_setnetent_r_proto" in
15711 define)
10bc17b6
JH
15712 case "$setnetent_r_proto" in
15713 ''|0) try='int setnetent_r(int, struct netent_data*);'
15714 ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
15715 esac
15716 case "$setnetent_r_proto" in
15717 ''|0) try='void setnetent_r(int, struct netent_data*);'
15718 ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
15719 esac
15720 case "$setnetent_r_proto" in
90e831dc 15721 ''|0) d_setnetent_r=undef
10bc17b6 15722 setnetent_r_proto=0
a48ec845 15723 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15724 * ) case "$setnetent_r_proto" in
15725 REENTRANT_PROTO*) ;;
15726 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
15727 esac
15728 echo "Prototype: $try" ;;
15729 esac
15730 ;;
c18e646a
JH
15731 *) case "$usethreads" in
15732 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
15733 esac
90e831dc
SB
15734 d_setnetent_r=undef
15735 setnetent_r_proto=0
c18e646a 15736 ;;
a48ec845
JH
15737 esac
15738 ;;
10bc17b6
JH
15739*) setnetent_r_proto=0
15740 ;;
15741esac
15742
b4eb6b3d
JH
15743: see if setprotoent exists
15744set setprotoent d_setpent
15745eval $inlibc
15746
15747: see if setpgid exists
15748set setpgid d_setpgid
15749eval $inlibc
15750
15751: see if setpgrp2 exists
15752set setpgrp2 d_setpgrp2
15753eval $inlibc
15754
15755: see if setpriority exists
15756set setpriority d_setprior
15757eval $inlibc
15758
15759: see if setproctitle exists
15760set setproctitle d_setproctitle
15761eval $inlibc
15762
10bc17b6
JH
15763: see if setprotoent_r exists
15764set setprotoent_r d_setprotoent_r
15765eval $inlibc
15766case "$d_setprotoent_r" in
15767"$define")
15768 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
15769 case "$d_setprotoent_r_proto:$usethreads" in
15770 ":define") d_setprotoent_r_proto=define
a48ec845
JH
15771 set d_setprotoent_r_proto setprotoent_r $hdrs
15772 eval $hasproto ;;
15773 *) ;;
15774 esac
15775 case "$d_setprotoent_r_proto" in
15776 define)
10bc17b6
JH
15777 case "$setprotoent_r_proto" in
15778 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
15779 ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
15780 esac
15781 case "$setprotoent_r_proto" in
15782 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
15783 ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
15784 esac
15785 case "$setprotoent_r_proto" in
90e831dc 15786 ''|0) d_setprotoent_r=undef
10bc17b6 15787 setprotoent_r_proto=0
a48ec845 15788 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15789 * ) case "$setprotoent_r_proto" in
15790 REENTRANT_PROTO*) ;;
15791 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
15792 esac
15793 echo "Prototype: $try" ;;
15794 esac
15795 ;;
c18e646a
JH
15796 *) case "$usethreads" in
15797 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
15798 esac
90e831dc
SB
15799 d_setprotoent_r=undef
15800 setprotoent_r_proto=0
c18e646a 15801 ;;
a48ec845
JH
15802 esac
15803 ;;
10bc17b6
JH
15804*) setprotoent_r_proto=0
15805 ;;
15806esac
15807
b4eb6b3d
JH
15808: see if setpwent exists
15809set setpwent d_setpwent
15810eval $inlibc
15811
10bc17b6
JH
15812: see if setpwent_r exists
15813set setpwent_r d_setpwent_r
15814eval $inlibc
15815case "$d_setpwent_r" in
15816"$define")
15817 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
15818 case "$d_setpwent_r_proto:$usethreads" in
15819 ":define") d_setpwent_r_proto=define
a48ec845
JH
15820 set d_setpwent_r_proto setpwent_r $hdrs
15821 eval $hasproto ;;
15822 *) ;;
15823 esac
15824 case "$d_setpwent_r_proto" in
15825 define)
10bc17b6
JH
15826 case "$setpwent_r_proto" in
15827 ''|0) try='int setpwent_r(FILE**);'
15828 ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
15829 esac
15830 case "$setpwent_r_proto" in
15831 ''|0) try='void setpwent_r(FILE**);'
15832 ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
15833 esac
15834 case "$setpwent_r_proto" in
90e831dc 15835 ''|0) d_setpwent_r=undef
10bc17b6 15836 setpwent_r_proto=0
a48ec845 15837 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15838 * ) case "$setpwent_r_proto" in
15839 REENTRANT_PROTO*) ;;
15840 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
15841 esac
15842 echo "Prototype: $try" ;;
15843 esac
15844 ;;
c18e646a
JH
15845 *) case "$usethreads" in
15846 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
15847 esac
90e831dc
SB
15848 d_setpwent_r=undef
15849 setpwent_r_proto=0
c18e646a 15850 ;;
a48ec845
JH
15851 esac
15852 ;;
10bc17b6
JH
15853*) setpwent_r_proto=0
15854 ;;
15855esac
15856
b4eb6b3d
JH
15857: see if setregid exists
15858set setregid d_setregid
15859eval $inlibc
15860set setresgid d_setresgid
15861eval $inlibc
15862
15863: see if setreuid exists
15864set setreuid d_setreuid
15865eval $inlibc
15866set setresuid d_setresuid
15867eval $inlibc
15868
15869: see if setrgid exists
15870set setrgid d_setrgid
15871eval $inlibc
15872
15873: see if setruid exists
15874set setruid d_setruid
15875eval $inlibc
15876
15877: see if setservent exists
15878set setservent d_setsent
15879eval $inlibc
15880
10bc17b6
JH
15881: see if setservent_r exists
15882set setservent_r d_setservent_r
15883eval $inlibc
15884case "$d_setservent_r" in
15885"$define")
15886 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
15887 case "$d_setservent_r_proto:$usethreads" in
15888 ":define") d_setservent_r_proto=define
a48ec845
JH
15889 set d_setservent_r_proto setservent_r $hdrs
15890 eval $hasproto ;;
15891 *) ;;
15892 esac
15893 case "$d_setservent_r_proto" in
15894 define)
10bc17b6
JH
15895 case "$setservent_r_proto" in
15896 ''|0) try='int setservent_r(int, struct servent_data*);'
15897 ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
15898 esac
15899 case "$setservent_r_proto" in
15900 ''|0) try='void setservent_r(int, struct servent_data*);'
15901 ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
15902 esac
15903 case "$setservent_r_proto" in
90e831dc 15904 ''|0) d_setservent_r=undef
10bc17b6 15905 setservent_r_proto=0
a48ec845 15906 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15907 * ) case "$setservent_r_proto" in
15908 REENTRANT_PROTO*) ;;
15909 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
15910 esac
15911 echo "Prototype: $try" ;;
15912 esac
15913 ;;
c18e646a
JH
15914 *) case "$usethreads" in
15915 define) echo "setservent_r has no prototype, not using it." >&4 ;;
15916 esac
90e831dc
SB
15917 d_setservent_r=undef
15918 setservent_r_proto=0
c18e646a 15919 ;;
a48ec845
JH
15920 esac
15921 ;;
10bc17b6
JH
15922*) setservent_r_proto=0
15923 ;;
15924esac
15925
b4eb6b3d
JH
15926: see if setsid exists
15927set setsid d_setsid
15928eval $inlibc
15929
15930: see if setvbuf exists
15931set setvbuf d_setvbuf
15932eval $inlibc
15933
15934: see if sfio.h is available
15935set sfio.h i_sfio
15936eval $inhdr
15937
15938
15939: see if sfio library is available
15940case "$i_sfio" in
15941$define)
15942 val=''
15943 set sfreserve val
15944 eval $inlibc
15945 ;;
15946*)
15947 val="$undef"
15948 ;;
15949esac
15950: Ok, but do we want to use it.
15951case "$val" in
15952$define)
15953 case "$usesfio" in
15954 true|$define|[yY]*) dflt='y';;
15955 *) dflt='n';;
15956 esac
15957 echo "$package can use the sfio library, but it is experimental."
15958 case "$useperlio" in
15959 "$undef")
15960 echo "For sfio also the PerlIO abstraction layer is needed."
15961 echo "Earlier you said you wouldn't want that."
15962 ;;
15963 esac
15964 rp="You seem to have sfio available, do you want to try using it?"
15965 . ./myread
15966 case "$ans" in
15967 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
15968 useperlio="$define"
15969 val="$define"
15970 ;;
15971 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
15972 val="$undef"
b4eb6b3d
JH
15973 ;;
15974 esac
15975 ;;
15976*) case "$usesfio" in
15977 true|$define|[yY]*)
15978 echo "Sorry, cannot find sfio on this machine." >&4
15979 echo "Ignoring your setting of usesfio=$usesfio." >&4
15980 val="$undef"
15981 ;;
15982 esac
15983 ;;
15984esac
15985set d_sfio
15986eval $setvar
15987case "$d_sfio" in
15988$define) usesfio='true';;
15989*) usesfio='false';;
15990esac
3659ebf1
JH
15991case "$d_sfio" in
15992$define) ;;
15993*) : Remove sfio from list of libraries to use
7483f793
JH
15994 case "$libs" in
15995 *-lsfio*)
15996 echo "Removing unneeded -lsfio from library list" >&4
15997 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
15998 shift
15999 libs="$*"
16000 echo "libs = $libs" >&4
16001 ;;
16002 esac
3659ebf1
JH
16003;;
16004esac
16005
b4eb6b3d
JH
16006
16007: see if shmctl exists
16008set shmctl d_shmctl
16009eval $inlibc
16010
16011: see if shmget exists
16012set shmget d_shmget
16013eval $inlibc
16014
16015: see if shmat exists
16016set shmat d_shmat
16017eval $inlibc
16018: see what shmat returns
16019case "$d_shmat" in
16020"$define")
16021 $cat >shmat.c <<'END'
16022#include <sys/shm.h>
16023void *shmat();
16024END
16025 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16026 shmattype='void *'
16027 else
16028 shmattype='char *'
16029 fi
16030 echo "and it returns ($shmattype)." >&4
16031 : see if a prototype for shmat is available
16032 xxx=`./findhdr sys/shm.h`
16033 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16034 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16035 val="$define"
16036 else
16037 val="$undef"
16038 fi
16039 $rm -f shmat.[co]
16040 ;;
16041*)
16042 val="$undef"
16043 ;;
16044esac
16045set d_shmatprototype
16046eval $setvar
16047
16048: see if shmdt exists
16049set shmdt d_shmdt
16050eval $inlibc
16051
16052: see how much of the 'shm*(2)' library is present.
16053h_shm=true
16054echo " "
16055case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16056*"$undef"*) h_shm=false;;
16057esac
16058case "$osname" in
16059freebsd)
16060 case "`ipcs 2>&1`" in
16061 "SVID shared memory"*"not configured"*)
16062 echo "Your $osname does not have the shm*(2) configured." >&4
16063 h_shm=false
16064 val="$undef"
16065 set shmctl d_shmctl
16066 evat $setvar
16067 set shmget d_shmget
16068 evat $setvar
16069 set shmat d_shmat
16070 evat $setvar
16071 set shmdt d_shmdt
16072 evat $setvar
16073 ;;
16074 esac
16075 ;;
16076esac
16077: we could also check for sys/ipc.h ...
16078if $h_shm && $test `./findhdr sys/shm.h`; then
16079 echo "You have the full shm*(2) library." >&4
16080 val="$define"
16081else
16082 echo "You don't have the full shm*(2) library." >&4
16083 val="$undef"
16084fi
16085set d_shm
16086eval $setvar
16087
16088echo " "
16089: see if we have sigaction
16090if set sigaction val -f d_sigaction; eval $csym; $val; then
16091 echo 'sigaction() found.' >&4
c04fee9e 16092 $cat > try.c <<EOP
b4eb6b3d
JH
16093#include <stdio.h>
16094#include <sys/types.h>
16095#include <signal.h>
c04fee9e
JH
16096#$i_stdlib I_STDLIB
16097#ifdef I_STDLIB
16098#include <stdlib.h>
16099#endif
b4eb6b3d
JH
16100int main()
16101{
16102 struct sigaction act, oact;
16103 act.sa_flags = 0;
16104 oact.sa_handler = 0;
16105 /* so that act and oact are used */
16106 exit(act.sa_flags == 0 && oact.sa_handler == 0);
16107}
16108EOP
16109 set try
16110 if eval $compile_ok; then
16111 val="$define"
16112 else
16113 echo "But you don't seem to have a useable struct sigaction." >&4
16114 val="$undef"
16115 fi
16116else
16117 echo 'sigaction NOT found.' >&4
16118 val="$undef"
16119fi
16120set d_sigaction; eval $setvar
16121$rm -f try try$_o try.c
16122
983dbef6
JH
16123: see if sigprocmask exists
16124set sigprocmask d_sigprocmask
16125eval $inlibc
16126
b4eb6b3d
JH
16127: see if sigsetjmp exists
16128echo " "
16129case "$d_sigsetjmp" in
16130'')
511118e1 16131 $cat >try.c <<EOP
b4eb6b3d 16132#include <setjmp.h>
5ed858ef
JH
16133#$i_stdlib I_STDLIB
16134#ifdef I_STDLIB
16135#include <stdlib.h>
16136#endif
b4eb6b3d
JH
16137sigjmp_buf env;
16138int set = 1;
16139int main()
16140{
16141 if (sigsetjmp(env,1))
16142 exit(set);
16143 set = 0;
16144 siglongjmp(env, 1);
16145 exit(1);
16146}
16147EOP
16148 set try
16149 if eval $compile; then
5440bc8e 16150 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
16151 echo "POSIX sigsetjmp found." >&4
16152 val="$define"
16153 else
16154 $cat >&4 <<EOM
16155Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16156I'll ignore them.
16157EOM
16158 val="$undef"
16159 fi
16160 else
16161 echo "sigsetjmp not found." >&4
16162 val="$undef"
16163 fi
16164 ;;
16165*) val="$d_sigsetjmp"
16166 case "$d_sigsetjmp" in
16167 $define) echo "POSIX sigsetjmp found." >&4;;
16168 $undef) echo "sigsetjmp not found." >&4;;
16169 esac
16170 ;;
16171esac
16172set d_sigsetjmp
16173eval $setvar
16174$rm -f try.c try
16175
49a78c82
JH
16176: see if sockatmark exists
16177set sockatmark d_sockatmark
16178eval $inlibc
16179
2ef53570
JH
16180: see if prototype for sockatmark is available
16181echo " "
16182set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16183eval $hasproto
16184
b4eb6b3d
JH
16185: see if socks5_init exists
16186set socks5_init d_socks5_init
16187eval $inlibc
16188
10bc17b6
JH
16189: see if srand48_r exists
16190set srand48_r d_srand48_r
16191eval $inlibc
16192case "$d_srand48_r" in
16193"$define")
16194 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16195 case "$d_srand48_r_proto:$usethreads" in
16196 ":define") d_srand48_r_proto=define
a48ec845
JH
16197 set d_srand48_r_proto srand48_r $hdrs
16198 eval $hasproto ;;
16199 *) ;;
16200 esac
16201 case "$d_srand48_r_proto" in
16202 define)
10bc17b6
JH
16203 case "$srand48_r_proto" in
16204 ''|0) try='int srand48_r(long, struct drand48_data*);'
16205 ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16206 esac
16207 case "$srand48_r_proto" in
90e831dc 16208 ''|0) d_srand48_r=undef
10bc17b6 16209 srand48_r_proto=0
a48ec845 16210 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16211 * ) case "$srand48_r_proto" in
16212 REENTRANT_PROTO*) ;;
16213 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16214 esac
16215 echo "Prototype: $try" ;;
16216 esac
16217 ;;
c18e646a
JH
16218 *) case "$usethreads" in
16219 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16220 esac
90e831dc
SB
16221 d_srand48_r=undef
16222 srand48_r_proto=0
c18e646a 16223 ;;
a48ec845
JH
16224 esac
16225 ;;
10bc17b6
JH
16226*) srand48_r_proto=0
16227 ;;
16228esac
16229
16230: see if srandom_r exists
16231set srandom_r d_srandom_r
16232eval $inlibc
16233case "$d_srandom_r" in
16234"$define")
16235 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16236 case "$d_srandom_r_proto:$usethreads" in
16237 ":define") d_srandom_r_proto=define
a48ec845
JH
16238 set d_srandom_r_proto srandom_r $hdrs
16239 eval $hasproto ;;
16240 *) ;;
16241 esac
16242 case "$d_srandom_r_proto" in
16243 define)
10bc17b6
JH
16244 case "$srandom_r_proto" in
16245 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16246 ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16247 esac
16248 case "$srandom_r_proto" in
90e831dc 16249 ''|0) d_srandom_r=undef
10bc17b6 16250 srandom_r_proto=0
a48ec845 16251 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16252 * ) case "$srandom_r_proto" in
16253 REENTRANT_PROTO*) ;;
16254 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16255 esac
16256 echo "Prototype: $try" ;;
16257 esac
16258 ;;
c18e646a
JH
16259 *) case "$usethreads" in
16260 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16261 esac
90e831dc
SB
16262 d_srandom_r=undef
16263 srandom_r_proto=0
c18e646a 16264 ;;
a48ec845
JH
16265 esac
16266 ;;
10bc17b6
JH
16267*) srandom_r_proto=0
16268 ;;
16269esac
16270
eef837ea
JH
16271: see if prototype for setresgid is available
16272echo " "
16273set d_sresgproto setresgid $i_unistd unistd.h
16274eval $hasproto
16275
640374d0
JH
16276: see if prototype for setresuid is available
16277echo " "
16278set d_sresuproto setresuid $i_unistd unistd.h
16279eval $hasproto
16280
b4eb6b3d
JH
16281: see if sys/stat.h is available
16282set sys/stat.h i_sysstat
16283eval $inhdr
16284
16285
16286: see if stat knows about block sizes
16287echo " "
16288echo "Checking to see if your struct stat has st_blocks field..." >&4
16289set d_statblks stat st_blocks $i_sysstat sys/stat.h
16290eval $hasfield
16291
16292
16293: see if this is a sys/vfs.h system
16294set sys/vfs.h i_sysvfs
16295eval $inhdr
16296
16297
16298: see if this is a sys/statfs.h system
16299set sys/statfs.h i_sysstatfs
16300eval $inhdr
16301
16302
16303echo " "
16304echo "Checking to see if your system supports struct statfs..." >&4
16305set 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
16306eval $hasstruct
16307case "$d_statfs_s" in
16308"$define") echo "Yes, it does." ;;
16309*) echo "No, it doesn't." ;;
16310esac
16311
16312
16313
16314: see if struct statfs knows about f_flags
16315case "$d_statfs_s" in
16316define)
16317 echo " "
16318 echo "Checking to see if your struct statfs has f_flags field..." >&4
16319 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
16320 eval $hasfield
16321 ;;
16322*) val="$undef"
16323 set d_statfs_f_flags
16324 eval $setvar
16325 ;;
16326esac
16327case "$d_statfs_f_flags" in
16328"$define") echo "Yes, it does." ;;
16329*) echo "No, it doesn't." ;;
16330esac
16331
b4eb6b3d
JH
16332$cat >&4 <<EOM
16333Checking how to access stdio streams by file descriptor number...
16334EOM
16335case "$stdio_stream_array" in
16336'') $cat >try.c <<EOCP
16337#include <stdio.h>
16338int main() {
16339 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16340 printf("yes\n");
16341}
16342EOCP
16343 for s in _iob __iob __sF
16344 do
16345 set try -DSTDIO_STREAM_ARRAY=$s
16346 if eval $compile; then
5440bc8e 16347 case "`$run ./try`" in
b4eb6b3d
JH
16348 yes) stdio_stream_array=$s; break ;;
16349 esac
16350 fi
16351 done
16352 $rm -f try.* try$exe_ext
16353esac
16354case "$stdio_stream_array" in
16355'') $cat >&4 <<EOM
16356I can't figure out how to access stdio streams by file descriptor number.
16357EOM
16358 d_stdio_stream_array="$undef"
16359 ;;
16360*) $cat >&4 <<EOM
16361You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16362EOM
16363 d_stdio_stream_array="$define"
16364 ;;
16365esac
16366
16367: see if strcoll exists
16368set strcoll d_strcoll
16369eval $inlibc
16370
16371: check for structure copying
16372echo " "
16373echo "Checking to see if your C compiler can copy structs..." >&4
16374$cat >try.c <<'EOCP'
16375int main()
16376{
16377 struct blurfl {
16378 int dyick;
16379 } foo, bar;
16380
16381 foo = bar;
16382}
16383EOCP
16384if $cc -c try.c >/dev/null 2>&1 ; then
16385 val="$define"
16386 echo "Yup, it can."
16387else
16388 val="$undef"
16389 echo "Nope, it can't."
16390fi
16391set d_strctcpy
16392eval $setvar
16393$rm -f try.*
16394
16395: see if strerror and/or sys_errlist[] exist
16396echo " "
16397if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16398 if set strerror val -f d_strerror; eval $csym; $val; then
16399 echo 'strerror() found.' >&4
16400 d_strerror="$define"
16401 d_strerrm='strerror(e)'
16402 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16403 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
16404 d_syserrlst="$define"
16405 else
16406 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16407 d_syserrlst="$undef"
16408 fi
16409 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16410 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16411 echo 'strerror() found in string header.' >&4
16412 d_strerror="$define"
16413 d_strerrm='strerror(e)'
16414 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16415 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16416 d_syserrlst="$define"
16417 else
16418 echo "(You don't appear to have any sys_errlist[], how can this be?)"
16419 d_syserrlst="$undef"
16420 fi
16421 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16422 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16423 d_strerror="$undef"
16424 d_syserrlst="$define"
16425 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16426 else
16427 echo 'strerror() and sys_errlist[] NOT found.' >&4
16428 d_strerror="$undef"
16429 d_syserrlst="$undef"
16430 d_strerrm='"unknown"'
16431 fi
16432fi
16433
10bc17b6
JH
16434: see if strerror_r exists
16435set strerror_r d_strerror_r
16436eval $inlibc
16437case "$d_strerror_r" in
16438"$define")
16439 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
16440 case "$d_strerror_r_proto:$usethreads" in
16441 ":define") d_strerror_r_proto=define
a48ec845
JH
16442 set d_strerror_r_proto strerror_r $hdrs
16443 eval $hasproto ;;
16444 *) ;;
16445 esac
16446 case "$d_strerror_r_proto" in
16447 define)
10bc17b6
JH
16448 case "$strerror_r_proto" in
16449 ''|0) try='int strerror_r(int, char*, size_t);'
16450 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16451 esac
16452 case "$strerror_r_proto" in
16453 ''|0) try='int strerror_r(int, char*, int);'
16454 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16455 esac
16456 case "$strerror_r_proto" in
16457 ''|0) try='char* strerror_r(int, char*, size_t);'
16458 ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16459 esac
16460 case "$strerror_r_proto" in
90e831dc 16461 ''|0) d_strerror_r=undef
10bc17b6 16462 strerror_r_proto=0
a48ec845 16463 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16464 * ) case "$strerror_r_proto" in
16465 REENTRANT_PROTO*) ;;
16466 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16467 esac
16468 echo "Prototype: $try" ;;
16469 esac
16470 ;;
c18e646a
JH
16471 *) case "$usethreads" in
16472 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16473 esac
90e831dc
SB
16474 d_strerror_r=undef
16475 strerror_r_proto=0
c18e646a 16476 ;;
a48ec845
JH
16477 esac
16478 ;;
10bc17b6
JH
16479*) strerror_r_proto=0
16480 ;;
16481esac
16482
b3c85772
JH
16483: see if strftime exists
16484set strftime d_strftime
16485eval $inlibc
16486
84baed4c
CB
16487: see if strlcat exists
16488set strlcat d_strlcat
16489eval $inlibc
16490
16491: see if strlcpy exists
16492set strlcpy d_strlcpy
16493eval $inlibc
16494
b4eb6b3d
JH
16495: see if strtod exists
16496set strtod d_strtod
16497eval $inlibc
16498
16499: see if strtol exists
16500set strtol d_strtol
16501eval $inlibc
16502
16503: see if strtold exists
16504set strtold d_strtold
16505eval $inlibc
16506
16507: see if strtoll exists
16508set strtoll d_strtoll
16509eval $inlibc
16510
16511case "$d_longlong-$d_strtoll" in
16512"$define-$define")
16513 $cat <<EOM
16514Checking whether your strtoll() works okay...
16515EOM
16516 $cat >try.c <<'EOCP'
16517#include <errno.h>
16518#ifdef __hpux
16519#define strtoll __strtoll
16520#endif
e75931a7
YST
16521#ifdef __EMX__
16522#define strtoll _strtoll
16523#endif
b4eb6b3d
JH
16524#include <stdio.h>
16525extern long long int strtoll(char *s, char **, int);
16526static int bad = 0;
16527int check(char *s, long long ell, int een) {
16528 long long gll;
16529 errno = 0;
16530 gll = strtoll(s, 0, 10);
16531 if (!((gll == ell) && (errno == een)))
16532 bad++;
16533}
16534int main() {
16535 check(" 1", 1LL, 0);
16536 check(" 0", 0LL, 0);
16537 check("-1", -1LL, 0);
16538 check("-9223372036854775808", -9223372036854775808LL, 0);
16539 check("-9223372036854775808", -9223372036854775808LL, 0);
16540 check(" 9223372036854775807", 9223372036854775807LL, 0);
16541 check("-9223372036854775808", -9223372036854775808LL, 0);
16542 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
16543 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16544 if (!bad)
16545 printf("ok\n");
16546}
16547EOCP
16548 set try
16549 if eval $compile; then
5440bc8e 16550 yyy=`$run ./try`
e75931a7 16551 case "$yyy" in
b4eb6b3d
JH
16552 ok) echo "Your strtoll() seems to be working okay." ;;
16553 *) cat <<EOM >&4
16554Your strtoll() doesn't seem to be working okay.
16555EOM
16556 d_strtoll="$undef"
16557 ;;
69eadf66 16558 esac
e75931a7
YST
16559 else
16560 echo "(I can't seem to compile the test program--assuming it doesn't)"
16561 d_strtoll="$undef"
b4eb6b3d
JH
16562 fi
16563 ;;
16564esac
16565
28e5dec8
JH
16566: see if strtoq exists
16567set strtoq d_strtoq
16568eval $inlibc
16569
b4eb6b3d
JH
16570: see if strtoul exists
16571set strtoul d_strtoul
16572eval $inlibc
16573
d0e6d399
NC
16574case "$d_strtoul" in
16575"$define")
16576 $cat <<EOM
16577Checking whether your strtoul() works okay...
16578EOM
16579 $cat >try.c <<'EOCP'
16580#include <errno.h>
16581#include <stdio.h>
16582extern unsigned long int strtoul(char *s, char **, int);
16583static int bad = 0;
16584void check(char *s, unsigned long eul, int een) {
16585 unsigned long gul;
16586 errno = 0;
16587 gul = strtoul(s, 0, 10);
16588 if (!((gul == eul) && (errno == een)))
16589 bad++;
16590}
16591int main() {
16592 check(" 1", 1L, 0);
16593 check(" 0", 0L, 0);
16594EOCP
16595 case "$longsize" in
16596 8)
16597 $cat >>try.c <<'EOCP'
09c0d2c4
JH
16598 check("18446744073709551615", 18446744073709551615UL, 0);
16599 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 16600#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 16601 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
16602 check("-18446744073709551614", 2, 0);
16603 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
16604 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16605 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 16606#endif
d0e6d399
NC
16607EOCP
16608 ;;
16609 4)
16610 $cat >>try.c <<'EOCP'
16611 check("4294967295", 4294967295UL, 0);
16612 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 16613#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
16614 check("-1", 4294967295UL, 0);
16615 check("-4294967294", 2, 0);
16616 check("-4294967295", 1, 0);
16617 check("-4294967296", 4294967295UL, ERANGE);
16618 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 16619#endif
d0e6d399
NC
16620EOCP
16621 ;;
16622 *)
16623: Should we write these tests to be more portable by sprintf-ing
16624: ~0 and then manipulating that char string as input for strtol?
16625 ;;
16626 esac
16627 $cat >>try.c <<'EOCP'
16628 if (!bad)
16629 printf("ok\n");
16630 return 0;
16631}
16632EOCP
16633 set try
16634 if eval $compile; then
5440bc8e 16635 case "`$run ./try`" in
d0e6d399
NC
16636 ok) echo "Your strtoul() seems to be working okay." ;;
16637 *) cat <<EOM >&4
16638Your strtoul() doesn't seem to be working okay.
16639EOM
16640 d_strtoul="$undef"
16641 ;;
16642 esac
16643 fi
16644 ;;
16645esac
16646
b4eb6b3d
JH
16647: see if strtoull exists
16648set strtoull d_strtoull
16649eval $inlibc
16650
16651case "$d_longlong-$d_strtoull" in
16652"$define-$define")
16653 $cat <<EOM
16654Checking whether your strtoull() works okay...
16655EOM
16656 $cat >try.c <<'EOCP'
16657#include <errno.h>
16658#ifdef __hpux
16659#define strtoull __strtoull
16660#endif
16661#include <stdio.h>
16662extern unsigned long long int strtoull(char *s, char **, int);
16663static int bad = 0;
16664int check(char *s, long long eull, int een) {
16665 long long gull;
16666 errno = 0;
16667 gull = strtoull(s, 0, 10);
16668 if (!((gull == eull) && (errno == een)))
16669 bad++;
16670}
16671int main() {
d0e6d399
NC
16672 check(" 1", 1LL, 0);
16673 check(" 0", 0LL, 0);
16674 check("18446744073709551615", 18446744073709551615ULL, 0);
16675 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 16676#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
16677 check("-1", 18446744073709551615ULL, 0);
16678 check("-18446744073709551614", 2LL, 0);
16679 check("-18446744073709551615", 1LL, 0);
16680 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16681 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 16682#endif
b4eb6b3d
JH
16683 if (!bad)
16684 printf("ok\n");
16685}
16686EOCP
16687 set try
16688 if eval $compile; then
5440bc8e 16689 case "`$run ./try`" in
b4eb6b3d
JH
16690 ok) echo "Your strtoull() seems to be working okay." ;;
16691 *) cat <<EOM >&4
16692Your strtoull() doesn't seem to be working okay.
16693EOM
16694 d_strtoull="$undef"
16695 ;;
16696 esac
16697 fi
16698 ;;
16699esac
16700
16701: see if strtouq exists
16702set strtouq d_strtouq
16703eval $inlibc
16704
d0e6d399
NC
16705case "$d_strtouq" in
16706"$define")
16707 $cat <<EOM
16708Checking whether your strtouq() works okay...
16709EOM
16710 $cat >try.c <<'EOCP'
16711#include <errno.h>
16712#include <stdio.h>
16713extern unsigned long long int strtouq(char *s, char **, int);
16714static int bad = 0;
16715void check(char *s, unsigned long long eull, int een) {
16716 unsigned long long gull;
16717 errno = 0;
16718 gull = strtouq(s, 0, 10);
16719 if (!((gull == eull) && (errno == een)))
16720 bad++;
16721}
16722int main() {
16723 check(" 1", 1LL, 0);
16724 check(" 0", 0LL, 0);
16725 check("18446744073709551615", 18446744073709551615ULL, 0);
16726 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 16727#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
16728 check("-1", 18446744073709551615ULL, 0);
16729 check("-18446744073709551614", 2LL, 0);
16730 check("-18446744073709551615", 1LL, 0);
16731 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16732 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 16733#endif
d0e6d399
NC
16734 if (!bad)
16735 printf("ok\n");
16736 return 0;
16737}
16738EOCP
16739 set try
16740 if eval $compile; then
5440bc8e 16741 case "`$run ./try`" in
d0e6d399
NC
16742 ok) echo "Your strtouq() seems to be working okay." ;;
16743 *) cat <<EOM >&4
16744Your strtouq() doesn't seem to be working okay.
16745EOM
16746 d_strtouq="$undef"
16747 ;;
16748 esac
16749 fi
16750 ;;
16751esac
16752
b4eb6b3d
JH
16753: see if strxfrm exists
16754set strxfrm d_strxfrm
16755eval $inlibc
16756
16757: see if symlink exists
16758set symlink d_symlink
16759eval $inlibc
16760
16761: see if syscall exists
16762set syscall d_syscall
16763eval $inlibc
16764
2ef53570
JH
16765: see if prototype for syscall is available
16766echo " "
16767set d_syscallproto syscall $i_unistd unistd.h
16768eval $hasproto
16769
b4eb6b3d
JH
16770: see if sysconf exists
16771set sysconf d_sysconf
16772eval $inlibc
16773
16774: see if system exists
16775set system d_system
16776eval $inlibc
16777
16778: see if tcgetpgrp exists
16779set tcgetpgrp d_tcgetpgrp
16780eval $inlibc
16781
16782: see if tcsetpgrp exists
16783set tcsetpgrp d_tcsetpgrp
16784eval $inlibc
16785
16786: see if prototype for telldir is available
16787echo " "
16788set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16789eval $hasproto
16790
ad493445
MB
16791: see if time exists
16792echo " "
16793if test "X$d_time" = X -o X"$timetype" = X; then
16794 if set time val -f d_time; eval $csym; $val; then
16795 echo 'time() found.' >&4
16796 val="$define"
16797 rp="What is the type returned by time() on this system?"
16798 set time_t timetype long stdio.h sys/types.h
16799 eval $typedef_ask
16800 else
16801 echo 'time() not found, hope that will do.' >&4
16802 val="$undef"
16803 timetype='int';
16804 fi
16805 set d_time
16806 eval $setvar
16807fi
16808
b4eb6b3d
JH
16809: see if this is a sys/times.h system
16810set sys/times.h i_systimes
16811eval $inhdr
16812
16813: see if times exists
16814echo " "
16815if set times val -f d_times; eval $csym; $val; then
16816 echo 'times() found.' >&4
16817 d_times="$define"
16818 inc=''
16819 case "$i_systimes" in
16820 "$define") inc='sys/times.h';;
16821 esac
16822 rp="What is the type returned by times() on this system?"
16823 set clock_t clocktype long stdio.h sys/types.h $inc
16824 eval $typedef_ask
16825else
16826 echo 'times() NOT found, hope that will do.' >&4
16827 d_times="$undef"
16828 clocktype='int'
16829fi
16830
10bc17b6
JH
16831: see if tmpnam_r exists
16832set tmpnam_r d_tmpnam_r
16833eval $inlibc
16834case "$d_tmpnam_r" in
16835"$define")
31ee0cb7 16836 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
16837 case "$d_tmpnam_r_proto:$usethreads" in
16838 ":define") d_tmpnam_r_proto=define
a48ec845
JH
16839 set d_tmpnam_r_proto tmpnam_r $hdrs
16840 eval $hasproto ;;
16841 *) ;;
16842 esac
16843 case "$d_tmpnam_r_proto" in
16844 define)
10bc17b6
JH
16845 case "$tmpnam_r_proto" in
16846 ''|0) try='char* tmpnam_r(char*);'
16847 ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16848 esac
16849 case "$tmpnam_r_proto" in
90e831dc 16850 ''|0) d_tmpnam_r=undef
10bc17b6 16851 tmpnam_r_proto=0
a48ec845 16852 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16853 * ) case "$tmpnam_r_proto" in
16854 REENTRANT_PROTO*) ;;
16855 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16856 esac
16857 echo "Prototype: $try" ;;
16858 esac
16859 ;;
c18e646a
JH
16860 *) case "$usethreads" in
16861 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16862 esac
90e831dc
SB
16863 d_tmpnam_r=undef
16864 tmpnam_r_proto=0
c18e646a 16865 ;;
a48ec845
JH
16866 esac
16867 ;;
10bc17b6
JH
16868*) tmpnam_r_proto=0
16869 ;;
16870esac
16871
b4eb6b3d
JH
16872: see if truncate exists
16873set truncate d_truncate
16874eval $inlibc
16875
10bc17b6
JH
16876: see if ttyname_r exists
16877set ttyname_r d_ttyname_r
16878eval $inlibc
16879case "$d_ttyname_r" in
16880"$define")
16881 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
16882 case "$d_ttyname_r_proto:$usethreads" in
16883 ":define") d_ttyname_r_proto=define
a48ec845
JH
16884 set d_ttyname_r_proto ttyname_r $hdrs
16885 eval $hasproto ;;
16886 *) ;;
16887 esac
16888 case "$d_ttyname_r_proto" in
16889 define)
10bc17b6
JH
16890 case "$ttyname_r_proto" in
16891 ''|0) try='int ttyname_r(int, char*, size_t);'
16892 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16893 esac
16894 case "$ttyname_r_proto" in
16895 ''|0) try='int ttyname_r(int, char*, int);'
16896 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16897 esac
16898 case "$ttyname_r_proto" in
16899 ''|0) try='char* ttyname_r(int, char*, int);'
16900 ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16901 esac
16902 case "$ttyname_r_proto" in
90e831dc 16903 ''|0) d_ttyname_r=undef
10bc17b6 16904 ttyname_r_proto=0
a48ec845 16905 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16906 * ) case "$ttyname_r_proto" in
16907 REENTRANT_PROTO*) ;;
16908 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16909 esac
16910 echo "Prototype: $try" ;;
16911 esac
16912 ;;
c18e646a
JH
16913 *) case "$usethreads" in
16914 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16915 esac
90e831dc
SB
16916 d_ttyname_r=undef
16917 ttyname_r_proto=0
c18e646a 16918 ;;
a48ec845
JH
16919 esac
16920 ;;
10bc17b6
JH
16921*) ttyname_r_proto=0
16922 ;;
16923esac
16924
b4eb6b3d
JH
16925: see if tzname[] exists
16926echo " "
16927if set tzname val -a d_tzname; eval $csym; $val; then
16928 val="$define"
16929 echo 'tzname[] found.' >&4
16930else
16931 val="$undef"
16932 echo 'tzname[] NOT found.' >&4
16933fi
16934set d_tzname
16935eval $setvar
16936
4e0554ec
JH
16937case "$osname" in
16938next|rhapsody|darwin) multiarch="$define" ;;
16939esac
16940case "$multiarch" in
16941''|[nN]*) multiarch="$undef" ;;
16942esac
16943
24412007 16944: check for ordering of bytes in a UV
4e0554ec 16945echo " "
5440bc8e 16946case "$usecrosscompile$multiarch" in
4e0554ec
JH
16947*$define*)
16948 $cat <<EOM
16949You seem to be either cross-compiling or doing a multiarchitecture build,
16950skipping the byteorder check.
16951
16952EOM
5440bc8e 16953 byteorder='ffff'
4e0554ec
JH
16954 ;;
16955*)
16956 case "$byteorder" in
16957 '')
16958 $cat <<'EOM'
16959In the following, larger digits indicate more significance. A big-endian
16960machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16961little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16962machines may have weird orders like 3412. A Cray will report 87654321,
16963an Alpha will report 12345678. If the test program works the default is
16964probably right.
16965I'm now running the test program...
16966EOM
24412007 16967 $cat >try.c <<EOCP
4e0554ec 16968#include <stdio.h>
5a29c6bc
JH
16969#$i_stdlib I_STDLIB
16970#ifdef I_STDLIB
16971#include <stdlib.h>
16972#endif
24412007
JH
16973#include <sys/types.h>
16974typedef $uvtype UV;
4e0554ec
JH
16975int main()
16976{
16977 int i;
16978 union {
24412007
JH
16979 UV l;
16980 char c[$uvsize];
4e0554ec
JH
16981 } u;
16982
24412007 16983 if ($uvsize > 4)
b5ded3e5 16984 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 16985 else
a4c53327 16986 u.l = (UV)0x04030201;
24412007 16987 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
16988 printf("%c", u.c[i]+'0');
16989 printf("\n");
16990 exit(0);
16991}
16992EOCP
16993 xxx_prompt=y
16994 set try
16995 if eval $compile && ./try > /dev/null; then
5440bc8e 16996 dflt=`$run ./try`
4e0554ec
JH
16997 case "$dflt" in
16998 [1-4][1-4][1-4][1-4]|12345678|87654321)
16999 echo "(The test program ran ok.)"
17000 echo "byteorder=$dflt"
17001 xxx_prompt=n
17002 ;;
17003 ????|????????) echo "(The test program ran ok.)" ;;
17004 *) echo "(The test program didn't run right for some reason.)" ;;
17005 esac
17006 else
17007 dflt='4321'
17008 cat <<'EOM'
17009(I can't seem to compile the test program. Guessing big-endian...)
17010EOM
17011 fi
17012 case "$xxx_prompt" in
17013 y)
24412007 17014 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
17015 . ./myread
17016 byteorder="$ans"
17017 ;;
17018 *) byteorder=$dflt
17019 ;;
17020 esac
17021 ;;
17022 esac
17023 $rm -f try.c try
17024 ;;
17025esac
17026
17027
17028$cat <<EOM
17029
17030Checking to see whether you can access character data unalignedly...
17031EOM
dc7b0a4f
JH
17032case "$d_u32align" in
17033'') $cat >try.c <<EOCP
4e0554ec 17034#include <stdio.h>
5ed858ef
JH
17035#$i_stdlib I_STDLIB
17036#ifdef I_STDLIB
17037#include <stdlib.h>
17038#endif
4e0554ec 17039#define U32 $u32type
d308175a
JH
17040#define BYTEORDER 0x$byteorder
17041#define U8 $u8type
9958dc3c
JH
17042#include <signal.h>
17043#ifdef SIGBUS
17044$signal_t bletch(s) int s; { exit(4); }
17045#endif
4e0554ec
JH
17046int main() {
17047#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
8906a23e 17048 U8 buf[8];
4e0554ec
JH
17049 U32 *up;
17050 int i;
17051
17052 if (sizeof(U32) != 4) {
17053 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17054 exit(1);
17055 }
17056
17057 fflush(stdout);
17058
9958dc3c
JH
17059#ifdef SIGBUS
17060 signal(SIGBUS, bletch);
17061#endif
17062
8906a23e
JH
17063 buf[0] = 0;
17064 buf[1] = 0;
17065 buf[2] = 0;
17066 buf[3] = 1;
9beed644 17067 buf[4] = 0;
8906a23e
JH
17068 buf[5] = 0;
17069 buf[6] = 0;
9beed644 17070 buf[7] = 1;
8906a23e 17071
4e0554ec
JH
17072 for (i = 0; i < 4; i++) {
17073 up = (U32*)(buf + i);
17074 if (! ((*up == 1 << (8*i)) || /* big-endian */
17075 (*up == 1 << (8*(3-i))) /* little-endian */
17076 )
17077 )
17078 {
17079 printf("read failed (%x)\n", *up);
17080 exit(2);
17081 }
17082 }
17083
17084 /* write test */
17085 for (i = 0; i < 4; i++) {
17086 up = (U32*)(buf + i);
17087 *up = 0xBeef;
17088 if (*up != 0xBeef) {
17089 printf("write failed (%x)\n", *up);
17090 exit(3);
17091 }
17092 }
17093
17094 exit(0);
17095#else
17096 printf("1\n");
17097 exit(1);
17098#endif
17099 return 0;
17100}
17101EOCP
17102set try
17103if eval $compile_ok; then
d308175a 17104 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 17105 $run ./try 2>&1 >/dev/null
4e0554ec
JH
17106 case "$?" in
17107 0) cat >&4 <<EOM
17108You can access character data pretty unalignedly.
17109EOM
17110 d_u32align="$undef"
17111 ;;
17112 *) cat >&4 <<EOM
17113It seems that you must access character data in an aligned manner.
17114EOM
17115 d_u32align="$define"
17116 ;;
17117 esac
4e0554ec
JH
17118else
17119 rp='Can you access character data at unaligned addresses?'
17120 dflt='n'
17121 . ./myread
17122 case "$ans" in
17123 [yY]*) d_u32align="$undef" ;;
17124 *) d_u32align="$define" ;;
17125 esac
17126fi
e36b5403 17127$rm -f core core.try.* try.core
dc7b0a4f
JH
17128;;
17129esac
4e0554ec
JH
17130
17131: see if ualarm exists
17132set ualarm d_ualarm
17133eval $inlibc
17134
b4eb6b3d
JH
17135: see if umask exists
17136set umask d_umask
17137eval $inlibc
17138
758a5d79
JH
17139: see if unordered exists
17140set unordered d_unordered
17141eval $inlibc
17142
4e0554ec
JH
17143: see if usleep exists
17144set usleep d_usleep
17145eval $inlibc
17146
2ef53570
JH
17147: see if prototype for usleep is available
17148echo " "
17149set d_usleepproto usleep $i_unistd unistd.h
17150eval $hasproto
17151
b4eb6b3d
JH
17152: see if ustat exists
17153set ustat d_ustat
17154eval $inlibc
17155
17156: backward compatibility for d_hvfork
17157if test X$d_hvfork != X; then
17158 d_vfork="$d_hvfork"
17159 d_hvfork=''
17160fi
17161: see if there is a vfork
17162val=''
17163set vfork val
17164eval $inlibc
17165
17166: Ok, but do we want to use it. vfork is reportedly unreliable in
17167: perl on Solaris 2.x, and probably elsewhere.
17168case "$val" in
17169$define)
17170 echo " "
17171 case "$usevfork" in
17172 false) dflt='n';;
17173 *) dflt='y';;
17174 esac
17175 cat <<'EOM'
17176
17177Perl can only use a vfork() that doesn't suffer from strict
17178restrictions on calling functions or modifying global data in
17179the child. For example, glibc-2.1 contains such a vfork()
17180that is unsuitable. If your system provides a proper fork()
17181call, chances are that you do NOT want perl to use vfork().
17182
17183EOM
17184 rp="Do you still want to use vfork()?"
17185 . ./myread
17186 case "$ans" in
17187 y|Y) ;;
17188 *)
17189 echo "Ok, we won't use vfork()."
17190 val="$undef"
17191 ;;
17192 esac
17193 ;;
17194esac
17195set d_vfork
17196eval $setvar
17197case "$d_vfork" in
17198$define) usevfork='true';;
17199*) usevfork='false';;
17200esac
17201
b4eb6b3d
JH
17202: see if closedir exists
17203set closedir d_closedir
17204eval $inlibc
17205
17206case "$d_closedir" in
17207"$define")
17208 echo " "
17209 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 17210 cat > try.c <<EOM
b4eb6b3d
JH
17211#$i_dirent I_DIRENT /**/
17212#$i_sysdir I_SYS_DIR /**/
17213#$i_sysndir I_SYS_NDIR /**/
17214#$i_systypes I_SYS_TYPES /**/
17215
17216#if defined(I_SYS_TYPES)
17217#include <sys/types.h>
17218#endif
17219#if defined(I_DIRENT)
17220#include <dirent.h>
17221#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17222#include <sys/dir.h>
17223#endif
17224#else
17225#ifdef I_SYS_NDIR
17226#include <sys/ndir.h>
17227#else
17228#ifdef I_SYS_DIR
17229#ifdef hp9000s500
17230#include <ndir.h> /* may be wrong in the future */
17231#else
17232#include <sys/dir.h>
17233#endif
17234#endif
17235#endif
17236#endif
17237int main() { return closedir(opendir(".")); }
17238EOM
5440bc8e 17239 set try
b4eb6b3d 17240 if eval $compile_ok; then
5440bc8e 17241 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
17242 echo "Yes, it does."
17243 val="$undef"
17244 else
17245 echo "No, it doesn't."
17246 val="$define"
17247 fi
17248 else
17249 echo "(I can't seem to compile the test program--assuming it doesn't)"
17250 val="$define"
17251 fi
17252 ;;
17253*)
17254 val="$undef";
17255 ;;
17256esac
17257set d_void_closedir
17258eval $setvar
5440bc8e 17259$rm -f try try.*
b4eb6b3d
JH
17260: see if there is a wait4
17261set wait4 d_wait4
17262eval $inlibc
17263
17264: see if waitpid exists
17265set waitpid d_waitpid
17266eval $inlibc
17267
17268: see if wcstombs exists
17269set wcstombs d_wcstombs
17270eval $inlibc
17271
17272: see if wctomb exists
17273set wctomb d_wctomb
17274eval $inlibc
17275
4e0554ec
JH
17276: see if writev exists
17277set writev d_writev
17278eval $inlibc
17279
b4eb6b3d
JH
17280: preserve RCS keywords in files with variable substitution, grrr
17281Date='$Date'
17282Id='$Id'
17283Log='$Log'
17284RCSfile='$RCSfile'
17285Revision='$Revision'
17286
b4eb6b3d
JH
17287: check for alignment requirements
17288echo " "
5440bc8e 17289case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
17290*$define*)
17291 $cat <<EOM
17292You seem to be either cross-compiling or doing a multiarchitecture build,
17293skipping the memory alignment check.
17294
17295EOM
17296 case "$alignbytes" in
17297 '') alignbytes=8 ;;
17298 esac
17299 ;;
17300*)
17301 case "$alignbytes" in
17302 '') echo "Checking alignment constraints..." >&4
17303 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17304 $cat >try.c <<'EOCP'
17305typedef long double NV;
17306EOCP
17307 else
17308 $cat >try.c <<'EOCP'
17309typedef double NV;
17310EOCP
17311 fi
17312 $cat >>try.c <<'EOCP'
17313#include <stdio.h>
17314struct foobar {
17315 char foo;
17316 NV bar;
17317} try_algn;
17318int main()
17319{
17320 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17321 return(0);
17322}
17323EOCP
17324 set try
17325 if eval $compile_ok; then
5440bc8e 17326 dflt=`$run ./try`
b4eb6b3d
JH
17327 else
17328 dflt='8'
17329 echo "(I can't seem to compile the test program...)"
17330 fi
17331 ;;
17332 *) dflt="$alignbytes"
17333 ;;
17334 esac
17335 rp="Doubles must be aligned on a how-many-byte boundary?"
17336 . ./myread
17337 alignbytes="$ans"
17338 $rm -f try.c try
17339 ;;
17340esac
17341
17342
17343: set the base revision
17344baserev=5.0
17345
92b39ff2 17346: how do we concatenate cpp tokens here?
b4eb6b3d 17347echo " "
92b39ff2 17348echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
17349$cat >cpp_stuff.c <<'EOCP'
17350#define RCAT(a,b)a/**/b
17351#define ACAT(a,b)a ## b
17352RCAT(Rei,ser)
17353ACAT(Cir,cus)
17354EOCP
17355$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17356if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17357 echo "Oh! Smells like ANSI's been here." >&4
17358 echo "We can catify or stringify, separately or together!"
17359 cpp_stuff=42
17360elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17361 echo "Ah, yes! The good old days!" >&4
17362 echo "However, in the good old days we don't know how to stringify and"
17363 echo "catify at the same time."
17364 cpp_stuff=1
17365else
17366 $cat >&4 <<EOM
92b39ff2
JH
17367Hmm, I don't seem to be able to concatenate tokens with your cpp.
17368You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
17369EOM
17370 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17371fi
17372$rm -f cpp_stuff.*
17373
17374: see if this is a db.h system
17375set db.h i_db
17376eval $inhdr
17377
17378case "$i_db" in
17379$define)
17380 : Check db version.
17381 echo " "
17382 echo "Checking Berkeley DB version ..." >&4
17383 $cat >try.c <<EOCP
17384#$d_const HASCONST
17385#ifndef HASCONST
17386#define const
17387#endif
17388#include <sys/types.h>
17389#include <stdio.h>
5a29c6bc
JH
17390#$i_stdlib I_STDLIB
17391#ifdef I_STDLIB
17392#include <stdlib.h>
17393#endif
b4eb6b3d 17394#include <db.h>
640374d0 17395int main(int argc, char *argv[])
b4eb6b3d
JH
17396{
17397#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17398 int Major, Minor, Patch ;
17399 unsigned long Version ;
17400 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
17401 if (argc == 2) {
17402 printf("%d %d %d %d %d %d\n",
17403 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17404 Major, Minor, Patch);
17405 exit(0);
17406 }
17407 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
17408
17409 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17410 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17411 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17412 Major, Minor, Patch) ;
17413
17414 /* check that db.h & libdb are compatible */
17415 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 17416 printf("db.h and libdb are incompatible.\n") ;
b4eb6b3d
JH
17417 exit(3);
17418 }
17419
640374d0 17420 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
17421
17422 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17423 + DB_VERSION_PATCH ;
17424
17425 /* needs to be >= 2.3.4 */
17426 if (Version < 2003004) {
17427 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 17428 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
b4eb6b3d
JH
17429 exit(2);
17430 }
17431
17432 exit(0);
17433#else
17434#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
17435 if (argc == 2) {
17436 printf("1 0 0\n");
17437 exit(0);
17438 }
17439 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
17440 exit(0); /* DB version < 2: the coast is clear. */
17441#else
17442 exit(1); /* <db.h> not Berkeley DB? */
17443#endif
17444#endif
17445}
17446EOCP
17447 set try
5440bc8e 17448 if eval $compile_ok && $run ./try; then
b4eb6b3d 17449 echo 'Looks OK.' >&4
5440bc8e 17450 set `$run ./try 1`
640374d0
JH
17451 db_version_major=$1
17452 db_version_minor=$2
17453 db_version_patch=$3
b4eb6b3d
JH
17454 else
17455 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
17456 i_db=$undef
17457 case " $libs " in
17458 *"-ldb "*)
17459 : Remove db from list of libraries to use
17460 echo "Removing unusable -ldb from library list" >&4
17461 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17462 shift
17463 libs="$*"
17464 echo "libs = $libs" >&4
17465 ;;
17466 esac
17467 fi
17468 $rm -f try.*
17469 ;;
17470esac
17471
17472case "$i_db" in
17473define)
17474 : Check the return type needed for hash
17475 echo " "
17476 echo "Checking return type needed for hash for Berkeley DB ..." >&4
17477 $cat >try.c <<EOCP
17478#$d_const HASCONST
17479#ifndef HASCONST
17480#define const
17481#endif
17482#include <sys/types.h>
17483#include <db.h>
17484
17485#ifndef DB_VERSION_MAJOR
17486u_int32_t hash_cb (ptr, size)
17487const void *ptr;
17488size_t size;
17489{
17490}
17491HASHINFO info;
17492int main()
17493{
17494 info.hash = hash_cb;
17495}
17496#endif
17497EOCP
17498 if $cc $ccflags -c try.c >try.out 2>&1 ; then
17499 if $contains warning try.out >>/dev/null 2>&1 ; then
17500 db_hashtype='int'
17501 else
17502 db_hashtype='u_int32_t'
17503 fi
17504 else
17505 : XXX Maybe we should just give up here.
17506 db_hashtype=u_int32_t
17507 $cat try.out >&4
17508 echo "Help: I can't seem to compile the db test program." >&4
17509 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17510 fi
17511 $rm -f try.*
17512 echo "Your version of Berkeley DB uses $db_hashtype for hash."
17513 ;;
17514*) db_hashtype=u_int32_t
17515 ;;
17516esac
17517case "$i_db" in
17518define)
17519 : Check the return type needed for prefix
17520 echo " "
17521 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17522 cat >try.c <<EOCP
17523#$d_const HASCONST
17524#ifndef HASCONST
17525#define const
17526#endif
17527#include <sys/types.h>
17528#include <db.h>
17529
17530#ifndef DB_VERSION_MAJOR
17531size_t prefix_cb (key1, key2)
17532const DBT *key1;
17533const DBT *key2;
17534{
17535}
17536BTREEINFO info;
17537int main()
17538{
17539 info.prefix = prefix_cb;
17540}
17541#endif
17542EOCP
17543 if $cc $ccflags -c try.c >try.out 2>&1 ; then
17544 if $contains warning try.out >>/dev/null 2>&1 ; then
17545 db_prefixtype='int'
17546 else
17547 db_prefixtype='size_t'
17548 fi
17549 else
17550 db_prefixtype='size_t'
17551 : XXX Maybe we should just give up here.
17552 $cat try.out >&4
17553 echo "Help: I can't seem to compile the db test program." >&4
17554 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17555 fi
17556 $rm -f try.*
17557 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17558 ;;
17559*) db_prefixtype='size_t'
17560 ;;
17561esac
17562
b4eb6b3d
JH
17563
17564: How can we generate normalized random numbers ?
17565echo " "
17566echo "Looking for a random number function..." >&4
17567case "$randfunc" in
17568'')
17569 if set drand48 val -f; eval $csym; $val; then
17570 dflt="drand48"
17571 echo "Good, found drand48()." >&4
17572 elif set random val -f; eval $csym; $val; then
17573 dflt="random"
17574 echo "OK, found random()." >&4
17575 else
17576 dflt="rand"
17577 echo "Yick, looks like I have to use rand()." >&4
17578 fi
17579 echo " "
17580 ;;
17581*)
17582 dflt="$randfunc"
17583 ;;
17584esac
17585cont=true
17586
17587case "$ccflags" in
17588*-Dmy_rand=*|*-Dmy_srand=*)
17589 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17590 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17591 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17592 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17593 ;;
17594esac
17595
17596while $test "$cont"; do
17597 rp="Use which function to generate random numbers?"
17598 . ./myread
17599 if $test "$ans" = "$dflt"; then
17600 : null
17601 else
17602 randbits=''
17603 fi
17604 randfunc="$ans"
17605 if set $ans val -f; eval $csym; $val; then
17606 cont=''
17607 else
17608 dflt=y
17609 rp="I cannot find function $ans. Use that name anyway?"
17610 . ./myread
17611 dflt=rand
17612 case "$ans" in
17613 [yY]*) cont='';;
17614 esac
17615 fi
17616 case "$cont" in
17617 '')
17618 case "$randfunc" in
17619 drand48)
17620 drand01="drand48()"
17621 seedfunc="srand48"
17622 randbits=48
17623 randseedtype=long
17624 ;;
17625 rand|random)
17626 case "$randbits" in
17627 '')
17628echo "Checking to see how many bits your $randfunc() function produces..." >&4
17629 $cat >try.c <<EOCP
17630#$i_unistd I_UNISTD
17631#$i_stdlib I_STDLIB
17632#include <stdio.h>
17633#ifdef I_UNISTD
17634# include <unistd.h>
17635#endif
17636#ifdef I_STDLIB
17637# include <stdlib.h>
17638#endif
17639int main()
17640{
17641 register int i;
17642 register unsigned long tmp;
17643 register unsigned long max = 0L;
17644
17645 for (i = 1000; i; i--) {
17646 tmp = (unsigned long) $randfunc();
17647 if (tmp > max) max = tmp;
17648 }
17649 for (i = 0; max; i++)
17650 max /= 2;
17651 printf("%d\n",i);
17652}
17653EOCP
17654 set try
17655 if eval $compile_ok; then
17656 dflt=`try`
17657 else
17658 dflt='?'
17659 echo "(I can't seem to compile the test program...)"
17660 fi
17661 ;;
17662 *)
17663 dflt="$randbits"
17664 ;;
17665 esac
17666 rp="How many bits does your $randfunc() function produce?"
17667 . ./myread
17668 randbits="$ans"
17669 $rm -f try.c try
17670 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17671 seedfunc="s$randfunc"
17672 randseedtype=unsigned
17673 ;;
17674 *)
17675 dflt="31"
17676 rp="How many bits does your $randfunc() function produce?"
17677 . ./myread
17678 randbits="$ans"
17679 seedfunc="s$randfunc"
17680 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17681 if set $seedfunc val -f; eval $csym; $val; then
17682 echo "(Using $seedfunc() to seed random generator)"
17683 else
17684 echo "(Warning: no $seedfunc() to seed random generator)"
17685 seedfunc=rand
17686 fi
17687 randseedtype=unsigned
17688 ;;
17689 esac
17690 ;;
17691 esac
17692done
17693
17694echo " "
17695echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 17696$cat >try.c <<'EOM'
b4eb6b3d
JH
17697int main()
17698{
17699 if ('M'==0xd4) return 0;
17700 return 1;
17701}
17702EOM
17703
17704val=$undef
5440bc8e 17705set try
b4eb6b3d 17706if eval $compile_ok; then
5440bc8e 17707 if $run ./try; then
b4eb6b3d
JH
17708 echo "You seem to speak EBCDIC." >&4
17709 val="$define"
17710 else
5440bc8e 17711 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
17712 fi
17713else
17714 echo "I'm unable to compile the test program." >&4
17715 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
17716fi
5440bc8e 17717$rm -f try try.*
b4eb6b3d
JH
17718set ebcdic
17719eval $setvar
17720
17721echo " "
17722$cat >&4 <<EOM
17723Checking how to flush all pending stdio output...
17724EOM
17725# I only know how to find the first 32 possibly open files on SunOS.
17726# See also hints/sunos_4_1.sh and util.c --AD
17727case "$osname" in
17728sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
17729esac
17730$cat >>try.c <<EOCP
17731#include <stdio.h>
5a29c6bc
JH
17732#$i_stdlib I_STDLIB
17733#ifdef I_STDLIB
17734#include <stdlib.h>
17735#endif
b4eb6b3d
JH
17736#$i_unistd I_UNISTD
17737#ifdef I_UNISTD
17738# include <unistd.h>
17739#endif
17740#$d_sysconf HAS_SYSCONF
17741#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
17742#ifdef HAS_STDIO_STREAM_ARRAY
17743# define STDIO_STREAM_ARRAY $stdio_stream_array
17744#endif
17745int main() {
5440bc8e
JH
17746 FILE* p;
17747 unlink("try.out");
17748 p = fopen("try.out", "w");
b4eb6b3d
JH
17749#ifdef TRY_FPUTC
17750 fputc('x', p);
17751#else
17752# ifdef TRY_FPRINTF
17753 fprintf(p, "x");
17754# endif
17755#endif
17756#ifdef TRY_FFLUSH_NULL
17757 fflush(NULL);
17758#endif
17759#ifdef TRY_FFLUSH_ALL
17760 {
17761 long open_max = -1;
17762# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
17763 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
17764# else
17765# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
17766 open_max = sysconf(_SC_OPEN_MAX);
17767# else
17768# ifdef FOPEN_MAX
17769 open_max = FOPEN_MAX;
17770# else
17771# ifdef OPEN_MAX
17772 open_max = OPEN_MAX;
17773# else
17774# ifdef _NFILE
17775 open_max = _NFILE;
17776# endif
17777# endif
17778# endif
17779# endif
17780# endif
17781# ifdef HAS_STDIO_STREAM_ARRAY
17782 if (open_max > 0) {
17783 long i;
17784 for (i = 0; i < open_max; i++)
17785 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17786 STDIO_STREAM_ARRAY[i]._file < open_max &&
17787 STDIO_STREAM_ARRAY[i]._flag)
17788 fflush(&STDIO_STREAM_ARRAY[i]);
17789 }
17790 }
17791# endif
17792#endif
17793 _exit(42);
17794}
17795EOCP
17796: first we have to find out how _not_ to flush
5440bc8e 17797$to try.c
b4eb6b3d
JH
17798if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17799 output=''
17800 set try -DTRY_FPUTC
17801 if eval $compile; then
fbe73d74 17802 $run ./try 2>/dev/null
28f5ac64 17803 code="$?"
5440bc8e 17804 $from try.out
28f5ac64 17805 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
17806 output=-DTRY_FPUTC
17807 fi
17808 fi
17809 case "$output" in
17810 '')
17811 set try -DTRY_FPRINTF
b4eb6b3d 17812 if eval $compile; then
fbe73d74 17813 $run ./try 2>/dev/null
28f5ac64 17814 code="$?"
5440bc8e 17815 $from try.out
28f5ac64 17816 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
17817 output=-DTRY_FPRINTF
17818 fi
17819 fi
17820 ;;
17821 esac
17822fi
17823: check for fflush NULL behaviour
17824case "$fflushNULL" in
17825'') set try -DTRY_FFLUSH_NULL $output
17826 if eval $compile; then
5440bc8e 17827 $run ./try 2>/dev/null
b4eb6b3d 17828 code="$?"
5440bc8e 17829 $from try.out
b4eb6b3d
JH
17830 if $test -s try.out -a "X$code" = X42; then
17831 fflushNULL="`$cat try.out`"
17832 else
17833 if $test "X$code" != X42; then
17834 $cat >&4 <<EOM
17835(If this test failed, don't worry, we'll try another method shortly.)
17836EOM
17837 fi
17838 fi
17839 fi
17840 $rm -f core try.core core.try.*
17841 case "$fflushNULL" in
17842 x) $cat >&4 <<EOM
17843Your fflush(NULL) works okay for output streams.
17844Let's see if it clobbers input pipes...
17845EOM
17846# As of mid-March 2000 all versions of Solaris appear to have a stdio
17847# bug that improperly flushes the input end of pipes. So we avoid the
17848# autoflush on fork/system/exec support for now. :-(
17849$cat >tryp.c <<EOCP
17850#include <stdio.h>
17851int
17852main(int argc, char **argv)
17853{
17854 char buf[1024];
17855 int i;
17856 char *bp = buf;
17857 while (1) {
17858 while ((i = getc(stdin)) != -1
17859 && (*bp++ = i) != '\n'
17860 && bp < &buf[1024])
17861 /* DO NOTHING */ ;
17862 *bp = '\0';
17863 fprintf(stdout, "%s", buf);
17864 fflush(NULL);
17865 if (i == -1)
17866 return 0;
17867 bp = buf;
17868 }
17869}
17870EOCP
17871 fflushNULL="$define"
17872 set tryp
17873 if eval $compile; then
17874 $rm -f tryp.out
5440bc8e 17875 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
17876 if cmp tryp.c tryp.out >/dev/null 2>&1; then
17877 $cat >&4 <<EOM
17878fflush(NULL) seems to behave okay with input streams.
17879EOM
17880 fflushNULL="$define"
17881 else
17882 $cat >&4 <<EOM
17883Ouch, fflush(NULL) clobbers input pipes! We will not use it.
17884EOM
17885 fflushNULL="$undef"
17886 fi
17887 fi
17888 $rm -f core tryp.c tryp.core core.tryp.*
17889 ;;
17890 '') $cat >&4 <<EOM
17891Your fflush(NULL) isn't working (contrary to ANSI C).
17892EOM
17893 fflushNULL="$undef"
17894 ;;
17895 *) $cat >&4 <<EOM
17896Cannot figure out whether your fflush(NULL) works or not.
17897I'm assuming it doesn't (contrary to ANSI C).
17898EOM
17899 fflushNULL="$undef"
17900 ;;
17901 esac
17902 ;;
17903$define|true|[yY]*)
17904 fflushNULL="$define"
17905 ;;
17906*)
17907 fflushNULL="$undef"
17908 ;;
17909esac
17910: check explicit looping only if NULL did not work, and if the pipe
17911: bug does not show up on an explicit flush too
17912case "$fflushNULL" in
17913"$undef")
17914 $cat >tryp.c <<EOCP
17915#include <stdio.h>
17916int
17917main(int argc, char **argv)
17918{
17919 char buf[1024];
17920 int i;
17921 char *bp = buf;
17922 while (1) {
17923 while ((i = getc(stdin)) != -1
17924 && (*bp++ = i) != '\n'
17925 && bp < &buf[1024])
17926 /* DO NOTHING */ ;
17927 *bp = '\0';
17928 fprintf(stdout, "%s", buf);
17929 fflush(stdin);
17930 if (i == -1)
17931 return 0;
17932 bp = buf;
17933 }
17934}
17935EOCP
17936 set tryp
17937 if eval $compile; then
17938 $rm -f tryp.out
5440bc8e 17939 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
17940 if cmp tryp.c tryp.out >/dev/null 2>&1; then
17941 $cat >&4 <<EOM
17942Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17943EOM
17944 : now check for fflushall behaviour
17945 case "$fflushall" in
17946 '') set try -DTRY_FFLUSH_ALL $output
17947 if eval $compile; then
17948 $cat >&4 <<EOM
17949(Now testing the other method--but note that this also may fail.)
17950EOM
5440bc8e 17951 $run ./try 2>/dev/null
28f5ac64 17952 code=$?
fbe73d74 17953 $from try.out
28f5ac64 17954 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
17955 fflushall="`$cat try.out`"
17956 fi
17957 fi
17958 $rm -f core try.core core.try.*
17959 case "$fflushall" in
17960 x) $cat >&4 <<EOM
17961Whew. Flushing explicitly all the stdio streams works.
17962EOM
17963 fflushall="$define"
17964 ;;
17965 '') $cat >&4 <<EOM
17966Sigh. Flushing explicitly all the stdio streams doesn't work.
17967EOM
17968 fflushall="$undef"
17969 ;;
17970 *) $cat >&4 <<EOM
17971Cannot figure out whether flushing stdio streams explicitly works or not.
17972I'm assuming it doesn't.
17973EOM
17974 fflushall="$undef"
17975 ;;
17976 esac
17977 ;;
17978 "$define"|true|[yY]*)
17979 fflushall="$define"
17980 ;;
17981 *)
17982 fflushall="$undef"
17983 ;;
17984 esac
17985 else
17986 $cat >&4 <<EOM
17987All is futile. Even fflush(stdin) clobbers input pipes!
17988EOM
17989 fflushall="$undef"
17990 fi
17991 else
17992 fflushall="$undef"
17993 fi
17994 $rm -f core tryp.c tryp.core core.tryp.*
17995 ;;
17996*) fflushall="$undef"
17997 ;;
17998esac
17999
18000case "$fflushNULL$fflushall" in
18001undefundef)
18002 $cat <<EOM
18003OK, I give up. I cannot figure out how to flush pending stdio output.
18004We won't be flushing handles at all before fork/exec/popen.
18005EOM
18006 ;;
18007esac
18008$rm -f try.* try$exe_ext
18009
18010: Store the full pathname to the ar program for use in the C program
18011: Respect a hint or command line value for full_ar.
18012case "$full_ar" in
18013'') full_ar=$ar ;;
18014esac
18015
18016: Store the full pathname to the sed program for use in the C program
18017full_sed=$sed
18018
18019: see what type gids are declared as in the kernel
18020echo " "
18021echo "Looking for the type for group ids returned by getgid()."
18022set gid_t gidtype xxx stdio.h sys/types.h
18023eval $typedef
18024case "$gidtype" in
18025xxx)
18026 xxx=`./findhdr sys/user.h`
18027 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18028 case $1 in
18029 unsigned) dflt="$1 $2" ;;
18030 *) dflt="$1" ;;
18031 esac
18032 ;;
18033*) dflt="$gidtype";;
18034esac
18035case "$gidtype" in
18036gid_t) echo "gid_t found." ;;
18037*) rp="What is the type for group ids returned by getgid()?"
18038 . ./myread
18039 gidtype="$ans"
18040 ;;
18041esac
18042
18043echo " "
18044case "$gidtype" in
18045*_t) zzz="$gidtype" ;;
18046*) zzz="gid" ;;
18047esac
18048echo "Checking the size of $zzz..." >&4
18049cat > try.c <<EOCP
18050#include <sys/types.h>
18051#include <stdio.h>
5ed858ef
JH
18052#$i_stdlib I_STDLIB
18053#ifdef I_STDLIB
18054#include <stdlib.h>
18055#endif
b4eb6b3d
JH
18056int main() {
18057 printf("%d\n", (int)sizeof($gidtype));
18058 exit(0);
18059}
18060EOCP
18061set try
18062if eval $compile_ok; then
5440bc8e 18063 yyy=`$run ./try`
b4eb6b3d
JH
18064 case "$yyy" in
18065 '') gidsize=4
18066 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18067 ;;
18068 *) gidsize=$yyy
18069 echo "Your $zzz is $gidsize bytes long."
18070 ;;
18071 esac
18072else
18073 gidsize=4
18074 echo "(I can't compile the test program--guessing $gidsize.)" >&4
18075fi
18076
18077
18078echo " "
18079case "$gidtype" in
18080*_t) zzz="$gidtype" ;;
18081*) zzz="gid" ;;
18082esac
18083echo "Checking the sign of $zzz..." >&4
18084cat > try.c <<EOCP
18085#include <sys/types.h>
18086#include <stdio.h>
18087int main() {
18088 $gidtype foo = -1;
18089 if (foo < 0)
18090 printf("-1\n");
18091 else
18092 printf("1\n");
18093}
18094EOCP
18095set try
18096if eval $compile; then
5440bc8e 18097 yyy=`$run ./try`
b4eb6b3d
JH
18098 case "$yyy" in
18099 '') gidsign=1
18100 echo "(I can't execute the test program--guessing unsigned.)" >&4
18101 ;;
18102 *) gidsign=$yyy
18103 case "$gidsign" in
18104 1) echo "Your $zzz is unsigned." ;;
18105 -1) echo "Your $zzz is signed." ;;
18106 esac
18107 ;;
18108 esac
18109else
18110 gidsign=1
18111 echo "(I can't compile the test program--guessing unsigned.)" >&4
18112fi
18113
18114
18115echo " "
18116
18117if $test X"$quadtype" != X; then
18118
18119echo "Checking how to print 64-bit integers..." >&4
18120
18121if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18122 $cat >try.c <<'EOCP'
18123#include <sys/types.h>
18124#include <stdio.h>
18125int main() {
18126 int q = 12345678901;
18127 printf("%ld\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='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18136 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18137 echo "We will use %d."
18138 ;;
18139 esac
18140 fi
18141fi
18142
18143if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18144 $cat >try.c <<'EOCP'
18145#include <sys/types.h>
18146#include <stdio.h>
18147int main() {
18148 long q = 12345678901;
18149 printf("%ld\n", q);
18150}
18151EOCP
18152 set try
18153 if eval $compile; then
5440bc8e 18154 yyy=`$run ./try`
b4eb6b3d
JH
18155 case "$yyy" in
18156 12345678901)
18157 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18158 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18159 echo "We will use %ld."
18160 ;;
18161 esac
18162 fi
18163fi
18164
18165if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18166 $cat >try.c <<'EOCP'
18167#include <sys/types.h>
18168#include <inttypes.h>
18169#include <stdio.h>
18170int main() {
18171 int64_t q = 12345678901;
18172 printf("%" PRId64 "\n", q);
18173}
18174EOCP
18175 set try
18176 if eval $compile; then
5440bc8e 18177 yyy=`$run ./try`
b4eb6b3d
JH
18178 case "$yyy" in
18179 12345678901)
18180 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18181 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18182 echo "We will use the C9X style."
18183 ;;
18184 esac
18185 fi
18186fi
18187
2ef53570
JH
18188if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18189 $cat >try.c <<EOCP
b4eb6b3d
JH
18190#include <sys/types.h>
18191#include <stdio.h>
18192int main() {
2ef53570
JH
18193 $quadtype q = 12345678901;
18194 printf("%Ld\n", q);
b4eb6b3d
JH
18195}
18196EOCP
18197 set try
18198 if eval $compile; then
5440bc8e 18199 yyy=`$run ./try`
b4eb6b3d
JH
18200 case "$yyy" in
18201 12345678901)
2ef53570
JH
18202 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18203 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18204 echo "We will use %Ld."
b4eb6b3d
JH
18205 ;;
18206 esac
18207 fi
18208fi
18209
2ef53570
JH
18210if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18211 $cat >try.c <<'EOCP'
b4eb6b3d
JH
18212#include <sys/types.h>
18213#include <stdio.h>
18214int main() {
2ef53570
JH
18215 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18216 printf("%lld\n", q);
b4eb6b3d
JH
18217}
18218EOCP
18219 set try
18220 if eval $compile; then
5440bc8e 18221 yyy=`$run ./try`
b4eb6b3d
JH
18222 case "$yyy" in
18223 12345678901)
2ef53570
JH
18224 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18225 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18226 echo "We will use the %lld style."
b4eb6b3d
JH
18227 ;;
18228 esac
18229 fi
18230fi
18231
18232if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18233 $cat >try.c <<EOCP
18234#include <sys/types.h>
18235#include <stdio.h>
18236int main() {
18237 $quadtype q = 12345678901;
18238 printf("%qd\n", q);
18239}
18240EOCP
18241 set try
18242 if eval $compile; then
5440bc8e 18243 yyy=`$run ./try`
b4eb6b3d
JH
18244 case "$yyy" in
18245 12345678901)
18246 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18247 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18248 echo "We will use %qd."
18249 ;;
18250 esac
18251 fi
18252fi
18253
18254if $test X"$sPRId64" = X; then
18255 echo "Cannot figure out how to print 64-bit integers." >&4
18256fi
18257
18258$rm -f try try.*
18259
18260fi
18261
18262case "$sPRId64" in
18263'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
18264 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
18265 ;;
18266*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
18267 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
18268 ;;
18269esac
18270
18271
18272echo " "
18273$echo "Checking the format strings to be used for Perl's internal types..." >&4
18274
18275if $test X"$ivsize" = X8; then
18276 ivdformat="$sPRId64"
18277 uvuformat="$sPRIu64"
18278 uvoformat="$sPRIo64"
18279 uvxformat="$sPRIx64"
18280 uvXUformat="$sPRIXU64"
18281else
18282 if $test X"$ivsize" = X"$longsize"; then
18283 ivdformat='"ld"'
18284 uvuformat='"lu"'
18285 uvoformat='"lo"'
18286 uvxformat='"lx"'
18287 uvXUformat='"lX"'
18288 else
18289 if $test X"$ivsize" = X"$intsize"; then
18290 ivdformat='"d"'
18291 uvuformat='"u"'
18292 uvoformat='"o"'
18293 uvxformat='"x"'
18294 uvXUformat='"X"'
18295 else
18296 : far out
18297 if $test X"$ivsize" = X"$shortsize"; then
18298 ivdformat='"hd"'
18299 uvuformat='"hu"'
18300 uvoformat='"ho"'
18301 uvxformat='"hx"'
18302 uvXUformat='"hX"'
18303 fi
18304 fi
18305 fi
18306fi
18307
18308if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18309 nveformat="$sPRIeldbl"
18310 nvfformat="$sPRIfldbl"
18311 nvgformat="$sPRIgldbl"
18312 nvEUformat="$sPRIEUldbl"
18313 nvFUformat="$sPRIFUldbl"
18314 nvGUformat="$sPRIGUldbl"
18315else
18316 nveformat='"e"'
18317 nvfformat='"f"'
18318 nvgformat='"g"'
18319 nvEUformat='"E"'
18320 nvFUformat='"F"'
18321 nvGUformat='"G"'
18322fi
18323
18324case "$ivdformat" in
3c728e00 18325'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
18326 exit 1
18327 ;;
18328esac
18329
18330
18331echo " "
18332$echo "Checking the format string to be used for gids..." >&4
18333
18334case "$gidsign" in
18335-1) if $test X"$gidsize" = X"$ivsize"; then
18336 gidformat="$ivdformat"
18337 else
18338 if $test X"$gidsize" = X"$longsize"; then
18339 gidformat='"ld"'
18340 else
18341 if $test X"$gidsize" = X"$intsize"; then
18342 gidformat='"d"'
18343 else
18344 if $test X"$gidsize" = X"$shortsize"; then
18345 gidformat='"hd"'
18346 fi
18347 fi
18348 fi
18349 fi
18350 ;;
18351*) if $test X"$gidsize" = X"$uvsize"; then
18352 gidformat="$uvuformat"
18353 else
18354 if $test X"$gidsize" = X"$longsize"; then
18355 gidformat='"lu"'
18356 else
18357 if $test X"$gidsize" = X"$intsize"; then
18358 gidformat='"u"'
18359 else
18360 if $test X"$gidsize" = X"$shortsize"; then
18361 gidformat='"hu"'
18362 fi
18363 fi
18364 fi
18365 fi
18366 ;;
18367esac
18368
18369: see if getgroups exists
18370set getgroups d_getgrps
18371eval $inlibc
18372
18373: see if setgroups exists
18374set setgroups d_setgrps
18375eval $inlibc
18376
18377
18378: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18379echo " "
18380case "$d_getgrps$d_setgrps" in
18381*define*)
18382 case "$groupstype" in
18383 '') dflt="$gidtype" ;;
18384 *) dflt="$groupstype" ;;
18385 esac
18386 $cat <<EOM
18387What type of pointer is the second argument to getgroups() and setgroups()?
18388Usually this is the same as group ids, $gidtype, but not always.
18389
18390EOM
18391 rp='What type pointer is the second argument to getgroups() and setgroups()?'
18392 . ./myread
18393 groupstype="$ans"
18394 ;;
18395*) groupstype="$gidtype";;
18396esac
18397
18398echo " "
18399echo "Checking if your $make program sets \$(MAKE)..." >&4
18400case "$make_set_make" in
18401'')
18402 $sed 's/^X //' > testmake.mak << 'EOF'
18403Xall:
18404X @echo 'maketemp="$(MAKE)"'
18405EOF
18406 case "`$make -f testmake.mak 2>/dev/null`" in
18407 *maketemp=*) make_set_make='#' ;;
18408 *) make_set_make="MAKE=$make" ;;
18409 esac
18410 $rm -f testmake.mak
18411 ;;
18412esac
18413case "$make_set_make" in
18414'#') echo "Yup, it does.";;
18415*) echo "Nope, it doesn't.";;
18416esac
18417
18418: see what type is used for mode_t
18419rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18420set mode_t modetype int stdio.h sys/types.h
18421eval $typedef_ask
18422
2cc61e15
DD
18423: see if stdarg is available
18424echo " "
18425if $test `./findhdr stdarg.h`; then
18426 echo "<stdarg.h> found." >&4
18427 valstd="$define"
18428else
18429 echo "<stdarg.h> NOT found." >&4
18430 valstd="$undef"
18431fi
18432
18433: see if varags is available
18434echo " "
18435if $test `./findhdr varargs.h`; then
18436 echo "<varargs.h> found." >&4
18437else
18438 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18439fi
18440
18441: set up the varargs testing programs
18442$cat > varargs.c <<EOP
18443#ifdef I_STDARG
18444#include <stdarg.h>
18445#endif
18446#ifdef I_VARARGS
18447#include <varargs.h>
18448#endif
18449
18450#ifdef I_STDARG
18451int f(char *p, ...)
18452#else
18453int f(va_alist)
18454va_dcl
18455#endif
18456{
18457 va_list ap;
18458#ifndef I_STDARG
18459 char *p;
18460#endif
18461#ifdef I_STDARG
18462 va_start(ap,p);
18463#else
18464 va_start(ap);
18465 p = va_arg(ap, char *);
18466#endif
18467 va_end(ap);
18468}
18469EOP
18470$cat > varargs <<EOP
18471$startsh
18472if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18473 echo "true"
18474else
18475 echo "false"
18476fi
18477$rm -f varargs$_o
18478EOP
18479chmod +x varargs
18480
18481: now check which varargs header should be included
18482echo " "
18483i_varhdr=''
18484case "$valstd" in
18485"$define")
18486 if `./varargs I_STDARG`; then
18487 val='stdarg.h'
18488 elif `./varargs I_VARARGS`; then
18489 val='varargs.h'
18490 fi
18491 ;;
18492*)
18493 if `./varargs I_VARARGS`; then
18494 val='varargs.h'
18495 fi
18496 ;;
18497esac
18498case "$val" in
18499'')
18500echo "I could not find the definition for va_dcl... You have problems..." >&4
18501 val="$undef"; set i_stdarg; eval $setvar
18502 val="$undef"; set i_varargs; eval $setvar
18503 ;;
18504*)
18505 set i_varhdr
18506 eval $setvar
18507 case "$i_varhdr" in
18508 stdarg.h)
18509 val="$define"; set i_stdarg; eval $setvar
18510 val="$undef"; set i_varargs; eval $setvar
18511 ;;
18512 varargs.h)
18513 val="$undef"; set i_stdarg; eval $setvar
18514 val="$define"; set i_varargs; eval $setvar
18515 ;;
18516 esac
18517 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18518esac
18519$rm -f varargs*
18520
18521: see if we need va_copy
18522echo " "
18523case "$i_stdarg" in
18524"$define")
18525 $cat >try.c <<EOCP
18526#include <stdarg.h>
18527#include <stdio.h>
85c8a686
DD
18528#$i_stdlib I_STDLIB
18529#ifdef I_STDLIB
18530#include <stdlib.h>
18531#endif
18532#include <signal.h>
2cc61e15
DD
18533
18534int
18535ivfprintf(FILE *f, const char *fmt, va_list *valp)
18536{
18537 return vfprintf(f, fmt, *valp);
18538}
18539
18540int
18541myvfprintf(FILE *f, const char *fmt, va_list val)
18542{
18543 return ivfprintf(f, fmt, &val);
18544}
18545
18546int
18547myprintf(char *fmt, ...)
18548{
18549 va_list val;
18550 va_start(val, fmt);
18551 return myvfprintf(stdout, fmt, val);
18552}
18553
18554int
18555main(int ac, char **av)
18556{
85c8a686
DD
18557 signal(SIGSEGV, exit);
18558
2cc61e15
DD
18559 myprintf("%s%cs all right, then\n", "that", '\'');
18560 exit(0);
18561}
18562EOCP
18563 set try
5440bc8e
JH
18564 if eval $compile && $run ./try 2>&1 >/dev/null; then
18565 case "`$run ./try`" in
2cc61e15
DD
18566 "that's all right, then")
18567 okay=yes
18568 ;;
18569 esac
18570 fi
18571 case "$okay" in
18572 yes) echo "It seems that you don't need va_copy()." >&4
18573 need_va_copy="$undef"
18574 ;;
18575 *) echo "It seems that va_copy() or similar will be needed." >&4
18576 need_va_copy="$define"
18577 ;;
18578 esac
18579 $rm -f try.* core core.* *.core *.core.*
18580 ;;
18581*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18582 ;;
18583esac
18584
b4eb6b3d
JH
18585: see what type is used for size_t
18586rp="What is the type used for the length parameter for string functions?"
18587set size_t sizetype 'unsigned int' stdio.h sys/types.h
18588eval $typedef_ask
18589
18590: check for type of arguments to gethostbyaddr.
18591if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18592 case "$d_gethbyaddr" in
18593 $define)
18594 $cat <<EOM
18595
18596Checking to see what type of arguments are accepted by gethostbyaddr().
18597EOM
18598 hdrs="$define sys/types.h
18599 $d_socket sys/socket.h
18600 $i_niin netinet/in.h
18601 $i_netdb netdb.h
18602 $i_unistd unistd.h"
18603 : The first arg can 'char *' or 'void *'
18604 : The second arg is some of integral type
18605 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18606 for yyy in size_t long int; do
18607 case "$netdb_host_type" in
18608 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18609 if ./protochk "$try" $hdrs; then
18610 echo "Your system accepts $xxx for the first arg."
18611 echo "...and $yyy for the second arg."
18612 netdb_host_type="$xxx"
18613 netdb_hlen_type="$yyy"
18614 fi
18615 ;;
18616 esac
18617 done
18618 done
18619 : In case none of those worked, prompt the user.
18620 case "$netdb_host_type" in
18621 '') rp='What is the type for the 1st argument to gethostbyaddr?'
18622 dflt='char *'
18623 . ./myread
18624 netdb_host_type=$ans
18625 rp='What is the type for the 2nd argument to gethostbyaddr?'
18626 dflt="$sizetype"
18627 . ./myread
18628 netdb_hlen_type=$ans
18629 ;;
18630 esac
18631 ;;
18632 *) : no gethostbyaddr, so pick harmless defaults
18633 netdb_host_type='char *'
18634 netdb_hlen_type="$sizetype"
18635 ;;
18636 esac
18637 # Remove the "const" if needed. -- but then we'll have a
18638 # prototype clash!
18639 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18640fi
18641
18642: check for type of argument to gethostbyname.
18643if test "X$netdb_name_type" = X ; then
18644 case "$d_gethbyname" in
18645 $define)
18646 $cat <<EOM
18647
18648Checking to see what type of argument is accepted by gethostbyname().
18649EOM
18650 hdrs="$define sys/types.h
18651 $d_socket sys/socket.h
18652 $i_niin netinet/in.h
18653 $i_netdb netdb.h
18654 $i_unistd unistd.h"
18655 for xxx in "const char *" "char *"; do
18656 case "$netdb_name_type" in
18657 '') try="extern struct hostent *gethostbyname($xxx);"
18658 if ./protochk "$try" $hdrs; then
18659 echo "Your system accepts $xxx."
18660 netdb_name_type="$xxx"
18661 fi
18662 ;;
18663 esac
18664 done
18665 : In case none of those worked, prompt the user.
18666 case "$netdb_name_type" in
18667 '') rp='What is the type for the 1st argument to gethostbyname?'
18668 dflt='char *'
18669 . ./myread
18670 netdb_name_type=$ans
18671 ;;
18672 esac
18673 ;;
18674 *) : no gethostbyname, so pick harmless default
18675 netdb_name_type='char *'
18676 ;;
18677 esac
18678fi
18679
18680: check for type of 1st argument to getnetbyaddr.
18681if test "X$netdb_net_type" = X ; then
18682 case "$d_getnbyaddr" in
18683 $define)
18684 $cat <<EOM
18685
18686Checking to see what type of 1st argument is accepted by getnetbyaddr().
18687EOM
18688 hdrs="$define sys/types.h
18689 $d_socket sys/socket.h
18690 $i_niin netinet/in.h
18691 $i_netdb netdb.h
18692 $i_unistd unistd.h"
18693 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
18694 case "$netdb_net_type" in
18695 '') try="extern struct netent *getnetbyaddr($xxx, int);"
18696 if ./protochk "$try" $hdrs; then
18697 echo "Your system accepts $xxx."
18698 netdb_net_type="$xxx"
18699 fi
18700 ;;
18701 esac
18702 done
18703 : In case none of those worked, prompt the user.
18704 case "$netdb_net_type" in
18705 '') rp='What is the type for the 1st argument to getnetbyaddr?'
18706 dflt='long'
18707 . ./myread
18708 netdb_net_type=$ans
18709 ;;
18710 esac
18711 ;;
18712 *) : no getnetbyaddr, so pick harmless default
18713 netdb_net_type='long'
18714 ;;
18715 esac
18716fi
18717: locate the preferred pager for this system
d604bb53 18718fn=f/
b4eb6b3d
JH
18719case "$pager" in
18720'')
18721 dflt=''
18722 case "$pg" in
18723 /*) dflt=$pg;;
18724 [a-zA-Z]:/*) dflt=$pg;;
18725 esac
18726 case "$more" in
18727 /*) dflt=$more;;
18728 [a-zA-Z]:/*) dflt=$more;;
18729 esac
18730 case "$less" in
18731 /*) dflt=$less;;
18732 [a-zA-Z]:/*) dflt=$less;;
18733 esac
18734 case "$dflt" in
18735 '') dflt=/usr/ucb/more;;
18736 esac
18737 ;;
d604bb53
JH
18738*) dflt="$pager"
18739 : Instruct ./getfile to trust the hinted or previous pager value,
18740 : even if it does not begin with a slash. For example, on os2,
18741 : pager might be cmd /c more. See comments in UU/getfile.
18742 fn="f/($pager)"
18743 ;;
b4eb6b3d
JH
18744esac
18745echo " "
b4eb6b3d
JH
18746rp='What pager is used on your system?'
18747. ./getfile
18748pager="$ans"
18749
18750: see what type pids are declared as in the kernel
18751rp="What is the type of process ids on this system?"
18752set pid_t pidtype int stdio.h sys/types.h
18753eval $typedef_ask
18754
b4eb6b3d
JH
18755: see if ar generates random libraries by itself
18756echo " "
18757echo "Checking how to generate random libraries on your machine..." >&4
18758echo 'int bar1() { return bar2(); }' > bar1.c
18759echo 'int bar2() { return 2; }' > bar2.c
5a29c6bc
JH
18760$cat > foo.c <<EOP
18761#$i_stdlib I_STDLIB
18762#ifdef I_STDLIB
18763#include <stdlib.h>
18764#endif
b4eb6b3d
JH
18765int main() { printf("%d\n", bar1()); exit(0); }
18766EOP
18767$cc $ccflags -c bar1.c >/dev/null 2>&1
18768$cc $ccflags -c bar2.c >/dev/null 2>&1
18769$cc $ccflags -c foo.c >/dev/null 2>&1
18770$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 18771if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 18772 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
18773 echo "$ar appears to generate random libraries itself."
18774 orderlib=false
18775 ranlib=":"
18776elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 18777 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 18778 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
18779 echo "a table of contents needs to be added with '$ar ts'."
18780 orderlib=false
18781 ranlib="$ar ts"
18782else
18783 case "$ranlib" in
18784 :) ranlib='';;
18785 '')
18786 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18787 $test -f $ranlib || ranlib=''
18788 ;;
18789 esac
18790 if $test -n "$ranlib"; then
18791 echo "your system has '$ranlib'; we'll use that."
18792 orderlib=false
18793 else
18794 echo "your system doesn't seem to support random libraries"
18795 echo "so we'll use lorder and tsort to order the libraries."
18796 orderlib=true
18797 ranlib=":"
18798 fi
18799fi
18800$rm -f foo* bar*
18801
18802: check for type of arguments to select.
18803case "$selecttype" in
18804'') case "$d_select" in
18805 $define)
18806 echo " "
18807 $cat <<EOM
18808Checking to see what type of arguments are accepted by select().
18809EOM
18810 hdrs="$define sys/types.h
18811 $i_systime sys/time.h
18812 $i_sysselct sys/select.h
18813 $d_socket sys/socket.h"
18814 : The first arg can be int, unsigned, or size_t
18815 : The last arg may or may not be 'const'
18816 val=''
18817 : void pointer has been seen but using that
18818 : breaks the selectminbits test
18819 for xxx in 'fd_set *' 'int *'; do
18820 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18821 for tmo in 'struct timeval *' 'const struct timeval *'; do
18822 case "$val" in
18823 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18824 if ./protochk "$try" $hdrs; then
18825 echo "Your system accepts $xxx."
18826 val="$xxx"
18827 fi
18828 ;;
18829 esac
18830 done
18831 done
18832 done
18833 case "$val" in
18834 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18835 case "$d_fd_set" in
18836 $define) dflt="fd_set *" ;;
18837 *) dflt="int *" ;;
18838 esac
18839 . ./myread
18840 val=$ans
18841 ;;
18842 esac
18843 selecttype="$val"
18844 ;;
18845 *) : no select, so pick a harmless default
18846 selecttype='int *'
18847 ;;
18848 esac
18849 ;;
18850esac
18851
18852: check for the select 'width'
18853case "$selectminbits" in
5a29c6bc
JH
18854'') safebits=`expr $ptrsize \* 8`
18855 case "$d_select" in
b4eb6b3d
JH
18856 $define)
18857 $cat <<EOM
18858
18859Checking to see on how many bits at a time your select() operates...
18860EOM
18861 $cat >try.c <<EOCP
18862#include <sys/types.h>
18863#$i_time I_TIME
18864#$i_systime I_SYS_TIME
18865#$i_systimek I_SYS_TIME_KERNEL
18866#ifdef I_TIME
18867# include <time.h>
18868#endif
18869#ifdef I_SYS_TIME
18870# ifdef I_SYS_TIME_KERNEL
18871# define KERNEL
18872# endif
18873# include <sys/time.h>
18874# ifdef I_SYS_TIME_KERNEL
18875# undef KERNEL
18876# endif
18877#endif
18878#$i_sysselct I_SYS_SELECT
18879#ifdef I_SYS_SELECT
18880#include <sys/select.h>
18881#endif
18882#$d_socket HAS_SOCKET
18883#ifdef HAS_SOCKET
18884# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18885#endif
18886#include <stdio.h>
5ed858ef
JH
18887#$i_stdlib I_STDLIB
18888#ifdef I_STDLIB
18889#include <stdlib.h>
18890#endif
b4eb6b3d
JH
18891$selecttype b;
18892#define S sizeof(*(b))
18893#define MINBITS 64
18894#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18895#define NBITS (NBYTES * 8)
18896int main() {
5a29c6bc 18897 char *s = malloc(NBYTES);
b4eb6b3d
JH
18898 struct timeval t;
18899 int i;
18900 FILE* fp;
18901 int fd;
18902
5a29c6bc
JH
18903 if (!s)
18904 exit(1);
b4eb6b3d
JH
18905 fclose(stdin);
18906 fp = fopen("try.c", "r");
18907 if (fp == 0)
5a29c6bc 18908 exit(2);
b4eb6b3d
JH
18909 fd = fileno(fp);
18910 if (fd < 0)
5a29c6bc 18911 exit(3);
b4eb6b3d
JH
18912 b = ($selecttype)s;
18913 for (i = 0; i < NBITS; i++)
18914 FD_SET(i, b);
18915 t.tv_sec = 0;
18916 t.tv_usec = 0;
18917 select(fd + 1, b, 0, 0, &t);
18918 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
5a29c6bc 18919 free(s);
b4eb6b3d
JH
18920 printf("%d\n", i + 1);
18921 return 0;
18922}
18923EOCP
18924 set try
18925 if eval $compile_ok; then
5440bc8e 18926 selectminbits=`$run ./try`
b4eb6b3d
JH
18927 case "$selectminbits" in
18928 '') cat >&4 <<EOM
18929Cannot figure out on how many bits at a time your select() operates.
5a29c6bc 18930I'll play safe and guess it is $safebits bits.
b4eb6b3d 18931EOM
5a29c6bc
JH
18932 selectminbits=$safebits
18933 bits="$safebits bits"
b4eb6b3d
JH
18934 ;;
18935 1) bits="1 bit" ;;
18936 *) bits="$selectminbits bits" ;;
18937 esac
18938 echo "Your select() operates on $bits at a time." >&4
18939 else
18940 rp='What is the minimum number of bits your select() operates on?'
18941 case "$byteorder" in
5a29c6bc
JH
18942 12345678) dflt=64 ;;
18943 1234) dflt=32 ;;
b4eb6b3d
JH
18944 *) dflt=1 ;;
18945 esac
18946 . ./myread
18947 val=$ans
18948 selectminbits="$val"
18949 fi
18950 $rm -f try.* try
18951 ;;
18952 *) : no select, so pick a harmless default
5a29c6bc 18953 selectminbits=$safebits
b4eb6b3d
JH
18954 ;;
18955 esac
18956 ;;
18957esac
18958
18959: Trace out the files included by signal.h, then look for SIGxxx names.
18960: Remove SIGARRAYSIZE used by HPUX.
18961: Remove SIGSTKSIZE used by Linux.
18962: Remove SIGSTKSZ used by Posix.
18963: Remove SIGTYP void lines used by OS2.
18964: Some cpps, like os390, dont give the file name anywhere
18965if [ "X$fieldn" = X ]; then
18966 : Just make some guesses. We check them later.
18967 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18968else
18969 xxx=`echo '#include <signal.h>' |
18970 $cppstdin $cppminus $cppflags 2>/dev/null |
18971 $grep '^[ ]*#.*include' |
a938a3bb 18972 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
18973fi
18974: Check this list of files to be sure we have parsed the cpp output ok.
18975: This will also avoid potentially non-existent files, such
18976: as ../foo/bar.h
18977xxxfiles=''
18978for xx in $xxx /dev/null ; do
18979 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18980done
18981: If we have found no files, at least try signal.h
18982case "$xxxfiles" in
18983'') xxxfiles=`./findhdr signal.h` ;;
18984esac
18985xxx=`awk '
18986$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18987 print substr($2, 4, 20)
18988}
18989$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18990 print substr($3, 4, 20)
18991}' $xxxfiles`
18992: Append some common names just in case the awk scan failed.
18993xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18994xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18995xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18996xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18997xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18998
18999: generate a few handy files for later
5a29c6bc 19000$cat > signal.c <<EOCP
b4eb6b3d
JH
19001#include <sys/types.h>
19002#include <signal.h>
5a29c6bc
JH
19003#$i_stdlib I_STDLIB
19004#ifdef I_STDLIB
19005#include <stdlib.h>
19006#endif
b4eb6b3d
JH
19007#include <stdio.h>
19008int main() {
19009
19010/* Strange style to avoid deeply-nested #if/#else/#endif */
19011#ifndef NSIG
19012# ifdef _NSIG
19013# define NSIG (_NSIG)
19014# endif
19015#endif
19016
19017#ifndef NSIG
19018# ifdef SIGMAX
19019# define NSIG (SIGMAX+1)
19020# endif
19021#endif
19022
19023#ifndef NSIG
19024# ifdef SIG_MAX
19025# define NSIG (SIG_MAX+1)
19026# endif
19027#endif
19028
19029#ifndef NSIG
19030# ifdef MAXSIG
19031# define NSIG (MAXSIG+1)
19032# endif
19033#endif
19034
19035#ifndef NSIG
19036# ifdef MAX_SIG
19037# define NSIG (MAX_SIG+1)
19038# endif
19039#endif
19040
19041#ifndef NSIG
19042# ifdef SIGARRAYSIZE
19043# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
19044# endif
19045#endif
19046
19047#ifndef NSIG
19048# ifdef _sys_nsig
19049# define NSIG (_sys_nsig) /* Solaris 2.5 */
19050# endif
19051#endif
19052
19053/* Default to some arbitrary number that's big enough to get most
19054 of the common signals.
19055*/
19056#ifndef NSIG
19057# define NSIG 50
19058#endif
19059
19060printf("NSIG %d\n", NSIG);
19061
19062#ifndef JUST_NSIG
19063
19064EOCP
19065
19066echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19067{
19068 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 19069 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
19070 printf $1; printf ");\n"
19071 printf "#endif\n"
19072}
19073END {
19074 printf "#endif /* JUST_NSIG */\n";
19075 printf "exit(0);\n}\n";
19076}
19077' >>signal.c
19078$cat >signal.awk <<'EOP'
19079BEGIN { ndups = 0 }
65197d93 19080$1 ~ /^NSIG$/ { nsig = $2 }
582e5fa1 19081($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
19082 if ($2 > maxsig) { maxsig = $2 }
19083 if (sig_name[$2]) {
19084 dup_name[ndups] = $1
19085 dup_num[ndups] = $2
b4eb6b3d
JH
19086 ndups++
19087 }
19088 else {
65197d93
JH
19089 sig_name[$2] = $1
19090 sig_num[$2] = $2
b4eb6b3d
JH
19091 }
19092}
19093END {
19094 if (nsig == 0) {
19095 nsig = maxsig + 1
19096 }
19097 printf("NSIG %d\n", nsig);
19098 for (n = 1; n < nsig; n++) {
19099 if (sig_name[n]) {
19100 printf("%s %d\n", sig_name[n], sig_num[n])
19101 }
19102 else {
19103 printf("NUM%d %d\n", n, n)
19104 }
19105 }
19106 for (n = 0; n < ndups; n++) {
19107 printf("%s %d\n", dup_name[n], dup_num[n])
19108 }
19109}
19110EOP
19111$cat >signal_cmd <<EOS
19112$startsh
19113if $test -s signal.lst; then
19114 echo "Using your existing signal.lst file"
19115 exit 0
19116fi
19117xxx="$xxx"
19118EOS
19119$cat >>signal_cmd <<'EOS'
19120
19121set signal
19122if eval $compile_ok; then
1eb9ad5b 19123 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
19124else
19125 echo "(I can't seem be able to compile the whole test program)" >&4
19126 echo "(I'll try it in little pieces.)" >&4
19127 set signal -DJUST_NSIG
19128 if eval $compile_ok; then
5440bc8e 19129 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
19130 $cat signal.nsg
19131 else
19132 echo "I can't seem to figure out how many signals you have." >&4
19133 echo "Guessing 50." >&4
19134 echo 'NSIG 50' > signal.nsg
19135 fi
19136 : Now look at all the signal names, one at a time.
19137 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19138 $cat > signal.c <<EOCP
19139#include <sys/types.h>
19140#include <signal.h>
19141#include <stdio.h>
19142int main() {
19143printf("$xx %d\n", SIG${xx});
19144return 0;
19145}
19146EOCP
19147 set signal
19148 if eval $compile; then
19149 echo "SIG${xx} found."
5440bc8e 19150 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
19151 else
19152 echo "SIG${xx} NOT found."
19153 fi
19154 done
19155 if $test -s signal.ls1; then
19156 $cat signal.nsg signal.ls1 |
65197d93 19157 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
19158 fi
19159
19160fi
19161if $test -s signal.lst; then
19162 :
19163else
19164 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19165 echo 'kill -l' >signal
19166 set X `csh -f <signal`
19167 $rm -f signal
19168 shift
19169 case $# in
19170 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19171 esac
19172 echo $@ | $tr ' ' $trnl | \
19173 $awk '{ printf "%s %d\n", $1, ++s; }
19174 END { printf "NSIG %d\n", ++s }' >signal.lst
19175fi
19176$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19177EOS
19178chmod a+x signal_cmd
19179$eunicefix signal_cmd
19180
19181: generate list of signal names
19182echo " "
19183case "$sig_name_init" in
19184'') doinit=yes ;;
19185*) case "$sig_num_init" in
19186 ''|*,*) doinit=yes ;;
19187 esac ;;
19188esac
19189case "$doinit" in
19190yes)
19191 echo "Generating a list of signal names and numbers..." >&4
19192 . ./signal_cmd
19193 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19194 sig_name=`$awk 'BEGIN { printf "ZERO " }
19195 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19196 sig_num=`$awk 'BEGIN { printf "0 " }
19197 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19198 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
19199 !/^NSIG/ { printf "\"%s\", ", $1 }
19200 END { printf "0\n" }' signal.lst`
19201 sig_num_init=`$awk 'BEGIN { printf "0, " }
19202 !/^NSIG/ { printf "%d, ", $2}
19203 END { printf "0\n"}' signal.lst`
19204 ;;
19205esac
19206echo "The following $sig_count signals are available:"
19207echo " "
19208echo $sig_name | $awk \
19209'BEGIN { linelen = 0 }
19210{
19211 for (i = 1; i <= NF; i++) {
19212 name = "SIG" $i " "
19213 linelen = linelen + length(name)
19214 if (linelen > 70) {
19215 printf "\n"
19216 linelen = length(name)
19217 }
19218 printf "%s", name
19219 }
19220 printf "\n"
19221}'
76d3c696 19222sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
19223$rm -f signal signal.c signal.awk signal.lst signal_cmd
19224
19225echo " "
19226case "$sizetype" in
19227*_t) zzz="$sizetype" ;;
19228*) zzz="filesize" ;;
19229esac
19230echo "Checking the size of $zzz..." >&4
19231cat > try.c <<EOCP
19232#include <sys/types.h>
19233#include <stdio.h>
5ed858ef
JH
19234#$i_stdlib I_STDLIB
19235#ifdef I_STDLIB
19236#include <stdlib.h>
19237#endif
b4eb6b3d
JH
19238int main() {
19239 printf("%d\n", (int)sizeof($sizetype));
19240 exit(0);
19241}
19242EOCP
19243set try
19244if eval $compile_ok; then
5440bc8e 19245 yyy=`$run ./try`
b4eb6b3d
JH
19246 case "$yyy" in
19247 '') sizesize=4
19248 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19249 ;;
19250 *) sizesize=$yyy
19251 echo "Your $zzz size is $sizesize bytes."
19252 ;;
19253 esac
19254else
19255 sizesize=4
19256 echo "(I can't compile the test program--guessing $sizesize.)" >&4
19257fi
19258
19259
19260: check for socklen_t
19261echo " "
19262echo "Checking to see if you have socklen_t..." >&4
19263$cat >try.c <<EOCP
19264#include <sys/types.h>
19265#$d_socket HAS_SOCKET
19266#ifdef HAS_SOCKET
19267#include <sys/socket.h>
19268#endif
19269int main() { socklen_t x = 16; }
19270EOCP
19271set try
19272if eval $compile; then
19273 val="$define"
19274 echo "You have socklen_t."
19275else
19276 val="$undef"
19277 echo "You do not have socklen_t."
19278 case "$sizetype" in
19279 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19280 esac
19281fi
19282$rm -f try try.*
19283set d_socklen_t
19284eval $setvar
19285
a7710f8d
JH
19286: see if this is a socks.h system
19287set socks.h i_socks
19288eval $inhdr
19289
b4eb6b3d
JH
19290: check for type of the size argument to socket calls
19291case "$d_socket" in
19292"$define")
19293 $cat <<EOM
19294
19295Checking to see what type is the last argument of accept().
19296EOM
b4eb6b3d
JH
19297 yyy=''
19298 case "$d_socklen_t" in
19299 "$define") yyy="$yyy socklen_t"
19300 esac
19301 yyy="$yyy $sizetype int long unsigned"
19302 for xxx in $yyy; do
19303 case "$socksizetype" in
19304 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
19305 case "$usesocks" in
19306 "$define")
19307 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19308 echo "Your system accepts '$xxx *' for the last argument of accept()."
19309 socksizetype="$xxx"
19310 fi
19311 ;;
19312 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
19313 echo "Your system accepts '$xxx *' for the last argument of accept()."
19314 socksizetype="$xxx"
19315 fi
19316 ;;
19317 esac
b4eb6b3d
JH
19318 ;;
19319 esac
19320 done
19321: In case none of those worked, prompt the user.
19322 case "$socksizetype" in
19323 '') rp='What is the type for socket address structure sizes?'
19324 dflt='int'
19325 . ./myread
19326 socksizetype=$ans
19327 ;;
19328 esac
19329 ;;
19330*) : no sockets, so pick relatively harmless default
19331 socksizetype='int'
19332 ;;
19333esac
19334
19335: see what type is used for signed size_t
19336set ssize_t ssizetype int stdio.h sys/types.h
19337eval $typedef
19338dflt="$ssizetype"
5440bc8e 19339$cat > try.c <<EOM
b4eb6b3d 19340#include <stdio.h>
5ed858ef
JH
19341#$i_stdlib I_STDLIB
19342#ifdef I_STDLIB
19343#include <stdlib.h>
19344#endif
b4eb6b3d
JH
19345#include <sys/types.h>
19346#define Size_t $sizetype
19347#define SSize_t $dflt
19348int main()
19349{
19350 if (sizeof(Size_t) == sizeof(SSize_t))
19351 printf("$dflt\n");
19352 else if (sizeof(Size_t) == sizeof(int))
19353 printf("int\n");
19354 else
19355 printf("long\n");
19356 exit(0);
19357}
19358EOM
19359echo " "
5440bc8e
JH
19360set try
19361if eval $compile_ok && $run ./try > /dev/null; then
19362 ssizetype=`$run ./try`
b4eb6b3d
JH
19363 echo "I'll be using $ssizetype for functions returning a byte count." >&4
19364else
19365 $cat >&4 <<EOM
19366Help! I can't compile and run the ssize_t test program: please enlighten me!
19367(This is probably a misconfiguration in your system or libraries, and
19368you really ought to fix it. Still, I'll try anyway.)
19369
19370I need a type that is the same size as $sizetype, but is guaranteed to
19371be signed. Common values are ssize_t, int and long.
19372
19373EOM
19374 rp="What signed type is the same size as $sizetype?"
19375 . ./myread
19376 ssizetype="$ans"
19377fi
5440bc8e 19378$rm -f try try.*
b4eb6b3d
JH
19379
19380: see what type of char stdio uses.
19381echo " "
aa517f50
JH
19382echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
19383if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
19384 echo "Your stdio uses unsigned chars." >&4
19385 stdchar="unsigned char"
19386else
aa517f50
JH
19387 echo "Your stdio uses signed chars." >&4
19388 stdchar="char"
b4eb6b3d 19389fi
aa517f50
JH
19390$rm -f stdioh
19391
19392
b4eb6b3d 19393
b4eb6b3d
JH
19394: see what type uids are declared as in the kernel
19395echo " "
19396echo "Looking for the type for user ids returned by getuid()."
19397set uid_t uidtype xxx stdio.h sys/types.h
19398eval $typedef
19399case "$uidtype" in
19400xxx)
19401 xxx=`./findhdr sys/user.h`
19402 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19403 case $1 in
19404 unsigned) dflt="$1 $2" ;;
19405 *) dflt="$1" ;;
19406 esac
19407 ;;
19408*) dflt="$uidtype";;
19409esac
19410case "$uidtype" in
19411uid_t) echo "uid_t found." ;;
19412*) rp="What is the type for user ids returned by getuid()?"
19413 . ./myread
19414 uidtype="$ans"
19415 ;;
19416esac
19417
19418echo " "
19419case "$uidtype" in
19420*_t) zzz="$uidtype" ;;
19421*) zzz="uid" ;;
19422esac
19423echo "Checking the size of $zzz..." >&4
19424cat > try.c <<EOCP
19425#include <sys/types.h>
19426#include <stdio.h>
5ed858ef
JH
19427#$i_stdlib I_STDLIB
19428#ifdef I_STDLIB
19429#include <stdlib.h>
19430#endif
b4eb6b3d
JH
19431int main() {
19432 printf("%d\n", (int)sizeof($uidtype));
19433 exit(0);
19434}
19435EOCP
19436set try
19437if eval $compile_ok; then
5440bc8e 19438 yyy=`$run ./try`
b4eb6b3d
JH
19439 case "$yyy" in
19440 '') uidsize=4
19441 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19442 ;;
19443 *) uidsize=$yyy
19444 echo "Your $zzz is $uidsize bytes long."
19445 ;;
19446 esac
19447else
19448 uidsize=4
19449 echo "(I can't compile the test program--guessing $uidsize.)" >&4
19450fi
19451
19452echo " "
19453case "$uidtype" in
19454*_t) zzz="$uidtype" ;;
19455*) zzz="uid" ;;
19456esac
19457echo "Checking the sign of $zzz..." >&4
19458cat > try.c <<EOCP
19459#include <sys/types.h>
19460#include <stdio.h>
19461int main() {
19462 $uidtype foo = -1;
19463 if (foo < 0)
19464 printf("-1\n");
19465 else
19466 printf("1\n");
19467}
19468EOCP
19469set try
19470if eval $compile; then
5440bc8e 19471 yyy=`$run ./try`
b4eb6b3d
JH
19472 case "$yyy" in
19473 '') uidsign=1
19474 echo "(I can't execute the test program--guessing unsigned.)" >&4
19475 ;;
19476 *) uidsign=$yyy
19477 case "$uidsign" in
19478 1) echo "Your $zzz is unsigned." ;;
19479 -1) echo "Your $zzz is signed." ;;
19480 esac
19481 ;;
19482 esac
19483else
19484 uidsign=1
19485 echo "(I can't compile the test program--guessing unsigned.)" >&4
19486fi
19487
19488
19489
19490echo " "
19491$echo "Checking the format string to be used for uids..." >&4
19492
19493case "$uidsign" in
19494-1) if $test X"$uidsize" = X"$ivsize"; then
19495 uidformat="$ivdformat"
19496 else
19497 if $test X"$uidsize" = X"$longsize"; then
19498 uidformat='"ld"'
19499 else
19500 if $test X"$uidsize" = X"$intsize"; then
19501 uidformat='"d"'
19502 else
19503 if $test X"$uidsize" = X"$shortsize"; then
19504 uidformat='"hd"'
19505 fi
19506 fi
19507 fi
19508 fi
19509 ;;
19510*) if $test X"$uidsize" = X"$uvsize"; then
19511 uidformat="$uvuformat"
19512 else
19513 if $test X"$uidsize" = X"$longsize"; then
19514 uidformat='"lu"'
19515 else
19516 if $test X"$uidsize" = X"$intsize"; then
19517 uidformat='"u"'
19518 else
19519 if $test X"$uidsize" = X"$shortsize"; then
19520 uidformat='"hu"'
19521 fi
19522 fi
19523 fi
19524 fi
19525 ;;
19526esac
19527
a663fd0a
AT
19528
19529case "$usesitecustomize" in
19530 $define|true|[Yy]*)
19531 usesitecustomize="$define"
19532 ;;
19533 *)
19534 usesitecustomize="$undef"
19535 ;;
19536 esac
19537
3659ebf1
JH
19538: determine compiler compiler
19539case "$yacc" in
19540'')
19541 dflt=yacc;;
19542*)
19543 dflt="$yacc";;
19544esac
19545echo " "
19546comp='yacc'
3c728e00 19547if $test -f "$byacc$_exe"; then
3659ebf1
JH
19548 dflt="$byacc"
19549 comp="byacc or $comp"
19550fi
3c728e00 19551if $test -f "$bison$_exe"; then
3659ebf1
JH
19552 comp="$comp or bison -y"
19553fi
19554rp="Which compiler compiler ($comp) shall I use?"
19555. ./myread
19556yacc="$ans"
19557case "$yacc" in
19558*bis*)
19559 case "$yacc" in
19560 *-y*) ;;
19561 *)
19562 yacc="$yacc -y"
19563 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19564 ;;
19565 esac
19566 ;;
19567esac
19568
758a5d79
JH
19569: see if this is a fp.h system
19570set fp.h i_fp
19571eval $inhdr
19572
19573: see if this is a fp_class.h system
19574set fp_class.h i_fp_class
19575eval $inhdr
19576
b4eb6b3d 19577: see if this is a ieeefp.h system
b5b9f165
JH
19578case "$i_ieeefp" in
19579'' ) set ieeefp.h i_ieeefp
19580 eval $inhdr
19581 ;;
19582esac
b4eb6b3d
JH
19583
19584: see if this is a libutil.h system
19585set libutil.h i_libutil
19586eval $inhdr
19587
b4eb6b3d
JH
19588: see if mach cthreads are available
19589if test "X$usethreads" = "X$define"; then
19590 set mach/cthreads.h i_machcthr
19591 eval $inhdr
19592else
19593 i_machcthr="$undef"
19594fi
19595
19596
19597
b4eb6b3d
JH
19598: see if this is a mntent.h system
19599set mntent.h i_mntent
19600eval $inhdr
19601
19602: see if ndbm.h is available
19603set ndbm.h t_ndbm
19604eval $inhdr
1c6861ad
JS
19605
19606case "$t_ndbm" in
19607$undef)
19608 # Some Linux distributions such as RedHat 7.1 put the
19609 # ndbm.h header in /usr/include/gdbm/ndbm.h.
19610 if $test -f /usr/include/gdbm/ndbm.h; then
d11b91bf 19611 echo '<gdbm/ndbm.h> found.'
1c6861ad
JS
19612 ccflags="$ccflags -I/usr/include/gdbm"
19613 cppflags="$cppflags -I/usr/include/gdbm"
19614 t_ndbm=$define
19615 fi
19616 ;;
19617esac
19618
b4eb6b3d
JH
19619case "$t_ndbm" in
19620$define)
19621 : see if dbm_open exists
19622 set dbm_open d_dbm_open
19623 eval $inlibc
19624 case "$d_dbm_open" in
19625 $undef)
19626 t_ndbm="$undef"
19627 echo "We won't be including <ndbm.h>"
19628 ;;
19629 esac
19630 ;;
19631esac
19632val="$t_ndbm"
19633set i_ndbm
19634eval $setvar
19635
19636: see if net/errno.h is available
19637val=''
19638set net/errno.h val
19639eval $inhdr
19640
19641: Unfortunately, it causes problems on some systems. Arrgh.
19642case "$val" in
19643$define)
19644 cat > try.c <<'EOM'
19645#include <stdio.h>
19646#include <errno.h>
19647#include <net/errno.h>
19648int func()
19649{
19650 return ENOTSOCK;
19651}
19652EOM
19653 if $cc $ccflags -c try.c >/dev/null 2>&1; then
19654 echo "We'll be including <net/errno.h>." >&4
19655 else
19656 echo "We won't be including <net/errno.h>." >&4
19657 val="$undef"
19658 fi
19659 $rm -f try.* try
19660 ;;
19661esac
19662set i_neterrno
19663eval $setvar
19664
19665: see if netinet/tcp.h is available
19666set netinet/tcp.h i_netinettcp
19667eval $inhdr
19668
19669: see if this is a poll.h system
19670set poll.h i_poll
19671eval $inhdr
19672
19673: see if this is a prot.h system
19674set prot.h i_prot
19675eval $inhdr
19676
19677echo " "
19678$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
19679$cat <<'EOSH' > Cppsym.know
19680a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
19681AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
d46c9a2d
JH
19682alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
19683ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
19684BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
19685BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
19686bull c cadmus clipper CMU COFF COMPILER_VERSION
19687concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
19688CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
19689Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
19690FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
19691GLIBC GLIBC_MINOR
19692GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
19693H3050R H3050RX hbullx20 hcx host_mips
19694hp200 hp300 hp700 HP700 hp800 hp9000
19695hp9000s200 hp9000s300 hp9000s400 hp9000s500
19696hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
19697i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 19698IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
19699INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
19700LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
19701LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
19702Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
19703LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
19704M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
19705M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
19706M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
19707MATH_HAS_NO_SIDE_EFFECTS
19708mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
19709mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
19710mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
19711MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
19712mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
19713NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 19714news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
19715ns32016 ns32332 ns32k nsc32000
19716OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
19717pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
19718pc532 pdp11 PGC PIC plexus PORTAR posix
19719POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
19720POSIX_C_SOURCE POSIX_SOURCE POWER
19721PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 19722riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
19723SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
19724sony sony_news sonyrisc sparc sparclite spectrum
19725stardent stdc STDC_EXT stratos sun sun3 sun386
19726Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
19727SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
19728SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
19729sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 19730TM3200 TM5400 TM5600
b4eb6b3d
JH
19731tower tower32 tower32_200 tower32_600 tower32_700
19732tower32_800 tower32_850 tss
19733u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
19734ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
19735unix UNIX95 UNIX99 unixpc unos
19736USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
19737USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
19738USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
19739USGr4 USGr4_2
b4eb6b3d
JH
19740Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
19741XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
19742XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
19743z8000
19744EOSH
19745# Maybe put other stuff here too.
19746cat <<EOSH >>Cppsym.know
19747$osname
19748EOSH
19749./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
19750./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
19751$cat Cppsym.know > Cppsym.c
381aa1ff 19752$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
19753$rm -f Cppsym.a Cppsym.b Cppsym.c
19754cat <<EOSH > Cppsym
19755$startsh
19756if $test \$# -gt 0; then
19757 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
19758 if $test -s Cppsym.got; then
19759 $rm -f Cppsym.got
19760 exit 0
19761 fi
19762 $rm -f Cppsym.got
19763 exit 1
19764else
19765 $tr " " "$trnl" | ./Cppsym.try
19766 exit 0
19767fi
19768EOSH
19769chmod +x Cppsym
19770$eunicefix Cppsym
19771cat <<EOSH > Cppsym.try
19772$startsh
19773cat <<'EOCP' > try.c
19774#include <stdio.h>
19775int main() {
19776EOCP
19777$awk \\
19778EOSH
19779cat <<'EOSH' >> Cppsym.try
19780'length($1) > 0 {
2ef53570
JH
19781 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
19782 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
19783 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
19784 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 19785}' >> try.c
2ef53570 19786echo 'return 0;}' >> try.c
b4eb6b3d
JH
19787EOSH
19788cat <<EOSH >> Cppsym.try
19789ccflags="$ccflags"
19790case "$osname-$gccversion" in
19791irix-) ccflags="\$ccflags -woff 1178" ;;
19792os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
19793esac
5440bc8e 19794$cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
b4eb6b3d
JH
19795EOSH
19796chmod +x Cppsym.try
19797$eunicefix Cppsym.try
19798./Cppsym < Cppsym.know > Cppsym.true
19799: now check the C compiler for additional symbols
19800postprocess_cc_v=''
19801case "$osname" in
19802aix) postprocess_cc_v="|$tr , ' '" ;;
19803esac
19804$cat >ccsym <<EOS
19805$startsh
19806$cat >tmp.c <<EOF
19807extern int foo;
19808EOF
19809for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19810do
19811 case "\$i" in
19812 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 19813 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
19814 esac
19815done
19816$rm -f try.c
19817EOS
19818postprocess_cc_v=''
19819chmod +x ccsym
19820$eunicefix ccsym
19821./ccsym > ccsym1.raw
19822if $test -s ccsym1.raw; then
19823 $sort ccsym1.raw | $uniq >ccsym.raw
19824else
19825 mv ccsym1.raw ccsym.raw
19826fi
19827
19828$awk '/\=/ { print $0; next }
19829 { print $0"=1" }' ccsym.raw >ccsym.list
19830$awk '/\=/ { print $0; next }
19831 { print $0"=1" }' Cppsym.true >ccsym.true
19832$comm -13 ccsym.true ccsym.list >ccsym.own
19833$comm -12 ccsym.true ccsym.list >ccsym.com
19834$comm -23 ccsym.true ccsym.list >ccsym.cpp
19835also=''
19836if $test -z ccsym.raw; then
19837 echo "Your C compiler doesn't seem to define any symbols!" >&4
19838 echo " "
19839 echo "However, your C preprocessor defines the following symbols:"
19840 $cat Cppsym.true
19841 ccsymbols=''
19842 cppsymbols=`$cat Cppsym.true`
19843 cppsymbols=`echo $cppsymbols`
19844 cppccsymbols="$cppsymbols"
19845else
19846 if $test -s ccsym.com; then
19847 echo "Your C compiler and pre-processor define these symbols:"
19848 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19849 also='also '
19850 symbols='ones'
19851 cppccsymbols=`$cat ccsym.com`
19852 cppccsymbols=`echo $cppccsymbols`
19853 $test "$silent" || sleep 1
19854 fi
19855 if $test -s ccsym.cpp; then
19856 $test "$also" && echo " "
19857 echo "Your C pre-processor ${also}defines the following symbols:"
19858 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19859 also='further '
19860 cppsymbols=`$cat ccsym.cpp`
19861 cppsymbols=`echo $cppsymbols`
19862 $test "$silent" || sleep 1
19863 fi
19864 if $test -s ccsym.own; then
19865 $test "$also" && echo " "
19866 echo "Your C compiler ${also}defines the following cpp symbols:"
19867 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19868 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19869 ccsymbols=`$cat ccsym.own`
19870 ccsymbols=`echo $ccsymbols`
19871 $test "$silent" || sleep 1
19872 fi
19873fi
b4eb6b3d
JH
19874
19875: see if this is a termio system
19876val="$undef"
19877val2="$undef"
19878val3="$undef"
19879if $test `./findhdr termios.h`; then
19880 set tcsetattr i_termios
19881 eval $inlibc
19882 val3="$i_termios"
19883fi
19884echo " "
19885case "$val3" in
19886"$define") echo "You have POSIX termios.h... good!" >&4;;
19887*) if ./Cppsym pyr; then
19888 case "`/bin/universe`" in
19889 ucb) if $test `./findhdr sgtty.h`; then
19890 val2="$define"
19891 echo "<sgtty.h> found." >&4
19892 else
19893 echo "System is pyramid with BSD universe."
19894 echo "<sgtty.h> not found--you could have problems." >&4
19895 fi;;
19896 *) if $test `./findhdr termio.h`; then
19897 val="$define"
19898 echo "<termio.h> found." >&4
19899 else
19900 echo "System is pyramid with USG universe."
19901 echo "<termio.h> not found--you could have problems." >&4
19902 fi;;
19903 esac
19904 elif ./usg; then
19905 if $test `./findhdr termio.h`; then
19906 echo "<termio.h> found." >&4
19907 val="$define"
19908 elif $test `./findhdr sgtty.h`; then
19909 echo "<sgtty.h> found." >&4
19910 val2="$define"
19911 else
19912echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19913 fi
19914 else
19915 if $test `./findhdr sgtty.h`; then
19916 echo "<sgtty.h> found." >&4
19917 val2="$define"
19918 elif $test `./findhdr termio.h`; then
19919 echo "<termio.h> found." >&4
19920 val="$define"
19921 else
19922echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19923 fi
19924 fi;;
19925esac
19926set i_termio; eval $setvar
19927val=$val2; set i_sgtty; eval $setvar
19928val=$val3; set i_termios; eval $setvar
19929
b4eb6b3d
JH
19930: see if stddef is available
19931set stddef.h i_stddef
19932eval $inhdr
923fc586 19933
b4eb6b3d
JH
19934: see if this is a sunmath.h system
19935set sunmath.h i_sunmath
19936eval $inhdr
5f80c64f 19937
b4eb6b3d
JH
19938: see if sys/access.h is available
19939set sys/access.h i_sysaccess
19940eval $inhdr
19941
19942: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19943set sys/filio.h i_sysfilio
19944eval $inhdr
19945echo " "
19946if $test `./findhdr sys/ioctl.h`; then
19947 val="$define"
19948 echo '<sys/ioctl.h> found.' >&4
19949else
19950 val="$undef"
19951 if $test $i_sysfilio = "$define"; then
19952 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 19953 else
b4eb6b3d
JH
19954 $test $i_sgtty = "$define" && xxx="sgtty.h"
19955 $test $i_termio = "$define" && xxx="termio.h"
19956 $test $i_termios = "$define" && xxx="termios.h"
19957echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19958 fi
19959fi
19960set i_sysioctl
19961eval $setvar
19962
49a78c82
JH
19963: see if socket ioctl defs are in sys/sockio.h
19964echo " "
19965xxx=`./findhdr sys/sockio.h`
19966if $test "$xxx"; then
19967 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19968 val="$define"
19969 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19970 else
19971 val="$undef"
19972 echo "No socket ioctls found in <sys/sockio.h>." >&4
19973 fi
19974else
19975 val="$undef"
19976 $cat <<EOM
19977<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19978EOM
19979fi
19980set i_syssockio
19981eval $setvar
19982
b4eb6b3d
JH
19983
19984: see if this is a syslog.h system
19985set syslog.h i_syslog
19986eval $inhdr
19987
19988
19989: see if this is a sys/mode.h system
19990set sys/mode.h i_sysmode
19991eval $inhdr
19992
19993: see if sys/resource.h has to be included
19994set sys/resource.h i_sysresrc
19995eval $inhdr
19996
19997: see if sys/security.h is available
19998set sys/security.h i_syssecrt
19999eval $inhdr
20000
20001: see if this is a sys/statvfs.h system
20002set sys/statvfs.h i_sysstatvfs
20003eval $inhdr
20004
b4eb6b3d
JH
20005: see if this is a sys/un.h system
20006set sys/un.h i_sysun
20007eval $inhdr
20008
20009
20010: see if this is a sys/utsname.h system
20011set sys/utsname.h i_sysutsname
20012eval $inhdr
20013
20014: see if this is a syswait system
20015set sys/wait.h i_syswait
20016eval $inhdr
20017
20018: see if this is a ustat.h system
20019set ustat.h i_ustat
20020eval $inhdr
20021
20022: see if this is an utime system
20023set utime.h i_utime
20024eval $inhdr
20025
20026: see if this is a values.h system
20027set values.h i_values
20028eval $inhdr
20029
20030: see if this is a vfork system
20031case "$d_vfork" in
20032"$define")
20033 set vfork.h i_vfork
20034 eval $inhdr
20035 ;;
20036*)
20037 i_vfork="$undef"
20038 ;;
20039esac
20040
20041: see if gdbm.h is available
20042set gdbm.h t_gdbm
20043eval $inhdr
20044case "$t_gdbm" in
20045$define)
20046 : see if gdbm_open exists
20047 set gdbm_open d_gdbm_open
20048 eval $inlibc
20049 case "$d_gdbm_open" in
20050 $undef)
20051 t_gdbm="$undef"
20052 echo "We won't be including <gdbm.h>"
5f80c64f 20053 ;;
b4eb6b3d
JH
20054 esac
20055 ;;
20056esac
20057val="$t_gdbm"
20058set i_gdbm
20059eval $setvar
20060
20061echo " "
20062echo "Looking for extensions..." >&4
20063: If we are using the old config.sh, known_extensions may contain
20064: old or inaccurate or duplicate values.
20065known_extensions=''
20066nonxs_extensions=''
20067: We do not use find because it might not be available.
20068: We do not just use MANIFEST because the user may have dropped
20069: some additional extensions into the source tree and expect them
20070: to be built.
20071
20072: Function to recursively find available extensions, ignoring DynaLoader
20073: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20074find_extensions='
20075 for xxx in *; do
20076 case "$xxx" in
20077 DynaLoader|dynaload) ;;
20078 *)
20079 if $test -f $xxx/$xxx.xs; then
20080 known_extensions="$known_extensions $1$xxx";
20081 elif $test -f $xxx/Makefile.PL; then
20082 nonxs_extensions="$nonxs_extensions $1$xxx";
20083 else
20084 if $test -d $xxx -a $# -lt 10; then
20085 set $1$xxx/ $*;
6904989c 20086 cd "$xxx";
b4eb6b3d
JH
20087 eval $find_extensions;
20088 cd ..;
20089 shift;
20090 fi;
20091 fi
20092 ;;
20093 esac;
20094 done'
20095tdir=`pwd`
6904989c 20096cd "$rsrc/ext"
b4eb6b3d
JH
20097set X
20098shift
20099eval $find_extensions
4e1a6d26
AD
20100# Special case: Add in threads/shared since it is not picked up by the
20101# recursive find above (and adding in general recursive finding breaks
20102# SDBM_File/sdbm). A.D. 10/25/2001.
998b396c 20103known_extensions="$known_extensions threads/shared"
b4eb6b3d
JH
20104set X $nonxs_extensions
20105shift
20106nonxs_extensions="$*"
20107set X $known_extensions
20108shift
20109known_extensions="$*"
6904989c 20110cd "$tdir"
b4eb6b3d
JH
20111
20112: Now see which are supported on this system.
20113avail_ext=''
20114for xxx in $known_extensions ; do
20115 case "$xxx" in
20116 DB_File|db_file)
20117 case "$i_db" in
20118 $define) avail_ext="$avail_ext $xxx" ;;
20119 esac
20120 ;;
20121 GDBM_File|gdbm_fil)
20122 case "$i_gdbm" in
20123 $define) avail_ext="$avail_ext $xxx" ;;
20124 esac
20125 ;;
1d59c593 20126 I18N/Langinfo|i18n_lan)
4bbcc6e8
JH
20127 case "$i_langinfo$d_nl_langinfo" in
20128 $define$define) avail_ext="$avail_ext $xxx" ;;
20129 esac
20130 ;;
b4eb6b3d
JH
20131 NDBM_File|ndbm_fil)
20132 case "$i_ndbm" in
20133 $define)
20134 case "$osname-$use64bitint" in
0be9fa5d 20135 hpux-define)
b4eb6b3d
JH
20136 case "$libs" in
20137 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20138 esac
20139 ;;
20140 *) avail_ext="$avail_ext $xxx" ;;
20141 esac
20142 ;;
20143 esac
20144 ;;
20145 ODBM_File|odbm_fil)
20146 case "${i_dbm}${i_rpcsvcdbm}" in
20147 *"${define}"*)
20148 case "$osname-$use64bitint" in
0be9fa5d 20149 hpux-define)
b4eb6b3d
JH
20150 case "$libs" in
20151 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20152 esac
20153 ;;
20154 *) avail_ext="$avail_ext $xxx" ;;
20155 esac
20156 ;;
20157 esac
20158 ;;
20159 POSIX|posix)
20160 case "$useposix" in
20161 true|define|y) avail_ext="$avail_ext $xxx" ;;
20162 esac
20163 ;;
20164 Opcode|opcode)
20165 case "$useopcode" in
20166 true|define|y) avail_ext="$avail_ext $xxx" ;;
20167 esac
20168 ;;
20169 Socket|socket)
20170 case "$d_socket" in
4a9f028c
JH
20171 true|$define|y)
20172 case "$osname" in
20173 beos) ;; # not unless BONE
20174 *) avail_ext="$avail_ext $xxx" ;;
20175 esac
20176 ;;
b4eb6b3d
JH
20177 esac
20178 ;;
20179 Sys/Syslog|sys/syslog)
20180 : XXX syslog requires socket
20181 case "$d_socket" in
20182 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20183 esac
20184 ;;
20185 Thread|thread)
b00ec89b
AB
20186 case "$usethreads" in
20187 true|$define|y)
20188 case "$useithreads" in
20189 $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20190 esac
b4eb6b3d
JH
20191 esac
20192 ;;
f9b6ed1c
AD
20193 XS/APItest|xs/apitest)
20194 # This is just for testing. Skip it unless we have dynamic loading.
20195
20196 case "$usedl" in
20197 $define) avail_ext="$avail_ext $xxx" ;;
20198 esac
20199 ;;
20200 XS/Typemap|xs/typemap)
20201 # This is just for testing. Skip it unless we have dynamic loading.
20202 case "$usedl" in
20203 $define) avail_ext="$avail_ext $xxx" ;;
20204 esac
20205 ;;
7deadc5f 20206 threads|threads/shared)
73e09c8f
JH
20207 # threads and threads::shared are special cases.
20208 # To stop people from asking "Perl 5.8.0 was supposed
20209 # to have this new fancy threads implementation but my
20210 # perl doesn't have it" and from people trying to
20211 # (re)install the threads module using CPAN.pm and
20212 # CPAN.pm then offering to reinstall Perl 5.8.0,
20213 # the threads.pm and threads/shared.pm will always be
20214 # there, croaking informatively ("you need to rebuild
20215 # all of Perl with threads, sorry") when threads haven't
20216 # been compiled in.
20217 # --jhi
20218 avail_ext="$avail_ext $xxx"
1dca008a 20219 ;;
b4eb6b3d
JH
20220 IPC/SysV|ipc/sysv)
20221 : XXX Do we need a useipcsysv variable here
20222 case "${d_msg}${d_sem}${d_shm}" in
20223 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20224 esac
20225 ;;
20226 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
20227 ;;
20228 esac
b4eb6b3d 20229done
5f80c64f 20230
b4eb6b3d
JH
20231set X $avail_ext
20232shift
20233avail_ext="$*"
5f80c64f 20234
4bedfb0f
JH
20235case "$onlyextensions" in
20236'') ;;
20237*) keepextensions=''
20238 echo "You have requested that only certains extensions be included..." >&4
20239 for i in $onlyextensions; do
20240 case " $avail_ext " in
20241 *" $i "*)
20242 echo "Keeping extension $i."
20243 keepextensions="$keepextensions $i"
20244 ;;
20245 *) echo "Ignoring extension $i." ;;
20246 esac
20247 done
20248 avail_ext="$keepextensions"
20249 ;;
20250esac
20251
20252case "$noextensions" in
20253'') ;;
20254*) keepextensions=''
20255 echo "You have requested that certain extensions be ignored..." >&4
20256 for i in $avail_ext; do
67bae6b3
JH
20257 case " $noextensions " in
20258 *" $i "*) echo "Ignoring extension $i." ;;
4bedfb0f
JH
20259 *) echo "Keeping extension $i.";
20260 keepextensions="$keepextensions $i"
20261 ;;
20262 esac
20263 done
20264 avail_ext="$keepextensions"
20265 ;;
20266esac
20267
b4eb6b3d
JH
20268: Now see which nonxs extensions are supported on this system.
20269: For now assume all are.
20270nonxs_ext=''
20271for xxx in $nonxs_extensions ; do
20272 case "$xxx" in
20273 *) nonxs_ext="$nonxs_ext $xxx"
20274 ;;
20275 esac
20276done
5f80c64f 20277
b4eb6b3d
JH
20278set X $nonxs_ext
20279shift
20280nonxs_ext="$*"
20281
20282case $usedl in
20283$define)
20284 $cat <<EOM
20285A number of extensions are supplied with $package. You may choose to
20286compile these extensions for dynamic loading (the default), compile
20287them into the $package executable (static loading), or not include
20288them at all. Answer "none" to include no extensions.
20289Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
20290
20291EOM
b4eb6b3d 20292 case "$dynamic_ext" in
5b7ea690
JH
20293 '')
20294 : Exclude those listed in static_ext
20295 dflt=''
20296 for xxx in $avail_ext; do
20297 case " $static_ext " in
20298 *" $xxx "*) ;;
20299 *) dflt="$dflt $xxx" ;;
20300 esac
20301 done
20302 set X $dflt
20303 shift
20304 dflt="$*"
20305 ;;
b4eb6b3d
JH
20306 *) dflt="$dynamic_ext"
20307 # Perhaps we are reusing an old out-of-date config.sh.
20308 case "$hint" in
20309 previous)
20310 if test X"$dynamic_ext" != X"$avail_ext"; then
20311 $cat <<EOM
20312NOTICE: Your previous config.sh list may be incorrect.
20313The extensions now available to you are
20314 ${avail_ext}
20315but the default list from your previous config.sh is
20316 ${dynamic_ext}
9c839522 20317
b4eb6b3d
JH
20318EOM
20319 fi
9c839522
PM
20320 ;;
20321 esac
b4eb6b3d
JH
20322 ;;
20323 esac
5f80c64f 20324 case "$dflt" in
b4eb6b3d
JH
20325 '') dflt=none;;
20326 esac
20327 rp="What extensions do you wish to load dynamically?"
20328 . ./myread
20329 case "$ans" in
20330 none) dynamic_ext=' ' ;;
20331 *) dynamic_ext="$ans" ;;
5f80c64f 20332 esac
5f80c64f 20333
b4eb6b3d
JH
20334 case "$static_ext" in
20335 '')
20336 : Exclude those already listed in dynamic linking
20337 dflt=''
20338 for xxx in $avail_ext; do
20339 case " $dynamic_ext " in
20340 *" $xxx "*) ;;
20341 *) dflt="$dflt $xxx" ;;
20342 esac
20343 done
20344 set X $dflt
20345 shift
20346 dflt="$*"
20347 ;;
20348 *) dflt="$static_ext"
20349 ;;
20350 esac
9c839522 20351
b4eb6b3d
JH
20352 case "$dflt" in
20353 '') dflt=none;;
20354 esac
20355 rp="What extensions do you wish to load statically?"
20356 . ./myread
20357 case "$ans" in
20358 none) static_ext=' ' ;;
20359 *) static_ext="$ans" ;;
20360 esac
20361 ;;
20362*)
20363 $cat <<EOM
20364A number of extensions are supplied with $package. Answer "none"
20365to include no extensions.
20366Note that DynaLoader is always built and need not be mentioned here.
9c839522 20367
b4eb6b3d
JH
20368EOM
20369 case "$static_ext" in
20370 '') dflt="$avail_ext" ;;
20371 *) dflt="$static_ext"
20372 # Perhaps we are reusing an old out-of-date config.sh.
20373 case "$hint" in
20374 previous)
20375 if test X"$static_ext" != X"$avail_ext"; then
20376 $cat <<EOM
20377NOTICE: Your previous config.sh list may be incorrect.
20378The extensions now available to you are
20379 ${avail_ext}
20380but the default list from your previous config.sh is
20381 ${static_ext}
5f80c64f
JH
20382
20383EOM
b4eb6b3d
JH
20384 fi
20385 ;;
20386 esac
20387 ;;
20388 esac
20389 : Exclude those that are not xs extensions
20390 case "$dflt" in
20391 '') dflt=none;;
20392 esac
20393 rp="What extensions do you wish to include?"
20394 . ./myread
20395 case "$ans" in
20396 none) static_ext=' ' ;;
20397 *) static_ext="$ans" ;;
20398 esac
20399 ;;
5f80c64f 20400esac
f1f6834f
AD
20401#
20402# Encode is a special case. If we are building Encode as a static
20403# extension, we need to explicitly list its subextensions as well.
20404# For other nested extensions, this is handled automatically by
20405# the appropriate Makefile.PL.
20406case " $static_ext " in
20407 *" Encode "*) # Add the subextensions of Encode
20408 cd "$rsrc/ext"
20409 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20410 static_ext="$static_ext Encode/$xxx"
20411 done
20412 cd "$tdir"
20413 ;;
20414esac
5f80c64f 20415
b4eb6b3d
JH
20416set X $dynamic_ext $static_ext $nonxs_ext
20417shift
20418extensions="$*"
20419
3a067427
AD
20420# Sanity check: We require an extension suitable for use with
20421# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
20422# should show up as failures in the test suite, but it's helpful to
20423# catch them now.) The 'extensions' list is normally sorted
20424# alphabetically, so we need to accept either
20425# DB_File ... Fcntl ... IO ....
20426# or something like
20427# Fcntl ... NDBM_File ... IO ....
3b46a705
JH
20428case " $extensions" in
20429*"_File "*" Fcntl "*" IO "*) ;; # DB_File
20430*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
20431*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
5a29c6bc
JH
20432*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
20433 echo "WARNING: The Perl you are building will be quite crippled." >& 4
20434 ;;
20435esac
20436
9c839522
PM
20437: Remove libraries needed only for extensions
20438: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
20439: The exception is SunOS 4.x, which needs them.
20440case "${osname}X${osvers}" in
20441sunos*X4*)
20442 perllibs="$libs"
20443 ;;
20444*) case "$usedl" in
20445 $define|true|[yY]*)
20446 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
20447 shift
20448 perllibs="$*"
20449 ;;
20450 *) perllibs="$libs"
20451 ;;
20452 esac
20453 ;;
9c839522 20454esac
5f80c64f
JH
20455
20456: Remove build directory name from cppstdin so it can be used from
20457: either the present location or the final installed location.
20458echo " "
20459: Get out of the UU directory to get correct path name.
20460cd ..
20461case "$cppstdin" in
20462`pwd`/cppstdin)
20463 echo "Stripping down cppstdin path name"
20464 cppstdin=cppstdin
20465 ;;
20466esac
20467cd UU
20468
20469: end of configuration questions
20470echo " "
20471echo "End of configuration questions."
20472echo " "
20473
20474: back to where it started
20475if test -d ../UU; then
20476 cd ..
20477fi
20478
48370efc
JH
20479: configuration may be patched via a 'config.arch' file
20480if $test -f config.arch; then
20481 echo "I see a config.arch file, loading it."
20482 . ./config.arch
20483fi
20484
5f80c64f
JH
20485: configuration may be patched via a 'config.over' file
20486if $test -f config.over; then
20487 echo " "
20488 dflt=y
20489 rp='I see a config.over file. Do you wish to load it?'
20490 . UU/myread
20491 case "$ans" in
20492 n*) echo "OK, I'll ignore it.";;
20493 *) . ./config.over
20494 echo "Configuration override changes have been loaded."
20495 ;;
20496 esac
20497fi
20498
20499: in case they want portability, strip down executable paths
20500case "$d_portable" in
20501"$define")
20502 echo " "
20503 echo "Stripping down executable paths..." >&4
20504 for file in $loclist $trylist; do
534ac15a
JH
20505 eval temp=\$$file
20506 eval $file=`basename $temp`
5f80c64f
JH
20507 done
20508 ;;
20509esac
20510
20511: create config.sh file
20512echo " "
20513echo "Creating config.sh..." >&4
20514$spitshell <<EOT >config.sh
20515$startsh
20516#
20517# This file was produced by running the Configure script. It holds all the
20518# definitions figured out by Configure. Should you modify one of these values,
20519# do not forget to propagate your changes by running "Configure -der". You may
20520# instead choose to run each of the .SH files by yourself, or "Configure -S".
20521#
20522
20523# Package name : $package
20524# Source directory : $src
20525# Configuration time: $cf_time
20526# Configured by : $cf_by
20527# Target system : $myuname
20528
20529Author='$Author'
20530Date='$Date'
20531Header='$Header'
20532Id='$Id'
20533Locker='$Locker'
20534Log='$Log'
20535Mcc='$Mcc'
20536RCSfile='$RCSfile'
20537Revision='$Revision'
20538Source='$Source'
20539State='$State'
20540_a='$_a'
20541_exe='$_exe'
20542_o='$_o'
b4eb6b3d 20543afs='$afs'
a6d26a0d 20544afsroot='$afsroot'
b4eb6b3d
JH
20545alignbytes='$alignbytes'
20546ansi2knr='$ansi2knr'
20547aphostname='$aphostname'
20548api_revision='$api_revision'
20549api_subversion='$api_subversion'
20550api_version='$api_version'
20551api_versionstring='$api_versionstring'
5f80c64f 20552ar='$ar'
b4eb6b3d
JH
20553archlib='$archlib'
20554archlibexp='$archlibexp'
20555archname64='$archname64'
20556archname='$archname'
5f80c64f 20557archobjs='$archobjs'
10bc17b6 20558asctime_r_proto='$asctime_r_proto'
5f80c64f 20559awk='$awk'
b4eb6b3d 20560baserev='$baserev'
5f80c64f 20561bash='$bash'
b4eb6b3d 20562bin='$bin'
b4eb6b3d 20563binexp='$binexp'
5f80c64f
JH
20564bison='$bison'
20565byacc='$byacc'
b4eb6b3d 20566byteorder='$byteorder'
5f80c64f 20567c='$c'
b4eb6b3d 20568castflags='$castflags'
5f80c64f
JH
20569cat='$cat'
20570cc='$cc'
20571cccdlflags='$cccdlflags'
20572ccdlflags='$ccdlflags'
20573ccflags='$ccflags'
b4eb6b3d 20574ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 20575ccname='$ccname'
b4eb6b3d 20576ccsymbols='$ccsymbols'
6b356c8e 20577ccversion='$ccversion'
5f80c64f 20578cf_by='$cf_by'
b4eb6b3d 20579cf_email='$cf_email'
5f80c64f 20580cf_time='$cf_time'
b4eb6b3d 20581charsize='$charsize'
5f80c64f
JH
20582chgrp='$chgrp'
20583chmod='$chmod'
20584chown='$chown'
b4eb6b3d 20585clocktype='$clocktype'
5f80c64f
JH
20586comm='$comm'
20587compress='$compress'
20588contains='$contains'
20589cp='$cp'
20590cpio='$cpio'
20591cpp='$cpp'
b4eb6b3d
JH
20592cpp_stuff='$cpp_stuff'
20593cppccsymbols='$cppccsymbols'
5f80c64f
JH
20594cppflags='$cppflags'
20595cpplast='$cpplast'
20596cppminus='$cppminus'
20597cpprun='$cpprun'
20598cppstdin='$cppstdin'
b4eb6b3d 20599cppsymbols='$cppsymbols'
10bc17b6 20600crypt_r_proto='$crypt_r_proto'
b4eb6b3d 20601cryptlib='$cryptlib'
5f80c64f 20602csh='$csh'
10bc17b6
JH
20603ctermid_r_proto='$ctermid_r_proto'
20604ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
20605d_Gconvert='$d_Gconvert'
20606d_PRIEUldbl='$d_PRIEUldbl'
20607d_PRIFUldbl='$d_PRIFUldbl'
20608d_PRIGUldbl='$d_PRIGUldbl'
20609d_PRIXU64='$d_PRIXU64'
20610d_PRId64='$d_PRId64'
20611d_PRIeldbl='$d_PRIeldbl'
20612d_PRIfldbl='$d_PRIfldbl'
20613d_PRIgldbl='$d_PRIgldbl'
20614d_PRIi64='$d_PRIi64'
20615d_PRIo64='$d_PRIo64'
20616d_PRIu64='$d_PRIu64'
20617d_PRIx64='$d_PRIx64'
20618d_SCNfldbl='$d_SCNfldbl'
74cac757 20619d__fwalk='$d__fwalk'
b4eb6b3d
JH
20620d_access='$d_access'
20621d_accessx='$d_accessx'
5a29c6bc 20622d_aintl='$d_aintl'
b4eb6b3d
JH
20623d_alarm='$d_alarm'
20624d_archlib='$d_archlib'
10bc17b6 20625d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
20626d_atolf='$d_atolf'
20627d_atoll='$d_atoll'
20628d_attribut='$d_attribut'
20629d_bcmp='$d_bcmp'
20630d_bcopy='$d_bcopy'
5f80c64f 20631d_bsd='$d_bsd'
b4eb6b3d
JH
20632d_bsdgetpgrp='$d_bsdgetpgrp'
20633d_bsdsetpgrp='$d_bsdsetpgrp'
20634d_bzero='$d_bzero'
20635d_casti32='$d_casti32'
20636d_castneg='$d_castneg'
20637d_charvspr='$d_charvspr'
20638d_chown='$d_chown'
20639d_chroot='$d_chroot'
20640d_chsize='$d_chsize'
758a5d79 20641d_class='$d_class'
b4eb6b3d 20642d_closedir='$d_closedir'
4e0554ec 20643d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 20644d_const='$d_const'
5a29c6bc 20645d_copysignl='$d_copysignl'
b4eb6b3d 20646d_crypt='$d_crypt'
10bc17b6 20647d_crypt_r='$d_crypt_r'
b4eb6b3d 20648d_csh='$d_csh'
10bc17b6
JH
20649d_ctermid_r='$d_ctermid_r'
20650d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
20651d_cuserid='$d_cuserid'
20652d_dbl_dig='$d_dbl_dig'
2ef53570 20653d_dbminitproto='$d_dbminitproto'
b4eb6b3d 20654d_difftime='$d_difftime'
ae0e3d3b 20655d_dirfd='$d_dirfd'
b4eb6b3d
JH
20656d_dirnamlen='$d_dirnamlen'
20657d_dlerror='$d_dlerror'
5f80c64f 20658d_dlopen='$d_dlopen'
b4eb6b3d
JH
20659d_dlsymun='$d_dlsymun'
20660d_dosuid='$d_dosuid'
10bc17b6 20661d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
20662d_drand48proto='$d_drand48proto'
20663d_dup2='$d_dup2'
20664d_eaccess='$d_eaccess'
20665d_endgrent='$d_endgrent'
10bc17b6 20666d_endgrent_r='$d_endgrent_r'
b4eb6b3d 20667d_endhent='$d_endhent'
10bc17b6 20668d_endhostent_r='$d_endhostent_r'
b4eb6b3d 20669d_endnent='$d_endnent'
10bc17b6 20670d_endnetent_r='$d_endnetent_r'
b4eb6b3d 20671d_endpent='$d_endpent'
10bc17b6 20672d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 20673d_endpwent='$d_endpwent'
10bc17b6 20674d_endpwent_r='$d_endpwent_r'
b4eb6b3d 20675d_endsent='$d_endsent'
10bc17b6 20676d_endservent_r='$d_endservent_r'
b4eb6b3d 20677d_eofnblk='$d_eofnblk'
5f80c64f 20678d_eunice='$d_eunice'
ff0950a8 20679d_faststdio='$d_faststdio'
b363b713 20680d_fchdir='$d_fchdir'
b4eb6b3d
JH
20681d_fchmod='$d_fchmod'
20682d_fchown='$d_fchown'
20683d_fcntl='$d_fcntl'
9d9004a9 20684d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
20685d_fd_macros='$d_fd_macros'
20686d_fd_set='$d_fd_set'
20687d_fds_bits='$d_fds_bits'
20688d_fgetpos='$d_fgetpos'
758a5d79
JH
20689d_finite='$d_finite'
20690d_finitel='$d_finitel'
b4eb6b3d
JH
20691d_flexfnam='$d_flexfnam'
20692d_flock='$d_flock'
2ef53570 20693d_flockproto='$d_flockproto'
b4eb6b3d 20694d_fork='$d_fork'
758a5d79 20695d_fp_class='$d_fp_class'
b4eb6b3d 20696d_fpathconf='$d_fpathconf'
758a5d79
JH
20697d_fpclass='$d_fpclass'
20698d_fpclassify='$d_fpclassify'
20699d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
20700d_fpos64_t='$d_fpos64_t'
20701d_frexpl='$d_frexpl'
20702d_fs_data_s='$d_fs_data_s'
20703d_fseeko='$d_fseeko'
20704d_fsetpos='$d_fsetpos'
20705d_fstatfs='$d_fstatfs'
20706d_fstatvfs='$d_fstatvfs'
411ab01c 20707d_fsync='$d_fsync'
b4eb6b3d
JH
20708d_ftello='$d_ftello'
20709d_ftime='$d_ftime'
20710d_getcwd='$d_getcwd'
20711d_getespwnam='$d_getespwnam'
20712d_getfsstat='$d_getfsstat'
20713d_getgrent='$d_getgrent'
10bc17b6
JH
20714d_getgrent_r='$d_getgrent_r'
20715d_getgrgid_r='$d_getgrgid_r'
20716d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
20717d_getgrps='$d_getgrps'
20718d_gethbyaddr='$d_gethbyaddr'
20719d_gethbyname='$d_gethbyname'
20720d_gethent='$d_gethent'
20721d_gethname='$d_gethname'
10bc17b6
JH
20722d_gethostbyaddr_r='$d_gethostbyaddr_r'
20723d_gethostbyname_r='$d_gethostbyname_r'
20724d_gethostent_r='$d_gethostent_r'
b4eb6b3d 20725d_gethostprotos='$d_gethostprotos'
4e0554ec 20726d_getitimer='$d_getitimer'
b4eb6b3d 20727d_getlogin='$d_getlogin'
10bc17b6 20728d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
20729d_getmnt='$d_getmnt'
20730d_getmntent='$d_getmntent'
20731d_getnbyaddr='$d_getnbyaddr'
20732d_getnbyname='$d_getnbyname'
20733d_getnent='$d_getnent'
10bc17b6
JH
20734d_getnetbyaddr_r='$d_getnetbyaddr_r'
20735d_getnetbyname_r='$d_getnetbyname_r'
20736d_getnetent_r='$d_getnetent_r'
b4eb6b3d 20737d_getnetprotos='$d_getnetprotos'
0c0643d0 20738d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
20739d_getpbyname='$d_getpbyname'
20740d_getpbynumber='$d_getpbynumber'
20741d_getpent='$d_getpent'
20742d_getpgid='$d_getpgid'
20743d_getpgrp2='$d_getpgrp2'
20744d_getpgrp='$d_getpgrp'
20745d_getppid='$d_getppid'
20746d_getprior='$d_getprior'
10bc17b6
JH
20747d_getprotobyname_r='$d_getprotobyname_r'
20748d_getprotobynumber_r='$d_getprotobynumber_r'
20749d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
20750d_getprotoprotos='$d_getprotoprotos'
20751d_getprpwnam='$d_getprpwnam'
20752d_getpwent='$d_getpwent'
10bc17b6
JH
20753d_getpwent_r='$d_getpwent_r'
20754d_getpwnam_r='$d_getpwnam_r'
20755d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
20756d_getsbyname='$d_getsbyname'
20757d_getsbyport='$d_getsbyport'
20758d_getsent='$d_getsent'
10bc17b6
JH
20759d_getservbyname_r='$d_getservbyname_r'
20760d_getservbyport_r='$d_getservbyport_r'
20761d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
20762d_getservprotos='$d_getservprotos'
20763d_getspnam='$d_getspnam'
10bc17b6 20764d_getspnam_r='$d_getspnam_r'
b4eb6b3d 20765d_gettimeod='$d_gettimeod'
10bc17b6 20766d_gmtime_r='$d_gmtime_r'
5f80c64f 20767d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
20768d_grpasswd='$d_grpasswd'
20769d_hasmntopt='$d_hasmntopt'
20770d_htonl='$d_htonl'
5a29c6bc 20771d_ilogbl='$d_ilogbl'
b4eb6b3d
JH
20772d_index='$d_index'
20773d_inetaton='$d_inetaton'
20774d_int64_t='$d_int64_t'
20775d_isascii='$d_isascii'
758a5d79
JH
20776d_isfinite='$d_isfinite'
20777d_isinf='$d_isinf'
b4eb6b3d
JH
20778d_isnan='$d_isnan'
20779d_isnanl='$d_isnanl'
20780d_killpg='$d_killpg'
20781d_lchown='$d_lchown'
20782d_ldbl_dig='$d_ldbl_dig'
a663fd0a 20783d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 20784d_link='$d_link'
10bc17b6 20785d_localtime_r='$d_localtime_r'
b4eb6b3d
JH
20786d_locconv='$d_locconv'
20787d_lockf='$d_lockf'
20788d_longdbl='$d_longdbl'
20789d_longlong='$d_longlong'
20790d_lseekproto='$d_lseekproto'
20791d_lstat='$d_lstat'
20792d_madvise='$d_madvise'
20793d_mblen='$d_mblen'
20794d_mbstowcs='$d_mbstowcs'
20795d_mbtowc='$d_mbtowc'
20796d_memchr='$d_memchr'
20797d_memcmp='$d_memcmp'
20798d_memcpy='$d_memcpy'
20799d_memmove='$d_memmove'
20800d_memset='$d_memset'
20801d_mkdir='$d_mkdir'
20802d_mkdtemp='$d_mkdtemp'
20803d_mkfifo='$d_mkfifo'
20804d_mkstemp='$d_mkstemp'
20805d_mkstemps='$d_mkstemps'
20806d_mktime='$d_mktime'
20807d_mmap='$d_mmap'
20808d_modfl='$d_modfl'
e67aeab1 20809d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 20810d_modflproto='$d_modflproto'
b4eb6b3d
JH
20811d_mprotect='$d_mprotect'
20812d_msg='$d_msg'
20813d_msg_ctrunc='$d_msg_ctrunc'
20814d_msg_dontroute='$d_msg_dontroute'
20815d_msg_oob='$d_msg_oob'
20816d_msg_peek='$d_msg_peek'
20817d_msg_proxy='$d_msg_proxy'
20818d_msgctl='$d_msgctl'
20819d_msgget='$d_msgget'
4e0554ec 20820d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
20821d_msgrcv='$d_msgrcv'
20822d_msgsnd='$d_msgsnd'
20823d_msync='$d_msync'
20824d_munmap='$d_munmap'
20825d_mymalloc='$d_mymalloc'
20826d_nice='$d_nice'
2765b840 20827d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 20828d_nv_preserves_uv='$d_nv_preserves_uv'
b4eb6b3d
JH
20829d_off64_t='$d_off64_t'
20830d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
20831d_oldpthreads='$d_oldpthreads'
20832d_oldsock='$d_oldsock'
20833d_open3='$d_open3'
20834d_pathconf='$d_pathconf'
20835d_pause='$d_pause'
20836d_perl_otherlibdirs='$d_perl_otherlibdirs'
20837d_phostname='$d_phostname'
20838d_pipe='$d_pipe'
20839d_poll='$d_poll'
5f80c64f 20840d_portable='$d_portable'
c7aff470 20841d_procselfexe='$d_procselfexe'
d6483fcc 20842d_pthread_atfork='$d_pthread_atfork'
16c773f9 20843d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
20844d_pthread_yield='$d_pthread_yield'
20845d_pwage='$d_pwage'
20846d_pwchange='$d_pwchange'
20847d_pwclass='$d_pwclass'
20848d_pwcomment='$d_pwcomment'
20849d_pwexpire='$d_pwexpire'
20850d_pwgecos='$d_pwgecos'
20851d_pwpasswd='$d_pwpasswd'
20852d_pwquota='$d_pwquota'
20853d_qgcvt='$d_qgcvt'
20854d_quad='$d_quad'
10bc17b6
JH
20855d_random_r='$d_random_r'
20856d_readdir64_r='$d_readdir64_r'
b4eb6b3d 20857d_readdir='$d_readdir'
10bc17b6 20858d_readdir_r='$d_readdir_r'
b4eb6b3d 20859d_readlink='$d_readlink'
4e0554ec
JH
20860d_readv='$d_readv'
20861d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
20862d_rename='$d_rename'
20863d_rewinddir='$d_rewinddir'
20864d_rmdir='$d_rmdir'
20865d_safebcpy='$d_safebcpy'
20866d_safemcpy='$d_safemcpy'
20867d_sanemcmp='$d_sanemcmp'
ef9f17be 20868d_sbrkproto='$d_sbrkproto'
5a29c6bc 20869d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
20870d_sched_yield='$d_sched_yield'
20871d_scm_rights='$d_scm_rights'
20872d_seekdir='$d_seekdir'
20873d_select='$d_select'
20874d_sem='$d_sem'
20875d_semctl='$d_semctl'
20876d_semctl_semid_ds='$d_semctl_semid_ds'
20877d_semctl_semun='$d_semctl_semun'
20878d_semget='$d_semget'
20879d_semop='$d_semop'
4e0554ec 20880d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
20881d_setegid='$d_setegid'
20882d_seteuid='$d_seteuid'
20883d_setgrent='$d_setgrent'
10bc17b6 20884d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
20885d_setgrps='$d_setgrps'
20886d_sethent='$d_sethent'
10bc17b6 20887d_sethostent_r='$d_sethostent_r'
4e0554ec 20888d_setitimer='$d_setitimer'
b4eb6b3d
JH
20889d_setlinebuf='$d_setlinebuf'
20890d_setlocale='$d_setlocale'
10bc17b6 20891d_setlocale_r='$d_setlocale_r'
b4eb6b3d 20892d_setnent='$d_setnent'
10bc17b6 20893d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
20894d_setpent='$d_setpent'
20895d_setpgid='$d_setpgid'
20896d_setpgrp2='$d_setpgrp2'
20897d_setpgrp='$d_setpgrp'
20898d_setprior='$d_setprior'
20899d_setproctitle='$d_setproctitle'
10bc17b6 20900d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 20901d_setpwent='$d_setpwent'
10bc17b6 20902d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
20903d_setregid='$d_setregid'
20904d_setresgid='$d_setresgid'
20905d_setresuid='$d_setresuid'
20906d_setreuid='$d_setreuid'
20907d_setrgid='$d_setrgid'
20908d_setruid='$d_setruid'
20909d_setsent='$d_setsent'
10bc17b6 20910d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
20911d_setsid='$d_setsid'
20912d_setvbuf='$d_setvbuf'
20913d_sfio='$d_sfio'
20914d_shm='$d_shm'
20915d_shmat='$d_shmat'
20916d_shmatprototype='$d_shmatprototype'
20917d_shmctl='$d_shmctl'
20918d_shmdt='$d_shmdt'
20919d_shmget='$d_shmget'
20920d_sigaction='$d_sigaction'
983dbef6 20921d_sigprocmask='$d_sigprocmask'
b4eb6b3d 20922d_sigsetjmp='$d_sigsetjmp'
49a78c82 20923d_sockatmark='$d_sockatmark'
2ef53570 20924d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
20925d_socket='$d_socket'
20926d_socklen_t='$d_socklen_t'
20927d_sockpair='$d_sockpair'
20928d_socks5_init='$d_socks5_init'
20929d_sqrtl='$d_sqrtl'
10bc17b6
JH
20930d_srand48_r='$d_srand48_r'
20931d_srandom_r='$d_srandom_r'
eef837ea 20932d_sresgproto='$d_sresgproto'
640374d0 20933d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
20934d_statblks='$d_statblks'
20935d_statfs_f_flags='$d_statfs_f_flags'
20936d_statfs_s='$d_statfs_s'
20937d_statvfs='$d_statvfs'
20938d_stdio_cnt_lval='$d_stdio_cnt_lval'
20939d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
20940d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20941d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
20942d_stdio_stream_array='$d_stdio_stream_array'
20943d_stdiobase='$d_stdiobase'
20944d_stdstdio='$d_stdstdio'
20945d_strchr='$d_strchr'
20946d_strcoll='$d_strcoll'
20947d_strctcpy='$d_strctcpy'
20948d_strerrm='$d_strerrm'
20949d_strerror='$d_strerror'
10bc17b6 20950d_strerror_r='$d_strerror_r'
b3c85772 20951d_strftime='$d_strftime'
84baed4c
CB
20952d_strlcat='$d_strlcat'
20953d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
20954d_strtod='$d_strtod'
20955d_strtol='$d_strtol'
20956d_strtold='$d_strtold'
20957d_strtoll='$d_strtoll'
28e5dec8 20958d_strtoq='$d_strtoq'
b4eb6b3d
JH
20959d_strtoul='$d_strtoul'
20960d_strtoull='$d_strtoull'
20961d_strtouq='$d_strtouq'
20962d_strxfrm='$d_strxfrm'
20963d_suidsafe='$d_suidsafe'
20964d_symlink='$d_symlink'
20965d_syscall='$d_syscall'
2ef53570 20966d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
20967d_sysconf='$d_sysconf'
20968d_sysernlst='$d_sysernlst'
20969d_syserrlst='$d_syserrlst'
20970d_system='$d_system'
20971d_tcgetpgrp='$d_tcgetpgrp'
20972d_tcsetpgrp='$d_tcsetpgrp'
20973d_telldir='$d_telldir'
20974d_telldirproto='$d_telldirproto'
20975d_time='$d_time'
20976d_times='$d_times'
14b90194
JH
20977d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20978d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 20979d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 20980d_truncate='$d_truncate'
10bc17b6 20981d_ttyname_r='$d_ttyname_r'
b4eb6b3d 20982d_tzname='$d_tzname'
4e0554ec
JH
20983d_u32align='$d_u32align'
20984d_ualarm='$d_ualarm'
b4eb6b3d
JH
20985d_umask='$d_umask'
20986d_uname='$d_uname'
20987d_union_semun='$d_union_semun'
758a5d79 20988d_unordered='$d_unordered'
4e0554ec 20989d_usleep='$d_usleep'
2ef53570 20990d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
20991d_ustat='$d_ustat'
20992d_vendorarch='$d_vendorarch'
20993d_vendorbin='$d_vendorbin'
20994d_vendorlib='$d_vendorlib'
6e1038e0 20995d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
20996d_vfork='$d_vfork'
20997d_void_closedir='$d_void_closedir'
20998d_voidsig='$d_voidsig'
20999d_voidtty='$d_voidtty'
21000d_volatile='$d_volatile'
21001d_vprintf='$d_vprintf'
21002d_wait4='$d_wait4'
21003d_waitpid='$d_waitpid'
21004d_wcstombs='$d_wcstombs'
21005d_wctomb='$d_wctomb'
4e0554ec 21006d_writev='$d_writev'
5f80c64f
JH
21007d_xenix='$d_xenix'
21008date='$date'
b4eb6b3d
JH
21009db_hashtype='$db_hashtype'
21010db_prefixtype='$db_prefixtype'
640374d0
JH
21011db_version_major='$db_version_major'
21012db_version_minor='$db_version_minor'
21013db_version_patch='$db_version_patch'
b4eb6b3d
JH
21014defvoidused='$defvoidused'
21015direntrytype='$direntrytype'
21016dlext='$dlext'
5f80c64f 21017dlsrc='$dlsrc'
b4eb6b3d
JH
21018doublesize='$doublesize'
21019drand01='$drand01'
10bc17b6 21020drand48_r_proto='$drand48_r_proto'
b4eb6b3d
JH
21021dynamic_ext='$dynamic_ext'
21022eagain='$eagain'
21023ebcdic='$ebcdic'
5f80c64f
JH
21024echo='$echo'
21025egrep='$egrep'
21026emacs='$emacs'
10bc17b6
JH
21027endgrent_r_proto='$endgrent_r_proto'
21028endhostent_r_proto='$endhostent_r_proto'
21029endnetent_r_proto='$endnetent_r_proto'
21030endprotoent_r_proto='$endprotoent_r_proto'
21031endpwent_r_proto='$endpwent_r_proto'
21032endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
21033eunicefix='$eunicefix'
21034exe_ext='$exe_ext'
21035expr='$expr'
b4eb6b3d 21036extensions='$extensions'
6fcddf3b 21037extras='$extras'
b4eb6b3d
JH
21038fflushNULL='$fflushNULL'
21039fflushall='$fflushall'
5f80c64f
JH
21040find='$find'
21041firstmakefile='$firstmakefile'
21042flex='$flex'
b4eb6b3d
JH
21043fpossize='$fpossize'
21044fpostype='$fpostype'
21045freetype='$freetype'
5440bc8e 21046from='$from'
b4eb6b3d
JH
21047full_ar='$full_ar'
21048full_csh='$full_csh'
21049full_sed='$full_sed'
2d736872 21050gccansipedantic='$gccansipedantic'
5b463ca7 21051gccosandvers='$gccosandvers'
5f80c64f 21052gccversion='$gccversion'
10bc17b6
JH
21053getgrent_r_proto='$getgrent_r_proto'
21054getgrgid_r_proto='$getgrgid_r_proto'
21055getgrnam_r_proto='$getgrnam_r_proto'
21056gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21057gethostbyname_r_proto='$gethostbyname_r_proto'
21058gethostent_r_proto='$gethostent_r_proto'
21059getlogin_r_proto='$getlogin_r_proto'
21060getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21061getnetbyname_r_proto='$getnetbyname_r_proto'
21062getnetent_r_proto='$getnetent_r_proto'
21063getprotobyname_r_proto='$getprotobyname_r_proto'
21064getprotobynumber_r_proto='$getprotobynumber_r_proto'
21065getprotoent_r_proto='$getprotoent_r_proto'
21066getpwent_r_proto='$getpwent_r_proto'
21067getpwnam_r_proto='$getpwnam_r_proto'
21068getpwuid_r_proto='$getpwuid_r_proto'
21069getservbyname_r_proto='$getservbyname_r_proto'
21070getservbyport_r_proto='$getservbyport_r_proto'
21071getservent_r_proto='$getservent_r_proto'
21072getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
21073gidformat='$gidformat'
21074gidsign='$gidsign'
21075gidsize='$gidsize'
21076gidtype='$gidtype'
5f80c64f 21077glibpth='$glibpth'
3c728e00 21078gmake='$gmake'
10bc17b6 21079gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 21080gnulibc_version='$gnulibc_version'
5f80c64f 21081grep='$grep'
b4eb6b3d
JH
21082groupcat='$groupcat'
21083groupstype='$groupstype'
5f80c64f 21084gzip='$gzip'
b4eb6b3d
JH
21085h_fcntl='$h_fcntl'
21086h_sysfile='$h_sysfile'
5f80c64f 21087hint='$hint'
b4eb6b3d 21088hostcat='$hostcat'
6e1038e0
MB
21089html1dir='$html1dir'
21090html1direxp='$html1direxp'
21091html3dir='$html3dir'
21092html3direxp='$html3direxp'
b4eb6b3d
JH
21093i16size='$i16size'
21094i16type='$i16type'
21095i32size='$i32size'
21096i32type='$i32type'
21097i64size='$i64size'
21098i64type='$i64type'
21099i8size='$i8size'
21100i8type='$i8type'
21101i_arpainet='$i_arpainet'
21102i_bsdioctl='$i_bsdioctl'
10bc17b6 21103i_crypt='$i_crypt'
b4eb6b3d
JH
21104i_db='$i_db'
21105i_dbm='$i_dbm'
21106i_dirent='$i_dirent'
5f80c64f 21107i_dld='$i_dld'
b4eb6b3d
JH
21108i_dlfcn='$i_dlfcn'
21109i_fcntl='$i_fcntl'
21110i_float='$i_float'
758a5d79
JH
21111i_fp='$i_fp'
21112i_fp_class='$i_fp_class'
b4eb6b3d
JH
21113i_gdbm='$i_gdbm'
21114i_grp='$i_grp'
b4eb6b3d
JH
21115i_ieeefp='$i_ieeefp'
21116i_inttypes='$i_inttypes'
2765b840 21117i_langinfo='$i_langinfo'
b4eb6b3d
JH
21118i_libutil='$i_libutil'
21119i_limits='$i_limits'
21120i_locale='$i_locale'
21121i_machcthr='$i_machcthr'
21122i_malloc='$i_malloc'
21123i_math='$i_math'
21124i_memory='$i_memory'
21125i_mntent='$i_mntent'
21126i_ndbm='$i_ndbm'
21127i_netdb='$i_netdb'
21128i_neterrno='$i_neterrno'
21129i_netinettcp='$i_netinettcp'
21130i_niin='$i_niin'
21131i_poll='$i_poll'
21132i_prot='$i_prot'
21133i_pthread='$i_pthread'
21134i_pwd='$i_pwd'
21135i_rpcsvcdbm='$i_rpcsvcdbm'
21136i_sfio='$i_sfio'
21137i_sgtty='$i_sgtty'
21138i_shadow='$i_shadow'
21139i_socks='$i_socks'
21140i_stdarg='$i_stdarg'
21141i_stddef='$i_stddef'
21142i_stdlib='$i_stdlib'
21143i_string='$i_string'
21144i_sunmath='$i_sunmath'
21145i_sysaccess='$i_sysaccess'
21146i_sysdir='$i_sysdir'
21147i_sysfile='$i_sysfile'
21148i_sysfilio='$i_sysfilio'
21149i_sysin='$i_sysin'
21150i_sysioctl='$i_sysioctl'
21151i_syslog='$i_syslog'
21152i_sysmman='$i_sysmman'
21153i_sysmode='$i_sysmode'
21154i_sysmount='$i_sysmount'
21155i_sysndir='$i_sysndir'
21156i_sysparam='$i_sysparam'
21157i_sysresrc='$i_sysresrc'
21158i_syssecrt='$i_syssecrt'
21159i_sysselct='$i_sysselct'
21160i_syssockio='$i_syssockio'
21161i_sysstat='$i_sysstat'
21162i_sysstatfs='$i_sysstatfs'
21163i_sysstatvfs='$i_sysstatvfs'
21164i_systime='$i_systime'
21165i_systimek='$i_systimek'
21166i_systimes='$i_systimes'
21167i_systypes='$i_systypes'
21168i_sysuio='$i_sysuio'
21169i_sysun='$i_sysun'
21170i_sysutsname='$i_sysutsname'
21171i_sysvfs='$i_sysvfs'
21172i_syswait='$i_syswait'
21173i_termio='$i_termio'
21174i_termios='$i_termios'
21175i_time='$i_time'
21176i_unistd='$i_unistd'
21177i_ustat='$i_ustat'
21178i_utime='$i_utime'
21179i_values='$i_values'
21180i_varargs='$i_varargs'
21181i_varhdr='$i_varhdr'
21182i_vfork='$i_vfork'
5f80c64f 21183ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
21184inc_version_list='$inc_version_list'
21185inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
21186incpath='$incpath'
21187inews='$inews'
b4eb6b3d
JH
21188installarchlib='$installarchlib'
21189installbin='$installbin'
6e1038e0
MB
21190installhtml1dir='$installhtml1dir'
21191installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
21192installman1dir='$installman1dir'
21193installman3dir='$installman3dir'
21194installprefix='$installprefix'
21195installprefixexp='$installprefixexp'
21196installprivlib='$installprivlib'
21197installscript='$installscript'
21198installsitearch='$installsitearch'
21199installsitebin='$installsitebin'
3bb95762
JH
21200installsitehtml1dir='$installsitehtml1dir'
21201installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 21202installsitelib='$installsitelib'
3bb95762
JH
21203installsiteman1dir='$installsiteman1dir'
21204installsiteman3dir='$installsiteman3dir'
6e1038e0 21205installsitescript='$installsitescript'
b4eb6b3d
JH
21206installstyle='$installstyle'
21207installusrbinperl='$installusrbinperl'
21208installvendorarch='$installvendorarch'
21209installvendorbin='$installvendorbin'
3bb95762
JH
21210installvendorhtml1dir='$installvendorhtml1dir'
21211installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 21212installvendorlib='$installvendorlib'
3bb95762
JH
21213installvendorman1dir='$installvendorman1dir'
21214installvendorman3dir='$installvendorman3dir'
6e1038e0 21215installvendorscript='$installvendorscript'
b4eb6b3d 21216intsize='$intsize'
4b661809 21217issymlink='$issymlink'
b4eb6b3d
JH
21218ivdformat='$ivdformat'
21219ivsize='$ivsize'
21220ivtype='$ivtype'
21221known_extensions='$known_extensions'
5f80c64f 21222ksh='$ksh'
5f80c64f
JH
21223ld='$ld'
21224lddlflags='$lddlflags'
21225ldflags='$ldflags'
b4eb6b3d
JH
21226ldflags_uselargefiles='$ldflags_uselargefiles'
21227ldlibpthname='$ldlibpthname'
5f80c64f
JH
21228less='$less'
21229lib_ext='$lib_ext'
21230libc='$libc'
b4eb6b3d 21231libperl='$libperl'
5f80c64f
JH
21232libpth='$libpth'
21233libs='$libs'
43999f95
JH
21234libsdirs='$libsdirs'
21235libsfiles='$libsfiles'
21236libsfound='$libsfound'
13b3f787 21237libspath='$libspath'
5f80c64f 21238libswanted='$libswanted'
b4eb6b3d 21239libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
21240line='$line'
21241lint='$lint'
21242lkflags='$lkflags'
21243ln='$ln'
21244lns='$lns'
10bc17b6 21245localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
21246locincpth='$locincpth'
21247loclibpth='$loclibpth'
b4eb6b3d
JH
21248longdblsize='$longdblsize'
21249longlongsize='$longlongsize'
21250longsize='$longsize'
5f80c64f
JH
21251lp='$lp'
21252lpr='$lpr'
21253ls='$ls'
b4eb6b3d
JH
21254lseeksize='$lseeksize'
21255lseektype='$lseektype'
5f80c64f
JH
21256mail='$mail'
21257mailx='$mailx'
21258make='$make'
21259make_set_make='$make_set_make'
b4eb6b3d
JH
21260mallocobj='$mallocobj'
21261mallocsrc='$mallocsrc'
21262malloctype='$malloctype'
21263man1dir='$man1dir'
21264man1direxp='$man1direxp'
21265man1ext='$man1ext'
21266man3dir='$man3dir'
21267man3direxp='$man3direxp'
21268man3ext='$man3ext'
5f80c64f 21269mips_type='$mips_type'
bd43df42 21270mistrustnm='$mistrustnm'
5f80c64f 21271mkdir='$mkdir'
b4eb6b3d
JH
21272mmaptype='$mmaptype'
21273modetype='$modetype'
5f80c64f 21274more='$more'
b4eb6b3d 21275multiarch='$multiarch'
5f80c64f 21276mv='$mv'
b4eb6b3d
JH
21277myarchname='$myarchname'
21278mydomain='$mydomain'
21279myhostname='$myhostname'
5f80c64f
JH
21280myuname='$myuname'
21281n='$n'
2cc61e15 21282need_va_copy='$need_va_copy'
b4eb6b3d
JH
21283netdb_hlen_type='$netdb_hlen_type'
21284netdb_host_type='$netdb_host_type'
21285netdb_name_type='$netdb_name_type'
21286netdb_net_type='$netdb_net_type'
5f80c64f
JH
21287nm='$nm'
21288nm_opt='$nm_opt'
21289nm_so_opt='$nm_so_opt'
b4eb6b3d 21290nonxs_ext='$nonxs_ext'
5f80c64f 21291nroff='$nroff'
b4eb6b3d
JH
21292nvEUformat='$nvEUformat'
21293nvFUformat='$nvFUformat'
21294nvGUformat='$nvGUformat'
53133ed1 21295nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
21296nveformat='$nveformat'
21297nvfformat='$nvfformat'
21298nvgformat='$nvgformat'
21299nvsize='$nvsize'
21300nvtype='$nvtype'
21301o_nonblock='$o_nonblock'
5f80c64f 21302obj_ext='$obj_ext'
b4eb6b3d 21303old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 21304optimize='$optimize'
b4eb6b3d 21305orderlib='$orderlib'
5f80c64f
JH
21306osname='$osname'
21307osvers='$osvers'
b4eb6b3d 21308otherlibdirs='$otherlibdirs'
5f80c64f 21309package='$package'
b4eb6b3d
JH
21310pager='$pager'
21311passcat='$passcat'
21312patchlevel='$patchlevel'
5f80c64f 21313path_sep='$path_sep'
b4eb6b3d 21314perl5='$perl5'
5f80c64f 21315perl='$perl'
151e6568 21316perl_patchlevel='$perl_patchlevel'
b4eb6b3d 21317perladmin='$perladmin'
9c839522 21318perllibs='$perllibs'
b4eb6b3d 21319perlpath='$perlpath'
5f80c64f 21320pg='$pg'
b4eb6b3d
JH
21321phostname='$phostname'
21322pidtype='$pidtype'
5f80c64f
JH
21323plibpth='$plibpth'
21324pmake='$pmake'
21325pr='$pr'
b4eb6b3d
JH
21326prefix='$prefix'
21327prefixexp='$prefixexp'
21328privlib='$privlib'
21329privlibexp='$privlibexp'
f24dbf84 21330procselfexe='$procselfexe'
b4eb6b3d
JH
21331prototype='$prototype'
21332ptrsize='$ptrsize'
21333quadkind='$quadkind'
21334quadtype='$quadtype'
21335randbits='$randbits'
21336randfunc='$randfunc'
10bc17b6 21337random_r_proto='$random_r_proto'
b4eb6b3d
JH
21338randseedtype='$randseedtype'
21339ranlib='$ranlib'
21340rd_nodata='$rd_nodata'
10bc17b6
JH
21341readdir64_r_proto='$readdir64_r_proto'
21342readdir_r_proto='$readdir_r_proto'
b4eb6b3d 21343revision='$revision'
5f80c64f
JH
21344rm='$rm'
21345rmail='$rmail'
5440bc8e 21346run='$run'
5f80c64f 21347runnm='$runnm'
b4eb6b3d
JH
21348sPRIEUldbl='$sPRIEUldbl'
21349sPRIFUldbl='$sPRIFUldbl'
21350sPRIGUldbl='$sPRIGUldbl'
21351sPRIXU64='$sPRIXU64'
21352sPRId64='$sPRId64'
21353sPRIeldbl='$sPRIeldbl'
21354sPRIfldbl='$sPRIfldbl'
21355sPRIgldbl='$sPRIgldbl'
21356sPRIi64='$sPRIi64'
21357sPRIo64='$sPRIo64'
21358sPRIu64='$sPRIu64'
21359sPRIx64='$sPRIx64'
21360sSCNfldbl='$sSCNfldbl'
21361sched_yield='$sched_yield'
21362scriptdir='$scriptdir'
21363scriptdirexp='$scriptdirexp'
5f80c64f 21364sed='$sed'
b4eb6b3d
JH
21365seedfunc='$seedfunc'
21366selectminbits='$selectminbits'
21367selecttype='$selecttype'
5f80c64f 21368sendmail='$sendmail'
10bc17b6
JH
21369setgrent_r_proto='$setgrent_r_proto'
21370sethostent_r_proto='$sethostent_r_proto'
21371setlocale_r_proto='$setlocale_r_proto'
21372setnetent_r_proto='$setnetent_r_proto'
21373setprotoent_r_proto='$setprotoent_r_proto'
21374setpwent_r_proto='$setpwent_r_proto'
21375setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
21376sh='$sh'
21377shar='$shar'
21378sharpbang='$sharpbang'
b4eb6b3d
JH
21379shmattype='$shmattype'
21380shortsize='$shortsize'
21381shrpenv='$shrpenv'
5f80c64f 21382shsharp='$shsharp'
b4eb6b3d
JH
21383sig_count='$sig_count'
21384sig_name='$sig_name'
21385sig_name_init='$sig_name_init'
21386sig_num='$sig_num'
21387sig_num_init='$sig_num_init'
76d3c696 21388sig_size='$sig_size'
b4eb6b3d
JH
21389signal_t='$signal_t'
21390sitearch='$sitearch'
21391sitearchexp='$sitearchexp'
21392sitebin='$sitebin'
21393sitebinexp='$sitebinexp'
3bb95762
JH
21394sitehtml1dir='$sitehtml1dir'
21395sitehtml1direxp='$sitehtml1direxp'
21396sitehtml3dir='$sitehtml3dir'
21397sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
21398sitelib='$sitelib'
21399sitelib_stem='$sitelib_stem'
21400sitelibexp='$sitelibexp'
3bb95762
JH
21401siteman1dir='$siteman1dir'
21402siteman1direxp='$siteman1direxp'
21403siteman3dir='$siteman3dir'
21404siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
21405siteprefix='$siteprefix'
21406siteprefixexp='$siteprefixexp'
6e1038e0
MB
21407sitescript='$sitescript'
21408sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
21409sizesize='$sizesize'
21410sizetype='$sizetype'
5f80c64f
JH
21411sleep='$sleep'
21412smail='$smail'
5f80c64f 21413so='$so'
b4eb6b3d
JH
21414sockethdr='$sockethdr'
21415socketlib='$socketlib'
21416socksizetype='$socksizetype'
5f80c64f
JH
21417sort='$sort'
21418spackage='$spackage'
21419spitshell='$spitshell'
10bc17b6
JH
21420srand48_r_proto='$srand48_r_proto'
21421srandom_r_proto='$srandom_r_proto'
5f80c64f 21422src='$src'
b4eb6b3d
JH
21423ssizetype='$ssizetype'
21424startperl='$startperl'
5f80c64f 21425startsh='$startsh'
b4eb6b3d
JH
21426static_ext='$static_ext'
21427stdchar='$stdchar'
21428stdio_base='$stdio_base'
21429stdio_bufsiz='$stdio_bufsiz'
21430stdio_cnt='$stdio_cnt'
21431stdio_filbuf='$stdio_filbuf'
21432stdio_ptr='$stdio_ptr'
21433stdio_stream_array='$stdio_stream_array'
10bc17b6 21434strerror_r_proto='$strerror_r_proto'
b4eb6b3d 21435strings='$strings'
5f80c64f 21436submit='$submit'
b4eb6b3d
JH
21437subversion='$subversion'
21438sysman='$sysman'
5f80c64f
JH
21439tail='$tail'
21440tar='$tar'
5440bc8e 21441targetarch='$targetarch'
5f80c64f
JH
21442tbl='$tbl'
21443tee='$tee'
21444test='$test'
b4eb6b3d
JH
21445timeincl='$timeincl'
21446timetype='$timetype'
10bc17b6 21447tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 21448to='$to'
5f80c64f
JH
21449touch='$touch'
21450tr='$tr'
21451trnl='$trnl'
21452troff='$troff'
10bc17b6 21453ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
21454u16size='$u16size'
21455u16type='$u16type'
21456u32size='$u32size'
21457u32type='$u32type'
21458u64size='$u64size'
21459u64type='$u64type'
21460u8size='$u8size'
21461u8type='$u8type'
21462uidformat='$uidformat'
21463uidsign='$uidsign'
21464uidsize='$uidsize'
21465uidtype='$uidtype'
5f80c64f
JH
21466uname='$uname'
21467uniq='$uniq'
b4eb6b3d
JH
21468uquadtype='$uquadtype'
21469use5005threads='$use5005threads'
21470use64bitall='$use64bitall'
21471use64bitint='$use64bitint'
5440bc8e 21472usecrosscompile='$usecrosscompile'
5f80c64f 21473usedl='$usedl'
ff0950a8 21474usefaststdio='$usefaststdio'
b4eb6b3d
JH
21475useithreads='$useithreads'
21476uselargefiles='$uselargefiles'
21477uselongdouble='$uselongdouble'
c53af328 21478usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
21479usemorebits='$usemorebits'
21480usemultiplicity='$usemultiplicity'
21481usemymalloc='$usemymalloc'
5f80c64f 21482usenm='$usenm'
b4eb6b3d
JH
21483useopcode='$useopcode'
21484useperlio='$useperlio'
21485useposix='$useposix'
9514c62b 21486usereentrant='$usereentrant'
b4eb6b3d
JH
21487usesfio='$usesfio'
21488useshrplib='$useshrplib'
5d39362b 21489usesitecustomize='$usesitecustomize'
29209bc5 21490usesocks='$usesocks'
b4eb6b3d
JH
21491usethreads='$usethreads'
21492usevendorprefix='$usevendorprefix'
21493usevfork='$usevfork'
5f80c64f
JH
21494usrinc='$usrinc'
21495uuname='$uuname'
b4eb6b3d
JH
21496uvXUformat='$uvXUformat'
21497uvoformat='$uvoformat'
21498uvsize='$uvsize'
21499uvtype='$uvtype'
21500uvuformat='$uvuformat'
21501uvxformat='$uvxformat'
21502vendorarch='$vendorarch'
21503vendorarchexp='$vendorarchexp'
21504vendorbin='$vendorbin'
21505vendorbinexp='$vendorbinexp'
3bb95762
JH
21506vendorhtml1dir='$vendorhtml1dir'
21507vendorhtml1direxp='$vendorhtml1direxp'
21508vendorhtml3dir='$vendorhtml3dir'
21509vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
21510vendorlib='$vendorlib'
21511vendorlib_stem='$vendorlib_stem'
21512vendorlibexp='$vendorlibexp'
3bb95762
JH
21513vendorman1dir='$vendorman1dir'
21514vendorman1direxp='$vendorman1direxp'
21515vendorman3dir='$vendorman3dir'
21516vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
21517vendorprefix='$vendorprefix'
21518vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
21519vendorscript='$vendorscript'
21520vendorscriptexp='$vendorscriptexp'
b4eb6b3d 21521version='$version'
861eb78d 21522version_patchlevel_string='$version_patchlevel_string'
d56c5707 21523versiononly='$versiononly'
5f80c64f 21524vi='$vi'
b4eb6b3d 21525voidflags='$voidflags'
5f80c64f 21526xlibpth='$xlibpth'
3659ebf1
JH
21527yacc='$yacc'
21528yaccflags='$yaccflags'
5f80c64f
JH
21529zcat='$zcat'
21530zip='$zip'
21531EOT
21532
21533: Add in command line options if available
21534$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21535
21536: add special variables
21537$test -f $src/patchlevel.h && \
d00b958f 21538awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 21539echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 21540echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
21541
21542: propagate old symbols
21543if $test -f UU/config.sh; then
381aa1ff 21544 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 21545 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 21546 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
21547 set X `cat UU/oldsyms`
21548 shift
21549 case $# in
21550 0) ;;
21551 *)
21552 cat <<EOM
21553Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21554EOM
21555 echo "# Variables propagated from previous config.sh file." >>config.sh
21556 for sym in `cat UU/oldsyms`; do
21557 echo " Propagating $hint variable "'$'"$sym..."
21558 eval 'tmp="$'"${sym}"'"'
21559 echo "$tmp" | \
21560 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21561 done
21562 ;;
21563 esac
21564fi
21565
21566: Finish up by extracting the .SH files
21567case "$alldone" in
21568exit)
21569 $rm -rf UU
24ccb310 21570 echo "Extraction done."
5f80c64f
JH
21571 exit 0
21572 ;;
21573cont)
21574 ;;
21575'')
21576 dflt=''
21577 nostick=true
21578 $cat <<EOM
21579
21580If you'd like to make any changes to the config.sh file before I begin
21581to configure things, do it as a shell escape now (e.g. !vi config.sh).
21582
21583EOM
21584 rp="Press return or use a shell escape to edit config.sh:"
21585 . UU/myread
21586 nostick=''
21587 case "$ans" in
21588 '') ;;
21589 *) : in case they cannot read
21590 sh 1>&4 -c "$ans";;
21591 esac
21592 ;;
21593esac
21594
21595: if this fails, just run all the .SH files by hand
21596. ./config.sh
21597
21598echo " "
21599exec 1>&4
a43e8593 21600pwd=`pwd`
5f80c64f 21601. ./UU/extract
6904989c 21602cd "$pwd"
5f80c64f
JH
21603
21604if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
21605 dflt=y
21606 case "$silent" in
21607 true) ;;
21608 *)
21609 $cat <<EOM
21610
21611Now you need to generate make dependencies by running "$make depend".
21612You might prefer to run it in background: "$make depend > makedepend.out &"
21613It can take a while, so you might not want to run it right now.
21614
21615EOM
21616 ;;
21617 esac
21618 rp="Run $make depend now?"
21619 . UU/myread
21620 case "$ans" in
21621 y*)
3d5d58b1 21622 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
21623 ;;
21624 *)
21625 echo "You must run '$make depend' then '$make'."
21626 ;;
21627 esac
21628elif test -f [Mm]akefile; then
21629 echo " "
21630 echo "Now you must run a $make."
21631else
24ccb310 21632 echo "Configure done."
5f80c64f
JH
21633fi
21634
21635if $test -f Policy.sh; then
21636 $cat <<EOM
21637
21638If you compile $package on a different machine or from a different object
21639directory, copy the Policy.sh file from this object directory to the
21640new one before you run Configure -- this will help you with most of
21641the policy defaults.
21642
21643EOM
21644fi
21645if $test -f config.msg; then
21646 echo "Hmm. I also noted the following information while running:"
21647 echo " "
21648 $cat config.msg >&4
21649 $rm -f config.msg
21650fi
21651$rm -f kit*isdone ark*isdone
21652$rm -rf UU
21653
21654: End of Configure
21655