This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Nothing is actually relying on GvUNIQUE holding state.
[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#
17f6277d 23# Generated on Tue Jun 21 21:45:01 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
f6538904 50if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
cbee2ce6
JH
51 cat >&4 <<EOF
52***
53*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
54*** Configure that well. (Plan 9 is close to UNIX but not close enough.)
55*** Please read the README.plan9 for further instructions.
56*** Cannot continue, aborting.
57***
58EOF
59 exit 1
60fi
61
a0d0e21e
LW
62: compute my invocation name
63me=$0
64case "$0" in
65*/*)
66 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
67 test "$me" || me=$0
68 ;;
69esac
70
dfe9444c 71: Proper separator for the PATH environment variable
8e07c86e
AD
72p_=:
73: On OS/2 this directory should exist if this is not floppy only system :-]
5c728af0 74if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
dfe9444c
AD
75 if test -n "$OS2_SHELL"; then
76 p_=\;
77 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
78 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
5c728af0 79 is_os2=yes
c4f23d77 80 elif test -n "$DJGPP"; then
495e2cbe
MB
81 case "X${MACHTYPE:-nonesuchmach}" in
82 *cygwin) ;;
83 *) p_=\; ;;
84 esac
dfe9444c 85 fi
39e571d4 86fi
a0d0e21e
LW
87
88: Proper PATH setting
89paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 90paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 91paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 92paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e 93paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
87bdd940 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=''
6b34ded5 191mistrustnm=''
9c839522 192perllibs=''
b4eb6b3d
JH
193dynamic_ext=''
194extensions=''
195known_extensions=''
196nonxs_ext=''
197static_ext=''
198useopcode=''
199useposix=''
6fcddf3b 200extras=''
ecfc5424 201d_bsd=''
40a7a20a 202d_eunice=''
2304df62
AD
203d_xenix=''
204eunicefix=''
205Mcc=''
dfe9444c 206ar=''
2304df62
AD
207awk=''
208bash=''
209bison=''
210byacc=''
211cat=''
212chgrp=''
213chmod=''
214chown=''
ecfc5424 215comm=''
2304df62
AD
216compress=''
217cp=''
218cpio=''
219cpp=''
220csh=''
221date=''
222echo=''
223egrep=''
224emacs=''
225expr=''
226find=''
227flex=''
3c728e00 228gmake=''
2304df62 229grep=''
8ff267be 230gzip=''
2304df62
AD
231inews=''
232ksh=''
233less=''
234line=''
235lint=''
236ln=''
237lp=''
238lpr=''
239ls=''
240mail=''
241mailx=''
dfe9444c 242make=''
2304df62
AD
243mkdir=''
244more=''
245mv=''
693762b4 246nm=''
2304df62
AD
247nroff=''
248perl=''
249pg=''
250pmake=''
251pr=''
252rm=''
253rmail=''
254sed=''
255sendmail=''
2304df62
AD
256shar=''
257sleep=''
258smail=''
259sort=''
260submit=''
261tail=''
262tar=''
263tbl=''
693762b4 264tee=''
2304df62
AD
265test=''
266touch=''
267tr=''
268troff=''
269uname=''
270uniq=''
271uuname=''
272vi=''
273zcat=''
8ff267be 274zip=''
b4eb6b3d
JH
275full_ar=''
276full_sed=''
a0d0e21e 277libswanted=''
2304df62
AD
278hint=''
279myuname=''
85e6fe83
LW
280osname=''
281osvers=''
2304df62
AD
282Author=''
283Date=''
284Header=''
285Id=''
286Locker=''
287Log=''
288RCSfile=''
289Revision=''
290Source=''
291State=''
dfe9444c
AD
292_a=''
293_exe=''
294_o=''
4633a7c4
LW
295archobjs=''
296exe_ext=''
297firstmakefile=''
298lib_ext=''
299obj_ext=''
300path_sep=''
b4eb6b3d 301afs=''
a6d26a0d 302afsroot=''
b4eb6b3d
JH
303alignbytes=''
304ansi2knr=''
305archlib=''
306archlibexp=''
307d_archlib=''
308installarchlib=''
309archname=''
310myarchname=''
311d_atolf=''
312d_atoll=''
313baserev=''
314bin=''
315binexp=''
316installbin=''
b4eb6b3d 317byteorder=''
2304df62 318cc=''
2304df62
AD
319ccflags=''
320cppflags=''
321ldflags=''
322lkflags=''
8e07c86e 323locincpth=''
2304df62 324optimize=''
b4eb6b3d 325cf_email=''
2304df62
AD
326cf_by=''
327cf_time=''
b4eb6b3d 328charsize=''
2304df62 329contains=''
b4eb6b3d 330cpp_stuff=''
2304df62
AD
331cpplast=''
332cppminus=''
333cpprun=''
334cppstdin=''
74cac757 335d__fwalk=''
b4eb6b3d
JH
336d_access=''
337d_accessx=''
55954f19 338d_aintl=''
b4eb6b3d 339d_alarm=''
10bc17b6
JH
340asctime_r_proto=''
341d_asctime_r=''
0dbb1585
AL
342d_attribute_format=''
343d_attribute_malloc=''
344d_attribute_nonnull=''
345d_attribute_noreturn=''
346d_attribute_pure=''
347d_attribute_unused=''
348d_attribute_warn_unused_result=''
b4eb6b3d
JH
349d_bcmp=''
350d_bcopy=''
351d_bzero=''
352d_casti32=''
353castflags=''
354d_castneg=''
355d_chown=''
356d_chroot=''
357d_chsize=''
758a5d79 358d_class=''
b4eb6b3d
JH
359d_closedir=''
360d_void_closedir=''
4e0554ec 361d_cmsghdr_s=''
b4eb6b3d 362d_const=''
36adc09b 363d_copysignl=''
b4eb6b3d
JH
364cryptlib=''
365d_crypt=''
10bc17b6
JH
366crypt_r_proto=''
367d_crypt_r=''
b4eb6b3d
JH
368d_csh=''
369full_csh=''
10bc17b6
JH
370ctermid_r_proto=''
371d_ctermid_r=''
372ctime_r_proto=''
373d_ctime_r=''
b4eb6b3d
JH
374d_cuserid=''
375d_dbl_dig=''
2ef53570 376d_dbminitproto=''
b4eb6b3d 377d_difftime=''
ae0e3d3b 378d_dirfd=''
b4eb6b3d 379d_dlerror=''
a0d0e21e 380d_dlopen=''
b4eb6b3d
JH
381d_dlsymun=''
382d_dosuid=''
383d_suidsafe=''
10bc17b6
JH
384d_drand48_r=''
385drand48_r_proto=''
b4eb6b3d
JH
386d_drand48proto=''
387d_dup2=''
388d_eaccess=''
389d_endgrent=''
10bc17b6
JH
390d_endgrent_r=''
391endgrent_r_proto=''
b4eb6b3d 392d_endhent=''
10bc17b6
JH
393d_endhostent_r=''
394endhostent_r_proto=''
b4eb6b3d 395d_endnent=''
10bc17b6
JH
396d_endnetent_r=''
397endnetent_r_proto=''
b4eb6b3d 398d_endpent=''
10bc17b6
JH
399d_endprotoent_r=''
400endprotoent_r_proto=''
b4eb6b3d 401d_endpwent=''
10bc17b6
JH
402d_endpwent_r=''
403endpwent_r_proto=''
b4eb6b3d 404d_endsent=''
10bc17b6
JH
405d_endservent_r=''
406endservent_r_proto=''
15b61c98 407d_faststdio=''
b363b713 408d_fchdir=''
b4eb6b3d
JH
409d_fchmod=''
410d_fchown=''
411d_fcntl=''
9d9004a9 412d_fcntl_can_lock=''
b4eb6b3d
JH
413d_fd_macros=''
414d_fd_set=''
415d_fds_bits=''
416d_fgetpos=''
758a5d79
JH
417d_finite=''
418d_finitel=''
b4eb6b3d
JH
419d_flexfnam=''
420d_flock=''
2ef53570 421d_flockproto=''
b4eb6b3d 422d_fork=''
758a5d79
JH
423d_fp_class=''
424d_fpclass=''
425d_fpclassify=''
426d_fpclassl=''
b4eb6b3d
JH
427d_fpos64_t=''
428d_frexpl=''
429d_fs_data_s=''
430d_fseeko=''
431d_fsetpos=''
432d_fstatfs=''
411ab01c 433d_fsync=''
b4eb6b3d
JH
434d_ftello=''
435d_ftime=''
436d_gettimeod=''
437d_Gconvert=''
438d_getcwd=''
439d_getespwnam=''
440d_getfsstat=''
441d_getgrent=''
10bc17b6
JH
442d_getgrent_r=''
443getgrent_r_proto=''
444d_getgrgid_r=''
445getgrgid_r_proto=''
446d_getgrnam_r=''
447getgrnam_r_proto=''
b4eb6b3d
JH
448d_getgrps=''
449d_gethbyaddr=''
450d_gethbyname=''
451d_gethent=''
452aphostname=''
453d_gethname=''
454d_phostname=''
455d_uname=''
10bc17b6
JH
456d_gethostbyaddr_r=''
457gethostbyaddr_r_proto=''
458d_gethostbyname_r=''
459gethostbyname_r_proto=''
460d_gethostent_r=''
461gethostent_r_proto=''
b4eb6b3d 462d_gethostprotos=''
4e0554ec 463d_getitimer=''
b4eb6b3d 464d_getlogin=''
10bc17b6
JH
465d_getlogin_r=''
466getlogin_r_proto=''
b4eb6b3d
JH
467d_getmnt=''
468d_getmntent=''
469d_getnbyaddr=''
470d_getnbyname=''
471d_getnent=''
10bc17b6
JH
472d_getnetbyaddr_r=''
473getnetbyaddr_r_proto=''
474d_getnetbyname_r=''
475getnetbyname_r_proto=''
476d_getnetent_r=''
477getnetent_r_proto=''
b4eb6b3d 478d_getnetprotos=''
0c0643d0 479d_getpagsz=''
b4eb6b3d
JH
480d_getpent=''
481d_getpgid=''
482d_getpgrp2=''
483d_bsdgetpgrp=''
484d_getpgrp=''
485d_getppid=''
486d_getprior=''
487d_getpbyname=''
488d_getpbynumber=''
10bc17b6
JH
489d_getprotobyname_r=''
490getprotobyname_r_proto=''
491d_getprotobynumber_r=''
492getprotobynumber_r_proto=''
493d_getprotoent_r=''
494getprotoent_r_proto=''
b4eb6b3d
JH
495d_getprotoprotos=''
496d_getprpwnam=''
497d_getpwent=''
10bc17b6
JH
498d_getpwent_r=''
499getpwent_r_proto=''
500d_getpwnam_r=''
501getpwnam_r_proto=''
502d_getpwuid_r=''
503getpwuid_r_proto=''
b4eb6b3d 504d_getsent=''
10bc17b6
JH
505d_getservbyname_r=''
506getservbyname_r_proto=''
507d_getservbyport_r=''
508getservbyport_r_proto=''
509d_getservent_r=''
510getservent_r_proto=''
b4eb6b3d
JH
511d_getservprotos=''
512d_getspnam=''
10bc17b6
JH
513d_getspnam_r=''
514getspnam_r_proto=''
b4eb6b3d
JH
515d_getsbyname=''
516d_getsbyport=''
10bc17b6
JH
517d_gmtime_r=''
518gmtime_r_proto=''
a4f3eea9 519d_gnulibc=''
5f6e0ee4 520gnulibc_version=''
b4eb6b3d
JH
521d_hasmntopt=''
522d_htonl=''
55954f19 523d_ilogbl=''
b4eb6b3d
JH
524d_inetaton=''
525d_int64_t=''
526d_isascii=''
758a5d79
JH
527d_isfinite=''
528d_isinf=''
b4eb6b3d
JH
529d_isnan=''
530d_isnanl=''
531d_killpg=''
532d_lchown=''
533d_ldbl_dig=''
0a0abfba 534d_libm_lib_version=''
b4eb6b3d 535d_link=''
10bc17b6
JH
536d_localtime_r=''
537localtime_r_proto=''
b4eb6b3d
JH
538d_locconv=''
539d_lockf=''
540d_longdbl=''
541longdblsize=''
542d_longlong=''
543longlongsize=''
544d_lseekproto=''
545d_lstat=''
546d_madvise=''
547d_mblen=''
548d_mbstowcs=''
549d_mbtowc=''
550d_memchr=''
551d_memcmp=''
552d_memcpy=''
553d_memmove=''
554d_memset=''
555d_mkdir=''
556d_mkdtemp=''
557d_mkfifo=''
558d_mkstemp=''
559d_mkstemps=''
560d_mktime=''
561d_mmap=''
562mmaptype=''
563d_modfl=''
e67aeab1 564d_modfl_pow32_bug=''
bc9a1b2c 565d_modflproto=''
b4eb6b3d
JH
566d_mprotect=''
567d_msg=''
568d_msgctl=''
569d_msgget=''
4e0554ec 570d_msghdr_s=''
b4eb6b3d
JH
571d_msgrcv=''
572d_msgsnd=''
573d_msync=''
574d_munmap=''
575d_nice=''
2765b840 576d_nl_langinfo=''
b4eb6b3d
JH
577d_off64_t=''
578d_open3=''
579d_fpathconf=''
580d_pathconf=''
581d_pause=''
582d_pipe=''
583d_poll=''
2304df62 584d_portable=''
a33c94aa 585d_procselfexe=''
f24dbf84 586procselfexe=''
b4eb6b3d
JH
587d_old_pthread_create_joinable=''
588old_pthread_create_joinable=''
d6483fcc 589d_pthread_atfork=''
58d975c3 590d_pthread_attr_setscope=''
b4eb6b3d
JH
591d_pthread_yield=''
592d_sched_yield=''
593sched_yield=''
594d_qgcvt=''
10bc17b6
JH
595d_random_r=''
596random_r_proto=''
597d_readdir64_r=''
598readdir64_r_proto=''
b4eb6b3d
JH
599d_readdir=''
600d_rewinddir=''
601d_seekdir=''
602d_telldir=''
10bc17b6
JH
603d_readdir_r=''
604readdir_r_proto=''
b4eb6b3d 605d_readlink=''
4e0554ec
JH
606d_readv=''
607d_recvmsg=''
b4eb6b3d
JH
608d_rename=''
609d_rmdir=''
610d_safebcpy=''
611d_safemcpy=''
612d_sanemcmp=''
ef9f17be 613d_sbrkproto=''
55954f19 614d_scalbnl=''
b4eb6b3d
JH
615d_select=''
616d_sem=''
617d_semctl=''
618d_semget=''
619d_semop=''
4e0554ec 620d_sendmsg=''
b4eb6b3d
JH
621d_setegid=''
622d_seteuid=''
623d_setgrent=''
10bc17b6
JH
624d_setgrent_r=''
625setgrent_r_proto=''
b4eb6b3d
JH
626d_setgrps=''
627d_sethent=''
10bc17b6
JH
628d_sethostent_r=''
629sethostent_r_proto=''
4e0554ec 630d_setitimer=''
b4eb6b3d
JH
631d_setlinebuf=''
632d_setlocale=''
10bc17b6
JH
633d_setlocale_r=''
634setlocale_r_proto=''
b4eb6b3d 635d_setnent=''
10bc17b6
JH
636d_setnetent_r=''
637setnetent_r_proto=''
b4eb6b3d
JH
638d_setpent=''
639d_setpgid=''
640d_setpgrp2=''
641d_bsdsetpgrp=''
642d_setpgrp=''
643d_setprior=''
644d_setproctitle=''
10bc17b6
JH
645d_setprotoent_r=''
646setprotoent_r_proto=''
b4eb6b3d 647d_setpwent=''
10bc17b6
JH
648d_setpwent_r=''
649setpwent_r_proto=''
b4eb6b3d
JH
650d_setregid=''
651d_setresgid=''
652d_setresuid=''
653d_setreuid=''
654d_setrgid=''
655d_setruid=''
656d_setsent=''
10bc17b6
JH
657d_setservent_r=''
658setservent_r_proto=''
b4eb6b3d
JH
659d_setsid=''
660d_setvbuf=''
661d_sfio=''
662usesfio=''
663d_shm=''
664d_shmat=''
665d_shmatprototype=''
666shmattype=''
667d_shmctl=''
668d_shmdt=''
669d_shmget=''
670d_sigaction=''
983dbef6 671d_sigprocmask=''
b4eb6b3d 672d_sigsetjmp=''
5f106f9c 673usesitecustomize=''
49a78c82 674d_sockatmark=''
2ef53570 675d_sockatmarkproto=''
b4eb6b3d
JH
676d_msg_ctrunc=''
677d_msg_dontroute=''
678d_msg_oob=''
679d_msg_peek=''
680d_msg_proxy=''
681d_oldsock=''
682d_scm_rights=''
683d_socket=''
684d_sockpair=''
685sockethdr=''
686socketlib=''
687d_socklen_t=''
688d_socks5_init=''
689d_sqrtl=''
10bc17b6
JH
690d_srand48_r=''
691srand48_r_proto=''
692d_srandom_r=''
693srandom_r_proto=''
eef837ea 694d_sresgproto=''
640374d0 695d_sresuproto=''
b4eb6b3d
JH
696d_statblks=''
697d_statfs_f_flags=''
698d_statfs_s=''
699d_fstatvfs=''
700d_statvfs=''
701d_stdio_cnt_lval=''
702d_stdio_ptr_lval=''
a7ffa9b9
NC
703d_stdio_ptr_lval_nochange_cnt=''
704d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
705d_stdiobase=''
706d_stdstdio=''
707stdio_base=''
708stdio_bufsiz=''
709stdio_cnt=''
710stdio_filbuf=''
711stdio_ptr=''
712d_index=''
713d_strchr=''
714d_strcoll=''
715d_strctcpy=''
716d_strerrm=''
717d_strerror=''
718d_sysernlst=''
719d_syserrlst=''
10bc17b6
JH
720d_strerror_r=''
721strerror_r_proto=''
b3c85772 722d_strftime=''
08c92000
MB
723d_strlcat=''
724d_strlcpy=''
b4eb6b3d
JH
725d_strtod=''
726d_strtol=''
727d_strtold=''
728d_strtoll=''
28e5dec8 729d_strtoq=''
b4eb6b3d
JH
730d_strtoul=''
731d_strtoull=''
732d_strtouq=''
733d_strxfrm=''
734d_symlink=''
735d_syscall=''
2ef53570 736d_syscallproto=''
b4eb6b3d
JH
737d_sysconf=''
738d_system=''
739d_tcgetpgrp=''
740d_tcsetpgrp=''
741d_telldirproto=''
742d_time=''
743timetype=''
744clocktype=''
745d_times=''
10bc17b6
JH
746d_tmpnam_r=''
747tmpnam_r_proto=''
b4eb6b3d 748d_truncate=''
10bc17b6
JH
749d_ttyname_r=''
750ttyname_r_proto=''
b4eb6b3d 751d_tzname=''
4e0554ec
JH
752d_u32align=''
753d_ualarm=''
b4eb6b3d
JH
754d_umask=''
755d_semctl_semid_ds=''
756d_semctl_semun=''
757d_union_semun=''
758a5d79 758d_unordered=''
4e0554ec 759d_usleep=''
2ef53570 760d_usleepproto=''
b4eb6b3d
JH
761d_ustat=''
762d_vfork=''
763usevfork=''
764d_voidsig=''
765signal_t=''
766d_volatile=''
767d_charvspr=''
768d_vprintf=''
769d_wait4=''
770d_waitpid=''
771d_wcstombs=''
772d_wctomb=''
4e0554ec 773d_writev=''
b4eb6b3d 774dlext=''
85e6fe83
LW
775cccdlflags=''
776ccdlflags=''
2304df62 777dlsrc=''
232e078e 778ld=''
85e6fe83 779lddlflags=''
2304df62 780usedl=''
b4eb6b3d
JH
781doublesize=''
782ebcdic=''
783fflushNULL=''
784fflushall=''
785fpossize=''
786fpostype=''
2d736872 787gccansipedantic=''
5b463ca7 788gccosandvers=''
8a27cf78 789gccversion=''
b4eb6b3d
JH
790gidformat=''
791gidsign=''
792gidsize=''
793gidtype=''
794groupstype=''
795h_fcntl=''
796h_sysfile=''
6e1038e0
MB
797html1dir=''
798html1direxp=''
799installhtml1dir=''
800html3dir=''
801html3direxp=''
802installhtml3dir=''
b4eb6b3d 803i_arpainet=''
10bc17b6 804i_crypt=''
b4eb6b3d
JH
805db_hashtype=''
806db_prefixtype=''
640374d0
JH
807db_version_major=''
808db_version_minor=''
809db_version_patch=''
b4eb6b3d
JH
810i_db=''
811i_dbm=''
812i_rpcsvcdbm=''
813d_dirnamlen=''
814direntrytype=''
815i_dirent=''
a0d0e21e 816i_dld=''
b4eb6b3d
JH
817i_dlfcn=''
818i_fcntl=''
819i_float=''
758a5d79
JH
820i_fp=''
821i_fp_class=''
b4eb6b3d
JH
822i_gdbm=''
823d_grpasswd=''
824i_grp=''
b4eb6b3d
JH
825i_ieeefp=''
826i_inttypes=''
2765b840 827i_langinfo=''
b4eb6b3d
JH
828i_libutil=''
829i_limits=''
830i_locale=''
831i_machcthr=''
832i_malloc=''
833i_math=''
834i_memory=''
835i_mntent=''
836i_ndbm=''
837i_netdb=''
838i_neterrno=''
839i_netinettcp=''
840i_niin=''
841i_sysin=''
842i_poll=''
843i_prot=''
844i_pthread=''
845d_pwage=''
846d_pwchange=''
847d_pwclass=''
848d_pwcomment=''
849d_pwexpire=''
850d_pwgecos=''
851d_pwpasswd=''
852d_pwquota=''
853i_pwd=''
854i_sfio=''
855i_shadow=''
856i_socks=''
857i_stddef=''
858i_stdlib=''
859i_string=''
860strings=''
861i_sunmath=''
862i_sysaccess=''
863i_sysdir=''
864i_sysfile=''
865d_voidtty=''
866i_bsdioctl=''
867i_sysfilio=''
868i_sysioctl=''
869i_syssockio=''
870i_syslog=''
871i_sysmman=''
872i_sysmode=''
873i_sysmount=''
874i_sysndir=''
875i_sysparam=''
876i_sysresrc=''
877i_syssecrt=''
878i_sysselct=''
879i_sysstat=''
880i_sysstatfs=''
881i_sysstatvfs=''
882i_systimes=''
883i_systypes=''
884i_sysuio=''
885i_sysun=''
886i_sysutsname=''
887i_sysvfs=''
888i_syswait=''
889i_sgtty=''
890i_termio=''
891i_termios=''
14b90194
JH
892d_tm_tm_gmtoff=''
893d_tm_tm_zone=''
b4eb6b3d
JH
894i_systime=''
895i_systimek=''
896i_time=''
897timeincl=''
898i_unistd=''
899i_ustat=''
900i_utime=''
901i_values=''
902i_stdarg=''
903i_varargs=''
904i_varhdr=''
905i_vfork=''
906inc_version_list=''
907inc_version_list_init=''
908installprefix=''
909installprefixexp=''
910installstyle=''
911installusrbinperl=''
912intsize=''
913longsize=''
914shortsize=''
4b661809 915issymlink=''
2304df62 916libc=''
b4eb6b3d
JH
917ldlibpthname=''
918libperl=''
919shrpenv=''
920useshrplib=''
a0d0e21e 921glibpth=''
2304df62 922libpth=''
8e07c86e 923loclibpth=''
2304df62
AD
924plibpth=''
925xlibpth=''
1cfa4ec7 926ignore_versioned_solibs=''
2304df62 927libs=''
43999f95
JH
928libsdirs=''
929libsfiles=''
930libsfound=''
13b3f787 931libspath=''
85e6fe83 932lns=''
b4eb6b3d
JH
933d_PRIEUldbl=''
934d_PRIFUldbl=''
935d_PRIGUldbl=''
936d_PRIeldbl=''
937d_PRIfldbl=''
938d_PRIgldbl=''
939d_SCNfldbl=''
940sPRIEUldbl=''
941sPRIFUldbl=''
942sPRIGUldbl=''
943sPRIeldbl=''
944sPRIfldbl=''
945sPRIgldbl=''
946sSCNfldbl=''
947lseeksize=''
948lseektype=''
8ff267be 949make_set_make=''
b4eb6b3d
JH
950d_mymalloc=''
951freetype=''
952mallocobj=''
953mallocsrc=''
954malloctype=''
9df442c2 955usemallocwrap=''
b4eb6b3d
JH
956usemymalloc=''
957installman1dir=''
958man1dir=''
959man1direxp=''
960man1ext=''
961installman3dir=''
962man3dir=''
963man3direxp=''
964man3ext=''
965modetype=''
966multiarch=''
967mydomain=''
968myhostname=''
969phostname=''
2304df62
AD
970c=''
971n=''
b4eb6b3d
JH
972d_eofnblk=''
973eagain=''
974o_nonblock=''
975rd_nodata=''
2cc61e15 976need_va_copy=''
b4eb6b3d
JH
977netdb_hlen_type=''
978netdb_host_type=''
979netdb_name_type=''
980netdb_net_type=''
981groupcat=''
982hostcat=''
983passcat=''
984orderlib=''
985ranlib=''
986d_perl_otherlibdirs=''
987otherlibdirs=''
2304df62
AD
988package=''
989spackage=''
b4eb6b3d
JH
990pager=''
991api_revision=''
992api_subversion=''
993api_version=''
994api_versionstring=''
995patchlevel=''
151e6568 996perl_patchlevel=''
b4eb6b3d
JH
997revision=''
998subversion=''
999version=''
861eb78d 1000version_patchlevel_string=''
b4eb6b3d
JH
1001perl5=''
1002perladmin=''
1003perlpath=''
1004d_nv_preserves_uv=''
f607920a 1005d_nv_zero_is_allbits_zero=''
b4eb6b3d
JH
1006i16size=''
1007i16type=''
1008i32size=''
1009i32type=''
1010i64size=''
1011i64type=''
1012i8size=''
1013i8type=''
1014ivsize=''
1015ivtype=''
53133ed1 1016nv_preserves_uv_bits=''
b4eb6b3d
JH
1017nvsize=''
1018nvtype=''
1019u16size=''
1020u16type=''
1021u32size=''
1022u32type=''
1023u64size=''
1024u64type=''
1025u8size=''
1026u8type=''
1027uvsize=''
1028uvtype=''
1029ivdformat=''
1030nvEUformat=''
1031nvFUformat=''
1032nvGUformat=''
1033nveformat=''
1034nvfformat=''
1035nvgformat=''
1036uvXUformat=''
1037uvoformat=''
1038uvuformat=''
1039uvxformat=''
1040pidtype=''
1041prefix=''
1042prefixexp=''
1043installprivlib=''
1044privlib=''
1045privlibexp=''
1046prototype=''
1047ptrsize=''
1048d_PRIXU64=''
1049d_PRId64=''
1050d_PRIi64=''
1051d_PRIo64=''
1052d_PRIu64=''
1053d_PRIx64=''
1054sPRIXU64=''
1055sPRId64=''
1056sPRIi64=''
1057sPRIo64=''
1058sPRIu64=''
1059sPRIx64=''
1060d_quad=''
1061quadkind=''
1062quadtype=''
1063uquadtype=''
1064drand01=''
1065randbits=''
1066randfunc=''
1067randseedtype=''
1068seedfunc=''
1069installscript=''
1070scriptdir=''
1071scriptdirexp=''
1072selectminbits=''
1073selecttype=''
8ff267be 1074sh=''
b4eb6b3d
JH
1075sig_count=''
1076sig_name=''
1077sig_name_init=''
1078sig_num=''
1079sig_num_init=''
76d3c696 1080sig_size=''
b4eb6b3d
JH
1081installsitearch=''
1082sitearch=''
1083sitearchexp=''
1084installsitebin=''
1085sitebin=''
1086sitebinexp=''
8d2cbf27
JH
1087installsitehtml1dir=''
1088sitehtml1dir=''
1089sitehtml1direxp=''
1090installsitehtml3dir=''
1091sitehtml3dir=''
1092sitehtml3direxp=''
b4eb6b3d
JH
1093installsitelib=''
1094sitelib=''
1095sitelib_stem=''
1096sitelibexp=''
91e123a8
JH
1097installsiteman1dir=''
1098siteman1dir=''
1099siteman1direxp=''
1100installsiteman3dir=''
1101siteman3dir=''
1102siteman3direxp=''
b4eb6b3d
JH
1103siteprefix=''
1104siteprefixexp=''
6e1038e0
MB
1105installsitescript=''
1106sitescript=''
1107sitescriptexp=''
b4eb6b3d
JH
1108sizesize=''
1109sizetype=''
a0d0e21e 1110so=''
b4eb6b3d 1111socksizetype=''
2304df62
AD
1112sharpbang=''
1113shsharp=''
1114spitshell=''
dfe9444c 1115src=''
b4eb6b3d
JH
1116ssizetype=''
1117startperl=''
2304df62 1118startsh=''
b4eb6b3d
JH
1119stdchar=''
1120d_stdio_stream_array=''
1121stdio_stream_array=''
1122sysman=''
5ff3f7a4 1123trnl=''
b4eb6b3d
JH
1124uidformat=''
1125uidsign=''
1126uidsize=''
1127uidtype=''
1128archname64=''
1129use64bitall=''
1130use64bitint=''
15b61c98 1131usefaststdio=''
b4eb6b3d
JH
1132ccflags_uselargefiles=''
1133ldflags_uselargefiles=''
1134libswanted_uselargefiles=''
1135uselargefiles=''
1136uselongdouble=''
1137usemorebits=''
1138usemultiplicity=''
2304df62 1139nm_opt=''
40a7a20a 1140nm_so_opt=''
2304df62
AD
1141runnm=''
1142usenm=''
b4eb6b3d 1143useperlio=''
db0f2be4 1144userelocatableinc=''
29209bc5 1145usesocks=''
b4eb6b3d
JH
1146d_oldpthreads=''
1147use5005threads=''
1148useithreads=''
9514c62b 1149usereentrant=''
b4eb6b3d 1150usethreads=''
2304df62 1151incpath=''
2304df62
AD
1152mips_type=''
1153usrinc=''
b4eb6b3d
JH
1154d_vendorarch=''
1155installvendorarch=''
1156vendorarch=''
1157vendorarchexp=''
1158d_vendorbin=''
1159installvendorbin=''
1160vendorbin=''
1161vendorbinexp=''
8d2cbf27
JH
1162installvendorhtml1dir=''
1163vendorhtml1dir=''
1164vendorhtml1direxp=''
1165installvendorhtml3dir=''
1166vendorhtml3dir=''
1167vendorhtml3direxp=''
b4eb6b3d
JH
1168d_vendorlib=''
1169installvendorlib=''
1170vendorlib=''
1171vendorlib_stem=''
1172vendorlibexp=''
91e123a8
JH
1173installvendorman1dir=''
1174vendorman1dir=''
1175vendorman1direxp=''
1176installvendorman3dir=''
1177vendorman3dir=''
1178vendorman3direxp=''
b4eb6b3d
JH
1179usevendorprefix=''
1180vendorprefix=''
1181vendorprefixexp=''
6e1038e0
MB
1182d_vendorscript=''
1183installvendorscript=''
1184vendorscript=''
1185vendorscriptexp=''
d56c5707 1186versiononly=''
b4eb6b3d
JH
1187defvoidused=''
1188voidflags=''
3659ebf1
JH
1189yacc=''
1190yaccflags=''
2304df62
AD
1191CONFIG=''
1192
ecfc5424
AD
1193define='define'
1194undef='undef'
1195smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1196rmlist=''
1197
1198: We must find out about Eunice early
1199eunicefix=':'
1200if test -f /etc/unixtovms; then
1201 eunicefix=/etc/unixtovms
1202fi
1203if test -f /etc/unixtovms.exe; then
1204 eunicefix=/etc/unixtovms.exe
1205fi
1206
cfb04860 1207: Set executable suffix now -- needed before hints available
6153ba32
PG
1208if test -f "/libs/version.library"; then
1209: Amiga OS
1210 _exe=""
1211elif test -f "/system/gnu_library/bin/ar.pm"; then
1212: Stratus VOS
cfb04860 1213 _exe=".pm"
6153ba32
PG
1214elif test -n "$DJGPP"; then
1215: DOS DJGPP
cfb04860 1216 _exe=".exe"
5c728af0 1217elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1218: OS/2 or cygwin
ba863942
JH
1219 _exe=".exe"
1220fi
868439a2 1221
b4eb6b3d 1222i_whoami=''
9da7673b
MB
1223ccname=''
1224ccversion=''
1225perllibs=''
1226: set useposix=false in your hint file to disable the POSIX extension.
1227useposix=true
1228: set useopcode=false in your hint file to disable the Opcode extension.
1229useopcode=true
1230: Trailing extension. Override this in a hint file, if needed.
1231: Extra object files, if any, needed on this platform.
1232archobjs=''
1233archname=''
ff935051
JH
1234: Possible local include directories to search.
1235: Set locincpth to "" in a hint file to defeat local include searches.
1236locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1237locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1238:
1239: no include file wanted by default
1240inclwanted=''
1241
b4eb6b3d 1242groupstype=''
64615a5e 1243libnames=''
732c9516
JH
1244: change the next line if compiling for Xenix/286 on Xenix/386
1245xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1246: Possible local library directories to search.
1247loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1248loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1249
1250: general looking path for locating libraries
5869b1f1 1251glibpth="/lib /usr/lib $xlibpth"
732c9516 1252glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1253test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1254test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1255
1256: Private path used by Configure to find libraries. Its value
1257: is prepended to libpth. This variable takes care of special
1258: machines, like the mips. Usually, it should be empty.
1259plibpth=''
1260
1cfa4ec7
GS
1261: default library list
1262libswanted=''
921b2963 1263: some systems want to use only the non-versioned libso:s
1cfa4ec7 1264ignore_versioned_solibs=''
9da7673b
MB
1265siteman1dir=''
1266siteman3dir=''
1267sitescript=''
b4eb6b3d
JH
1268archname64=''
1269ccflags_uselargefiles=''
1270ldflags_uselargefiles=''
1271libswanted_uselargefiles=''
1272: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1273: set usesocks on the Configure command line to enable socks.
b4eb6b3d 1274: set usethreads on the Configure command line to enable threads.
cd040c5e 1275usereentrant='undef'
9da7673b
MB
1276: full support for void wanted by default
1277defvoidused=15
1278
ecfc5424 1279: List of libraries we want.
15431986 1280: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef
AB
1281libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1282libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1283: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1284: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1285glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1286glibpth="/usr/shlib $glibpth"
1287: Do not use vfork unless overridden by a hint file.
1288usevfork=false
1289
8ff267be 1290: Find the basic shell for Bourne shell scripts
1291case "$sh" in
1292'')
8ff267be 1293 case "$SYSTYPE" in
1294 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1295 *) xxx='/bin/sh';;
1296 esac
1297 if test -f "$xxx"; then
1298 sh="$xxx"
1299 else
1300 : Build up a list and do a single loop so we can 'break' out.
1301 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1302 for xxx in sh bash ksh pdksh ash; do
1303 for p in $pth; do
1304 try="$try ${p}/${xxx}"
1305 done
1306 done
1307 for xxx in $try; do
1308 if test -f "$xxx"; then
1309 sh="$xxx";
8ff267be 1310 break
a5a94ea5
JH
1311 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1312 sh="$xxx";
1313 break
8ff267be 1314 elif test -f "$xxx.exe"; then
1315 sh="$xxx";
8ff267be 1316 break
1317 fi
1318 done
1319 fi
1320 ;;
1321esac
1322
1323case "$sh" in
a33c94aa 1324'') cat >&2 <<EOM
8ff267be 1325$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1326
8ff267be 1327Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1328Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1329we'll try to straighten this all out.
8ff267be 1330EOM
1331 exit 1
1332 ;;
1333esac
1334
760ac839 1335: see if sh knows # comments
73614538 1336if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1337 shsharp=true
1338 spitshell=cat
760ac839 1339 xcat=/bin/cat
a931254c
JH
1340 test -f $xcat$_exe || xcat=/usr/bin/cat
1341 if test ! -f $xcat$_exe; then
4bdb8fb5 1342 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1343 if test -f $p/cat$_exe; then
1deb0a86 1344 xcat=$p/cat
3c728e00
JH
1345 break
1346 fi
1347 done
1deb0a86
JH
1348 if test ! -f $xcat$_exe; then
1349 echo "Can't find cat anywhere!"
3c728e00
JH
1350 exit 1
1351 fi
1352 fi
5440bc8e
JH
1353 echo "#!$xcat" >sharp
1354 $eunicefix sharp
1355 chmod +x sharp
1356 ./sharp > today
760ac839 1357 if test -s today; then
760ac839
LW
1358 sharpbang='#!'
1359 else
5440bc8e
JH
1360 echo "#! $xcat" > sharp
1361 $eunicefix sharp
1362 chmod +x sharp
1363 ./sharp > today
760ac839 1364 if test -s today; then
760ac839
LW
1365 sharpbang='#! '
1366 else
760ac839
LW
1367 sharpbang=': use '
1368 fi
1369 fi
1370else
dfe9444c 1371 echo " "
8ff267be 1372 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1373 shsharp=false
1374 cd ..
1375 echo "exec grep -v '^[ ]*#'" >spitshell
1376 chmod +x spitshell
1377 $eunicefix spitshell
1378 spitshell=`pwd`/spitshell
1379 cd UU
1380 echo "I presume that if # doesn't work, #! won't work either!"
1381 sharpbang=': use '
1382fi
5440bc8e 1383rm -f sharp today
760ac839
LW
1384
1385: figure out how to guarantee sh startup
8ff267be 1386case "$startsh" in
1387'') startsh=${sharpbang}${sh} ;;
1388*)
760ac839 1389esac
5440bc8e 1390cat >sharp <<EOSS
760ac839
LW
1391$startsh
1392set abc
1393test "$?abc" != 1
1394EOSS
1395
5440bc8e
JH
1396chmod +x sharp
1397$eunicefix sharp
1398if ./sharp; then
8ff267be 1399 : echo "Yup, it does."
760ac839 1400else
dfe9444c
AD
1401 echo "Hmm... '$startsh' does not guarantee sh startup..."
1402 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1403fi
5440bc8e 1404rm -f sharp
760ac839 1405
aebf16e7
AD
1406
1407: Save command line options in file UU/cmdline.opt for later use in
1408: generating config.sh.
1409cat > cmdline.opt <<EOSH
1410# Configure command line arguments.
1411config_arg0='$0'
1412config_args='$*'
1413config_argc=$#
1414EOSH
1415argn=1
ee45ea83
IZ
1416args_exp=''
1417args_sep=''
aebf16e7
AD
1418for arg in "$@"; do
1419 cat >>cmdline.opt <<EOSH
1420config_arg$argn='$arg'
1421EOSH
ee45ea83
IZ
1422 # Extreme backslashitis: replace each ' by '"'"'
1423 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1424$arg
1425EOC
1426 arg_exp=`cat cmdl.opt`
1427 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1428 argn=`expr $argn + 1`
ee45ea83 1429 args_sep=' '
aebf16e7 1430done
ee45ea83
IZ
1431# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1432# used by ./hints/os2.sh
1433rm -f cmdl.opt
aebf16e7 1434
2304df62
AD
1435: produce awk script to parse command line options
1436cat >options.awk <<'EOF'
1437BEGIN {
02e93a22 1438 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1439
1440 len = length(optstr);
1441 for (i = 1; i <= len; i++) {
1442 c = substr(optstr, i, 1);
1443 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1444 if (a == ":") {
1445 arg[c] = 1;
1446 i++;
1447 }
1448 opt[c] = 1;
1449 }
1450}
1451{
1452 expect = 0;
1453 str = $0;
1454 if (substr(str, 1, 1) != "-") {
1455 printf("'%s'\n", str);
1456 next;
1457 }
1458 len = length($0);
1459 for (i = 2; i <= len; i++) {
1460 c = substr(str, i, 1);
1461 if (!opt[c]) {
1462 printf("-%s\n", substr(str, i));
1463 next;
1464 }
1465 printf("-%s\n", c);
1466 if (arg[c]) {
1467 if (i < len)
1468 printf("'%s'\n", substr(str, i + 1));
1469 else
1470 expect = 1;
1471 next;
1472 }
1473 }
1474}
1475END {
1476 if (expect)
1477 print "?";
1478}
1479EOF
1480
1481: process the command line options
4633a7c4
LW
1482set X `for arg in "$@"; do echo "X$arg"; done |
1483 sed -e s/X// | awk -f options.awk`
2304df62
AD
1484eval "set $*"
1485shift
1486rm -f options.awk
1487
1488: set up default values
1489fastread=''
1490reuseval=false
1491config_sh=''
1492alldone=''
1493error=''
1494silent=''
1495extractsh=''
ecfc5424 1496override=''
16d20bd9 1497knowitall=''
02e93a22 1498rm -f optdef.sh posthint.sh
28757baa 1499cat >optdef.sh <<EOS
1500$startsh
1501EOS
2304df62 1502
dfe9444c 1503
2304df62
AD
1504: option parsing
1505while test $# -gt 0; do
1506 case "$1" in
1507 -d) shift; fastread=yes;;
1508 -e) shift; alldone=cont;;
1509 -f)
1510 shift
1511 cd ..
1512 if test -r "$1"; then
1513 config_sh="$1"
1514 else
a0d0e21e 1515 echo "$me: cannot read config file $1." >&2
2304df62
AD
1516 error=true
1517 fi
1518 cd UU
1519 shift;;
1520 -h) shift; error=true;;
1521 -r) shift; reuseval=true;;
dfe9444c 1522 -s) shift; silent=true; realsilent=true;;
2304df62 1523 -E) shift; alldone=exit;;
16d20bd9 1524 -K) shift; knowitall=true;;
ecfc5424 1525 -O) shift; override=true;;
dfe9444c 1526 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1527 -D)
1528 shift
1529 case "$1" in
1530 *=)
1531 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1532 echo "$me: ignoring -D $1" >&2
1533 ;;
ecfc5424 1534 *=*) echo "$1" | \
1aef975c
AD
1535 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1536 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1537 esac
1538 shift
1539 ;;
1540 -U)
1541 shift
1542 case "$1" in
1aef975c 1543 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1544 *=*)
1545 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1546 echo "$me: ignoring -U $1" >&2
1547 ;;
1aef975c 1548 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1549 esac
1550 shift
1551 ;;
02e93a22
JH
1552 -A)
1553 shift
1554 xxx=''
1555 yyy="$1"
02e93a22 1556 zzz=''
5f83a3e9 1557 uuu=undef
02e93a22 1558 case "$yyy" in
f7c31117 1559 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1560 case "$zzz" in
1561 *:*) zzz='' ;;
1562 *) xxx=append
f7c31117
JH
1563 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1564 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1565 esac
1566 ;;
1567 esac
1568 case "$xxx" in
1569 '') case "$yyy" in
f7c31117
JH
1570 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1571 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1572 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1573 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1574 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1575 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9
JH
1576 esac
1577 ;;
1578 esac
02e93a22
JH
1579 case "$xxx" in
1580 append)
5f83a3e9 1581 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1582 clear)
5f83a3e9 1583 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1584 define)
1585 case "$zzz" in
1586 '') zzz=define ;;
1587 esac
5f83a3e9 1588 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1589 eval)
5f83a3e9 1590 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1591 prepend)
5f83a3e9 1592 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1593 undef)
1594 case "$zzz" in
1595 '') zzz="$uuu" ;;
1596 esac
5f83a3e9
JH
1597 echo "$yyy=$zzz" >> posthint.sh ;;
1598 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1599 esac
bde6b06b 1600 shift
02e93a22 1601 ;;
dfe9444c 1602 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1603 exit 0;;
2304df62 1604 --) break;;
a0d0e21e 1605 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1606 *) break;;
1607 esac
1608done
1609
1610case "$error" in
1611true)
1612 cat >&2 <<EOM
2afac517 1613Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1614 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1615 -d : use defaults for all answers.
1616 -e : go on without questioning past the production of config.sh.
1617 -f : specify an alternate default configuration file.
1618 -h : print this help message and exit (with an error status).
1619 -r : reuse C symbols value if possible (skips costly nm extraction).
1620 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1621 -D : define symbol to have some value:
1622 -D symbol symbol gets the value 'define'
1623 -D symbol=value symbol gets the value 'value'
2304df62 1624 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1625 -K : do not use unless you know what you are doing.
ecfc5424 1626 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1627 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1628 -U : undefine symbol:
1629 -U symbol symbol gets the value 'undef'
1630 -U symbol= symbol gets completely empty
02e93a22 1631 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1632 -A symbol=value append " "value to symbol
02e93a22
JH
1633 -A append:symbol=value append value to symbol
1634 -A define:symbol=value define symbol to have value
02e93a22
JH
1635 -A clear:symbol define symbol to be ''
1636 -A define:symbol define symbol to be 'define'
1637 -A eval:symbol=value define symbol to be eval of value
1638 -A prepend:symbol=value prepend value to symbol
1639 -A undef:symbol define symbol to be 'undef'
1640 -A undef:symbol= define symbol to be ''
2304df62
AD
1641 -V : print version number and exit (with a zero status).
1642EOM
1643 exit 1
1644 ;;
1645esac
1646
dfe9444c
AD
1647: Sanity checks
1648case "$fastread$alldone" in
1649yescont|yesexit) ;;
1650*)
aaeb8e51
GS
1651 case "$extractsh" in
1652 true) ;;
1653 *)
1654 if test ! -t 0; then
1655 echo "Say 'sh Configure', not 'sh <Configure'"
1656 exit 1
1657 fi
1658 ;;
1659 esac
dfe9444c
AD
1660 ;;
1661esac
1662
2304df62
AD
1663exec 4>&1
1664case "$silent" in
1665true) exec 1>/dev/null;;
1666esac
1667
ecfc5424 1668: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1669touch optdef.sh
1670. ./optdef.sh
02e93a22
JH
1671: create the posthint manipulation script and leave the file out there...
1672touch posthint.sh
a0d0e21e 1673
2304df62 1674: set package name
85e6fe83 1675package=perl5
b4eb6b3d
JH
1676first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1677last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1678case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1679ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1680*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1681esac
2304df62 1682
2304df62
AD
1683: Some greps do not return status, grrr.
1684echo "grimblepritz" >grimble
1685if grep blurfldyick grimble >/dev/null 2>&1 ; then
1686 contains=contains
1687elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1688 contains=grep
1689else
1690 contains=contains
1691fi
1692rm -f grimble
1693: the following should work in any shell
1694case "$contains" in
1695contains*)
1696 echo " "
1697 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1698 cat >contains <<'EOSS'
1699grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1700EOSS
1701chmod +x contains
1702esac
1703
dfe9444c
AD
1704: Find the path to the source tree
1705case "$src" in
1706'') case "$0" in
b233458b
JH
1707 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1708 case "$src" in
1709 /*) ;;
8504afb7 1710 .) ;;
b233458b
JH
1711 *) src=`cd ../$src && pwd` ;;
1712 esac
1713 ;;
dfe9444c
AD
1714 *) src='.';;
1715 esac;;
1716esac
1717case "$src" in
1718'') src=/
1719 rsrc=/
1720 ;;
1721/*) rsrc="$src";;
1722*) rsrc="../$src";;
1723esac
1724if test -f $rsrc/Configure && \
1725 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1726then
1727 : found it, so we are ok.
1728else
1729 rsrc=''
1730 for src in . .. ../.. ../../.. ../../../..; do
1731 if test -f ../$src/Configure && \
1732 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1733 then
1734 rsrc=../$src
1735 break
1736 fi
1737 done
1738fi
1739case "$rsrc" in
1740'')
1741 cat <<EOM >&4
1742
1743Sorry, I can't seem to locate the source dir for $package. Please start
1744Configure with an explicit path -- i.e. /some/path/Configure.
1745
1746EOM
1747 exit 1
1748 ;;
1749../.) rsrc='..';;
1750*)
1751 echo " "
1752 echo "Sources for $package found in \"$src\"." >&4
1753 ;;
1754esac
1755
1756: script used to extract .SH files with variable substitutions
1757cat >extract <<'EOS'
a02608de 1758PERL_CONFIG_SH=true
dfe9444c 1759echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1760if test -f MANIFEST; then
1761 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1762else
1763 echo "(Looking for .SH files under the source directory.)"
6904989c 1764 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1765fi
1766shift
1767case $# in
6904989c 17680) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1769esac
6904989c 1770if test ! -f "$src/$1"; then
dfe9444c
AD
1771 shift
1772fi
1773mkdir_p='
1774name=$1;
1775create="";
1776while test $name; do
1777 if test ! -d "$name"; then
1778 create="$name $create";
1779 name=`echo $name | sed -e "s|^[^/]*$||"`;
1780 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1781 else
1782 name="";
1783 fi;
1784done;
1785for file in $create; do
1786 mkdir $file;
1787done
1788'
1789for file in $*; do
1790 case "$src" in
1791 ".")
1792 case "$file" in
1793 */*)
1794 dir=`expr X$file : 'X\(.*\)/'`
1795 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1796 (cd "$dir" && . ./$file)
dfe9444c
AD
1797 ;;
1798 *)
1799 . ./$file
1800 ;;
1801 esac
1802 ;;
1803 *)
1804 case "$file" in
1805 */*)
1806 dir=`expr X$file : 'X\(.*\)/'`
1807 file=`expr X$file : 'X.*/\(.*\)'`
1808 (set x $dir; shift; eval $mkdir_p)
6904989c 1809 sh <"$src/$dir/$file"
dfe9444c
AD
1810 ;;
1811 *)
6904989c 1812 sh <"$src/$file"
dfe9444c
AD
1813 ;;
1814 esac
1815 ;;
1816 esac
1817done
6904989c 1818if test -f "$src/config_h.SH"; then
dfe9444c
AD
1819 if test ! -f config.h; then
1820 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1821 . "$src/config_h.SH"
dfe9444c
AD
1822 fi
1823fi
1824EOS
1825
1826: extract files and exit if asked to do so
1827case "$extractsh" in
1828true)
1829 case "$realsilent" in
1830 true) ;;
1831 *) exec 1>&4;;
1832 esac
1833 case "$config_sh" in
1834 '') config_sh='config.sh';;
1835 esac
1836 echo " "
1837 echo "Fetching answers from $config_sh..."
1838 cd ..
1839 . $config_sh
1840 test "$override" && . ./optdef.sh
1841 echo " "
1842 . UU/extract
1843 rm -rf UU
24ccb310 1844 echo "Extraction done."
dfe9444c
AD
1845 exit 0
1846 ;;
1847esac
1848
1849: Eunice requires " " instead of "", can you believe it
1850echo " "
1851: Here we go...
1852echo "Beginning of configuration questions for $package."
1853
1854trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1855
2304df62
AD
1856: first determine how to suppress newline on echo command
1857echo " "
1858echo "Checking echo to see how to suppress newlines..."
1859(echo "hi there\c" ; echo " ") >.echotmp
1860if $contains c .echotmp >/dev/null 2>&1 ; then
1861 echo "...using -n."
1862 n='-n'
1863 c=''
1864else
1865 cat <<'EOM'
1866...using \c
1867EOM
1868 n=''
1869 c='\c'
1870fi
1871echo $n "The star should be here-->$c"
1872echo '*'
1873rm -f .echotmp
1874
1875: Now test for existence of everything in MANIFEST
1876echo " "
6904989c 1877if test -f "$rsrc/MANIFEST"; then
2304df62 1878 echo "First let's make sure your kit is complete. Checking..." >&4
4242830c 1879 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
2304df62 1880 rm -f missing
dfe9444c 1881 tmppwd=`pwd`
2304df62 1882 for filelist in x??; do
6904989c 1883 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1884 done
1885 if test -s missing; then
1886 cat missing >&4
1887 cat >&4 <<'EOM'
1888
1889THIS PACKAGE SEEMS TO BE INCOMPLETE.
1890
1891You have the option of continuing the configuration process, despite the
1892distinct possibility that your kit is damaged, by typing 'y'es. If you
1893do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1894and contact the author (perlbug@perl.org).
2304df62
AD
1895
1896EOM
1897 echo $n "Continue? [n] $c" >&4
1898 read ans
1899 case "$ans" in
1900 y*)
1901 echo "Continuing..." >&4
1902 rm -f missing
1903 ;;
1904 *)
1905 echo "ABORTING..." >&4
1906 kill $$
1907 ;;
1908 esac
1909 else
dfe9444c 1910 echo "Looks good..."
2304df62
AD
1911 fi
1912else
1913 echo "There is no MANIFEST file. I hope your kit is complete !"
1914fi
1915rm -f missing x??
1916
5ff3f7a4
GS
1917echo " "
1918: Find the appropriate value for a newline for tr
1919if test -n "$DJGPP"; then
1920 trnl='\012'
1921fi
1922if test X"$trnl" = X; then
1923 case "`echo foo|tr '\n' x 2>/dev/null`" in
1924 foox) trnl='\n' ;;
1925 esac
1926fi
1927if test X"$trnl" = X; then
1928 case "`echo foo|tr '\012' x 2>/dev/null`" in
1929 foox) trnl='\012' ;;
1930 esac
1931fi
1932if test X"$trnl" = X; then
8be2c24c
JH
1933 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1934 fooxy) trnl='\n\r' ;;
1935 esac
1936fi
1937if test X"$trnl" = X; then
5ff3f7a4
GS
1938 cat <<EOM >&2
1939
1940$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1941
1942EOM
1943 exit 1
1944fi
1945
2304df62
AD
1946: compute the number of columns on the terminal for proper question formatting
1947case "$COLUMNS" in
1948'') COLUMNS='80';;
1949esac
1950
1951: set up the echo used in my read
1952myecho="case \"\$xxxm\" in
1953'') echo $n \"\$rp $c\" >&4;;
1954*) case \"\$rp\" in
1955 '') echo $n \"[\$xxxm] $c\";;
1956 *)
1957 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1958 echo \"\$rp\" >&4
1959 echo $n \"[\$xxxm] $c\" >&4
1960 else
1961 echo $n \"\$rp [\$xxxm] $c\" >&4
1962 fi
1963 ;;
1964 esac;;
1965esac"
1966
1967: now set up to do reads with possible shell escape and default assignment
1968cat <<EOSC >myread
28757baa 1969$startsh
2304df62
AD
1970xxxm=\$dflt
1971$myecho
1972ans='!'
1973case "\$fastread" in
1974yes) case "\$dflt" in
1975 '') ;;
1976 *) ans='';
1977 case "\$silent-\$rp" in
1978 true-) ;;
1979 *) echo " " >&4;;
1980 esac;;
1981 esac;;
1982*) case "\$silent" in
1983 true) case "\$rp" in
1984 '') ans='';;
1985 esac;;
1986 esac;;
1987esac
1988while expr "X\$ans" : "X!" >/dev/null; do
1989 read answ
1990 set x \$xxxm
1991 shift
dfe9444c 1992 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1993 case "\$answ" in
dfe9444c
AD
1994 "!")
1995 sh 1>&4
1996 echo " "
1997 $myecho
1998 ;;
1999 !*)
2000 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2001 shift
2002 sh 1>&4 -c "\$*"
2003 echo " "
2004 $myecho
2005 ;;
2304df62
AD
2006 "\$ans")
2007 case "\$ans" in
ecfc5424
AD
2008 \\&*)
2009 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2010 shift
2011 case "\$1" in
2012 -d)
2013 fastread=yes
40a7a20a 2014 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2015 ;;
2016 -*)
40a7a20a 2017 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2018 ;;
2019 esac
2020 $myecho
2021 ans=!
2022 ;;
2304df62
AD
2023 esac;;
2024 *)
2025 case "\$aok" in
2026 y)
2027 echo "*** Substitution done -- please confirm."
2028 xxxm="\$ans"
c9795ab7 2029 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2030 xxxm="\$ans"
2031 ans=!
2032 ;;
2033 *)
2034 echo "*** Error -- try again."
2035 ans=!
2036 ;;
2037 esac
2038 $myecho
2039 ;;
2040 esac
2041 case "\$ans\$xxxm\$nostick" in
2042 '')
2043 ans=!
2044 $myecho
2045 ;;
2046 esac
2047done
2048case "\$ans" in
2049'') ans="\$xxxm";;
2050esac
2051EOSC
2052
2053: create .config dir to save info across Configure sessions
2054test -d ../.config || mkdir ../.config
2055cat >../.config/README <<EOF
2056This directory created by Configure to save information that should
dfe9444c 2057persist across sessions for $package.
2304df62
AD
2058
2059You may safely delete it if you wish.
2060EOF
2061
9507cadf 2062xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2063case "$usedevel" in
0107c034 2064$define|true|[yY]*) ;;
9507cadf 2065*) case "$xversion" in
0107c034
JH
2066 *[13579])
2067 cat >&4 <<EOH
2068*** WHOA THERE!!! ***
2069
2070 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2071 The version of this $package distribution is $xversion, that is, odd,
2072 (as opposed to even) and that signifies a development release.
3d5d58b1 2073 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2074
2075 Do ***NOT*** install this into production use.
2076 Data corruption and crashes are possible.
2077
2078 It is most seriously suggested that you do not continue any further
2079 unless you want to help in developing and debugging Perl.
2080
6adc6a45
JH
2081 If you *still* want to build perl, you can answer 'y' now,
2082 or pass -Dusedevel to Configure.
2083
0107c034
JH
2084EOH
2085 rp='Do you really want to continue?'
2086 dflt='n'
2087 . ./myread
2088 case "$ans" in
8feeef0e
JH
2089 [yY]) echo >&4 "Okay, continuing."
2090 usedevel="$define" ;;
0107c034
JH
2091 *) echo >&4 "Okay, bye."
2092 exit 1
2093 ;;
2094 esac
2095 ;;
2096 esac
2097 ;;
2098esac
8feeef0e
JH
2099case "$usedevel" in
2100$define|true|[yY]*)
2101 case "$versiononly" in
2102 '') versiononly="$define" ;;
2103 esac
2104 case "$installusrbinperl" in
2105 '') installusrbinperl="$undef" ;;
2106 esac
2107 ;;
2108esac
0107c034 2109
2304df62
AD
2110: general instructions
2111needman=true
2112firsttime=true
760ac839 2113user=`(logname) 2>/dev/null`
dfe9444c
AD
2114case "$user" in
2115'') user=`whoami 2>&1`;;
760ac839 2116esac
2304df62
AD
2117if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2118 firsttime=false
2119 echo " "
2120 rp='Would you like to see the instructions?'
2121 dflt=n
2122 . ./myread
2123 case "$ans" in
2124 [yY]*) ;;
2125 *) needman=false;;
2126 esac
2127fi
2128if $needman; then
2129 cat <<EOH
4e2a5f63 2130
2304df62 2131This installation shell script will examine your system and ask you questions
a0d0e21e 2132to determine how the perl5 package should be installed. If you get
2304df62
AD
2133stuck on a question, you may use a ! shell escape to start a subshell or
2134execute a command. Many of the questions will have default answers in square
2135brackets; typing carriage return will give you the default.
2136
2137On some of the questions which ask for file or directory names you are allowed
2138to use the ~name construct to specify the login directory belonging to "name",
2139even if you don't have a shell which knows about that. Questions where this is
2140allowed will be marked "(~name ok)".
2141
2142EOH
2143 rp=''
2144 dflt='Type carriage return to continue'
2145 . ./myread
2146 cat <<'EOH'
2147
2148The prompter used in this script allows you to use shell variables and
2149backticks in your answers. You may use $1, $2, etc... to refer to the words
2150in the default answer, as if the default line was a set of arguments given to a
2151script shell. This means you may also use $* to repeat the whole default line,
2152so you do not have to re-type everything to add something to the default.
2153
2154Everytime there is a substitution, you will have to confirm. If there is an
2155error (e.g. an unmatched backtick), the default answer will remain unchanged
2156and you will be prompted again.
2157
2158If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2159the questions and use the computed defaults (or the previous answers if there
2160was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2161You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2162on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2163
2164EOH
2165 . ./myread
2166 cat <<EOH
2167
2168Much effort has been expended to ensure that this shell script will run on any
2169Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2170Configure and run it again. If you can't run Configure for some reason,
2171you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2172have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2173
2174This installation script affects things in two ways:
2175
21761) it may do direct variable substitutions on some of the files included
2177 in this kit.
21782) it builds a config.h file for inclusion in C programs. You may edit
2179 any of these files as the need arises after running this script.
2180
2181If you make a mistake on a question, there is no easy way to back up to it
2182currently. The easiest thing to do is to edit config.sh and rerun all the SH
2183files. Configure will offer to let you do this before it runs the SH files.
2184
2185EOH
2186 dflt='Type carriage return to continue'
2187 . ./myread
2188 case "$firsttime" in
2189 true) echo $user >>../.config/instruct;;
2190 esac
2191fi
2192
2304df62
AD
2193: find out where common programs are
2194echo " "
2195echo "Locating common programs..." >&4
2196cat <<EOSC >loc
2197$startsh
2198case \$# in
21990) exit 1;;
2200esac
2201thing=\$1
2202shift
2203dflt=\$1
2204shift
2205for dir in \$*; do
2206 case "\$thing" in
2207 .)
2208 if test -d \$dir/\$thing; then
2209 echo \$dir
2210 exit 0
2211 fi
2212 ;;
2213 *)
a0d0e21e 2214 for thisthing in \$dir/\$thing; do
ecfc5424 2215 : just loop through to pick last item
a0d0e21e 2216 done
25f94b33 2217 if test -f \$thisthing; then
a0d0e21e 2218 echo \$thisthing
2304df62 2219 exit 0
a5a94ea5
JH
2220 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2221 echo \$thisthing
2222 exit 0
2304df62 2223 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2224 if test -n "$DJGPP"; then
2225 echo \$dir/\$thing.exe
b921d661 2226 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2227 : on Eunice apparently
2228 echo \$dir/\$thing
b921d661 2229 exit 0
c4f23d77 2230 fi
2d736872 2231 exit 0
2304df62
AD
2232 fi
2233 ;;
2234 esac
2235done
2236echo \$dflt
2237exit 1
2238EOSC
2239chmod +x loc
2240$eunicefix loc
2241loclist="
2242awk
2243cat
f8006fac 2244chmod
b4eb6b3d
JH
2245comm
2246cp
2304df62
AD
2247echo
2248expr
2249grep
a0d0e21e 2250ls
b4eb6b3d 2251mkdir
2304df62
AD
2252rm
2253sed
b4eb6b3d 2254sort
85e6fe83 2255touch
2304df62 2256tr
b4eb6b3d 2257uniq
2304df62
AD
2258"
2259trylist="
2260Mcc
dfe9444c 2261ar
3659ebf1 2262bison
b4eb6b3d 2263byacc
2304df62 2264cpp
b4eb6b3d 2265csh
2304df62
AD
2266date
2267egrep
1fef16b3 2268gmake
8ff267be 2269gzip
b4eb6b3d 2270less
8ff267be 2271ln
3c728e00 2272make
b4eb6b3d 2273more
693762b4 2274nm
b4eb6b3d
JH
2275nroff
2276pg
2304df62
AD
2277test
2278uname
8ff267be 2279zip
2304df62 2280"
8e07c86e 2281pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2282pth="$pth /lib /usr/lib"
2283for file in $loclist; do
dfe9444c
AD
2284 eval xxx=\$$file
2285 case "$xxx" in
2286 /*|?:[\\/]*)
2287 if test -f "$xxx"; then
2288 : ok
2289 else
2290 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2291 xxx=`./loc $file $file $pth`
2292 fi
2293 ;;
2294 '') xxx=`./loc $file $file $pth`;;
2295 *) xxx=`./loc $xxx $xxx $pth`;;
2296 esac
a5a94ea5 2297 eval $file=$xxx$_exe
2304df62
AD
2298 eval _$file=$xxx
2299 case "$xxx" in
2300 /*)
2301 echo $file is in $xxx.
2302 ;;
8e07c86e
AD
2303 ?:[\\/]*)
2304 echo $file is in $xxx.
2305 ;;
2304df62 2306 *)
25f94b33
AD
2307 echo "I don't know where '$file' is, and my life depends on it." >&4
2308 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2309 exit 1
2304df62
AD
2310 ;;
2311 esac
2312done
2313echo " "
2314echo "Don't worry if any of the following aren't found..."
2315say=offhand
2316for file in $trylist; do
dfe9444c
AD
2317 eval xxx=\$$file
2318 case "$xxx" in
2319 /*|?:[\\/]*)
2320 if test -f "$xxx"; then
2321 : ok
2322 else
2323 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2324 xxx=`./loc $file $file $pth`
2325 fi
2326 ;;
2327 '') xxx=`./loc $file $file $pth`;;
2328 *) xxx=`./loc $xxx $xxx $pth`;;
2329 esac
306a8474 2330 eval $file=$xxx$_exe
2304df62
AD
2331 eval _$file=$xxx
2332 case "$xxx" in
2333 /*)
2334 echo $file is in $xxx.
2335 ;;
8e07c86e
AD
2336 ?:[\\/]*)
2337 echo $file is in $xxx.
2338 ;;
2304df62
AD
2339 *)
2340 echo "I don't see $file out there, $say."
2341 say=either
2342 ;;
2343 esac
2344done
2345case "$egrep" in
1fef16b3 2346egrep)
2304df62
AD
2347 echo "Substituting grep for egrep."
2348 egrep=$grep
868439a2 2349 _egrep=$grep
2304df62
AD
2350 ;;
2351esac
8ff267be 2352case "$ln" in
1fef16b3 2353ln)
8ff267be 2354 echo "Substituting cp for ln."
2355 ln=$cp
868439a2 2356 _ln=$cp
8ff267be 2357 ;;
2358esac
2e26f1d5
JH
2359case "$make" in
2360make)
2361 case "$gmake" in
2362 gmake)
2363 echo "I can't find make or gmake, and my life depends on it." >&4
2364 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2365 exit 1
2366 ;;
2367 esac
2368 ;;
2369esac
2370case "$gmake" in
2371gmake) ;;
2372*) # We can't have osname yet.
1fef16b3
JH
2373 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2374 # Assume that gmake, if found, is definitely GNU make
2375 # and prefer it over the system make.
2376 echo "Substituting gmake for make."
2377 make=$gmake
868439a2 2378 _make=$gmake
1fef16b3
JH
2379 fi
2380 ;;
a5a94ea5 2381esac
2304df62
AD
2382case "$test" in
2383test)
2384 echo "Hopefully test is built into your sh."
2385 ;;
2386*)
73614538 2387 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2388 echo "Using the test built into your sh."
2304df62
AD
2389 test=test
2390 _test=test
2391 fi
2392 ;;
2393esac
2394case "$echo" in
2395echo)
2396 echo "Hopefully echo is built into your sh."
2397 ;;
2398'') ;;
2399*)
2400 echo " "
2401echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2402 $echo $n "hi there$c" >foo1
2403 echo $n "hi there$c" >foo2
2404 if cmp foo1 foo2 >/dev/null 2>&1; then
2405 echo "They are compatible. In fact, they may be identical."
2406 else
2407 case "$n" in
2408 '-n') n='' c='\c';;
2409 *) n='-n' c='';;
2410 esac
2411 cat <<FOO
2412They are not compatible! You are probably running ksh on a non-USG system.
2413I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2414have echo built in and we may have to run some Bourne shell scripts. That
2415means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2416
2417FOO
2418 $echo $n "The star should be here-->$c"
2419 $echo "*"
2420 fi
2421 $rm -f foo1 foo2
2422 ;;
2423esac
2424
6b769f8f 2425cat <<EOS >trygcc
2573c5f9
JH
2426$startsh
2427EOS
6b769f8f 2428cat <<'EOSC' >>trygcc
2573c5f9
JH
2429case "$cc" in
2430'') ;;
2431*) $rm -f try try.*
2432 $cat >try.c <<EOM
2433int main(int argc, char *argv[]) {
2434 return 0;
2435}
2436EOM
e4778687 2437 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2438 :
2439 else
2440 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2441 despair=yes
2442 trygcc=yes
2443 case "$cc" in
2444 *gcc*) trygcc=no ;;
2445 esac
2446 case "`$cc -v -c try.c 2>&1`" in
2447 *gcc*) trygcc=no ;;
2448 esac
2449 if $test X"$trygcc" = Xyes; then
2450 if gcc -o try -c try.c; then
2451 echo " "
2452 echo "You seem to have a working gcc, though." >&4
2453 rp="Would you like to use it?"
2454 dflt=y
2455 if $test -f myread; then
2456 . ./myread
2457 else
2458 if $test -f UU/myread; then
2459 . ./UU/myread
2460 else
2461 echo "Cannot find myread, sorry. Aborting." >&2
2462 exit 1
2463 fi
2464 fi
2465 case "$ans" in
6371411c
RB
2466 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2467 if $test -f usethreads.cbu; then
2468 $cat >&4 <<EOM
2469
2470*** However, any setting of the C compiler flags (e.g. for thread support)
2471*** has been lost. It may be necessary to pass -Dcc=gcc to Configure
2472*** (together with e.g. -Dusethreads).
2473
2474EOM
2475 fi;;
2573c5f9
JH
2476 esac
2477 fi
2478 fi
6b769f8f
RB
2479 fi
2480 $rm -f try try.*
2481 ;;
2482esac
2483EOSC
2484
2485cat <<EOS >checkcc
2486$startsh
2487EOS
2488cat <<'EOSC' >>checkcc
2489case "$cc" in
2490'') ;;
2491*) $rm -f try try.*
2492 $cat >try.c <<EOM
2493int main(int argc, char *argv[]) {
2494 return 0;
2495}
2496EOM
2497 if $cc -o try $ccflags $ldflags try.c; then
2498 :
2499 else
2573c5f9 2500 if $test X"$despair" = Xyes; then
6b769f8f
RB
2501 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2502 fi
2503 $cat >&4 <<EOM
5dd4fbdf
MB
2504You need to find a working C compiler.
2505Either (purchase and) install the C compiler supplied by your OS vendor,
2506or for a free C compiler try http://gcc.gnu.org/
2507I cannot continue any further, aborting.
2508EOM
6b769f8f 2509 exit 1
2573c5f9
JH
2510 fi
2511 $rm -f try try.*
2512 ;;
2513esac
2514EOSC
2515
a0d0e21e
LW
2516: determine whether symbolic links are supported
2517echo " "
2518$touch blurfl
2519if $ln -s blurfl sym > /dev/null 2>&1 ; then
2520 echo "Symbolic links are supported." >&4
818f00be 2521 lns="$ln -s"
a0d0e21e
LW
2522else
2523 echo "Symbolic links are NOT supported." >&4
2524 lns="$ln"
2525fi
2526$rm -f blurfl sym
2527
dafca956
JH
2528: determine whether symbolic links are supported
2529echo " "
2530case "$lns" in
18ea2752 2531*"ln"*" -s")
dafca956
JH
2532 echo "Checking how to test for symbolic links..." >&4
2533 $lns blurfl sym
4b661809 2534 if $test "X$issymlink" = X; then
2e2a97a6
JH
2535 case "$newsh" in
2536 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2537 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2538 esac
5d644a95
MB
2539 if test $? = 0; then
2540 issymlink="test -h"
2e2a97a6
JH
2541 else
2542 echo "Your builtin 'test -h' may be broken." >&4
2543 case "$test" in
2544 /*) ;;
2545 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2546 for p in $pth
2547 do
2548 if test -f "$p/$test"; then
2549 test="$p/$test"
2550 break
2551 fi
2552 done
2553 ;;
2554 esac
2555 case "$test" in
2556 /*)
2557 echo "Trying external '$test -h'." >&4
2558 issymlink="$test -h"
2559 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2560 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2561 issymlink=''
2562 fi
2563 ;;
2564 *) issymlink='' ;;
2565 esac
5d644a95
MB
2566 fi
2567 fi
4b661809 2568 if $test "X$issymlink" = X; then
dafca956 2569 if $test -L sym 2>/dev/null; then
5d644a95 2570 issymlink="$test -L"
2e2a97a6 2571 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2572 fi
2573 fi
4b661809 2574 if $test "X$issymlink" != X; then
5d644a95 2575 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2576 else
2577 echo "I do not know how you can test for symbolic links." >&4
2578 fi
2579 $rm -f blurfl sym
2580 ;;
2581*) echo "No symbolic links, so not testing for their testing..." >&4
2582 ;;
2583esac
2584echo " "
2585
2586
2587case "$mksymlinks" in
2588$define|true|[yY]*)
2589 case "$src" in
2590 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2591 exit 1
2592 ;;
4b661809 2593 *) case "$lns:$issymlink" in
f314eb9f 2594 *"ln"*" -s:"*"test -"?)
dafca956
JH
2595 echo "Creating the symbolic links..." >&4
2596 echo "(First creating the subdirectories...)" >&4
2597 cd ..
2598 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2599 read directory
2600 test -z "$directory" && break
2601 mkdir -p $directory
2602 done
2603 # Sanity check 1.
2604 if test ! -d t/base; then
2605 echo "Failed to create the subdirectories. Aborting." >&4
2606 exit 1
2607 fi
2608 echo "(Then creating the symlinks...)" >&4
2609 awk '{print $1}' $src/MANIFEST | while true; do
2610 read filename
2611 test -z "$filename" && break
2612 if test -f $filename; then
5d644a95 2613 if $issymlink $filename; then
dafca956
JH
2614 rm -f $filename
2615 fi
2616 fi
2617 if test -f $filename; then
2618 echo "$filename already exists, not symlinking."
2619 else
2620 ln -s $src/$filename $filename
2621 fi
2622 done
2623 # Sanity check 2.
a0d24b8a
JH
2624 if test ! -f t/base/lex.t; then
2625 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2626 exit 1
2627 fi
2628 cd UU
2629 ;;
2630 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2631 ;;
2632 esac
2633 ;;
2634 esac
2635 ;;
2636esac
2637
5440bc8e
JH
2638
2639case "$usecrosscompile" in
2640$define|true|[yY]*)
93bc48fa 2641 $echo "Cross-compiling..."
5440bc8e
JH
2642 croak=''
2643 case "$cc" in
2644 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2645 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2646 ar=$targetarch-ar
2647 # leave out ld, choosing it is more complex
2648 nm=$targetarch-nm
2649 ranlib=$targetarch-ranlib
93bc48fa 2650 $echo 'extern int foo;' > try.c
f8006fac 2651 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2652 shift
2653 if $test $# -gt 0; then
2654 incpth="$incpth $*"
f8006fac
JH
2655 incpth="`$echo $incpth|$sed 's/^ //'`"
2656 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2657 for i in $*; do
f8006fac 2658 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2659 if $test -d $j; then
2660 libpth="$libpth $j"
2661 fi
2662 done
f8006fac
JH
2663 libpth="`$echo $libpth|$sed 's/^ //'`"
2664 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2665 fi
2666 $rm -f try.c
5440bc8e
JH
2667 ;;
2668 esac
2669 case "$targetarch" in
93bc48fa
JH
2670 '') echo "Targetarch not defined." >&4; croak=y ;;
2671 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2672 esac
2673 case "$incpth" in
93bc48fa 2674 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2675 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2676 esac
2677 case "$libpth" in
93bc48fa 2678 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2679 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2680 esac
93bc48fa
JH
2681 case "$usrinc" in
2682 '') for i in $incpth; do
2683 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2684 usrinc=$i
2685 echo "Guessing usrinc $usrinc." >&4
2686 break
2687 fi
2688 done
2689 case "$usrinc" in
2690 '') echo "Usrinc not defined." >&4; croak=y ;;
2691 esac
2692 ;;
2693 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2694 esac
93bc48fa
JH
2695 case "$targethost" in
2696 '') echo "Targethost not defined." >&4; croak=y ;;
2697 *) echo "Using targethost $targethost." >&4
5440bc8e 2698 esac
93bc48fa
JH
2699 locincpth=' '
2700 loclibpth=' '
5440bc8e 2701 case "$croak" in
93bc48fa 2702 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2703 esac
2704 case "$src" in
2705 /*) run=$src/Cross/run
93c0359c 2706 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2707 to=$src/Cross/to
2708 from=$src/Cross/from
2709 ;;
93bc48fa 2710 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2711 run=$pwd/Cross/run
f8006fac 2712 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2713 to=$pwd/Cross/to
2714 from=$pwd/Cross/from
2715 ;;
2716 esac
2717 case "$targetrun" in
2718 '') targetrun=ssh ;;
2719 esac
2720 case "$targetto" in
2721 '') targetto=scp ;;
2722 esac
2723 case "$targetfrom" in
2724 '') targetfrom=scp ;;
2725 esac
2726 run=$run-$targetrun
2727 to=$to-$targetto
2728 from=$from-$targetfrom
93bc48fa
JH
2729 case "$targetdir" in
2730 '') targetdir=/tmp
2731 echo "Guessing targetdir $targetdir." >&4
2732 ;;
2733 esac
5440bc8e 2734 case "$targetuser" in
93bc48fa
JH
2735 '') targetuser=root
2736 echo "Guessing targetuser $targetuser." >&4
2737 ;;
5440bc8e
JH
2738 esac
2739 case "$targetfrom" in
2740 scp) q=-q ;;
2741 *) q='' ;;
2742 esac
2743 case "$targetrun" in
2744 ssh|rsh)
2745 cat >$run <<EOF
2746#!/bin/sh
93c0359c
JH
2747case "\$1" in
2748-cwd)
2749 shift
2750 cwd=\$1
2751 shift
2752 ;;
2753esac
2754case "\$cwd" in
2755'') cwd=$targetdir ;;
2756esac
5440bc8e
JH
2757exe=\$1
2758shift
93c0359c
JH
2759if $test ! -f \$exe.xok; then
2760 $to \$exe
2761 $touch \$exe.xok
2762fi
2763$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2764EOF
2765 ;;
93bc48fa 2766 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2767 exit 1
2768 ;;
2769 esac
93c0359c
JH
2770 case "$targetmkdir" in
2771 */Cross/mkdir)
2772 cat >$targetmkdir <<EOF
2773#!/bin/sh
2774$targetrun -l $targetuser $targethost "mkdir -p \$@"
2775EOF
f8006fac 2776 $chmod a+rx $targetmkdir
93c0359c
JH
2777 ;;
2778 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2779 exit 1
2780 ;;
2781 esac
5440bc8e
JH
2782 case "$targetto" in
2783 scp|rcp)
2784 cat >$to <<EOF
2785#!/bin/sh
2786for f in \$@
2787do
93c0359c
JH
2788 case "\$f" in
2789 /*)
2790 $targetmkdir \`dirname \$f\`
2791 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2792 ;;
2793 *)
2794 $targetmkdir $targetdir/\`dirname \$f\`
2795 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2796 ;;
2797 esac
5440bc8e
JH
2798done
2799exit 0
2800EOF
2801 ;;
2802 cp) cat >$to <<EOF
2803#!/bin/sh
93c0359c
JH
2804for f in \$@
2805do
2806 case "\$f" in
2807 /*)
2808 $mkdir -p $targetdir/\`dirname \$f\`
2809 $cp \$f $targetdir/\$f || exit 1
2810 ;;
2811 *)
2812 $targetmkdir $targetdir/\`dirname \$f\`
2813 $cp \$f $targetdir/\$f || exit 1
2814 ;;
2815 esac
2816done
2817exit 0
5440bc8e
JH
2818EOF
2819 ;;
93bc48fa 2820 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2821 exit 1
2822 ;;
2823 esac
2824 case "$targetfrom" in
2825 scp|rcp)
2826 cat >$from <<EOF
2827#!/bin/sh
2828for f in \$@
2829do
93c0359c 2830 $rm -f \$f
5440bc8e
JH
2831 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2832done
2833exit 0
2834EOF
2835 ;;
2836 cp) cat >$from <<EOF
2837#!/bin/sh
2838for f in \$@
2839do
93c0359c 2840 $rm -f \$f
5440bc8e
JH
2841 cp $targetdir/\$f . || exit 1
2842done
2843exit 0
2844EOF
2845 ;;
93bc48fa 2846 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2847 exit 1
2848 ;;
2849 esac
93bc48fa
JH
2850 if $test ! -f $run; then
2851 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2852 else
f8006fac 2853 $chmod a+rx $run
5440bc8e 2854 fi
93bc48fa
JH
2855 if $test ! -f $to; then
2856 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2857 else
f8006fac 2858 $chmod a+rx $to
5440bc8e 2859 fi
93bc48fa
JH
2860 if $test ! -f $from; then
2861 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2862 else
f8006fac 2863 $chmod a+rx $from
5440bc8e 2864 fi
93bc48fa 2865 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2866 exit 1
2867 fi
2868 cat >&4 <<EOF
f8006fac
JH
2869Using '$run' for remote execution,
2870and '$from' and '$to'
93bc48fa 2871for remote file transfer.
5440bc8e
JH
2872EOF
2873 ;;
2874*) run=''
2875 to=:
2876 from=:
2877 usecrosscompile='undef'
2878 targetarch=''
2879 ;;
2880esac
2881
ecfc5424
AD
2882: see whether [:lower:] and [:upper:] are supported character classes
2883echo " "
ecfc5424
AD
2884case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2885ABYZ)
2886 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2887 up='[:upper:]'
2888 low='[:lower:]'
2889 ;;
416d0bea
MB
2890*) # There is a discontinuity in EBCDIC between 'R' and 'S'
2891 # (0xd9 and 0xe2), therefore that is a nice testing point.
2892 if test "X$up" = X -o "X$low" = X; then
2893 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2894 rs) up='[A-Z]'
2895 low='[a-z]'
28e8609d
JH
2896 ;;
2897 esac
416d0bea 2898 fi
28e8609d 2899 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2900 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2901 rs) up='A-Z'
28e8609d
JH
2902 low='a-z'
2903 ;;
2904 esac
416d0bea 2905 fi
28e8609d 2906 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2907 case "`echo RS | od -x 2>/dev/null`" in
2908 *D9E2*|*d9e2*)
28e8609d
JH
2909 echo "Hey, this might be EBCDIC." >&4
2910 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2911 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2912 rs) up='[A-IJ-RS-Z]'
2913 low='[a-ij-rs-z]'
28e8609d
JH
2914 ;;
2915 esac
2916 fi
2917 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2918 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2919 rs) up='A-IJ-RS-Z'
2920 low='a-ij-rs-z'
28e8609d
JH
2921 ;;
2922 esac
2923 fi
2924 ;;
2925 esac
2926 fi
2927esac
416d0bea
MB
2928case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2929rs)
28e8609d
JH
2930 echo "Using $up and $low to convert case." >&4
2931 ;;
ecfc5424 2932*)
28e8609d
JH
2933 echo "I don't know how to translate letters from upper to lower case." >&4
2934 echo "Your tr is not acting any way I know of." >&4
2935 exit 1
2936 ;;
ecfc5424
AD
2937esac
2938: set up the translation script tr, must be called with ./tr of course
2939cat >tr <<EOSC
2940$startsh
2941case "\$1\$2" in
2942'[A-Z][a-z]') exec $tr '$up' '$low';;
2943'[a-z][A-Z]') exec $tr '$low' '$up';;
2944esac
2945exec $tr "\$@"
2946EOSC
2947chmod +x tr
2948$eunicefix tr
2949
2304df62
AD
2950: Try to determine whether config.sh was made on this system
2951case "$config_sh" in
2952'')
43999f95
JH
2953myuname=`$uname -a 2>/dev/null`
2954$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2955# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2956# because the A-Z/a-z are not consecutive.
a0d0e21e 2957myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2958 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2959newmyuname="$myuname"
2304df62 2960dflt=n
16d20bd9
AD
2961case "$knowitall" in
2962'')
2963 if test -f ../config.sh; then
2964 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2965 eval "`grep myuname= ../config.sh`"
2966 fi
2967 if test "X$myuname" = "X$newmyuname"; then
2968 dflt=y
2969 fi
2304df62 2970 fi
16d20bd9
AD
2971 ;;
2972*) dflt=y;;
2973esac
2304df62
AD
2974
2975: Get old answers from old config file if Configure was run on the
2976: same system, otherwise use the hints.
2977hint=default
2978cd ..
2979if test -f config.sh; then
16d20bd9
AD
2980 echo " "
2981 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2982 . UU/myread
2983 case "$ans" in
f83701cd
AD
2984 n*|N*) echo "OK, I'll ignore it."
2985 mv config.sh config.sh.old
2986 myuname="$newmyuname"
2987 ;;
2304df62 2988 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2989 tmp_n="$n"
2990 tmp_c="$c"
85cad39c 2991 tmp_sh="$sh"
2304df62
AD
2992 . ./config.sh
2993 cp config.sh UU
ecfc5424
AD
2994 n="$tmp_n"
2995 c="$tmp_c"
85cad39c 2996 : Older versions did not always set $sh. Catch re-use of such
2997 : an old config.sh.
2998 case "$sh" in
2999 '') sh="$tmp_sh" ;;
3000 esac
2304df62
AD
3001 hint=previous
3002 ;;
3003 esac
3004fi
2573c5f9 3005. ./UU/checkcc
2304df62
AD
3006if test ! -f config.sh; then
3007 $cat <<EOM
3008
4e2a5f63
AD
3009First time through, eh? I have some defaults handy for some systems
3010that need some extra help getting the Configure answers right:
2304df62
AD
3011
3012EOM
dfe9444c 3013 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3014 dflt=''
3015 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3016 : tests or hints, please send them to perlbug@perl.org
2304df62 3017 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3018 $test -f /irix && osname=irix
85e6fe83
LW
3019 $test -f /xenix && osname=sco_xenix
3020 $test -f /dynix && osname=dynix
3021 $test -f /dnix && osname=dnix
5f05dabc 3022 $test -f /lynx.os && osname=lynxos
3023 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3024 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3025 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3026 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3027 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3028 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3029 $test -d /usr/apollo/bin && osname=apollo
3030 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3031 $test -d /usr/include/minix && osname=minix
d54344fc 3032 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3033 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3034 osname=machten
4633a7c4 3035 if $test -x /sbin/version; then
dfe9444c 3036 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3037 $sed -e 's/[A-Za-z]$//'`
3038 elif $test -x /usr/etc/version; then
dfe9444c 3039 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3040 $sed -e 's/[A-Za-z]$//'`
3041 else
3042 osvers="$2.$3"
3043 fi
3044 fi
aaacdc8b
GS
3045
3046 $test -f /sys/posix.dll &&
3047 $test -f /usr/bin/what &&
3048 set X `/usr/bin/what /sys/posix.dll` &&
3049 $test "$3" = UWIN &&
3050 osname=uwin &&
3051 osvers="$5"
3052
2304df62
AD
3053 if $test -f $uname; then
3054 set X $myuname
3055 shift
3056
2304df62 3057 case "$5" in
85e6fe83 3058 fps*) osname=fps ;;
2304df62
AD
3059 mips*)
3060 case "$4" in
85e6fe83
LW
3061 umips) osname=umips ;;
3062 *) osname=mips ;;
2304df62 3063 esac;;
85e6fe83
LW
3064 [23]100) osname=mips ;;
3065 next*) osname=next ;;
ecfc5424 3066 i386*)
c6912327
JH
3067 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3068 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3069 osname='sco'
3070 osvers=$tmp
3071 elif $test -f /etc/kconfig; then
ecfc5424 3072 osname=isc
bd628c73 3073 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3074 osvers=4
3075 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3076 osvers=3
2304df62 3077 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3078 osvers=2
ecfc5424
AD
3079 fi
3080 fi
2000072c 3081 tmp=''
ecfc5424 3082 ;;
c4f23d77
AD
3083 pc*)
3084 if test -n "$DJGPP"; then
3085 osname=dos
3086 osvers=djgpp
3087 fi
3088 ;;
2304df62
AD
3089 esac
3090
3091 case "$1" in
a0d0e21e
LW
3092 aix) osname=aix
3093 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3094 case "$tmp" in
e81c5c2a
NC
3095 # oslevel can fail with:
3096 # oslevel: Unable to acquire lock.
3097 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3098 '<3240'|'<>3240') osvers=3.2.0 ;;
3099 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3100 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3101 *) osvers=$tmp;;
a0d0e21e
LW
3102 esac
3103 ;;
aaacdc8b
GS
3104 bsd386) osname=bsd386
3105 osvers=`$uname -r`
3106 ;;
3107 cygwin*) osname=cygwin
3108 osvers="$3"
3109 ;;
23f87696
SZ
3110 *dc.osx) osname=dcosx
3111 osvers="$3"
3112 ;;
a0d0e21e
LW
3113 dnix) osname=dnix
3114 osvers="$3"
3115 ;;
3116 domainos) osname=apollo
3117 osvers="$3"
3118 ;;
761ee4e8 3119 dgux) osname=dgux
a0d0e21e
LW
3120 osvers="$3"
3121 ;;
760ac839 3122 dynixptx*) osname=dynixptx
e58e581d 3123 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3124 ;;
a0d0e21e
LW
3125 freebsd) osname=freebsd
3126 osvers="$3" ;;
761ee4e8
BD
3127 genix) osname=genix ;;
3128 gnu) osname=gnu
3129 osvers="$3" ;;
3130 hp*) osname=hpux
bfb7748a 3131 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3132 ;;
761ee4e8 3133 irix*) osname=irix
a0d0e21e
LW
3134 case "$3" in
3135 4*) osvers=4 ;;
3136 5*) osvers=5 ;;
ecfc5424 3137 *) osvers="$3" ;;
a0d0e21e
LW
3138 esac
3139 ;;
761ee4e8 3140 linux) osname=linux
a0d0e21e 3141 case "$3" in
a0d0e21e
LW
3142 *) osvers="$3" ;;
3143 esac
3144 ;;
761ee4e8 3145 MiNT) osname=mint
28e8609d
JH
3146 ;;
3147 netbsd*) osname=netbsd
ecfc5424
AD
3148 osvers="$3"
3149 ;;
4e81affe
MM
3150 news-os) osvers="$3"
3151 case "$3" in
3152 4*) osname=newsos4 ;;
3153 *) osname=newsos ;;
3154 esac
3155 ;;
aaacdc8b 3156 next*) osname=next ;;
28bb1e2c 3157 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3158 openbsd) osname=openbsd
3159 osvers="$3"
3160 ;;
5c728af0
IZ
3161 os2) osname=os2
3162 osvers="$4"
3163 ;;
aaacdc8b
GS
3164 POSIX-BC | posix-bc ) osname=posix-bc
3165 osvers="$3"
a0d0e21e 3166 ;;
ae3afa4e
TH
3167 powerux | power_ux | powermax_os | powermaxos | \
3168 powerunix | power_unix) osname=powerux
3169 osvers="$3"
3170 ;;
aaacdc8b
GS
3171 qnx) osname=qnx
3172 osvers="$4"
3173 ;;
a0d0e21e
LW
3174 solaris) osname=solaris
3175 case "$3" in
3176 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3177 *) osvers="$3" ;;
a0d0e21e
LW
3178 esac
3179 ;;
85e6fe83
LW
3180 sunos) osname=sunos
3181 case "$3" in
85e6fe83
LW
3182 5*) osname=solaris
3183 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3184 *) osvers="$3" ;;
2304df62
AD
3185 esac
3186 ;;
a0d0e21e 3187 titanos) osname=titanos
85e6fe83 3188 case "$3" in
a0d0e21e
LW
3189 1*) osvers=1 ;;
3190 2*) osvers=2 ;;
3191 3*) osvers=3 ;;
3192 4*) osvers=4 ;;
ecfc5424 3193 *) osvers="$3" ;;
2304df62
AD
3194 esac
3195 ;;
85e6fe83 3196 ultrix) osname=ultrix
ecfc5424 3197 osvers="$3"
2304df62 3198 ;;
28757baa 3199 osf1|mls+) case "$5" in
fed7345c
AD
3200 alpha)
3201 osname=dec_osf
fdd85a03 3202 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3203 case "$osvers" in
3204 [1-9].[0-9]*) ;;
3205 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3206 esac
ecfc5424
AD
3207 ;;
3208 hp*) osname=hp_osf1 ;;
3209 mips) osname=mips_osf1 ;;
85e6fe83
LW
3210 esac
3211 ;;
af1ff193 3212 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3213 openunix|unixware) osname=svr5
0337d152
BG
3214 osvers="$4"
3215 ;;
3c728e00 3216 uts) osname=uts
a0d0e21e
LW
3217 osvers="$3"
3218 ;;
3c728e00
JH
3219 vos) osvers="$3"
3220 ;;
85e6fe83 3221 $2) case "$osname" in
2304df62 3222 *isc*) ;;
a0d0e21e 3223 *freebsd*) ;;
5f05dabc 3224 svr*)
a0d0e21e
LW
3225 : svr4.x or possibly later
3226 case "svr$3" in
3227 ${osname}*)
3228 osname=svr$3
3229 osvers=$4
3230 ;;
3231 esac
3232 case "$osname" in
3233 svr4.0)
3234 : Check for ESIX
3235 if test -f /stand/boot ; then
3236 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3237 if test -n "$INITPROG" -a -f "$INITPROG"; then
3238 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3239 if test -n "$isesix"; then
a0d0e21e
LW
3240 osname=esix4
3241 fi
3242 fi
3243 fi
3244 ;;
3245 esac
3246 ;;
2304df62 3247 *) if test -f /etc/systemid; then
a0d0e21e
LW
3248 osname=sco
3249 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3250 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3251 osvers=$1.$2.$3
c4f23d77 3252 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3253 osvers=$1.$2
c4f23d77 3254 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3255 osvers=$1
2304df62 3256 fi
a0d0e21e
LW
3257 else
3258 case "$osname" in
3259 '') : Still unknown. Probably a generic Sys V.
3260 osname="sysv"
3261 osvers="$3"
3262 ;;
3263 esac
2304df62
AD
3264 fi
3265 ;;
3266 esac
3267 ;;
a0d0e21e
LW
3268 *) case "$osname" in
3269 '') : Still unknown. Probably a generic BSD.
3270 osname="$1"
3271 osvers="$3"
3272 ;;
3273 esac
3274 ;;
2304df62
AD
3275 esac
3276 else
dfe9444c
AD
3277 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3278 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3279 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3280 osname=news_os
2304df62 3281 fi
dfe9444c 3282 $rm -f UU/kernel.what
5c728af0 3283 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3284 set X $myuname
3285 osname=os2
3286 osvers="$5"
2304df62
AD
3287 fi
3288 fi
85e6fe83 3289
5440bc8e
JH
3290 case "$targetarch" in
3291 '') ;;
3292 *) hostarch=$osname
3293 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3294 osvers=''
3295 ;;
3296 esac
3297
a0d0e21e
LW
3298 : Now look for a hint file osname_osvers, unless one has been
3299 : specified already.
3300 case "$hintfile" in
3301 ''|' ')
1e127011 3302 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3303 : Also try without trailing minor version numbers.
1e127011
DD
3304 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3305 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3306 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3307 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3308 case "$file" in
3309 '') dflt=none ;;
3310 *) case "$osvers" in
3311 '') dflt=$file
3312 ;;
dfe9444c 3313 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3314 dflt=$file
dfe9444c 3315 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3316 dflt=$xfile
dfe9444c 3317 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3318 dflt=$xxfile
dfe9444c 3319 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3320 dflt=$xxxfile
dfe9444c 3321 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3322 dflt=$xxxxfile
dfe9444c 3323 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3324 dflt="${osname}"
3325 else
3326 dflt=none
3327 fi
3328 ;;
3329 esac
85e6fe83
LW
3330 ;;
3331 esac
4e2a5f63
AD
3332 if $test -f Policy.sh ; then
3333 case "$dflt" in
3334 *Policy*) ;;
3335 none) dflt="Policy" ;;
3336 *) dflt="Policy $dflt" ;;
3337 esac
3338 fi
85e6fe83 3339 ;;
a0d0e21e 3340 *)
ecfc5424 3341 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3342 ;;
2304df62 3343 esac
1aef975c 3344
4e2a5f63
AD
3345 if $test -f Policy.sh ; then
3346 $cat <<EOM
3347
3348There's also a Policy hint file available, which should make the
3349site-specific (policy) questions easier to answer.
3350EOM
3351
3352 fi
3353
2304df62
AD
3354 $cat <<EOM
3355
3356You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 3357A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 3358is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
3359
3360EOM
4e2a5f63 3361
2304df62 3362 rp="Which of these apply, if any?"
dfe9444c 3363 . UU/myread
85e6fe83
LW
3364 tans=$ans
3365 for file in $tans; do
4e2a5f63
AD
3366 if $test X$file = XPolicy -a -f Policy.sh; then
3367 . Policy.sh
3368 $cat Policy.sh >> UU/config.sh
3369 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3370 . $src/hints/$file.sh
3371 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3372 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3373 : nothing
3374 else
85e6fe83
LW
3375 : Give one chance to correct a possible typo.
3376 echo "$file.sh does not exist"
3377 dflt=$file
3378 rp="hint to use instead?"
dfe9444c 3379 . UU/myread
85e6fe83 3380 for file in $ans; do
dfe9444c
AD
3381 if $test -f "$src/hints/$file.sh"; then
3382 . $src/hints/$file.sh
3383 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3384 elif $test X$ans = X -o X$ans = Xnone ; then
3385 : nothing
3386 else
3387 echo "$file.sh does not exist -- ignored."
3388 fi
3389 done
2304df62
AD
3390 fi
3391 done
85e6fe83 3392
2304df62 3393 hint=recommended
85e6fe83 3394 : Remember our hint file for later.
dfe9444c 3395 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3396 hintfile="$file"
85e6fe83 3397 else
a0d0e21e 3398 hintfile=''
85e6fe83 3399 fi
2304df62
AD
3400fi
3401cd UU
3402;;
3403*)
3404 echo " "
3405 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3406 tmp_n="$n"
3407 tmp_c="$c"
2304df62
AD
3408 cd ..
3409 cp $config_sh config.sh 2>/dev/null
a78b0d02 3410 chmod +w config.sh
2304df62
AD
3411 . ./config.sh
3412 cd UU
3413 cp ../config.sh .
ecfc5424
AD
3414 n="$tmp_n"
3415 c="$tmp_c"
2304df62
AD
3416 hint=previous
3417 ;;
3418esac
1aef975c 3419test "$override" && . ./optdef.sh
2304df62
AD
3420
3421: Restore computed paths
3422for file in $loclist $trylist; do
3423 eval $file="\$_$file"
3424done
3425
85e6fe83 3426cat << EOM
a0d0e21e 3427
85e6fe83 3428Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3429The default value is probably right if the name rings a bell. Otherwise,
3430since spelling matters for me, either accept the default or answer "none"
3431to leave it blank.
a0d0e21e 3432
85e6fe83 3433EOM
85e6fe83 3434case "$osname" in
a0d0e21e 3435 ''|' ')
85e6fe83 3436 case "$hintfile" in
a0d0e21e 3437 ''|' '|none) dflt=none ;;
ecfc5424 3438 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3439 esac
3440 ;;
3441 *) dflt="$osname" ;;
3442esac
3443rp="Operating system name?"
3444. ./myread
3445case "$ans" in
ecfc5424
AD
3446none) osname='' ;;
3447*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3448esac
8ff267be 3449echo " "
3450case "$osvers" in
3451 ''|' ')
3452 case "$hintfile" in
3453 ''|' '|none) dflt=none ;;
3454 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3455 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3456 case "$dflt" in
3457 ''|' ') dflt=none ;;
3458 esac
3459 ;;
3460 esac
3461 ;;
3462 *) dflt="$osvers" ;;
3463esac
3464rp="Operating system version?"
3465. ./myread
3466case "$ans" in
3467none) osvers='' ;;
3468*) osvers="$ans" ;;
3469esac
3470
02e93a22
JH
3471
3472. ./posthint.sh
3473
2304df62 3474: who configured the system
59b83a6f 3475cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3476case "$cf_by" in
3477"")
7c04078e 3478 cf_by=`(logname) 2>/dev/null`
dfe9444c 3479 case "$cf_by" in
7c04078e
GA
3480 "")
3481 cf_by=`(whoami) 2>/dev/null`
3482 case "$cf_by" in
3483 "") cf_by=unknown ;;
3484 esac ;;
8ff267be 3485 esac ;;
3486esac
2304df62 3487
b4eb6b3d
JH
3488: set up the script used to warn in case of inconsistency
3489cat <<EOS >whoa
3490$startsh
3491EOS
3492cat <<'EOSC' >>whoa
3493dflt=y
3494echo " "
3495echo "*** WHOA THERE!!! ***" >&4
3496echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3497rp=" Keep the $hint value?"
3498. ./myread
3499case "$ans" in
3500y) td=$was; tu=$was;;
3501esac
3502EOSC
3503
3504: function used to set $1 to $val
3505setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3506case "$val$was" in
3507$define$undef) . ./whoa; eval "$var=\$td";;
3508$undef$define) . ./whoa; eval "$var=\$tu";;
3509*) eval "$var=$val";;
3510esac'
3511
b29b105d
JH
3512case "$usesocks" in
3513$define|true|[yY]*) dflt='y';;
3514*) dflt='n';;
3515esac
3516cat <<EOM
3517
3518Perl can be built to use the SOCKS proxy protocol library. To do so,
3519Configure must be run with -Dusesocks. If you use SOCKS you also need
3520to use the PerlIO abstraction layer, this will be implicitly selected.
3521
3522If this doesn't make any sense to you, just accept the default '$dflt'.
3523EOM
3524rp='Build Perl for SOCKS?'
3525. ./myread
3526case "$ans" in
3527y|Y) val="$define" ;;
3528*) val="$undef" ;;
3529esac
3530set usesocks
3531eval $setvar
3532
3533case "$usesocks" in
3534$define|true|[yY]*) useperlio="$define";;
3535esac
3536
3537case "$useperlio" in
3538$define|true|[yY]*|'') dflt='y';;
3539*) dflt='n';;
3540esac
3541cat <<EOM
3542
3543Previous version of $package used the standard IO mechanisms as
3544defined in <stdio.h>. Versions 5.003_02 and later of $package allow
3545alternate IO mechanisms via the PerlIO abstraction layer, but the
3546stdio mechanism is still available if needed. The abstraction layer
3547can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3548Using PerlIO with sfio may cause problems with some extension modules.
3549
3550If this doesn't make any sense to you, just accept the default '$dflt'.
3551EOM
3552rp='Use the PerlIO abstraction layer?'
3553. ./myread
3554case "$ans" in
3555y|Y)
3556 val="$define"
3557 ;;
3558*)
3559 echo "Ok, doing things the stdio way."
3560 val="$undef"
3561 ;;
3562esac
3563set useperlio
3564eval $setvar
3565
3566case "$usesocks" in
3567$define|true|[yY]*)
3568 case "$useperlio" in
3569 $define|true|[yY]*) ;;
3570 *) cat >&4 <<EOM
3571
3572You are using the SOCKS proxy protocol library which means that you
3573should also use the PerlIO layer. You may be headed for trouble.
3574
3575EOM
3576 ;;
3577 esac
3578 ;;
3579esac
3580
3581
b4eb6b3d
JH
3582case "$usethreads" in
3583$define|true|[yY]*) dflt='y';;
8e285145
AD
3584*) # Catch case where user specified ithreads or 5005threads but
3585 # forgot -Dusethreads (A.D. 4/2002)
3586 case "$useithreads$use5005threads" in
b29b105d
JH
3587 *$define*)
3588 case "$useperlio" in
3589 "$define") dflt='y' ;;
3590 *) dflt='n' ;;
3591 esac
3592 ;;
3593 *) dflt='n';;
8e285145
AD
3594 esac
3595 ;;
b4eb6b3d
JH
3596esac
3597cat <<EOM
3598
3599Perl can be built to take advantage of threads on some systems.
3600To do so, Configure can be run with -Dusethreads.
3601
bfce6503
DM
3602Note that Perl built with threading support runs slightly slower
3603and uses more memory than plain Perl. The current implementation
3604is believed to be stable, but it is fairly new, and so should be
3605treated with caution.
b4eb6b3d
JH
3606
3607If this doesn't make any sense to you, just accept the default '$dflt'.
3608EOM
3609rp='Build a threading Perl?'
3610. ./myread
3611case "$ans" in
3612y|Y) val="$define" ;;
3613*) val="$undef" ;;
3614esac
3615set usethreads
3616eval $setvar
3617
3618case "$usethreads" in
3619$define)
3620 $cat <<EOM
3621
bfce6503
DM
3622Since release 5.6, Perl has had two different threading implementations,
3623the newer interpreter-based version (ithreads) with one interpreter per
3624thread, and the older 5.005 version (5005threads).
3625The 5005threads version is effectively unmaintained and will probably be
3626removed in Perl 5.10, so there should be no need to build a Perl using it
3627unless needed for backwards compatibility with some existing 5.005threads
3628code.
b4eb6b3d 3629
b4eb6b3d
JH
3630EOM
3631 : Default to ithreads unless overridden on command line or with
3632 : old config.sh
3633 dflt='y'
3634 case "$use5005threads" in
3635 $define|true|[yY]*) dflt='n';;
3636 esac
3637 case "$useithreads" in
3638 $undef|false|[nN]*) dflt='n';;
3639 esac
bfce6503 3640 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
3641 . ./myread
3642 case "$ans" in
3643 y|Y) val="$define" ;;
3644 *) val="$undef" ;;
3645 esac
3646 set useithreads
3647 eval $setvar
3648 : Now set use5005threads to the opposite value.
3649 case "$useithreads" in
3650 $define) val="$undef" ;;
3651 *) val="$define" ;;
3652 esac
3653 set use5005threads
3654 eval $setvar
3655 ;;
3656*)
3657 useithreads="$undef"
3658 use5005threads="$undef"
3659 ;;
3660esac
3661
c915ce7f
JH
3662case "$useithreads$use5005threads" in
3663"$define$define")
3664 $cat >&4 <<EOM
3665
3666You cannot have both the ithreads and the 5.005 threads enabled
3667at the same time. Disabling the 5.005 threads since they are
3668much less stable than the ithreads.
3669
3670EOM
3671 use5005threads="$undef"
3672 ;;
3673esac
3674
b29b105d
JH
3675if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3676 cat >&4 <<EOF
3677***
3678*** To build with ithreads you must also use the PerlIO layer.
3679*** Cannot continue, aborting.
3680***
3681EOF
3682 exit 1
3683fi
3684
b4eb6b3d
JH
3685case "$d_oldpthreads" in
3686'') : Configure tests would be welcome here. For now, assume undef.
3687 val="$undef" ;;
3688*) val="$d_oldpthreads" ;;
3689esac
3690set d_oldpthreads
3691eval $setvar
3692
3693
b4eb6b3d
JH
3694: Look for a hint-file generated 'call-back-unit'. If the
3695: user has specified that a threading perl is to be built,
3696: we may need to set or change some other defaults.
9da7673b
MB
3697if $test -f usethreads.cbu; then
3698 echo "Your platform has some specific hints regarding threaded builds, using them..."
3699 . ./usethreads.cbu
3700else
3701 case "$usethreads" in
3702 "$define"|true|[yY]*)
b4eb6b3d 3703 $cat <<EOM
9da7673b 3704(Your platform does not have any specific hints for threaded builds.
b4eb6b3d
JH
3705 Assuming POSIX threads, then.)
3706EOM
b4eb6b3d 3707 ;;
9da7673b
MB
3708 esac
3709fi
b4eb6b3d
JH
3710
3711cat <<EOM
3712
3713Perl can be built so that multiple Perl interpreters can coexist
3714within the same Perl executable.
3715EOM
3716
3717case "$useithreads" in
3718$define)
3719 cat <<EOM
3720This multiple interpreter support is required for interpreter-based threads.
3721EOM
3722 val="$define"
3723 ;;
3724*) case "$usemultiplicity" in
3725 $define|true|[yY]*) dflt='y';;
3726 *) dflt='n';;
3727 esac
3728 echo " "
3729 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3730 rp='Build Perl for multiplicity?'
3731 . ./myread
3732 case "$ans" in
3733 y|Y) val="$define" ;;
3734 *) val="$undef" ;;
3735 esac
3736 ;;
3737esac
3738set usemultiplicity
3739eval $setvar
3740
96056487
JH
3741
3742case "$usemorebits" in
3743"$define"|true|[yY]*)
3744 use64bitint="$define"
3745 uselongdouble="$define"
3746 usemorebits="$define"
3747 ;;
3748*) usemorebits="$undef"
3749 ;;
3750esac
3751
e5e20432
JH
3752: make some quick guesses about what we are up against
3753echo " "
3754$echo $n "Hmm... $c"
3755echo exit 1 >bsd
3756echo exit 1 >usg
3757echo exit 1 >v7
3758echo exit 1 >osf1
3759echo exit 1 >eunice
3760echo exit 1 >xenix
3761echo exit 1 >venix
3762echo exit 1 >os2
3763d_bsd="$undef"
3764$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3765if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3766then
3767 echo "Looks kind of like an OSF/1 system, but we'll see..."
3768 echo exit 0 >osf1
381aa1ff 3769elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3770 xxx=`./loc addbib blurfl $pth`
3771 if $test -f $xxx; then
3772 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3773 echo exit 0 >bsd
3774 echo exit 0 >usg
3775 else
3776 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3777 echo "Looks kind of like an extended USG system, but we'll see..."
3778 else
3779 echo "Looks kind of like a USG system, but we'll see..."
3780 fi
3781 echo exit 0 >usg
3782 fi
3783elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3784 echo "Looks kind of like a BSD system, but we'll see..."
3785 d_bsd="$define"
3786 echo exit 0 >bsd
3787else
3788 echo "Looks kind of like a Version 7 system, but we'll see..."
3789 echo exit 0 >v7
3790fi
3791case "$eunicefix" in
3792*unixtovms*)
3793 $cat <<'EOI'
3794There is, however, a strange, musty smell in the air that reminds me of
3795something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3796EOI
3797 echo exit 0 >eunice
3798 d_eunice="$define"
3799: it so happens the Eunice I know will not run shell scripts in Unix format
3800 ;;
3801*)
3802 echo " "
3803 echo "Congratulations. You aren't running Eunice."
3804 d_eunice="$undef"
3805 ;;
3806esac
3807: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3808: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3809: semicolon as a patch separator
e5e20432
JH
3810case "$p_" in
3811:) ;;
3812*)
3813 $cat <<'EOI'
3814I have the feeling something is not exactly right, however...don't tell me...
3815lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3816(Or you may be running DOS with DJGPP.)
e5e20432
JH
3817EOI
3818 echo exit 0 >os2
3819 ;;
3820esac
3821if test -f /xenix; then
3822 echo "Actually, this looks more like a XENIX system..."
3823 echo exit 0 >xenix
3824 d_xenix="$define"
3825else
3826 echo " "
3827 echo "It's not Xenix..."
3828 d_xenix="$undef"
3829fi
3830chmod +x xenix
3831$eunicefix xenix
3832if test -f /venix; then
3833 echo "Actually, this looks more like a VENIX system..."
3834 echo exit 0 >venix
3835else
3836 echo " "
3837 if ./xenix; then
3838 : null
3839 else
3840 echo "Nor is it Venix..."
3841 fi
3842fi
3843chmod +x bsd usg v7 osf1 eunice xenix venix os2
3844$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3845$rm -f foo
3846
5869b1f1
JH
3847case "$cc" in
3848'') dflt=cc;;
3849*) dflt="$cc";;
3850esac
3851rp="Use which C compiler?"
3852. ./myread
3853cc="$ans"
6b769f8f
RB
3854
3855: See if they have not cc but they do have gcc
3856. ./trygcc
e5e20432
JH
3857: Look for a hint-file generated 'call-back-unit'. Now that the
3858: user has specified the compiler, we may need to set or change some
3859: other defaults.
3860if $test -f cc.cbu; then
3861 . ./cc.cbu
3862fi
2573c5f9 3863. ./checkcc
8a27cf78 3864
e5e20432
JH
3865echo " "
3866echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 3867$cat >try.c <<EOM
e5e20432
JH
3868#include <stdio.h>
3869int main() {
3870#ifdef __GNUC__
3871#ifdef __VERSION__
3872 printf("%s\n", __VERSION__);
3873#else
3874 printf("%s\n", "1");
3875#endif
3876#endif
073b6de5 3877 return(0);
e5e20432
JH
3878}
3879EOM
5440bc8e
JH
3880if $cc -o try $ccflags $ldflags try.c; then
3881 gccversion=`$run ./try`
e5e20432
JH
3882 case "$gccversion" in
3883 '') echo "You are not using GNU cc." ;;
fc68435e 3884 *) echo "You are using GNU cc $gccversion."
48fe685d 3885 ccname=gcc
fc68435e 3886 ;;
e5e20432
JH
3887 esac
3888else
3889 echo " "
3890 echo "*** WHOA THERE!!! ***" >&4
3891 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3892 case "$knowitall" in
3893 '')
3894 echo " You'd better start hunting for one and let me know about it." >&4
3895 exit 1
3896 ;;
3897 esac
3898fi
5440bc8e 3899$rm -f try try.*
e5e20432
JH
3900case "$gccversion" in
39011*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3902esac
5b463ca7
KS
3903case "$gccversion" in
3904'') gccosandvers='' ;;
10b4ebb5
JH
3905*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3906 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3907 gccshortvers=''
5b463ca7 3908 case "$gccosandvers" in
02903077
JH
3909 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3910 $osname$osvers) ;; # looking good
5b463ca7
KS
3911 $osname*) cat <<EOM >&4
3912
3913*** WHOA THERE!!! ***
3914
3915 Your gcc has not been compiled for the exact release of
3916 your operating system ($gccosandvers versus $osname$osvers).
3917
3918 In general it is a good idea to keep gcc synchronized with
3919 the operating system because otherwise serious problems
3920 may ensue when trying to compile software, like Perl.
3921
3922 I'm trying to be optimistic here, though, and will continue.
3923 If later during the configuration and build icky compilation
02903077
JH
3924 problems appear (headerfile conflicts being the most common
3925 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3926 your operating system release.
3927
3928EOM
3929 ;;
81575342 3930 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3931 esac
3932 ;;
3933esac
e723fc21
JH
3934case "$ccname" in
3935'') ccname="$cc" ;;
3936esac
e5e20432 3937
224cb7cb 3938# gcc 3.* complain about adding -Idirectories that they already know about,
76589481
JH
3939# so we will take those off from locincpth.
3940case "$gccversion" in
39413*)
3942 echo "main(){}">try.c
224cb7cb
JH
3943 for incdir in $locincpth; do
3944 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
48fe685d 3945 grep '^c[cp]p*[01]: warning: changing search order '`
224cb7cb 3946 if test "X$warn" != X; then
44b94491 3947 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
224cb7cb 3948 fi
76589481
JH
3949 done
3950 $rm -f try try.*
3951esac
640374d0 3952
bd9b35c9
JH
3953: decide how portable to be. Allow command line overrides.
3954case "$d_portable" in
3955"$undef") ;;
3956*) d_portable="$define" ;;
104d25b7 3957esac
85ab1d1d 3958
bd9b35c9
JH
3959: set up shell script to do ~ expansion
3960cat >filexp <<EOSS
3961$startsh
3962: expand filename
3963case "\$1" in
3964 ~/*|~)
3965 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3966 ;;
3967 ~*)
3968 if $test -f /bin/csh; then
3969 /bin/csh -f -c "glob \$1"
3970 failed=\$?
3971 echo ""
3972 exit \$failed
e5e20432 3973 else
bd9b35c9
JH
3974 name=\`$expr x\$1 : '..\([^/]*\)'\`
3975 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3976 if $test ! -d "\$dir"; then
3977 me=\`basename \$0\`
3978 echo "\$me: can't locate home directory for: \$name" >&2
3979 exit 1
3980 fi
3981 case "\$1" in
3982 */*)
3983 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3984 ;;
3985 *)
3986 echo \$dir
e5e20432
JH
3987 ;;
3988 esac
3989 fi
b691c02f 3990 ;;
4633a7c4 3991*)
bd9b35c9 3992 echo \$1
2304df62
AD
3993 ;;
3994esac
4633a7c4
LW
3995EOSS
3996chmod +x filexp
3997$eunicefix filexp
2304df62
AD
3998
3999: now set up to get a file name
28757baa 4000cat <<EOS >getfile
4001$startsh
4002EOS
4003cat <<'EOSC' >>getfile
2304df62
AD
4004tilde=''
4005fullpath=''
4006already=''
4007skip=''
4008none_ok=''
4009exp_file=''
a0d0e21e 4010nopath_ok=''
2304df62
AD
4011orig_rp="$rp"
4012orig_dflt="$dflt"
b233458b
JH
4013case "$gfpth" in
4014'') gfpth='.' ;;
4015esac
2304df62
AD
4016
4017case "$fn" in
ecfc5424 4018*\(*)
d604bb53
JH
4019 : getfile will accept an answer from the comma-separated list
4020 : enclosed in parentheses even if it does not meet other criteria.
4021 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
4022 fn=`echo $fn | sed 's/(.*)//'`
4023 ;;
4024esac
4025
4026case "$fn" in
a0d0e21e
LW
4027*:*)
4028 loc_file=`expr $fn : '.*:\(.*\)'`
4029 fn=`expr $fn : '\(.*\):.*'`
4030 ;;
4031esac
4032
4033case "$fn" in
2304df62
AD
4034*~*) tilde=true;;
4035esac
4036case "$fn" in
4037*/*) fullpath=true;;
4038esac
4039case "$fn" in
4040*+*) skip=true;;
4041esac
4042case "$fn" in
4043*n*) none_ok=true;;
4044esac
4045case "$fn" in
4046*e*) exp_file=true;;
4047esac
a0d0e21e
LW
4048case "$fn" in
4049*p*) nopath_ok=true;;
4050esac
2304df62
AD
4051
4052case "$fn" in
4053*f*) type='File';;
4054*d*) type='Directory';;
a0d0e21e 4055*l*) type='Locate';;
2304df62
AD
4056esac
4057
4058what="$type"
4059case "$what" in
4060Locate) what='File';;
4061esac
4062
4063case "$exp_file" in
4064'')
4065 case "$d_portable" in
4066 "$define") ;;
4067 *) exp_file=true;;
4068 esac
4069 ;;
4070esac
4071
4072cd ..
4073while test "$type"; do
4074 redo=''
4075 rp="$orig_rp"
4076 dflt="$orig_dflt"
4077 case "$tilde" in
4078 true) rp="$rp (~name ok)";;
4079 esac
4080 . UU/myread
ecfc5424
AD
4081 if test -f UU/getfile.ok && \
4082 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4083 then
4084 value="$ans"
4085 ansexp="$ans"
4086 break
4087 fi
2304df62
AD
4088 case "$ans" in
4089 none)
4090 value=''
4091 ansexp=''
4092 case "$none_ok" in
4093 true) type='';;
4094 esac
4095 ;;
4096 *)
4097 case "$tilde" in
4098 '') value="$ans"
4099 ansexp="$ans";;
4100 *)
4101 value=`UU/filexp $ans`
4102 case $? in
4103 0)
4104 if test "$ans" != "$value"; then
ecfc5424 4105 echo "(That expands to $value on this system.)"
2304df62
AD
4106 fi
4107 ;;
4108 *) value="$ans";;
4109 esac
4110 ansexp="$value"
4111 case "$exp_file" in
4112 '') value="$ans";;
4113 esac
4114 ;;
4115 esac
4116 case "$fullpath" in
4117 true)
4118 case "$ansexp" in
4119 /*) value="$ansexp" ;;
23da6c43 4120 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
4121 *)
4122 redo=true
4123 case "$already" in
4124 true)
4125 echo "I shall only accept a full path name, as in /bin/ls." >&4
4126 echo "Use a ! shell escape if you wish to check pathnames." >&4
4127 ;;
4128 *)
4129 echo "Please give a full path name, starting with slash." >&4
4130 case "$tilde" in
4131 true)
4132 echo "Note that using ~name is ok provided it expands well." >&4
4133 already=true
4134 ;;
4135 esac
4136 esac
4137 ;;
4138 esac
4139 ;;
4140 esac
4141 case "$redo" in
4142 '')
4143 case "$type" in
4144 File)
b233458b
JH
4145 for fp in $gfpth; do
4146 if test "X$fp" = X.; then
4147 pf="$ansexp"
4148 else
4149 pf="$fp/$ansexp"
4150 fi
4151 if test -f "$pf"; then
4152 type=''
4153 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4154 then
4155 echo "($value is not a plain file, but that's ok.)"
4156 type=''
4157 fi
4158 if test X"$type" = X; then
4159 value="$pf"
4160 break
4161 fi
4162 done
2304df62
AD
4163 ;;
4164 Directory)
b233458b
JH
4165 for fp in $gfpth; do
4166 if test "X$fp" = X.; then
f78bfc9c
JH
4167 dir="$ans"
4168 direxp="$ansexp"
b233458b 4169 else
dd858076 4170 dir="$fp/$ansexp"
f78bfc9c 4171 direxp="$fp/$ansexp"
b233458b 4172 fi
f78bfc9c 4173 if test -d "$direxp"; then
b233458b 4174 type=''
f78bfc9c 4175 value="$dir"
b233458b
JH
4176 break
4177 fi
4178 done
2304df62
AD
4179 ;;
4180 Locate)
40000a8c 4181 if test -d "$ansexp"; then
a0d0e21e
LW
4182 echo "(Looking for $loc_file in directory $value.)"
4183 value="$value/$loc_file"
40000a8c 4184 ansexp="$ansexp/$loc_file"
2304df62 4185 fi
40000a8c 4186 if test -f "$ansexp"; then
2304df62
AD
4187 type=''
4188 fi
a0d0e21e
LW
4189 case "$nopath_ok" in
4190 true) case "$value" in
4191 */*) ;;
4192 *) echo "Assuming $value will be in people's path."
4193 type=''
4194 ;;
4195 esac
4196 ;;
4197 esac
2304df62
AD
4198 ;;
4199 esac
4200
4201 case "$skip" in
4202 true) type='';
4203 esac
4204
4205 case "$type" in
4206 '') ;;
4207 *)
4208 if test "$fastread" = yes; then
4209 dflt=y
4210 else
4211 dflt=n
4212 fi
4213 rp="$what $value doesn't exist. Use that name anyway?"
4214 . UU/myread
4215 dflt=''
4216 case "$ans" in
4217 y*) type='';;
4218 *) echo " ";;
4219 esac
4220 ;;
4221 esac
4222 ;;
4223 esac
4224 ;;
4225 esac
4226done
4227cd UU
4228ans="$value"
4229rp="$orig_rp"
4230dflt="$orig_dflt"
ecfc5424 4231rm -f getfile.ok
b233458b 4232test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
4233EOSC
4234
bd9b35c9
JH
4235: What should the include directory be ?
4236echo " "
4237$echo $n "Hmm... $c"
4238dflt='/usr/include'
4239incpath=''
4240mips_type=''
4241if $test -f /bin/mips && /bin/mips; then
4242 echo "Looks like a MIPS system..."
4243 $cat >usr.c <<'EOCP'
4244#ifdef SYSTYPE_BSD43
4245/bsd43
4246#endif
4247EOCP
8a27cf78 4248 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4249 dflt='/bsd43/usr/include'
4250 incpath='/bsd43'
4251 mips_type='BSD 4.3'
4252 else
4253 mips_type='System V'
4254 fi
4255 $rm -f usr.c usr.out
4256 echo "and you're compiling with the $mips_type compiler and libraries."
4257 xxx_prompt=y
4258 echo "exit 0" >mips
4259else
4260 echo "Doesn't look like a MIPS system."
4261 xxx_prompt=n
4262 echo "exit 1" >mips
4263fi
4264chmod +x mips
4265$eunicefix mips
4266case "$usrinc" in
4267'') ;;
4268*) dflt="$usrinc";;
4269esac
4270case "$xxx_prompt" in
4271y) fn=d/
4272 echo " "
4273 rp='Where are the include files you want to use?'
4274 . ./getfile
4275 usrinc="$ans"
8e07c86e 4276 ;;
bd9b35c9 4277*) usrinc="$dflt"
8e07c86e
AD
4278 ;;
4279esac
2304df62 4280
96056487
JH
4281: see how we invoke the C preprocessor
4282echo " "
4283echo "Now, how can we feed standard input to your C preprocessor..." >&4
4284cat <<'EOT' >testcpp.c
4285#define ABC abc
4286#define XYZ xyz
4287ABC.XYZ
4288EOT
4289cd ..
4290if test ! -f cppstdin; then
4291 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4292 # AIX cc -E doesn't show the absolute headerfile
4293 # locations but we'll cheat by using the -M flag.
4294 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
4295 else
4296 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4297 fi
4298else
4299 echo "Keeping your $hint cppstdin wrapper."
4300fi
4301chmod 755 cppstdin
4302wrapper=`pwd`/cppstdin
4303ok='false'
4304cd UU
4305
4306if $test "X$cppstdin" != "X" && \
4307 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4308 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4309then
4310 echo "You used to use $cppstdin $cppminus so we'll use that again."
4311 case "$cpprun" in
4312 '') echo "But let's see if we can live without a wrapper..." ;;
4313 *)
4314 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4315 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4316 then
4317 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4318 ok='true'
4319 else
4320 echo "(However, $cpprun $cpplast does not work, let's see...)"
4321 fi
4322 ;;
4323 esac
4324else
4325 case "$cppstdin" in
4326 '') ;;
4327 *)
4328 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4329 ;;
4330 esac
4331fi
4332
4333if $ok; then
4334 : nothing
4335elif echo 'Maybe "'"$cc"' -E" will work...'; \
4336 $cc -E <testcpp.c >testcpp.out 2>&1; \
4337 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4338 echo "Yup, it does."
4339 x_cpp="$cc -E"
4340 x_minus='';
4341elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4342 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4343 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4344 echo "Yup, it does."
4345 x_cpp="$cc -E"
4346 x_minus='-';
4347elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4348 $cc -P <testcpp.c >testcpp.out 2>&1; \
4349 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4350 echo "Yipee, that works!"
4351 x_cpp="$cc -P"
4352 x_minus='';
4353elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4354 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4355 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4356 echo "At long last!"
4357 x_cpp="$cc -P"
4358 x_minus='-';
4359elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4360 $cpp <testcpp.c >testcpp.out 2>&1; \
4361 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4362 echo "It works!"
4363 x_cpp="$cpp"
4364 x_minus='';
4365elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4366 $cpp - <testcpp.c >testcpp.out 2>&1; \
4367 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4368 echo "Hooray, it works! I was beginning to wonder."
4369 x_cpp="$cpp"
4370 x_minus='-';
4371elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4372 $wrapper <testcpp.c >testcpp.out 2>&1; \
4373 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4374 x_cpp="$wrapper"
4375 x_minus=''
4376 echo "Eureka!"
4377else
4378 dflt=''
4379 rp="No dice. I can't find a C preprocessor. Name one:"
4380 . ./myread
4381 x_cpp="$ans"
4382 x_minus=''
4383 $x_cpp <testcpp.c >testcpp.out 2>&1
4384 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4385 echo "OK, that will do." >&4
4386 else
4387echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4388 exit 1
4389 fi
4390fi
4391
4392case "$ok" in
4393false)
4394 cppstdin="$x_cpp"
4395 cppminus="$x_minus"
4396 cpprun="$x_cpp"
4397 cpplast="$x_minus"
4398 set X $x_cpp
4399 shift
4400 case "$1" in
4401 "$cpp")
4402 echo "Perhaps can we force $cc -E using a wrapper..."
4403 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4404 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4405 then
4406 echo "Yup, we can."
4407 cppstdin="$wrapper"
4408 cppminus='';
4409 else
4410 echo "Nope, we'll have to live without it..."
4411 fi
4412 ;;
4413 esac
4414 case "$cpprun" in
4415 "$wrapper")
4416 cpprun=''
4417 cpplast=''
4418 ;;
4419 esac
4420 ;;
4421esac
4422
4423case "$cppstdin" in
4424"$wrapper"|'cppstdin') ;;
4425*) $rm -f $wrapper;;
4426esac
4427$rm -f testcpp.c testcpp.out
4428
bd9b35c9
JH
4429: Set private lib path
4430case "$plibpth" in
4431'') if ./mips; then
4432 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4433 fi;;
4434esac
4435case "$libpth" in
4436' ') dlist='';;
4437'') dlist="$loclibpth $plibpth $glibpth";;
4438*) dlist="$libpth";;
4439esac
4440
4441: Now check and see which directories actually exist, avoiding duplicates
4442libpth=''
4443for xxx in $dlist
4444do
4445 if $test -d $xxx; then
4446 case " $libpth " in
4447 *" $xxx "*) ;;
4448 *) libpth="$libpth $xxx";;
4449 esac
4450 fi
4451done
4452$cat <<'EOM'
4453
4454Some systems have incompatible or broken versions of libraries. Among
4455the directories listed in the question below, please remove any you
4456know not to be holding relevant libraries, and add any that are needed.
4457Say "none" for none.
8e07c86e
AD
4458
4459EOM
bd9b35c9
JH
4460case "$libpth" in
4461'') dflt='none';;
8e07c86e 4462*)
bd9b35c9
JH
4463 set X $libpth
4464 shift
4465 dflt=${1+"$@"}
8e07c86e 4466 ;;
a0d0e21e 4467esac
bd9b35c9
JH
4468rp="Directories to use for library searches?"
4469. ./myread
4470case "$ans" in
4471none) libpth=' ';;
4472*) libpth="$ans";;
4473esac
a0d0e21e 4474
bd9b35c9
JH
4475: compute shared library extension
4476case "$so" in
4477'')
4478 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4479 dflt='sl'
dd4e71fd 4480 else
bd9b35c9 4481 dflt='so'
dd4e71fd
JH
4482 fi
4483 ;;
bd9b35c9 4484*) dflt="$so";;
dd4e71fd 4485esac
dd4e71fd
JH
4486$cat <<EOM
4487
bd9b35c9 4488On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4489you want to suppress searching of shared libraries for the remainder
bd9b35c9 4490of this configuration.
dd4e71fd
JH
4491
4492EOM
bd9b35c9
JH
4493rp='What is the file extension used for shared libraries?'
4494. ./myread
4495so="$ans"
dd4e71fd 4496
bd9b35c9
JH
4497: Define several unixisms.
4498: Hints files or command line option can be used to override them.
4499: The convoluted testing is in case hints files set either the old
4500: or the new name.
4501case "$_exe" in
4502'') case "$exe_ext" in
1fef16b3 4503 '') ;;
bd9b35c9 4504 *) _exe="$exe_ext" ;;
dd4e71fd 4505 esac
bd9b35c9 4506 ;;
bfb7748a 4507esac
bd9b35c9
JH
4508case "$_a" in
4509'') case "$lib_ext" in
4510 '') _a='.a';;
4511 *) _a="$lib_ext" ;;
dd4e71fd
JH
4512 esac
4513 ;;
dd4e71fd 4514esac
bd9b35c9
JH
4515case "$_o" in
4516'') case "$obj_ext" in
4517 '') _o='.o';;
4518 *) _o="$obj_ext";;
4519 esac
4520 ;;
4521esac
4522case "$p_" in
4523'') case "$path_sep" in
4524 '') p_=':';;
4525 *) p_="$path_sep";;
4526 esac
4527 ;;
4528esac
4529exe_ext=$_exe
4530lib_ext=$_a
4531obj_ext=$_o
4532path_sep=$p_
dd4e71fd 4533
b4eb6b3d
JH
4534: Which makefile gets called first. This is used by make depend.
4535case "$firstmakefile" in
4536'') firstmakefile='makefile';;
4633a7c4 4537esac
4633a7c4 4538
1f603089
JH
4539case "$ccflags" in
4540*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4541esac
4542
4543case "$uselongdouble" in
4544$define|true|[yY]*) dflt='y';;
4545*) dflt='n';;
4546esac
4547cat <<EOM
4548
4549Perl can be built to take advantage of long doubles which
4550(if available) may give more accuracy and range for floating point numbers.
4551
4552If this doesn't make any sense to you, just accept the default '$dflt'.
4553EOM
4554rp='Try to use long doubles if available?'
4555. ./myread
4556case "$ans" in
4557y|Y) val="$define" ;;
4558*) val="$undef" ;;
4559esac
4560set uselongdouble
4561eval $setvar
4562
4563case "$uselongdouble" in
4564true|[yY]*) uselongdouble="$define" ;;
4565esac
4566
1f603089
JH
4567: Look for a hint-file generated 'call-back-unit'. If the
4568: user has specified that long doubles should be used,
4569: we may need to set or change some other defaults.
9da7673b
MB
4570if $test -f uselongdouble.cbu; then
4571 echo "Your platform has some specific hints regarding long doubles, using them..."
4572 . ./uselongdouble.cbu
4573else
4574 case "$uselongdouble" in
4575 $define)
1f603089 4576 $cat <<EOM
9da7673b 4577(Your platform does not have any specific hints for long doubles.)
1f603089 4578EOM
1f603089 4579 ;;
9da7673b
MB
4580 esac
4581fi
1f603089 4582
bd9b35c9
JH
4583: Looking for optional libraries
4584echo " "
4585echo "Checking for optional libraries..." >&4
4586case "$libs" in
4587' '|'') dflt='';;
4588*) dflt="$libs";;
4589esac
4590case "$libswanted" in
4591'') libswanted='c_s';;
4592esac
4593case "$usesocks" in
923fc586 4594"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4595esac
68435ea7
JH
4596libsfound=''
4597libsfiles=''
4598libsdirs=''
13b3f787
JH
4599libspath=''
4600for thisdir in $libpth $xlibpth; do
4601 test -d $thisdir && libspath="$libspath $thisdir"
4602done
bd9b35c9 4603for thislib in $libswanted; do
13b3f787 4604 for thisdir in $libspath; do
f7dd4e7f
JH
4605 xxx=''
4606 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4607 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4608 $test -f "$xxx" && eval $libscheck
4609 $test -f "$xxx" && libstyle=shared
4610 fi
4611 if test ! -f "$xxx"; then
4612 xxx=$thisdir/lib$thislib.$so
4613 $test -f "$xxx" && eval $libscheck
4614 $test -f "$xxx" && libstyle=shared
4615 fi
4616 if test ! -f "$xxx"; then
4617 xxx=$thisdir/lib$thislib$_a
4618 $test -f "$xxx" && eval $libscheck
4619 $test -f "$xxx" && libstyle=static
4620 fi
4621 if test ! -f "$xxx"; then
4622 xxx=$thisdir/$thislib$_a
4623 $test -f "$xxx" && eval $libscheck
4624 $test -f "$xxx" && libstyle=static
4625 fi
4626 if test ! -f "$xxx"; then
4627 xxx=$thisdir/lib${thislib}_s$_a
4628 $test -f "$xxx" && eval $libscheck
4629 $test -f "$xxx" && libstyle=static
09ea5ba9 4630 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4631 fi
4632 if test ! -f "$xxx"; then
4633 xxx=$thisdir/Slib$thislib$_a
4634 $test -f "$xxx" && eval $libscheck
4635 $test -f "$xxx" && libstyle=static
4636 fi
4637 if $test -f "$xxx"; then
43999f95 4638 case "$libstyle" in
f7dd4e7f
JH
4639 shared) echo "Found -l$thislib (shared)." ;;
4640 static) echo "Found -l$thislib." ;;
4641 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4642 esac
bd9b35c9
JH
4643 case " $dflt " in
4644 *"-l$thislib "*);;
f7dd4e7f 4645 *) dflt="$dflt -l$thislib"
43999f95
JH
4646 libsfound="$libsfound $xxx"
4647 yyy=`basename $xxx`
4648 libsfiles="$libsfiles $yyy"
1e127011 4649 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4650 case " $libsdirs " in
4651 *" $yyy "*) ;;
4652 *) libsdirs="$libsdirs $yyy" ;;
4653 esac
4654 ;;
bd9b35c9 4655 esac
f7dd4e7f
JH
4656 break
4657 fi
4658 done
4659 if $test ! -f "$xxx"; then
4660 echo "No -l$thislib."
bd9b35c9
JH
4661 fi
4662done
4663set X $dflt
4664shift
4665dflt="$*"
4666case "$libs" in
4667'') dflt="$dflt";;
4668*) dflt="$libs";;
4669esac
4670case "$dflt" in
4671' '|'') dflt='none';;
4672esac
4633a7c4 4673
bd9b35c9 4674$cat <<EOM
4633a7c4 4675
bd9b35c9
JH
4676In order to compile $package on your machine, a number of libraries
4677are usually needed. Include any other special libraries here as well.
4678Say "none" for none. The default list is almost always right.
8e07c86e 4679EOM
8e07c86e 4680
bd9b35c9
JH
4681echo " "
4682rp="What libraries to use?"
4683. ./myread
4684case "$ans" in
4685none) libs=' ';;
4686*) libs="$ans";;
4687esac
d71b2b6b 4688
bd9b35c9
JH
4689: determine optimization, if desired, or use for debug flag also
4690case "$optimize" in
4691' '|$undef) dflt='none';;
4692'') dflt='-O';;
4693*) dflt="$optimize";;
4694esac
4695$cat <<EOH
d71b2b6b 4696
bd9b35c9
JH
4697By default, $package compiles with the -O flag to use the optimizer.
4698Alternately, you might want to use the symbolic debugger, which uses
4699the -g flag (on traditional Unix systems). Either flag can be
4700specified here. To use neither flag, specify the word "none".
d71b2b6b 4701
bd9b35c9
JH
4702EOH
4703rp="What optimizer/debugger flag should be used?"
4704. ./myread
4705optimize="$ans"
4706case "$optimize" in
4707'none') optimize=" ";;
4708esac
4709
4710dflt=''
4711: We will not override a previous value, but we might want to
4712: augment a hint file
4713case "$hint" in
4714default|recommended)
4715 case "$gccversion" in
4716 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 4717 esac
bd9b35c9
JH
4718 case "$optimize" in
4719 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 4720 esac
bd9b35c9
JH
4721 case "$gccversion" in
4722 2*) if test -d /etc/conf/kconfig.d &&
4723 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4724 then
00e89ad4 4725 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
4726 dflt="$dflt -posix"
4727 fi
f0d04425 4728 ;;
bd9b35c9
JH
4729 esac
4730 case "$gccversion" in
4731 1*) ;;
4732 2.[0-8]*) ;;
4733 ?*) echo " "
4734 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4735 echo 'int main(void) { return 0; }' > gcctest.c
4736 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4737 echo "Yes, it does." 2>&1
4738 case "$ccflags" in
00e89ad4 4739 *strict-aliasing*)
bd9b35c9
JH
4740 echo "Leaving current flags $ccflags alone." 2>&1
4741 ;;
4742 *) dflt="$dflt -fno-strict-aliasing" ;;
4743 esac
4744 else
4745 echo "Nope, it doesn't, but that's ok." 2>&1
4746 fi
f0d04425 4747 ;;
e5e20432 4748 esac
00e89ad4
AD
4749 # For gcc, adding -pipe speeds up compilations for some, but apparently
4750 # some assemblers can't read from stdin. (It also slows down compilations
4751 # in other cases, but those are apparently rarer these days.) AD 5/2004.
4752 case "$gccversion" in
4753 ?*) echo " "
4754 echo "Checking if your compiler accepts -pipe" 2>&1
4755 echo 'int main(void) { return 0; }' > gcctest.c
6347b5be 4756 if $cc -pipe -o gcctest gcctest.c; then
00e89ad4
AD
4757 echo "Yes, it does." 2>&1
4758 case "$ccflags" in
4759 *-pipe*)
4760 echo "Leaving current flags $ccflags alone." 2>&1
4761 ;;
4762 *) dflt="$dflt -pipe" ;;
4763 esac
4764 else
4765 echo "Nope, it doesn't, but that's ok." 2>&1
4766 fi
6347b5be
SP
4767
4768 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4769 echo 'int main(void) { return 0; }' > gcctest.c
4770 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4771 echo "Yes, it does." 2>&1
4772 case "$ccflags" in
4773 *-Wdeclaration-after-statement*)
4774 echo "Leaving current flags $ccflags alone." 2>&1
4775 ;;
4776 *) dflt="$dflt -Wdeclaration-after-statement" ;;
4777 esac
4778 else
4779 echo "Nope, it doesn't, but that's ok." 2>&1
4780 fi
00e89ad4
AD
4781 ;;
4782 esac
e5e20432
JH
4783 ;;
4784esac
4785
bd9b35c9
JH
4786case "$mips_type" in
4787*BSD*|'') inclwanted="$locincpth $usrinc";;
4788*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4789esac
4790for thisincl in $inclwanted; do
4791 if $test -d $thisincl; then
4792 if $test x$thisincl != x$usrinc; then
4793 case "$dflt" in
00e89ad4
AD
4794 *" -I$thisincl "*);;
4795 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
4796 esac
4797 fi
4798 fi
4799done
40a7a20a 4800
bd9b35c9
JH
4801inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4802 xxx=true;
4803elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4804 xxx=true;
4805else
4806 xxx=false;
4807fi;
4808if $xxx; then
4809 case "$dflt" in
4810 *$2*);;
4811 *) dflt="$dflt -D$2";;
4812 esac;
4813fi'
40a7a20a 4814
bd9b35c9 4815set signal.h LANGUAGE_C; eval $inctest
40a7a20a 4816
bd9b35c9
JH
4817case "$usesocks" in
4818$define)
4819 ccflags="$ccflags -DSOCKS"
4820 ;;
4821esac
40a7a20a 4822
bd9b35c9
JH
4823case "$hint" in
4824default|recommended) dflt="$ccflags $dflt" ;;
4825*) dflt="$ccflags";;
4826esac
40a7a20a 4827
bd9b35c9
JH
4828case "$dflt" in
4829''|' ') dflt=none;;
4830esac
422af00a 4831
bd9b35c9 4832$cat <<EOH
40a7a20a 4833
bd9b35c9
JH
4834Your C compiler may want other flags. For this question you should include
4835-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4836but you should NOT include libraries or ld flags like -lwhatever. If you
4837want $package to honor its debug switch, you should include -DDEBUGGING here.
4838Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 4839
bd9b35c9 4840To use no flags, specify the word "none".
40a7a20a 4841
bd9b35c9
JH
4842EOH
4843set X $dflt
4844shift
4845dflt=${1+"$@"}
4846rp="Any additional cc flags?"
4847. ./myread
4848case "$ans" in
4849none) ccflags='';;
4850*) ccflags="$ans";;
4851esac
8e07c86e 4852
bd9b35c9 4853: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
4854case "$cppflags" in
4855'') cppflags="$ccflags" ;;
4856*) cppflags="$cppflags $ccflags" ;;
4857esac
bd9b35c9
JH
4858case "$gccversion" in
48591*) cppflags="$cppflags -D__GNUC__"
4633a7c4 4860esac
bd9b35c9
JH
4861case "$mips_type" in
4862'');;
4863*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4864esac
4865case "$cppflags" in
4866'');;
4867*)
4868 echo " "
4869 echo "Let me guess what the preprocessor flags are..." >&4
4870 set X $cppflags
4871 shift
4872 cppflags=''
4873 $cat >cpp.c <<'EOM'
4874#define BLURFL foo
8e07c86e 4875
bd9b35c9
JH
4876BLURFL xx LFRULB
4877EOM
4878 previous=''
4879 for flag in $*
4880 do
4881 case "$flag" in
4882 -*) ftry="$flag";;
4883 *) ftry="$previous $flag";;
4884 esac
4885 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4886 >cpp1.out 2>/dev/null && \
4887 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4888 >cpp2.out 2>/dev/null && \
4889 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4890 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4891 then
4892 cppflags="$cppflags $ftry"
4893 previous=''
4894 else
4895 previous="$flag"
4896 fi
4897 done
4898 set X $cppflags
4899 shift
4900 cppflags=${1+"$@"}
4901 case "$cppflags" in
4902 *-*) echo "They appear to be: $cppflags";;
4903 esac
4904 $rm -f cpp.c cpp?.out
2afac517 4905 ;;
4906esac
8e07c86e 4907
bd9b35c9
JH
4908: flags used in final linking phase
4909case "$ldflags" in
4910'') if ./venix; then
4911 dflt='-i -z'
10a23457 4912 else
bd9b35c9 4913 dflt=''
10a23457 4914 fi
bd9b35c9
JH
4915 case "$ccflags" in
4916 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 4917 esac
bd9b35c9
JH
4918 ;;
4919*) dflt="$ldflags";;
4920esac
4921
4922: Try to guess additional flags to pick up local libraries.
4923for thislibdir in $libpth; do
4924 case " $loclibpth " in
4925 *" $thislibdir "*)
00e89ad4 4926 case "$dflt " in
bd9b35c9
JH
4927 *"-L$thislibdir "*) ;;
4928 *) dflt="$dflt -L$thislibdir" ;;
4929 esac
c4f23d77
AD
4930 ;;
4931 esac
bd9b35c9 4932done
c4f23d77 4933
bd9b35c9
JH
4934case "$dflt" in
4935'') dflt='none' ;;
4936esac
c4f23d77 4937
bd9b35c9
JH
4938$cat <<EOH
4939
4940Your C linker may need flags. For this question you should
4941include -L/whatever and any other flags used by the C linker, but you
4942should NOT include libraries like -lwhatever.
4943
4944Make sure you include the appropriate -L/path flags if your C linker
4945does not normally search all of the directories you specified above,
4946namely
4947 $libpth
4948To use no flags, specify the word "none".
4949
4950EOH
4951
4952rp="Any additional ld flags (NOT including libraries)?"
4953. ./myread
4954case "$ans" in
4955none) ldflags='';;
4956*) ldflags="$ans";;
4957esac
4958rmlist="$rmlist pdp11"
4959
4960: coherency check
4961echo " "
4962echo "Checking your choice of C compiler and flags for coherency..." >&4
4963$cat > try.c <<'EOF'
4964#include <stdio.h>
55954f19 4965int main() { printf("Ok\n"); return(0); }
bd9b35c9 4966EOF
7a282f6d 4967set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
4968shift
4969$cat >try.msg <<'EOM'
4970I've tried to compile and run the following simple program:
4971
4972EOM
4973$cat try.c >> try.msg
4974
4975$cat >> try.msg <<EOM
4976
4977I used the command:
4978
4979 $*
5440bc8e 4980 $run ./try
bd9b35c9
JH
4981
4982and I got the following output:
4983
4984EOM
4985dflt=y
73614538 4986if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5440bc8e
JH
4987 if $sh -c "$run ./try" >>try.msg 2>&1; then
4988 xxx=`$run ./try`
bd9b35c9
JH
4989 case "$xxx" in
4990 "Ok") dflt=n ;;
4991 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4992 case " $libs " in
4993 *" -lsfio "*)
4994 cat >> try.msg <<'EOQS'
4995If $libs contains -lsfio, and sfio is mis-configured, then it
4996sometimes (apparently) runs and exits with a 0 status, but with no
4997output! It may have to do with sfio's use of _exit vs. exit.
4998
4999EOQS
5000 rp="You have a big problem. Shall I abort Configure"
5001 dflt=y
5002 ;;
5003 esac
5004 ;;
5005 esac
5006 else
5007 echo "The program compiled OK, but exited with status $?." >>try.msg
5008 rp="You have a problem. Shall I abort Configure"
5009 dflt=y
5010 fi
5011else
5012 echo "I can't compile the test program." >>try.msg
5013 rp="You have a BIG problem. Shall I abort Configure"
5014 dflt=y
5015fi
5016case "$dflt" in
5017y)
5018 $cat try.msg >&4
5019 case "$knowitall" in
5020 '')
5021 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5022 ;;
bd9b35c9 5023 *) dflt=n;;
c4f23d77 5024 esac
bd9b35c9
JH
5025 echo " "
5026 . ./myread
5027 case "$ans" in
5028 n*|N*) ;;
5029 *) echo "Ok. Stopping Configure." >&4
5030 exit 1
c4f23d77
AD
5031 ;;
5032 esac
5033 ;;
bd9b35c9 5034n) echo "OK, that should do.";;
c4f23d77 5035esac
bd9b35c9 5036$rm -f try try.* core
c4f23d77 5037
bd9b35c9
JH
5038: define a shorthand compile call
5039compile='
5040mc_file=$1;
5041shift;
08413ebc 5042$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5043: define a shorthand compile call for compilations that should be ok.
5044compile_ok='
5045mc_file=$1;
5046shift;
7a282f6d 5047$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5048
8dfa8df9
JH
5049: determine filename position in cpp output
5050echo " "
5051echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5052case "$osname" in
5053vos) testaccess=-e ;;
5054*) testaccess=-r ;;
5055esac
8dfa8df9
JH
5056echo '#include <stdio.h>' > foo.c
5057$cat >fieldn <<EOF
5058$startsh
5059$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5060$grep '^[ ]*#.*stdio\.h' | \
5061while read cline; do
5062 pos=1
5063 set \$cline
5064 while $test \$# -gt 0; do
a5a94ea5 5065 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5066 echo "\$pos"
5067 exit 0
5068 fi
5069 shift
5070 pos=\`expr \$pos + 1\`
5071 done
5072done
5073EOF
5074chmod +x fieldn
5075fieldn=`./fieldn`
5076$rm -f foo.c fieldn
5077case $fieldn in
5078'') pos='???';;
50791) pos=first;;
50802) pos=second;;
50813) pos=third;;
5082*) pos="${fieldn}th";;
5083esac
5084echo "Your cpp writes the filename in the $pos field of the line."
5085
3c728e00
JH
5086case "$osname" in
5087vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5c728af0 5088os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5089*) cppfilter='' ;;
5090esac
8dfa8df9
JH
5091: locate header file
5092$cat >findhdr <<EOF
5093$startsh
5094wanted=\$1
5095name=''
5096for usrincdir in $usrinc
5097do
5098 if test -f \$usrincdir/\$wanted; then
5099 echo "\$usrincdir/\$wanted"
5100 exit 0
5101 fi
5102done
5103awkprg='{ print \$$fieldn }'
5104echo "#include <\$wanted>" > foo\$\$.c
5105$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5106$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5107while read cline; do
5108 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5109 case "\$name" in
5110 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5111 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5112 *) exit 2;;
5113 esac;
5114done;
5115#
5116# status = 0: grep returned 0 lines, case statement not executed
5117# status = 1: headerfile found
5118# status = 2: while loop executed, no headerfile found
5119#
5120status=\$?
5121$rm -f foo\$\$.c;
5122if test \$status -eq 1; then
5123 exit 0;
5124fi
5125exit 1
5126EOF
5127chmod +x findhdr
5128
5129: define an alternate in-header-list? function
5130inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5131cont=true; xxf="echo \"<\$1> found.\" >&4";
5132case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5133*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5134esac;
5135case $# in 4) instead=instead;; *) instead="at last";; esac;
5136while $test "$cont"; do
5137 xxx=`./findhdr $1`
5138 var=$2; eval "was=\$$2";
5139 if $test "$xxx" && $test -r "$xxx";
5140 then eval $xxf;
5141 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5142 cont="";
5143 else eval $xxnf;
5144 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5145 set $yyy; shift; shift; yyy=$@;
5146 case $# in 0) cont="";;
5147 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5148 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5149 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5150 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5151 esac;
5152done;
5153while $test "$yyy";
5154do set $yyy; var=$2; eval "was=\$$2";
5155 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5156 set $yyy; shift; shift; yyy=$@;
5157done'
5158
d1daaddf
JH
5159: see if stdlib is available
5160set stdlib.h i_stdlib
5161eval $inhdr
5162
5163: check for lengths of integral types
5164echo " "
5165case "$intsize" in
5166'')
5167 echo "Checking to see how big your integers are..." >&4
c63dfae1 5168 $cat >try.c <<EOCP
d1daaddf
JH
5169#include <stdio.h>
5170#$i_stdlib I_STDLIB
5171#ifdef I_STDLIB
5172#include <stdlib.h>
5173#endif
5174int main()
5175{
5176 printf("intsize=%d;\n", (int)sizeof(int));
5177 printf("longsize=%d;\n", (int)sizeof(long));
5178 printf("shortsize=%d;\n", (int)sizeof(short));
5179 exit(0);
5180}
5181EOCP
5182 set try
5183 if eval $compile_ok && $run ./try > /dev/null; then
5184 eval `$run ./try`
5185 echo "Your integers are $intsize bytes long."
5186 echo "Your long integers are $longsize bytes long."
5187 echo "Your short integers are $shortsize bytes long."
5188 else
5189 $cat >&4 <<EOM
5190!
5191Help! I can't compile and run the intsize test program: please enlighten me!
5192(This is probably a misconfiguration in your system or libraries, and
5193you really ought to fix it. Still, I'll try anyway.)
5194!
5195EOM
5196 dflt=4
5197 rp="What is the size of an integer (in bytes)?"
5198 . ./myread
5199 intsize="$ans"
5200 dflt=$intsize
5201 rp="What is the size of a long integer (in bytes)?"
5202 . ./myread
5203 longsize="$ans"
5204 dflt=2
5205 rp="What is the size of a short integer (in bytes)?"
5206 . ./myread
5207 shortsize="$ans"
5208 fi
5209 ;;
5210esac
5211$rm -f try try.*
5212
5213: check for long long
5214echo " "
5215echo "Checking to see if you have long long..." >&4
5216echo 'int main() { long long x = 7; return 0; }' > try.c
5217set try
5218if eval $compile; then
5219 val="$define"
5220 echo "You have long long."
5221else
5222 val="$undef"
5223 echo "You do not have long long."
5224fi
5225$rm try.*
5226set d_longlong
5227eval $setvar
5228
5229: check for length of long long
5230case "${d_longlong}${longlongsize}" in
5231$define)
5232 echo " "
5233 echo "Checking to see how big your long longs are..." >&4
5234 $cat >try.c <<'EOCP'
5235#include <stdio.h>
5236int main()
5237{
5238 printf("%d\n", (int)sizeof(long long));
5239 return(0);
5240}
5241EOCP
5242 set try
5243 if eval $compile_ok; then
5244 longlongsize=`$run ./try`
5245 echo "Your long longs are $longlongsize bytes long."
5246 else
5247 dflt='8'
5248 echo " "
5249 echo "(I can't seem to compile the test program. Guessing...)"
5250 rp="What is the size of a long long (in bytes)?"
5251 . ./myread
5252 longlongsize="$ans"
5253 fi
5254 if $test "X$longsize" = "X$longlongsize"; then
5255 echo "(That isn't any different from an ordinary long.)"
5256 fi
5257 ;;
5258esac
5259$rm -f try.* try
5260
8dfa8df9
JH
5261: see if inttypes.h is available
5262: we want a real compile instead of Inhdr because some systems
5263: have an inttypes.h which includes non-existent headers
5264echo " "
5265$cat >try.c <<EOCP
5266#include <inttypes.h>
5267int main() {
5268 static int32_t foo32 = 0x12345678;
5269}
5270EOCP
5271set try
5272if eval $compile; then
5273 echo "<inttypes.h> found." >&4
5274 val="$define"
5275else
5276 echo "<inttypes.h> NOT found." >&4
5277 val="$undef"
5278fi
5279$rm -f try.c try
5280set i_inttypes
5281eval $setvar
5282
5283: check for int64_t
5284echo " "
5285echo "Checking to see if you have int64_t..." >&4
5286$cat >try.c <<EOCP
5287#include <sys/types.h>
5288#$i_inttypes I_INTTYPES
5289#ifdef I_INTTYPES
5290#include <inttypes.h>
5291#endif
5292int main() { int64_t x = 7; }
5293EOCP
5294set try
5295if eval $compile; then
5296 val="$define"
5297 echo "You have int64_t."
5298else
5299 val="$undef"
5300 echo "You do not have int64_t."
5301fi
5302$rm -f try try.*
5303set d_int64_t
5304eval $setvar
5305
5306
5307echo " "
5308echo "Checking which 64-bit integer type we could use..." >&4
5309
5310case "$intsize" in
53118) val=int
5312 set quadtype
5313 eval $setvar
5314 val='"unsigned int"'
5315 set uquadtype
5316 eval $setvar
5317 quadkind=1
5318 ;;
5319*) case "$longsize" in
5320 8) val=long
5321 set quadtype
5322 eval $setvar
5323 val='"unsigned long"'
5324 set uquadtype
5325 eval $setvar
5326 quadkind=2
5327 ;;
5328 *) case "$d_longlong:$longlongsize" in
5329 define:8)
5330 val='"long long"'
5331 set quadtype
5332 eval $setvar
5333 val='"unsigned long long"'
5334 set uquadtype
5335 eval $setvar
5336 quadkind=3
5337 ;;
5338 *) case "$d_int64_t" in
5339 define)
5340 val=int64_t
5341 set quadtype
5342 eval $setvar
5343 val=uint64_t
5344 set uquadtype
5345 eval $setvar
5346 quadkind=4
5347 ;;
5348 esac
5349 ;;
5350 esac
5351 ;;
5352 esac
5353 ;;
5354esac
5355
5356case "$quadtype" in
5357'') echo "Alas, no 64-bit integer types in sight." >&4
5358 d_quad="$undef"
5359 ;;
5360*) echo "We could use '$quadtype' for 64-bit integers." >&4
5361 d_quad="$define"
5362 ;;
5363esac
5364
b4eb6b3d
JH
5365
5366case "$uselonglong" in
5367"$define"|true|[yY]*)
5368 cat <<EOM >&4
5369
5370*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5371EOM
5372 use64bitint="$define"
5373 ;;
5374esac
5375case "$use64bits" in
5376"$define"|true|[yY]*)
5377 cat <<EOM >&4
5378
5379*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5380EOM
5381 use64bitint="$define"
5382 ;;
5383esac
5384case "$use64bitints" in
5385"$define"|true|[yY]*)
5386 cat <<EOM >&4
5387
5388*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5389EOM
5390 use64bitint="$define"
5391 ;;
5392esac
5393case "$use64bitsint" in
5394"$define"|true|[yY]*)
5395 cat <<EOM >&4
5396
5397*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5398EOM
5399 use64bitint="$define"
5400 ;;
5401esac
5402case "$uselonglongs" in
5403"$define"|true|[yY]*)
5404 cat <<EOM >&4
5405
5406*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5407EOM
5408 use64bitint="$define"
5409 ;;
5410esac
5411case "$use64bitsall" in
5412"$define"|true|[yY]*)
5413 cat <<EOM >&4
5414
5415*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5416EOM
5417 use64bitall="$define"
5418 ;;
5419esac
5420
5421case "$ccflags" in
5422*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5423esac
5424case "$use64bitall" in
5425"$define"|true|[yY]*) use64bitint="$define" ;;
5426esac
5427
5428case "$longsize" in
54298) cat <<EOM
5430
5431You have natively 64-bit long integers.
5432EOM
5433 val="$define"
5434 ;;
5435*) case "$use64bitint" in
5436 "$define"|true|[yY]*) dflt='y';;
5437 *) dflt='n';;
5438 esac
8dfa8df9
JH
5439 case "$d_quad" in
5440 "$define") ;;
5441 *) dflt='n' ;;
5442 esac
b4eb6b3d
JH
5443 cat <<EOM
5444
5445Perl can be built to take advantage of 64-bit integer types
5446on some systems. To do so, Configure can be run with -Duse64bitint.
5447Choosing this option will most probably introduce binary incompatibilities.
5448
5449If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5450(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5451EOM
5452 rp='Try to use 64-bit integers, if available?'
5453 . ./myread
5454 case "$ans" in
5455 [yY]*) val="$define" ;;
5456 *) val="$undef" ;;
5457 esac
5458 ;;
5459esac
5460set use64bitint
5461eval $setvar
5462
5463case "$use64bitall" in
5464"$define"|true|[yY]*) dflt='y' ;;
5465*) case "$longsize" in
5466 8) dflt='y' ;;
5467 *) dflt='n' ;;
5468 esac
5469 ;;
5470esac
5471cat <<EOM
5472
5473You may also choose to try maximal 64-bitness. It means using as much
547464-bitness as possible on the platform. This in turn means even more
5475binary incompatibilities. On the other hand, your platform may not
5476have any more 64-bitness available than what you already have chosen.
5477
5478If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5479(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5480EOM
5481rp='Try to use maximal 64-bit support, if available?'
5482. ./myread
5483case "$ans" in
5484[yY]*) val="$define" ;;
5485*) val="$undef" ;;
5486esac
5487set use64bitall
5488eval $setvar
5489case "$use64bitall" in
5490"$define")
5491 case "$use64bitint" in
5492 "$undef")
5493 cat <<EOM
5494
5495Since you have chosen a maximally 64-bit build, I'm also turning on
5496the use of 64-bit integers.
5497EOM
5498 use64bitint="$define" ;;
5499 esac
5500 ;;
5501esac
5502
b4eb6b3d
JH
5503: Look for a hint-file generated 'call-back-unit'. If the
5504: user has specified that a 64-bit perl is to be built,
5505: we may need to set or change some other defaults.
19a100ff 5506if $test -f use64bitint.cbu; then
9da7673b 5507 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
19a100ff
MB
5508 . ./use64bitint.cbu
5509fi
9da7673b
MB
5510case "$use64bitint" in
5511"$define"|true|[yY]*)
b4eb6b3d
JH
5512 case "$longsize" in
5513 4) case "$archname64" in
5514 '') archname64=64int ;;
5515 esac
5516 ;;
5517 esac
5518 ;;
5519esac
5520
b4eb6b3d
JH
5521: Look for a hint-file generated 'call-back-unit'. If the
5522: user has specified that a maximally 64-bit perl is to be built,
5523: we may need to set or change some other defaults.
19a100ff 5524if $test -f use64bitall.cbu; then
9da7673b 5525 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
19a100ff
MB
5526 . ./use64bitall.cbu
5527fi
9da7673b
MB
5528case "$use64bitall" in
5529"$define"|true|[yY]*)
b4eb6b3d
JH
5530 case "$longsize" in
5531 4) case "$archname64" in
5532 ''|64int) archname64=64all ;;
5533 esac
5534 ;;
5535 esac
5536 ;;
5537esac
5538
1911a026
JH
5539case "$d_quad:$use64bitint" in
5540$undef:$define)
5541 cat >&4 <<EOF
5542
5543*** You have chosen to use 64-bit integers,
19a100ff 5544*** but none can be found.
09b58c7b 5545*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
1911a026
JH
5546*** Cannot continue, aborting.
5547
5548EOF
5549 exit 1
5550 ;;
5551esac
5552
36adc09b
JH
5553: check for length of double
5554echo " "
5555case "$doublesize" in
5556'')
5557 echo "Checking to see how big your double precision numbers are..." >&4
5558 $cat >try.c <<EOCP
5559#include <stdio.h>
1911a026
JH
5560#$i_stdlib I_STDLIB
5561#ifdef I_STDLIB
5562#include <stdlib.h>
5563#endif
36adc09b
JH
5564int main()
5565{
5566 printf("%d\n", (int)sizeof(double));
1911a026 5567 exit(0);
36adc09b
JH
5568}
5569EOCP
5570 set try
5571 if eval $compile_ok; then
5572 doublesize=`$run ./try`
5573 echo "Your double is $doublesize bytes long."
5574 else
5575 dflt='8'
5576 echo "(I can't seem to compile the test program. Guessing...)"
5577 rp="What is the size of a double precision number (in bytes)?"
5578 . ./myread
5579 doublesize="$ans"
5580 fi
5581 ;;
5582esac
5583$rm -f try.c try
5584
5585: check for long doubles
5586echo " "
5587echo "Checking to see if you have long double..." >&4
5588echo 'int main() { long double x = 7.0; }' > try.c
5589set try
5590if eval $compile; then
5591 val="$define"
5592 echo "You have long double."
5593else
5594 val="$undef"
5595 echo "You do not have long double."
5596fi
5597$rm try.*
5598set d_longdbl
5599eval $setvar
5600
5601: check for length of long double
5602case "${d_longdbl}${longdblsize}" in
5603$define)
5604 echo " "
5605 echo "Checking to see how big your long doubles are..." >&4
5606 $cat >try.c <<'EOCP'
5607#include <stdio.h>
5608int main()
5609{
5610 printf("%d\n", sizeof(long double));
5611}
5612EOCP
5613 set try
5614 set try
5615 if eval $compile; then
5616 longdblsize=`$run ./try`
5617 echo "Your long doubles are $longdblsize bytes long."
5618 else
5619 dflt='8'
5620 echo " "
5621 echo "(I can't seem to compile the test program. Guessing...)" >&4
5622 rp="What is the size of a long double (in bytes)?"
5623 . ./myread
5624 longdblsize="$ans"
5625 fi
5626 if $test "X$doublesize" = "X$longdblsize"; then
7ad90562
AD
5627 echo "That isn't any different from an ordinary double."
5628 echo "I'll keep your setting anyway, but you may see some"
5629 echo "harmless compilation warnings."
36adc09b
JH
5630 fi
5631 ;;
5632esac
5633$rm -f try.* try
5634
89ce900e 5635: determine the architecture name
b4eb6b3d 5636echo " "
89ce900e
JH
5637if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5638 tarch=`arch`"-$osname"
5639elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5640 if uname -m > tmparch 2>&1 ; then
5641 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5642 -e 's/$/'"-$osname/" tmparch`
5643 else
5644 tarch="$osname"
5645 fi
5646 $rm -f tmparch
b4eb6b3d 5647else
89ce900e 5648 tarch="$osname"
b4eb6b3d 5649fi
89ce900e
JH
5650case "$myarchname" in
5651''|"$tarch") ;;
5652*)
5653 echo "(Your architecture name used to be $myarchname.)"
5654 archname=''
5655 ;;
5656esac
5657case "$targetarch" in
5658'') ;;
5659*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5660esac
5661myarchname="$tarch"
5662case "$archname" in
5663'') dflt="$tarch";;
5664*) dflt="$archname";;
5665esac
5666rp='What is your architecture name'
5667. ./myread
5668archname="$ans"
5669case "$usethreads" in
5670$define)
5671 echo "Threads selected." >&4
5672 case "$archname" in
5673 *-thread*) echo "...and architecture name already has -thread." >&4
5674 ;;
5675 *) archname="$archname-thread"
5676 echo "...setting architecture name to $archname." >&4
5677 ;;
5678 esac
5679 ;;
5680esac
5681case "$usemultiplicity" in
5682$define)
5683 echo "Multiplicity selected." >&4
5684 case "$archname" in
5685 *-multi*) echo "...and architecture name already has -multi." >&4
5686 ;;
5687 *) archname="$archname-multi"
5688 echo "...setting architecture name to $archname." >&4
5689 ;;
5690 esac
5691 ;;
5692esac
5693case "$use64bitint$use64bitall" in
5694*"$define"*)
5695 case "$archname64" in
5696 '')
5697 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
bd9b35c9 5698 ;;
89ce900e
JH
5699 *)
5700 case "$use64bitint" in
5701 "$define") echo "64 bit integers selected." >&4 ;;
5702 esac
5703 case "$use64bitall" in
5704 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5705 esac
5706 case "$archname" in
5707 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5708 ;;
5709 *) archname="$archname-$archname64"
5710 echo "...setting architecture name to $archname." >&4
5711 ;;
5712 esac
c1a7f87b
JH
5713 ;;
5714 esac
89ce900e
JH
5715esac
5716case "$uselongdouble" in
5717$define)
5718 echo "Long doubles selected." >&4
5719 case "$longdblsize" in
5720 $doublesize)
5721 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5722 ;;
5723 *)
5724 case "$archname" in
5725 *-ld*) echo "...and architecture name already has -ld." >&4
5726 ;;
5727 *) archname="$archname-ld"
5728 echo "...setting architecture name to $archname." >&4
5729 ;;
5730 esac
bd9b35c9
JH
5731 ;;
5732 esac
bd9b35c9 5733 ;;
89ce900e
JH
5734esac
5735case "$useperlio" in
5736$define)
5737 echo "Perlio selected." >&4
5738 ;;
bd9b35c9 5739*)
89ce900e
JH
5740 echo "Perlio not selected, using stdio." >&4
5741 case "$archname" in
5742 *-stdio*) echo "...and architecture name already has -stdio." >&4
5743 ;;
5744 *) archname="$archname-stdio"
5745 echo "...setting architecture name to $archname." >&4
5746 ;;
5747 esac
bd9b35c9
JH
5748 ;;
5749esac
d2e0c6f7
JH
5750if $test -f archname.cbu; then
5751 echo "Your platform has some specific hints for architecture name, using them..."
5752 . ./archname.cbu
5753fi
bd9b35c9 5754
89ce900e
JH
5755: determine root of directory hierarchy where package will be installed.
5756case "$prefix" in
5757'')
5758 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5759 ;;
5760*?/)
5761 dflt=`echo "$prefix" | sed 's/.$//'`
5762 ;;
5763*)
5764 dflt="$prefix"
5765 ;;
5766esac
5767$cat <<EOM
c1a7f87b 5768
89ce900e
JH
5769By default, $package will be installed in $dflt/bin, manual pages
5770under $dflt/man, etc..., i.e. with $dflt as prefix for all
5771installation directories. Typically this is something like /usr/local.
5772If you wish to have binaries under /usr/bin but other parts of the
5773installation under /usr/local, that's ok: you will be prompted
5774separately for each of the installation directories, the prefix being
5775only used to set the defaults.
bd9b35c9
JH
5776
5777EOM
89ce900e
JH
5778fn=d~
5779rp='Installation prefix to use?'
5780. ./getfile
5781oldprefix=''
5782case "$prefix" in
5783'') ;;
5784*)
5785 case "$ans" in
5786 "$prefix") ;;
5787 *) oldprefix="$prefix";;
5788 esac
5789 ;;
bd9b35c9 5790esac
89ce900e
JH
5791prefix="$ans"
5792prefixexp="$ansexp"
bd9b35c9 5793
89ce900e
JH
5794case "$afsroot" in
5795'') afsroot=/afs ;;
5796*) afsroot=$afsroot ;;
8e07c86e 5797esac
29209bc5 5798
89ce900e
JH
5799: is AFS running?
5800echo " "
5801case "$afs" in
5802$define|true) afs=true ;;
5803$undef|false) afs=false ;;
5804*) if test -d $afsroot; then
5805 afs=true
c1a7f87b 5806 else
89ce900e
JH
5807 afs=false
5808 fi
5809 ;;
c1a7f87b 5810esac
89ce900e
JH
5811if $afs; then
5812 echo "AFS may be running... I'll be extra cautious then..." >&4
5813else
5814 echo "AFS does not seem to be running..." >&4
5815fi
b4eb6b3d
JH
5816
5817: determine installation prefix for where package is to be installed.
5818if $afs; then
5819$cat <<EOM
5820
5821Since you are running AFS, I need to distinguish the directory in which
5822files will reside from the directory in which they are installed (and from
5823which they are presumably copied to the former directory by occult means).
5824
5825EOM
5826 case "$installprefix" in
5827 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5828 *) dflt="$installprefix";;
5829 esac
5830else
5831$cat <<EOM
5832
5833In some special cases, particularly when building $package for distribution,
c2bfb7b1
MB
5834it is convenient to distinguish the directory in which files should be
5835installed from the directory ($prefix) in which they will
5836eventually reside. For most users, these two directories are the same.
b4eb6b3d
JH
5837
5838EOM
5839 case "$installprefix" in
5840 '') dflt=$prefix ;;
5841 *) dflt=$installprefix;;
5842 esac
5843fi
5844fn=d~
5845rp='What installation prefix should I use for installing files?'
5846. ./getfile
5847installprefix="$ans"
5848installprefixexp="$ansexp"
5849
5850: set the prefixit variable, to compute a suitable default value
5851prefixit='case "$3" in
5852""|none)
5853 case "$oldprefix" in
5854 "") eval "$1=\"\$$2\"";;
5855 *)
5856 case "$3" in
5857 "") eval "$1=";;
5858 none)
5859 eval "tp=\"\$$2\"";
5860 case "$tp" in
5861 ""|" ") eval "$1=\"\$$2\"";;
5862 *) eval "$1=";;
5863 esac;;
5864 esac;;
5865 esac;;
5866*)
5867 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5868 case "$tp" in
5869 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5870 /*-$oldprefix/*|\~*-$oldprefix/*)
5871 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5872 *) eval "$1=\"\$$2\"";;
5873 esac;;
5874esac'
5875
b4eb6b3d
JH
5876: get the patchlevel
5877echo " "
5878echo "Getting the current patchlevel..." >&4
5879if $test -r $rsrc/patchlevel.h;then
5880 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5881 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5882 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5883 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5884 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5885 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
151e6568 5886 perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
b4eb6b3d
JH
5887else
5888 revision=0
5889 patchlevel=0
5890 subversion=0
5891 api_revision=0
5892 api_version=0
5893 api_subversion=0
151e6568
MB
5894 perl_patchlevel=0
5895 $echo "(You do not have patchlevel.h. Eek.)"
b4eb6b3d 5896fi
151e6568
MB
5897if $test -r $rsrc/.patch ; then
5898 if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5899 perl_patchlevel=`cat $rsrc/.patch`
5900 fi
5901fi
861eb78d
AD
5902: Define a handy string here to avoid duplication in myconfig.SH and configpm.
5903version_patchlevel_string="version $patchlevel subversion $subversion"
151e6568 5904case "$perl_patchlevel" in
861eb78d
AD
59050|'') ;;
5906*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
151e6568 5907esac
861eb78d
AD
5908
5909$echo "(You have $package $version_patchlevel_string.)"
5910
b4eb6b3d
JH
5911case "$osname" in
5912dos|vms)
5913 : XXX Should be a Configure test for double-dots in filenames.
5914 version=`echo $revision $patchlevel $subversion | \
5915 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5916 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5917 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5918 ;;
5919*)
5920 version=`echo $revision $patchlevel $subversion | \
5921 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5922 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5923 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5924 ;;
5925esac
5926: Special case the 5.005_xx maintenance series, which used 5.005
5927: without any subversion label as a subdirectory in $sitelib
5928if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5929 api_versionstring='5.005'
5930fi
5931
5932: determine installation style
5933: For now, try to deduce it from prefix unless it is already set.
5934: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5935case "$installstyle" in
5936'') case "$prefix" in
5937 *perl*) dflt='lib';;
5938 *) dflt='lib/perl5' ;;
5939 esac
5940 ;;
5941*) dflt="$installstyle" ;;
5942esac
5943: Probably not worth prompting for this since we prompt for all
5944: the directories individually, and the prompt would be too long and
5945: confusing anyway.
5946installstyle=$dflt
5947
5948: determine where private library files go
5949: Usual default is /usr/local/lib/perl5/$version.
5950: Also allow things like /opt/perl/lib/$version, since
5951: /opt/perl/lib/perl5... would be redundant.
5952: The default "style" setting is made in installstyle.U
5953case "$installstyle" in
5954*lib/perl5*) set dflt privlib lib/$package/$version ;;
5955*) set dflt privlib lib/$version ;;
5956esac
5957eval $prefixit
5958$cat <<EOM
5959
5960There are some auxiliary files for $package that need to be put into a
5961private library directory that is accessible by everyone.
5962
5963EOM
5964fn=d~+
5965rp='Pathname where the private library files will reside?'
5966. ./getfile
5967privlib="$ans"
5968privlibexp="$ansexp"
5969: Change installation prefix, if necessary.
5970if $test X"$prefix" != X"$installprefix"; then
5971 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5972else
5973 installprivlib="$privlibexp"
5974fi
5975
5976: set the prefixup variable, to restore leading tilda escape
5977prefixup='case "$prefixexp" in
5978"$prefix") ;;
5979*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5980esac'
5981
5982: determine where public architecture dependent libraries go
5983set archlib archlib
5984eval $prefixit
5985: privlib default is /usr/local/lib/$package/$version
5986: archlib default is /usr/local/lib/$package/$version/$archname
5987: privlib may have an optional trailing /share.
5988tdflt=`echo $privlib | $sed 's,/share$,,'`
5989tdflt=$tdflt/$archname
5990case "$archlib" in
5991'') dflt=$tdflt
5992 ;;
5993*) dflt="$archlib"
5994 ;;
5995esac
5996$cat <<EOM
5997
5998$spackage contains architecture-dependent library files. If you are
5999sharing libraries in a heterogeneous environment, you might store
6000these files in a separate location. Otherwise, you can just include
6001them with the rest of the public library files.
6002
6003EOM
6004fn=d+~
6005rp='Where do you want to put the public architecture-dependent libraries?'
6006. ./getfile
6007archlib="$ans"
6008archlibexp="$ansexp"
6009if $test X"$archlib" = X"$privlib"; then
6010 d_archlib="$undef"
6011else
6012 d_archlib="$define"
6013fi
6014: Change installation prefix, if necessary.
6015if $test X"$prefix" != X"$installprefix"; then
6016 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6017else
6018 installarchlib="$archlibexp"
6019fi
6020
b4eb6b3d
JH
6021: see if setuid scripts can be secure
6022$cat <<EOM
6023
6024Some kernels have a bug that prevents setuid #! scripts from being
6025secure. Some sites have disabled setuid #! scripts because of this.
6026
6027First let's decide if your kernel supports secure setuid #! scripts.
6028(If setuid #! scripts would be secure but have been disabled anyway,
6029don't say that they are secure if asked.)
6030
6031EOM
6032
6033val="$undef"
6034if $test -d /dev/fd; then
6035 echo "#!$ls" >reflect
6036 chmod +x,u+s reflect
6037 ./reflect >flect 2>&1
6038 if $contains "/dev/fd" flect >/dev/null; then
6039 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6040 val="$define"
6041 else
6042 $cat <<EOM
6043If you are not sure if they are secure, I can check but I'll need a
6044username and password different from the one you are using right now.
6045If you don't have such a username or don't want me to test, simply
6046enter 'none'.
6047
6048EOM
6049 rp='Other username to test security of setuid scripts with?'
6050 dflt='none'
6051 . ./myread
6052 case "$ans" in
6053 n|none)
6054 case "$d_suidsafe" in
6055 '') echo "I'll assume setuid scripts are *not* secure." >&4
6056 dflt=n;;
6057 "$undef")
6058 echo "Well, the $hint value is *not* secure." >&4
6059 dflt=n;;
6060 *) echo "Well, the $hint value *is* secure." >&4
6061 dflt=y;;
6062 esac
c1a7f87b 6063 ;;
b4eb6b3d
JH
6064 *)
6065 $rm -f reflect flect
6066 echo "#!$ls" >reflect
6067 chmod +x,u+s reflect
6068 echo >flect
6069 chmod a+w flect
6070 echo '"su" will (probably) prompt you for '"$ans's password."
6071 su $ans -c './reflect >flect'
6072 if $contains "/dev/fd" flect >/dev/null; then
6073 echo "Okay, it looks like setuid scripts are secure." >&4
6074 dflt=y
6075 else
6076 echo "I don't think setuid scripts are secure." >&4
6077 dflt=n
6078 fi
6079 ;;
6080 esac
6081 rp='Does your kernel have *secure* setuid scripts?'
6082 . ./myread
6083 case "$ans" in
6084 [yY]*) val="$define";;
6085 *) val="$undef";;
6086 esac
6087 fi
6088else
6089 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6090 echo "(That's for file descriptors, not floppy disks.)"
6091 val="$undef"
6092fi
6093set d_suidsafe
6094eval $setvar
6095
6096$rm -f reflect flect
6097
6098: now see if they want to do setuid emulation
6099echo " "
6100val="$undef"
6101case "$d_suidsafe" in
6102"$define")
6103 val="$undef"
3c728e00 6104 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d
JH
6105 ;;
6106*)
6107 $cat <<EOM
6108Some systems have disabled setuid scripts, especially systems where
6109setuid scripts cannot be secure. On systems where setuid scripts have
6110been disabled, the setuid/setgid bits on scripts are currently
6111useless. It is possible for $package to detect those bits and emulate
6112setuid/setgid in a secure fashion. This emulation will only work if
6113setuid scripts have been disabled in your kernel.
6114
6115EOM
6116 case "$d_dosuid" in
6117 "$define") dflt=y ;;
6118 *) dflt=n ;;
6119 esac
6120 rp="Do you want to do setuid/setgid emulation?"
6121 . ./myread
6122 case "$ans" in
6123 [yY]*) val="$define";;
6124 *) val="$undef";;
6125 esac
6126 ;;
6127esac
6128set d_dosuid
6129eval $setvar
6130
b4eb6b3d 6131: see if this is a malloc.h system
01d07975
YST
6132: we want a real compile instead of Inhdr because some systems have a
6133: malloc.h that just gives a compile error saying to use stdlib.h instead
6134echo " "
6135$cat >try.c <<EOCP
6136#include <stdlib.h>
6137#include <malloc.h>
6138int main () { return 0; }
6139EOCP
6140set try
6141if eval $compile; then
6142 echo "<malloc.h> found." >&4
6143 val="$define"
6144else
6145 echo "<malloc.h> NOT found." >&4
6146 val="$undef"
6147fi
6148$rm -f try.c try
6149set i_malloc
6150eval $setvar
b4eb6b3d 6151
c8b93cf9
JH
6152: check for void type
6153echo " "
6154echo "Checking to see how well your C compiler groks the void type..." >&4
6155case "$voidflags" in
6156'')
c727eafa 6157 $cat >try.c <<EOCP
d1daaddf
JH
6158#$i_stdlib I_STDLIB
6159#ifdef I_STDLIB
6160#include <stdlib.h>
6161#endif
c8b93cf9
JH
6162#if TRY & 1
6163void sub() {
6164#else
6165sub() {
6166#endif
6167 extern void moo(); /* function returning void */
6168 void (*goo)(); /* ptr to func returning void */
6169#if TRY & 8
6170 void *hue; /* generic ptr */
6171#endif
6172#if TRY & 2
6173 void (*foo[10])();
6174#endif
6175
6176#if TRY & 4
6177 if(goo == moo) {
6178 exit(0);
6179 }
6180#endif
6181 exit(0);
6182}
6183int main() { sub(); }
6184EOCP
6185 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6186 voidflags=$defvoidused
6187 echo "Good. It appears to support void to the level $package wants.">&4
6188 if $contains warning .out >/dev/null 2>&1; then
6189 echo "However, you might get some warnings that look like this:"
6190 $cat .out
6191 fi
6192 else
6193echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6194 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6195 echo "It supports 1..."
6196 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6197 echo "It also supports 2..."
6198 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6199 voidflags=7
6200 echo "And it supports 4 but not 8 definitely."
6201 else
6202 echo "It doesn't support 4..."
6203 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6204 voidflags=11
6205 echo "But it supports 8."
6206 else
6207 voidflags=3
6208 echo "Neither does it support 8."
6209 fi
6210 fi
6211 else
6212 echo "It does not support 2..."
6213 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6214 voidflags=13
6215 echo "But it supports 4 and 8."
6216 else
6217 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6218 voidflags=5
6219 echo "And it supports 4 but has not heard about 8."
6220 else
6221 echo "However it supports 8 but not 4."
6222 fi
6223 fi
6224 fi
6225 else
6226 echo "There is no support at all for void."
6227 voidflags=0
6228 fi
6229 fi
6230esac
6231case "$voidflags" in
6232"$defvoidused") ;;
6233*) $cat >&4 <<'EOM'
6234 Support flag bits are:
6235 1: basic void declarations.
6236 2: arrays of pointers to functions returning void.
6237 4: operations between pointers to and addresses of void functions.
6238 8: generic void pointers.
6239EOM
6240 dflt="$voidflags";
6241 rp="Your void support flags add up to what?"
6242 . ./myread
6243 voidflags="$ans"
6244 ;;
6245esac
6246$rm -f try.* .out
6247
6248: check for length of pointer
6249echo " "
6250case "$ptrsize" in
6251'')
6252 echo "Checking to see how big your pointers are..." >&4
6253 if test "$voidflags" -gt 7; then
6254 echo '#define VOID_PTR char *' > try.c
6255 else
6256 echo '#define VOID_PTR void *' > try.c
6257 fi
74d00865 6258 $cat >>try.c <<EOCP
c8b93cf9 6259#include <stdio.h>
d1daaddf
JH
6260#$i_stdlib I_STDLIB
6261#ifdef I_STDLIB
6262#include <stdlib.h>
6263#endif
c8b93cf9
JH
6264int main()
6265{
6266 printf("%d\n", (int)sizeof(VOID_PTR));
6267 exit(0);
6268}
6269EOCP
6270 set try
6271 if eval $compile_ok; then
6272 ptrsize=`$run ./try`
6273 echo "Your pointers are $ptrsize bytes long."
6274 else
6275 dflt='4'
6276 echo "(I can't seem to compile the test program. Guessing...)" >&4
6277 rp="What is the size of a pointer (in bytes)?"
6278 . ./myread
6279 ptrsize="$ans"
6280 fi
6281 ;;
6282esac
6283$rm -f try.c try
6284case "$use64bitall" in
6285"$define"|true|[yY]*)
6286 case "$ptrsize" in
6287 4) cat <<EOM >&4
6288
1911a026
JH
6289*** You have chosen a maximally 64-bit build,
6290*** but your pointers are only 4 bytes wide.
09b58c7b
JH
6291*** Please rerun Configure without -Duse64bitall.
6292EOM
6293 case "$d_quad" in
6294 define)
6295 cat <<EOM >&4
6296*** Since you have quads, you could possibly try with -Duse64bitint.
6297EOM
6298 ;;
6299 esac
6300 cat <<EOM >&4
1911a026 6301*** Cannot continue, aborting.
c8b93cf9
JH
6302
6303EOM
09b58c7b 6304
1911a026 6305 exit 1
c8b93cf9
JH
6306 ;;
6307 esac
6308 ;;
6309esac
6310
19a100ff 6311
9df442c2
NC
6312: determine whether to use malloc wrapping
6313echo " "
6314case "$usemallocwrap" in
6315[yY]*|true|$define) dflt='y' ;;
6316[nN]*|false|$undef) dflt='n' ;;
6317*) case "$usedevel" in
6318 [yY]*|true|$define) dflt='y' ;;
6319 *) dflt='n' ;;
6320 esac
6321 ;;
6322esac
6323rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6324. ./myread
6325usemallocwrap="$ans"
6326case "$ans" in
6327y*|true)
6328 usemallocwrap="$define" ;;
6329*)
6330 usemallocwrap="$undef" ;;
6331esac
c8b93cf9 6332
b4eb6b3d
JH
6333: determine which malloc to compile in
6334echo " "
6335case "$usemymalloc" in
c4163172
JH
6336[yY]*|true|$define) dflt='y' ;;
6337[nN]*|false|$undef) dflt='n' ;;
6338*) case "$ptrsize" in
6339 4) dflt='y' ;;
6340 *) dflt='n' ;;
6341 esac
6342 ;;
8dfa8df9 6343esac
b4eb6b3d
JH
6344rp="Do you wish to attempt to use the malloc that comes with $package?"
6345. ./myread
6346usemymalloc="$ans"
6347case "$ans" in
6348y*|true)
6349 usemymalloc='y'
6350 mallocsrc='malloc.c'
6351 mallocobj="malloc$_o"
6352 d_mymalloc="$define"
6353 case "$libs" in
6354 *-lmalloc*)
6355 : Remove malloc from list of libraries to use
6356 echo "Removing unneeded -lmalloc from library list" >&4
6357 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6358 shift
6359 libs="$*"
6360 echo "libs = $libs" >&4
6361 ;;
6362 esac
6363 ;;
6364*)
6365 usemymalloc='n'
6366 mallocsrc=''
6367 mallocobj=''
6368 d_mymalloc="$undef"
6369 ;;
6370esac
6371
6372: compute the return types of malloc and free
6373echo " "
6374$cat >malloc.c <<END
6375#$i_malloc I_MALLOC
6376#$i_stdlib I_STDLIB
6377#include <stdio.h>
6378#include <sys/types.h>
6379#ifdef I_MALLOC
6380#include <malloc.h>
6381#endif
6382#ifdef I_STDLIB
6383#include <stdlib.h>
6384#endif
6385#ifdef TRY_MALLOC
6386void *malloc();
6387#endif
6388#ifdef TRY_FREE
6389void free();
6390#endif
6391END
6392case "$malloctype" in
6393'')
6394 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6395 malloctype='void *'
6396 else
6397 malloctype='char *'
6398 fi
6399 ;;
6400esac
6401echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6402
6403case "$freetype" in
6404'')
6405 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6406 freetype='void'
6407 else
6408 freetype='int'
6409 fi
6410 ;;
6411esac
6412echo "Your system uses $freetype free(), it would seem." >&4
6413$rm -f malloc.[co]
6414$cat <<EOM
6415
6416After $package is installed, you may wish to install various
6417add-on modules and utilities. Typically, these add-ons will
6418be installed under $prefix with the rest
6419of this package. However, you may wish to install such add-ons
6420elsewhere under a different prefix.
6421
6422If you do not wish to put everything under a single prefix, that's
6423ok. You will be prompted for the individual locations; this siteprefix
6424is only used to suggest the defaults.
6425
6426The default should be fine for most people.
6427
6428EOM
6429fn=d~+
6430rp='Installation prefix to use for add-on modules and utilities?'
6431: XXX Here might be another good place for an installstyle setting.
6432case "$siteprefix" in
6433'') dflt=$prefix ;;
6434*) dflt=$siteprefix ;;
6435esac
6436. ./getfile
6437: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6438oldsiteprefix=''
6439case "$siteprefix" in
6440'') ;;
6441*) case "$ans" in
6442 "$prefix") ;;
6443 *) oldsiteprefix="$prefix";;
6444 esac
6445 ;;
6446esac
6447siteprefix="$ans"
6448siteprefixexp="$ansexp"
6449
6450: determine where site specific libraries go.
6451: Usual default is /usr/local/lib/perl5/site_perl/$version
6452: The default "style" setting is made in installstyle.U
6453: XXX No longer works with Prefixit stuff.
6454prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6455case "$sitelib" in
6456'') case "$installstyle" in
6457 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6458 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6459 esac
6460 ;;
6461*) dflt="$sitelib"
6462 ;;
6463esac
6464$cat <<EOM
6465
6466The installation process will create a directory for
6467site-specific extensions and modules. Most users find it convenient
6468to place all site-specific files in this directory rather than in the
6469main distribution directory.
6470
6471EOM
6472fn=d~+
6473rp='Pathname for the site-specific library files?'
6474. ./getfile
6475sitelib="$ans"
6476sitelibexp="$ansexp"
6477sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6478: Change installation prefix, if necessary.
6479if $test X"$prefix" != X"$installprefix"; then
6480 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6481else
6482 installsitelib="$sitelibexp"
6483fi
6484
6485: determine where site specific architecture-dependent libraries go.
6486: sitelib default is /usr/local/lib/perl5/site_perl/$version
6487: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6488: sitelib may have an optional trailing /share.
6489case "$sitearch" in
6490'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6491 dflt="$dflt/$archname"
6492 ;;
6493*) dflt="$sitearch"
6494 ;;
6495esac
6496set sitearch sitearch none
6497eval $prefixit
6498$cat <<EOM
6499
6500The installation process will also create a directory for
6501architecture-dependent site-specific extensions and modules.
6502
6503EOM
6504fn=d~+
6505rp='Pathname for the site-specific architecture-dependent library files?'
6506. ./getfile
6507sitearch="$ans"
6508sitearchexp="$ansexp"
6509: Change installation prefix, if necessary.
6510if $test X"$prefix" != X"$installprefix"; then
6511 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6512else
6513 installsitearch="$sitearchexp"
6514fi
6515
6516$cat <<EOM
6517
6518The installation process will also create a directory for
6519vendor-supplied add-ons. Vendors who supply perl with their system
6520may find it convenient to place all vendor-supplied files in this
6521directory rather than in the main distribution directory. This will
6522ease upgrades between binary-compatible maintenance versions of perl.
6523
6524Of course you may also use these directories in whatever way you see
6525fit. For example, you might use them to access modules shared over a
6526company-wide network.
6527
6528The default answer should be fine for most people.
6529This causes further questions about vendor add-ons to be skipped
6530and no vendor-specific directories will be configured for perl.
6531
6532EOM
6533rp='Do you want to configure vendor-specific add-on directories?'
6534case "$usevendorprefix" in
6535define|true|[yY]*) dflt=y ;;
6536*) : User may have set vendorprefix directly on Configure command line.
6537 case "$vendorprefix" in
6538 ''|' ') dflt=n ;;
6539 *) dflt=y ;;
6540 esac
6541 ;;
6542esac
6543. ./myread
6544case "$ans" in
6545[yY]*) fn=d~+
6546 rp='Installation prefix to use for vendor-supplied add-ons?'
6547 case "$vendorprefix" in
6548 '') dflt='' ;;
6549 *) dflt=$vendorprefix ;;
6550 esac
6551 . ./getfile
6552 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6553 oldvendorprefix=''
6554 case "$vendorprefix" in
6555 '') ;;
6556 *) case "$ans" in
6557 "$prefix") ;;
6558 *) oldvendorprefix="$prefix";;
6559 esac
6560 ;;
6561 esac
6562 usevendorprefix="$define"
6563 vendorprefix="$ans"
6564 vendorprefixexp="$ansexp"
6565 ;;
6566*) usevendorprefix="$undef"
6567 vendorprefix=''
6568 vendorprefixexp=''
6569 ;;
6570esac
6571
6572case "$vendorprefix" in
6573'') d_vendorlib="$undef"
6574 vendorlib=''
6575 vendorlibexp=''
6576 ;;
6577*) d_vendorlib="$define"
6578 : determine where vendor-supplied modules go.
6579 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6580 case "$vendorlib" in
6581 '')
6582 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6583 case "$installstyle" in
6584 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6585 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6586 esac
6587 ;;
6588 *) dflt="$vendorlib"
6589 ;;
6590 esac
6591 fn=d~+
6592 rp='Pathname for the vendor-supplied library files?'
6593 . ./getfile
6594 vendorlib="$ans"
6595 vendorlibexp="$ansexp"
6596 ;;
6597esac
6598vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6599: Change installation prefix, if necessary.
6600if $test X"$prefix" != X"$installprefix"; then
6601 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6602else
6603 installvendorlib="$vendorlibexp"
6604fi
6605
6606case "$vendorprefix" in
6607'') d_vendorarch="$undef"
6608 vendorarch=''
6609 vendorarchexp=''
6610 ;;
6611*) d_vendorarch="$define"
6612 : determine where vendor-supplied architecture-dependent libraries go.
6613 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6614 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6615 : vendorlib may have an optional trailing /share.
6616 case "$vendorarch" in
6617 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6618 dflt="$dflt/$archname"
6619 ;;
6620 *) dflt="$vendorarch" ;;
6621 esac
6622 fn=d~+
6623 rp='Pathname for vendor-supplied architecture-dependent files?'
6624 . ./getfile
6625 vendorarch="$ans"
6626 vendorarchexp="$ansexp"
6627 ;;
6628esac
6629: Change installation prefix, if necessary.
6630if $test X"$prefix" != X"$installprefix"; then
6631 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6632else
6633 installvendorarch="$vendorarchexp"
6634fi
6635
6636: Final catch-all directories to search
6637$cat <<EOM
6638
6639Lastly, you can have perl look in other directories for extensions and
6640modules in addition to those already specified.
6641These directories will be searched after
6642 $sitearch
6643 $sitelib
6644EOM
6645test X"$vendorlib" != "X" && echo ' ' $vendorlib
6646test X"$vendorarch" != "X" && echo ' ' $vendorarch
6647echo ' '
6648case "$otherlibdirs" in
6649''|' ') dflt='none' ;;
6650*) dflt="$otherlibdirs" ;;
6651esac
6652$cat <<EOM
6653Enter a colon-separated set of extra paths to include in perl's @INC
6654search path, or enter 'none' for no extra paths.
6655
6656EOM
6657
6658rp='Colon-separated list of additional directories for perl to search?'
6659. ./myread
6660case "$ans" in
6661' '|''|none) otherlibdirs=' ' ;;
6662*) otherlibdirs="$ans" ;;
6663esac
6664case "$otherlibdirs" in
6665' ') val=$undef ;;
6666*) val=$define ;;
6667esac
6668set d_perl_otherlibdirs
6669eval $setvar
6670
6671: Cruising for prototypes
6672echo " "
6673echo "Checking out function prototypes..." >&4
55954f19
JH
6674$cat >prototype.c <<EOCP
6675#$i_stdlib I_STDLIB
6676#ifdef I_STDLIB
6677#include <stdlib.h>
6678#endif
b4eb6b3d
JH
6679int main(int argc, char *argv[]) {
6680 exit(0);}
6681EOCP
6682if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6683 echo "Your C compiler appears to support function prototypes."
6684 val="$define"
6685else
6686 echo "Your C compiler doesn't seem to understand function prototypes."
6687 val="$undef"
6688fi
6689set prototype
6690eval $setvar
6691$rm -f prototype*
6692
6693case "$prototype" in
6694"$define") ;;
6695*) ansi2knr='ansi2knr'
6696 echo " "
6697 cat <<EOM >&4
6698
6699$me: FATAL ERROR:
6700This version of $package can only be compiled by a compiler that
6701understands function prototypes. Unfortunately, your C compiler
6702 $cc $ccflags
6703doesn't seem to understand them. Sorry about that.
6704
6705If GNU cc is available for your system, perhaps you could try that instead.
6706
6707Eventually, we hope to support building Perl with pre-ANSI compilers.
6708If you would like to help in that effort, please contact <perlbug@perl.org>.
6709
6710Aborting Configure now.
6711EOM
6712 exit 2
6713 ;;
6714esac
6715
6716: determine where public executables go
6717echo " "
6718set dflt bin bin
6719eval $prefixit
6720fn=d~
6721rp='Pathname where the public executables will reside?'
6722. ./getfile
6723if $test "X$ansexp" != "X$binexp"; then
6724 installbin=''
6725fi
6726bin="$ans"
6727binexp="$ansexp"
6728: Change installation prefix, if necessary.
6729: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6730if $test X"$prefix" != X"$installprefix"; then
6731 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6732else
6733 installbin="$binexp"
6734fi
6735
6fcddf3b 6736echo " "
6fcddf3b 6737case "$extras" in
bf35c3f6
JH
6738'') dflt='n';;
6739*) dflt='y';;
6fcddf3b
JH
6740esac
6741cat <<EOM
6742Perl can be built with extra modules or bundles of modules which
6743will be fetched from the CPAN and installed alongside Perl.
6744
6745Notice that you will need access to the CPAN; either via the Internet,
6746or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
6747be asked later to configure the CPAN.pm module which will in turn do
6748the installation of the rest of the extra modules or bundles.)
6749
6750Notice also that if the modules require any external software such as
dd2de242
JH
6751libraries and headers (the libz library and the zlib.h header for the
6752Compress::Zlib module, for example) you MUST have any such software
6753already installed, this configuration process will NOT install such
6754things for you.
6fcddf3b
JH
6755
6756If this doesn't make any sense to you, just accept the default '$dflt'.
6757EOM
dd2de242 6758rp='Install any extra modules (y or n)?'
6fcddf3b
JH
6759. ./myread
6760case "$ans" in
6761y|Y)
6762 cat <<EOM
6763
6764Please list any extra modules or bundles to be installed from CPAN,
6765with spaces between the names. The names can be in any format the
dd2de242
JH
6766'install' command of CPAN.pm will understand. (Answer 'none',
6767without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
6768EOM
6769 rp='Extras?'
6770 dflt="$extras"
6771 . ./myread
6772 extras="$ans"
6773esac
6774case "$extras" in
6775''|'none')
6776 val=''
6777 $rm -f ../extras.lst
6778 ;;
6779*) echo "(Saving the list of extras for later...)"
dd2de242
JH
6780 echo "$extras" > ../extras.lst
6781 val="'$extras'"
6fcddf3b
JH
6782 ;;
6783esac
6784set extras
6785eval $setvar
6786echo " "
6787
6e1038e0
MB
6788: determine where html pages for programs go
6789set html1dir html1dir none
6790eval $prefixit
6791$cat <<EOM
6792
6793If you wish to install html files for programs in $spackage, indicate
6794the appropriate directory here. To skip installing html files,
6795answer "none".
6796EOM
6797case "$html1dir" in
6798''|none|$undef|' ') dflt=none ;;
6799*) dflt=$html1dir ;;
6800esac
6801fn=dn+~
6802rp="Directory for the main $spackage html pages?"
6803. ./getfile
6804html1dir="$ans"
6805html1direxp="$ansexp"
6806: Use ' ' for none so value is preserved next time through Configure
6807$test X"$html1dir" = "X" && html1dir=' '
6808: Change installation prefix, if necessary.
6809if $test X"$prefix" != X"$installprefix"; then
6810 installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
6811else
6812 installhtml1dir="$html1direxp"
6813fi
6814
6815: determine where html pages for libraries and modules go
6816set html3dir html3dir none
6817eval $prefixit
6818$cat <<EOM
6819
6820If you wish to install html files for modules associated with $spackage,
6821indicate the appropriate directory here. To skip installing html files,
6822answer "none".
6823EOM
6824: There is no obvious default. If they have specified html1dir, then
6825: try to key off that, possibly changing .../html1 into .../html3.
6826case "$html3dir" in
6827'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6828*) dflt=$html3dir ;;
6829esac
6830fn=dn+~
6831rp="Directory for the $spackage module html pages?"
6832. ./getfile
6833html3dir="$ans"
6834html3direxp="$ansexp"
6835: Use ' ' for none so value is preserved next time through Configure
6836$test X"$html3dir" = "X" && html3dir=' '
6837: Change installation prefix, if necessary.
6838if $test X"$prefix" != X"$installprefix"; then
6839 installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
6840else
6841 installhtml3dir="$html3direxp"
6842fi
6843
b4eb6b3d
JH
6844: Find perl5.005 or later.
6845echo "Looking for a previously installed perl5.005 or later... "
6846case "$perl5" in
a938a3bb 6847'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
b4eb6b3d 6848 : Check if this perl is recent and can load a simple module
a938a3bb 6849 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
b4eb6b3d
JH
6850 perl5=$tdir/perl
6851 break;
a938a3bb
IZ
6852 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6853 perl5=$tdir/perl5
b4eb6b3d
JH
6854 break;
6855 fi
89ce900e
JH
6856 done
6857 ;;
6858*) perl5="$perl5"
6859 ;;
6860esac
6861case "$perl5" in
6862'') echo "None found. That's ok.";;
6863*) echo "Using $perl5." ;;
6864esac
6865
6866: Determine list of previous versions to include in @INC
6867$cat > getverlist <<EOPL
6868#!$perl5 -w
6869use File::Basename;
6870\$api_versionstring = "$api_versionstring";
6871\$version = "$version";
6872\$stem = "$sitelib_stem";
6873\$archname = "$archname";
6874EOPL
6875 $cat >> getverlist <<'EOPL'
6876# Can't have leading @ because metaconfig interprets it as a command!
6877;@inc_version_list=();
6878# XXX Redo to do opendir/readdir?
6879if (-d $stem) {
6880 chdir($stem);
6881 ;@candidates = glob("5.*");
6882}
6883else {
6884 ;@candidates = ();
6885}
6886
6887# XXX ToDo: These comparisons must be reworked when two-digit
6888# subversions come along, so that 5.7.10 compares as greater than
6889# 5.7.3! By that time, hope that 5.6.x is sufficiently
6890# widespread that we can use the built-in version vectors rather
6891# than reinventing them here. For 5.6.0, however, we must
6892# assume this script will likely be run by 5.005_0x. --AD 1/2000.
6893foreach $d (@candidates) {
6894 if ($d lt $version) {
6895 if ($d ge $api_versionstring) {
6896 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6897 }
6898 elsif ($d ge "5.005") {
6899 unshift(@inc_version_list, grep { -d } $d);
6900 }
6901 }
6902 else {
6903 # Skip newer version. I.e. don't look in
6904 # 5.7.0 if we're installing 5.6.1.
6905 }
6906}
6907
6908if (@inc_version_list) {
6909 print join(' ', @inc_version_list);
6910}
6911else {
6912 # Blank space to preserve value for next Configure run.
6913 print " ";
6914}
6915EOPL
6916chmod +x getverlist
6917case "$inc_version_list" in
6918'') if test -x "$perl5$exe_ext"; then
6919 dflt=`$perl5 getverlist`
6920 else
6921 dflt='none'
6922 fi
6923 ;;
6924$undef) dflt='none' ;;
6925*) eval dflt=\"$inc_version_list\" ;;
6926esac
6927case "$dflt" in
6928''|' ') dflt=none ;;
6929esac
6930case "$dflt" in
69315.005) dflt=none ;;
6932esac
6933$cat <<EOM
6934
6935In order to ease the process of upgrading, this version of perl
6936can be configured to use modules built and installed with earlier
6937versions of perl that were installed under $prefix. Specify here
6938the list of earlier versions that this version of perl should check.
6939If Configure detected no earlier versions of perl installed under
6940$prefix, then the list will be empty. Answer 'none' to tell perl
6941to not search earlier versions.
6942
6943The default should almost always be sensible, so if you're not sure,
6944just accept the default.
6945EOM
6946
6947rp='List of earlier versions to include in @INC?'
6948. ./myread
6949case "$ans" in
d2556f21 6950[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
89ce900e
JH
6951*) inc_version_list="$ans" ;;
6952esac
6953case "$inc_version_list" in
6954''|' ')
6955 inc_version_list_init='0';;
6956*) inc_version_list_init=`echo $inc_version_list |
6957 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6958 ;;
6959esac
6960$rm -f getverlist
6961
6962: determine whether to install perl also as /usr/bin/perl
6963
6964echo " "
6965if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6966 $cat <<EOM
6967Many scripts expect perl to be installed as /usr/bin/perl.
6968
6969If you want to, I can install the perl you are about to compile
6970as /usr/bin/perl (in addition to $bin/perl).
6971EOM
6972 if test -f /usr/bin/perl; then
6973 $cat <<EOM
6974
6975However, please note that because you already have a /usr/bin/perl,
6976overwriting that with a new Perl would very probably cause problems.
6977Therefore I'm assuming you don't want to do that (unless you insist).
6978
6979EOM
6980 case "$installusrbinperl" in
6981 "$define"|[yY]*) dflt='y';;
6982 *) dflt='n';;
6983 esac
6984 else
6985 $cat <<EOM
6986
6987Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
6988
6989EOM
6990 case "$installusrbinperl" in
6991 "$undef"|[nN]*) dflt='n';;
6992 *) dflt='y';;
6993 esac
6994 fi
6995 rp="Do you want to install perl as /usr/bin/perl?"
6996 . ./myread
6997 case "$ans" in
6998 [yY]*) val="$define";;
6999 *) val="$undef" ;;
7000 esac
7001else
7002 val="$undef"
7003fi
7004set installusrbinperl
7005eval $setvar
7006
7007echo " "
7008echo "Checking for GNU C Library..." >&4
7009cat >try.c <<'EOCP'
7010/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7011 alone are insufficient to distinguish different versions, such as
7012 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7013 libc version 2.1.0. A. Dougherty, June 3, 2002.
7014*/
7015#include <stdio.h>
7016int main(void)
7017{
7018#ifdef __GLIBC__
7019# ifdef __GLIBC_MINOR__
7020# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7021# include <gnu/libc-version.h>
7022 printf("%s\n", gnu_get_libc_version());
7023# else
7024 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7025# endif
7026# else
7027 printf("%d\n", __GLIBC__);
7028# endif
7029 return 0;
7030#else
7031 return 1;
7032#endif
7033}
7034EOCP
7035set try
7036if eval $compile_ok && $run ./try > glibc.ver; then
7037 val="$define"
7038 gnulibc_version=`$cat glibc.ver`
7039 echo "You are using the GNU C Library version $gnulibc_version"
7040else
7041 val="$undef"
7042 gnulibc_version=''
7043 echo "You are not using the GNU C Library"
7044fi
7045$rm -f try try.* glibc.ver
7046set d_gnulibc
7047eval $setvar
7048
7049: see if nm is to be used to determine whether a symbol is defined or not
7050case "$usenm" in
7051'')
7052 dflt=''
7053 case "$d_gnulibc" in
7054 "$define")
7055 echo " "
7056 echo "nm probably won't work on the GNU C Library." >&4
7057 dflt=n
7058 ;;
7059 esac
7060 case "$dflt" in
7061 '')
7062 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7063 echo " "
7064 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7065 echo "'nm' won't be sufficient on this sytem." >&4
7066 dflt=n
7067 fi
7068 ;;
7069 esac
7070 case "$dflt" in
7071 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7072 if $test $dflt -gt 20; then
7073 dflt=y
7074 else
7075 dflt=n
7076 fi
7077 ;;
7078 esac
b4eb6b3d 7079 ;;
89ce900e
JH
7080*)
7081 case "$usenm" in
7082 true|$define) dflt=y;;
7083 *) dflt=n;;
7084 esac
b4eb6b3d
JH
7085 ;;
7086esac
89ce900e 7087$cat <<EOM
b4eb6b3d 7088
89ce900e
JH
7089I can use $nm to extract the symbols from your C libraries. This
7090is a time consuming task which may generate huge output on the disk (up
7091to 3 megabytes) but that should make the symbols extraction faster. The
7092alternative is to skip the 'nm' extraction part and to compile a small
7093test program instead to determine whether each symbol is present. If
7094you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7095this may be the best solution.
b4eb6b3d 7096
89ce900e 7097You probably shouldn't let me use 'nm' if you are using the GNU C Library.
b4eb6b3d 7098
89ce900e
JH
7099EOM
7100rp="Shall I use $nm to extract C symbols from the libraries?"
7101. ./myread
7102case "$ans" in
7103[Nn]*) usenm=false;;
7104*) usenm=true;;
b4eb6b3d 7105esac
89ce900e
JH
7106
7107runnm=$usenm
7108case "$reuseval" in
7109true) runnm=false;;
b4eb6b3d 7110esac
b4eb6b3d 7111
89ce900e
JH
7112: nm options which may be necessary
7113case "$nm_opt" in
7114'') if $test -f /mach_boot; then
7115 nm_opt='' # Mach
7116 elif $test -d /usr/ccs/lib; then
7117 nm_opt='-p' # Solaris (and SunOS?)
7118 elif $test -f /dgux; then
7119 nm_opt='-p' # DG-UX
7120 elif $test -f /lib64/rld; then
7121 nm_opt='-p' # 64-bit Irix
7122 else
7123 nm_opt=''
7124 fi;;
7125esac
b4eb6b3d 7126
89ce900e
JH
7127: nm options which may be necessary for shared libraries but illegal
7128: for archive libraries. Thank you, Linux.
7129case "$nm_so_opt" in
7130'') case "$myuname" in
fb2e1bc0 7131 *linux*|gnu*)
89ce900e
JH
7132 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7133 nm_so_opt='--dynamic'
7134 fi
7135 ;;
7136 esac
7137 ;;
7138esac
b4eb6b3d 7139
89ce900e
JH
7140case "$runnm" in
7141true)
7142: get list of predefined functions in a handy place
7143echo " "
7144case "$libc" in
7145'') libc=unknown
7146 case "$libs" in
7147 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7148 esac
7149 ;;
b4eb6b3d 7150esac
89ce900e
JH
7151case "$libs" in
7152'') ;;
7153*) for thislib in $libs; do
7154 case "$thislib" in
7155 -lc|-lc_s)
7156 : Handle C library specially below.
7157 ;;
7158 -l*)
7159 thislib=`echo $thislib | $sed -e 's/^-l//'`
7160 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7161 :
7162 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7163 :
7164 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7165 :
7166 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7167 :
7168 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7169 :
7170 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7171 :
7172 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7173 :
7174 else
7175 try=''
7176 fi
7177 libnames="$libnames $try"
7178 ;;
7179 *) libnames="$libnames $thislib" ;;
7180 esac
7181 done
b4eb6b3d
JH
7182 ;;
7183esac
89ce900e
JH
7184xxx=normal
7185case "$libc" in
7186unknown)
7187 set /lib/libc.$so
7188 for xxx in $libpth; do
7189 $test -r $1 || set $xxx/libc.$so
7190 : The messy sed command sorts on library version numbers.
7191 $test -r $1 || \
7192 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7193 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7194 h
7195 s/[0-9][0-9]*/0000&/g
7196 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7197 G
7198 s/\n/ /' | \
7199 $sort | $sed -e 's/^.* //'`
7200 eval set \$$#
7201 done
7202 $test -r $1 || set /usr/ccs/lib/libc.$so
7203 $test -r $1 || set /lib/libsys_s$_a
7204 ;;
7205*)
7206 set blurfl
7207 ;;
7208esac
7209if $test -r "$1"; then
7210 echo "Your (shared) C library seems to be in $1."
7211 libc="$1"
7212elif $test -r /lib/libc && $test -r /lib/clib; then
7213 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7214 xxx=apollo
7215 libc='/lib/clib /lib/libc'
7216 if $test -r /lib/syslib; then
7217 echo "(Your math library is in /lib/syslib.)"
7218 libc="$libc /lib/syslib"
7219 fi
7220elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7221 echo "Your C library seems to be in $libc, as you said before."
7222elif $test -r $incpath/usr/lib/libc$_a; then
7223 libc=$incpath/usr/lib/libc$_a;
7224 echo "Your C library seems to be in $libc. That's fine."
7225elif $test -r /lib/libc$_a; then
7226 libc=/lib/libc$_a;
7227 echo "Your C library seems to be in $libc. You're normal."
7228else
7229 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7230 :
7231 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7232 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7233 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7234 :
7235 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7236 :
7237 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7238 :
7239 else
7240 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7241 fi
7242 if $test -r "$tans"; then
7243 echo "Your C library seems to be in $tans, of all places."
7244 libc=$tans
7245 else
7246 libc='blurfl'
7247 fi
7248fi
7249if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7250 dflt="$libc"
7251 cat <<EOM
b4eb6b3d 7252
89ce900e
JH
7253If the guess above is wrong (which it might be if you're using a strange
7254compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7255
89ce900e
JH
7256EOM
7257else
7258 dflt=''
7259 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7260 cat >&4 <<EOM
7261I can't seem to find your C library. I've looked in the following places:
5e366f65 7262
b4eb6b3d 7263EOM
89ce900e
JH
7264 $sed 's/^/ /' libpath
7265 cat <<EOM
5e366f65 7266
89ce900e 7267None of these seems to contain your C library. I need to get its name...
5e366f65
JH
7268
7269EOM
89ce900e
JH
7270fi
7271fn=f
7272rp='Where is your C library?'
7273. ./getfile
7274libc="$ans"
5e366f65 7275
89ce900e
JH
7276echo " "
7277echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7278set X `cat libnames`
7279shift
7280xxx=files
7281case $# in 1) xxx=file; esac
7282echo "Extracting names from the following $xxx for later perusal:" >&4
7283echo " "
7284$sed 's/^/ /' libnames >&4
7285echo " "
7286$echo $n "This may take a while...$c" >&4
5e366f65 7287
89ce900e
JH
7288for file in $*; do
7289 case $file in
7290 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7291 *) $nm $nm_opt $file 2>/dev/null;;
b4eb6b3d 7292 esac
89ce900e
JH
7293done >libc.tmp
7294
7295$echo $n ".$c"
7296$grep fprintf libc.tmp > libc.ptf
7297xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7298xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7299xxx='[ADTSIW]'
ab900c53 7300if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
89ce900e
JH
7301 eval $xscan;\
7302 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7303 eval $xrun
7304elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7305 eval $xscan;\
7306 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7307 eval $xrun
7308elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7309 eval $xscan;\
7310 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7311 eval $xrun
7312elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7313 eval $xscan;\
7314 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7315 eval $xrun
7316elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7317 eval $xscan;\
7318 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7319 eval $xrun
7320elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7321 eval $xscan;\
7322 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7323 eval $xrun
7324elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7325 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7326 eval $xscan;\
7327 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7328 eval $xrun
7329elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7330 eval $xscan;\
7331 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7332 eval $xrun
7333elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7334 eval $xscan;\
7335 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7336 eval $xrun
7337elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7338 eval $xscan;\
7339 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7340 eval $xrun
7341elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7342 eval $xscan;\
7343 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7344 eval $xrun
7345elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7346 eval $xscan;\
7347 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7348 eval $xrun
7349elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7350 eval $xscan;\
7351 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7352 eval $xrun
7353elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7354 eval $xscan;\
7355 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7356 eval $xrun
b4eb6b3d 7357else
89ce900e
JH
7358 $nm -p $* 2>/dev/null >libc.tmp
7359 $grep fprintf libc.tmp > libc.ptf
7360 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7361 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7362 then
7363 nm_opt='-p'
7364 eval $xrun
7365 else
7366 echo " "
7367 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7368 com=''
7369 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7370 for thisname in $libnames $libc; do
7371 $ar t $thisname >>libc.tmp
7372 done
7373 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7374 echo "Ok." >&4
7375 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7376 # Repeat libc to extract forwarders to DLL entries too
7377 for thisname in $libnames $libc; do
7378 $ar tv $thisname >>libc.tmp
7379 # Revision 50 of EMX has bug in $ar.
7380 # it will not extract forwarders to DLL entries
7381 # Use emximp which will extract exactly them.
7382 emximp -o tmp.imp $thisname \
7383 2>/dev/null && \
7384 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7385 < tmp.imp >>libc.tmp
7386 $rm tmp.imp
7387 done
7388 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7389 echo "Ok." >&4
7390 else
7391 echo "$ar didn't seem to work right." >&4
7392 echo "Maybe this is a Cray...trying bld instead..." >&4
7393 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7394 then
7395 for thisname in $libnames; do
7396 bld t $libnames | \
7397 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7398 $ar t $thisname >>libc.tmp
7399 done
7400 echo "Ok." >&4
7401 else
7402 echo "That didn't work either. Giving up." >&4
7403 exit 1
7404 fi
7405 fi
7406 fi
b4eb6b3d 7407fi
89ce900e
JH
7408nm_extract="$com"
7409case "$PASE" in
7410define)
7411 echo " "
7412 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7413 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7414 ;;
7415*) if $test -f /lib/syscalls.exp; then
7416 echo " "
7417 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7418 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' /lib/syscalls.exp >>libc.list
7419 fi
7420 ;;
7421esac
7422;;
7423esac
7424$rm -f libnames libpath
b4eb6b3d
JH
7425
7426: see if dld is available
7427set dld.h i_dld
7428eval $inhdr
7429
89ce900e
JH
7430: is a C symbol defined?
7431csym='tlook=$1;
7432case "$3" in
373dfab3
JH
7433-v) tf=libc.tmp; tdc="";;
7434-a) tf=libc.tmp; tdc="[]";;
7435*) tlook="^$1\$"; tf=libc.list; tdc="()";;
89ce900e
JH
7436esac;
7437tx=yes;
7438case "$reuseval-$4" in
7439true-) ;;
7440true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7441esac;
7442case "$tx" in
7443yes)
ab900c53 7444 tval=false;
5129fff4
JH
7445 if $test "$runnm" = true; then
7446 if $contains $tlook $tf >/dev/null 2>&1; then
ab900c53 7447 tval=true;
5129fff4 7448 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
373dfab3 7449 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7450 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
373dfab3
JH
7451 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7452 $rm -f try$_exe try.c core core.* try.core;
89ce900e 7453 fi;
5129fff4 7454 else
373dfab3 7455 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7456 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
373dfab3 7457 $rm -f try$_exe try.c;
ab900c53
AB
7458 fi;
7459 ;;
89ce900e
JH
7460*)
7461 case "$tval" in
7462 $define) tval=true;;
7463 *) tval=false;;
ab900c53
AB
7464 esac;
7465 ;;
89ce900e
JH
7466esac;
7467eval "$2=$tval"'
7468
7469: define an is-in-libc? function
7470inlibc='echo " "; td=$define; tu=$undef;
7471sym=$1; var=$2; eval "was=\$$2";
7472tx=yes;
7473case "$reuseval$was" in
7474true) ;;
7475true*) tx=no;;
7476esac;
7477case "$tx" in
7478yes)
7479 set $sym tres -f;
7480 eval $csym;
7481 case "$tres" in
7482 true)
7483 echo "$sym() found." >&4;
7484 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7485 *)
7486 echo "$sym() NOT found." >&4;
7487 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7488 esac;;
7489*)
7490 case "$was" in
7491 $define) echo "$sym() found." >&4;;
7492 *) echo "$sym() NOT found." >&4;;
7493 esac;;
7494esac'
7495
b4eb6b3d
JH
7496: see if dlopen exists
7497xxx_runnm="$runnm"
7498runnm=false
7499set dlopen d_dlopen
7500eval $inlibc
7501runnm="$xxx_runnm"
7502
7503: determine which dynamic loading, if any, to compile in
7504echo " "
7505dldir="ext/DynaLoader"
7506case "$usedl" in
7507$define|y|true)
7508 dflt='y'
7509 usedl="$define"
7510 ;;
7511$undef|n|false)
7512 dflt='n'
7513 usedl="$undef"
7514 ;;
7515*)
7516 dflt='n'
7517 case "$d_dlopen" in
7518 $define) dflt='y' ;;
7519 esac
7520 case "$i_dld" in
7521 $define) dflt='y' ;;
7522 esac
7523 : Does a dl_xxx.xs file exist for this operating system
7524 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7525 ;;
7526esac
7527rp="Do you wish to use dynamic loading?"
7528. ./myread
7529usedl="$ans"
7530case "$ans" in
7531y*) usedl="$define"
7532 case "$dlsrc" in
7533 '')
7534 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7535 dflt="$dldir/dl_${osname}.xs"
7536 elif $test "$d_dlopen" = "$define" ; then
7537 dflt="$dldir/dl_dlopen.xs"
7538 elif $test "$i_dld" = "$define" ; then
7539 dflt="$dldir/dl_dld.xs"
7540 else
7541 dflt=''
7542 fi
7543 ;;
7544 *) dflt="$dldir/$dlsrc"
7545 ;;
7546 esac
7547 echo "The following dynamic loading files are available:"
7548 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7549 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7550 rp="Source file to use for dynamic loading"
7551 fn="fne"
7552 gfpth="$src"
7553 . ./getfile
7554 usedl="$define"
7555 : emulate basename
7556 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7557
7558 $cat << EOM
7559
7560Some systems may require passing special flags to $cc -c to
7561compile modules that will be used to create a shared library.
7562To use no flags, say "none".
7563
7564EOM
7565 case "$cccdlflags" in
7566 '') case "$gccversion" in
7567 '') case "$osname" in
7568 hpux) dflt='+z' ;;
7569 next) dflt='none' ;;
7570 irix*) dflt='-KPIC' ;;
48bcfe03 7571 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7572 sunos) dflt='-pic' ;;
7573 *) dflt='none' ;;
7574 esac
7575 ;;
7576 *) case "$osname" in
b6cc0f4c 7577 darwin) dflt='none' ;;
48bcfe03 7578 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7579 *) dflt='-fpic' ;;
7580 esac ;;
7581 esac ;;
7582 ' ') dflt='none' ;;
7583 *) dflt="$cccdlflags" ;;
7584 esac
7585 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7586 . ./myread
7587 case "$ans" in
7588 none) cccdlflags=' ' ;;
7589 *) cccdlflags="$ans" ;;
7590 esac
7591
7592 cat << EOM
7593
7594Some systems use ld to create libraries that can be dynamically loaded,
7595while other systems (such as those using ELF) use $cc.
7596
7597EOM
7598 case "$ld" in
55954f19 7599 '') $cat >try.c <<EOM
b4eb6b3d
JH
7600/* Test for whether ELF binaries are produced */
7601#include <fcntl.h>
55954f19
JH
7602#$i_stdlib I_STDLIB
7603#ifdef I_STDLIB
b4eb6b3d 7604#include <stdlib.h>
55954f19 7605#endif
b4eb6b3d
JH
7606int main() {
7607 char b[4];
7608 int i = open("a.out",O_RDONLY);
7609 if(i == -1)
7610 exit(1); /* fail */
7611 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7612 exit(0); /* succeed (yes, it's ELF) */
7613 else
7614 exit(1); /* fail */
7615}
7616EOM
5440bc8e 7617 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7618 cat <<EOM
7619You appear to have ELF support. I'll use $cc to build dynamic libraries.
7620EOM
7621 dflt="$cc"
7622 else
7623 echo "I'll use ld to build dynamic libraries."
7624 dflt='ld'
7625 fi
7626 rm -f try.c a.out
7627 ;;
7628 *) dflt="$ld"
7629 ;;
7630 esac
7631
7632 rp="What command should be used to create dynamic libraries?"
7633 . ./myread
7634 ld="$ans"
7635
7636 cat << EOM
7637
7638Some systems may require passing special flags to $ld to create a
7639library that can be dynamically loaded. If your ld flags include
7640-L/other/path options to locate libraries outside your loader's normal
7641search path, you may need to specify those -L options here as well. To
7642use no flags, say "none".
7643
7644EOM
7645 case "$lddlflags" in
7646 '') case "$osname" in
7647 beos) dflt='-nostart' ;;
7648 hpux) dflt='-b';
7649 case "$gccversion" in
7650 '') dflt="$dflt +vnocompatwarnings" ;;
7651 esac
7652 ;;
fb2e1bc0 7653 linux|irix*|gnu*) dflt='-shared' ;;
b4eb6b3d
JH
7654 next) dflt='none' ;;
7655 solaris) dflt='-G' ;;
7656 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 7657 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
7658 *) dflt='none' ;;
7659 esac
7660 ;;
7661 *) dflt="$lddlflags" ;;
7662 esac
7663
7664 : Try to guess additional flags to pick up local libraries.
7665 : Be careful not to append to a plain 'none'
7666 case "$dflt" in
7667 none) dflt='' ;;
7668 esac
7669 for thisflag in $ldflags; do
7670 case "$thisflag" in
b5b9f165 7671 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
7672 case " $dflt " in
7673 *" $thisflag "*) ;;
7674 *) dflt="$dflt $thisflag" ;;
7675 esac
7676 ;;
7677 esac
7678 done
7679
7680 case "$dflt" in
7681 ''|' ') dflt='none' ;;
7682 esac
7683
7684 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7685 . ./myread
7686 case "$ans" in
7687 none) lddlflags=' ' ;;
7688 *) lddlflags="$ans" ;;
7689 esac
7690
7691 cat <<EOM
7692
7693Some systems may require passing special flags to $cc to indicate that
7694the resulting executable will use dynamic linking. To use no flags,
7695say "none".
7696
7697EOM
7698 case "$ccdlflags" in
7699 '') case "$osname" in
fb2e1bc0 7700 linux|hpux|gnu*) dflt='-Wl,-E' ;;
91fc0aa5
AH
7701 next|sunos) dflt='none' ;;
7702 *) dflt='none' ;;
b4eb6b3d
JH
7703 esac ;;
7704 ' ') dflt='none' ;;
7705 *) dflt="$ccdlflags" ;;
7706 esac
7707 rp="Any special flags to pass to $cc to use dynamic linking?"
7708 . ./myread
7709 case "$ans" in
7710 none) ccdlflags=' ' ;;
7711 *) ccdlflags="$ans" ;;
7712 esac
7713 ;;
7714*) usedl="$undef"
7715 ld='ld'
7716 dlsrc='dl_none.xs'
7717 lddlflags=''
7718 ccdlflags=''
7719 ;;
7720esac
7721
7722also=''
7723case "$usedl" in
7724$undef)
7725 # No dynamic loading being used, so don't bother even to prompt.
7726 useshrplib='false'
7727 ;;
7728*) case "$useshrplib" in
7729 '') case "$osname" in
48bcfe03 7730 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7731 dflt=y
7732 also='Building a shared libperl is required for dynamic loading to work on your system.'
7733 ;;
7734 next*)
7735 case "$osvers" in
7736 4*) dflt=y
7737 also='Building a shared libperl is needed for MAB support.'
7738 ;;
7739 *) dflt=n
7740 ;;
7741 esac
7742 ;;
7743 *) dflt=n
7744 ;;
7745 esac
7746 ;;
7747 $define|true|[Yy]*)
7748 dflt=y
7749 ;;
7750 *) dflt=n
7751 ;;
7752 esac
7753 $cat << EOM
7754
7755The perl executable is normally obtained by linking perlmain.c with
7756libperl${_a}, any static extensions (usually just DynaLoader), and
7757any other libraries needed on this system (such as -lm, etc.). Since
7758your system supports dynamic loading, it is probably possible to build
7759a shared libperl.$so. If you will have more than one executable linked
7760to libperl.$so, this will significantly reduce the size of each
7761executable, but it may have a noticeable affect on performance. The
7762default is probably sensible for your system.
7763$also
7764
7765EOM
7766 rp="Build a shared libperl.$so (y/n)"
7767 . ./myread
7768 case "$ans" in
7769 true|$define|[Yy]*)
7770 useshrplib='true' ;;
7771 *) useshrplib='false' ;;
7772 esac
7773 ;;
7774esac
7775
7776case "$useshrplib" in
7777true)
7778 case "$libperl" in
7779 '')
7780 # Figure out a good name for libperl.so. Since it gets stored in
7781 # a version-specific architecture-dependent library, the version
7782 # number isn't really that important, except for making cc/ld happy.
7783 #
7784 # A name such as libperl.so.3.1
7785 majmin="libperl.$so.$patchlevel.$subversion"
7786 # A name such as libperl.so.301
7787 majonly=`echo $patchlevel $subversion |
7788 $awk '{printf "%d%02d", $1, $2}'`
7789 majonly=libperl.$so.$majonly
7790 # I'd prefer to keep the os-specific stuff here to a minimum, and
7791 # rely on figuring it out from the naming of libc.
7792 case "${osname}${osvers}" in
7793 next4*)
7794 dflt=libperl.5.$so
7795 # XXX How handle the --version stuff for MAB?
7796 ;;
fb2e1bc0 7797 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
7798 dflt=libperl.$so
7799 ;;
b53432e4
GH
7800 cygwin*) # ld links against an importlib
7801 dflt=libperl$lib_ext
b4eb6b3d
JH
7802 ;;
7803 *) # Try to guess based on whether libc has major.minor.
7804 case "$libc" in
7805 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7806 *libc.$so.[0-9]*) dflt=$majonly ;;
7807 *) dflt=libperl.$so ;;
7808 esac
7809 ;;
7810 esac
7811 ;;
7812 *) dflt=$libperl
7813 ;;
7814 esac
7815 cat << EOM
7816
7817I need to select a good name for the shared libperl. If your system uses
7818library names with major and minor numbers, then you might want something
7819like $majmin. Alternatively, if your system uses a single version
7820number for shared libraries, then you might want to use $majonly.
7821Or, your system might be quite happy with a simple libperl.$so.
7822
7823Since the shared libperl will get installed into a version-specific
7824architecture-dependent directory, the version number of the shared perl
7825library probably isn't important, so the default should be o.k.
7826
7827EOM
7828 rp='What name do you want to give to the shared libperl?'
7829 . ./myread
7830 libperl=$ans
7831 echo "Ok, I'll use $libperl"
7832 ;;
7833*)
7834 libperl="libperl${_a}"
7835 ;;
7836esac
7837
7838# Detect old use of shrpdir via undocumented Configure -Dshrpdir
7839case "$shrpdir" in
7840'') ;;
7841*) $cat >&4 <<EOM
7842WARNING: Use of the shrpdir variable for the installation location of
7843the shared $libperl is not supported. It was never documented and
7844will not work in this version. Let me (perlbug@perl.org)
7845know of any problems this may cause.
7846
7847EOM
7848 case "$shrpdir" in
7849 "$archlibexp/CORE")
7850 $cat >&4 <<EOM
7851But your current setting of $shrpdir is
7852the default anyway, so it's harmless.
7853EOM
7854 ;;
7855 *)
7856 $cat >&4 <<EOM
7857Further, your current attempted setting of $shrpdir
7858conflicts with the value of $archlibexp/CORE
7859that installperl will use.
7860EOM
7861 ;;
7862 esac
7863 ;;
7864esac
7865
7866# How will the perl executable find the installed shared $libperl?
7867# Add $xxx to ccdlflags.
7868# If we can't figure out a command-line option, use $shrpenv to
7869# set env LD_RUN_PATH. The main perl makefile uses this.
7870shrpdir=$archlibexp/CORE
7871xxx=''
7872tmp_shrpenv=''
7873if "$useshrplib"; then
7874 case "$osname" in
7875 aix)
7876 # We'll set it in Makefile.SH...
7877 ;;
b5b9f165 7878 solaris)
b4eb6b3d
JH
7879 xxx="-R $shrpdir"
7880 ;;
46fcf6af 7881 freebsd|netbsd|openbsd|interix)
b4eb6b3d
JH
7882 xxx="-Wl,-R$shrpdir"
7883 ;;
fb2e1bc0 7884 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
7885 xxx="-Wl,-rpath,$shrpdir"
7886 ;;
7887 next)
7888 # next doesn't like the default...
7889 ;;
7890 beos)
7891 # beos doesn't like the default, either.
7892 ;;
7893 hpux*)
7894 # hpux doesn't like the default, either.
7895 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7896 ;;
7897 *)
7898 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7899 ;;
7900 esac
7901 case "$xxx" in
7902 '') ;;
7903 *)
7904 # Only add $xxx if it isn't already in ccdlflags.
7905 case " $ccdlflags " in
7906 *" $xxx "*) ;;
7907 *) ccdlflags="$ccdlflags $xxx"
7908 cat <<EOM >&4
7909
7910Adding $xxx to the flags
7911passed to $ld so that the perl executable will find the
7912installed shared $libperl.
7913
7914EOM
7915 ;;
7916 esac
7917 ;;
7918 esac
7919fi
7920# Fix ccdlflags in AIX for building external extensions.
7921# (For building Perl itself bare -bE:perl.exp is needed,
7922# Makefile.SH takes care of this.)
7923case "$osname" in
7924aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7925esac
7926# Respect a hint or command-line value.
7927case "$shrpenv" in
7928'') shrpenv="$tmp_shrpenv" ;;
7929esac
7930case "$ldlibpthname" in
7931'') ldlibpthname=LD_LIBRARY_PATH ;;
7932none) ldlibpthname='' ;;
7933esac
7934
7935: determine where manual pages are on this system
7936echo " "
7937case "$sysman" in
7938'')
4a0a3829
SD
7939 syspath='/usr/share/man/man1 /usr/man/man1'
7940 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7941 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
7942 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7943 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7944 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7945 sysman=`./loc . /usr/man/man1 $syspath`
7946 ;;
7947esac
7948if $test -d "$sysman"; then
7949 echo "System manual is in $sysman." >&4
7950else
7951 echo "Could not find manual pages in source form." >&4
7952fi
7953
7954: determine where manual pages go
7955set man1dir man1dir none
7956eval $prefixit
7957$cat <<EOM
7958
7959$spackage has manual pages available in source form.
7960EOM
7961case "$nroff" in
7962nroff)
7963 echo "However, you don't have nroff, so they're probably useless to you."
7964 case "$man1dir" in
7965 '') man1dir="none";;
7966 esac;;
7967esac
7968echo "If you don't want the manual sources installed, answer 'none'."
7969case "$man1dir" in
7970' ') dflt=none
7971 ;;
7972'')
4a0a3829
SD
7973 lookpath="$prefixexp/share/man/man1"
7974 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
7975 lookpath="$lookpath $prefixexp/man/p_man/man1"
7976 lookpath="$lookpath $prefixexp/man/u_man/man1"
7977 lookpath="$lookpath $prefixexp/man/man.1"
7978 case "$sysman" in
7979 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7980 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7981 esac
7982 set dflt
7983 eval $prefixup
7984 ;;
7985*) dflt="$man1dir"
7986 ;;
7987esac
7988echo " "
7989fn=dn+~
7990rp="Where do the main $spackage manual pages (source) go?"
7991. ./getfile
7992if $test "X$man1direxp" != "X$ansexp"; then
7993 installman1dir=''
7994fi
7995man1dir="$ans"
7996man1direxp="$ansexp"
7997case "$man1dir" in
7998'') man1dir=' '
7999 installman1dir='';;
8000esac
8001
8002: Change installation prefix, if necessary.
8003if $test X"$prefix" != X"$installprefix"; then
8004 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8005else
8006 installman1dir="$man1direxp"
8007fi
8008
8009: What suffix to use on installed man pages
8010
8011case "$man1dir" in
8012' ')
8013 man1ext='0'
8014 ;;
8015*)
8016 rp="What suffix should be used for the main $spackage man pages?"
8017 case "$man1ext" in
8018 '') case "$man1dir" in
8019 *1) dflt=1 ;;
8020 *1p) dflt=1p ;;
8021 *1pm) dflt=1pm ;;
8022 *l) dflt=l;;
8023 *n) dflt=n;;
8024 *o) dflt=o;;
8025 *p) dflt=p;;
8026 *C) dflt=C;;
8027 *L) dflt=L;;
8028 *L1) dflt=L1;;
8029 *) dflt=1;;
8030 esac
8031 ;;
8032 *) dflt="$man1ext";;
8033 esac
8034 . ./myread
8035 man1ext="$ans"
8036 ;;
8037esac
8038
8039: see if we can have long filenames
8040echo " "
8041first=123456789abcdef
8042$rm -f $first
8043if (echo hi >$first) 2>/dev/null; then
8044 if $test -f 123456789abcde; then
8045 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8046 val="$undef"
8047 else
8048 echo 'You can have filenames longer than 14 characters.'>&4
8049 val="$define"
8050 fi
8051else
8052 $cat <<'EOM'
8053You can't have filenames longer than 14 chars.
8054You can't even think about them!
8055EOM
8056 val="$undef"
8057fi
8058set d_flexfnam
8059eval $setvar
8060$rm -rf 123456789abcde*
8061
8062: determine where library module manual pages go
8063set man3dir man3dir none
8064eval $prefixit
8065$cat <<EOM
8066
8067$spackage has manual pages for many of the library modules.
8068EOM
8069
8070case "$nroff" in
8071nroff)
8072 $cat <<'EOM'
8073However, you don't have nroff, so they're probably useless to you.
8074EOM
8075 case "$man3dir" in
8076 '') man3dir="none";;
8077 esac;;
8078esac
8079
8080case "$d_flexfnam" in
8081undef)
8082 $cat <<'EOM'
8083However, your system can't handle the long file names like File::Basename.3.
8084EOM
8085 case "$man3dir" in
8086 '') man3dir="none";;
8087 esac;;
8088esac
8089
8090echo "If you don't want the manual sources installed, answer 'none'."
8091prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8092case "$man3dir" in
8093'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8094 if $test -d "$privlib/man/man3"; then
8095 cat <<EOM >&4
8096
8097WARNING: Previous versions of perl installed man3 pages into
8098$privlib/man/man3. This version will suggest a
8099new default of $dflt.
8100EOM
8101 tdflt=$dflt
8102 dflt='n'
8103 rp='Do you wish to preserve the old behavior?(y/n)'
8104 . ./myread
8105 case "$ans" in
8106 y*) dflt="$privlib/man/man3" ;;
8107 *) dflt=$tdflt ;;
8108 esac
8109 fi
8110 ;;
8111*) dflt="$man3dir" ;;
8112esac
8113case "$dflt" in
8114' ') dflt=none ;;
8115esac
8116echo " "
8117fn=dn+~
8118rp="Where do the $package library man pages (source) go?"
8119. ./getfile
8120man3dir="$ans"
8121man3direxp="$ansexp"
8122case "$man3dir" in
8123'') man3dir=' '
8124 installman3dir='';;
8125esac
8126
8127: Change installation prefix, if necessary.
8128if $test X"$prefix" != X"$installprefix"; then
8129 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8130else
8131 installman3dir="$man3direxp"
8132fi
8133
8134: What suffix to use on installed man pages
8135case "$man3dir" in
8136' ')
8137 man3ext='0'
8138 ;;
8139*)
8140 rp="What suffix should be used for the $package library man pages?"
8141 case "$man3ext" in
8142 '') case "$man3dir" in
8143 *3) dflt=3 ;;
8144 *3p) dflt=3p ;;
8145 *3pm) dflt=3pm ;;
8146 *l) dflt=l;;
8147 *n) dflt=n;;
8148 *o) dflt=o;;
8149 *p) dflt=p;;
8150 *C) dflt=C;;
8151 *L) dflt=L;;
8152 *L3) dflt=L3;;
8153 *) dflt=3;;
8154 esac
8155 ;;
8156 *) dflt="$man3ext";;
8157 esac
8158 . ./myread
8159 man3ext="$ans"
8160 ;;
8161esac
8162
8163: see if we have to deal with yellow pages, now NIS.
0384a54a 8164if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8165 if $test -f /usr/etc/nibindd; then
8166 echo " "
8167 echo "I'm fairly confident you're on a NeXT."
8168 echo " "
8169 rp='Do you get the hosts file via NetInfo?'
8170 dflt=y
8171 case "$hostcat" in
8172 nidump*) ;;
8173 '') ;;
8174 *) dflt=n;;
8175 esac
8176 . ./myread
8177 case "$ans" in
8178 y*) hostcat='nidump hosts .';;
8179 *) case "$hostcat" in
8180 nidump*) hostcat='';;
8181 esac
8182 ;;
8183 esac
8184 fi
8185 case "$hostcat" in
8186 nidump*) ;;
8187 *)
8188 case "$hostcat" in
8189 *ypcat*) dflt=y;;
8190 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8191 dflt=y
8192 else
8193 dflt=n
8194 fi;;
8195 *) dflt=n;;
8196 esac
8197 echo " "
8198 rp='Are you getting the hosts file via yellow pages?'
8199 . ./myread
8200 case "$ans" in
8201 y*) hostcat='ypcat hosts';;
8202 *) hostcat='cat /etc/hosts';;
8203 esac
8204 ;;
8205 esac
8206fi
8207case "$hostcat" in
8208'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8209esac
8210case "$groupcat" in
8211'') test -f /etc/group && groupcat='cat /etc/group';;
8212esac
8213case "$passcat" in
8214'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8215esac
8216
8217: now get the host name
8218echo " "
8219echo "Figuring out host name..." >&4
8220case "$myhostname" in
8221'') cont=true
8222 echo 'Maybe "hostname" will work...'
73614538 8223 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8224 myhostname=$tans
8225 phostname=hostname
8226 cont=''
8227 fi
8228 ;;
8229*) cont='';;
8230esac
8231if $test "$cont"; then
8232 if ./xenix; then
8233 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8234 if tans=`cat /etc/systemid 2>&1` ; then
8235 myhostname=$tans
8236 phostname='cat /etc/systemid'
8237 echo "Whadyaknow. Xenix always was a bit strange..."
8238 cont=''
8239 fi
8240 elif $test -r /etc/systemid; then
8241 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8242 fi
8243fi
8244if $test "$cont"; then
8245 echo 'No, maybe "uuname -l" will work...'
73614538 8246 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8247 myhostname=$tans
8248 phostname='uuname -l'
8249 else
8250 echo 'Strange. Maybe "uname -n" will work...'
73614538 8251 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8252 myhostname=$tans
8253 phostname='uname -n'
8254 else
8255 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8256 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8257 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8258 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8259 else
8260 case "$myhostname" in
8261 '') echo "Does this machine have an identity crisis or something?"
8262 phostname='';;
8263 *)
8264 echo "Well, you said $myhostname before..."
8265 phostname='echo $myhostname';;
8266 esac
8267 fi
8268 fi
8269 fi
8270fi
52a549d0
JH
8271case "$myhostname" in
8272'') myhostname=noname ;;
8273esac
b4eb6b3d
JH
8274: you do not want to know about this
8275set $myhostname
8276myhostname=$1
8277
8278: verify guess
8279if $test "$myhostname" ; then
8280 dflt=y
8281 rp='Your host name appears to be "'$myhostname'".'" Right?"
8282 . ./myread
8283 case "$ans" in
8284 y*) ;;
8285 *) myhostname='';;
8286 esac
8287fi
8288
8289: bad guess or no guess
8290while $test "X$myhostname" = X ; do
8291 dflt=''
8292 rp="Please type the (one word) name of your host:"
8293 . ./myread
8294 myhostname="$ans"
8295done
8296
8297: translate upper to lower if necessary
8298case "$myhostname" in
8299*[A-Z]*)
8300 echo "(Normalizing case in your host name)"
8301 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8302 ;;
8303esac
8304
8305case "$myhostname" in
8306*.*)
8307 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8308 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8309 echo "(Trimming domain name from host name--host name is now $myhostname)"
8310 ;;
8311*) case "$mydomain" in
8312 '')
8313 {
8314 test "X$hostcat" = "Xypcat hosts" &&
8315 ypmatch "$myhostname" hosts 2>/dev/null |\
8316 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8317 $test -s hosts
8318 } || {
8319 test "X$hostcat" != "X" &&
8320 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8321 /[ ]$myhostname[ . ]/p" > hosts
8322 }
8323 tmp_re="[ . ]"
f08cbdd1
PP
8324 if $test -f hosts; then
8325 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8326 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8327 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8328 hosts | $sort | $uniq | \
8329 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8330 case `$echo X$dflt` in
8331 X*\ *) echo "(Several hosts in the database matched hostname)"
8332 dflt=.
8333 ;;
8334 X.) echo "(You do not have fully-qualified names in the hosts database)"
8335 ;;
8336 esac
8337 else
8338 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8339 dflt=.
f08cbdd1 8340 fi
b4eb6b3d
JH
8341 case "$dflt" in
8342 .)
8343 tans=`./loc resolv.conf X /etc /usr/etc`
8344 if $test -f "$tans"; then
8345 echo "(Attempting domain name extraction from $tans)"
8346 dflt=.`$sed -n -e 's/ / /g' \
8347 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
8348 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8349 case "$dflt" in
8350 .) dflt=.`$sed -n -e 's/ / /g' \
8351 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
8352 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8353 ;;
8354 esac
8355 fi
8356 ;;
8357 esac
8358 case "$dflt" in
8359 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8360 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8361 case "$dflt" in
8362 '') dflt='.';;
8363 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8364 esac
8365 ;;
8366 esac
59c9e5d6
PP
8367 case "$dflt$osname" in
8368 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8369 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8370 ;;
8371 esac
b4eb6b3d
JH
8372 case "$dflt" in
8373 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8374 dflt='.nonet'
b4eb6b3d
JH
8375 ;;
8376 esac
8377 $rm -f hosts
8378 ;;
8379 *) dflt="$mydomain";;
8380 esac;;
8381esac
8382echo " "
8383rp="What is your domain name?"
8384. ./myread
8385tans="$ans"
8386case "$ans" in
8387'') ;;
8388.*) ;;
8389*) tans=".$tans";;
8390esac
8391mydomain="$tans"
8392
8393: translate upper to lower if necessary
8394case "$mydomain" in
8395*[A-Z]*)
8396 echo "(Normalizing case in your domain name)"
8397 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8398 ;;
8399esac
8400
8401: a little sanity check here
8402case "$phostname" in
8403'') ;;
8404*)
8405 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8406 $myhostname$mydomain|$myhostname) ;;
8407 *)
8408 case "$phostname" in
8409 sed*)
8410 echo "(That doesn't agree with your whoami.h file, by the way.)"
8411 ;;
8412 *)
8413 echo "(That doesn't agree with your $phostname command, by the way.)"
8414 ;;
8415 esac
8416 ;;
8417 esac
8418 ;;
8419esac
8420
8421$cat <<EOM
8422
8423I need to get your e-mail address in Internet format if possible, i.e.
8424something like user@host.domain. Please answer accurately since I have
8425no easy means to double check it. The default value provided below
8426is most probably close to reality but may not be valid from outside
8427your organization...
8428
8429EOM
8430cont=x
8431while test "$cont"; do
8432 case "$cf_email" in
8433 '') dflt="$cf_by@$myhostname$mydomain";;
8434 *) dflt="$cf_email";;
8435 esac
8436 rp='What is your e-mail address?'
8437 . ./myread
8438 cf_email="$ans"
8439 case "$cf_email" in
8440 *@*.*) cont='' ;;
8441 *)
8442 rp='Address does not look like an Internet one. Use it anyway?'
8443 case "$fastread" in
8444 yes) dflt=y ;;
8445 *) dflt=n ;;
8446 esac
8447 . ./myread
8448 case "$ans" in
8449 y*) cont='' ;;
8450 *) echo " " ;;
8451 esac
8452 ;;
8453 esac
8454done
8455
8456$cat <<EOM
8457
8458If you or somebody else will be maintaining perl at your site, please
8459fill in the correct e-mail address here so that they may be contacted
8460if necessary. Currently, the "perlbug" program included with perl
8461will send mail to this address in addition to perlbug@perl.org. You may
8462enter "none" for no administrator.
8463
8464EOM
8465case "$perladmin" in
8466'') dflt="$cf_email";;
8467*) dflt="$perladmin";;
8468esac
8469rp='Perl administrator e-mail address'
8470. ./myread
8471perladmin="$ans"
8472
674912d7
RB
8473: determine whether to only install version-specific parts.
8474echo " "
8475$cat <<EOM
8476Do you want to install only the version-specific parts of the perl
8477distribution? Usually you do *not* want to do this.
8478EOM
8479case "$versiononly" in
8480"$define"|[Yy]*|true) dflt='y' ;;
8481*) dflt='n';
8482esac
8483rp="Do you want to install only the version-specific parts of perl?"
8484. ./myread
8485case "$ans" in
8486[yY]*) val="$define";;
8487*) val="$undef" ;;
8488esac
8489set versiononly
8490eval $setvar
8491
ad493445
MB
8492case "$versiononly" in
8493"$define") inc_version_list=''
8494 inc_version_list_init=0
8495 ;;
8496esac
8497
b4eb6b3d
JH
8498: figure out how to guarantee perl startup
8499case "$startperl" in
8500'')
8501 case "$sharpbang" in
8502 *!)
8503 $cat <<EOH
8504
8505I can use the #! construct to start perl on your system. This will
8506make startup of perl scripts faster, but may cause problems if you
8507want to share those scripts and perl is not in a standard place
8508($binexp/perl) on all your platforms. The alternative is to force
8509a shell by starting the script with a single ':' character.
8510
8511EOH
674912d7
RB
8512 case "$versiononly" in
8513 "$define") dflt="$binexp/perl$version";;
8514 *) dflt="$binexp/perl";;
8515 esac
b4eb6b3d
JH
8516 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8517 . ./myread
8518 case "$ans" in
8519 none) startperl=": # use perl";;
8520 *) startperl="#!$ans"
8521 if $test 30 -lt `echo "$ans" | wc -c`; then
8522 $cat >&4 <<EOM
8523
8524WARNING: Some systems limit the #! command to 32 characters.
8525If you experience difficulty running Perl scripts with #!, try
8526installing Perl in a directory with a shorter pathname.
8527
8528EOM
8529 fi ;;
8530 esac
8531 ;;
8532 *) startperl=": # use perl"
8533 ;;
8534 esac
8535 ;;
8536esac
8537echo "I'll use $startperl to start perl scripts."
8538
8539: figure best path for perl in scripts
8540case "$perlpath" in
8541'')
5e20a8ca
RGS
8542 case "$versiononly" in
8543 "$define") perlpath="$binexp/perl$version";;
8544 *) perlpath="$binexp/perl";;
8545 esac
b4eb6b3d
JH
8546 case "$startperl" in
8547 *!*) ;;
8548 *)
8549 $cat <<EOH
8550
8551I will use the "eval 'exec'" idiom to start Perl on your system.
8552I can use the full path of your Perl binary for this purpose, but
8553doing so may cause problems if you want to share those scripts and
8554Perl is not always in a standard place ($binexp/perl).
8555
8556EOH
8557 dflt="$binexp/perl"
8558 rp="What path shall I use in \"eval 'exec'\"?"
8559 . ./myread
8560 perlpath="$ans"
8561 ;;
8562 esac
8563 ;;
8564esac
8565case "$startperl" in
8566*!*) ;;
8567*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8568esac
8569
8570: determine where public executable scripts go
8571set scriptdir scriptdir
8572eval $prefixit
8573case "$scriptdir" in
8574'')
8575 dflt="$bin"
8576 : guess some guesses
8577 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8578 $test -d /usr/share/bin && dflt=/usr/share/bin
8579 $test -d /usr/local/script && dflt=/usr/local/script
8580 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8581 $test -d $prefixexp/script && dflt=$prefixexp/script
8582 set dflt
8583 eval $prefixup
8584 ;;
8585*) dflt="$scriptdir"
8586 ;;
8587esac
8588$cat <<EOM
8589
8590Some installations have a separate directory just for executable scripts so
8591that they can mount it across multiple architectures but keep the scripts in
8592one spot. You might, for example, have a subdirectory of /usr/share for this.
8593Or you might just lump your scripts in with all your other executables.
8594
8595EOM
8596fn=d~
8597rp='Where do you keep publicly executable scripts?'
8598. ./getfile
8599if $test "X$ansexp" != "X$scriptdirexp"; then
8600 installscript=''
8601fi
8602scriptdir="$ans"
8603scriptdirexp="$ansexp"
8604: Change installation prefix, if necessary.
8605if $test X"$prefix" != X"$installprefix"; then
8606 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8607else
8608 installscript="$scriptdirexp"
8609fi
8610
8611: determine where add-on public executables go
8612case "$sitebin" in
8613'') dflt=$siteprefix/bin ;;
8614*) dflt=$sitebin ;;
8615esac
8616fn=d~
8617rp='Pathname where the add-on public executables should be installed?'
8618. ./getfile
8619sitebin="$ans"
8620sitebinexp="$ansexp"
8621: Change installation prefix, if necessary.
8622if $test X"$prefix" != X"$installprefix"; then
8623 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8624else
8625 installsitebin="$sitebinexp"
8626fi
8627
6e1038e0 8628: determine where add-on html pages go
8d2cbf27 8629: There is no standard location, so try to copy the previously-selected
6e1038e0 8630: directory structure for the core html pages.
8d2cbf27
JH
8631case "$sitehtml1dir" in
8632'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8633*) dflt=$sitehtml1dir ;;
6e1038e0
MB
8634esac
8635case "$dflt" in
8636''|' ') dflt=none ;;
8637esac
8638fn=dn+~
8639rp='Pathname where the site-specific html pages should be installed?'
8640. ./getfile
8d2cbf27
JH
8641sitehtml1dir="$ans"
8642sitehtml1direxp="$ansexp"
6e1038e0
MB
8643: Change installation prefix, if necessary.
8644if $test X"$prefix" != X"$installprefix"; then
8d2cbf27 8645 installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 8646else
8d2cbf27 8647 installsitehtml1dir="$sitehtml1direxp"
6e1038e0
MB
8648fi
8649
8650: determine where add-on library html pages go
8651: There is no standard location, so try to copy the previously-selected
8652: directory structure for the core html pages.
8d2cbf27
JH
8653case "$sitehtml3dir" in
8654'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8655*) dflt=$sitehtml3dir ;;
6e1038e0
MB
8656esac
8657case "$dflt" in
8658''|' ') dflt=none ;;
8659esac
8660fn=dn+~
8661rp='Pathname where the site-specific library html pages should be installed?'
8662. ./getfile
8d2cbf27
JH
8663sitehtml3dir="$ans"
8664sitehtml3direxp="$ansexp"
6e1038e0
MB
8665: Change installation prefix, if necessary.
8666if $test X"$prefix" != X"$installprefix"; then
8d2cbf27 8667 installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 8668else
8d2cbf27 8669 installsitehtml3dir="$sitehtml3direxp"
6e1038e0
MB
8670fi
8671
8672: determine where add-on manual pages go
91e123a8
JH
8673case "$siteman1dir" in
8674'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8675*) dflt=$siteman1dir ;;
6e1038e0 8676esac
257059b5
JH
8677case "$dflt" in
8678''|' ') dflt=none ;;
8679esac
6e1038e0
MB
8680fn=dn+~
8681rp='Pathname where the site-specific manual pages should be installed?'
8682. ./getfile
91e123a8
JH
8683siteman1dir="$ans"
8684siteman1direxp="$ansexp"
6e1038e0
MB
8685: Change installation prefix, if necessary.
8686if $test X"$prefix" != X"$installprefix"; then
91e123a8 8687 installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 8688else
91e123a8 8689 installsiteman1dir="$siteman1direxp"
6e1038e0
MB
8690fi
8691
8692: determine where add-on library man pages go
91e123a8
JH
8693case "$siteman3dir" in
8694'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8695*) dflt=$siteman3dir ;;
6e1038e0 8696esac
257059b5
JH
8697case "$dflt" in
8698''|' ') dflt=none ;;
8699esac
6e1038e0
MB
8700fn=dn+~
8701rp='Pathname where the site-specific library manual pages should be installed?'
8702. ./getfile
91e123a8
JH
8703siteman3dir="$ans"
8704siteman3direxp="$ansexp"
6e1038e0
MB
8705: Change installation prefix, if necessary.
8706if $test X"$prefix" != X"$installprefix"; then
91e123a8 8707 installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 8708else
91e123a8 8709 installsiteman3dir="$siteman3direxp"
6e1038e0
MB
8710fi
8711
8712: determine where add-on public executable scripts go
8713case "$sitescript" in
8714'') dflt=$siteprefix/script
8715 $test -d $dflt || dflt=$sitebin ;;
8716*) dflt="$sitescript" ;;
8717esac
8718fn=d~+
8719rp='Pathname where add-on public executable scripts should be installed?'
8720. ./getfile
8721sitescript="$ans"
8722sitescriptexp="$ansexp"
8723: Change installation prefix, if necessary.
8724if $test X"$prefix" != X"$installprefix"; then
8725 installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8726else
8727 installsitescript="$sitescriptexp"
8728fi
8729
15b61c98
JH
8730case "$usefaststdio" in
8731$define|true|[yY]*|'')
8732 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8733 case "$xversion" in
8734 [68]) dflt='y' ;;
8735 *) dflt='n' ;;
8736 esac
8737 ;;
8738*) dflt='n';;
8739esac
8740cat <<EOM
8741
8742Perl can be built to use 'fast stdio', which means using the stdio
8743library but also directly manipulating the stdio buffers to enable
8744faster I/O. Using stdio is better for backward compatibility (especially
8745for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8746interface has been preferred instead of stdio.
8747
8748If this doesn't make any sense to you, just accept the default '$dflt'.
8749EOM
8750rp='Use the "fast stdio" if available?'
8751. ./myread
8752case "$ans" in
8753y|Y) val="$define" ;;
8754*) val="$undef" ;;
8755esac
8756set usefaststdio
8757eval $setvar
8758
8759
96056487
JH
8760: define an is-a-typedef? function
8761typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8762case "$inclist" in
8763"") inclist="sys/types.h";;
8764esac;
8765eval "varval=\$$var";
8766case "$varval" in
8767"")
8768 $rm -f temp.c;
8769 for inc in $inclist; do
8770 echo "#include <$inc>" >>temp.c;
8771 done;
8772 echo "#ifdef $type" >> temp.c;
8773 echo "printf(\"We have $type\");" >> temp.c;
8774 echo "#endif" >> temp.c;
8775 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8776 if $contains $type temp.E >/dev/null 2>&1; then
8777 eval "$var=\$type";
8778 else
8779 eval "$var=\$def";
8780 fi;
8781 $rm -f temp.?;;
8782*) eval "$var=\$varval";;
8783esac'
8784
8785: define an is-a-typedef? function that prompts if the type is not available.
8786typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8787case "$inclist" in
8788"") inclist="sys/types.h";;
8789esac;
8790eval "varval=\$$var";
8791case "$varval" in
8792"")
8793 $rm -f temp.c;
8794 for inc in $inclist; do
8795 echo "#include <$inc>" >>temp.c;
8796 done;
8797 echo "#ifdef $type" >> temp.c;
8798 echo "printf(\"We have $type\");" >> temp.c;
8799 echo "#endif" >> temp.c;
8800 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8801 echo " " ;
8802 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8803 if $contains $type temp.E >/dev/null 2>&1; then
8804 echo "$type found." >&4;
8805 eval "$var=\$type";
8806 else
8807 echo "$type NOT found." >&4;
8808 dflt="$def";
8809 . ./myread ;
8810 eval "$var=\$ans";
8811 fi;
8812 $rm -f temp.?;;
8813*) eval "$var=\$varval";;
8814esac'
8815
8816: see what type lseek is declared as in the kernel
8817rp="What is the type used for lseek's offset on this system?"
8818set off_t lseektype long stdio.h sys/types.h
8819eval $typedef_ask
8820
8821echo " "
8822echo "Checking to see how big your file offsets are..." >&4
8823$cat >try.c <<EOCP
8824#include <sys/types.h>
8825#include <stdio.h>
8826int main()
8827{
8828 printf("%d\n", (int)sizeof($lseektype));
8829 return(0);
8830}
8831EOCP
8832set try
8833if eval $compile_ok; then
8834 lseeksize=`$run ./try`
8835 echo "Your file offsets are $lseeksize bytes long."
8836else
8837 dflt=$longsize
8838 echo " "
8839 echo "(I can't seem to compile the test program. Guessing...)"
8840 rp="What is the size of your file offsets (in bytes)?"
8841 . ./myread
8842 lseeksize="$ans"
8843fi
8844$rm -f try.c try
8845
8846: see what type file positions are declared as in the library
8847rp="What is the type for file position used by fsetpos()?"
8848set fpos_t fpostype long stdio.h sys/types.h
8849eval $typedef_ask
8850
8851echo " "
8852case "$fpostype" in
8853*_t) zzz="$fpostype" ;;
8854*) zzz="fpos_t" ;;
8855esac
8856echo "Checking the size of $zzz..." >&4
8857cat > try.c <<EOCP
8858#include <sys/types.h>
8859#include <stdio.h>
d1daaddf
JH
8860#$i_stdlib I_STDLIB
8861#ifdef I_STDLIB
8862#include <stdlib.h>
8863#endif
96056487
JH
8864int main() {
8865 printf("%d\n", (int)sizeof($fpostype));
8866 exit(0);
8867}
8868EOCP
8869set try
8870if eval $compile_ok; then
8871 yyy=`$run ./try`
8872 case "$yyy" in
8873 '') fpossize=4
8874 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8875 ;;
8876 *) fpossize=$yyy
8877 echo "Your $zzz is $fpossize bytes long."
8878 ;;
8879 esac
8880else
8881 dflt="$longsize"
8882 echo " " >&4
8883 echo "(I can't compile the test program. Guessing...)" >&4
8884 rp="What is the size of your file positions (in bytes)?"
8885 . ./myread
8886 fpossize="$ans"
8887fi
8888
96056487
JH
8889# Backward compatibility (uselfs is deprecated).
8890case "$uselfs" in
8891"$define"|true|[yY]*)
8892 cat <<EOM >&4
8893
8894*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8895EOM
8896 uselargefiles="$define"
8897 ;;
8898esac
8899
8900case "$lseeksize:$fpossize" in
89018:8) cat <<EOM
8902
8903You can have files larger than 2 gigabytes.
8904EOM
8905 val="$define" ;;
8906*) case "$uselargefiles" in
8907 "$undef"|false|[nN]*) dflt='n' ;;
8908 *) dflt='y' ;;
8909 esac
8910 cat <<EOM
8911
8912Perl can be built to understand large files (files larger than 2 gigabytes)
8913on some systems. To do so, Configure can be run with -Duselargefiles.
8914
8915If this doesn't make any sense to you, just accept the default '$dflt'.
8916EOM
8917 rp='Try to understand large files, if available?'
8918 . ./myread
8919 case "$ans" in
8920 y|Y) val="$define" ;;
8921 *) val="$undef" ;;
8922 esac
8923 ;;
8924esac
8925set uselargefiles
8926eval $setvar
96056487
JH
8927: Look for a hint-file generated 'call-back-unit'. If the
8928: user has specified that a large files perl is to be built,
8929: we may need to set or change some other defaults.
9da7673b
MB
8930if $test -f uselargefiles.cbu; then
8931 echo "Your platform has some specific hints regarding large file builds, using them..."
8932 . ./uselargefiles.cbu
8933fi
8934case "$uselargefiles" in
8935"$define")
96056487 8936 if $test -f uselargefiles.cbu; then
96056487
JH
8937 echo " "
8938 echo "Rechecking to see how big your file offsets are..." >&4
8939 $cat >try.c <<EOCP
8940#include <sys/types.h>
8941#include <stdio.h>
8942int main()
8943{
8944 printf("%d\n", (int)sizeof($lseektype));
8945 return(0);
8946}
8947EOCP
8948 set try
8949 if eval $compile_ok; then
8950 lseeksize=`$run ./try`
8951 $echo "Your file offsets are now $lseeksize bytes long."
8952 else
8953 dflt="$lseeksize"
8954 echo " "
8955 echo "(I can't seem to compile the test program. Guessing...)"
8956 rp="What is the size of your file offsets (in bytes)?"
8957 . ./myread
8958 lseeksize="$ans"
8959 fi
8960 case "$fpostype" in
8961 *_t) zzz="$fpostype" ;;
8962 *) zzz="fpos_t" ;;
8963 esac
8964 $echo $n "Rechecking the size of $zzz...$c" >&4
8965 $cat > try.c <<EOCP
8966#include <sys/types.h>
8967#include <stdio.h>
55954f19
JH
8968#$i_stdlib I_STDLIB
8969#ifdef I_STDLIB
8970#include <stdlib.h>
8971#endif
96056487
JH
8972int main() {
8973 printf("%d\n", (int)sizeof($fpostype));
073b6de5 8974 return(0);
96056487
JH
8975}
8976EOCP
8977 set try
8978 if eval $compile_ok; then
8979 yyy=`$run ./try`
8980 dflt="$lseeksize"
8981 case "$yyy" in
8982 '') echo " "
8983 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8984 ;;
8985 *) fpossize=$yyy
8986 echo " $fpossize bytes." >&4
8987 ;;
8988 esac
8989 else
8990 dflt="$fpossize"
8991 echo " "
8992 echo "(I can't compile the test program. Guessing...)" >&4
8993 rp="What is the size of your file positions (in bytes)?"
8994 . ./myread
8995 fpossize="$ans"
8996 fi
8997 $rm -f try.c try
8998 fi
8999 ;;
9000esac
9001
db0f2be4
MB
9002# probably will refer to
9003# $archlib $privlib $sitearch $sitelib $vendorarch $vendorlib
9004need_relocation=0
9005userelocatableinc=undef
9006
b4eb6b3d
JH
9007case "$vendorprefix" in
9008'') d_vendorbin="$undef"
9009 vendorbin=''
9010 vendorbinexp=''
9011 ;;
9012*) d_vendorbin="$define"
9013 : determine where vendor-supplied executables go.
9014 case "$vendorbin" in
9015 '') dflt=$vendorprefix/bin ;;
9016 *) dflt="$vendorbin" ;;
9017 esac
9018 fn=d~+
9019 rp='Pathname for the vendor-supplied executables directory?'
9020 . ./getfile
9021 vendorbin="$ans"
9022 vendorbinexp="$ansexp"
9023 ;;
9024esac
9025: Change installation prefix, if necessary.
9026if $test X"$prefix" != X"$installprefix"; then
9027 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9028else
9029 installvendorbin="$vendorbinexp"
9030fi
9031
6e1038e0 9032case "$vendorprefix" in
8d2cbf27
JH
9033'') vendorhtml1dir=''
9034 vendorhtml1direxp=''
6e1038e0
MB
9035 ;;
9036*) : determine where vendor-supplied html pages go.
9037 : There is no standard location, so try to copy the previously-selected
9038 : directory structure for the core html pages.
9039 : XXX Better default suggestions would be welcome.
8d2cbf27 9040 case "$vendorhtml1dir" in
6e1038e0 9041 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9042 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9043 esac
9044 case "$dflt" in
9045 ''|' ') dflt=none ;;
9046 esac
9047 fn=dn+~
9048 rp='Pathname for the vendor-supplied html pages?'
9049 . ./getfile
8d2cbf27
JH
9050 vendorhtml1dir="$ans"
9051 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9052 ;;
9053esac
9054: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9055$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
6e1038e0
MB
9056: Change installation prefix, if necessary.
9057if $test X"$prefix" != X"$installprefix"; then
8d2cbf27 9058 installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 9059else
8d2cbf27 9060 installvendorhtml1dir="$vendorhtml1direxp"
6e1038e0
MB
9061fi
9062
9063case "$vendorprefix" in
8d2cbf27
JH
9064'') vendorhtml3dir=''
9065 vendorhtml3direxp=''
6e1038e0
MB
9066 ;;
9067*) : determine where vendor-supplied module html pages go.
9068 : There is no standard location, so try to copy the previously-selected
9069 : directory structure for the core html pages.
9070 : XXX Better default suggestions would be welcome.
8d2cbf27 9071 case "$vendorhtml3dir" in
6e1038e0 9072 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9073 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9074 esac
9075 case "$dflt" in
9076 ''|' ') dflt=none ;;
9077 esac
9078 fn=dn+~
9079 rp='Pathname for the vendor-supplied html pages?'
9080 . ./getfile
8d2cbf27
JH
9081 vendorhtml3dir="$ans"
9082 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9083 ;;
9084esac
9085: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9086$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
6e1038e0
MB
9087: Change installation prefix, if necessary.
9088if $test X"$prefix" != X"$installprefix"; then
8d2cbf27 9089 installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 9090else
8d2cbf27 9091 installvendorhtml3dir="$vendorhtml3direxp"
6e1038e0
MB
9092fi
9093
9094case "$vendorprefix" in
91e123a8
JH
9095'') vendorman1dir=''
9096 vendorman1direxp=''
6e1038e0
MB
9097 ;;
9098*) : determine where vendor-supplied manual pages go.
91e123a8 9099 case "$vendorman1dir" in
6e1038e0 9100 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9101 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9102 esac
9103 case "$dflt" in
9104 ''|' ') dflt=none ;;
9105 esac
9106 fn=nd~+
9107 rp='Pathname for the vendor-supplied manual section 1 pages?'
9108 . ./getfile
91e123a8
JH
9109 vendorman1dir="$ans"
9110 vendorman1direxp="$ansexp"
6e1038e0
MB
9111 ;;
9112esac
9113: Use ' ' for none so value is preserved next time through Configure
91e123a8 9114$test X"$vendorman1dir" = "X" && vendorman1dir=' '
6e1038e0
MB
9115: Change installation prefix, if necessary.
9116if $test X"$prefix" != X"$installprefix"; then
91e123a8 9117 installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefix#$installprefix#"`
6e1038e0 9118else
91e123a8 9119 installvendorman1dir="$vendorman1direxp"
6e1038e0
MB
9120fi
9121
9122case "$vendorprefix" in
91e123a8
JH
9123'') vendorman3dir=''
9124 vendorman3direxp=''
6e1038e0
MB
9125 ;;
9126*) : determine where vendor-supplied module manual pages go.
91e123a8 9127 case "$vendorman3dir" in
6e1038e0 9128 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9129 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9130 esac
9131 case "$dflt" in
9132 ''|' ') dflt=none ;;
9133 esac
9134 fn=nd~+
9135 rp='Pathname for the vendor-supplied manual section 3 pages?'
9136 . ./getfile
91e123a8
JH
9137 vendorman3dir="$ans"
9138 vendorman3direxp="$ansexp"
6e1038e0
MB
9139 ;;
9140esac
9141: Use ' ' for none so value is preserved next time through Configure
91e123a8 9142$test X"$vendorman3dir" = "X" && vendorman3dir=' '
6e1038e0
MB
9143: Change installation prefix, if necessary.
9144if $test X"$prefix" != X"$installprefix"; then
91e123a8 9145 installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefix#$installprefix#"`
6e1038e0 9146else
91e123a8 9147 installvendorman3dir="$vendorman3direxp"
6e1038e0
MB
9148fi
9149
9150case "$vendorprefix" in
9151'') d_vendorscript="$undef"
9152 vendorscript=''
9153 vendorscriptexp=''
9154 ;;
9155*) d_vendorscript="$define"
9156 : determine where vendor-supplied scripts go.
9157 case "$vendorscript" in
9158 '') dflt=$vendorprefix/script
9159 $test -d $dflt || dflt=$vendorbin ;;
9160 *) dflt="$vendorscript" ;;
9161 esac
9162 $cat <<EOM
9163
9164The installation process will create a directory for
9165vendor-supplied scripts.
9166
9167EOM
9168 fn=d~+
9169 rp='Pathname for the vendor-supplied scripts directory?'
9170 . ./getfile
9171 vendorscript="$ans"
9172 vendorscriptexp="$ansexp"
9173 ;;
9174esac
9175: Change installation prefix, if necessary.
9176if $test X"$prefix" != X"$installprefix"; then
9177 installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9178else
9179 installvendorscript="$vendorscriptexp"
9180fi
9181
b4eb6b3d
JH
9182: see if qgcvt exists
9183set qgcvt d_qgcvt
9184eval $inlibc
9185
89ce900e
JH
9186echo " "
9187
9188if $test X"$d_longdbl" = X"$define"; then
9189
9190echo "Checking how to print long doubles..." >&4
9191
9192if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9193 $cat >try.c <<'EOCP'
9194#include <sys/types.h>
9195#include <stdio.h>
9196int main() {
9197 double d = 123.456;
9198 printf("%.3f\n", d);
9199}
9200EOCP
9201 set try
9202 if eval $compile; then
9203 yyy=`$run ./try`
9204 case "$yyy" in
9205 123.456)
9206 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9207 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9208 echo "We will use %f."
9209 ;;
9210 esac
9211 fi
9212fi
9213
9214if $test X"$sPRIfldbl" = X; then
9215 $cat >try.c <<'EOCP'
9216#include <sys/types.h>
9217#include <stdio.h>
9218int main() {
9219 long double d = 123.456;
9220 printf("%.3Lf\n", d);
9221}
9222EOCP
9223 set try
9224 if eval $compile; then
9225 yyy=`$run ./try`
9226 case "$yyy" in
9227 123.456)
9228 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9229 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9230 echo "We will use %Lf."
9231 ;;
9232 esac
9233 fi
9234fi
9235
9236if $test X"$sPRIfldbl" = X; then
9237 $cat >try.c <<'EOCP'
9238#include <sys/types.h>
9239#include <stdio.h>
9240int main() {
9241 long double d = 123.456;
9242 printf("%.3llf\n", d);
9243}
9244EOCP
9245 set try
9246 if eval $compile; then
9247 yyy=`$run ./try`
9248 case "$yyy" in
9249 123.456)
9250 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9251 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9252 echo "We will use %llf."
9253 ;;
9254 esac
9255 fi
9256fi
9257
9258if $test X"$sPRIfldbl" = X; then
9259 $cat >try.c <<'EOCP'
9260#include <sys/types.h>
9261#include <stdio.h>
9262int main() {
9263 long double d = 123.456;
9264 printf("%.3lf\n", d);
9265}
9266EOCP
9267 set try
9268 if eval $compile; then
9269 yyy=`$run ./try`
9270 case "$yyy" in
9271 123.456)
9272 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9273 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9274 echo "We will use %lf."
9275 ;;
9276 esac
9277 fi
9278fi
9279
9280if $test X"$sPRIfldbl" = X; then
9281 echo "Cannot figure out how to print long doubles." >&4
9282else
9283 sSCNfldbl=$sPRIfldbl # expect consistency
9284fi
9285
9286$rm -f try try.*
9287
9288fi # d_longdbl
9289
9290case "$sPRIfldbl" in
9291'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9292 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9293 d_SCNfldbl="$undef";
9294 ;;
9295*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9296 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9297 d_SCNfldbl="$define";
9298 ;;
9299esac
9300
b4eb6b3d 9301: Check how to convert floats to strings.
a5b10d80
YST
9302
9303if test "X$d_Gconvert" = X; then
9304
b4eb6b3d
JH
9305echo " "
9306echo "Checking for an efficient way to convert floats to strings."
9307echo " " > try.c
9308case "$uselongdouble" in
9309"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9310esac
9311case "$d_longdbl" in
9312"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9313esac
9314case "$d_PRIgldbl" in
9315"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9316esac
9317$cat >>try.c <<EOP
9318#ifdef TRY_gconvert
9319#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9320char *myname = "gconvert";
9321#endif
9322#ifdef TRY_gcvt
9323#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9324char *myname = "gcvt";
9325#endif
9326#ifdef TRY_qgcvt
9327#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9328char *myname = "qgcvt";
9329#define DOUBLETYPE long double
9330#endif
9331#ifdef TRY_sprintf
a5b10d80
YST
9332#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9333#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9334#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9335#else
a5b10d80
YST
9336#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9337#endif
9338#else
b4eb6b3d
JH
9339#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9340#endif
9341char *myname = "sprintf";
9342#endif
9343
9344#ifndef DOUBLETYPE
9345#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9346#define DOUBLETYPE long double
9347#else
9348#define DOUBLETYPE double
9349#endif
9350#endif
9351
9352#include <stdio.h>
9353
9354#define I_STDLIB $i_stdlib
9355#ifdef I_STDLIB
9356#include <stdlib.h>
9357#endif
9358
9359int
9360checkit(expect, got)
9361char *expect;
9362char *got;
9363{
9364 if (strcmp(expect, got)) {
9365 printf("%s oddity: Expected %s, got %s\n",
9366 myname, expect, got);
9367 exit(1);
9368 }
9369}
9370
9371int main()
9372{
9373 char buf[64];
9374 buf[63] = '\0';
9375
9376 /* This must be 1st test on (which?) platform */
9377 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9378 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9379 checkit("0.1", buf);
9380
a5b10d80
YST
9381 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9382 checkit("0.01", buf);
9383
9384 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9385 checkit("0.001", buf);
9386
9387 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9388 checkit("0.0001", buf);
9389
9390 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9391 if (strlen(buf) > 5)
9392 checkit("9e-005", buf); /* for Microsoft ?? */
9393 else
9394 checkit("9e-05", buf);
9395
b4eb6b3d
JH
9396 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9397 checkit("1", buf);
9398
9399 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9400 checkit("1.1", buf);
9401
9402 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9403 checkit("1.01", buf);
9404
9405 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9406 checkit("1.001", buf);
9407
9408 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9409 checkit("1.0001", buf);
9410
9411 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9412 checkit("1.00001", buf);
9413
9414 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9415 checkit("1.000001", buf);
9416
9417 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9418 checkit("0", buf);
9419
9420 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9421 checkit("-1", buf);
9422
9423 /* Some Linux gcvt's give 1.e+5 here. */
9424 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9425 checkit("100000", buf);
9426
9427 /* Some Linux gcvt's give -1.e+5 here. */
9428 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9429 checkit("-100000", buf);
9430
9431 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9432 checkit("123.456", buf);
9433
ab6ca9f4 9434 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9435 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9436 /* 34 should be enough to scare even long double
9437 * places into using the e notation. */
ab6ca9f4 9438 if (strlen(buf) > 5)
94b339ad 9439 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9440 else
94b339ad 9441 checkit("1e+34", buf);
8e2a5ede 9442
d1eb8299
YST
9443 /* For Perl, if you add additional tests here, also add them to
9444 * t/base/num.t for benefit of platforms not using Configure or
9445 * overriding d_Gconvert */
9446
b4eb6b3d
JH
9447 exit(0);
9448}
9449EOP
ab6ca9f4 9450: first add preferred functions to our list
a5b10d80 9451xxx_list=""
ab6ca9f4 9452for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9453 case $xxx_convert in
9454 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9455 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
a5b10d80
YST
9456 esac
9457done
9458: then add any others
9459for xxx_convert in gconvert gcvt sprintf; do
9460 case "$xxx_list" in
9461 *$xxx_convert*) ;;
9462 *) xxx_list="$xxx_list $xxx_convert" ;;
9463 esac
9464done
9465
9466case "$d_longdbl$uselongdouble" in
9467"$define$define")
9468 : again, add prefered functions to our list first
9469 xxx_ld_list=""
ab6ca9f4 9470 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9471 case $xxx_convert in
9472 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9473 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9474 esac
9475 done
9476 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9477 for xxx_convert in qgcvt sprintf $xxx_list; do
9478 case "$xxx_ld_list" in
9479 $xxx_convert*|*" $xxx_convert"*) ;;
9480 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9481 esac
9482 done
9483 : if sprintf cannot do long doubles, move it to the end
9484 if test "$d_PRIgldbl" != "$define"; then
9485 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9486 fi
9487 : if no qgcvt, remove it
9488 if test "$d_qgcvt" != "$define"; then
9489 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9490 fi
9491 : use the ld_list
9492 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9493 ;;
9494esac
9495
9496for xxx_convert in $xxx_list; do
9497 echo "Trying $xxx_convert..."
9498 $rm -f try try$_o
9499 set try -DTRY_$xxx_convert
9500 if eval $compile; then
9501 echo "$xxx_convert() found." >&4
5440bc8e 9502 if $run ./try; then
b4eb6b3d
JH
9503 echo "I'll use $xxx_convert to convert floats into a string." >&4
9504 break;
9505 else
9506 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9507 xxx_convert=''
b4eb6b3d
JH
9508 fi
9509 else
9510 echo "$xxx_convert NOT found." >&4
9511 fi
9512done
ab6ca9f4 9513
a5b10d80
YST
9514if test X$xxx_convert = X; then
9515 echo "*** WHOA THERE!!! ***" >&4
9516 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9517 xxx_convert=sprintf
9518fi
9519
b4eb6b3d
JH
9520case "$xxx_convert" in
9521gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9522gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9523qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9524*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9525 "$define$define$define")
9526 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9527 "$define$define$undef")
9528 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9529 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9530 esac
9531 ;;
9532esac
9533
a5b10d80
YST
9534fi
9535
74cac757
JH
9536: see if _fwalk exists
9537set fwalk d__fwalk
9538eval $inlibc
9539
b4eb6b3d
JH
9540: Initialize h_fcntl
9541h_fcntl=false
9542
9543: Initialize h_sysfile
9544h_sysfile=false
9545
9546: access call always available on UNIX
9547set access d_access
9548eval $inlibc
9549
9550: locate the flags for 'access()'
9551case "$d_access" in
9552"$define")
9553 echo " "
55954f19 9554 $cat >access.c <<EOCP
b4eb6b3d
JH
9555#include <sys/types.h>
9556#ifdef I_FCNTL
9557#include <fcntl.h>
9558#endif
9559#ifdef I_SYS_FILE
9560#include <sys/file.h>
9561#endif
9562#ifdef I_UNISTD
9563#include <unistd.h>
9564#endif
55954f19
JH
9565#$i_stdlib I_STDLIB
9566#ifdef I_STDLIB
9567#include <stdlib.h>
9568#endif
b4eb6b3d
JH
9569int main() {
9570 exit(R_OK);
9571}
9572EOCP
9573 : check sys/file.h first, no particular reason here
9574 if $test `./findhdr sys/file.h` && \
7a282f6d 9575 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9576 h_sysfile=true;
9577 echo "<sys/file.h> defines the *_OK access constants." >&4
9578 elif $test `./findhdr fcntl.h` && \
7a282f6d 9579 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9580 h_fcntl=true;
9581 echo "<fcntl.h> defines the *_OK access constants." >&4
9582 elif $test `./findhdr unistd.h` && \
7a282f6d 9583 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9584 echo "<unistd.h> defines the *_OK access constants." >&4
9585 else
9586 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9587 fi
9588 ;;
9589esac
9590$rm -f access*
9591
9592: see if accessx exists
9593set accessx d_accessx
9594eval $inlibc
9595
89ce900e
JH
9596: see if aintl exists
9597set aintl d_aintl
9598eval $inlibc
9599
b4eb6b3d
JH
9600: see if alarm exists
9601set alarm d_alarm
9602eval $inlibc
9603
a9dade78
JH
9604: see if POSIX threads are available
9605set pthread.h i_pthread
9606eval $inhdr
9607
10bc17b6
JH
9608: define a fucntion to check prototypes
9609$cat > protochk <<EOSH
9610$startsh
9611cc="$cc"
9612optimize="$optimize"
9613ccflags="$ccflags"
9614prototype="$prototype"
9615define="$define"
9616rm=$rm
a9dade78
JH
9617usethreads=$usethreads
9618i_pthread=$i_pthread
9619pthread_h_first=$pthread_h_first
10bc17b6
JH
9620EOSH
9621
9622$cat >> protochk <<'EOSH'
9623
9624$rm -f try.c
9625foo="$1"
9626shift
9627while test $# -ge 2; do
9628 case "$1" in
9629 $define) echo "#include <$2>" >> try.c ;;
9630 literal) echo "$2" >> try.c ;;
9631 esac
cce6a207
MB
9632 # Extra magic for the benefit of systems that need pthread.h
9633 # to be included early to correctly detect threadsafe functions.
9634 # Such functions must guarantee themselves, though, that the usethreads
9635 # and i_pthread have been defined, before calling protochk.
9636 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9637 echo "#include <pthread.h>" >> try.c
9638 pthread_h_done=yes
9639 fi
10bc17b6
JH
9640 shift 2
9641done
9642test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
9643cat >> try.c <<'EOCP'
9644#ifdef CAN_PROTOTYPE
9645#define _(args) args
9646#else
9647#define _(args) ()
9648#endif
9649EOCP
9650echo "$foo" >> try.c
9651echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9652$cc $optimize $ccflags -c try.c > /dev/null 2>&1
9653status=$?
9654$rm -f try.[co]
9655exit $status
9656EOSH
9657chmod +x protochk
9658$eunicefix protochk
9659
89ce900e
JH
9660hasproto='varname=$1; func=$2; shift; shift;
9661while $test $# -ge 2; do
9662 case "$1" in
9663 $define) echo "#include <$2>";;
9664 esac ;
9665 shift 2;
9666done > try.c;
9667$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9668if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9669 echo "$func() prototype found.";
9670 val="$define";
9671else
9672 echo "$func() prototype NOT found.";
9673 val="$undef";
9674fi;
9675set $varname;
9676eval $setvar;
9677$rm -f try.c tryout.c'
9678
10bc17b6
JH
9679: see if sys/types.h has to be included
9680set sys/types.h i_systypes
9681eval $inhdr
9682
9683: see if sys/select.h has to be included
9684set sys/select.h i_sysselct
9685eval $inhdr
9686
9687hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9688while $test $# -ge 2; do
9689 case "$1" in
9690 $define) echo "#include <$2>";;
9691 esac ;
9692 shift 2;
9693done > try.c;
9694echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9695set try;
9696if eval $compile; then
9697 val="$define";
9698else
9699 val="$undef";
9700fi;
9701set $varname;
9702eval $setvar;
9703$rm -f try.c try.o'
9704
9705: see if we should include time.h, sys/time.h, or both
9706echo " "
9707if test "X$timeincl" = X; then
9708 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9709 $echo $n "I'm now running the test program...$c"
55954f19 9710 $cat >try.c <<EOCP
10bc17b6
JH
9711#include <sys/types.h>
9712#ifdef I_TIME
9713#include <time.h>
9714#endif
9715#ifdef I_SYSTIME
9716#ifdef SYSTIMEKERNEL
9717#define KERNEL
9718#endif
9719#include <sys/time.h>
9720#endif
9721#ifdef I_SYSSELECT
9722#include <sys/select.h>
9723#endif
55954f19
JH
9724#$i_stdlib I_STDLIB
9725#ifdef I_STDLIB
9726#include <stdlib.h>
9727#endif
10bc17b6
JH
9728int main()
9729{
9730 struct tm foo;
9731#ifdef S_TIMEVAL
9732 struct timeval bar;
9733#endif
9734#ifdef S_TIMEZONE
9735 struct timezone tzp;
9736#endif
9737 if (foo.tm_sec == foo.tm_sec)
9738 exit(0);
9739#ifdef S_TIMEVAL
9740 if (bar.tv_sec == bar.tv_sec)
9741 exit(0);
9742#endif
9743 exit(1);
9744}
9745EOCP
9746 flags=''
9747 for s_timezone in '-DS_TIMEZONE' ''; do
9748 sysselect=''
9749 for s_timeval in '-DS_TIMEVAL' ''; do
9750 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9751 for i_time in '' '-DI_TIME'; do
9752 for i_systime in '-DI_SYSTIME' ''; do
9753 case "$flags" in
9754 '') $echo $n ".$c"
9755 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9756 if eval $compile; then
9757 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9758 shift
9759 flags="$*"
9760 echo " "
9761 $echo $n "Succeeded with $flags$c"
9762 fi
9763 ;;
9764 esac
9765 done
9766 done
9767 done
9768 done
9769 done
9770 timeincl=''
9771 echo " "
9772 case "$flags" in
9773 *SYSTIMEKERNEL*) i_systimek="$define"
9774 timeincl=`./findhdr sys/time.h`
9775 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9776 *) i_systimek="$undef";;
9777 esac
9778 case "$flags" in
9779 *I_TIME*) i_time="$define"
9780 timeincl=`./findhdr time.h`" $timeincl"
9781 echo "We'll include <time.h>." >&4;;
9782 *) i_time="$undef";;
9783 esac
9784 case "$flags" in
9785 *I_SYSTIME*) i_systime="$define"
9786 timeincl=`./findhdr sys/time.h`" $timeincl"
9787 echo "We'll include <sys/time.h>." >&4;;
9788 *) i_systime="$undef";;
9789 esac
9790 $rm -f try.c try
9791fi
9792: see if struct tm knows about tm_zone
9793case "$i_systime$i_time" in
9794*$define*)
9795 echo " "
9796 echo "Checking to see if your struct tm has tm_zone field..." >&4
9797 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9798 eval $hasfield
9799 ;;
9800*) val="$undef"
9801 set d_tm_tm_zone
9802 eval $setvar
9803 ;;
9804esac
9805case "$d_tm_tm_zone" in
9806"$define") echo "Yes, it does." ;;
9807*) echo "No, it doesn't." ;;
9808esac
9809: see if struct tm knows about tm_gmtoff
9810case "$i_systime$i_time" in
9811*$define*)
9812 echo " "
9813 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9814 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9815 eval $hasfield
9816 ;;
9817*) val="$undef"
9818 set d_tm_tm_gmtoff
9819 eval $setvar
9820 ;;
9821esac
9822case "$d_tm_tm_gmtoff" in
9823"$define") echo "Yes, it does." ;;
9824*) echo "No, it doesn't." ;;
9825esac
9826
9827: see if asctime_r exists
9828set asctime_r d_asctime_r
9829eval $inlibc
9830case "$d_asctime_r" in
9831"$define")
d63eadf0 9832 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
9833 case "$d_asctime_r_proto:$usethreads" in
9834 ":define") d_asctime_r_proto=define
a48ec845
JH
9835 set d_asctime_r_proto asctime_r $hdrs
9836 eval $hasproto ;;
9837 *) ;;
9838 esac
9839 case "$d_asctime_r_proto" in
9840 define)
10bc17b6
JH
9841 case "$asctime_r_proto" in
9842 ''|0) try='char* asctime_r(const struct tm*, char*);'
9843 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9844 esac
9845 case "$asctime_r_proto" in
9846 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9847 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9848 esac
9849 case "$asctime_r_proto" in
9850 ''|0) try='int asctime_r(const struct tm*, char*);'
9851 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9852 esac
9853 case "$asctime_r_proto" in
9854 ''|0) try='int asctime_r(const struct tm*, char*, int);'
9855 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9856 esac
9857 case "$asctime_r_proto" in
90e831dc 9858 ''|0) d_asctime_r=undef
10bc17b6 9859 asctime_r_proto=0
a48ec845 9860 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
9861 * ) case "$asctime_r_proto" in
9862 REENTRANT_PROTO*) ;;
9863 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9864 esac
9865 echo "Prototype: $try" ;;
9866 esac
9867 ;;
c18e646a
JH
9868 *) case "$usethreads" in
9869 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9870 esac
90e831dc
SB
9871 d_asctime_r=undef
9872 asctime_r_proto=0
c18e646a 9873 ;;
a48ec845
JH
9874 esac
9875 ;;
10bc17b6
JH
9876*) asctime_r_proto=0
9877 ;;
9878esac
9879
b4eb6b3d
JH
9880: see if atolf exists
9881set atolf d_atolf
9882eval $inlibc
9883
9884: see if atoll exists
9885set atoll d_atoll
9886eval $inlibc
9887
0dbb1585
AL
9888: Look for GCC-style attribute format
9889case "$d_attribute_format" in
bde30f85 9890'')
b4eb6b3d 9891echo " "
0dbb1585 9892echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
b4eb6b3d
JH
9893$cat >attrib.c <<'EOCP'
9894#include <stdio.h>
0dbb1585 9895void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
b4eb6b3d
JH
9896EOCP
9897if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9898 if $contains 'warning' attrib.out >/dev/null 2>&1; then
0dbb1585 9899 echo "Your C compiler doesn't support __attribute__((format))."
b4eb6b3d
JH
9900 val="$undef"
9901 else
0dbb1585 9902 echo "Your C compiler supports __attribute__((format))."
b4eb6b3d
JH
9903 val="$define"
9904 fi
9905else
9906 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9907 val="$undef"
9908fi
bde30f85 9909;;
0dbb1585 9910*) val="$d_attribute_format" ;;
bde30f85 9911esac
0dbb1585
AL
9912set d_attribute_format
9913eval $setvar
9914$rm -f attrib*
9915
9916: Look for GCC-style attribute malloc
9917case "$d_attribute_malloc" in
9918'')
9919echo " "
9920echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9921$cat >attrib.c <<'EOCP'
9922#include <stdio.h>
9923char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9924EOCP
9925if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9926 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9927 echo "Your C compiler doesn't support __attribute__((malloc))."
9928 val="$undef"
9929 else
9930 echo "Your C compiler supports __attribute__((malloc))."
9931 val="$define"
9932 fi
9933else
9934 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9935 val="$undef"
9936fi
9937;;
9938*) val="$d_attribute_malloc" ;;
9939esac
9940set d_attribute_malloc
9941eval $setvar
9942$rm -f attrib*
9943
9944: Look for GCC-style attribute nonnull
9945case "$d_attribute_nonnull" in
9946'')
9947echo " "
9948echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9949$cat >attrib.c <<'EOCP'
9950#include <stdio.h>
9951void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9952EOCP
9953if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9954 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9955 echo "Your C compiler doesn't support __attribute__((nonnull))."
9956 val="$undef"
9957 else
9958 echo "Your C compiler supports __attribute__((nonnull))."
9959 val="$define"
9960 fi
9961else
9962 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9963 val="$undef"
9964fi
9965;;
9966*) val="$d_attribute_nonnull" ;;
9967esac
9968set d_attribute_nonnull
9969eval $setvar
9970$rm -f attrib*
9971
9972: Look for GCC-style attribute noreturn
9973case "$d_attribute_noreturn" in
9974'')
9975echo " "
9976echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9977$cat >attrib.c <<'EOCP'
9978#include <stdio.h>
9979void fall_over_dead( void ) __attribute__((noreturn));
9980EOCP
9981if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9982 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9983 echo "Your C compiler doesn't support __attribute__((noreturn))."
9984 val="$undef"
9985 else
9986 echo "Your C compiler supports __attribute__((noreturn))."
9987 val="$define"
9988 fi
9989else
9990 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9991 val="$undef"
9992fi
9993;;
9994*) val="$d_attribute_noreturn" ;;
9995esac
9996set d_attribute_noreturn
9997eval $setvar
9998$rm -f attrib*
9999
10000: Look for GCC-style attribute pure
10001case "$d_attribute_pure" in
10002'')
10003echo " "
10004echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10005$cat >attrib.c <<'EOCP'
10006#include <stdio.h>
10007int square( int n ) __attribute__((pure));
10008EOCP
10009if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10010 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10011 echo "Your C compiler doesn't support __attribute__((pure))."
10012 val="$undef"
10013 else
10014 echo "Your C compiler supports __attribute__((pure))."
10015 val="$define"
10016 fi
10017else
10018 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10019 val="$undef"
10020fi
10021;;
10022*) val="$d_attribute_pure" ;;
10023esac
10024set d_attribute_pure
10025eval $setvar
10026$rm -f attrib*
10027
10028: Look for GCC-style attribute unused
10029case "$d_attribute_unused" in
10030'')
10031echo " "
10032echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10033$cat >attrib.c <<'EOCP'
10034#include <stdio.h>
10035int do_something( int dummy __attribute__((unused)), int n );
10036EOCP
10037if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10038 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10039 echo "Your C compiler doesn't support __attribute__((unused))."
10040 val="$undef"
10041 else
10042 echo "Your C compiler supports __attribute__((unused))."
10043 val="$define"
10044 fi
10045else
10046 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10047 val="$undef"
10048fi
10049;;
10050*) val="$d_attribute_unused" ;;
10051esac
10052set d_attribute_unused
10053eval $setvar
10054$rm -f attrib*
10055
10056: Look for GCC-style attribute warn_unused_result
10057case "$d_attribute_warn_unused_result" in
10058'')
10059echo " "
10060echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10061$cat >attrib.c <<'EOCP'
10062#include <stdio.h>
10063int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10064EOCP
10065if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10066 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10067 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10068 val="$undef"
10069 else
10070 echo "Your C compiler supports __attribute__((warn_unused_result))."
10071 val="$define"
10072 fi
10073else
10074 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10075 val="$undef"
10076fi
10077;;
10078*) val="$d_attribute_warn_unused_result" ;;
10079esac
10080set d_attribute_warn_unused_result
b4eb6b3d
JH
10081eval $setvar
10082$rm -f attrib*
10083
10084: see if bcmp exists
10085set bcmp d_bcmp
10086eval $inlibc
10087
10088: see if bcopy exists
10089set bcopy d_bcopy
10090eval $inlibc
10091
10092: see if this is a unistd.h system
10093set unistd.h i_unistd
10094eval $inhdr
10095
10096: see if getpgrp exists
10097set getpgrp d_getpgrp
10098eval $inlibc
10099
10100case "$d_getpgrp" in
10101"$define")
10102 echo " "
10103 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 10104 $cat >try.c <<EOP
b4eb6b3d
JH
10105#$i_unistd I_UNISTD
10106#include <sys/types.h>
10107#ifdef I_UNISTD
10108# include <unistd.h>
10109#endif
55954f19
JH
10110#$i_stdlib I_STDLIB
10111#ifdef I_STDLIB
10112#include <stdlib.h>
10113#endif
b4eb6b3d
JH
10114int main()
10115{
10116 if (getuid() == 0) {
10117 printf("(I see you are running Configure as super-user...)\n");
10118 setuid(1);
10119 }
10120#ifdef TRY_BSD_PGRP
10121 if (getpgrp(1) == 0)
10122 exit(0);
10123#else
10124 if (getpgrp() > 0)
10125 exit(0);
10126#endif
10127 exit(1);
10128}
10129EOP
5440bc8e 10130 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10131 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10132 val="$define"
5440bc8e 10133 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10134 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10135 val="$undef"
10136 else
10137 echo "I can't seem to compile and run the test program."
10138 if ./usg; then
10139 xxx="a USG one, i.e. you use getpgrp()."
10140 else
10141 # SVR4 systems can appear rather BSD-ish.
10142 case "$i_unistd" in
10143 $undef)
10144 xxx="a BSD one, i.e. you use getpgrp(pid)."
10145 val="$define"
10146 ;;
10147 $define)
10148 xxx="probably a USG one, i.e. you use getpgrp()."
10149 val="$undef"
10150 ;;
10151 esac
10152 fi
10153 echo "Assuming your getpgrp is $xxx" >&4
10154 fi
10155 ;;
10156*) val="$undef";;
10157esac
10158set d_bsdgetpgrp
10159eval $setvar
5440bc8e 10160$rm -f try try.*
b4eb6b3d
JH
10161
10162: see if setpgrp exists
10163set setpgrp d_setpgrp
10164eval $inlibc
10165
10166case "$d_setpgrp" in
10167"$define")
10168 echo " "
10169 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 10170 $cat >try.c <<EOP
b4eb6b3d
JH
10171#$i_unistd I_UNISTD
10172#include <sys/types.h>
10173#ifdef I_UNISTD
10174# include <unistd.h>
10175#endif
55954f19
JH
10176#$i_stdlib I_STDLIB
10177#ifdef I_STDLIB
10178#include <stdlib.h>
10179#endif
b4eb6b3d
JH
10180int main()
10181{
10182 if (getuid() == 0) {
10183 printf("(I see you are running Configure as super-user...)\n");
10184 setuid(1);
10185 }
10186#ifdef TRY_BSD_PGRP
10187 if (-1 == setpgrp(1, 1))
10188 exit(0);
10189#else
10190 if (setpgrp() != -1)
10191 exit(0);
10192#endif
10193 exit(1);
10194}
10195EOP
5440bc8e 10196 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10197 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10198 val="$define"
5440bc8e 10199 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10200 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10201 val="$undef"
10202 else
10203 echo "(I can't seem to compile and run the test program.)"
10204 if ./usg; then
10205 xxx="a USG one, i.e. you use setpgrp()."
10206 else
10207 # SVR4 systems can appear rather BSD-ish.
10208 case "$i_unistd" in
10209 $undef)
10210 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10211 val="$define"
10212 ;;
10213 $define)
10214 xxx="probably a USG one, i.e. you use setpgrp()."
10215 val="$undef"
10216 ;;
10217 esac
10218 fi
10219 echo "Assuming your setpgrp is $xxx" >&4
10220 fi
10221 ;;
10222*) val="$undef";;
10223esac
10224set d_bsdsetpgrp
10225eval $setvar
5440bc8e 10226$rm -f try try.*
b4eb6b3d
JH
10227: see if bzero exists
10228set bzero d_bzero
10229eval $inlibc
10230
10231: see if signal is declared as pointer to function returning int or void
10232echo " "
10233xxx=`./findhdr signal.h`
10234$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10235if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10236 echo "You have int (*signal())() instead of void." >&4
10237 val="$undef"
10238elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10239 echo "You have void (*signal())()." >&4
10240 val="$define"
10241elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10242 echo "You have int (*signal())() instead of void." >&4
10243 val="$undef"
10244elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10245 echo "You have void (*signal())()." >&4
10246 val="$define"
10247else
10248 case "$d_voidsig" in
10249 '')
10250 echo "I can't determine whether signal handler returns void or int..." >&4
10251 dflt=void
10252 rp="What type does your signal handler return?"
10253 . ./myread
10254 case "$ans" in
10255 v*) val="$define";;
10256 *) val="$undef";;
10257 esac;;
10258 "$define")
10259 echo "As you already told me, signal handler returns void." >&4
10260 val="$define"
10261 ;;
10262 *) echo "As you already told me, signal handler returns int." >&4
10263 val="$undef"
10264 ;;
10265 esac
10266fi
10267set d_voidsig
10268eval $setvar
10269case "$d_voidsig" in
10270"$define") signal_t="void";;
10271*) signal_t="int";;
10272esac
10273$rm -f $$.tmp
10274
10275: check for ability to cast large floats to 32-bit ints.
10276echo " "
10277echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10278if $test "$intsize" -ge 4; then
10279 xxx=int
10280else
10281 xxx=long
10282fi
10283$cat >try.c <<EOCP
10284#include <stdio.h>
d1daaddf
JH
10285#$i_stdlib I_STDLIB
10286#ifdef I_STDLIB
10287#include <stdlib.h>
10288#endif
b4eb6b3d
JH
10289#include <sys/types.h>
10290#include <signal.h>
10291$signal_t blech(s) int s; { exit(3); }
10292int main()
10293{
10294 $xxx i32;
10295 double f, g;
10296 int result = 0;
10297 char str[16];
10298 signal(SIGFPE, blech);
10299
10300 /* Don't let compiler optimize the test away. Store the number
10301 in a writable string for gcc to pass to sscanf under HP/UX.
10302 */
10303 sprintf(str, "2147483647");
10304 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10305 g = 10 * f;
10306 i32 = ($xxx) g;
10307
10308 /* x86 processors will probably give 0x8000 0000, which is a
4a39fcde 10309 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
10310 behavior here, which is to preserve the sign and give
10311 back 0x7fff ffff.
10312 */
10313 if (i32 != ($xxx) f)
10314 result |= 1;
10315 exit(result);
10316}
10317EOCP
10318set try
10319if eval $compile_ok; then
5440bc8e 10320 $run ./try
b4eb6b3d
JH
10321 yyy=$?
10322else
10323 echo "(I can't seem to compile the test program--assuming it can't)"
10324 yyy=1
10325fi
10326case "$yyy" in
103270) val="$define"
10328 echo "Yup, it can."
10329 ;;
10330*) val="$undef"
10331 echo "Nope, it can't."
10332 ;;
10333esac
10334set d_casti32
10335eval $setvar
10336$rm -f try try.*
10337
10338: check for ability to cast negative floats to unsigned
10339echo " "
10340echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10341$cat >try.c <<EOCP
10342#include <stdio.h>
d1daaddf
JH
10343#$i_stdlib I_STDLIB
10344#ifdef I_STDLIB
10345#include <stdlib.h>
10346#endif
b4eb6b3d
JH
10347#include <sys/types.h>
10348#include <signal.h>
10349$signal_t blech(s) int s; { exit(7); }
10350$signal_t blech_in_list(s) int s; { exit(4); }
10351unsigned long dummy_long(p) unsigned long p; { return p; }
10352unsigned int dummy_int(p) unsigned int p; { return p; }
10353unsigned short dummy_short(p) unsigned short p; { return p; }
10354int main()
10355{
10356 double f;
10357 unsigned long along;
10358 unsigned int aint;
10359 unsigned short ashort;
10360 int result = 0;
10361 char str[16];
10362
10363 /* Frustrate gcc-2.7.2's optimizer which failed this test with
10364 a direct f = -123. assignment. gcc-2.8.0 reportedly
10365 optimized the whole file away
10366 */
10367 /* Store the number in a writable string for gcc to pass to
10368 sscanf under HP/UX.
10369 */
10370 sprintf(str, "-123");
10371 sscanf(str, "%lf", &f); /* f = -123.; */
10372
10373 signal(SIGFPE, blech);
10374 along = (unsigned long)f;
10375 aint = (unsigned int)f;
10376 ashort = (unsigned short)f;
10377 if (along != (unsigned long)-123)
10378 result |= 1;
10379 if (aint != (unsigned int)-123)
10380 result |= 1;
10381 if (ashort != (unsigned short)-123)
10382 result |= 1;
10383 sprintf(str, "1073741824.");
10384 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10385 f = f + f;
10386 along = 0;
10387 along = (unsigned long)f;
10388 if (along != 0x80000000)
10389 result |= 2;
10390 f -= 1.;
10391 along = 0;
10392 along = (unsigned long)f;
10393 if (along != 0x7fffffff)
10394 result |= 1;
10395 f += 2.;
10396 along = 0;
10397 along = (unsigned long)f;
10398 if (along != 0x80000001)
10399 result |= 2;
10400 if (result)
10401 exit(result);
10402 signal(SIGFPE, blech_in_list);
10403 sprintf(str, "123.");
10404 sscanf(str, "%lf", &f); /* f = 123.; */
10405 along = dummy_long((unsigned long)f);
10406 aint = dummy_int((unsigned int)f);
10407 ashort = dummy_short((unsigned short)f);
10408 if (along != (unsigned long)123)
10409 result |= 4;
10410 if (aint != (unsigned int)123)
10411 result |= 4;
10412 if (ashort != (unsigned short)123)
10413 result |= 4;
10414 exit(result);
10415
10416}
10417EOCP
10418set try
10419if eval $compile_ok; then
5440bc8e 10420 $run ./try
b4eb6b3d
JH
10421 castflags=$?
10422else
10423 echo "(I can't seem to compile the test program--assuming it can't)"
10424 castflags=7
10425fi
10426case "$castflags" in
104270) val="$define"
10428 echo "Yup, it can."
10429 ;;
10430*) val="$undef"
10431 echo "Nope, it can't."
10432 ;;
10433esac
10434set d_castneg
10435eval $setvar
10436$rm -f try.*
10437
10438: see if vprintf exists
10439echo " "
10440if set vprintf val -f d_vprintf; eval $csym; $val; then
10441 echo 'vprintf() found.' >&4
10442 val="$define"
55954f19 10443 $cat >try.c <<EOF
b4eb6b3d 10444#include <varargs.h>
55954f19
JH
10445#$i_stdlib I_STDLIB
10446#ifdef I_STDLIB
10447#include <stdlib.h>
10448#endif
b4eb6b3d
JH
10449
10450int main() { xxx("foo"); }
10451
10452xxx(va_alist)
10453va_dcl
10454{
10455 va_list args;
10456 char buf[10];
10457
10458 va_start(args);
10459 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10460}
10461EOF
5440bc8e
JH
10462 set try
10463 if eval $compile && $run ./try; then
b4eb6b3d
JH
10464 echo "Your vsprintf() returns (int)." >&4
10465 val2="$undef"
10466 else
10467 echo "Your vsprintf() returns (char*)." >&4
10468 val2="$define"
10469 fi
10470else
10471 echo 'vprintf() NOT found.' >&4
10472 val="$undef"
10473 val2="$undef"
10474fi
5440bc8e 10475$rm -f try try.*
b4eb6b3d
JH
10476set d_vprintf
10477eval $setvar
10478val=$val2
10479set d_charvspr
10480eval $setvar
10481
10482: see if chown exists
10483set chown d_chown
10484eval $inlibc
10485
10486: see if chroot exists
10487set chroot d_chroot
10488eval $inlibc
10489
10490: see if chsize exists
10491set chsize d_chsize
10492eval $inlibc
10493
758a5d79
JH
10494: see if class exists
10495set class d_class
10496eval $inlibc
10497
4e0554ec
JH
10498hasstruct='varname=$1; struct=$2; shift; shift;
10499while $test $# -ge 2; do
10500 case "$1" in
10501 $define) echo "#include <$2>";;
10502 esac ;
10503 shift 2;
10504done > try.c;
10505echo "int main () { struct $struct foo; }" >> try.c;
10506set try;
10507if eval $compile; then
10508 val="$define";
10509else
10510 val="$undef";
10511fi;
10512set $varname;
10513eval $setvar;
10514$rm -f try.c try.o'
10515
4e0554ec
JH
10516socketlib=''
10517sockethdr=''
10518: see whether socket exists
10519echo " "
10520$echo $n "Hmm... $c" >&4
10521if set socket val -f d_socket; eval $csym; $val; then
10522 echo "Looks like you have Berkeley networking support." >&4
10523 d_socket="$define"
10524 if set setsockopt val -f; eval $csym; $val; then
10525 d_oldsock="$undef"
10526 else
10527 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10528 d_oldsock="$define"
10529 fi
10530else
10531 if $contains socklib libc.list >/dev/null 2>&1; then
10532 echo "Looks like you have Berkeley networking support." >&4
10533 d_socket="$define"
10534 : we will have to assume that it supports the 4.2 BSD interface
10535 d_oldsock="$undef"
10536 else
10537 echo "You don't have Berkeley networking in libc$_a..." >&4
10538 if test "X$d_socket" = "X$define"; then
10539 echo "...but you seem to believe that you have sockets." >&4
10540 else
10541 for net in net socket
10542 do
10543 if test -f /usr/lib/lib$net$_a; then
10544 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
10545 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10546 if $contains socket libc.list >/dev/null 2>&1; then
10547 d_socket="$define"
10548 socketlib="-l$net"
10549 case "$net" in
10550 net)
10551 echo "...but the Wollongong group seems to have hacked it in." >&4
10552 sockethdr="-I/usr/netinclude"
10553 ;;
10554 esac
3c728e00 10555 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
10556 if $contains setsockopt libc.list >/dev/null 2>&1; then
10557 d_oldsock="$undef"
10558 else
10559 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10560 d_oldsock="$define"
10561 fi
10562 break
10563 fi
10564 fi
10565 done
10566 if test "X$d_socket" != "X$define"; then
10567 echo "or anywhere else I see." >&4
10568 d_socket="$undef"
10569 d_oldsock="$undef"
10570 fi
10571 fi
10572 fi
10573fi
10574
10575: see if socketpair exists
10576set socketpair d_sockpair
10577eval $inlibc
10578
10579
10580echo " "
3c728e00 10581echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
10582for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10583 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10584 $cat >try.c <<EOF
10585#include <sys/types.h>
10586#include <sys/socket.h>
10587int main() {
10588 int i = $ENUM;
10589}
10590EOF
10591 val="$undef"
10592 set try; if eval $compile; then
10593 val="$define"
10594 fi
10595 set d_${enum}; eval $setvar
10596 $rm -f try.c try
10597done
10598
10599: see if this is a sys/uio.h system
10600set sys/uio.h i_sysuio
10601eval $inhdr
10602
10603
10604echo " "
10605echo "Checking to see if your system supports struct cmsghdr..." >&4
10606set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10607eval $hasstruct
10608case "$d_cmsghdr_s" in
10609"$define") echo "Yes, it does." ;;
10610*) echo "No, it doesn't." ;;
10611esac
10612
10613
b4eb6b3d
JH
10614: check for const keyword
10615echo " "
10616echo 'Checking to see if your C compiler knows about "const"...' >&4
10617$cat >const.c <<'EOCP'
10618typedef struct spug { int drokk; } spug;
76f47787 10619int main()
b4eb6b3d
JH
10620{
10621 const char *foo;
10622 const spug y;
10623}
10624EOCP
10625if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10626 val="$define"
10627 echo "Yup, it does."
10628else
10629 val="$undef"
10630 echo "Nope, it doesn't."
10631fi
10632set d_const
10633eval $setvar
10634
89ce900e
JH
10635: see if copysignl exists
10636set copysignl d_copysignl
10637eval $inlibc
10638
b4eb6b3d
JH
10639: see if crypt exists
10640echo " "
a5a94ea5
JH
10641set crypt d_crypt
10642eval $inlibc
10643case "$d_crypt" in
10644$define) cryptlib='' ;;
10645*) if set crypt val -f d_crypt; eval $csym; $val; then
10646 echo 'crypt() found.' >&4
b4eb6b3d 10647 val="$define"
a5a94ea5
JH
10648 cryptlib=''
10649 else
10650 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10651 if $test -z "$cryptlib"; then
10652 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10653 else
10654 cryptlib=-lcrypt
10655 fi
10656 if $test -z "$cryptlib"; then
10657 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10658 else
10659 cryptlib=-lcrypt
10660 fi
10661 if $test -z "$cryptlib"; then
10662 cryptlib=`./loc libcrypt$_a "" $libpth`
10663 else
10664 cryptlib=-lcrypt
10665 fi
10666 if $test -z "$cryptlib"; then
10667 echo 'crypt() NOT found.' >&4
10668 val="$undef"
10669 else
10670 val="$define"
10671 fi
b4eb6b3d 10672 fi
a5a94ea5
JH
10673 set d_crypt
10674 eval $setvar
10675 ;;
10676esac
b4eb6b3d 10677
10bc17b6
JH
10678: see if this is a crypt.h system
10679set crypt.h i_crypt
10680eval $inhdr
10681
10682: see if crypt_r exists
10683set crypt_r d_crypt_r
10684eval $inlibc
10685case "$d_crypt_r" in
10686"$define")
10687 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
10688 case "$d_crypt_r_proto:$usethreads" in
10689 ":define") d_crypt_r_proto=define
a48ec845
JH
10690 set d_crypt_r_proto crypt_r $hdrs
10691 eval $hasproto ;;
10692 *) ;;
10693 esac
10694 case "$d_crypt_r_proto" in
10695 define)
10bc17b6
JH
10696 case "$crypt_r_proto" in
10697 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10698 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10699 esac
10700 case "$crypt_r_proto" in
b430fd04
JH
10701 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10702 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10703 esac
10704 case "$crypt_r_proto" in
90e831dc 10705 ''|0) d_crypt_r=undef
10bc17b6 10706 crypt_r_proto=0
a48ec845 10707 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10708 * ) case "$crypt_r_proto" in
10709 REENTRANT_PROTO*) ;;
10710 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10711 esac
10712 echo "Prototype: $try" ;;
10713 esac
10714 ;;
c18e646a
JH
10715 *) case "$usethreads" in
10716 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10717 esac
90e831dc
SB
10718 d_crypt_r=undef
10719 crypt_r_proto=0
c18e646a 10720 ;;
a48ec845
JH
10721 esac
10722 ;;
10bc17b6
JH
10723*) crypt_r_proto=0
10724 ;;
10725esac
10726
b4eb6b3d
JH
10727: get csh whereabouts
10728case "$csh" in
10729'csh') val="$undef" ;;
10730*) val="$define" ;;
10731esac
10732set d_csh
10733eval $setvar
10734: Respect a hint or command line value for full_csh.
10735case "$full_csh" in
10736'') full_csh=$csh ;;
10737esac
10738
10bc17b6
JH
10739: see if ctermid_r exists
10740set ctermid_r d_ctermid_r
10741eval $inlibc
10742case "$d_ctermid_r" in
10743"$define")
31ee0cb7 10744 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
10745 case "$d_ctermid_r_proto:$usethreads" in
10746 ":define") d_ctermid_r_proto=define
a48ec845
JH
10747 set d_ctermid_r_proto ctermid_r $hdrs
10748 eval $hasproto ;;
10749 *) ;;
10750 esac
10751 case "$d_ctermid_r_proto" in
10752 define)
10bc17b6
JH
10753 case "$ctermid_r_proto" in
10754 ''|0) try='char* ctermid_r(char*);'
10755 ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10756 esac
10757 case "$ctermid_r_proto" in
90e831dc 10758 ''|0) d_ctermid_r=undef
10bc17b6 10759 ctermid_r_proto=0
a48ec845 10760 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10761 * ) case "$ctermid_r_proto" in
10762 REENTRANT_PROTO*) ;;
10763 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10764 esac
10765 echo "Prototype: $try" ;;
10766 esac
10767 ;;
c18e646a
JH
10768 *) case "$usethreads" in
10769 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10770 esac
90e831dc
SB
10771 d_ctermid_r=undef
10772 ctermid_r_proto=0
c18e646a 10773 ;;
a48ec845
JH
10774 esac
10775 ;;
10bc17b6
JH
10776*) ctermid_r_proto=0
10777 ;;
10778esac
10779
10780: see if ctime_r exists
10781set ctime_r d_ctime_r
10782eval $inlibc
10783case "$d_ctime_r" in
10784"$define")
d63eadf0 10785 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
10786 case "$d_ctime_r_proto:$usethreads" in
10787 ":define") d_ctime_r_proto=define
a48ec845
JH
10788 set d_ctime_r_proto ctime_r $hdrs
10789 eval $hasproto ;;
10790 *) ;;
10791 esac
10792 case "$d_ctime_r_proto" in
10793 define)
10bc17b6
JH
10794 case "$ctime_r_proto" in
10795 ''|0) try='char* ctime_r(const time_t*, char*);'
10796 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10797 esac
10798 case "$ctime_r_proto" in
10799 ''|0) try='char* ctime_r(const time_t*, char*, int);'
10800 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10801 esac
10802 case "$ctime_r_proto" in
10803 ''|0) try='int ctime_r(const time_t*, char*);'
10804 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10805 esac
10806 case "$ctime_r_proto" in
10807 ''|0) try='int ctime_r(const time_t*, char*, int);'
10808 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10809 esac
10810 case "$ctime_r_proto" in
90e831dc 10811 ''|0) d_ctime_r=undef
10bc17b6 10812 ctime_r_proto=0
a48ec845 10813 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10814 * ) case "$ctime_r_proto" in
10815 REENTRANT_PROTO*) ;;
10816 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10817 esac
10818 echo "Prototype: $try" ;;
10819 esac
10820 ;;
c18e646a
JH
10821 *) case "$usethreads" in
10822 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10823 esac
90e831dc
SB
10824 d_ctime_r=undef
10825 ctime_r_proto=0
c18e646a 10826 ;;
a48ec845
JH
10827 esac
10828 ;;
10bc17b6
JH
10829*) ctime_r_proto=0
10830 ;;
10831esac
10832
b4eb6b3d
JH
10833: see if cuserid exists
10834set cuserid d_cuserid
10835eval $inlibc
10836
10837: see if this is a limits.h system
10838set limits.h i_limits
10839eval $inhdr
10840
10841: see if this is a float.h system
10842set float.h i_float
10843eval $inhdr
10844
10845: See if number of significant digits in a double precision number is known
10846echo " "
10847$cat >dbl_dig.c <<EOM
10848#$i_limits I_LIMITS
10849#$i_float I_FLOAT
10850#ifdef I_LIMITS
10851#include <limits.h>
10852#endif
10853#ifdef I_FLOAT
10854#include <float.h>
10855#endif
10856#ifdef DBL_DIG
10857printf("Contains DBL_DIG");
10858#endif
10859EOM
10860$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10861if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10862 echo "DBL_DIG found." >&4
10863 val="$define"
10864else
10865 echo "DBL_DIG NOT found." >&4
10866 val="$undef"
10867fi
10868$rm -f dbl_dig.?
10869set d_dbl_dig
10870eval $setvar
10871
2ef53570
JH
10872: see if dbm.h is available
10873: see if dbmclose exists
10874set dbmclose d_dbmclose
10875eval $inlibc
10876
10877case "$d_dbmclose" in
10878$define)
10879 set dbm.h i_dbm
10880 eval $inhdr
10881 case "$i_dbm" in
10882 $define)
10883 val="$undef"
10884 set i_rpcsvcdbm
10885 eval $setvar
10886 ;;
10887 *) set rpcsvc/dbm.h i_rpcsvcdbm
10888 eval $inhdr
10889 ;;
10890 esac
10891 ;;
10892*) echo "We won't be including <dbm.h>"
10893 val="$undef"
10894 set i_dbm
10895 eval $setvar
10896 val="$undef"
10897 set i_rpcsvcdbm
10898 eval $setvar
10899 ;;
10900esac
10901
10902: see if prototype for dbminit is available
10903echo " "
10904set d_dbminitproto dbminit $i_dbm dbm.h
10905eval $hasproto
10906
b4eb6b3d
JH
10907: see if difftime exists
10908set difftime d_difftime
10909eval $inlibc
10910
10911: see if this is a dirent system
10912echo " "
10913if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10914 val="$define"
10915 echo "<dirent.h> found." >&4
10916else
10917 val="$undef"
10918 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10919 echo "<sys/dir.h> found." >&4
10920 echo " "
10921 else
10922 xinc=`./findhdr sys/ndir.h`
10923 fi
10924 echo "<dirent.h> NOT found." >&4
10925fi
10926set i_dirent
10927eval $setvar
10928
10929: Look for type of directory structure.
10930echo " "
10931$cppstdin $cppflags $cppminus < "$xinc" > try.c
10932
10933case "$direntrytype" in
10934''|' ')
10935 case "$i_dirent" in
10936 $define) guess1='struct dirent' ;;
10937 *) guess1='struct direct' ;;
10938 esac
10939 ;;
10940*) guess1="$direntrytype"
10941 ;;
10942esac
10943
10944case "$guess1" in
10945'struct dirent') guess2='struct direct' ;;
10946*) guess2='struct dirent' ;;
10947esac
10948
10949if $contains "$guess1" try.c >/dev/null 2>&1; then
10950 direntrytype="$guess1"
10951 echo "Your directory entries are $direntrytype." >&4
10952elif $contains "$guess2" try.c >/dev/null 2>&1; then
10953 direntrytype="$guess2"
10954 echo "Your directory entries seem to be $direntrytype." >&4
10955else
10956 echo "I don't recognize your system's directory entries." >&4
10957 rp="What type is used for directory entries on this system?"
10958 dflt="$guess1"
10959 . ./myread
10960 direntrytype="$ans"
10961fi
10962$rm -f try.c
10963
10964
10965: see if the directory entry stores field length
10966echo " "
10967$cppstdin $cppflags $cppminus < "$xinc" > try.c
10968if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10969 echo "Good, your directory entry keeps length information in d_namlen." >&4
10970 val="$define"
10971else
10972 echo "Your directory entry does not know about the d_namlen field." >&4
10973 val="$undef"
10974fi
10975set d_dirnamlen
10976eval $setvar
10977$rm -f try.c
10978
ae0e3d3b
JH
10979: see if this is an sysdir system
10980set sys/dir.h i_sysdir
10981eval $inhdr
10982
10983: see if this is an sysndir system
10984set sys/ndir.h i_sysndir
10985eval $inhdr
10986
10987: Look for dirfd
10988echo " "
10989$cat >dirfd.c <<EOM
10990#include <stdio.h>
55954f19
JH
10991#$i_stdlib I_STDLIB
10992#ifdef I_STDLIB
10993#include <stdlib.h>
10994#endif
ae0e3d3b
JH
10995#$i_dirent I_DIRENT /**/
10996#$i_sysdir I_SYS_DIR /**/
10997#$i_sysndir I_SYS_NDIR /**/
10998#$i_systypes I_SYS_TYPES /**/
10999#if defined(I_SYS_TYPES)
11000#include <sys/types.h>
11001#endif
11002#if defined(I_DIRENT)
11003#include <dirent.h>
11004#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11005#include <sys/dir.h>
11006#endif
11007#else
11008#ifdef I_SYS_NDIR
11009#include <sys/ndir.h>
11010#else
11011#ifdef I_SYS_DIR
11012#ifdef hp9000s500
11013#include <ndir.h> /* may be wrong in the future */
11014#else
11015#include <sys/dir.h>
11016#endif
11017#endif
11018#endif
11019#endif
11020int main() {
11021 DIR *dirp = opendir(".");
11022 if (dirfd(dirp) >= 0)
11023 exit(0);
11024 else
11025 exit(1);
11026}
11027EOM
11028set dirfd
11029if eval $compile; then
11030 val="$define"
11031fi
11032case "$val" in
11033$define) echo "dirfd() found." >&4 ;;
11034*) echo "dirfd() NOT found." >&4 ;;
11035esac
11036set d_dirfd
11037eval $setvar
11038$rm -f dirfd*
11039
b4eb6b3d
JH
11040: see if dlerror exists
11041xxx_runnm="$runnm"
11042runnm=false
11043set dlerror d_dlerror
11044eval $inlibc
11045runnm="$xxx_runnm"
11046
11047: see if dlfcn is available
11048set dlfcn.h i_dlfcn
11049eval $inhdr
11050
11051case "$usedl" in
11052$define|y|true)
11053 $cat << EOM
11054
11055On a few systems, the dynamically loaded modules that perl generates and uses
11056will need a different extension than shared libs. The default will probably
11057be appropriate.
11058
11059EOM
11060 case "$dlext" in
11061 '') dflt="$so" ;;
11062 *) dflt="$dlext" ;;
11063 esac
11064 rp='What is the extension of dynamically loaded modules'
11065 . ./myread
11066 dlext="$ans"
11067 ;;
11068*)
11069 dlext="none"
11070 ;;
11071esac
11072
11073: Check if dlsym need a leading underscore
11074echo " "
11075val="$undef"
11076
11077case "$dlsrc" in
11078dl_dlopen.xs)
11079 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11080 $cat >dyna.c <<'EOM'
11081fred () { }
11082EOM
11083
11084$cat >fred.c<<EOM
11085
11086#include <stdio.h>
55954f19
JH
11087#$i_stdlib I_STDLIB
11088#ifdef I_STDLIB
11089#include <stdlib.h>
11090#endif
b4eb6b3d
JH
11091#$i_dlfcn I_DLFCN
11092#ifdef I_DLFCN
5440bc8e 11093#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
11094#else
11095#include <sys/types.h>
11096#include <nlist.h>
11097#include <link.h>
11098#endif
11099
11100extern int fred() ;
11101
11102int main()
11103{
11104 void * handle ;
11105 void * symbol ;
11106#ifndef RTLD_LAZY
11107 int mode = 1 ;
11108#else
11109 int mode = RTLD_LAZY ;
11110#endif
11111 handle = dlopen("./dyna.$dlext", mode) ;
11112 if (handle == NULL) {
11113 printf ("1\n") ;
11114 fflush (stdout) ;
11115 exit(0);
11116 }
11117 symbol = dlsym(handle, "fred") ;
11118 if (symbol == NULL) {
11119 /* try putting a leading underscore */
11120 symbol = dlsym(handle, "_fred") ;
11121 if (symbol == NULL) {
11122 printf ("2\n") ;
11123 fflush (stdout) ;
11124 exit(0);
11125 }
11126 printf ("3\n") ;
11127 }
11128 else
11129 printf ("4\n") ;
11130 fflush (stdout) ;
11131 exit(0);
11132}
11133EOM
11134 : Call the object file tmp-dyna.o in case dlext=o.
11135 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11136 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 11137 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
11138 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11139 xxx=`$run ./fred`
b4eb6b3d
JH
11140 case $xxx in
11141 1) echo "Test program failed using dlopen." >&4
11142 echo "Perhaps you should not use dynamic loading." >&4;;
11143 2) echo "Test program failed using dlsym." >&4
11144 echo "Perhaps you should not use dynamic loading." >&4;;
11145 3) echo "dlsym needs a leading underscore" >&4
11146 val="$define" ;;
11147 4) echo "dlsym doesn't need a leading underscore." >&4;;
11148 esac
11149 else
11150 echo "I can't compile and run the test program." >&4
11151 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11152 fi
11153 ;;
11154esac
11155
3c728e00 11156$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
11157
11158set d_dlsymun
11159eval $setvar
11160
10bc17b6
JH
11161: see if drand48_r exists
11162set drand48_r d_drand48_r
11163eval $inlibc
11164case "$d_drand48_r" in
11165"$define")
11166 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
11167 case "$d_drand48_r_proto:$usethreads" in
11168 ":define") d_drand48_r_proto=define
a48ec845
JH
11169 set d_drand48_r_proto drand48_r $hdrs
11170 eval $hasproto ;;
11171 *) ;;
11172 esac
11173 case "$d_drand48_r_proto" in
11174 define)
10bc17b6
JH
11175 case "$drand48_r_proto" in
11176 ''|0) try='int drand48_r(struct drand48_data*, double*);'
11177 ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11178 esac
11179 case "$drand48_r_proto" in
90e831dc 11180 ''|0) d_drand48_r=undef
10bc17b6 11181 drand48_r_proto=0
a48ec845 11182 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11183 * ) case "$drand48_r_proto" in
11184 REENTRANT_PROTO*) ;;
11185 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11186 esac
11187 echo "Prototype: $try" ;;
11188 esac
11189 ;;
c18e646a
JH
11190 *) case "$usethreads" in
11191 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11192 esac
90e831dc
SB
11193 d_drand48_r=undef
11194 drand48_r_proto=0
c18e646a 11195 ;;
a48ec845
JH
11196 esac
11197 ;;
10bc17b6
JH
11198*) drand48_r_proto=0
11199 ;;
11200esac
11201
11202: see if prototype for drand48 is available
11203echo " "
11204set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11205eval $hasproto
11206
b4eb6b3d
JH
11207: see if dup2 exists
11208set dup2 d_dup2
11209eval $inlibc
11210
11211: see if eaccess exists
11212set eaccess d_eaccess
11213eval $inlibc
11214
11215: see if endgrent exists
11216set endgrent d_endgrent
11217eval $inlibc
11218
10bc17b6
JH
11219: see if this is an grp system
11220set grp.h i_grp
11221eval $inhdr
11222
11223case "$i_grp" in
11224$define)
11225 xxx=`./findhdr grp.h`
11226 $cppstdin $cppflags $cppminus < $xxx >$$.h
11227
11228 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11229 val="$define"
11230 else
11231 val="$undef"
11232 fi
11233 set d_grpasswd
11234 eval $setvar
11235
11236 $rm -f $$.h
11237 ;;
11238*)
11239 val="$undef";
11240 set d_grpasswd; eval $setvar
11241 ;;
11242esac
11243
11244: see if endgrent_r exists
11245set endgrent_r d_endgrent_r
11246eval $inlibc
11247case "$d_endgrent_r" in
11248"$define")
11249 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11250 case "$d_endgrent_r_proto:$usethreads" in
11251 ":define") d_endgrent_r_proto=define
a48ec845
JH
11252 set d_endgrent_r_proto endgrent_r $hdrs
11253 eval $hasproto ;;
11254 *) ;;
11255 esac
11256 case "$d_endgrent_r_proto" in
11257 define)
10bc17b6
JH
11258 case "$endgrent_r_proto" in
11259 ''|0) try='int endgrent_r(FILE**);'
11260 ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11261 esac
11262 case "$endgrent_r_proto" in
11263 ''|0) try='void endgrent_r(FILE**);'
11264 ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11265 esac
11266 case "$endgrent_r_proto" in
90e831dc 11267 ''|0) d_endgrent_r=undef
10bc17b6 11268 endgrent_r_proto=0
a48ec845 11269 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11270 * ) case "$endgrent_r_proto" in
11271 REENTRANT_PROTO*) ;;
11272 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11273 esac
11274 echo "Prototype: $try" ;;
11275 esac
11276 ;;
c18e646a
JH
11277 *) case "$usethreads" in
11278 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11279 esac
90e831dc
SB
11280 d_endgrent_r=undef
11281 endgrent_r_proto=0
c18e646a 11282 ;;
a48ec845
JH
11283 esac
11284 ;;
10bc17b6
JH
11285*) endgrent_r_proto=0
11286 ;;
11287esac
11288
b4eb6b3d
JH
11289: see if endhostent exists
11290set endhostent d_endhent
11291eval $inlibc
11292
10bc17b6
JH
11293: see if this is a netdb.h system
11294set netdb.h i_netdb
11295eval $inhdr
11296
11297: see if endhostent_r exists
11298set endhostent_r d_endhostent_r
11299eval $inlibc
11300case "$d_endhostent_r" in
11301"$define")
11302 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11303 case "$d_endhostent_r_proto:$usethreads" in
11304 ":define") d_endhostent_r_proto=define
a48ec845
JH
11305 set d_endhostent_r_proto endhostent_r $hdrs
11306 eval $hasproto ;;
11307 *) ;;
11308 esac
11309 case "$d_endhostent_r_proto" in
11310 define)
10bc17b6
JH
11311 case "$endhostent_r_proto" in
11312 ''|0) try='int endhostent_r(struct hostent_data*);'
31ee0cb7 11313 ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
11314 esac
11315 case "$endhostent_r_proto" in
11316 ''|0) try='void endhostent_r(struct hostent_data*);'
31ee0cb7 11317 ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
11318 esac
11319 case "$endhostent_r_proto" in
90e831dc 11320 ''|0) d_endhostent_r=undef
10bc17b6 11321 endhostent_r_proto=0
a48ec845 11322 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11323 * ) case "$endhostent_r_proto" in
11324 REENTRANT_PROTO*) ;;
11325 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11326 esac
11327 echo "Prototype: $try" ;;
11328 esac
11329 ;;
c18e646a
JH
11330 *) case "$usethreads" in
11331 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11332 esac
90e831dc
SB
11333 d_endhostent_r=undef
11334 endhostent_r_proto=0
c18e646a 11335 ;;
a48ec845
JH
11336 esac
11337 ;;
10bc17b6
JH
11338*) endhostent_r_proto=0
11339 ;;
11340esac
11341
b4eb6b3d
JH
11342: see if endnetent exists
11343set endnetent d_endnent
11344eval $inlibc
11345
10bc17b6
JH
11346: see if endnetent_r exists
11347set endnetent_r d_endnetent_r
11348eval $inlibc
11349case "$d_endnetent_r" in
11350"$define")
11351 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11352 case "$d_endnetent_r_proto:$usethreads" in
11353 ":define") d_endnetent_r_proto=define
a48ec845
JH
11354 set d_endnetent_r_proto endnetent_r $hdrs
11355 eval $hasproto ;;
11356 *) ;;
11357 esac
11358 case "$d_endnetent_r_proto" in
11359 define)
10bc17b6
JH
11360 case "$endnetent_r_proto" in
11361 ''|0) try='int endnetent_r(struct netent_data*);'
31ee0cb7 11362 ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
11363 esac
11364 case "$endnetent_r_proto" in
11365 ''|0) try='void endnetent_r(struct netent_data*);'
31ee0cb7 11366 ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
11367 esac
11368 case "$endnetent_r_proto" in
90e831dc 11369 ''|0) d_endnetent_r=undef
10bc17b6 11370 endnetent_r_proto=0
a48ec845 11371 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11372 * ) case "$endnetent_r_proto" in
11373 REENTRANT_PROTO*) ;;
11374 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11375 esac
11376 echo "Prototype: $try" ;;
11377 esac
11378 ;;
c18e646a
JH
11379 *) case "$usethreads" in
11380 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11381 esac
90e831dc
SB
11382 d_endnetent_r=undef
11383 endnetent_r_proto=0
c18e646a 11384 ;;
a48ec845
JH
11385 esac
11386 ;;
10bc17b6
JH
11387*) endnetent_r_proto=0
11388 ;;
11389esac
11390
b4eb6b3d
JH
11391: see if endprotoent exists
11392set endprotoent d_endpent
11393eval $inlibc
11394
10bc17b6
JH
11395: see if endprotoent_r exists
11396set endprotoent_r d_endprotoent_r
11397eval $inlibc
11398case "$d_endprotoent_r" in
11399"$define")
11400 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11401 case "$d_endprotoent_r_proto:$usethreads" in
11402 ":define") d_endprotoent_r_proto=define
a48ec845
JH
11403 set d_endprotoent_r_proto endprotoent_r $hdrs
11404 eval $hasproto ;;
11405 *) ;;
11406 esac
11407 case "$d_endprotoent_r_proto" in
11408 define)
10bc17b6
JH
11409 case "$endprotoent_r_proto" in
11410 ''|0) try='int endprotoent_r(struct protoent_data*);'
31ee0cb7 11411 ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
11412 esac
11413 case "$endprotoent_r_proto" in
11414 ''|0) try='void endprotoent_r(struct protoent_data*);'
31ee0cb7 11415 ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
11416 esac
11417 case "$endprotoent_r_proto" in
90e831dc 11418 ''|0) d_endprotoent_r=undef
10bc17b6 11419 endprotoent_r_proto=0
a48ec845 11420 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11421 * ) case "$endprotoent_r_proto" in
11422 REENTRANT_PROTO*) ;;
11423 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11424 esac
11425 echo "Prototype: $try" ;;
11426 esac
11427 ;;
c18e646a
JH
11428 *) case "$usethreads" in
11429 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11430 esac
90e831dc
SB
11431 d_endprotoent_r=undef
11432 endprotoent_r_proto=0
c18e646a 11433 ;;
a48ec845
JH
11434 esac
11435 ;;
10bc17b6
JH
11436*) endprotoent_r_proto=0
11437 ;;
11438esac
11439
b4eb6b3d
JH
11440: see if endpwent exists
11441set endpwent d_endpwent
11442eval $inlibc
11443
10bc17b6
JH
11444: see if this is a pwd.h system
11445set pwd.h i_pwd
11446eval $inhdr
11447
11448case "$i_pwd" in
11449$define)
11450 xxx=`./findhdr pwd.h`
11451 $cppstdin $cppflags $cppminus < $xxx >$$.h
11452
11453 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11454 val="$define"
11455 else
11456 val="$undef"
11457 fi
11458 set d_pwquota
11459 eval $setvar
11460
11461 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11462 val="$define"
11463 else
11464 val="$undef"
11465 fi
11466 set d_pwage
11467 eval $setvar
11468
11469 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11470 val="$define"
11471 else
11472 val="$undef"
11473 fi
11474 set d_pwchange
11475 eval $setvar
11476
11477 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11478 val="$define"
11479 else
11480 val="$undef"
11481 fi
11482 set d_pwclass
11483 eval $setvar
11484
11485 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11486 val="$define"
11487 else
11488 val="$undef"
11489 fi
11490 set d_pwexpire
11491 eval $setvar
11492
11493 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11494 val="$define"
11495 else
11496 val="$undef"
11497 fi
11498 set d_pwcomment
11499 eval $setvar
11500
11501 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11502 val="$define"
11503 else
11504 val="$undef"
11505 fi
11506 set d_pwgecos
11507 eval $setvar
11508
11509 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11510 val="$define"
11511 else
11512 val="$undef"
11513 fi
11514 set d_pwpasswd
11515 eval $setvar
11516
11517 $rm -f $$.h
11518 ;;
11519*)
11520 val="$undef";
11521 set d_pwquota; eval $setvar
11522 set d_pwage; eval $setvar
11523 set d_pwchange; eval $setvar
11524 set d_pwclass; eval $setvar
11525 set d_pwexpire; eval $setvar
11526 set d_pwcomment; eval $setvar
11527 set d_pwgecos; eval $setvar
11528 set d_pwpasswd; eval $setvar
11529 ;;
11530esac
11531
11532: see if endpwent_r exists
11533set endpwent_r d_endpwent_r
11534eval $inlibc
11535case "$d_endpwent_r" in
11536"$define")
11537 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
11538 case "$d_endpwent_r_proto:$usethreads" in
11539 ":define") d_endpwent_r_proto=define
a48ec845
JH
11540 set d_endpwent_r_proto endpwent_r $hdrs
11541 eval $hasproto ;;
11542 *) ;;
11543 esac
11544 case "$d_endpwent_r_proto" in
11545 define)
10bc17b6
JH
11546 case "$endpwent_r_proto" in
11547 ''|0) try='int endpwent_r(FILE**);'
11548 ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11549 esac
11550 case "$endpwent_r_proto" in
11551 ''|0) try='void endpwent_r(FILE**);'
11552 ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11553 esac
11554 case "$endpwent_r_proto" in
90e831dc 11555 ''|0) d_endpwent_r=undef
10bc17b6 11556 endpwent_r_proto=0
a48ec845 11557 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11558 * ) case "$endpwent_r_proto" in
11559 REENTRANT_PROTO*) ;;
11560 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11561 esac
11562 echo "Prototype: $try" ;;
11563 esac
11564 ;;
c18e646a
JH
11565 *) case "$usethreads" in
11566 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11567 esac
90e831dc
SB
11568 d_endpwent_r=undef
11569 endpwent_r_proto=0
c18e646a 11570 ;;
a48ec845
JH
11571 esac
11572 ;;
10bc17b6
JH
11573*) endpwent_r_proto=0
11574 ;;
11575esac
11576
b4eb6b3d
JH
11577: see if endservent exists
11578set endservent d_endsent
11579eval $inlibc
11580
10bc17b6
JH
11581: see if endservent_r exists
11582set endservent_r d_endservent_r
11583eval $inlibc
11584case "$d_endservent_r" in
11585"$define")
11586 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11587 case "$d_endservent_r_proto:$usethreads" in
11588 ":define") d_endservent_r_proto=define
a48ec845
JH
11589 set d_endservent_r_proto endservent_r $hdrs
11590 eval $hasproto ;;
11591 *) ;;
11592 esac
11593 case "$d_endservent_r_proto" in
11594 define)
10bc17b6
JH
11595 case "$endservent_r_proto" in
11596 ''|0) try='int endservent_r(struct servent_data*);'
31ee0cb7 11597 ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
11598 esac
11599 case "$endservent_r_proto" in
11600 ''|0) try='void endservent_r(struct servent_data*);'
31ee0cb7 11601 ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
11602 esac
11603 case "$endservent_r_proto" in
90e831dc 11604 ''|0) d_endservent_r=undef
10bc17b6 11605 endservent_r_proto=0
a48ec845 11606 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11607 * ) case "$endservent_r_proto" in
11608 REENTRANT_PROTO*) ;;
11609 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11610 esac
11611 echo "Prototype: $try" ;;
11612 esac
11613 ;;
c18e646a
JH
11614 *) case "$usethreads" in
11615 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11616 esac
90e831dc
SB
11617 d_endservent_r=undef
11618 endservent_r_proto=0
c18e646a 11619 ;;
a48ec845
JH
11620 esac
11621 ;;
10bc17b6
JH
11622*) endservent_r_proto=0
11623 ;;
11624esac
11625
b4eb6b3d
JH
11626: Locate the flags for 'open()'
11627echo " "
55954f19 11628$cat >try.c <<EOCP
b4eb6b3d
JH
11629#include <sys/types.h>
11630#ifdef I_FCNTL
11631#include <fcntl.h>
11632#endif
11633#ifdef I_SYS_FILE
11634#include <sys/file.h>
11635#endif
55954f19
JH
11636#$i_stdlib I_STDLIB
11637#ifdef I_STDLIB
11638#include <stdlib.h>
11639#endif
b4eb6b3d
JH
11640int main() {
11641 if(O_RDONLY);
11642#ifdef O_TRUNC
11643 exit(0);
11644#else
11645 exit(1);
11646#endif
11647}
11648EOCP
11649: check sys/file.h first to get FREAD on Sun
11650if $test `./findhdr sys/file.h` && \
5440bc8e 11651 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
11652 h_sysfile=true;
11653 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 11654 if $run ./try; then
b4eb6b3d
JH
11655 echo "and you have the 3 argument form of open()." >&4
11656 val="$define"
11657 else
11658 echo "but not the 3 argument form of open(). Oh, well." >&4
11659 val="$undef"
11660 fi
11661elif $test `./findhdr fcntl.h` && \
5440bc8e 11662 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
11663 h_fcntl=true;
11664 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 11665 if $run ./try; then
b4eb6b3d
JH
11666 echo "and you have the 3 argument form of open()." >&4
11667 val="$define"
11668 else
11669 echo "but not the 3 argument form of open(). Oh, well." >&4
11670 val="$undef"
11671 fi
11672else
11673 val="$undef"
11674 echo "I can't find the O_* constant definitions! You got problems." >&4
11675fi
11676set d_open3
11677eval $setvar
5440bc8e 11678$rm -f try try.*
b4eb6b3d
JH
11679
11680: see which of string.h or strings.h is needed
11681echo " "
11682strings=`./findhdr string.h`
11683if $test "$strings" && $test -r "$strings"; then
11684 echo "Using <string.h> instead of <strings.h>." >&4
11685 val="$define"
11686else
11687 val="$undef"
11688 strings=`./findhdr strings.h`
11689 if $test "$strings" && $test -r "$strings"; then
11690 echo "Using <strings.h> instead of <string.h>." >&4
11691 else
11692 echo "No string header found -- You'll surely have problems." >&4
11693 fi
11694fi
11695set i_string
11696eval $setvar
11697case "$i_string" in
11698"$undef") strings=`./findhdr strings.h`;;
11699*) strings=`./findhdr string.h`;;
11700esac
11701
3c728e00
JH
11702: see if this is a sys/file.h system
11703val=''
11704set sys/file.h val
11705eval $inhdr
11706
11707: do we need to include sys/file.h ?
11708case "$val" in
11709"$define")
11710 echo " "
11711 if $h_sysfile; then
11712 val="$define"
11713 echo "We'll be including <sys/file.h>." >&4
11714 else
11715 val="$undef"
11716 echo "We won't be including <sys/file.h>." >&4
11717 fi
11718 ;;
11719*)
11720 h_sysfile=false
11721 ;;
11722esac
11723set i_sysfile
11724eval $setvar
11725
11726: see if fcntl.h is there
11727val=''
11728set fcntl.h val
11729eval $inhdr
11730
11731: see if we can include fcntl.h
11732case "$val" in
11733"$define")
11734 echo " "
11735 if $h_fcntl; then
11736 val="$define"
11737 echo "We'll be including <fcntl.h>." >&4
11738 else
11739 val="$undef"
11740 if $h_sysfile; then
11741 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11742 else
11743 echo "We won't be including <fcntl.h>." >&4
11744 fi
11745 fi
11746 ;;
11747*)
11748 h_fcntl=false
11749 val="$undef"
11750 ;;
11751esac
11752set i_fcntl
11753eval $setvar
11754
b4eb6b3d
JH
11755: check for non-blocking I/O stuff
11756case "$h_sysfile" in
a0acbdc3
JH
11757true) echo "#include <sys/file.h>" > head.c;;
11758*)
11759 case "$h_fcntl" in
11760 true) echo "#include <fcntl.h>" > head.c;;
11761 *) echo "#include <sys/fcntl.h>" > head.c;;
11762 esac
11763 ;;
b4eb6b3d
JH
11764esac
11765echo " "
11766echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11767case "$o_nonblock" in
11768'')
11769 $cat head.c > try.c
3c728e00 11770 $cat >>try.c <<EOCP
b4eb6b3d 11771#include <stdio.h>
55954f19
JH
11772#$i_stdlib I_STDLIB
11773#ifdef I_STDLIB
80b3ef99 11774#include <stdlib.h>
55954f19 11775#endif
3c728e00
JH
11776#$i_fcntl I_FCNTL
11777#ifdef I_FCNTL
11778#include <fcntl.h>
11779#endif
b4eb6b3d
JH
11780int main() {
11781#ifdef O_NONBLOCK
11782 printf("O_NONBLOCK\n");
11783 exit(0);
11784#endif
11785#ifdef O_NDELAY
11786 printf("O_NDELAY\n");
11787 exit(0);
11788#endif
11789#ifdef FNDELAY
11790 printf("FNDELAY\n");
11791 exit(0);
11792#endif
11793 exit(0);
11794}
11795EOCP
11796 set try
11797 if eval $compile_ok; then
5440bc8e 11798 o_nonblock=`$run ./try`
b4eb6b3d
JH
11799 case "$o_nonblock" in
11800 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11801 *) echo "Seems like we can use $o_nonblock.";;
11802 esac
11803 else
11804 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11805 fi
11806 ;;
11807*) echo "Using $hint value $o_nonblock.";;
11808esac
11809$rm -f try try.* .out core
11810
11811echo " "
11812echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11813case "$eagain" in
11814'')
11815 $cat head.c > try.c
11816 $cat >>try.c <<EOCP
11817#include <errno.h>
11818#include <sys/types.h>
11819#include <signal.h>
11820#include <stdio.h>
55954f19
JH
11821#$i_stdlib I_STDLIB
11822#ifdef I_STDLIB
11823#include <stdlib.h>
11824#endif
1deb0a86
JH
11825#$i_fcntl I_FCNTL
11826#ifdef I_FCNTL
11827#include <fcntl.h>
11828#endif
b4eb6b3d
JH
11829#define MY_O_NONBLOCK $o_nonblock
11830#ifndef errno /* XXX need better Configure test */
11831extern int errno;
11832#endif
11833#$i_unistd I_UNISTD
11834#ifdef I_UNISTD
11835#include <unistd.h>
11836#endif
11837#$i_string I_STRING
11838#ifdef I_STRING
11839#include <string.h>
11840#else
11841#include <strings.h>
11842#endif
11843$signal_t blech(x) int x; { exit(3); }
11844EOCP
11845 $cat >> try.c <<'EOCP'
11846int main()
11847{
11848 int pd[2];
11849 int pu[2];
11850 char buf[1];
11851 char string[100];
11852
11853 pipe(pd); /* Down: child -> parent */
11854 pipe(pu); /* Up: parent -> child */
11855 if (0 != fork()) {
11856 int ret;
11857 close(pd[1]); /* Parent reads from pd[0] */
11858 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 11859#ifdef F_SETFL
b4eb6b3d
JH
11860 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11861 exit(1);
a0acbdc3
JH
11862#else
11863 exit(4);
11864#endif
b4eb6b3d
JH
11865 signal(SIGALRM, blech);
11866 alarm(5);
11867 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
11868 exit(2);
11869 sprintf(string, "%d\n", ret);
11870 write(2, string, strlen(string));
11871 alarm(0);
11872#ifdef EAGAIN
11873 if (errno == EAGAIN) {
11874 printf("EAGAIN\n");
11875 goto ok;
11876 }
11877#endif
11878#ifdef EWOULDBLOCK
11879 if (errno == EWOULDBLOCK)
11880 printf("EWOULDBLOCK\n");
11881#endif
11882 ok:
11883 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
11884 sleep(2); /* Give it time to close our pipe */
11885 alarm(5);
11886 ret = read(pd[0], buf, 1); /* Should read EOF */
11887 alarm(0);
11888 sprintf(string, "%d\n", ret);
868439a2 11889 write(4, string, strlen(string));
b4eb6b3d
JH
11890 exit(0);
11891 }
11892
11893 close(pd[0]); /* We write to pd[1] */
11894 close(pu[1]); /* We read from pu[0] */
11895 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
11896 close(pd[1]); /* Pipe pd is now fully closed! */
11897 exit(0); /* Bye bye, thank you for playing! */
11898}
11899EOCP
11900 set try
11901 if eval $compile_ok; then
11902 echo "$startsh" >mtry
868439a2 11903 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
11904 chmod +x mtry
11905 ./mtry >/dev/null 2>&1
11906 case $? in
11907 0) eagain=`$cat try.out`;;
11908 1) echo "Could not perform non-blocking setting!";;
11909 2) echo "I did a successful read() for something that was not there!";;
11910 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 11911 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
11912 *) echo "Something terribly wrong happened during testing.";;
11913 esac
11914 rd_nodata=`$cat try.ret`
11915 echo "A read() system call with no data present returns $rd_nodata."
11916 case "$rd_nodata" in
11917 0|-1) ;;
11918 *)
11919 echo "(That's peculiar, fixing that to be -1.)"
11920 rd_nodata=-1
11921 ;;
11922 esac
11923 case "$eagain" in
11924 '')
11925 echo "Forcing errno EAGAIN on read() with no data available."
11926 eagain=EAGAIN
11927 ;;
11928 *)
11929 echo "Your read() sets errno to $eagain when no data is available."
11930 ;;
11931 esac
11932 status=`$cat try.err`
11933 case "$status" in
11934 0) echo "And it correctly returns 0 to signal EOF.";;
11935 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11936 *) echo "However, your read() returns '$status' on EOF??";;
11937 esac
11938 val="$define"
11939 if test "$status" = "$rd_nodata"; then
11940 echo "WARNING: you can't distinguish between EOF and no data!"
11941 val="$undef"
11942 fi
11943 else
11944 echo "I can't compile the test program--assuming errno EAGAIN will do."
11945 eagain=EAGAIN
11946 fi
11947 set d_eofnblk
11948 eval $setvar
11949 ;;
11950*)
11951 echo "Using $hint value $eagain."
11952 echo "Your read() returns $rd_nodata when no data is present."
11953 case "$d_eofnblk" in
11954 "$define") echo "And you can see EOF because read() returns 0.";;
11955 "$undef") echo "But you can't see EOF status from read() returned value.";;
11956 *)
11957 echo "(Assuming you can't see EOF status from read anyway.)"
11958 d_eofnblk=$undef
11959 ;;
11960 esac
11961 ;;
11962esac
11963$rm -f try try.* .out core head.c mtry
11964
15b61c98
JH
11965: see if _ptr and _cnt from stdio act std
11966echo " "
b4eb6b3d 11967
15b61c98
JH
11968if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11969 echo "(Looks like you have stdio.h from BSD.)"
11970 case "$stdio_ptr" in
11971 '') stdio_ptr='((fp)->_p)'
11972 ptr_lval=$define
11973 ;;
11974 *) ptr_lval=$d_stdio_ptr_lval;;
11975 esac
11976 case "$stdio_cnt" in
11977 '') stdio_cnt='((fp)->_r)'
11978 cnt_lval=$define
11979 ;;
11980 *) cnt_lval=$d_stdio_cnt_lval;;
11981 esac
11982 case "$stdio_base" in
11983 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11984 esac
11985 case "$stdio_bufsiz" in
11986 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11987 esac
11988elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11989 echo "(Looks like you have stdio.h from Linux.)"
11990 case "$stdio_ptr" in
11991 '') stdio_ptr='((fp)->_IO_read_ptr)'
11992 ptr_lval=$define
11993 ;;
11994 *) ptr_lval=$d_stdio_ptr_lval;;
11995 esac
11996 case "$stdio_cnt" in
11997 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11998 cnt_lval=$undef
11999 ;;
12000 *) cnt_lval=$d_stdio_cnt_lval;;
12001 esac
12002 case "$stdio_base" in
12003 '') stdio_base='((fp)->_IO_read_base)';;
12004 esac
12005 case "$stdio_bufsiz" in
12006 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12007 esac
12008else
12009 case "$stdio_ptr" in
12010 '') stdio_ptr='((fp)->_ptr)'
12011 ptr_lval=$define
12012 ;;
12013 *) ptr_lval=$d_stdio_ptr_lval;;
12014 esac
12015 case "$stdio_cnt" in
12016 '') stdio_cnt='((fp)->_cnt)'
12017 cnt_lval=$define
12018 ;;
12019 *) cnt_lval=$d_stdio_cnt_lval;;
12020 esac
12021 case "$stdio_base" in
12022 '') stdio_base='((fp)->_base)';;
12023 esac
12024 case "$stdio_bufsiz" in
12025 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12026 esac
12027fi
b4eb6b3d 12028
15b61c98
JH
12029: test whether _ptr and _cnt really work
12030echo "Checking how std your stdio is..." >&4
12031$cat >try.c <<EOP
12032#include <stdio.h>
55954f19
JH
12033#$i_stdlib I_STDLIB
12034#ifdef I_STDLIB
9d9004a9 12035#include <stdlib.h>
55954f19 12036#endif
15b61c98
JH
12037#define FILE_ptr(fp) $stdio_ptr
12038#define FILE_cnt(fp) $stdio_cnt
9d9004a9 12039int main() {
15b61c98
JH
12040 FILE *fp = fopen("try.c", "r");
12041 char c = getc(fp);
12042 if (
12043 18 <= FILE_cnt(fp) &&
12044 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12045 )
12046 exit(0);
12047 exit(1);
9d9004a9 12048}
15b61c98
JH
12049EOP
12050val="$undef"
12051set try
12052if eval $compile && $to try.c; then
12053 if $run ./try; then
12054 echo "Your stdio acts pretty std."
12055 val="$define"
9d9004a9 12056 else
15b61c98 12057 echo "Your stdio isn't very std."
9d9004a9 12058 fi
15b61c98
JH
12059else
12060 echo "Your stdio doesn't appear very std."
12061fi
12062$rm -f try.c try
12063
12064# glibc 2.2.90 and above apparently change stdio streams so Perl's
12065# direct buffer manipulation no longer works. The Configure tests
12066# should be changed to correctly detect this, but until then,
12067# the following check should at least let perl compile and run.
12068# (This quick fix should be updated before 5.8.1.)
12069# To be defensive, reject all unknown versions, and all versions > 2.2.9.
12070# A. Dougherty, June 3, 2002.
12071case "$d_gnulibc" in
12072$define)
12073 case "$gnulibc_version" in
12074 2.[01]*) ;;
12075 2.2) ;;
12076 2.2.[0-9]) ;;
12077 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12078 val="$undef"
12079 ;;
12080 esac
9d9004a9
AD
12081 ;;
12082esac
15b61c98 12083set d_stdstdio
9d9004a9 12084eval $setvar
9d9004a9 12085
15b61c98
JH
12086: Can _ptr be used as an lvalue?
12087case "$d_stdstdio$ptr_lval" in
12088$define$define) val=$define ;;
12089*) val=$undef ;;
12090esac
12091set d_stdio_ptr_lval
12092eval $setvar
9d9004a9 12093
15b61c98
JH
12094: Can _cnt be used as an lvalue?
12095case "$d_stdstdio$cnt_lval" in
12096$define$define) val=$define ;;
12097*) val=$undef ;;
12098esac
12099set d_stdio_cnt_lval
12100eval $setvar
b4eb6b3d 12101
15b61c98
JH
12102
12103: test whether setting _ptr sets _cnt as a side effect
12104d_stdio_ptr_lval_sets_cnt="$undef"
12105d_stdio_ptr_lval_nochange_cnt="$undef"
12106case "$d_stdio_ptr_lval$d_stdstdio" in
12107$define$define)
12108 echo "Checking to see what happens if we set the stdio ptr..." >&4
12109$cat >try.c <<EOP
12110#include <stdio.h>
12111/* Can we scream? */
12112/* Eat dust sed :-) */
12113/* In the buffer space, no one can hear you scream. */
55954f19
JH
12114#$i_stdlib I_STDLIB
12115#ifdef I_STDLIB
12116#include <stdlib.h>
12117#endif
15b61c98
JH
12118#define FILE_ptr(fp) $stdio_ptr
12119#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 12120#include <sys/types.h>
b4eb6b3d 12121int main() {
15b61c98
JH
12122 FILE *fp = fopen("try.c", "r");
12123 int c;
12124 char *ptr;
12125 size_t cnt;
12126 if (!fp) {
12127 puts("Fail even to read");
12128 exit(1);
12129 }
12130 c = getc(fp); /* Read away the first # */
12131 if (c == EOF) {
12132 puts("Fail even to read");
12133 exit(1);
12134 }
12135 if (!(
12136 18 <= FILE_cnt(fp) &&
12137 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12138 )) {
12139 puts("Fail even to read");
12140 exit (1);
12141 }
12142 ptr = (char*) FILE_ptr(fp);
12143 cnt = (size_t)FILE_cnt(fp);
12144
12145 FILE_ptr(fp) += 42;
12146
12147 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12148 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12149 exit (1);
12150 }
12151 if (FILE_cnt(fp) <= 20) {
12152 printf ("Fail (<20 chars to test)");
12153 exit (1);
12154 }
12155 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12156 puts("Fail compare");
12157 exit (1);
12158 }
12159 if (cnt == FILE_cnt(fp)) {
12160 puts("Pass_unchanged");
12161 exit (0);
12162 }
12163 if (FILE_cnt(fp) == (cnt - 42)) {
12164 puts("Pass_changed");
12165 exit (0);
12166 }
12167 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12168 return 1;
12169
12170}
12171EOP
12172 set try
12173 if eval $compile && $to try.c; then
12174 case `$run ./try` in
12175 Pass_changed)
12176 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
12177 d_stdio_ptr_lval_sets_cnt="$define" ;;
12178 Pass_unchanged)
12179 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12180 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12181 Fail*)
12182 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12183 *)
12184 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12185 esac
12186 else
12187 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12188 fi
12189 $rm -f try.c try
12190 ;;
12191esac
12192
12193: see if _base is also standard
12194val="$undef"
12195case "$d_stdstdio" in
12196$define)
12197 $cat >try.c <<EOP
12198#include <stdio.h>
12199#$i_stdlib I_STDLIB
12200#ifdef I_STDLIB
12201#include <stdlib.h>
12202#endif
12203#define FILE_base(fp) $stdio_base
12204#define FILE_bufsiz(fp) $stdio_bufsiz
12205int main() {
12206 FILE *fp = fopen("try.c", "r");
12207 char c = getc(fp);
12208 if (
12209 19 <= FILE_bufsiz(fp) &&
12210 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12211 )
12212 exit(0);
12213 exit(1);
12214}
12215EOP
12216 set try
12217 if eval $compile && $to try.c; then
12218 if $run ./try; then
12219 echo "And its _base field acts std."
12220 val="$define"
12221 else
12222 echo "But its _base field isn't std."
12223 fi
12224 else
12225 echo "However, it seems to be lacking the _base field."
12226 fi
12227 $rm -f try.c try
12228 ;;
12229esac
12230set d_stdiobase
12231eval $setvar
12232
12233: see if fast_stdio exists
12234val="$undef"
12235case "$d_stdstdio:$d_stdio_ptr_lval" in
12236"$define:$define")
12237 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12238 *$define*)
12239 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12240 val="$define"
12241 ;;
12242 esac
12243 ;;
12244esac
12245set d_faststdio
12246eval $setvar
12247
12248
12249
12250: see if fchdir exists
12251set fchdir d_fchdir
12252eval $inlibc
12253
12254: see if fchmod exists
12255set fchmod d_fchmod
12256eval $inlibc
12257
12258: see if fchown exists
12259set fchown d_fchown
12260eval $inlibc
12261
12262: see if this is an fcntl system
12263set fcntl d_fcntl
12264eval $inlibc
12265
12266echo " "
12267: See if fcntl-based locking works.
12268$cat >try.c <<EOCP
12269#$i_stdlib I_STDLIB
12270#ifdef I_STDLIB
12271#include <stdlib.h>
12272#endif
12273#include <unistd.h>
12274#include <fcntl.h>
12275#include <signal.h>
12276$signal_t blech(x) int x; { exit(3); }
12277int main() {
12278#if defined(F_SETLK) && defined(F_SETLKW)
12279 struct flock flock;
12280 int retval, fd;
12281 fd = open("try.c", O_RDONLY);
12282 flock.l_type = F_RDLCK;
12283 flock.l_whence = SEEK_SET;
12284 flock.l_start = flock.l_len = 0;
12285 signal(SIGALRM, blech);
12286 alarm(10);
12287 retval = fcntl(fd, F_SETLK, &flock);
12288 close(fd);
12289 (retval < 0 ? exit(2) : exit(0));
12290#else
12291 exit(2);
12292#endif
12293}
12294EOCP
12295echo "Checking if fcntl-based file locking works... "
12296case "$d_fcntl" in
12297"$define")
12298 set try
12299 if eval $compile_ok; then
12300 if $run ./try; then
12301 echo "Yes, it seems to work."
12302 val="$define"
12303 else
12304 echo "Nope, it didn't work."
12305 val="$undef"
12306 case "$?" in
12307 3) $cat >&4 <<EOM
12308***
12309*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12310*** This is (almost) impossible.
12311*** If your NFS lock daemons are not feeling well, something like
12312*** this may happen, please investigate. Cannot continue, aborting.
12313***
12314EOM
12315 exit 1
12316 ;;
12317 esac
12318 fi
12319 else
12320 echo "I'm unable to compile the test program, so I'll assume not."
12321 val="$undef"
12322 fi
12323 ;;
12324*) val="$undef";
12325 echo "Nope, since you don't even have fcntl()."
12326 ;;
12327esac
12328set d_fcntl_can_lock
12329eval $setvar
12330$rm -f try*
12331
12332
12333: check for fd_set items
12334$cat <<EOM
12335
12336Checking to see how well your C compiler handles fd_set and friends ...
12337EOM
12338$cat >try.c <<EOCP
12339#$i_stdlib I_STDLIB
12340#ifdef I_STDLIB
12341#include <stdlib.h>
12342#endif
12343#$i_systime I_SYS_TIME
12344#$i_sysselct I_SYS_SELECT
12345#$d_socket HAS_SOCKET
12346#include <sys/types.h>
12347#ifdef HAS_SOCKET
12348#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12349#endif
12350#ifdef I_SYS_TIME
12351#include <sys/time.h>
12352#endif
12353#ifdef I_SYS_SELECT
12354#include <sys/select.h>
12355#endif
12356int main() {
12357 fd_set fds;
12358
12359#ifdef TRYBITS
12360 if(fds.fds_bits);
12361#endif
12362
12363#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12364 exit(0);
12365#else
12366 exit(1);
12367#endif
12368}
12369EOCP
12370set try -DTRYBITS
12371if eval $compile; then
12372 d_fds_bits="$define"
12373 d_fd_set="$define"
12374 echo "Well, your system knows about the normal fd_set typedef..." >&4
12375 if $run ./try; then
b4eb6b3d
JH
12376 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12377 d_fd_macros="$define"
12378 else
12379 $cat >&4 <<'EOM'
12380but not the normal fd_set macros! Gaaack! I'll have to cover for you.
12381EOM
12382 d_fd_macros="$undef"
12383 fi
12384else
12385 $cat <<'EOM'
12386Hmm, your compiler has some difficulty with fd_set. Checking further...
12387EOM
5440bc8e 12388 set try
b4eb6b3d
JH
12389 if eval $compile; then
12390 d_fds_bits="$undef"
12391 d_fd_set="$define"
12392 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 12393 if $run ./try; then
b4eb6b3d
JH
12394 echo "and you have the normal fd_set macros." >&4
12395 d_fd_macros="$define"
12396 else
12397 $cat <<'EOM'
12398but not the normal fd_set macros! Gross! More work for me...
12399EOM
12400 d_fd_macros="$undef"
12401 fi
12402 else
12403 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
12404 d_fd_set="$undef"
12405 d_fds_bits="$undef"
12406 d_fd_macros="$undef"
12407 fi
12408fi
5440bc8e 12409$rm -f try try.*
b4eb6b3d
JH
12410
12411: see if fgetpos exists
12412set fgetpos d_fgetpos
12413eval $inlibc
12414
758a5d79
JH
12415: see if finite exists
12416set finite d_finite
12417eval $inlibc
12418
12419: see if finitel exists
12420set finitel d_finitel
12421eval $inlibc
12422
b4eb6b3d
JH
12423: see if flock exists
12424set flock d_flock
12425eval $inlibc
12426
2ef53570
JH
12427: see if prototype for flock is available
12428echo " "
12429set d_flockproto flock $i_sysfile sys/file.h
12430eval $hasproto
12431
b4eb6b3d
JH
12432: see if fork exists
12433set fork d_fork
12434eval $inlibc
12435
758a5d79
JH
12436: see if fp_class exists
12437set fp_class d_fp_class
12438eval $inlibc
12439
b4eb6b3d
JH
12440: see if pathconf exists
12441set pathconf d_pathconf
12442eval $inlibc
12443
12444: see if fpathconf exists
12445set fpathconf d_fpathconf
12446eval $inlibc
12447
758a5d79
JH
12448: see if fpclass exists
12449set fpclass d_fpclass
12450eval $inlibc
12451
12452: see if fpclassify exists
12453set fpclassify d_fpclassify
12454eval $inlibc
12455
12456: see if fpclassl exists
12457set fpclassl d_fpclassl
12458eval $inlibc
12459
b4eb6b3d
JH
12460
12461: check for fpos64_t
12462echo " "
12463echo "Checking to see if you have fpos64_t..." >&4
12464$cat >try.c <<EOCP
12465#include <stdio.h>
12466int main() { fpos64_t x = 7; }
12467EOCP
12468set try
12469if eval $compile; then
12470 val="$define"
12471 echo "You have fpos64_t."
12472else
12473 val="$undef"
12474 echo "You do not have fpos64_t."
12475 case "$fpossize" in
12476 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12477 esac
12478fi
12479$rm -f try.* try
12480set d_fpos64_t
12481eval $setvar
12482
12483: see if frexpl exists
12484set frexpl d_frexpl
12485eval $inlibc
12486
b4eb6b3d
JH
12487: see if this is a sys/param system
12488set sys/param.h i_sysparam
12489eval $inhdr
12490
12491: see if this is a sys/mount.h system
12492set sys/mount.h i_sysmount
12493eval $inhdr
12494
b4eb6b3d
JH
12495
12496echo " "
12497echo "Checking to see if your system supports struct fs_data..." >&4
12498set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12499eval $hasstruct
12500case "$d_fs_data_s" in
12501"$define") echo "Yes, it does." ;;
12502*) echo "No, it doesn't." ;;
12503esac
12504
12505: see if fseeko exists
12506set fseeko d_fseeko
12507eval $inlibc
12508case "$longsize" in
125098) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12510esac
12511
12512: see if fsetpos exists
12513set fsetpos d_fsetpos
12514eval $inlibc
12515
12516
12517: see if fstatfs exists
12518set fstatfs d_fstatfs
12519eval $inlibc
12520
12521
12522: see if statvfs exists
12523set statvfs d_statvfs
12524eval $inlibc
12525
12526: see if fstatvfs exists
12527set fstatvfs d_fstatvfs
12528eval $inlibc
12529
12530
411ab01c
JH
12531: see if fsync exists
12532set fsync d_fsync
12533eval $inlibc
12534
b4eb6b3d
JH
12535: see if ftello exists
12536set ftello d_ftello
12537eval $inlibc
12538case "$longsize" in
125398) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12540esac
12541
12542: see if getcwd exists
12543set getcwd d_getcwd
12544eval $inlibc
12545
12546: see if getespwnam exists
12547set getespwnam d_getespwnam
12548eval $inlibc
12549
12550
12551: see if getfsstat exists
12552set getfsstat d_getfsstat
12553eval $inlibc
12554
12555: see if getgrent exists
12556set getgrent d_getgrent
12557eval $inlibc
12558
10bc17b6
JH
12559: see if getgrent_r exists
12560set getgrent_r d_getgrent_r
12561eval $inlibc
12562case "$d_getgrent_r" in
12563"$define")
12564 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12565 case "$d_getgrent_r_proto:$usethreads" in
12566 ":define") d_getgrent_r_proto=define
a48ec845
JH
12567 set d_getgrent_r_proto getgrent_r $hdrs
12568 eval $hasproto ;;
12569 *) ;;
12570 esac
12571 case "$d_getgrent_r_proto" in
12572 define)
10bc17b6
JH
12573 case "$getgrent_r_proto" in
12574 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12575 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12576 esac
12577 case "$getgrent_r_proto" in
12578 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12579 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12580 esac
12581 case "$getgrent_r_proto" in
12582 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12583 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12584 esac
12585 case "$getgrent_r_proto" in
12586 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12587 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12588 esac
12589 case "$getgrent_r_proto" in
12590 ''|0) try='int getgrent_r(struct group*, char*, int);'
12591 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12592 esac
12593 case "$getgrent_r_proto" in
12594 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12595 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12596 esac
12597 case "$getgrent_r_proto" in
90e831dc 12598 ''|0) d_getgrent_r=undef
10bc17b6 12599 getgrent_r_proto=0
a48ec845 12600 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12601 * ) case "$getgrent_r_proto" in
12602 REENTRANT_PROTO*) ;;
12603 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12604 esac
12605 echo "Prototype: $try" ;;
12606 esac
12607 ;;
c18e646a
JH
12608 *) case "$usethreads" in
12609 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12610 esac
90e831dc
SB
12611 d_getgrent_r=undef
12612 getgrent_r_proto=0
c18e646a 12613 ;;
a48ec845
JH
12614 esac
12615 ;;
10bc17b6
JH
12616*) getgrent_r_proto=0
12617 ;;
12618esac
12619
12620: see if getgrgid_r exists
12621set getgrgid_r d_getgrgid_r
12622eval $inlibc
12623case "$d_getgrgid_r" in
12624"$define")
12625 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12626 case "$d_getgrgid_r_proto:$usethreads" in
12627 ":define") d_getgrgid_r_proto=define
a48ec845
JH
12628 set d_getgrgid_r_proto getgrgid_r $hdrs
12629 eval $hasproto ;;
12630 *) ;;
12631 esac
12632 case "$d_getgrgid_r_proto" in
12633 define)
10bc17b6
JH
12634 case "$getgrgid_r_proto" in
12635 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12636 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12637 esac
12638 case "$getgrgid_r_proto" in
12639 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12640 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12641 esac
12642 case "$getgrgid_r_proto" in
12643 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12644 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12645 esac
12646 case "$getgrgid_r_proto" in
12647 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12648 ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12649 esac
12650 case "$getgrgid_r_proto" in
90e831dc 12651 ''|0) d_getgrgid_r=undef
10bc17b6 12652 getgrgid_r_proto=0
a48ec845 12653 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12654 * ) case "$getgrgid_r_proto" in
12655 REENTRANT_PROTO*) ;;
12656 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12657 esac
12658 echo "Prototype: $try" ;;
12659 esac
12660 ;;
c18e646a
JH
12661 *) case "$usethreads" in
12662 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12663 esac
90e831dc
SB
12664 d_getgrgid_r=undef
12665 getgrgid_r_proto=0
c18e646a 12666 ;;
a48ec845
JH
12667 esac
12668 ;;
10bc17b6
JH
12669*) getgrgid_r_proto=0
12670 ;;
12671esac
12672
12673: see if getgrnam_r exists
12674set getgrnam_r d_getgrnam_r
12675eval $inlibc
12676case "$d_getgrnam_r" in
12677"$define")
12678 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12679 case "$d_getgrnam_r_proto:$usethreads" in
12680 ":define") d_getgrnam_r_proto=define
a48ec845
JH
12681 set d_getgrnam_r_proto getgrnam_r $hdrs
12682 eval $hasproto ;;
12683 *) ;;
12684 esac
12685 case "$d_getgrnam_r_proto" in
12686 define)
10bc17b6
JH
12687 case "$getgrnam_r_proto" in
12688 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12689 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12690 esac
12691 case "$getgrnam_r_proto" in
12692 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12693 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12694 esac
12695 case "$getgrnam_r_proto" in
12696 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12697 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12698 esac
12699 case "$getgrnam_r_proto" in
12700 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12701 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12702 esac
12703 case "$getgrnam_r_proto" in
12704 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12705 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12706 esac
12707 case "$getgrnam_r_proto" in
90e831dc 12708 ''|0) d_getgrnam_r=undef
10bc17b6 12709 getgrnam_r_proto=0
a48ec845 12710 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12711 * ) case "$getgrnam_r_proto" in
12712 REENTRANT_PROTO*) ;;
12713 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12714 esac
12715 echo "Prototype: $try" ;;
12716 esac
12717 ;;
c18e646a
JH
12718 *) case "$usethreads" in
12719 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12720 esac
90e831dc
SB
12721 d_getgrnam_r=undef
12722 getgrnam_r_proto=0
c18e646a 12723 ;;
a48ec845
JH
12724 esac
12725 ;;
10bc17b6
JH
12726*) getgrnam_r_proto=0
12727 ;;
12728esac
12729
b4eb6b3d
JH
12730: see if gethostbyaddr exists
12731set gethostbyaddr d_gethbyaddr
12732eval $inlibc
12733
12734: see if gethostbyname exists
12735set gethostbyname d_gethbyname
12736eval $inlibc
12737
12738: see if gethostent exists
12739set gethostent d_gethent
12740eval $inlibc
12741
12742: see how we will look up host name
12743echo " "
12744call=''
12745if set gethostname val -f d_gethname; eval $csym; $val; then
12746 echo 'gethostname() found.' >&4
12747 d_gethname="$define"
12748 call=gethostname
12749fi
12750if set uname val -f d_uname; eval $csym; $val; then
12751 if ./xenix; then
12752 $cat <<'EOM'
12753uname() was found, but you're running xenix, and older versions of xenix
12754have a broken uname(). If you don't really know whether your xenix is old
12755enough to have a broken system call, use the default answer.
12756
12757EOM
12758 dflt=y
12759 case "$d_uname" in
12760 "$define") dflt=n;;
12761 esac
12762 rp='Is your uname() broken?'
12763 . ./myread
12764 case "$ans" in
12765 n*) d_uname="$define"; call=uname;;
12766 esac
12767 else
12768 echo 'uname() found.' >&4
12769 d_uname="$define"
12770 case "$call" in
12771 '') call=uname ;;
12772 esac
12773 fi
12774fi
12775case "$d_gethname" in
12776'') d_gethname="$undef";;
12777esac
12778case "$d_uname" in
12779'') d_uname="$undef";;
12780esac
12781case "$d_uname$d_gethname" in
12782*define*)
12783 dflt=n
12784 cat <<EOM
12785
12786Every now and then someone has a $call() that lies about the hostname
12787but can't be fixed for political or economic reasons. If you wish, I can
12788pretend $call() isn't there and maybe compute hostname at run-time
12789thanks to the '$phostname' command.
12790
12791EOM
12792 rp="Shall I ignore $call() from now on?"
12793 . ./myread
12794 case "$ans" in
12795 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12796 esac;;
12797esac
12798case "$phostname" in
12799'') aphostname='';;
12800*) case "$aphostname" in
12801 /*) ;;
12802 *) set X $phostname
12803 shift
12804 file=$1
12805 shift
12806 file=`./loc $file $file $pth`
12807 aphostname=`echo $file $*`
12808 ;;
12809 esac
12810 ;;
12811esac
12812case "$d_uname$d_gethname" in
12813*define*) ;;
12814*)
12815 case "$phostname" in
12816 '')
12817 echo "There will be no way for $package to get your hostname." >&4;;
12818 *)
12819 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12820 ;;
12821 esac;;
12822esac
12823case "$d_phostname" in
12824'') d_phostname="$undef";;
12825esac
12826
10bc17b6
JH
12827: see if gethostbyaddr_r exists
12828set gethostbyaddr_r d_gethostbyaddr_r
12829eval $inlibc
12830case "$d_gethostbyaddr_r" in
12831"$define")
12832 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12833 case "$d_gethostbyaddr_r_proto:$usethreads" in
12834 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
12835 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12836 eval $hasproto ;;
12837 *) ;;
12838 esac
12839 case "$d_gethostbyaddr_r_proto" in
12840 define)
10bc17b6
JH
12841 case "$gethostbyaddr_r_proto" in
12842 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12843 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12844 esac
12845 case "$gethostbyaddr_r_proto" in
12846 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12847 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12848 esac
12849 case "$gethostbyaddr_r_proto" in
12850 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12851 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12852 esac
12853 case "$gethostbyaddr_r_proto" in
12854 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12855 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12856 esac
12857 case "$gethostbyaddr_r_proto" in
12858 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12859 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12860 esac
12861 case "$gethostbyaddr_r_proto" in
12862 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12863 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12864 esac
12865 case "$gethostbyaddr_r_proto" in
12866 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12867 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12868 esac
12869 case "$gethostbyaddr_r_proto" in
12870 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12871 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12872 esac
12873 case "$gethostbyaddr_r_proto" in
12874 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12875 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12876 esac
12877 case "$gethostbyaddr_r_proto" in
12878 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12879 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12880 esac
12881 case "$gethostbyaddr_r_proto" in
a845a0d4
JH
12882 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12883 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12884 esac
12885 case "$gethostbyaddr_r_proto" in
90e831dc 12886 ''|0) d_gethostbyaddr_r=undef
10bc17b6 12887 gethostbyaddr_r_proto=0
a48ec845 12888 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12889 * ) case "$gethostbyaddr_r_proto" in
12890 REENTRANT_PROTO*) ;;
12891 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12892 esac
12893 echo "Prototype: $try" ;;
12894 esac
12895 ;;
c18e646a
JH
12896 *) case "$usethreads" in
12897 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12898 esac
90e831dc
SB
12899 d_gethostbyaddr_r=undef
12900 gethostbyaddr_r_proto=0
c18e646a 12901 ;;
a48ec845
JH
12902 esac
12903 ;;
10bc17b6
JH
12904*) gethostbyaddr_r_proto=0
12905 ;;
12906esac
12907
12908: see if gethostbyname_r exists
12909set gethostbyname_r d_gethostbyname_r
12910eval $inlibc
12911case "$d_gethostbyname_r" in
12912"$define")
12913 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12914 case "$d_gethostbyname_r_proto:$usethreads" in
12915 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
12916 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12917 eval $hasproto ;;
12918 *) ;;
12919 esac
12920 case "$d_gethostbyname_r_proto" in
12921 define)
10bc17b6
JH
12922 case "$gethostbyname_r_proto" in
12923 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12924 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12925 esac
12926 case "$gethostbyname_r_proto" in
12927 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12928 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12929 esac
12930 case "$gethostbyname_r_proto" in
12931 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12932 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12933 esac
12934 case "$gethostbyname_r_proto" in
90e831dc 12935 ''|0) d_gethostbyname_r=undef
10bc17b6 12936 gethostbyname_r_proto=0
a48ec845 12937 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12938 * ) case "$gethostbyname_r_proto" in
12939 REENTRANT_PROTO*) ;;
12940 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12941 esac
12942 echo "Prototype: $try" ;;
12943 esac
12944 ;;
c18e646a
JH
12945 *) case "$usethreads" in
12946 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12947 esac
90e831dc
SB
12948 d_gethostbyname_r=undef
12949 gethostbyname_r_proto=0
c18e646a 12950 ;;
a48ec845
JH
12951 esac
12952 ;;
10bc17b6
JH
12953*) gethostbyname_r_proto=0
12954 ;;
12955esac
12956
12957: see if gethostent_r exists
12958set gethostent_r d_gethostent_r
12959eval $inlibc
12960case "$d_gethostent_r" in
12961"$define")
12962 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12963 case "$d_gethostent_r_proto:$usethreads" in
12964 ":define") d_gethostent_r_proto=define
a48ec845
JH
12965 set d_gethostent_r_proto gethostent_r $hdrs
12966 eval $hasproto ;;
12967 *) ;;
12968 esac
12969 case "$d_gethostent_r_proto" in
12970 define)
10bc17b6
JH
12971 case "$gethostent_r_proto" in
12972 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12973 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12974 esac
12975 case "$gethostent_r_proto" in
12976 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12977 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12978 esac
12979 case "$gethostent_r_proto" in
12980 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12981 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12982 esac
12983 case "$gethostent_r_proto" in
12984 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12985 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12986 esac
12987 case "$gethostent_r_proto" in
12988 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12989 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12990 esac
12991 case "$gethostent_r_proto" in
12992 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12993 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12994 esac
12995 case "$gethostent_r_proto" in
90e831dc 12996 ''|0) d_gethostent_r=undef
10bc17b6 12997 gethostent_r_proto=0
a48ec845 12998 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12999 * ) case "$gethostent_r_proto" in
13000 REENTRANT_PROTO*) ;;
13001 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13002 esac
13003 echo "Prototype: $try" ;;
13004 esac
13005 ;;
c18e646a
JH
13006 *) case "$usethreads" in
13007 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13008 esac
90e831dc
SB
13009 d_gethostent_r=undef
13010 gethostent_r_proto=0
c18e646a 13011 ;;
a48ec845
JH
13012 esac
13013 ;;
10bc17b6
JH
13014*) gethostent_r_proto=0
13015 ;;
13016esac
b4eb6b3d
JH
13017
13018: see if prototypes for various gethostxxx netdb.h functions are available
13019echo " "
13020set d_gethostprotos gethostent $i_netdb netdb.h
13021eval $hasproto
13022
4e0554ec
JH
13023: see if getitimer exists
13024set getitimer d_getitimer
13025eval $inlibc
13026
b4eb6b3d
JH
13027: see if getlogin exists
13028set getlogin d_getlogin
13029eval $inlibc
13030
10bc17b6
JH
13031: see if getlogin_r exists
13032set getlogin_r d_getlogin_r
13033eval $inlibc
13034case "$d_getlogin_r" in
13035"$define")
13036 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
13037 case "$d_getlogin_r_proto:$usethreads" in
13038 ":define") d_getlogin_r_proto=define
a48ec845
JH
13039 set d_getlogin_r_proto getlogin_r $hdrs
13040 eval $hasproto ;;
13041 *) ;;
13042 esac
13043 case "$d_getlogin_r_proto" in
13044 define)
10bc17b6
JH
13045 case "$getlogin_r_proto" in
13046 ''|0) try='int getlogin_r(char*, size_t);'
13047 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13048 esac
13049 case "$getlogin_r_proto" in
13050 ''|0) try='int getlogin_r(char*, int);'
13051 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13052 esac
13053 case "$getlogin_r_proto" in
13054 ''|0) try='char* getlogin_r(char*, size_t);'
13055 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13056 esac
13057 case "$getlogin_r_proto" in
13058 ''|0) try='char* getlogin_r(char*, int);'
13059 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13060 esac
13061 case "$getlogin_r_proto" in
90e831dc 13062 ''|0) d_getlogin_r=undef
10bc17b6 13063 getlogin_r_proto=0
a48ec845 13064 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13065 * ) case "$getlogin_r_proto" in
13066 REENTRANT_PROTO*) ;;
13067 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13068 esac
13069 echo "Prototype: $try" ;;
13070 esac
13071 ;;
c18e646a
JH
13072 *) case "$usethreads" in
13073 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13074 esac
90e831dc
SB
13075 d_getlogin_r=undef
13076 getlogin_r_proto=0
c18e646a 13077 ;;
a48ec845
JH
13078 esac
13079 ;;
10bc17b6
JH
13080*) getlogin_r_proto=0
13081 ;;
13082esac
13083
b4eb6b3d
JH
13084: see if getmnt exists
13085set getmnt d_getmnt
13086eval $inlibc
13087
13088: see if getmntent exists
13089set getmntent d_getmntent
13090eval $inlibc
13091
13092: see if getnetbyaddr exists
13093set getnetbyaddr d_getnbyaddr
13094eval $inlibc
13095
13096: see if getnetbyname exists
13097set getnetbyname d_getnbyname
13098eval $inlibc
13099
13100: see if getnetent exists
13101set getnetent d_getnent
13102eval $inlibc
13103
10bc17b6
JH
13104: see if getnetbyaddr_r exists
13105set getnetbyaddr_r d_getnetbyaddr_r
13106eval $inlibc
13107case "$d_getnetbyaddr_r" in
13108"$define")
13109 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13110 case "$d_getnetbyaddr_r_proto:$usethreads" in
13111 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
13112 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13113 eval $hasproto ;;
13114 *) ;;
13115 esac
13116 case "$d_getnetbyaddr_r_proto" in
13117 define)
10bc17b6
JH
13118 case "$getnetbyaddr_r_proto" in
13119 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13120 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13121 esac
13122 case "$getnetbyaddr_r_proto" in
13123 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13124 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13125 esac
13126 case "$getnetbyaddr_r_proto" in
13127 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13128 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13129 esac
13130 case "$getnetbyaddr_r_proto" in
13131 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13132 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13133 esac
13134 case "$getnetbyaddr_r_proto" in
13135 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13136 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13137 esac
13138 case "$getnetbyaddr_r_proto" in
13139 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13140 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13141 esac
13142 case "$getnetbyaddr_r_proto" in
13143 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13144 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13145 esac
13146 case "$getnetbyaddr_r_proto" in
a845a0d4
JH
13147 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13148 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13149 esac
13150 case "$getnetbyaddr_r_proto" in
90e831dc 13151 ''|0) d_getnetbyaddr_r=undef
10bc17b6 13152 getnetbyaddr_r_proto=0
a48ec845 13153 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13154 * ) case "$getnetbyaddr_r_proto" in
13155 REENTRANT_PROTO*) ;;
13156 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13157 esac
13158 echo "Prototype: $try" ;;
13159 esac
13160 ;;
c18e646a
JH
13161 *) case "$usethreads" in
13162 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13163 esac
90e831dc
SB
13164 d_getnetbyaddr_r=undef
13165 getnetbyaddr_r_proto=0
c18e646a 13166 ;;
a48ec845
JH
13167 esac
13168 ;;
10bc17b6
JH
13169*) getnetbyaddr_r_proto=0
13170 ;;
13171esac
13172
13173: see if getnetbyname_r exists
13174set getnetbyname_r d_getnetbyname_r
13175eval $inlibc
13176case "$d_getnetbyname_r" in
13177"$define")
13178 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13179 case "$d_getnetbyname_r_proto:$usethreads" in
13180 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
13181 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13182 eval $hasproto ;;
13183 *) ;;
13184 esac
13185 case "$d_getnetbyname_r_proto" in
13186 define)
10bc17b6
JH
13187 case "$getnetbyname_r_proto" in
13188 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13189 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13190 esac
13191 case "$getnetbyname_r_proto" in
13192 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13193 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13194 esac
13195 case "$getnetbyname_r_proto" in
13196 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13197 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13198 esac
13199 case "$getnetbyname_r_proto" in
13200 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13201 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13202 esac
13203 case "$getnetbyname_r_proto" in
90e831dc 13204 ''|0) d_getnetbyname_r=undef
10bc17b6 13205 getnetbyname_r_proto=0
a48ec845 13206 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13207 * ) case "$getnetbyname_r_proto" in
13208 REENTRANT_PROTO*) ;;
13209 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13210 esac
13211 echo "Prototype: $try" ;;
13212 esac
13213 ;;
c18e646a
JH
13214 *) case "$usethreads" in
13215 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13216 esac
90e831dc
SB
13217 d_getnetbyname_r=undef
13218 getnetbyname_r_proto=0
c18e646a 13219 ;;
a48ec845
JH
13220 esac
13221 ;;
10bc17b6
JH
13222*) getnetbyname_r_proto=0
13223 ;;
13224esac
13225
13226: see if getnetent_r exists
13227set getnetent_r d_getnetent_r
13228eval $inlibc
13229case "$d_getnetent_r" in
13230"$define")
13231 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13232 case "$d_getnetent_r_proto:$usethreads" in
13233 ":define") d_getnetent_r_proto=define
a48ec845
JH
13234 set d_getnetent_r_proto getnetent_r $hdrs
13235 eval $hasproto ;;
13236 *) ;;
13237 esac
13238 case "$d_getnetent_r_proto" in
13239 define)
10bc17b6
JH
13240 case "$getnetent_r_proto" in
13241 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13242 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13243 esac
13244 case "$getnetent_r_proto" in
13245 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13246 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13247 esac
13248 case "$getnetent_r_proto" in
13249 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13250 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13251 esac
13252 case "$getnetent_r_proto" in
13253 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13254 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13255 esac
13256 case "$getnetent_r_proto" in
13257 ''|0) try='int getnetent_r(struct netent*, char*, int);'
13258 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13259 esac
13260 case "$getnetent_r_proto" in
13261 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13262 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13263 esac
13264 case "$getnetent_r_proto" in
90e831dc 13265 ''|0) d_getnetent_r=undef
10bc17b6 13266 getnetent_r_proto=0
a48ec845 13267 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13268 * ) case "$getnetent_r_proto" in
13269 REENTRANT_PROTO*) ;;
13270 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13271 esac
13272 echo "Prototype: $try" ;;
13273 esac
13274 ;;
c18e646a
JH
13275 *) case "$usethreads" in
13276 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13277 esac
90e831dc
SB
13278 d_getnetent_r=undef
13279 getnetent_r_proto=0
c18e646a 13280 ;;
a48ec845
JH
13281 esac
13282 ;;
10bc17b6
JH
13283*) getnetent_r_proto=0
13284 ;;
13285esac
13286
b4eb6b3d
JH
13287: see if prototypes for various getnetxxx netdb.h functions are available
13288echo " "
13289set d_getnetprotos getnetent $i_netdb netdb.h
13290eval $hasproto
13291
0c0643d0
JH
13292: see if getpagesize exists
13293set getpagesize d_getpagsz
13294eval $inlibc
13295
b4eb6b3d
JH
13296
13297: see if getprotobyname exists
13298set getprotobyname d_getpbyname
13299eval $inlibc
13300
13301: see if getprotobynumber exists
13302set getprotobynumber d_getpbynumber
13303eval $inlibc
13304
13305: see if getprotoent exists
13306set getprotoent d_getpent
13307eval $inlibc
13308
13309: see if getpgid exists
13310set getpgid d_getpgid
13311eval $inlibc
13312
13313: see if getpgrp2 exists
13314set getpgrp2 d_getpgrp2
13315eval $inlibc
13316
13317: see if getppid exists
13318set getppid d_getppid
13319eval $inlibc
13320
13321: see if getpriority exists
13322set getpriority d_getprior
13323eval $inlibc
13324
10bc17b6
JH
13325: see if getprotobyname_r exists
13326set getprotobyname_r d_getprotobyname_r
13327eval $inlibc
13328case "$d_getprotobyname_r" in
13329"$define")
13330 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13331 case "$d_getprotobyname_r_proto:$usethreads" in
13332 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
13333 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13334 eval $hasproto ;;
13335 *) ;;
13336 esac
13337 case "$d_getprotobyname_r_proto" in
13338 define)
10bc17b6
JH
13339 case "$getprotobyname_r_proto" in
13340 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13341 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13342 esac
13343 case "$getprotobyname_r_proto" in
13344 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13345 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13346 esac
13347 case "$getprotobyname_r_proto" in
13348 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13349 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13350 esac
13351 case "$getprotobyname_r_proto" in
90e831dc 13352 ''|0) d_getprotobyname_r=undef
10bc17b6 13353 getprotobyname_r_proto=0
a48ec845 13354 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13355 * ) case "$getprotobyname_r_proto" in
13356 REENTRANT_PROTO*) ;;
13357 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13358 esac
13359 echo "Prototype: $try" ;;
13360 esac
13361 ;;
c18e646a
JH
13362 *) case "$usethreads" in
13363 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13364 esac
90e831dc
SB
13365 d_getprotobyname_r=undef
13366 getprotobyname_r_proto=0
c18e646a 13367 ;;
a48ec845
JH
13368 esac
13369 ;;
10bc17b6
JH
13370*) getprotobyname_r_proto=0
13371 ;;
13372esac
13373
13374: see if getprotobynumber_r exists
13375set getprotobynumber_r d_getprotobynumber_r
13376eval $inlibc
13377case "$d_getprotobynumber_r" in
13378"$define")
13379 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13380 case "$d_getprotobynumber_r_proto:$usethreads" in
13381 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
13382 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13383 eval $hasproto ;;
13384 *) ;;
13385 esac
13386 case "$d_getprotobynumber_r_proto" in
13387 define)
10bc17b6
JH
13388 case "$getprotobynumber_r_proto" in
13389 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13390 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13391 esac
13392 case "$getprotobynumber_r_proto" in
13393 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13394 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13395 esac
13396 case "$getprotobynumber_r_proto" in
13397 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13398 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13399 esac
13400 case "$getprotobynumber_r_proto" in
90e831dc 13401 ''|0) d_getprotobynumber_r=undef
10bc17b6 13402 getprotobynumber_r_proto=0
a48ec845 13403 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13404 * ) case "$getprotobynumber_r_proto" in
13405 REENTRANT_PROTO*) ;;
13406 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13407 esac
13408 echo "Prototype: $try" ;;
13409 esac
13410 ;;
c18e646a
JH
13411 *) case "$usethreads" in
13412 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13413 esac
90e831dc
SB
13414 d_getprotobynumber_r=undef
13415 getprotobynumber_r_proto=0
c18e646a 13416 ;;
a48ec845
JH
13417 esac
13418 ;;
10bc17b6
JH
13419*) getprotobynumber_r_proto=0
13420 ;;
13421esac
13422
13423: see if getprotoent_r exists
13424set getprotoent_r d_getprotoent_r
13425eval $inlibc
13426case "$d_getprotoent_r" in
13427"$define")
13428 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13429 case "$d_getprotoent_r_proto:$usethreads" in
13430 ":define") d_getprotoent_r_proto=define
a48ec845
JH
13431 set d_getprotoent_r_proto getprotoent_r $hdrs
13432 eval $hasproto ;;
13433 *) ;;
13434 esac
13435 case "$d_getprotoent_r_proto" in
13436 define)
10bc17b6
JH
13437 case "$getprotoent_r_proto" in
13438 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13439 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13440 esac
13441 case "$getprotoent_r_proto" in
13442 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13443 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13444 esac
13445 case "$getprotoent_r_proto" in
13446 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13447 ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13448 esac
13449 case "$getprotoent_r_proto" in
13450 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13451 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13452 esac
13453 case "$getprotoent_r_proto" in
90e831dc 13454 ''|0) d_getprotoent_r=undef
10bc17b6 13455 getprotoent_r_proto=0
a48ec845 13456 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13457 * ) case "$getprotoent_r_proto" in
13458 REENTRANT_PROTO*) ;;
13459 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13460 esac
13461 echo "Prototype: $try" ;;
13462 esac
13463 ;;
c18e646a
JH
13464 *) case "$usethreads" in
13465 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13466 esac
90e831dc
SB
13467 d_getprotoent_r=undef
13468 getprotoent_r_proto=0
c18e646a 13469 ;;
a48ec845
JH
13470 esac
13471 ;;
10bc17b6
JH
13472*) getprotoent_r_proto=0
13473 ;;
13474esac
13475
b4eb6b3d
JH
13476: see if prototypes for various getprotoxxx netdb.h functions are available
13477echo " "
13478set d_getprotoprotos getprotoent $i_netdb netdb.h
13479eval $hasproto
13480
13481: see if getprpwnam exists
13482set getprpwnam d_getprpwnam
13483eval $inlibc
13484
13485: see if getpwent exists
13486set getpwent d_getpwent
13487eval $inlibc
13488
10bc17b6
JH
13489: see if getpwent_r exists
13490set getpwent_r d_getpwent_r
13491eval $inlibc
13492case "$d_getpwent_r" in
13493"$define")
13494 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13495 case "$d_getpwent_r_proto:$usethreads" in
13496 ":define") d_getpwent_r_proto=define
a48ec845
JH
13497 set d_getpwent_r_proto getpwent_r $hdrs
13498 eval $hasproto ;;
13499 *) ;;
13500 esac
13501 case "$d_getpwent_r_proto" in
13502 define)
10bc17b6
JH
13503 case "$getpwent_r_proto" in
13504 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13505 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13506 esac
13507 case "$getpwent_r_proto" in
13508 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13509 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13510 esac
13511 case "$getpwent_r_proto" in
13512 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13513 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13514 esac
13515 case "$getpwent_r_proto" in
13516 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13517 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13518 esac
13519 case "$getpwent_r_proto" in
13520 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13521 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13522 esac
13523 case "$getpwent_r_proto" in
13524 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13525 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13526 esac
13527 case "$getpwent_r_proto" in
90e831dc 13528 ''|0) d_getpwent_r=undef
10bc17b6 13529 getpwent_r_proto=0
a48ec845 13530 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13531 * ) case "$getpwent_r_proto" in
13532 REENTRANT_PROTO*) ;;
13533 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13534 esac
13535 echo "Prototype: $try" ;;
13536 esac
13537 ;;
c18e646a
JH
13538 *) case "$usethreads" in
13539 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13540 esac
90e831dc
SB
13541 d_getpwent_r=undef
13542 getpwent_r_proto=0
c18e646a 13543 ;;
a48ec845
JH
13544 esac
13545 ;;
10bc17b6
JH
13546*) getpwent_r_proto=0
13547 ;;
13548esac
13549
13550: see if getpwnam_r exists
13551set getpwnam_r d_getpwnam_r
13552eval $inlibc
13553case "$d_getpwnam_r" in
13554"$define")
13555 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13556 case "$d_getpwnam_r_proto:$usethreads" in
13557 ":define") d_getpwnam_r_proto=define
a48ec845
JH
13558 set d_getpwnam_r_proto getpwnam_r $hdrs
13559 eval $hasproto ;;
13560 *) ;;
13561 esac
13562 case "$d_getpwnam_r_proto" in
13563 define)
10bc17b6
JH
13564 case "$getpwnam_r_proto" in
13565 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13566 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13567 esac
13568 case "$getpwnam_r_proto" in
13569 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13570 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13571 esac
13572 case "$getpwnam_r_proto" in
13573 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13574 ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13575 esac
13576 case "$getpwnam_r_proto" in
13577 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13578 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13579 esac
13580 case "$getpwnam_r_proto" in
90e831dc 13581 ''|0) d_getpwnam_r=undef
10bc17b6 13582 getpwnam_r_proto=0
a48ec845 13583 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13584 * ) case "$getpwnam_r_proto" in
13585 REENTRANT_PROTO*) ;;
13586 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13587 esac
13588 echo "Prototype: $try" ;;
13589 esac
13590 ;;
c18e646a
JH
13591 *) case "$usethreads" in
13592 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13593 esac
90e831dc
SB
13594 d_getpwnam_r=undef
13595 getpwnam_r_proto=0
c18e646a 13596 ;;
a48ec845
JH
13597 esac
13598 ;;
10bc17b6
JH
13599*) getpwnam_r_proto=0
13600 ;;
13601esac
13602
13603: see if getpwuid_r exists
13604set getpwuid_r d_getpwuid_r
13605eval $inlibc
13606case "$d_getpwuid_r" in
13607"$define")
13608 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13609 case "$d_getpwuid_r_proto:$usethreads" in
13610 ":define") d_getpwuid_r_proto=define
a48ec845
JH
13611 set d_getpwuid_r_proto getpwuid_r $hdrs
13612 eval $hasproto ;;
13613 *) ;;
13614 esac
13615 case "$d_getpwuid_r_proto" in
13616 define)
10bc17b6
JH
13617 case "$getpwuid_r_proto" in
13618 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13619 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13620 esac
13621 case "$getpwuid_r_proto" in
13622 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13623 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13624 esac
13625 case "$getpwuid_r_proto" in
13626 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13627 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13628 esac
13629 case "$getpwuid_r_proto" in
13630 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13631 ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13632 esac
13633 case "$getpwuid_r_proto" in
90e831dc 13634 ''|0) d_getpwuid_r=undef
10bc17b6 13635 getpwuid_r_proto=0
a48ec845 13636 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13637 * ) case "$getpwuid_r_proto" in
13638 REENTRANT_PROTO*) ;;
13639 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13640 esac
13641 echo "Prototype: $try" ;;
13642 esac
13643 ;;
c18e646a
JH
13644 *) case "$usethreads" in
13645 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13646 esac
90e831dc
SB
13647 d_getpwuid_r=undef
13648 getpwuid_r_proto=0
c18e646a 13649 ;;
a48ec845
JH
13650 esac
13651 ;;
10bc17b6
JH
13652*) getpwuid_r_proto=0
13653 ;;
13654esac
13655
b4eb6b3d
JH
13656
13657: see if getservbyname exists
13658set getservbyname d_getsbyname
13659eval $inlibc
13660
13661: see if getservbyport exists
13662set getservbyport d_getsbyport
13663eval $inlibc
13664
13665: see if getservent exists
13666set getservent d_getsent
13667eval $inlibc
13668
10bc17b6
JH
13669: see if getservbyname_r exists
13670set getservbyname_r d_getservbyname_r
13671eval $inlibc
13672case "$d_getservbyname_r" in
13673"$define")
13674 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13675 case "$d_getservbyname_r_proto:$usethreads" in
13676 ":define") d_getservbyname_r_proto=define
a48ec845
JH
13677 set d_getservbyname_r_proto getservbyname_r $hdrs
13678 eval $hasproto ;;
13679 *) ;;
13680 esac
13681 case "$d_getservbyname_r_proto" in
13682 define)
10bc17b6
JH
13683 case "$getservbyname_r_proto" in
13684 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13685 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13686 esac
13687 case "$getservbyname_r_proto" in
13688 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13689 ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13690 esac
13691 case "$getservbyname_r_proto" in
13692 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13693 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13694 esac
13695 case "$getservbyname_r_proto" in
90e831dc 13696 ''|0) d_getservbyname_r=undef
10bc17b6 13697 getservbyname_r_proto=0
a48ec845 13698 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13699 * ) case "$getservbyname_r_proto" in
13700 REENTRANT_PROTO*) ;;
13701 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13702 esac
13703 echo "Prototype: $try" ;;
13704 esac
13705 ;;
c18e646a
JH
13706 *) case "$usethreads" in
13707 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13708 esac
90e831dc
SB
13709 d_getservbyname_r=undef
13710 getservbyname_r_proto=0
c18e646a 13711 ;;
a48ec845
JH
13712 esac
13713 ;;
10bc17b6
JH
13714*) getservbyname_r_proto=0
13715 ;;
13716esac
13717
13718: see if getservbyport_r exists
13719set getservbyport_r d_getservbyport_r
13720eval $inlibc
13721case "$d_getservbyport_r" in
13722"$define")
13723 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13724 case "$d_getservbyport_r_proto:$usethreads" in
13725 ":define") d_getservbyport_r_proto=define
a48ec845
JH
13726 set d_getservbyport_r_proto getservbyport_r $hdrs
13727 eval $hasproto ;;
13728 *) ;;
13729 esac
13730 case "$d_getservbyport_r_proto" in
13731 define)
10bc17b6
JH
13732 case "$getservbyport_r_proto" in
13733 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13734 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13735 esac
13736 case "$getservbyport_r_proto" in
13737 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13738 ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13739 esac
13740 case "$getservbyport_r_proto" in
13741 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13742 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13743 esac
13744 case "$getservbyport_r_proto" in
90e831dc 13745 ''|0) d_getservbyport_r=undef
10bc17b6 13746 getservbyport_r_proto=0
a48ec845 13747 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13748 * ) case "$getservbyport_r_proto" in
13749 REENTRANT_PROTO*) ;;
13750 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13751 esac
13752 echo "Prototype: $try" ;;
13753 esac
13754 ;;
c18e646a
JH
13755 *) case "$usethreads" in
13756 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13757 esac
90e831dc
SB
13758 d_getservbyport_r=undef
13759 getservbyport_r_proto=0
c18e646a 13760 ;;
a48ec845
JH
13761 esac
13762 ;;
10bc17b6
JH
13763*) getservbyport_r_proto=0
13764 ;;
13765esac
13766
13767: see if getservent_r exists
13768set getservent_r d_getservent_r
13769eval $inlibc
13770case "$d_getservent_r" in
13771"$define")
13772 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13773 case "$d_getservent_r_proto:$usethreads" in
13774 ":define") d_getservent_r_proto=define
a48ec845
JH
13775 set d_getservent_r_proto getservent_r $hdrs
13776 eval $hasproto ;;
13777 *) ;;
13778 esac
13779 case "$d_getservent_r_proto" in
13780 define)
10bc17b6
JH
13781 case "$getservent_r_proto" in
13782 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13783 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13784 esac
13785 case "$getservent_r_proto" in
13786 ''|0) try='int getservent_r(struct servent*, char*, int);'
13787 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13788 esac
13789 case "$getservent_r_proto" in
13790 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13791 ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13792 esac
13793 case "$getservent_r_proto" in
13794 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13795 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13796 esac
13797 case "$getservent_r_proto" in
90e831dc 13798 ''|0) d_getservent_r=undef
10bc17b6 13799 getservent_r_proto=0
a48ec845 13800 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13801 * ) case "$getservent_r_proto" in
13802 REENTRANT_PROTO*) ;;
13803 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13804 esac
13805 echo "Prototype: $try" ;;
13806 esac
13807 ;;
c18e646a
JH
13808 *) case "$usethreads" in
13809 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13810 esac
90e831dc
SB
13811 d_getservent_r=undef
13812 getservent_r_proto=0
c18e646a 13813 ;;
a48ec845
JH
13814 esac
13815 ;;
10bc17b6
JH
13816*) getservent_r_proto=0
13817 ;;
13818esac
13819
b4eb6b3d
JH
13820: see if prototypes for various getservxxx netdb.h functions are available
13821echo " "
13822set d_getservprotos getservent $i_netdb netdb.h
13823eval $hasproto
13824
13825: see if getspnam exists
13826set getspnam d_getspnam
13827eval $inlibc
13828
10bc17b6
JH
13829: see if this is a shadow.h system
13830set shadow.h i_shadow
13831eval $inhdr
13832
13833: see if getspnam_r exists
13834set getspnam_r d_getspnam_r
13835eval $inlibc
13836case "$d_getspnam_r" in
13837"$define")
13838 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
13839 case "$d_getspnam_r_proto:$usethreads" in
13840 ":define") d_getspnam_r_proto=define
a48ec845
JH
13841 set d_getspnam_r_proto getspnam_r $hdrs
13842 eval $hasproto ;;
13843 *) ;;
13844 esac
13845 case "$d_getspnam_r_proto" in
13846 define)
10bc17b6
JH
13847 case "$getspnam_r_proto" in
13848 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13849 ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13850 esac
13851 case "$getspnam_r_proto" in
13852 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13853 ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13854 esac
13855 case "$getspnam_r_proto" in
90e831dc 13856 ''|0) d_getspnam_r=undef
10bc17b6 13857 getspnam_r_proto=0
a48ec845 13858 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13859 * ) case "$getspnam_r_proto" in
13860 REENTRANT_PROTO*) ;;
13861 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13862 esac
13863 echo "Prototype: $try" ;;
13864 esac
13865 ;;
c18e646a
JH
13866 *) case "$usethreads" in
13867 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13868 esac
90e831dc
SB
13869 d_getspnam_r=undef
13870 getspnam_r_proto=0
c18e646a 13871 ;;
a48ec845
JH
13872 esac
13873 ;;
10bc17b6
JH
13874*) getspnam_r_proto=0
13875 ;;
13876esac
13877
b4eb6b3d
JH
13878: see if gettimeofday or ftime exists
13879set gettimeofday d_gettimeod
13880eval $inlibc
13881case "$d_gettimeod" in
13882"$undef")
13883 set ftime d_ftime
13884 eval $inlibc
13885 ;;
13886*)
13887 val="$undef"; set d_ftime; eval $setvar
13888 ;;
13889esac
13890case "$d_gettimeod$d_ftime" in
13891"$undef$undef")
13892 echo " "
13893 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13894 ;;
13895esac
13896
10bc17b6
JH
13897: see if gmtime_r exists
13898set gmtime_r d_gmtime_r
13899eval $inlibc
13900case "$d_gmtime_r" in
13901"$define")
d63eadf0 13902 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
13903 case "$d_gmtime_r_proto:$usethreads" in
13904 ":define") d_gmtime_r_proto=define
a48ec845
JH
13905 set d_gmtime_r_proto gmtime_r $hdrs
13906 eval $hasproto ;;
13907 *) ;;
13908 esac
13909 case "$d_gmtime_r_proto" in
13910 define)
10bc17b6
JH
13911 case "$gmtime_r_proto" in
13912 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13913 ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13914 esac
13915 case "$gmtime_r_proto" in
13916 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13917 ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13918 esac
13919 case "$gmtime_r_proto" in
90e831dc 13920 ''|0) d_gmtime_r=undef
10bc17b6 13921 gmtime_r_proto=0
a48ec845 13922 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13923 * ) case "$gmtime_r_proto" in
13924 REENTRANT_PROTO*) ;;
13925 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13926 esac
13927 echo "Prototype: $try" ;;
13928 esac
b4eb6b3d 13929 ;;
c18e646a
JH
13930 *) case "$usethreads" in
13931 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13932 esac
90e831dc
SB
13933 d_gmtime_r=undef
13934 gmtime_r_proto=0
c18e646a 13935 ;;
a48ec845
JH
13936 esac
13937 ;;
10bc17b6 13938*) gmtime_r_proto=0
b4eb6b3d
JH
13939 ;;
13940esac
13941
13942: see if hasmntopt exists
13943set hasmntopt d_hasmntopt
13944eval $inlibc
13945
13946: see if this is a netinet/in.h or sys/in.h system
13947set netinet/in.h i_niin sys/in.h i_sysin
13948eval $inhdr
13949
13950: see if arpa/inet.h has to be included
13951set arpa/inet.h i_arpainet
13952eval $inhdr
13953
13954: see if htonl --and friends-- exists
13955val=''
13956set htonl val
13957eval $inlibc
13958
13959: Maybe they are macros.
13960case "$val" in
13961$undef)
13962 $cat >htonl.c <<EOM
13963#include <stdio.h>
13964#include <sys/types.h>
13965#$i_niin I_NETINET_IN
13966#$i_sysin I_SYS_IN
13967#$i_arpainet I_ARPA_INET
13968#ifdef I_NETINET_IN
13969#include <netinet/in.h>
13970#endif
13971#ifdef I_SYS_IN
13972#include <sys/in.h>
13973#endif
13974#ifdef I_ARPA_INET
13975#include <arpa/inet.h>
13976#endif
13977#ifdef htonl
13978printf("Defined as a macro.");
13979#endif
13980EOM
13981 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13982 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13983 val="$define"
13984 echo "But it seems to be defined as a macro." >&4
13985 fi
13986 $rm -f htonl.?
13987 ;;
13988esac
13989set d_htonl
13990eval $setvar
13991
36adc09b
JH
13992: see if ilogbl exists
13993set ilogbl d_ilogbl
13994eval $inlibc
13995
b4eb6b3d
JH
13996: index or strchr
13997echo " "
13998if set index val -f; eval $csym; $val; then
13999 if set strchr val -f d_strchr; eval $csym; $val; then
14000 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14001 val="$define"
14002 vali="$undef"
14003 echo "strchr() found." >&4
14004 else
14005 val="$undef"
14006 vali="$define"
14007 echo "index() found." >&4
14008 fi
14009 else
14010 val="$undef"
14011 vali="$define"
8dfa8df9
JH
14012 echo "index() found." >&4
14013 fi
b4eb6b3d 14014else
8dfa8df9
JH
14015 if set strchr val -f d_strchr; eval $csym; $val; then
14016 val="$define"
14017 vali="$undef"
14018 echo "strchr() found." >&4
14019 else
14020 echo "No index() or strchr() found!" >&4
14021 val="$undef"
14022 vali="$undef"
14023 fi
b4eb6b3d 14024fi
8dfa8df9
JH
14025set d_strchr; eval $setvar
14026val="$vali"
14027set d_index; eval $setvar
14028
14029: check whether inet_aton exists
14030set inet_aton d_inetaton
14031eval $inlibc
b4eb6b3d
JH
14032
14033: Look for isascii
14034echo " "
36adc09b 14035$cat >isascii.c <<EOCP
b4eb6b3d
JH
14036#include <stdio.h>
14037#include <ctype.h>
55954f19
JH
14038#$i_stdlib I_STDLIB
14039#ifdef I_STDLIB
14040#include <stdlib.h>
14041#endif
b4eb6b3d
JH
14042int main() {
14043 int c = 'A';
14044 if (isascii(c))
14045 exit(0);
14046 else
14047 exit(1);
14048}
14049EOCP
14050set isascii
14051if eval $compile; then
14052 echo "isascii() found." >&4
14053 val="$define"
14054else
14055 echo "isascii() NOT found." >&4
14056 val="$undef"
14057fi
14058set d_isascii
14059eval $setvar
14060$rm -f isascii*
14061
758a5d79
JH
14062: see if isfinite exists
14063set isfinite d_isfinite
14064eval $inlibc
14065
14066: see if isinf exists
14067set isinf d_isinf
14068eval $inlibc
14069
b4eb6b3d
JH
14070: see if isnan exists
14071set isnan d_isnan
14072eval $inlibc
14073
14074: see if isnanl exists
14075set isnanl d_isnanl
14076eval $inlibc
14077
14078: see if killpg exists
14079set killpg d_killpg
14080eval $inlibc
14081
14082: see if lchown exists
14083echo " "
14084$cat > try.c <<'EOCP'
14085/* System header to define __stub macros and hopefully few prototypes,
14086 which can conflict with char lchown(); below. */
14087#include <assert.h>
14088/* Override any gcc2 internal prototype to avoid an error. */
14089/* We use char because int might match the return type of a gcc2
14090 builtin and then its argument prototype would still apply. */
14091char lchown();
14092int main() {
14093 /* The GNU C library defines this for functions which it implements
14094 to always fail with ENOSYS. Some functions are actually named
14095 something starting with __ and the normal name is an alias. */
14096#if defined (__stub_lchown) || defined (__stub___lchown)
14097choke me
14098#else
14099lchown();
14100#endif
14101; return 0; }
14102EOCP
14103set try
14104if eval $compile; then
14105 $echo "lchown() found." >&4
14106 val="$define"
14107else
14108 $echo "lchown() NOT found." >&4
14109 val="$undef"
14110fi
14111set d_lchown
14112eval $setvar
14113
14114: See if number of significant digits in a double precision number is known
14115echo " "
14116$cat >ldbl_dig.c <<EOM
14117#$i_limits I_LIMITS
14118#$i_float I_FLOAT
14119#ifdef I_LIMITS
14120#include <limits.h>
14121#endif
14122#ifdef I_FLOAT
14123#include <float.h>
14124#endif
14125#ifdef LDBL_DIG
14126printf("Contains LDBL_DIG");
14127#endif
14128EOM
14129$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14130if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14131 echo "LDBL_DIG found." >&4
14132 val="$define"
14133else
14134 echo "LDBL_DIG NOT found." >&4
14135 val="$undef"
14136fi
14137$rm -f ldbl_dig.?
14138set d_ldbl_dig
14139eval $setvar
14140
0a0abfba
MB
14141: see if this is a math.h system
14142set math.h i_math
14143eval $inhdr
14144
14145d_libm_lib_version="$undef"
14146case $i_math in
14147 $define)
14148 : check to see if math.h defines _LIB_VERSION
14149 echo " "
14150 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14151 $cat >try.c <<EOCP
14152#include <unistd.h>
14153#include <math.h>
14154int main (int argc, char *argv[])
14155{
14156 printf ("%d\n", _LIB_VERSION);
14157 return (0);
14158 } /* main */
14159EOCP
14160 set try
14161 if eval $compile; then
14162 foo=`$run ./try`
14163 echo "Yes, it does ($foo)" >&4
14164 d_libm_lib_version="$define"
14165 else
14166 echo "No, it does not (probably harmless)\n" >&4
14167 fi
14168 $rm -f try.* try core core.try.*
14169 ;;
14170
14171 esac
14172
b4eb6b3d
JH
14173: see if link exists
14174set link d_link
14175eval $inlibc
14176
10bc17b6
JH
14177: see if localtime_r exists
14178set localtime_r d_localtime_r
14179eval $inlibc
14180case "$d_localtime_r" in
14181"$define")
d63eadf0 14182 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14183 case "$d_localtime_r_proto:$usethreads" in
14184 ":define") d_localtime_r_proto=define
a48ec845
JH
14185 set d_localtime_r_proto localtime_r $hdrs
14186 eval $hasproto ;;
14187 *) ;;
14188 esac
14189 case "$d_localtime_r_proto" in
14190 define)
10bc17b6
JH
14191 case "$localtime_r_proto" in
14192 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14193 ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14194 esac
14195 case "$localtime_r_proto" in
14196 ''|0) try='int localtime_r(const time_t*, struct tm*);'
14197 ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14198 esac
14199 case "$localtime_r_proto" in
90e831dc 14200 ''|0) d_localtime_r=undef
10bc17b6 14201 localtime_r_proto=0
a48ec845 14202 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14203 * ) case "$localtime_r_proto" in
14204 REENTRANT_PROTO*) ;;
14205 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14206 esac
14207 echo "Prototype: $try" ;;
14208 esac
14209 ;;
c18e646a
JH
14210 *) case "$usethreads" in
14211 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14212 esac
90e831dc
SB
14213 d_localtime_r=undef
14214 localtime_r_proto=0
c18e646a 14215 ;;
a48ec845
JH
14216 esac
14217 ;;
10bc17b6
JH
14218*) localtime_r_proto=0
14219 ;;
14220esac
14221
b4eb6b3d
JH
14222: see if localeconv exists
14223set localeconv d_locconv
14224eval $inlibc
14225
14226: see if lockf exists
14227set lockf d_lockf
14228eval $inlibc
14229
b4eb6b3d
JH
14230: see if prototype for lseek is available
14231echo " "
4786929f 14232set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
14233eval $hasproto
14234
14235: see if lstat exists
14236set lstat d_lstat
14237eval $inlibc
14238
14239: see if madvise exists
14240set madvise d_madvise
14241eval $inlibc
14242
14243: see if mblen exists
14244set mblen d_mblen
14245eval $inlibc
14246
14247: see if mbstowcs exists
14248set mbstowcs d_mbstowcs
14249eval $inlibc
14250
14251: see if mbtowc exists
14252set mbtowc d_mbtowc
14253eval $inlibc
14254
14255: see if memchr exists
14256set memchr d_memchr
14257eval $inlibc
14258
14259: see if memcmp exists
14260set memcmp d_memcmp
14261eval $inlibc
14262
14263: see if memcpy exists
14264set memcpy d_memcpy
14265eval $inlibc
14266
14267: see if memmove exists
14268set memmove d_memmove
14269eval $inlibc
14270
14271: see if memset exists
14272set memset d_memset
14273eval $inlibc
14274
14275: see if mkdir exists
14276set mkdir d_mkdir
14277eval $inlibc
14278
14279: see if mkdtemp exists
14280set mkdtemp d_mkdtemp
14281eval $inlibc
14282
14283: see if mkfifo exists
14284set mkfifo d_mkfifo
14285eval $inlibc
14286
14287: see if mkstemp exists
14288set mkstemp d_mkstemp
14289eval $inlibc
14290
14291: see if mkstemps exists
14292set mkstemps d_mkstemps
14293eval $inlibc
14294
14295: see if mktime exists
14296set mktime d_mktime
14297eval $inlibc
14298
14299: see if this is a sys/mman.h system
14300set sys/mman.h i_sysmman
14301eval $inhdr
14302
14303: see if mmap exists
14304set mmap d_mmap
14305eval $inlibc
14306: see what shmat returns
14307: default to something harmless
14308mmaptype='void *'
14309case "$i_sysmman$d_mmap" in
14310"$define$define")
14311 $cat >mmap.c <<'END'
14312#include <sys/mman.h>
14313void *mmap();
14314END
14315 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14316 mmaptype='void *'
14317 else
14318 mmaptype='caddr_t'
14319 fi
14320 echo "and it returns ($mmaptype)." >&4
14321 ;;
14322esac
14323
14324
14325
89ce900e
JH
14326: see if sqrtl exists
14327set sqrtl d_sqrtl
14328eval $inlibc
14329
af1ff193
JH
14330: see if scalbnl exists
14331set scalbnl d_scalbnl
14332eval $inlibc
14333
89ce900e
JH
14334: see if modfl exists
14335set modfl d_modfl
14336eval $inlibc
14337
14338: see if prototype for modfl is available
14339echo " "
3a794506 14340set d_modflproto modfl $i_math math.h
89ce900e
JH
14341eval $hasproto
14342
14343d_modfl_pow32_bug="$undef"
14344
14345case "$d_longdbl$d_modfl" in
14346$define$define)
14347 $cat <<EOM
14348Checking to see whether your modfl() is okay for large values...
14349EOM
14350$cat >try.c <<EOCP
14351#include <math.h>
14352#include <stdio.h>
14353EOCP
14354if $test "X$d_modflproto" != "X$define"; then
14355 $cat >>try.c <<EOCP
14356/* Sigh. many current glibcs provide the function, but do not prototype it. */
14357long double modfl (long double, long double *);
14358EOCP
14359fi
14360$cat >>try.c <<EOCP
14361int main() {
14362 long double nv = 4294967303.15;
14363 long double v, w;
14364 v = modfl(nv, &w);
14365#ifdef __GLIBC__
14366 printf("glibc");
14367#endif
14368 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14369 return 0;
14370}
14371EOCP
14372 case "$osname:$gccversion" in
14373 aix:) saveccflags="$ccflags"
14374 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14375 esac
14376 set try
14377 if eval $compile; then
14378 foo=`$run ./try`
14379 case "$foo" in
14380 *" 4294967303.150000 1.150000 4294967302.000000")
14381 echo >&4 "Your modfl() is broken for large values."
14382 d_modfl_pow32_bug="$define"
14383 case "$foo" in
14384 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14385 ;;
14386 esac
14387 ;;
14388 *" 4294967303.150000 0.150000 4294967303.000000")
14389 echo >&4 "Your modfl() seems okay for large values."
14390 ;;
14391 *) echo >&4 "I don't understand your modfl() at all."
14392 d_modfl="$undef"
14393 ;;
14394 esac
14395 $rm -f try.* try core core.try.*
14396 else
14397 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14398 d_modfl="$undef"
14399 fi
14400 case "$osname:$gccversion" in
14401 aix:) ccflags="$saveccflags" ;; # restore
14402 esac
14403 ;;
14404esac
14405
14406if $test "$uselongdouble" = "$define"; then
af1ff193
JH
14407 message=""
14408 if $test "$d_sqrtl" != "$define"; then
14409 message="$message sqrtl"
14410 fi
14411 if $test "$d_modfl" != "$define"; then
89ce900e
JH
14412 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14413 echo "You have both aintl and copysignl, so I can emulate modfl."
14414 else
af1ff193 14415 message="$message modfl"
89ce900e 14416 fi
af1ff193
JH
14417 fi
14418 if $test "$d_frexpl" != "$define"; then
14419 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14420 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14421 else
14422 message="$message frexpl"
14423 fi
14424 fi
89ce900e 14425
af1ff193 14426 if $test "$message" != ""; then
89ce900e
JH
14427 $cat <<EOM >&4
14428
14429*** You requested the use of long doubles but you do not seem to have
af1ff193
JH
14430*** the following mathematical functions needed for long double support:
14431*** $message
fe63a0b4
JH
14432*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14433*** Cannot continue, aborting.
89ce900e
JH
14434
14435EOM
14436
fe63a0b4 14437 exit 1
89ce900e
JH
14438 fi
14439fi
14440
b4eb6b3d
JH
14441: see if mprotect exists
14442set mprotect d_mprotect
14443eval $inlibc
14444
14445: see if msgctl exists
14446set msgctl d_msgctl
14447eval $inlibc
14448
14449: see if msgget exists
14450set msgget d_msgget
14451eval $inlibc
14452
14453: see if msgsnd exists
14454set msgsnd d_msgsnd
14455eval $inlibc
14456
14457: see if msgrcv exists
14458set msgrcv d_msgrcv
14459eval $inlibc
14460
14461: see how much of the 'msg*(2)' library is present.
14462h_msg=true
14463echo " "
14464case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14465*"$undef"*) h_msg=false;;
14466esac
14467case "$osname" in
14468freebsd)
14469 case "`ipcs 2>&1`" in
14470 "SVID messages"*"not configured"*)
14471 echo "Your $osname does not have the msg*(2) configured." >&4
14472 h_msg=false
14473 val="$undef"
14474 set msgctl d_msgctl
14475 eval $setvar
14476 set msgget d_msgget
14477 eval $setvar
14478 set msgsnd d_msgsnd
14479 eval $setvar
14480 set msgrcv d_msgrcv
14481 eval $setvar
14482 ;;
14483 esac
14484 ;;
14485esac
14486: we could also check for sys/ipc.h ...
14487if $h_msg && $test `./findhdr sys/msg.h`; then
14488 echo "You have the full msg*(2) library." >&4
14489 val="$define"
14490else
14491 echo "You don't have the full msg*(2) library." >&4
14492 val="$undef"
14493fi
14494set d_msg
14495eval $setvar
14496
4e0554ec
JH
14497
14498echo " "
14499echo "Checking to see if your system supports struct msghdr..." >&4
14500set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14501eval $hasstruct
14502case "$d_msghdr_s" in
14503"$define") echo "Yes, it does." ;;
14504*) echo "No, it doesn't." ;;
14505esac
14506
14507
b4eb6b3d
JH
14508: see if msync exists
14509set msync d_msync
14510eval $inlibc
14511
14512: see if munmap exists
14513set munmap d_munmap
14514eval $inlibc
14515
14516: see if nice exists
14517set nice d_nice
14518eval $inlibc
14519
2765b840
JH
14520: see if this is a langinfo.h system
14521set langinfo.h i_langinfo
14522eval $inhdr
14523
14524: see if nl_langinfo exists
14525set nl_langinfo d_nl_langinfo
14526eval $inlibc
14527
b4eb6b3d
JH
14528: check for length of character
14529echo " "
14530case "$charsize" in
14531'')
14532 echo "Checking to see how big your characters are (hey, you never know)..." >&4
74d00865 14533 $cat >try.c <<EOCP
b4eb6b3d 14534#include <stdio.h>
d1daaddf
JH
14535#$i_stdlib I_STDLIB
14536#ifdef I_STDLIB
14537#include <stdlib.h>
14538#endif
b4eb6b3d
JH
14539int main()
14540{
14541 printf("%d\n", (int)sizeof(char));
14542 exit(0);
14543}
14544EOCP
14545 set try
14546 if eval $compile_ok; then
5440bc8e 14547 dflt=`$run ./try`
b4eb6b3d
JH
14548 else
14549 dflt='1'
14550 echo "(I can't seem to compile the test program. Guessing...)"
14551 fi
14552 ;;
14553*)
14554 dflt="$charsize"
14555 ;;
14556esac
14557rp="What is the size of a character (in bytes)?"
14558. ./myread
14559charsize="$ans"
14560$rm -f try.c try
14561
1d1be0dc
NC
14562: check for volatile keyword
14563echo " "
14564echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14565$cat >try.c <<'EOCP'
76f47787 14566int main()
1d1be0dc
NC
14567{
14568 typedef struct _goo_struct goo_struct;
14569 goo_struct * volatile goo = ((goo_struct *)0);
14570 struct _goo_struct {
14571 long long_int;
14572 int reg_int;
14573 char char_var;
14574 };
14575 typedef unsigned short foo_t;
14576 char *volatile foo;
14577 volatile int bar;
14578 volatile foo_t blech;
14579 foo = foo;
14580}
14581EOCP
14582if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14583 val="$define"
14584 echo "Yup, it does."
14585else
14586 val="$undef"
14587 echo "Nope, it doesn't."
14588fi
14589set d_volatile
14590eval $setvar
14591$rm -f try.*
14592
b4eb6b3d
JH
14593
14594echo " "
14595$echo "Choosing the C types to be used for Perl's internal types..." >&4
14596
14597case "$use64bitint:$d_quad:$quadtype" in
14598define:define:?*)
14599 ivtype="$quadtype"
14600 uvtype="$uquadtype"
14601 ivsize=8
14602 uvsize=8
14603 ;;
14604*) ivtype="long"
14605 uvtype="unsigned long"
14606 ivsize=$longsize
14607 uvsize=$longsize
14608 ;;
14609esac
14610
14611case "$uselongdouble:$d_longdbl" in
14612define:define)
14613 nvtype="long double"
14614 nvsize=$longdblsize
14615 ;;
14616*) nvtype=double
14617 nvsize=$doublesize
14618 ;;
14619esac
14620
14621$echo "(IV will be "$ivtype", $ivsize bytes)"
14622$echo "(UV will be "$uvtype", $uvsize bytes)"
14623$echo "(NV will be "$nvtype", $nvsize bytes)"
14624
14625$cat >try.c <<EOCP
14626#$i_inttypes I_INTTYPES
14627#ifdef I_INTTYPES
14628#include <inttypes.h>
14629#endif
14630#include <stdio.h>
14631int main() {
14632#ifdef INT8
14633 int8_t i = INT8_MAX;
14634 uint8_t u = UINT8_MAX;
14635 printf("int8_t\n");
14636#endif
14637#ifdef INT16
14638 int16_t i = INT16_MAX;
14639 uint16_t i = UINT16_MAX;
14640 printf("int16_t\n");
14641#endif
14642#ifdef INT32
14643 int32_t i = INT32_MAX;
14644 uint32_t u = UINT32_MAX;
14645 printf("int32_t\n");
14646#endif
14647}
14648EOCP
14649
14650case "$i8type" in
14651'') case "$charsize" in
14652 1) i8type=char
14653 u8type="unsigned char"
14654 i8size=$charsize
14655 u8size=$charsize
14656 ;;
14657 esac
14658 ;;
14659esac
14660case "$i8type" in
14661'') set try -DINT8
14662 if eval $compile; then
5440bc8e 14663 case "`$run ./try`" in
b4eb6b3d
JH
14664 int8_t) i8type=int8_t
14665 u8type=uint8_t
14666 i8size=1
14667 u8size=1
14668 ;;
14669 esac
14670 fi
14671 ;;
14672esac
14673case "$i8type" in
14674'') if $test $charsize -ge 1; then
14675 i8type=char
14676 u8type="unsigned char"
14677 i8size=$charsize
14678 u8size=$charsize
14679 fi
14680 ;;
14681esac
14682
14683case "$i16type" in
14684'') case "$shortsize" in
14685 2) i16type=short
14686 u16type="unsigned short"
14687 i16size=$shortsize
14688 u16size=$shortsize
14689 ;;
14690 esac
14691 ;;
14692esac
14693case "$i16type" in
14694'') set try -DINT16
14695 if eval $compile; then
5440bc8e 14696 case "`$run ./try`" in
b4eb6b3d
JH
14697 int16_t)
14698 i16type=int16_t
14699 u16type=uint16_t
14700 i16size=2
14701 u16size=2
14702 ;;
14703 esac
14704 fi
14705 ;;
14706esac
14707case "$i16type" in
14708'') if $test $shortsize -ge 2; then
14709 i16type=short
14710 u16type="unsigned short"
14711 i16size=$shortsize
14712 u16size=$shortsize
14713 fi
14714 ;;
14715esac
14716
14717case "$i32type" in
14718'') case "$longsize" in
14719 4) i32type=long
14720 u32type="unsigned long"
14721 i32size=$longsize
14722 u32size=$longsize
14723 ;;
14724 *) case "$intsize" in
14725 4) i32type=int
14726 u32type="unsigned int"
14727 i32size=$intsize
14728 u32size=$intsize
14729 ;;
14730 esac
14731 ;;
14732 esac
14733 ;;
14734esac
14735case "$i32type" in
14736'') set try -DINT32
14737 if eval $compile; then
5440bc8e 14738 case "`$run ./try`" in
b4eb6b3d
JH
14739 int32_t)
14740 i32type=int32_t
14741 u32type=uint32_t
14742 i32size=4
14743 u32size=4
14744 ;;
14745 esac
14746 fi
14747 ;;
14748esac
14749case "$i32type" in
14750'') if $test $intsize -ge 4; then
14751 i32type=int
14752 u32type="unsigned int"
14753 i32size=$intsize
14754 u32size=$intsize
14755 fi
14756 ;;
14757esac
14758
14759case "$i64type" in
14760'') case "$d_quad:$quadtype" in
14761 define:?*)
14762 i64type="$quadtype"
14763 u64type="$uquadtype"
14764 i64size=8
14765 u64size=8
14766 ;;
14767 esac
14768 ;;
14769esac
14770
1d1be0dc
NC
14771$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14772: volatile so that the compiler has to store it out to memory.
14773if test X"$d_volatile" = X"$define"; then
14774 volatile=volatile
14775fi
b4eb6b3d
JH
14776$cat <<EOP >try.c
14777#include <stdio.h>
55954f19
JH
14778#$i_stdlib I_STDLIB
14779#ifdef I_STDLIB
14780#include <stdlib.h>
14781#endif
1d1be0dc
NC
14782#include <sys/types.h>
14783#include <signal.h>
14784#ifdef SIGFPE
14785$volatile int bletched = 0;
14786$signal_t blech(s) int s; { bletched = 1; }
14787#endif
b4eb6b3d
JH
14788int main() {
14789 $uvtype u = 0;
1d1be0dc 14790 $nvtype d;
b4eb6b3d
JH
14791 int n = 8 * $uvsize;
14792 int i;
1d1be0dc
NC
14793#ifdef SIGFPE
14794 signal(SIGFPE, blech);
14795#endif
14796
b4eb6b3d
JH
14797 for (i = 0; i < n; i++) {
14798 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
14799 d = ($nvtype)u;
14800 if (($uvtype)d != u)
b4eb6b3d 14801 break;
1d1be0dc
NC
14802 if (d <= 0)
14803 break;
14804 d = ($nvtype)(u - 1);
14805 if (($uvtype)d != (u - 1))
14806 break;
14807#ifdef SIGFPE
14808 if (bletched) {
14809 break;
14810#endif
14811 }
b4eb6b3d 14812 }
efd1522b 14813 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
14814 exit(0);
14815}
14816EOP
1d1be0dc
NC
14817set try
14818
14819d_nv_preserves_uv="$undef"
14820if eval $compile; then
53133ed1 14821 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 14822fi
53133ed1 14823case "$nv_preserves_uv_bits" in
1d1be0dc 14824\-[1-9]*)
53133ed1
NC
14825 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14826 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 14827 d_nv_preserves_uv="$define"
b4eb6b3d 14828 ;;
53133ed1 14829[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
14830 d_nv_preserves_uv="$undef" ;;
14831*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
53133ed1 14832 nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
14833esac
14834
1d1be0dc
NC
14835$rm -f try.* try
14836
f607920a
CB
14837$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14838: volatile so that the compiler has to store it out to memory.
14839if test X"$d_volatile" = X"$define"; then
14840 volatile=volatile
14841fi
14842$cat <<EOP >try.c
14843#include <stdio.h>
14844#$i_stdlib I_STDLIB
14845#ifdef I_STDLIB
14846#include <stdlib.h>
14847#endif
14848#$i_string I_STRING
14849#ifdef I_STRING
14850# include <string.h>
14851#else
14852# include <strings.h>
14853#endif
14854#include <sys/types.h>
14855#include <signal.h>
14856#ifdef SIGFPE
14857$volatile int bletched = 0;
14858$signal_t blech(s) int s; { bletched = 1; }
14859#endif
14860
14861int checkit($nvtype d, char *where) {
14862 unsigned char *p = (char *)&d;
14863 unsigned char *end = p + sizeof(d);
14864 int fail = 0;
14865
14866 while (p < end)
14867 fail += *p++;
14868
14869 if (!fail)
17f6277d 14870 return 0;
f607920a
CB
14871
14872 p = (char *)&d;
14873 printf("No - %s: 0x", where);
14874 while (p < end)
14875 printf ("%02X", *p++);
14876 printf("\n");
14877 return 1;
14878}
14879
14880int main(int argc, char **argv) {
14881 $nvtype d = 0.0;
14882 int fail = 0;
14883 fail += checkit(d, "0.0");
14884
14885 /* The compiler shouldn't be assuming that bletched is 0 */
14886 d = bletched;
14887
14888 fail += checkit(d, "bleched");
14889
14890#ifdef SIGFPE
14891 signal(SIGFPE, blech);
14892#endif
14893
14894 /* Paranoia - the compiler should have no way of knowing that ANSI says
14895 that argv[argc] will always be NULL. Actually, if it did assume this it
14896 would be buggy, as this is C and main() can be called from elsewhere in
14897 the program. */
14898 d = argv[argc] ? 1 : 0;
14899
14900 if (d) {
14901 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
14902 }
14903
14904 fail += checkit(d, "ternary");
14905
14906 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
14907
14908 if (d != 0.0) {
14909 printf("No - memset doesn't give 0.0\n");
14910 /* This might just blow up: */
14911 printf("(gives %g)\n", d);
14912 return 1;
14913 }
14914
14915#ifdef SIGFPE
14916 if (bletched) {
14917 printf("No - something bleched\n");
14918 return 1;
14919 }
14920#endif
14921 if (fail) {
14922 printf("No - %d fail(s)\n", fail);
14923 return 1;
14924 }
14925 printf("Yes\n");
14926 return 0;
14927}
14928EOP
14929set try
14930
14931d_nv_zero_is_allbits_zero="$undef"
14932if eval $compile; then
14933 xxx="`$run ./try`"
14934 case "$?" in
14935 0)
14936 case "$xxx" in
14937 Yes) cat >&4 <<EOM
149380.0 is represented as all bits zero in memory
14939EOM
14940 d_nv_zero_is_allbits_zero="$define"
14941 ;;
14942 *) cat >&4 <<EOM
149430.0 is not represented as all bits zero in memory
14944EOM
14945 d_nv_zero_is_allbits_zero="$undef"
14946 ;;
14947 esac
14948 ;;
14949 *) cat >&4 <<EOM
149500.0 is not represented as all bits zero in memory
14951EOM
14952 d_nv_zero_is_allbits_zero="$undef"
14953 ;;
14954 esac
14955fi
14956
14957$rm -f try.* try
14958
b4eb6b3d
JH
14959
14960: check for off64_t
14961echo " "
14962echo "Checking to see if you have off64_t..." >&4
14963$cat >try.c <<EOCP
14964#include <sys/types.h>
14965#include <unistd.h>
14966int main() { off64_t x = 7; }
14967EOCP
14968set try
14969if eval $compile; then
14970 val="$define"
14971 echo "You have off64_t."
14972else
14973 val="$undef"
14974 echo "You do not have off64_t."
14975 case "$lseeksize" in
14976 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
14977 esac
14978fi
14979$rm -f try.* try
14980set d_off64_t
14981eval $setvar
14982
b4eb6b3d
JH
14983: how to create joinable pthreads
14984if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
14985 echo " "
14986 echo "Checking what constant to use for creating joinable pthreads..." >&4
14987 $cat >try.c <<'EOCP'
14988#include <pthread.h>
14989int main() {
14990 int detachstate = JOINABLE;
14991}
14992EOCP
14993 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
14994 if eval $compile; then
14995 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
14996 val="$undef" # Yes, undef.
14997 set d_old_pthread_create_joinable
14998 eval $setvar
14999 val=""
15000 set old_pthread_create_joinable
15001 eval $setvar
15002 else
15003 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15004 if eval $compile; then
15005 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15006 val="$define"
15007 set d_old_pthread_create_joinable
15008 eval $setvar
15009 val=PTHREAD_CREATE_UNDETACHED
15010 set old_pthread_create_joinable
15011 eval $setvar
15012 else
15013 set try -DJOINABLE=__UNDETACHED
15014 if eval $compile; then
15015 echo "You seem to use __UNDETACHED." >&4
15016 val="$define"
15017 set d_old_pthread_create_joinable
15018 eval $setvar
15019 val=__UNDETACHED
15020 set old_pthread_create_joinable
15021 eval $setvar
15022 else
15023 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
15024 val="$define"
15025 set d_old_pthread_create_joinable
15026 eval $setvar
15027 val=0
15028 set old_pthread_create_joinable
15029 eval $setvar
15030 fi
15031 fi
15032 fi
15033 $rm -f try try.*
15034else
15035 d_old_pthread_create_joinable="$undef"
15036 old_pthread_create_joinable=""
15037fi
15038
15039: see if pause exists
15040set pause d_pause
15041eval $inlibc
15042
15043: see if pipe exists
15044set pipe d_pipe
15045eval $inlibc
15046
15047: see if poll exists
15048set poll d_poll
15049eval $inlibc
15050
c7aff470
NIS
15051: see if readlink exists
15052set readlink d_readlink
15053eval $inlibc
15054
15055echo " "
f24dbf84 15056procselfexe=''
c7aff470 15057val="$undef"
a33c94aa
JH
15058case "$d_readlink" in
15059"$define")
c7aff470
NIS
15060 if $issymlink /proc/self/exe ; then
15061 $ls -l /proc/self/exe > reflect
51660ed5 15062 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 15063 echo "You have Linux-like /proc/self/exe."
92236451 15064 procselfexe='"/proc/self/exe"'
f24dbf84 15065 val="$define"
f24dbf84
JH
15066 fi
15067 fi
15068 if $issymlink /proc/curproc/file ; then
15069 $ls -l /proc/curproc/file > reflect
15070 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15071 echo "You have BSD-like /proc/curproc/file."
92236451 15072 procselfexe='"/proc/curproc/file"'
f24dbf84 15073 val="$define"
c7aff470 15074 fi
c7aff470 15075 fi
a33c94aa
JH
15076 ;;
15077esac
428dc699 15078$rm -f reflect
c7aff470
NIS
15079set d_procselfexe
15080eval $setvar
15081
263fee3f
JH
15082: see whether the pthread_atfork exists
15083$cat >try.c <<EOP
15084#include <pthread.h>
15085#include <stdio.h>
15086int main() {
15087#ifdef PTHREAD_ATFORK
15088 pthread_atfork(NULL,NULL,NULL);
15089#endif
15090}
15091EOP
15092
d6483fcc 15093: see if pthread_atfork exists
263fee3f
JH
15094set try -DPTHREAD_ATFORK
15095if eval $compile; then
15096 val="$define"
15097else
15098 val="$undef"
15099fi
15100case "$usethreads" in
15101$define)
15102 case "$val" in
15103 $define) echo 'pthread_atfork found.' >&4 ;;
15104 *) echo 'pthread_atfork NOT found.' >&4 ;;
15105 esac
15106esac
15107set d_pthread_atfork
15108eval $setvar
d6483fcc 15109
58d975c3
JH
15110: see if pthread_attr_setscope exists
15111set pthread_attr_setscope d_pthread_attr_setscope
15112eval $inlibc
15113
b4eb6b3d
JH
15114
15115: see whether the various POSIXish _yields exist
15116$cat >try.c <<EOP
15117#include <pthread.h>
15118#include <stdio.h>
15119int main() {
15120#ifdef SCHED_YIELD
15121 sched_yield();
15122#else
15123#ifdef PTHREAD_YIELD
15124 pthread_yield();
15125#else
15126#ifdef PTHREAD_YIELD_NULL
15127 pthread_yield(NULL);
15128#endif
15129#endif
15130#endif
15131}
15132EOP
15133: see if sched_yield exists
15134set try -DSCHED_YIELD
15135if eval $compile; then
15136 val="$define"
15137 sched_yield='sched_yield()'
15138else
15139 val="$undef"
15140fi
15141case "$usethreads" in
15142$define)
15143 case "$val" in
15144 $define) echo 'sched_yield() found.' >&4 ;;
15145 *) echo 'sched_yield() NOT found.' >&4 ;;
15146 esac
15147esac
10bc17b6
JH
15148set d_sched_yield
15149eval $setvar
b4eb6b3d 15150
10bc17b6
JH
15151: see if pthread_yield exists
15152set try -DPTHREAD_YIELD
15153if eval $compile; then
15154 val="$define"
15155 case "$sched_yield" in
15156 '') sched_yield='pthread_yield()' ;;
15157 esac
15158else
15159 set try -DPTHREAD_YIELD_NULL
15160 if eval $compile; then
15161 val="$define"
15162 case "$sched_yield" in
15163 '') sched_yield='pthread_yield(NULL)' ;;
15164 esac
15165 else
15166 val="$undef"
15167 fi
15168fi
15169case "$usethreads" in
15170$define)
15171 case "$val" in
15172 $define) echo 'pthread_yield() found.' >&4 ;;
15173 *) echo 'pthread_yield() NOT found.' >&4 ;;
15174 esac
15175 ;;
15176esac
15177set d_pthread_yield
15178eval $setvar
b4eb6b3d 15179
10bc17b6
JH
15180case "$sched_yield" in
15181'') sched_yield=undef ;;
15182esac
b4eb6b3d 15183
10bc17b6
JH
15184$rm -f try try.*
15185
15186: see if random_r exists
15187set random_r d_random_r
15188eval $inlibc
15189case "$d_random_r" in
15190"$define")
15191 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
15192 case "$d_random_r_proto:$usethreads" in
15193 ":define") d_random_r_proto=define
a48ec845
JH
15194 set d_random_r_proto random_r $hdrs
15195 eval $hasproto ;;
15196 *) ;;
15197 esac
15198 case "$d_random_r_proto" in
15199 define)
10bc17b6
JH
15200 case "$random_r_proto" in
15201 ''|0) try='int random_r(int*, struct random_data*);'
a845a0d4
JH
15202 ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15203 esac
15204 case "$random_r_proto" in
15205 ''|0) try='int random_r(long*, struct random_data*);'
15206 ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15207 esac
15208 case "$random_r_proto" in
15209 ''|0) try='int random_r(struct random_data*, int32_t*);'
15210 ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
15211 esac
15212 case "$random_r_proto" in
90e831dc 15213 ''|0) d_random_r=undef
10bc17b6 15214 random_r_proto=0
a48ec845 15215 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15216 * ) case "$random_r_proto" in
15217 REENTRANT_PROTO*) ;;
15218 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15219 esac
15220 echo "Prototype: $try" ;;
15221 esac
b4eb6b3d 15222 ;;
c18e646a
JH
15223 *) case "$usethreads" in
15224 define) echo "random_r has no prototype, not using it." >&4 ;;
15225 esac
90e831dc
SB
15226 d_random_r=undef
15227 random_r_proto=0
c18e646a 15228 ;;
a48ec845
JH
15229 esac
15230 ;;
10bc17b6 15231*) random_r_proto=0
b4eb6b3d
JH
15232 ;;
15233esac
15234
15235: see if readdir and friends exist
15236set readdir d_readdir
15237eval $inlibc
15238set seekdir d_seekdir
15239eval $inlibc
15240set telldir d_telldir
15241eval $inlibc
15242set rewinddir d_rewinddir
15243eval $inlibc
15244
10bc17b6
JH
15245: see if readdir64_r exists
15246set readdir64_r d_readdir64_r
15247eval $inlibc
15248case "$d_readdir64_r" in
15249"$define")
15250 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15251 case "$d_readdir64_r_proto:$usethreads" in
15252 ":define") d_readdir64_r_proto=define
a48ec845
JH
15253 set d_readdir64_r_proto readdir64_r $hdrs
15254 eval $hasproto ;;
15255 *) ;;
15256 esac
15257 case "$d_readdir64_r_proto" in
15258 define)
10bc17b6
JH
15259 case "$readdir64_r_proto" in
15260 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15261 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15262 esac
15263 case "$readdir64_r_proto" in
15264 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15265 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15266 esac
15267 case "$readdir64_r_proto" in
90e831dc 15268 ''|0) d_readdir64_r=undef
10bc17b6 15269 readdir64_r_proto=0
a48ec845 15270 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15271 * ) case "$readdir64_r_proto" in
15272 REENTRANT_PROTO*) ;;
15273 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15274 esac
15275 echo "Prototype: $try" ;;
15276 esac
15277 ;;
c18e646a
JH
15278 *) case "$usethreads" in
15279 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15280 esac
90e831dc
SB
15281 d_readdir64_r=undef
15282 readdir64_r_proto=0
c18e646a 15283 ;;
a48ec845
JH
15284 esac
15285 ;;
10bc17b6
JH
15286*) readdir64_r_proto=0
15287 ;;
15288esac
15289
15290: see if readdir_r exists
15291set readdir_r d_readdir_r
15292eval $inlibc
15293case "$d_readdir_r" in
15294"$define")
15295 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15296 case "$d_readdir_r_proto:$usethreads" in
15297 ":define") d_readdir_r_proto=define
a48ec845
JH
15298 set d_readdir_r_proto readdir_r $hdrs
15299 eval $hasproto ;;
15300 *) ;;
15301 esac
15302 case "$d_readdir_r_proto" in
15303 define)
10bc17b6
JH
15304 case "$readdir_r_proto" in
15305 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15306 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15307 esac
15308 case "$readdir_r_proto" in
15309 ''|0) try='int readdir_r(DIR*, struct dirent*);'
15310 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15311 esac
15312 case "$readdir_r_proto" in
90e831dc 15313 ''|0) d_readdir_r=undef
10bc17b6 15314 readdir_r_proto=0
a48ec845 15315 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15316 * ) case "$readdir_r_proto" in
15317 REENTRANT_PROTO*) ;;
15318 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15319 esac
15320 echo "Prototype: $try" ;;
15321 esac
15322 ;;
c18e646a
JH
15323 *) case "$usethreads" in
15324 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15325 esac
90e831dc
SB
15326 d_readdir_r=undef
15327 readdir_r_proto=0
c18e646a 15328 ;;
a48ec845
JH
15329 esac
15330 ;;
10bc17b6
JH
15331*) readdir_r_proto=0
15332 ;;
15333esac
15334
4e0554ec
JH
15335: see if readv exists
15336set readv d_readv
15337eval $inlibc
15338
15339: see if recvmsg exists
15340set recvmsg d_recvmsg
15341eval $inlibc
15342
b4eb6b3d
JH
15343: see if rename exists
15344set rename d_rename
15345eval $inlibc
15346
15347: see if rmdir exists
15348set rmdir d_rmdir
15349eval $inlibc
15350
15351: see if memory.h is available.
15352val=''
15353set memory.h val
15354eval $inhdr
15355
15356: See if it conflicts with string.h
15357case "$val" in
15358$define)
15359 case "$strings" in
15360 '') ;;
15361 *)
15362 $cppstdin $cppflags $cppminus < $strings > mem.h
15363 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15364 echo " "
15365 echo "We won't be including <memory.h>."
15366 val="$undef"
15367 fi
15368 $rm -f mem.h
15369 ;;
15370 esac
15371esac
15372set i_memory
15373eval $setvar
15374
15375: can bcopy handle overlapping blocks?
b6cc3bc4 15376echo " "
b4eb6b3d 15377val="$undef"
b6cc3bc4
AD
15378case "$d_memmove" in
15379"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15380*) case "$d_bcopy" in
15381 "$define")
15382 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15383 $cat >try.c <<EOCP
b4eb6b3d
JH
15384#$i_memory I_MEMORY
15385#$i_stdlib I_STDLIB
15386#$i_string I_STRING
15387#$i_unistd I_UNISTD
15388EOCP
15389 $cat >>try.c <<'EOCP'
15390#include <stdio.h>
15391#ifdef I_MEMORY
15392# include <memory.h>
15393#endif
15394#ifdef I_STDLIB
15395# include <stdlib.h>
15396#endif
15397#ifdef I_STRING
15398# include <string.h>
15399#else
15400# include <strings.h>
15401#endif
15402#ifdef I_UNISTD
15403# include <unistd.h> /* Needed for NetBSD */
15404#endif
15405int main()
15406{
15407char buf[128], abc[128];
15408char *b;
15409int len;
15410int off;
15411int align;
15412
b6cc3bc4
AD
15413/* Copy "abcde..." string to char abc[] so that gcc doesn't
15414 try to store the string in read-only memory. */
b4eb6b3d
JH
15415bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15416
15417for (align = 7; align >= 0; align--) {
15418 for (len = 36; len; len--) {
15419 b = buf+align;
15420 bcopy(abc, b, len);
15421 for (off = 1; off <= len; off++) {
15422 bcopy(b, b+off, len);
15423 bcopy(b+off, b, len);
15424 if (bcmp(b, abc, len))
15425 exit(1);
15426 }
15427 }
15428}
15429exit(0);
15430}
15431EOCP
b6cc3bc4
AD
15432 set try
15433 if eval $compile_ok; then
15434 if ./try 2>/dev/null; then
15435 echo "Yes, it can."
15436 val="$define"
15437 else
15438 echo "It can't, sorry."
15439 fi
b4eb6b3d 15440 else
b6cc3bc4 15441 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15442 fi
b6cc3bc4
AD
15443 ;;
15444 esac
15445 $rm -f try.* try core
b4eb6b3d
JH
15446 ;;
15447esac
b4eb6b3d
JH
15448set d_safebcpy
15449eval $setvar
15450
15451: can memcpy handle overlapping blocks?
b6cc3bc4 15452echo " "
b4eb6b3d 15453val="$undef"
b6cc3bc4
AD
15454case "$d_memmove" in
15455"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15456*) case "$d_memcpy" in
15457 "$define")
15458 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15459 $cat >try.c <<EOCP
b4eb6b3d
JH
15460#$i_memory I_MEMORY
15461#$i_stdlib I_STDLIB
15462#$i_string I_STRING
15463#$i_unistd I_UNISTD
15464EOCP
15465 $cat >>try.c <<'EOCP'
15466#include <stdio.h>
15467#ifdef I_MEMORY
15468# include <memory.h>
15469#endif
15470#ifdef I_STDLIB
15471# include <stdlib.h>
15472#endif
15473#ifdef I_STRING
15474# include <string.h>
15475#else
15476# include <strings.h>
15477#endif
15478#ifdef I_UNISTD
15479# include <unistd.h> /* Needed for NetBSD */
15480#endif
15481int main()
15482{
15483char buf[128], abc[128];
15484char *b;
15485int len;
15486int off;
15487int align;
15488
15489/* Copy "abcde..." string to char abc[] so that gcc doesn't
15490 try to store the string in read-only memory. */
15491memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15492
15493for (align = 7; align >= 0; align--) {
15494 for (len = 36; len; len--) {
15495 b = buf+align;
15496 memcpy(b, abc, len);
15497 for (off = 1; off <= len; off++) {
15498 memcpy(b+off, b, len);
15499 memcpy(b, b+off, len);
15500 if (memcmp(b, abc, len))
15501 exit(1);
15502 }
15503 }
15504}
15505exit(0);
15506}
15507EOCP
b6cc3bc4
AD
15508 set try
15509 if eval $compile_ok; then
15510 if ./try 2>/dev/null; then
15511 echo "Yes, it can."
15512 val="$define"
15513 else
15514 echo "It can't, sorry."
15515 fi
b4eb6b3d 15516 else
b6cc3bc4 15517 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15518 fi
b6cc3bc4
AD
15519 ;;
15520 esac
15521 $rm -f try.* try core
b4eb6b3d
JH
15522 ;;
15523esac
b4eb6b3d
JH
15524set d_safemcpy
15525eval $setvar
15526
15527: can memcmp be trusted to compare relative magnitude?
15528val="$undef"
15529case "$d_memcmp" in
15530"$define")
15531 echo " "
15532 echo "Checking if your memcmp() can compare relative magnitude..." >&4
15533 $cat >try.c <<EOCP
15534#$i_memory I_MEMORY
15535#$i_stdlib I_STDLIB
15536#$i_string I_STRING
15537#$i_unistd I_UNISTD
15538EOCP
15539 $cat >>try.c <<'EOCP'
15540#include <stdio.h>
15541#ifdef I_MEMORY
15542# include <memory.h>
15543#endif
15544#ifdef I_STDLIB
36adc09b 15545# include <stdlib.h>
b4eb6b3d
JH
15546#endif
15547#ifdef I_STRING
15548# include <string.h>
15549#else
15550# include <strings.h>
15551#endif
15552#ifdef I_UNISTD
15553# include <unistd.h> /* Needed for NetBSD */
15554#endif
15555int main()
15556{
15557char a = -1;
15558char b = 0;
15559if ((a < b) && memcmp(&a, &b, 1) < 0)
15560 exit(1);
15561exit(0);
15562}
15563EOCP
15564 set try
15565 if eval $compile_ok; then
5440bc8e 15566 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
15567 echo "Yes, it can."
15568 val="$define"
15569 else
15570 echo "No, it can't (it uses signed chars)."
15571 fi
15572 else
15573 echo "(I can't compile the test program, so we'll assume not...)"
15574 fi
15575 ;;
15576esac
15577$rm -f try.* try core
15578set d_sanemcmp
15579eval $setvar
15580
ef9f17be
JH
15581: see if prototype for sbrk is available
15582echo " "
15583set d_sbrkproto sbrk $i_unistd unistd.h
15584eval $hasproto
15585
b4eb6b3d
JH
15586: see if select exists
15587set select d_select
15588eval $inlibc
15589
15590: see if semctl exists
15591set semctl d_semctl
15592eval $inlibc
15593
15594: see if semget exists
15595set semget d_semget
15596eval $inlibc
15597
15598: see if semop exists
15599set semop d_semop
15600eval $inlibc
15601
15602: see how much of the 'sem*(2)' library is present.
15603h_sem=true
15604echo " "
15605case "$d_semctl$d_semget$d_semop" in
15606*"$undef"*) h_sem=false;;
15607esac
15608case "$osname" in
15609freebsd)
15610 case "`ipcs 2>&1`" in
15611 "SVID messages"*"not configured"*)
15612 echo "Your $osname does not have the sem*(2) configured." >&4
15613 h_sem=false
15614 val="$undef"
15615 set semctl d_semctl
15616 eval $setvar
15617 set semget d_semget
15618 eval $setvar
15619 set semop d_semop
15620 eval $setvar
15621 ;;
15622 esac
15623 ;;
15624esac
15625: we could also check for sys/ipc.h ...
15626if $h_sem && $test `./findhdr sys/sem.h`; then
15627 echo "You have the full sem*(2) library." >&4
15628 val="$define"
15629else
15630 echo "You don't have the full sem*(2) library." >&4
15631 val="$undef"
15632fi
15633set d_sem
15634eval $setvar
15635
15636: see whether sys/sem.h defines union semun
15637echo " "
15638$cat > try.c <<'END'
15639#include <sys/types.h>
15640#include <sys/ipc.h>
15641#include <sys/sem.h>
15642int main () { union semun semun; semun.buf = 0; }
15643END
15644set try
15645if eval $compile; then
15646 echo "You have union semun in <sys/sem.h>." >&4
15647 val="$define"
15648else
15649 echo "You do not have union semun in <sys/sem.h>." >&4
15650 val="$undef"
15651fi
2fad75a1 15652$rm -f try try.c
b4eb6b3d
JH
15653set d_union_semun
15654eval $setvar
15655
15656: see how to do semctl IPC_STAT
15657case "$d_sem" in
15658$define)
b4eb6b3d
JH
15659 echo " "
15660 $cat > try.h <<END
15661#ifndef S_IRUSR
15662# ifdef S_IREAD
15663# define S_IRUSR S_IREAD
15664# define S_IWUSR S_IWRITE
15665# define S_IXUSR S_IEXEC
15666# else
15667# define S_IRUSR 0400
15668# define S_IWUSR 0200
15669# define S_IXUSR 0100
15670# endif
15671# define S_IRGRP (S_IRUSR>>3)
15672# define S_IWGRP (S_IWUSR>>3)
15673# define S_IXGRP (S_IXUSR>>3)
15674# define S_IROTH (S_IRUSR>>6)
15675# define S_IWOTH (S_IWUSR>>6)
15676# define S_IXOTH (S_IXUSR>>6)
15677#endif
15678#ifndef S_IRWXU
15679# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15680# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15681# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15682#endif
15683END
2fad75a1
JH
15684 : see whether semctl IPC_STAT can use union semun
15685 val="$undef"
15686 case "$d_semctl_semun" in
15687 '')
15688 $cat > try.c <<END
b4eb6b3d
JH
15689#include <sys/types.h>
15690#include <sys/ipc.h>
15691#include <sys/sem.h>
15692#include <sys/stat.h>
15693#include <stdio.h>
15694#include <errno.h>
15695#include "try.h"
15696#ifndef errno
15697extern int errno;
15698#endif
15699#$d_union_semun HAS_UNION_SEMUN
15700int main() {
15701 union semun
15702#ifndef HAS_UNION_SEMUN
15703 {
15704 int val;
15705 struct semid_ds *buf;
15706 unsigned short *array;
15707 }
15708#endif
15709 arg;
15710 int sem, st;
15711
15712#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15713 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15714 if (sem > -1) {
15715 struct semid_ds argbuf;
15716 arg.buf = &argbuf;
15717# ifdef IPC_STAT
15718 st = semctl(sem, 0, IPC_STAT, arg);
15719 if (st == 0)
15720 printf("semun\n");
15721 else
15722# endif /* IPC_STAT */
15723 printf("semctl IPC_STAT failed: errno = %d\n", errno);
15724# ifdef IPC_RMID
15725 if (semctl(sem, 0, IPC_RMID, arg) != 0)
15726# endif /* IPC_RMID */
15727 printf("semctl IPC_RMID failed: errno = %d\n", errno);
15728 } else
15729#endif /* IPC_PRIVATE && ... */
15730 printf("semget failed: errno = %d\n", errno);
15731 return 0;
15732}
15733END
2fad75a1
JH
15734 set try
15735 if eval $compile; then
15736 xxx=`$run ./try`
15737 case "$xxx" in
15738 semun) val="$define" ;;
15739 esac
15740 fi
15741 $rm -f try try.c
15742 ;;
15743 esac
b4eb6b3d
JH
15744 set d_semctl_semun
15745 eval $setvar
15746 case "$d_semctl_semun" in
15747 $define)
15748 echo "You can use union semun for semctl IPC_STAT." >&4
15749 also='also'
15750 ;;
15751 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
15752 also=''
15753 ;;
15754 esac
15755
15756 : see whether semctl IPC_STAT can use struct semid_ds pointer
2fad75a1
JH
15757 val="$undef"
15758 case "$d_semctl_semid_ds" in
15759 '')
15760 $cat > try.c <<'END'
b4eb6b3d
JH
15761#include <sys/types.h>
15762#include <sys/ipc.h>
15763#include <sys/sem.h>
15764#include <sys/stat.h>
15765#include "try.h"
15766#include <stdio.h>
15767#include <errno.h>
15768#ifndef errno
15769extern int errno;
15770#endif
15771int main() {
15772 struct semid_ds arg;
15773 int sem, st;
15774
15775#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15776 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15777 if (sem > -1) {
15778# ifdef IPC_STAT
15779 st = semctl(sem, 0, IPC_STAT, &arg);
15780 if (st == 0)
15781 printf("semid_ds\n");
15782 else
15783# endif /* IPC_STAT */
15784 printf("semctl IPC_STAT failed: errno = %d\n", errno);
15785# ifdef IPC_RMID
15786 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15787# endif /* IPC_RMID */
15788 printf("semctl IPC_RMID failed: errno = %d\n", errno);
15789 } else
15790#endif /* IPC_PRIVATE && ... */
15791 printf("semget failed: errno = %d\n", errno);
15792
15793 return 0;
15794}
15795END
2fad75a1
JH
15796 set try
15797 if eval $compile; then
15798 xxx=`$run ./try`
15799 case "$xxx" in
15800 semid_ds) val="$define" ;;
15801 esac
15802 fi
15803 $rm -f try try.c
15804 ;;
15805 esac
b4eb6b3d
JH
15806 set d_semctl_semid_ds
15807 eval $setvar
15808 case "$d_semctl_semid_ds" in
15809 $define)
15810 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15811 ;;
15812 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15813 ;;
15814 esac
15815 $rm -f try.h
15816 ;;
15817*) val="$undef"
15818
15819 # We do not have the full sem*(2) library, so assume we can not
15820 # use either.
15821
15822 set d_semctl_semun
15823 eval $setvar
15824
15825 set d_semctl_semid_ds
15826 eval $setvar
15827 ;;
15828esac
15829
4e0554ec
JH
15830: see if sendmsg exists
15831set sendmsg d_sendmsg
15832eval $inlibc
15833
b4eb6b3d
JH
15834: see if setegid exists
15835set setegid d_setegid
15836eval $inlibc
15837
15838: see if seteuid exists
15839set seteuid d_seteuid
15840eval $inlibc
15841
15842: see if setgrent exists
15843set setgrent d_setgrent
15844eval $inlibc
15845
10bc17b6
JH
15846: see if setgrent_r exists
15847set setgrent_r d_setgrent_r
15848eval $inlibc
15849case "$d_setgrent_r" in
15850"$define")
15851 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
15852 case "$d_setgrent_r_proto:$usethreads" in
15853 ":define") d_setgrent_r_proto=define
a48ec845
JH
15854 set d_setgrent_r_proto setgrent_r $hdrs
15855 eval $hasproto ;;
15856 *) ;;
15857 esac
15858 case "$d_setgrent_r_proto" in
15859 define)
10bc17b6
JH
15860 case "$setgrent_r_proto" in
15861 ''|0) try='int setgrent_r(FILE**);'
15862 ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15863 esac
15864 case "$setgrent_r_proto" in
15865 ''|0) try='void setgrent_r(FILE**);'
15866 ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15867 esac
15868 case "$setgrent_r_proto" in
90e831dc 15869 ''|0) d_setgrent_r=undef
10bc17b6 15870 setgrent_r_proto=0
a48ec845 15871 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15872 * ) case "$setgrent_r_proto" in
15873 REENTRANT_PROTO*) ;;
15874 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15875 esac
15876 echo "Prototype: $try" ;;
15877 esac
15878 ;;
c18e646a
JH
15879 *) case "$usethreads" in
15880 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15881 esac
90e831dc
SB
15882 d_setgrent_r=undef
15883 setgrent_r_proto=0
c18e646a 15884 ;;
a48ec845
JH
15885 esac
15886 ;;
10bc17b6
JH
15887*) setgrent_r_proto=0
15888 ;;
15889esac
15890
b4eb6b3d
JH
15891: see if sethostent exists
15892set sethostent d_sethent
15893eval $inlibc
15894
10bc17b6
JH
15895: see if sethostent_r exists
15896set sethostent_r d_sethostent_r
15897eval $inlibc
15898case "$d_sethostent_r" in
15899"$define")
15900 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
15901 case "$d_sethostent_r_proto:$usethreads" in
15902 ":define") d_sethostent_r_proto=define
a48ec845
JH
15903 set d_sethostent_r_proto sethostent_r $hdrs
15904 eval $hasproto ;;
15905 *) ;;
15906 esac
15907 case "$d_sethostent_r_proto" in
15908 define)
10bc17b6
JH
15909 case "$sethostent_r_proto" in
15910 ''|0) try='int sethostent_r(int, struct hostent_data*);'
15911 ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15912 esac
15913 case "$sethostent_r_proto" in
15914 ''|0) try='void sethostent_r(int, struct hostent_data*);'
15915 ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15916 esac
15917 case "$sethostent_r_proto" in
90e831dc 15918 ''|0) d_sethostent_r=undef
10bc17b6 15919 sethostent_r_proto=0
a48ec845 15920 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15921 * ) case "$sethostent_r_proto" in
15922 REENTRANT_PROTO*) ;;
15923 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15924 esac
15925 echo "Prototype: $try" ;;
15926 esac
15927 ;;
c18e646a
JH
15928 *) case "$usethreads" in
15929 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15930 esac
90e831dc
SB
15931 d_sethostent_r=undef
15932 sethostent_r_proto=0
c18e646a 15933 ;;
a48ec845
JH
15934 esac
15935 ;;
10bc17b6
JH
15936*) sethostent_r_proto=0
15937 ;;
15938esac
15939
4e0554ec
JH
15940: see if setitimer exists
15941set setitimer d_setitimer
15942eval $inlibc
15943
b4eb6b3d
JH
15944: see if setlinebuf exists
15945set setlinebuf d_setlinebuf
15946eval $inlibc
15947
15948: see if setlocale exists
15949set setlocale d_setlocale
15950eval $inlibc
15951
10bc17b6
JH
15952: see if locale.h is available
15953set locale.h i_locale
15954eval $inhdr
15955
15956: see if setlocale_r exists
15957set setlocale_r d_setlocale_r
15958eval $inlibc
15959case "$d_setlocale_r" in
15960"$define")
15961 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
15962 case "$d_setlocale_r_proto:$usethreads" in
15963 ":define") d_setlocale_r_proto=define
a48ec845
JH
15964 set d_setlocale_r_proto setlocale_r $hdrs
15965 eval $hasproto ;;
15966 *) ;;
15967 esac
15968 case "$d_setlocale_r_proto" in
15969 define)
10bc17b6
JH
15970 case "$setlocale_r_proto" in
15971 ''|0) try='int setlocale_r(int, const char*, char*, int);'
15972 ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
15973 esac
15974 case "$setlocale_r_proto" in
90e831dc 15975 ''|0) d_setlocale_r=undef
10bc17b6 15976 setlocale_r_proto=0
a48ec845 15977 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15978 * ) case "$setlocale_r_proto" in
15979 REENTRANT_PROTO*) ;;
15980 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
15981 esac
15982 echo "Prototype: $try" ;;
15983 esac
15984 ;;
c18e646a
JH
15985 *) case "$usethreads" in
15986 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
15987 esac
90e831dc
SB
15988 d_setlocale_r=undef
15989 setlocale_r_proto=0
c18e646a 15990 ;;
a48ec845
JH
15991 esac
15992 ;;
10bc17b6
JH
15993*) setlocale_r_proto=0
15994 ;;
15995esac
15996
b4eb6b3d
JH
15997: see if setnetent exists
15998set setnetent d_setnent
15999eval $inlibc
16000
10bc17b6
JH
16001: see if setnetent_r exists
16002set setnetent_r d_setnetent_r
16003eval $inlibc
16004case "$d_setnetent_r" in
16005"$define")
16006 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16007 case "$d_setnetent_r_proto:$usethreads" in
16008 ":define") d_setnetent_r_proto=define
a48ec845
JH
16009 set d_setnetent_r_proto setnetent_r $hdrs
16010 eval $hasproto ;;
16011 *) ;;
16012 esac
16013 case "$d_setnetent_r_proto" in
16014 define)
10bc17b6
JH
16015 case "$setnetent_r_proto" in
16016 ''|0) try='int setnetent_r(int, struct netent_data*);'
16017 ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16018 esac
16019 case "$setnetent_r_proto" in
16020 ''|0) try='void setnetent_r(int, struct netent_data*);'
16021 ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16022 esac
16023 case "$setnetent_r_proto" in
90e831dc 16024 ''|0) d_setnetent_r=undef
10bc17b6 16025 setnetent_r_proto=0
a48ec845 16026 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16027 * ) case "$setnetent_r_proto" in
16028 REENTRANT_PROTO*) ;;
16029 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16030 esac
16031 echo "Prototype: $try" ;;
16032 esac
16033 ;;
c18e646a
JH
16034 *) case "$usethreads" in
16035 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16036 esac
90e831dc
SB
16037 d_setnetent_r=undef
16038 setnetent_r_proto=0
c18e646a 16039 ;;
a48ec845
JH
16040 esac
16041 ;;
10bc17b6
JH
16042*) setnetent_r_proto=0
16043 ;;
16044esac
16045
b4eb6b3d
JH
16046: see if setprotoent exists
16047set setprotoent d_setpent
16048eval $inlibc
16049
16050: see if setpgid exists
16051set setpgid d_setpgid
16052eval $inlibc
16053
16054: see if setpgrp2 exists
16055set setpgrp2 d_setpgrp2
16056eval $inlibc
16057
16058: see if setpriority exists
16059set setpriority d_setprior
16060eval $inlibc
16061
16062: see if setproctitle exists
16063set setproctitle d_setproctitle
16064eval $inlibc
16065
10bc17b6
JH
16066: see if setprotoent_r exists
16067set setprotoent_r d_setprotoent_r
16068eval $inlibc
16069case "$d_setprotoent_r" in
16070"$define")
16071 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16072 case "$d_setprotoent_r_proto:$usethreads" in
16073 ":define") d_setprotoent_r_proto=define
a48ec845
JH
16074 set d_setprotoent_r_proto setprotoent_r $hdrs
16075 eval $hasproto ;;
16076 *) ;;
16077 esac
16078 case "$d_setprotoent_r_proto" in
16079 define)
10bc17b6
JH
16080 case "$setprotoent_r_proto" in
16081 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16082 ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16083 esac
16084 case "$setprotoent_r_proto" in
16085 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16086 ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16087 esac
16088 case "$setprotoent_r_proto" in
90e831dc 16089 ''|0) d_setprotoent_r=undef
10bc17b6 16090 setprotoent_r_proto=0
a48ec845 16091 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16092 * ) case "$setprotoent_r_proto" in
16093 REENTRANT_PROTO*) ;;
16094 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16095 esac
16096 echo "Prototype: $try" ;;
16097 esac
16098 ;;
c18e646a
JH
16099 *) case "$usethreads" in
16100 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16101 esac
90e831dc
SB
16102 d_setprotoent_r=undef
16103 setprotoent_r_proto=0
c18e646a 16104 ;;
a48ec845
JH
16105 esac
16106 ;;
10bc17b6
JH
16107*) setprotoent_r_proto=0
16108 ;;
16109esac
16110
b4eb6b3d
JH
16111: see if setpwent exists
16112set setpwent d_setpwent
16113eval $inlibc
16114
10bc17b6
JH
16115: see if setpwent_r exists
16116set setpwent_r d_setpwent_r
16117eval $inlibc
16118case "$d_setpwent_r" in
16119"$define")
16120 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
16121 case "$d_setpwent_r_proto:$usethreads" in
16122 ":define") d_setpwent_r_proto=define
a48ec845
JH
16123 set d_setpwent_r_proto setpwent_r $hdrs
16124 eval $hasproto ;;
16125 *) ;;
16126 esac
16127 case "$d_setpwent_r_proto" in
16128 define)
10bc17b6
JH
16129 case "$setpwent_r_proto" in
16130 ''|0) try='int setpwent_r(FILE**);'
16131 ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16132 esac
16133 case "$setpwent_r_proto" in
16134 ''|0) try='void setpwent_r(FILE**);'
16135 ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16136 esac
16137 case "$setpwent_r_proto" in
90e831dc 16138 ''|0) d_setpwent_r=undef
10bc17b6 16139 setpwent_r_proto=0
a48ec845 16140 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16141 * ) case "$setpwent_r_proto" in
16142 REENTRANT_PROTO*) ;;
16143 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16144 esac
16145 echo "Prototype: $try" ;;
16146 esac
16147 ;;
c18e646a
JH
16148 *) case "$usethreads" in
16149 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16150 esac
90e831dc
SB
16151 d_setpwent_r=undef
16152 setpwent_r_proto=0
c18e646a 16153 ;;
a48ec845
JH
16154 esac
16155 ;;
10bc17b6
JH
16156*) setpwent_r_proto=0
16157 ;;
16158esac
16159
b4eb6b3d
JH
16160: see if setregid exists
16161set setregid d_setregid
16162eval $inlibc
16163set setresgid d_setresgid
16164eval $inlibc
16165
16166: see if setreuid exists
16167set setreuid d_setreuid
16168eval $inlibc
16169set setresuid d_setresuid
16170eval $inlibc
16171
16172: see if setrgid exists
16173set setrgid d_setrgid
16174eval $inlibc
16175
16176: see if setruid exists
16177set setruid d_setruid
16178eval $inlibc
16179
16180: see if setservent exists
16181set setservent d_setsent
16182eval $inlibc
16183
10bc17b6
JH
16184: see if setservent_r exists
16185set setservent_r d_setservent_r
16186eval $inlibc
16187case "$d_setservent_r" in
16188"$define")
16189 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16190 case "$d_setservent_r_proto:$usethreads" in
16191 ":define") d_setservent_r_proto=define
a48ec845
JH
16192 set d_setservent_r_proto setservent_r $hdrs
16193 eval $hasproto ;;
16194 *) ;;
16195 esac
16196 case "$d_setservent_r_proto" in
16197 define)
10bc17b6
JH
16198 case "$setservent_r_proto" in
16199 ''|0) try='int setservent_r(int, struct servent_data*);'
16200 ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16201 esac
16202 case "$setservent_r_proto" in
16203 ''|0) try='void setservent_r(int, struct servent_data*);'
16204 ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16205 esac
16206 case "$setservent_r_proto" in
90e831dc 16207 ''|0) d_setservent_r=undef
10bc17b6 16208 setservent_r_proto=0
a48ec845 16209 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16210 * ) case "$setservent_r_proto" in
16211 REENTRANT_PROTO*) ;;
16212 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16213 esac
16214 echo "Prototype: $try" ;;
16215 esac
16216 ;;
c18e646a
JH
16217 *) case "$usethreads" in
16218 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16219 esac
90e831dc
SB
16220 d_setservent_r=undef
16221 setservent_r_proto=0
c18e646a 16222 ;;
a48ec845
JH
16223 esac
16224 ;;
10bc17b6
JH
16225*) setservent_r_proto=0
16226 ;;
16227esac
16228
b4eb6b3d
JH
16229: see if setsid exists
16230set setsid d_setsid
16231eval $inlibc
16232
16233: see if setvbuf exists
16234set setvbuf d_setvbuf
16235eval $inlibc
16236
16237: see if sfio.h is available
16238set sfio.h i_sfio
16239eval $inhdr
16240
16241
16242: see if sfio library is available
16243case "$i_sfio" in
16244$define)
16245 val=''
16246 set sfreserve val
16247 eval $inlibc
16248 ;;
16249*)
16250 val="$undef"
16251 ;;
16252esac
16253: Ok, but do we want to use it.
16254case "$val" in
16255$define)
16256 case "$usesfio" in
16257 true|$define|[yY]*) dflt='y';;
16258 *) dflt='n';;
16259 esac
16260 echo "$package can use the sfio library, but it is experimental."
16261 case "$useperlio" in
16262 "$undef")
16263 echo "For sfio also the PerlIO abstraction layer is needed."
16264 echo "Earlier you said you wouldn't want that."
16265 ;;
16266 esac
16267 rp="You seem to have sfio available, do you want to try using it?"
16268 . ./myread
16269 case "$ans" in
16270 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
16271 useperlio="$define"
16272 val="$define"
16273 ;;
16274 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
16275 val="$undef"
b4eb6b3d
JH
16276 ;;
16277 esac
16278 ;;
16279*) case "$usesfio" in
16280 true|$define|[yY]*)
16281 echo "Sorry, cannot find sfio on this machine." >&4
16282 echo "Ignoring your setting of usesfio=$usesfio." >&4
16283 val="$undef"
16284 ;;
16285 esac
16286 ;;
16287esac
16288set d_sfio
16289eval $setvar
16290case "$d_sfio" in
16291$define) usesfio='true';;
16292*) usesfio='false';;
16293esac
3659ebf1
JH
16294case "$d_sfio" in
16295$define) ;;
16296*) : Remove sfio from list of libraries to use
7483f793
JH
16297 case "$libs" in
16298 *-lsfio*)
16299 echo "Removing unneeded -lsfio from library list" >&4
16300 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16301 shift
16302 libs="$*"
16303 echo "libs = $libs" >&4
16304 ;;
16305 esac
3659ebf1
JH
16306;;
16307esac
16308
b4eb6b3d
JH
16309
16310: see if shmctl exists
16311set shmctl d_shmctl
16312eval $inlibc
16313
16314: see if shmget exists
16315set shmget d_shmget
16316eval $inlibc
16317
16318: see if shmat exists
16319set shmat d_shmat
16320eval $inlibc
16321: see what shmat returns
16322case "$d_shmat" in
16323"$define")
16324 $cat >shmat.c <<'END'
16325#include <sys/shm.h>
16326void *shmat();
16327END
16328 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16329 shmattype='void *'
16330 else
16331 shmattype='char *'
16332 fi
16333 echo "and it returns ($shmattype)." >&4
16334 : see if a prototype for shmat is available
16335 xxx=`./findhdr sys/shm.h`
16336 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16337 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16338 val="$define"
16339 else
16340 val="$undef"
16341 fi
16342 $rm -f shmat.[co]
16343 ;;
16344*)
16345 val="$undef"
16346 ;;
16347esac
16348set d_shmatprototype
16349eval $setvar
16350
16351: see if shmdt exists
16352set shmdt d_shmdt
16353eval $inlibc
16354
16355: see how much of the 'shm*(2)' library is present.
16356h_shm=true
16357echo " "
16358case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16359*"$undef"*) h_shm=false;;
16360esac
16361case "$osname" in
16362freebsd)
16363 case "`ipcs 2>&1`" in
16364 "SVID shared memory"*"not configured"*)
16365 echo "Your $osname does not have the shm*(2) configured." >&4
16366 h_shm=false
16367 val="$undef"
16368 set shmctl d_shmctl
16369 evat $setvar
16370 set shmget d_shmget
16371 evat $setvar
16372 set shmat d_shmat
16373 evat $setvar
16374 set shmdt d_shmdt
16375 evat $setvar
16376 ;;
16377 esac
16378 ;;
16379esac
16380: we could also check for sys/ipc.h ...
16381if $h_shm && $test `./findhdr sys/shm.h`; then
16382 echo "You have the full shm*(2) library." >&4
16383 val="$define"
16384else
16385 echo "You don't have the full shm*(2) library." >&4
16386 val="$undef"
16387fi
16388set d_shm
16389eval $setvar
16390
16391echo " "
16392: see if we have sigaction
16393if set sigaction val -f d_sigaction; eval $csym; $val; then
16394 echo 'sigaction() found.' >&4
073b6de5 16395 $cat > try.c <<EOP
b4eb6b3d
JH
16396#include <stdio.h>
16397#include <sys/types.h>
16398#include <signal.h>
073b6de5
JH
16399#$i_stdlib I_STDLIB
16400#ifdef I_STDLIB
16401#include <stdlib.h>
16402#endif
b4eb6b3d
JH
16403int main()
16404{
16405 struct sigaction act, oact;
16406 act.sa_flags = 0;
16407 oact.sa_handler = 0;
16408 /* so that act and oact are used */
16409 exit(act.sa_flags == 0 && oact.sa_handler == 0);
16410}
16411EOP
16412 set try
16413 if eval $compile_ok; then
16414 val="$define"
16415 else
16416 echo "But you don't seem to have a useable struct sigaction." >&4
16417 val="$undef"
16418 fi
16419else
16420 echo 'sigaction NOT found.' >&4
16421 val="$undef"
16422fi
16423set d_sigaction; eval $setvar
16424$rm -f try try$_o try.c
16425
983dbef6
JH
16426: see if sigprocmask exists
16427set sigprocmask d_sigprocmask
16428eval $inlibc
16429
b4eb6b3d
JH
16430: see if sigsetjmp exists
16431echo " "
16432case "$d_sigsetjmp" in
16433'')
c727eafa 16434 $cat >try.c <<EOP
b4eb6b3d 16435#include <setjmp.h>
d1daaddf
JH
16436#$i_stdlib I_STDLIB
16437#ifdef I_STDLIB
16438#include <stdlib.h>
16439#endif
b4eb6b3d
JH
16440sigjmp_buf env;
16441int set = 1;
16442int main()
16443{
16444 if (sigsetjmp(env,1))
16445 exit(set);
16446 set = 0;
16447 siglongjmp(env, 1);
16448 exit(1);
16449}
16450EOP
16451 set try
16452 if eval $compile; then
5440bc8e 16453 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
16454 echo "POSIX sigsetjmp found." >&4
16455 val="$define"
16456 else
16457 $cat >&4 <<EOM
16458Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16459I'll ignore them.
16460EOM
16461 val="$undef"
16462 fi
16463 else
16464 echo "sigsetjmp not found." >&4
16465 val="$undef"
16466 fi
16467 ;;
16468*) val="$d_sigsetjmp"
16469 case "$d_sigsetjmp" in
16470 $define) echo "POSIX sigsetjmp found." >&4;;
16471 $undef) echo "sigsetjmp not found." >&4;;
16472 esac
16473 ;;
16474esac
16475set d_sigsetjmp
16476eval $setvar
16477$rm -f try.c try
16478
49a78c82
JH
16479: see if sockatmark exists
16480set sockatmark d_sockatmark
16481eval $inlibc
16482
2ef53570
JH
16483: see if prototype for sockatmark is available
16484echo " "
16485set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16486eval $hasproto
16487
b4eb6b3d
JH
16488: see if socks5_init exists
16489set socks5_init d_socks5_init
16490eval $inlibc
16491
10bc17b6
JH
16492: see if srand48_r exists
16493set srand48_r d_srand48_r
16494eval $inlibc
16495case "$d_srand48_r" in
16496"$define")
16497 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16498 case "$d_srand48_r_proto:$usethreads" in
16499 ":define") d_srand48_r_proto=define
a48ec845
JH
16500 set d_srand48_r_proto srand48_r $hdrs
16501 eval $hasproto ;;
16502 *) ;;
16503 esac
16504 case "$d_srand48_r_proto" in
16505 define)
10bc17b6
JH
16506 case "$srand48_r_proto" in
16507 ''|0) try='int srand48_r(long, struct drand48_data*);'
16508 ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16509 esac
16510 case "$srand48_r_proto" in
90e831dc 16511 ''|0) d_srand48_r=undef
10bc17b6 16512 srand48_r_proto=0
a48ec845 16513 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16514 * ) case "$srand48_r_proto" in
16515 REENTRANT_PROTO*) ;;
16516 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16517 esac
16518 echo "Prototype: $try" ;;
16519 esac
16520 ;;
c18e646a
JH
16521 *) case "$usethreads" in
16522 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16523 esac
90e831dc
SB
16524 d_srand48_r=undef
16525 srand48_r_proto=0
c18e646a 16526 ;;
a48ec845
JH
16527 esac
16528 ;;
10bc17b6
JH
16529*) srand48_r_proto=0
16530 ;;
16531esac
16532
16533: see if srandom_r exists
16534set srandom_r d_srandom_r
16535eval $inlibc
16536case "$d_srandom_r" in
16537"$define")
16538 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16539 case "$d_srandom_r_proto:$usethreads" in
16540 ":define") d_srandom_r_proto=define
a48ec845
JH
16541 set d_srandom_r_proto srandom_r $hdrs
16542 eval $hasproto ;;
16543 *) ;;
16544 esac
16545 case "$d_srandom_r_proto" in
16546 define)
10bc17b6
JH
16547 case "$srandom_r_proto" in
16548 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16549 ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16550 esac
16551 case "$srandom_r_proto" in
90e831dc 16552 ''|0) d_srandom_r=undef
10bc17b6 16553 srandom_r_proto=0
a48ec845 16554 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16555 * ) case "$srandom_r_proto" in
16556 REENTRANT_PROTO*) ;;
16557 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16558 esac
16559 echo "Prototype: $try" ;;
16560 esac
16561 ;;
c18e646a
JH
16562 *) case "$usethreads" in
16563 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16564 esac
90e831dc
SB
16565 d_srandom_r=undef
16566 srandom_r_proto=0
c18e646a 16567 ;;
a48ec845
JH
16568 esac
16569 ;;
10bc17b6
JH
16570*) srandom_r_proto=0
16571 ;;
16572esac
16573
eef837ea
JH
16574: see if prototype for setresgid is available
16575echo " "
16576set d_sresgproto setresgid $i_unistd unistd.h
16577eval $hasproto
16578
640374d0
JH
16579: see if prototype for setresuid is available
16580echo " "
16581set d_sresuproto setresuid $i_unistd unistd.h
16582eval $hasproto
16583
b4eb6b3d
JH
16584: see if sys/stat.h is available
16585set sys/stat.h i_sysstat
16586eval $inhdr
16587
16588
16589: see if stat knows about block sizes
16590echo " "
16591echo "Checking to see if your struct stat has st_blocks field..." >&4
16592set d_statblks stat st_blocks $i_sysstat sys/stat.h
16593eval $hasfield
16594
16595
16596: see if this is a sys/vfs.h system
16597set sys/vfs.h i_sysvfs
16598eval $inhdr
16599
16600
16601: see if this is a sys/statfs.h system
16602set sys/statfs.h i_sysstatfs
16603eval $inhdr
16604
16605
16606echo " "
16607echo "Checking to see if your system supports struct statfs..." >&4
16608set 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
16609eval $hasstruct
16610case "$d_statfs_s" in
16611"$define") echo "Yes, it does." ;;
16612*) echo "No, it doesn't." ;;
16613esac
16614
16615
16616
16617: see if struct statfs knows about f_flags
16618case "$d_statfs_s" in
16619define)
16620 echo " "
16621 echo "Checking to see if your struct statfs has f_flags field..." >&4
16622 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
16623 eval $hasfield
16624 ;;
16625*) val="$undef"
16626 set d_statfs_f_flags
16627 eval $setvar
16628 ;;
16629esac
16630case "$d_statfs_f_flags" in
16631"$define") echo "Yes, it does." ;;
16632*) echo "No, it doesn't." ;;
16633esac
16634
b4eb6b3d
JH
16635$cat >&4 <<EOM
16636Checking how to access stdio streams by file descriptor number...
16637EOM
16638case "$stdio_stream_array" in
16639'') $cat >try.c <<EOCP
16640#include <stdio.h>
16641int main() {
16642 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16643 printf("yes\n");
16644}
16645EOCP
16646 for s in _iob __iob __sF
16647 do
16648 set try -DSTDIO_STREAM_ARRAY=$s
16649 if eval $compile; then
5440bc8e 16650 case "`$run ./try`" in
b4eb6b3d
JH
16651 yes) stdio_stream_array=$s; break ;;
16652 esac
16653 fi
16654 done
16655 $rm -f try.* try$exe_ext
16656esac
16657case "$stdio_stream_array" in
16658'') $cat >&4 <<EOM
16659I can't figure out how to access stdio streams by file descriptor number.
16660EOM
16661 d_stdio_stream_array="$undef"
16662 ;;
16663*) $cat >&4 <<EOM
16664You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16665EOM
16666 d_stdio_stream_array="$define"
16667 ;;
16668esac
16669
16670: see if strcoll exists
16671set strcoll d_strcoll
16672eval $inlibc
16673
16674: check for structure copying
16675echo " "
16676echo "Checking to see if your C compiler can copy structs..." >&4
16677$cat >try.c <<'EOCP'
76f47787 16678int main()
b4eb6b3d
JH
16679{
16680 struct blurfl {
16681 int dyick;
16682 } foo, bar;
16683
16684 foo = bar;
16685}
16686EOCP
16687if $cc -c try.c >/dev/null 2>&1 ; then
16688 val="$define"
16689 echo "Yup, it can."
16690else
16691 val="$undef"
16692 echo "Nope, it can't."
16693fi
16694set d_strctcpy
16695eval $setvar
16696$rm -f try.*
16697
16698: see if strerror and/or sys_errlist[] exist
16699echo " "
16700if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16701 if set strerror val -f d_strerror; eval $csym; $val; then
16702 echo 'strerror() found.' >&4
16703 d_strerror="$define"
16704 d_strerrm='strerror(e)'
16705 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16706 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
16707 d_syserrlst="$define"
16708 else
16709 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16710 d_syserrlst="$undef"
16711 fi
16712 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16713 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16714 echo 'strerror() found in string header.' >&4
16715 d_strerror="$define"
16716 d_strerrm='strerror(e)'
16717 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16718 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16719 d_syserrlst="$define"
16720 else
16721 echo "(You don't appear to have any sys_errlist[], how can this be?)"
16722 d_syserrlst="$undef"
16723 fi
16724 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16725 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16726 d_strerror="$undef"
16727 d_syserrlst="$define"
16728 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16729 else
16730 echo 'strerror() and sys_errlist[] NOT found.' >&4
16731 d_strerror="$undef"
16732 d_syserrlst="$undef"
16733 d_strerrm='"unknown"'
16734 fi
16735fi
16736
10bc17b6
JH
16737: see if strerror_r exists
16738set strerror_r d_strerror_r
16739eval $inlibc
16740case "$d_strerror_r" in
16741"$define")
16742 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
16743 case "$d_strerror_r_proto:$usethreads" in
16744 ":define") d_strerror_r_proto=define
a48ec845
JH
16745 set d_strerror_r_proto strerror_r $hdrs
16746 eval $hasproto ;;
16747 *) ;;
16748 esac
16749 case "$d_strerror_r_proto" in
16750 define)
10bc17b6
JH
16751 case "$strerror_r_proto" in
16752 ''|0) try='int strerror_r(int, char*, size_t);'
16753 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16754 esac
16755 case "$strerror_r_proto" in
16756 ''|0) try='int strerror_r(int, char*, int);'
16757 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16758 esac
16759 case "$strerror_r_proto" in
16760 ''|0) try='char* strerror_r(int, char*, size_t);'
16761 ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16762 esac
16763 case "$strerror_r_proto" in
90e831dc 16764 ''|0) d_strerror_r=undef
10bc17b6 16765 strerror_r_proto=0
a48ec845 16766 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16767 * ) case "$strerror_r_proto" in
16768 REENTRANT_PROTO*) ;;
16769 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16770 esac
16771 echo "Prototype: $try" ;;
16772 esac
16773 ;;
c18e646a
JH
16774 *) case "$usethreads" in
16775 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16776 esac
90e831dc
SB
16777 d_strerror_r=undef
16778 strerror_r_proto=0
c18e646a 16779 ;;
a48ec845
JH
16780 esac
16781 ;;
10bc17b6
JH
16782*) strerror_r_proto=0
16783 ;;
16784esac
16785
b3c85772
JH
16786: see if strftime exists
16787set strftime d_strftime
16788eval $inlibc
16789
08c92000
MB
16790: see if strlcat exists
16791set strlcat d_strlcat
16792eval $inlibc
16793
16794: see if strlcpy exists
16795set strlcpy d_strlcpy
16796eval $inlibc
16797
b4eb6b3d
JH
16798: see if strtod exists
16799set strtod d_strtod
16800eval $inlibc
16801
16802: see if strtol exists
16803set strtol d_strtol
16804eval $inlibc
16805
16806: see if strtold exists
16807set strtold d_strtold
16808eval $inlibc
16809
16810: see if strtoll exists
16811set strtoll d_strtoll
16812eval $inlibc
16813
16814case "$d_longlong-$d_strtoll" in
16815"$define-$define")
16816 $cat <<EOM
16817Checking whether your strtoll() works okay...
16818EOM
16819 $cat >try.c <<'EOCP'
16820#include <errno.h>
16821#ifdef __hpux
16822#define strtoll __strtoll
16823#endif
e75931a7
YST
16824#ifdef __EMX__
16825#define strtoll _strtoll
16826#endif
b4eb6b3d
JH
16827#include <stdio.h>
16828extern long long int strtoll(char *s, char **, int);
16829static int bad = 0;
16830int check(char *s, long long ell, int een) {
16831 long long gll;
16832 errno = 0;
16833 gll = strtoll(s, 0, 10);
16834 if (!((gll == ell) && (errno == een)))
16835 bad++;
16836}
16837int main() {
16838 check(" 1", 1LL, 0);
16839 check(" 0", 0LL, 0);
16840 check("-1", -1LL, 0);
16841 check("-9223372036854775808", -9223372036854775808LL, 0);
16842 check("-9223372036854775808", -9223372036854775808LL, 0);
16843 check(" 9223372036854775807", 9223372036854775807LL, 0);
16844 check("-9223372036854775808", -9223372036854775808LL, 0);
16845 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
16846 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16847 if (!bad)
16848 printf("ok\n");
16849}
16850EOCP
16851 set try
16852 if eval $compile; then
5440bc8e 16853 yyy=`$run ./try`
e75931a7 16854 case "$yyy" in
b4eb6b3d
JH
16855 ok) echo "Your strtoll() seems to be working okay." ;;
16856 *) cat <<EOM >&4
16857Your strtoll() doesn't seem to be working okay.
16858EOM
16859 d_strtoll="$undef"
16860 ;;
69eadf66 16861 esac
e75931a7
YST
16862 else
16863 echo "(I can't seem to compile the test program--assuming it doesn't)"
16864 d_strtoll="$undef"
b4eb6b3d
JH
16865 fi
16866 ;;
16867esac
16868
28e5dec8
JH
16869: see if strtoq exists
16870set strtoq d_strtoq
16871eval $inlibc
16872
b4eb6b3d
JH
16873: see if strtoul exists
16874set strtoul d_strtoul
16875eval $inlibc
16876
d0e6d399
NC
16877case "$d_strtoul" in
16878"$define")
16879 $cat <<EOM
16880Checking whether your strtoul() works okay...
16881EOM
16882 $cat >try.c <<'EOCP'
16883#include <errno.h>
16884#include <stdio.h>
16885extern unsigned long int strtoul(char *s, char **, int);
16886static int bad = 0;
16887void check(char *s, unsigned long eul, int een) {
16888 unsigned long gul;
16889 errno = 0;
16890 gul = strtoul(s, 0, 10);
16891 if (!((gul == eul) && (errno == een)))
16892 bad++;
16893}
16894int main() {
16895 check(" 1", 1L, 0);
16896 check(" 0", 0L, 0);
16897EOCP
16898 case "$longsize" in
16899 8)
16900 $cat >>try.c <<'EOCP'
09c0d2c4
JH
16901 check("18446744073709551615", 18446744073709551615UL, 0);
16902 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 16903#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 16904 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
16905 check("-18446744073709551614", 2, 0);
16906 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
16907 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16908 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 16909#endif
d0e6d399
NC
16910EOCP
16911 ;;
16912 4)
16913 $cat >>try.c <<'EOCP'
16914 check("4294967295", 4294967295UL, 0);
16915 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 16916#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
16917 check("-1", 4294967295UL, 0);
16918 check("-4294967294", 2, 0);
16919 check("-4294967295", 1, 0);
16920 check("-4294967296", 4294967295UL, ERANGE);
16921 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 16922#endif
d0e6d399
NC
16923EOCP
16924 ;;
16925 *)
16926: Should we write these tests to be more portable by sprintf-ing
16927: ~0 and then manipulating that char string as input for strtol?
16928 ;;
16929 esac
16930 $cat >>try.c <<'EOCP'
16931 if (!bad)
16932 printf("ok\n");
16933 return 0;
16934}
16935EOCP
16936 set try
16937 if eval $compile; then
5440bc8e 16938 case "`$run ./try`" in
d0e6d399
NC
16939 ok) echo "Your strtoul() seems to be working okay." ;;
16940 *) cat <<EOM >&4
16941Your strtoul() doesn't seem to be working okay.
16942EOM
16943 d_strtoul="$undef"
16944 ;;
16945 esac
16946 fi
16947 ;;
16948esac
16949
b4eb6b3d
JH
16950: see if strtoull exists
16951set strtoull d_strtoull
16952eval $inlibc
16953
16954case "$d_longlong-$d_strtoull" in
16955"$define-$define")
16956 $cat <<EOM
16957Checking whether your strtoull() works okay...
16958EOM
16959 $cat >try.c <<'EOCP'
16960#include <errno.h>
16961#ifdef __hpux
16962#define strtoull __strtoull
16963#endif
16964#include <stdio.h>
16965extern unsigned long long int strtoull(char *s, char **, int);
16966static int bad = 0;
16967int check(char *s, long long eull, int een) {
16968 long long gull;
16969 errno = 0;
16970 gull = strtoull(s, 0, 10);
16971 if (!((gull == eull) && (errno == een)))
16972 bad++;
16973}
16974int main() {
d0e6d399
NC
16975 check(" 1", 1LL, 0);
16976 check(" 0", 0LL, 0);
16977 check("18446744073709551615", 18446744073709551615ULL, 0);
16978 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 16979#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
16980 check("-1", 18446744073709551615ULL, 0);
16981 check("-18446744073709551614", 2LL, 0);
16982 check("-18446744073709551615", 1LL, 0);
16983 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16984 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 16985#endif
b4eb6b3d
JH
16986 if (!bad)
16987 printf("ok\n");
16988}
16989EOCP
16990 set try
16991 if eval $compile; then
5440bc8e 16992 case "`$run ./try`" in
b4eb6b3d
JH
16993 ok) echo "Your strtoull() seems to be working okay." ;;
16994 *) cat <<EOM >&4
16995Your strtoull() doesn't seem to be working okay.
16996EOM
16997 d_strtoull="$undef"
16998 ;;
16999 esac
17000 fi
17001 ;;
17002esac
17003
17004: see if strtouq exists
17005set strtouq d_strtouq
17006eval $inlibc
17007
d0e6d399
NC
17008case "$d_strtouq" in
17009"$define")
17010 $cat <<EOM
17011Checking whether your strtouq() works okay...
17012EOM
17013 $cat >try.c <<'EOCP'
17014#include <errno.h>
17015#include <stdio.h>
17016extern unsigned long long int strtouq(char *s, char **, int);
17017static int bad = 0;
17018void check(char *s, unsigned long long eull, int een) {
17019 unsigned long long gull;
17020 errno = 0;
17021 gull = strtouq(s, 0, 10);
17022 if (!((gull == eull) && (errno == een)))
17023 bad++;
17024}
17025int main() {
17026 check(" 1", 1LL, 0);
17027 check(" 0", 0LL, 0);
17028 check("18446744073709551615", 18446744073709551615ULL, 0);
17029 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 17030#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
17031 check("-1", 18446744073709551615ULL, 0);
17032 check("-18446744073709551614", 2LL, 0);
17033 check("-18446744073709551615", 1LL, 0);
17034 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17035 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 17036#endif
d0e6d399
NC
17037 if (!bad)
17038 printf("ok\n");
17039 return 0;
17040}
17041EOCP
17042 set try
17043 if eval $compile; then
5440bc8e 17044 case "`$run ./try`" in
d0e6d399
NC
17045 ok) echo "Your strtouq() seems to be working okay." ;;
17046 *) cat <<EOM >&4
17047Your strtouq() doesn't seem to be working okay.
17048EOM
17049 d_strtouq="$undef"
17050 ;;
17051 esac
17052 fi
17053 ;;
17054esac
17055
b4eb6b3d
JH
17056: see if strxfrm exists
17057set strxfrm d_strxfrm
17058eval $inlibc
17059
17060: see if symlink exists
17061set symlink d_symlink
17062eval $inlibc
17063
17064: see if syscall exists
17065set syscall d_syscall
17066eval $inlibc
17067
2ef53570
JH
17068: see if prototype for syscall is available
17069echo " "
17070set d_syscallproto syscall $i_unistd unistd.h
17071eval $hasproto
17072
b4eb6b3d
JH
17073: see if sysconf exists
17074set sysconf d_sysconf
17075eval $inlibc
17076
17077: see if system exists
17078set system d_system
17079eval $inlibc
17080
17081: see if tcgetpgrp exists
17082set tcgetpgrp d_tcgetpgrp
17083eval $inlibc
17084
17085: see if tcsetpgrp exists
17086set tcsetpgrp d_tcsetpgrp
17087eval $inlibc
17088
17089: see if prototype for telldir is available
17090echo " "
17091set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17092eval $hasproto
17093
ad493445
MB
17094: see if time exists
17095echo " "
17096if test "X$d_time" = X -o X"$timetype" = X; then
17097 if set time val -f d_time; eval $csym; $val; then
17098 echo 'time() found.' >&4
17099 val="$define"
17100 rp="What is the type returned by time() on this system?"
17101 set time_t timetype long stdio.h sys/types.h
17102 eval $typedef_ask
17103 else
17104 echo 'time() not found, hope that will do.' >&4
17105 val="$undef"
17106 timetype='int';
17107 fi
17108 set d_time
17109 eval $setvar
17110fi
17111
b4eb6b3d
JH
17112: see if this is a sys/times.h system
17113set sys/times.h i_systimes
17114eval $inhdr
17115
17116: see if times exists
17117echo " "
17118if set times val -f d_times; eval $csym; $val; then
17119 echo 'times() found.' >&4
17120 d_times="$define"
17121 inc=''
17122 case "$i_systimes" in
17123 "$define") inc='sys/times.h';;
17124 esac
17125 rp="What is the type returned by times() on this system?"
17126 set clock_t clocktype long stdio.h sys/types.h $inc
17127 eval $typedef_ask
17128else
17129 echo 'times() NOT found, hope that will do.' >&4
17130 d_times="$undef"
17131 clocktype='int'
17132fi
17133
10bc17b6
JH
17134: see if tmpnam_r exists
17135set tmpnam_r d_tmpnam_r
17136eval $inlibc
17137case "$d_tmpnam_r" in
17138"$define")
31ee0cb7 17139 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
17140 case "$d_tmpnam_r_proto:$usethreads" in
17141 ":define") d_tmpnam_r_proto=define
a48ec845
JH
17142 set d_tmpnam_r_proto tmpnam_r $hdrs
17143 eval $hasproto ;;
17144 *) ;;
17145 esac
17146 case "$d_tmpnam_r_proto" in
17147 define)
10bc17b6
JH
17148 case "$tmpnam_r_proto" in
17149 ''|0) try='char* tmpnam_r(char*);'
17150 ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17151 esac
17152 case "$tmpnam_r_proto" in
90e831dc 17153 ''|0) d_tmpnam_r=undef
10bc17b6 17154 tmpnam_r_proto=0
a48ec845 17155 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17156 * ) case "$tmpnam_r_proto" in
17157 REENTRANT_PROTO*) ;;
17158 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17159 esac
17160 echo "Prototype: $try" ;;
17161 esac
17162 ;;
c18e646a
JH
17163 *) case "$usethreads" in
17164 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17165 esac
90e831dc
SB
17166 d_tmpnam_r=undef
17167 tmpnam_r_proto=0
c18e646a 17168 ;;
a48ec845
JH
17169 esac
17170 ;;
10bc17b6
JH
17171*) tmpnam_r_proto=0
17172 ;;
17173esac
17174
b4eb6b3d
JH
17175: see if truncate exists
17176set truncate d_truncate
17177eval $inlibc
17178
10bc17b6
JH
17179: see if ttyname_r exists
17180set ttyname_r d_ttyname_r
17181eval $inlibc
17182case "$d_ttyname_r" in
17183"$define")
17184 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
17185 case "$d_ttyname_r_proto:$usethreads" in
17186 ":define") d_ttyname_r_proto=define
a48ec845
JH
17187 set d_ttyname_r_proto ttyname_r $hdrs
17188 eval $hasproto ;;
17189 *) ;;
17190 esac
17191 case "$d_ttyname_r_proto" in
17192 define)
10bc17b6
JH
17193 case "$ttyname_r_proto" in
17194 ''|0) try='int ttyname_r(int, char*, size_t);'
17195 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17196 esac
17197 case "$ttyname_r_proto" in
17198 ''|0) try='int ttyname_r(int, char*, int);'
17199 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17200 esac
17201 case "$ttyname_r_proto" in
17202 ''|0) try='char* ttyname_r(int, char*, int);'
17203 ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17204 esac
17205 case "$ttyname_r_proto" in
90e831dc 17206 ''|0) d_ttyname_r=undef
10bc17b6 17207 ttyname_r_proto=0
a48ec845 17208 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17209 * ) case "$ttyname_r_proto" in
17210 REENTRANT_PROTO*) ;;
17211 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17212 esac
17213 echo "Prototype: $try" ;;
17214 esac
17215 ;;
c18e646a
JH
17216 *) case "$usethreads" in
17217 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17218 esac
90e831dc
SB
17219 d_ttyname_r=undef
17220 ttyname_r_proto=0
c18e646a 17221 ;;
a48ec845
JH
17222 esac
17223 ;;
10bc17b6
JH
17224*) ttyname_r_proto=0
17225 ;;
17226esac
17227
b4eb6b3d
JH
17228: see if tzname[] exists
17229echo " "
17230if set tzname val -a d_tzname; eval $csym; $val; then
17231 val="$define"
17232 echo 'tzname[] found.' >&4
17233else
17234 val="$undef"
17235 echo 'tzname[] NOT found.' >&4
17236fi
17237set d_tzname
17238eval $setvar
17239
4e0554ec
JH
17240case "$osname" in
17241next|rhapsody|darwin) multiarch="$define" ;;
17242esac
17243case "$multiarch" in
17244''|[nN]*) multiarch="$undef" ;;
17245esac
17246
24412007 17247: check for ordering of bytes in a UV
4e0554ec 17248echo " "
5440bc8e 17249case "$usecrosscompile$multiarch" in
4e0554ec
JH
17250*$define*)
17251 $cat <<EOM
17252You seem to be either cross-compiling or doing a multiarchitecture build,
17253skipping the byteorder check.
17254
17255EOM
5440bc8e 17256 byteorder='ffff'
4e0554ec
JH
17257 ;;
17258*)
17259 case "$byteorder" in
17260 '')
17261 $cat <<'EOM'
17262In the following, larger digits indicate more significance. A big-endian
17263machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17264little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17265machines may have weird orders like 3412. A Cray will report 87654321,
17266an Alpha will report 12345678. If the test program works the default is
17267probably right.
17268I'm now running the test program...
17269EOM
24412007 17270 $cat >try.c <<EOCP
4e0554ec 17271#include <stdio.h>
55954f19
JH
17272#$i_stdlib I_STDLIB
17273#ifdef I_STDLIB
17274#include <stdlib.h>
17275#endif
24412007
JH
17276#include <sys/types.h>
17277typedef $uvtype UV;
4e0554ec
JH
17278int main()
17279{
17280 int i;
17281 union {
24412007
JH
17282 UV l;
17283 char c[$uvsize];
4e0554ec
JH
17284 } u;
17285
24412007 17286 if ($uvsize > 4)
b5ded3e5 17287 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 17288 else
a4c53327 17289 u.l = (UV)0x04030201;
24412007 17290 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
17291 printf("%c", u.c[i]+'0');
17292 printf("\n");
17293 exit(0);
17294}
17295EOCP
17296 xxx_prompt=y
17297 set try
17298 if eval $compile && ./try > /dev/null; then
5440bc8e 17299 dflt=`$run ./try`
4e0554ec
JH
17300 case "$dflt" in
17301 [1-4][1-4][1-4][1-4]|12345678|87654321)
17302 echo "(The test program ran ok.)"
17303 echo "byteorder=$dflt"
17304 xxx_prompt=n
17305 ;;
17306 ????|????????) echo "(The test program ran ok.)" ;;
17307 *) echo "(The test program didn't run right for some reason.)" ;;
17308 esac
17309 else
17310 dflt='4321'
17311 cat <<'EOM'
17312(I can't seem to compile the test program. Guessing big-endian...)
17313EOM
17314 fi
17315 case "$xxx_prompt" in
17316 y)
24412007 17317 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
17318 . ./myread
17319 byteorder="$ans"
17320 ;;
17321 *) byteorder=$dflt
17322 ;;
17323 esac
17324 ;;
17325 esac
17326 $rm -f try.c try
17327 ;;
17328esac
17329
17330
17331$cat <<EOM
17332
17333Checking to see whether you can access character data unalignedly...
17334EOM
dc7b0a4f
JH
17335case "$d_u32align" in
17336'') $cat >try.c <<EOCP
4e0554ec 17337#include <stdio.h>
d1daaddf
JH
17338#$i_stdlib I_STDLIB
17339#ifdef I_STDLIB
17340#include <stdlib.h>
17341#endif
4e0554ec 17342#define U32 $u32type
d308175a
JH
17343#define BYTEORDER 0x$byteorder
17344#define U8 $u8type
9958dc3c
JH
17345#include <signal.h>
17346#ifdef SIGBUS
17347$signal_t bletch(s) int s; { exit(4); }
17348#endif
4e0554ec
JH
17349int main() {
17350#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
8906a23e 17351 U8 buf[8];
4e0554ec
JH
17352 U32 *up;
17353 int i;
17354
17355 if (sizeof(U32) != 4) {
17356 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17357 exit(1);
17358 }
17359
17360 fflush(stdout);
17361
9958dc3c
JH
17362#ifdef SIGBUS
17363 signal(SIGBUS, bletch);
17364#endif
17365
8906a23e
JH
17366 buf[0] = 0;
17367 buf[1] = 0;
17368 buf[2] = 0;
17369 buf[3] = 1;
7eac3fd6 17370 buf[4] = 0;
8906a23e
JH
17371 buf[5] = 0;
17372 buf[6] = 0;
7eac3fd6 17373 buf[7] = 1;
8906a23e 17374
4e0554ec
JH
17375 for (i = 0; i < 4; i++) {
17376 up = (U32*)(buf + i);
17377 if (! ((*up == 1 << (8*i)) || /* big-endian */
17378 (*up == 1 << (8*(3-i))) /* little-endian */
17379 )
17380 )
17381 {
17382 printf("read failed (%x)\n", *up);
17383 exit(2);
17384 }
17385 }
17386
17387 /* write test */
17388 for (i = 0; i < 4; i++) {
17389 up = (U32*)(buf + i);
17390 *up = 0xBeef;
17391 if (*up != 0xBeef) {
17392 printf("write failed (%x)\n", *up);
17393 exit(3);
17394 }
17395 }
17396
17397 exit(0);
17398#else
17399 printf("1\n");
17400 exit(1);
17401#endif
17402 return 0;
17403}
17404EOCP
17405set try
17406if eval $compile_ok; then
d308175a 17407 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 17408 $run ./try 2>&1 >/dev/null
4e0554ec
JH
17409 case "$?" in
17410 0) cat >&4 <<EOM
17411You can access character data pretty unalignedly.
17412EOM
17413 d_u32align="$undef"
17414 ;;
17415 *) cat >&4 <<EOM
17416It seems that you must access character data in an aligned manner.
17417EOM
17418 d_u32align="$define"
17419 ;;
17420 esac
4e0554ec
JH
17421else
17422 rp='Can you access character data at unaligned addresses?'
17423 dflt='n'
17424 . ./myread
17425 case "$ans" in
17426 [yY]*) d_u32align="$undef" ;;
17427 *) d_u32align="$define" ;;
17428 esac
17429fi
e36b5403 17430$rm -f core core.try.* try.core
dc7b0a4f
JH
17431;;
17432esac
4e0554ec
JH
17433
17434: see if ualarm exists
17435set ualarm d_ualarm
17436eval $inlibc
17437
b4eb6b3d
JH
17438: see if umask exists
17439set umask d_umask
17440eval $inlibc
17441
758a5d79
JH
17442: see if unordered exists
17443set unordered d_unordered
17444eval $inlibc
17445
4e0554ec
JH
17446: see if usleep exists
17447set usleep d_usleep
17448eval $inlibc
17449
2ef53570
JH
17450: see if prototype for usleep is available
17451echo " "
17452set d_usleepproto usleep $i_unistd unistd.h
17453eval $hasproto
17454
b4eb6b3d
JH
17455: see if ustat exists
17456set ustat d_ustat
17457eval $inlibc
17458
17459: backward compatibility for d_hvfork
17460if test X$d_hvfork != X; then
17461 d_vfork="$d_hvfork"
17462 d_hvfork=''
17463fi
17464: see if there is a vfork
17465val=''
17466set vfork val
17467eval $inlibc
17468
17469: Ok, but do we want to use it. vfork is reportedly unreliable in
17470: perl on Solaris 2.x, and probably elsewhere.
17471case "$val" in
17472$define)
17473 echo " "
17474 case "$usevfork" in
17475 false) dflt='n';;
17476 *) dflt='y';;
17477 esac
17478 cat <<'EOM'
17479
17480Perl can only use a vfork() that doesn't suffer from strict
17481restrictions on calling functions or modifying global data in
17482the child. For example, glibc-2.1 contains such a vfork()
17483that is unsuitable. If your system provides a proper fork()
17484call, chances are that you do NOT want perl to use vfork().
17485
17486EOM
17487 rp="Do you still want to use vfork()?"
17488 . ./myread
17489 case "$ans" in
17490 y|Y) ;;
17491 *)
17492 echo "Ok, we won't use vfork()."
17493 val="$undef"
17494 ;;
17495 esac
17496 ;;
17497esac
17498set d_vfork
17499eval $setvar
17500case "$d_vfork" in
17501$define) usevfork='true';;
17502*) usevfork='false';;
17503esac
17504
b4eb6b3d
JH
17505: see if closedir exists
17506set closedir d_closedir
17507eval $inlibc
17508
17509case "$d_closedir" in
17510"$define")
17511 echo " "
17512 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 17513 cat > try.c <<EOM
b4eb6b3d
JH
17514#$i_dirent I_DIRENT /**/
17515#$i_sysdir I_SYS_DIR /**/
17516#$i_sysndir I_SYS_NDIR /**/
17517#$i_systypes I_SYS_TYPES /**/
17518
17519#if defined(I_SYS_TYPES)
17520#include <sys/types.h>
17521#endif
17522#if defined(I_DIRENT)
17523#include <dirent.h>
17524#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17525#include <sys/dir.h>
17526#endif
17527#else
17528#ifdef I_SYS_NDIR
17529#include <sys/ndir.h>
17530#else
17531#ifdef I_SYS_DIR
17532#ifdef hp9000s500
17533#include <ndir.h> /* may be wrong in the future */
17534#else
17535#include <sys/dir.h>
17536#endif
17537#endif
17538#endif
17539#endif
17540int main() { return closedir(opendir(".")); }
17541EOM
5440bc8e 17542 set try
b4eb6b3d 17543 if eval $compile_ok; then
5440bc8e 17544 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
17545 echo "Yes, it does."
17546 val="$undef"
17547 else
17548 echo "No, it doesn't."
17549 val="$define"
17550 fi
17551 else
17552 echo "(I can't seem to compile the test program--assuming it doesn't)"
17553 val="$define"
17554 fi
17555 ;;
17556*)
17557 val="$undef";
17558 ;;
17559esac
17560set d_void_closedir
17561eval $setvar
5440bc8e 17562$rm -f try try.*
b4eb6b3d
JH
17563: see if there is a wait4
17564set wait4 d_wait4
17565eval $inlibc
17566
17567: see if waitpid exists
17568set waitpid d_waitpid
17569eval $inlibc
17570
17571: see if wcstombs exists
17572set wcstombs d_wcstombs
17573eval $inlibc
17574
17575: see if wctomb exists
17576set wctomb d_wctomb
17577eval $inlibc
17578
4e0554ec
JH
17579: see if writev exists
17580set writev d_writev
17581eval $inlibc
17582
b4eb6b3d
JH
17583: preserve RCS keywords in files with variable substitution, grrr
17584Date='$Date'
17585Id='$Id'
17586Log='$Log'
17587RCSfile='$RCSfile'
17588Revision='$Revision'
17589
b4eb6b3d
JH
17590: check for alignment requirements
17591echo " "
5440bc8e 17592case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
17593*$define*)
17594 $cat <<EOM
17595You seem to be either cross-compiling or doing a multiarchitecture build,
17596skipping the memory alignment check.
17597
17598EOM
17599 case "$alignbytes" in
17600 '') alignbytes=8 ;;
17601 esac
17602 ;;
17603*)
17604 case "$alignbytes" in
17605 '') echo "Checking alignment constraints..." >&4
17606 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17607 $cat >try.c <<'EOCP'
17608typedef long double NV;
17609EOCP
17610 else
17611 $cat >try.c <<'EOCP'
17612typedef double NV;
17613EOCP
17614 fi
17615 $cat >>try.c <<'EOCP'
17616#include <stdio.h>
17617struct foobar {
17618 char foo;
17619 NV bar;
17620} try_algn;
17621int main()
17622{
17623 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17624 return(0);
17625}
17626EOCP
17627 set try
17628 if eval $compile_ok; then
5440bc8e 17629 dflt=`$run ./try`
b4eb6b3d
JH
17630 else
17631 dflt='8'
17632 echo "(I can't seem to compile the test program...)"
17633 fi
17634 ;;
17635 *) dflt="$alignbytes"
17636 ;;
17637 esac
17638 rp="Doubles must be aligned on a how-many-byte boundary?"
17639 . ./myread
17640 alignbytes="$ans"
17641 $rm -f try.c try
17642 ;;
17643esac
17644
17645
17646: set the base revision
17647baserev=5.0
17648
3099fc99 17649: how do we concatenate cpp tokens here?
b4eb6b3d 17650echo " "
3099fc99 17651echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
17652$cat >cpp_stuff.c <<'EOCP'
17653#define RCAT(a,b)a/**/b
17654#define ACAT(a,b)a ## b
17655RCAT(Rei,ser)
17656ACAT(Cir,cus)
17657EOCP
17658$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17659if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17660 echo "Oh! Smells like ANSI's been here." >&4
17661 echo "We can catify or stringify, separately or together!"
17662 cpp_stuff=42
17663elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17664 echo "Ah, yes! The good old days!" >&4
17665 echo "However, in the good old days we don't know how to stringify and"
17666 echo "catify at the same time."
17667 cpp_stuff=1
17668else
17669 $cat >&4 <<EOM
3099fc99
CW
17670Hmm, I don't seem to be able to concatenate tokens with your cpp.
17671You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
17672EOM
17673 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17674fi
17675$rm -f cpp_stuff.*
17676
17677: see if this is a db.h system
17678set db.h i_db
17679eval $inhdr
17680
17681case "$i_db" in
17682$define)
17683 : Check db version.
17684 echo " "
17685 echo "Checking Berkeley DB version ..." >&4
17686 $cat >try.c <<EOCP
17687#$d_const HASCONST
17688#ifndef HASCONST
17689#define const
17690#endif
17691#include <sys/types.h>
17692#include <stdio.h>
55954f19
JH
17693#$i_stdlib I_STDLIB
17694#ifdef I_STDLIB
17695#include <stdlib.h>
17696#endif
b4eb6b3d 17697#include <db.h>
640374d0 17698int main(int argc, char *argv[])
b4eb6b3d
JH
17699{
17700#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17701 int Major, Minor, Patch ;
17702 unsigned long Version ;
17703 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
17704 if (argc == 2) {
17705 printf("%d %d %d %d %d %d\n",
17706 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17707 Major, Minor, Patch);
17708 exit(0);
17709 }
17710 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
17711
17712 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17713 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17714 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17715 Major, Minor, Patch) ;
17716
17717 /* check that db.h & libdb are compatible */
17718 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 17719 printf("db.h and libdb are incompatible.\n") ;
b4eb6b3d
JH
17720 exit(3);
17721 }
17722
640374d0 17723 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
17724
17725 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17726 + DB_VERSION_PATCH ;
17727
17728 /* needs to be >= 2.3.4 */
17729 if (Version < 2003004) {
17730 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 17731 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
b4eb6b3d
JH
17732 exit(2);
17733 }
17734
17735 exit(0);
17736#else
17737#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
17738 if (argc == 2) {
17739 printf("1 0 0\n");
17740 exit(0);
17741 }
17742 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
17743 exit(0); /* DB version < 2: the coast is clear. */
17744#else
17745 exit(1); /* <db.h> not Berkeley DB? */
17746#endif
17747#endif
17748}
17749EOCP
17750 set try
5440bc8e 17751 if eval $compile_ok && $run ./try; then
b4eb6b3d 17752 echo 'Looks OK.' >&4
5440bc8e 17753 set `$run ./try 1`
640374d0
JH
17754 db_version_major=$1
17755 db_version_minor=$2
17756 db_version_patch=$3
b4eb6b3d
JH
17757 else
17758 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
17759 i_db=$undef
17760 case " $libs " in
17761 *"-ldb "*)
17762 : Remove db from list of libraries to use
17763 echo "Removing unusable -ldb from library list" >&4
17764 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17765 shift
17766 libs="$*"
17767 echo "libs = $libs" >&4
17768 ;;
17769 esac
17770 fi
17771 $rm -f try.*
17772 ;;
17773esac
17774
17775case "$i_db" in
17776define)
17777 : Check the return type needed for hash
17778 echo " "
17779 echo "Checking return type needed for hash for Berkeley DB ..." >&4
17780 $cat >try.c <<EOCP
17781#$d_const HASCONST
17782#ifndef HASCONST
17783#define const
17784#endif
17785#include <sys/types.h>
17786#include <db.h>
17787
17788#ifndef DB_VERSION_MAJOR
17789u_int32_t hash_cb (ptr, size)
17790const void *ptr;
17791size_t size;
17792{
17793}
17794HASHINFO info;
17795int main()
17796{
17797 info.hash = hash_cb;
17798}
17799#endif
17800EOCP
17801 if $cc $ccflags -c try.c >try.out 2>&1 ; then
17802 if $contains warning try.out >>/dev/null 2>&1 ; then
17803 db_hashtype='int'
17804 else
17805 db_hashtype='u_int32_t'
17806 fi
17807 else
17808 : XXX Maybe we should just give up here.
17809 db_hashtype=u_int32_t
17810 $cat try.out >&4
17811 echo "Help: I can't seem to compile the db test program." >&4
17812 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17813 fi
17814 $rm -f try.*
17815 echo "Your version of Berkeley DB uses $db_hashtype for hash."
17816 ;;
17817*) db_hashtype=u_int32_t
17818 ;;
17819esac
17820case "$i_db" in
17821define)
17822 : Check the return type needed for prefix
17823 echo " "
17824 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17825 cat >try.c <<EOCP
17826#$d_const HASCONST
17827#ifndef HASCONST
17828#define const
17829#endif
17830#include <sys/types.h>
17831#include <db.h>
17832
17833#ifndef DB_VERSION_MAJOR
17834size_t prefix_cb (key1, key2)
17835const DBT *key1;
17836const DBT *key2;
17837{
17838}
17839BTREEINFO info;
17840int main()
17841{
17842 info.prefix = prefix_cb;
17843}
17844#endif
17845EOCP
17846 if $cc $ccflags -c try.c >try.out 2>&1 ; then
17847 if $contains warning try.out >>/dev/null 2>&1 ; then
17848 db_prefixtype='int'
17849 else
17850 db_prefixtype='size_t'
17851 fi
17852 else
17853 db_prefixtype='size_t'
17854 : XXX Maybe we should just give up here.
17855 $cat try.out >&4
17856 echo "Help: I can't seem to compile the db test program." >&4
17857 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17858 fi
17859 $rm -f try.*
17860 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17861 ;;
17862*) db_prefixtype='size_t'
17863 ;;
17864esac
17865
b4eb6b3d
JH
17866
17867: How can we generate normalized random numbers ?
17868echo " "
17869echo "Looking for a random number function..." >&4
17870case "$randfunc" in
17871'')
17872 if set drand48 val -f; eval $csym; $val; then
17873 dflt="drand48"
17874 echo "Good, found drand48()." >&4
17875 elif set random val -f; eval $csym; $val; then
17876 dflt="random"
17877 echo "OK, found random()." >&4
17878 else
17879 dflt="rand"
17880 echo "Yick, looks like I have to use rand()." >&4
17881 fi
17882 echo " "
17883 ;;
17884*)
17885 dflt="$randfunc"
17886 ;;
17887esac
17888cont=true
17889
17890case "$ccflags" in
17891*-Dmy_rand=*|*-Dmy_srand=*)
17892 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17893 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17894 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17895 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17896 ;;
17897esac
17898
17899while $test "$cont"; do
17900 rp="Use which function to generate random numbers?"
17901 . ./myread
17902 if $test "$ans" = "$dflt"; then
17903 : null
17904 else
17905 randbits=''
17906 fi
17907 randfunc="$ans"
17908 if set $ans val -f; eval $csym; $val; then
17909 cont=''
17910 else
17911 dflt=y
17912 rp="I cannot find function $ans. Use that name anyway?"
17913 . ./myread
17914 dflt=rand
17915 case "$ans" in
17916 [yY]*) cont='';;
17917 esac
17918 fi
17919 case "$cont" in
17920 '')
17921 case "$randfunc" in
17922 drand48)
17923 drand01="drand48()"
17924 seedfunc="srand48"
17925 randbits=48
17926 randseedtype=long
17927 ;;
17928 rand|random)
17929 case "$randbits" in
17930 '')
17931echo "Checking to see how many bits your $randfunc() function produces..." >&4
17932 $cat >try.c <<EOCP
17933#$i_unistd I_UNISTD
17934#$i_stdlib I_STDLIB
17935#include <stdio.h>
17936#ifdef I_UNISTD
17937# include <unistd.h>
17938#endif
17939#ifdef I_STDLIB
17940# include <stdlib.h>
17941#endif
17942int main()
17943{
17944 register int i;
17945 register unsigned long tmp;
17946 register unsigned long max = 0L;
17947
17948 for (i = 1000; i; i--) {
17949 tmp = (unsigned long) $randfunc();
17950 if (tmp > max) max = tmp;
17951 }
17952 for (i = 0; max; i++)
17953 max /= 2;
17954 printf("%d\n",i);
17955}
17956EOCP
17957 set try
17958 if eval $compile_ok; then
17959 dflt=`try`
17960 else
17961 dflt='?'
17962 echo "(I can't seem to compile the test program...)"
17963 fi
17964 ;;
17965 *)
17966 dflt="$randbits"
17967 ;;
17968 esac
17969 rp="How many bits does your $randfunc() function produce?"
17970 . ./myread
17971 randbits="$ans"
17972 $rm -f try.c try
17973 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17974 seedfunc="s$randfunc"
17975 randseedtype=unsigned
17976 ;;
17977 *)
17978 dflt="31"
17979 rp="How many bits does your $randfunc() function produce?"
17980 . ./myread
17981 randbits="$ans"
17982 seedfunc="s$randfunc"
17983 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17984 if set $seedfunc val -f; eval $csym; $val; then
17985 echo "(Using $seedfunc() to seed random generator)"
17986 else
17987 echo "(Warning: no $seedfunc() to seed random generator)"
17988 seedfunc=rand
17989 fi
17990 randseedtype=unsigned
17991 ;;
17992 esac
17993 ;;
17994 esac
17995done
17996
17997echo " "
17998echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 17999$cat >try.c <<'EOM'
b4eb6b3d
JH
18000int main()
18001{
18002 if ('M'==0xd4) return 0;
18003 return 1;
18004}
18005EOM
18006
18007val=$undef
5440bc8e 18008set try
b4eb6b3d 18009if eval $compile_ok; then
5440bc8e 18010 if $run ./try; then
b4eb6b3d
JH
18011 echo "You seem to speak EBCDIC." >&4
18012 val="$define"
18013 else
5440bc8e 18014 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
18015 fi
18016else
18017 echo "I'm unable to compile the test program." >&4
18018 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18019fi
5440bc8e 18020$rm -f try try.*
b4eb6b3d
JH
18021set ebcdic
18022eval $setvar
18023
18024echo " "
18025$cat >&4 <<EOM
18026Checking how to flush all pending stdio output...
18027EOM
18028# I only know how to find the first 32 possibly open files on SunOS.
18029# See also hints/sunos_4_1.sh and util.c --AD
18030case "$osname" in
18031sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18032esac
18033$cat >>try.c <<EOCP
18034#include <stdio.h>
55954f19
JH
18035#$i_stdlib I_STDLIB
18036#ifdef I_STDLIB
18037#include <stdlib.h>
18038#endif
b4eb6b3d
JH
18039#$i_unistd I_UNISTD
18040#ifdef I_UNISTD
18041# include <unistd.h>
18042#endif
18043#$d_sysconf HAS_SYSCONF
18044#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18045#ifdef HAS_STDIO_STREAM_ARRAY
18046# define STDIO_STREAM_ARRAY $stdio_stream_array
18047#endif
18048int main() {
5440bc8e
JH
18049 FILE* p;
18050 unlink("try.out");
18051 p = fopen("try.out", "w");
b4eb6b3d
JH
18052#ifdef TRY_FPUTC
18053 fputc('x', p);
18054#else
18055# ifdef TRY_FPRINTF
18056 fprintf(p, "x");
18057# endif
18058#endif
18059#ifdef TRY_FFLUSH_NULL
18060 fflush(NULL);
18061#endif
18062#ifdef TRY_FFLUSH_ALL
18063 {
18064 long open_max = -1;
18065# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18066 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18067# else
18068# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18069 open_max = sysconf(_SC_OPEN_MAX);
18070# else
18071# ifdef FOPEN_MAX
18072 open_max = FOPEN_MAX;
18073# else
18074# ifdef OPEN_MAX
18075 open_max = OPEN_MAX;
18076# else
18077# ifdef _NFILE
18078 open_max = _NFILE;
18079# endif
18080# endif
18081# endif
18082# endif
18083# endif
18084# ifdef HAS_STDIO_STREAM_ARRAY
18085 if (open_max > 0) {
18086 long i;
18087 for (i = 0; i < open_max; i++)
18088 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18089 STDIO_STREAM_ARRAY[i]._file < open_max &&
18090 STDIO_STREAM_ARRAY[i]._flag)
18091 fflush(&STDIO_STREAM_ARRAY[i]);
18092 }
18093 }
18094# endif
18095#endif
18096 _exit(42);
18097}
18098EOCP
18099: first we have to find out how _not_ to flush
5440bc8e 18100$to try.c
b4eb6b3d
JH
18101if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18102 output=''
18103 set try -DTRY_FPUTC
18104 if eval $compile; then
fbe73d74 18105 $run ./try 2>/dev/null
28f5ac64 18106 code="$?"
5440bc8e 18107 $from try.out
28f5ac64 18108 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18109 output=-DTRY_FPUTC
18110 fi
18111 fi
18112 case "$output" in
18113 '')
18114 set try -DTRY_FPRINTF
b4eb6b3d 18115 if eval $compile; then
fbe73d74 18116 $run ./try 2>/dev/null
28f5ac64 18117 code="$?"
5440bc8e 18118 $from try.out
28f5ac64 18119 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18120 output=-DTRY_FPRINTF
18121 fi
18122 fi
18123 ;;
18124 esac
18125fi
18126: check for fflush NULL behaviour
18127case "$fflushNULL" in
18128'') set try -DTRY_FFLUSH_NULL $output
18129 if eval $compile; then
5440bc8e 18130 $run ./try 2>/dev/null
b4eb6b3d 18131 code="$?"
5440bc8e 18132 $from try.out
b4eb6b3d
JH
18133 if $test -s try.out -a "X$code" = X42; then
18134 fflushNULL="`$cat try.out`"
18135 else
18136 if $test "X$code" != X42; then
18137 $cat >&4 <<EOM
18138(If this test failed, don't worry, we'll try another method shortly.)
18139EOM
18140 fi
18141 fi
18142 fi
18143 $rm -f core try.core core.try.*
18144 case "$fflushNULL" in
18145 x) $cat >&4 <<EOM
18146Your fflush(NULL) works okay for output streams.
18147Let's see if it clobbers input pipes...
18148EOM
18149# As of mid-March 2000 all versions of Solaris appear to have a stdio
18150# bug that improperly flushes the input end of pipes. So we avoid the
18151# autoflush on fork/system/exec support for now. :-(
18152$cat >tryp.c <<EOCP
18153#include <stdio.h>
18154int
18155main(int argc, char **argv)
18156{
18157 char buf[1024];
18158 int i;
18159 char *bp = buf;
18160 while (1) {
18161 while ((i = getc(stdin)) != -1
18162 && (*bp++ = i) != '\n'
18163 && bp < &buf[1024])
18164 /* DO NOTHING */ ;
18165 *bp = '\0';
18166 fprintf(stdout, "%s", buf);
18167 fflush(NULL);
18168 if (i == -1)
18169 return 0;
18170 bp = buf;
18171 }
18172}
18173EOCP
18174 fflushNULL="$define"
18175 set tryp
18176 if eval $compile; then
18177 $rm -f tryp.out
5440bc8e 18178 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18179 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18180 $cat >&4 <<EOM
18181fflush(NULL) seems to behave okay with input streams.
18182EOM
18183 fflushNULL="$define"
18184 else
18185 $cat >&4 <<EOM
18186Ouch, fflush(NULL) clobbers input pipes! We will not use it.
18187EOM
18188 fflushNULL="$undef"
18189 fi
18190 fi
18191 $rm -f core tryp.c tryp.core core.tryp.*
18192 ;;
18193 '') $cat >&4 <<EOM
18194Your fflush(NULL) isn't working (contrary to ANSI C).
18195EOM
18196 fflushNULL="$undef"
18197 ;;
18198 *) $cat >&4 <<EOM
18199Cannot figure out whether your fflush(NULL) works or not.
18200I'm assuming it doesn't (contrary to ANSI C).
18201EOM
18202 fflushNULL="$undef"
18203 ;;
18204 esac
18205 ;;
18206$define|true|[yY]*)
18207 fflushNULL="$define"
18208 ;;
18209*)
18210 fflushNULL="$undef"
18211 ;;
18212esac
18213: check explicit looping only if NULL did not work, and if the pipe
18214: bug does not show up on an explicit flush too
18215case "$fflushNULL" in
18216"$undef")
18217 $cat >tryp.c <<EOCP
18218#include <stdio.h>
18219int
18220main(int argc, char **argv)
18221{
18222 char buf[1024];
18223 int i;
18224 char *bp = buf;
18225 while (1) {
18226 while ((i = getc(stdin)) != -1
18227 && (*bp++ = i) != '\n'
18228 && bp < &buf[1024])
18229 /* DO NOTHING */ ;
18230 *bp = '\0';
18231 fprintf(stdout, "%s", buf);
18232 fflush(stdin);
18233 if (i == -1)
18234 return 0;
18235 bp = buf;
18236 }
18237}
18238EOCP
18239 set tryp
18240 if eval $compile; then
18241 $rm -f tryp.out
5440bc8e 18242 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18243 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18244 $cat >&4 <<EOM
18245Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18246EOM
18247 : now check for fflushall behaviour
18248 case "$fflushall" in
18249 '') set try -DTRY_FFLUSH_ALL $output
18250 if eval $compile; then
18251 $cat >&4 <<EOM
18252(Now testing the other method--but note that this also may fail.)
18253EOM
5440bc8e 18254 $run ./try 2>/dev/null
28f5ac64 18255 code=$?
fbe73d74 18256 $from try.out
28f5ac64 18257 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18258 fflushall="`$cat try.out`"
18259 fi
18260 fi
18261 $rm -f core try.core core.try.*
18262 case "$fflushall" in
18263 x) $cat >&4 <<EOM
18264Whew. Flushing explicitly all the stdio streams works.
18265EOM
18266 fflushall="$define"
18267 ;;
18268 '') $cat >&4 <<EOM
18269Sigh. Flushing explicitly all the stdio streams doesn't work.
18270EOM
18271 fflushall="$undef"
18272 ;;
18273 *) $cat >&4 <<EOM
18274Cannot figure out whether flushing stdio streams explicitly works or not.
18275I'm assuming it doesn't.
18276EOM
18277 fflushall="$undef"
18278 ;;
18279 esac
18280 ;;
18281 "$define"|true|[yY]*)
18282 fflushall="$define"
18283 ;;
18284 *)
18285 fflushall="$undef"
18286 ;;
18287 esac
18288 else
18289 $cat >&4 <<EOM
18290All is futile. Even fflush(stdin) clobbers input pipes!
18291EOM
18292 fflushall="$undef"
18293 fi
18294 else
18295 fflushall="$undef"
18296 fi
18297 $rm -f core tryp.c tryp.core core.tryp.*
18298 ;;
18299*) fflushall="$undef"
18300 ;;
18301esac
18302
18303case "$fflushNULL$fflushall" in
18304undefundef)
18305 $cat <<EOM
18306OK, I give up. I cannot figure out how to flush pending stdio output.
18307We won't be flushing handles at all before fork/exec/popen.
18308EOM
18309 ;;
18310esac
18311$rm -f try.* try$exe_ext
18312
18313: Store the full pathname to the ar program for use in the C program
18314: Respect a hint or command line value for full_ar.
18315case "$full_ar" in
18316'') full_ar=$ar ;;
18317esac
18318
18319: Store the full pathname to the sed program for use in the C program
18320full_sed=$sed
18321
18322: see what type gids are declared as in the kernel
18323echo " "
18324echo "Looking for the type for group ids returned by getgid()."
18325set gid_t gidtype xxx stdio.h sys/types.h
18326eval $typedef
18327case "$gidtype" in
18328xxx)
18329 xxx=`./findhdr sys/user.h`
18330 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18331 case $1 in
18332 unsigned) dflt="$1 $2" ;;
18333 *) dflt="$1" ;;
18334 esac
18335 ;;
18336*) dflt="$gidtype";;
18337esac
18338case "$gidtype" in
18339gid_t) echo "gid_t found." ;;
18340*) rp="What is the type for group ids returned by getgid()?"
18341 . ./myread
18342 gidtype="$ans"
18343 ;;
18344esac
18345
18346echo " "
18347case "$gidtype" in
18348*_t) zzz="$gidtype" ;;
18349*) zzz="gid" ;;
18350esac
18351echo "Checking the size of $zzz..." >&4
18352cat > try.c <<EOCP
18353#include <sys/types.h>
18354#include <stdio.h>
d1daaddf
JH
18355#$i_stdlib I_STDLIB
18356#ifdef I_STDLIB
18357#include <stdlib.h>
18358#endif
b4eb6b3d
JH
18359int main() {
18360 printf("%d\n", (int)sizeof($gidtype));
18361 exit(0);
18362}
18363EOCP
18364set try
18365if eval $compile_ok; then
5440bc8e 18366 yyy=`$run ./try`
b4eb6b3d
JH
18367 case "$yyy" in
18368 '') gidsize=4
18369 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18370 ;;
18371 *) gidsize=$yyy
18372 echo "Your $zzz is $gidsize bytes long."
18373 ;;
18374 esac
18375else
18376 gidsize=4
18377 echo "(I can't compile the test program--guessing $gidsize.)" >&4
18378fi
18379
18380
18381echo " "
18382case "$gidtype" in
18383*_t) zzz="$gidtype" ;;
18384*) zzz="gid" ;;
18385esac
18386echo "Checking the sign of $zzz..." >&4
18387cat > try.c <<EOCP
18388#include <sys/types.h>
18389#include <stdio.h>
18390int main() {
18391 $gidtype foo = -1;
18392 if (foo < 0)
18393 printf("-1\n");
18394 else
18395 printf("1\n");
18396}
18397EOCP
18398set try
18399if eval $compile; then
5440bc8e 18400 yyy=`$run ./try`
b4eb6b3d
JH
18401 case "$yyy" in
18402 '') gidsign=1
18403 echo "(I can't execute the test program--guessing unsigned.)" >&4
18404 ;;
18405 *) gidsign=$yyy
18406 case "$gidsign" in
18407 1) echo "Your $zzz is unsigned." ;;
18408 -1) echo "Your $zzz is signed." ;;
18409 esac
18410 ;;
18411 esac
18412else
18413 gidsign=1
18414 echo "(I can't compile the test program--guessing unsigned.)" >&4
18415fi
18416
18417
18418echo " "
18419
18420if $test X"$quadtype" != X; then
18421
18422echo "Checking how to print 64-bit integers..." >&4
18423
18424if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18425 $cat >try.c <<'EOCP'
18426#include <sys/types.h>
18427#include <stdio.h>
18428int main() {
18429 int q = 12345678901;
18430 printf("%ld\n", q);
18431}
18432EOCP
18433 set try
18434 if eval $compile; then
5440bc8e 18435 yyy=`$run ./try`
b4eb6b3d
JH
18436 case "$yyy" in
18437 12345678901)
18438 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18439 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18440 echo "We will use %d."
18441 ;;
18442 esac
18443 fi
18444fi
18445
18446if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18447 $cat >try.c <<'EOCP'
18448#include <sys/types.h>
18449#include <stdio.h>
18450int main() {
18451 long q = 12345678901;
18452 printf("%ld\n", q);
18453}
18454EOCP
18455 set try
18456 if eval $compile; then
5440bc8e 18457 yyy=`$run ./try`
b4eb6b3d
JH
18458 case "$yyy" in
18459 12345678901)
18460 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18461 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18462 echo "We will use %ld."
18463 ;;
18464 esac
18465 fi
18466fi
18467
18468if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18469 $cat >try.c <<'EOCP'
18470#include <sys/types.h>
18471#include <inttypes.h>
18472#include <stdio.h>
18473int main() {
18474 int64_t q = 12345678901;
18475 printf("%" PRId64 "\n", q);
18476}
18477EOCP
18478 set try
18479 if eval $compile; then
5440bc8e 18480 yyy=`$run ./try`
b4eb6b3d
JH
18481 case "$yyy" in
18482 12345678901)
18483 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18484 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18485 echo "We will use the C9X style."
18486 ;;
18487 esac
18488 fi
18489fi
18490
2ef53570
JH
18491if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18492 $cat >try.c <<EOCP
b4eb6b3d
JH
18493#include <sys/types.h>
18494#include <stdio.h>
18495int main() {
2ef53570
JH
18496 $quadtype q = 12345678901;
18497 printf("%Ld\n", q);
b4eb6b3d
JH
18498}
18499EOCP
18500 set try
18501 if eval $compile; then
5440bc8e 18502 yyy=`$run ./try`
b4eb6b3d
JH
18503 case "$yyy" in
18504 12345678901)
2ef53570
JH
18505 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18506 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18507 echo "We will use %Ld."
b4eb6b3d
JH
18508 ;;
18509 esac
18510 fi
18511fi
18512
2ef53570
JH
18513if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18514 $cat >try.c <<'EOCP'
b4eb6b3d
JH
18515#include <sys/types.h>
18516#include <stdio.h>
18517int main() {
2ef53570
JH
18518 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18519 printf("%lld\n", q);
b4eb6b3d
JH
18520}
18521EOCP
18522 set try
18523 if eval $compile; then
5440bc8e 18524 yyy=`$run ./try`
b4eb6b3d
JH
18525 case "$yyy" in
18526 12345678901)
2ef53570
JH
18527 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18528 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18529 echo "We will use the %lld style."
b4eb6b3d
JH
18530 ;;
18531 esac
18532 fi
18533fi
18534
18535if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18536 $cat >try.c <<EOCP
18537#include <sys/types.h>
18538#include <stdio.h>
18539int main() {
18540 $quadtype q = 12345678901;
18541 printf("%qd\n", q);
18542}
18543EOCP
18544 set try
18545 if eval $compile; then
5440bc8e 18546 yyy=`$run ./try`
b4eb6b3d
JH
18547 case "$yyy" in
18548 12345678901)
18549 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18550 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18551 echo "We will use %qd."
18552 ;;
18553 esac
18554 fi
18555fi
18556
18557if $test X"$sPRId64" = X; then
18558 echo "Cannot figure out how to print 64-bit integers." >&4
18559fi
18560
18561$rm -f try try.*
18562
18563fi
18564
18565case "$sPRId64" in
18566'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
18567 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
18568 ;;
18569*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
18570 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
18571 ;;
18572esac
18573
18574
18575echo " "
18576$echo "Checking the format strings to be used for Perl's internal types..." >&4
18577
18578if $test X"$ivsize" = X8; then
18579 ivdformat="$sPRId64"
18580 uvuformat="$sPRIu64"
18581 uvoformat="$sPRIo64"
18582 uvxformat="$sPRIx64"
18583 uvXUformat="$sPRIXU64"
18584else
18585 if $test X"$ivsize" = X"$longsize"; then
18586 ivdformat='"ld"'
18587 uvuformat='"lu"'
18588 uvoformat='"lo"'
18589 uvxformat='"lx"'
18590 uvXUformat='"lX"'
18591 else
18592 if $test X"$ivsize" = X"$intsize"; then
18593 ivdformat='"d"'
18594 uvuformat='"u"'
18595 uvoformat='"o"'
18596 uvxformat='"x"'
18597 uvXUformat='"X"'
18598 else
18599 : far out
18600 if $test X"$ivsize" = X"$shortsize"; then
18601 ivdformat='"hd"'
18602 uvuformat='"hu"'
18603 uvoformat='"ho"'
18604 uvxformat='"hx"'
18605 uvXUformat='"hX"'
18606 fi
18607 fi
18608 fi
18609fi
18610
18611if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18612 nveformat="$sPRIeldbl"
18613 nvfformat="$sPRIfldbl"
18614 nvgformat="$sPRIgldbl"
18615 nvEUformat="$sPRIEUldbl"
18616 nvFUformat="$sPRIFUldbl"
18617 nvGUformat="$sPRIGUldbl"
18618else
18619 nveformat='"e"'
18620 nvfformat='"f"'
18621 nvgformat='"g"'
18622 nvEUformat='"E"'
18623 nvFUformat='"F"'
18624 nvGUformat='"G"'
18625fi
18626
18627case "$ivdformat" in
3c728e00 18628'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
18629 exit 1
18630 ;;
18631esac
18632
18633
18634echo " "
18635$echo "Checking the format string to be used for gids..." >&4
18636
18637case "$gidsign" in
18638-1) if $test X"$gidsize" = X"$ivsize"; then
18639 gidformat="$ivdformat"
18640 else
18641 if $test X"$gidsize" = X"$longsize"; then
18642 gidformat='"ld"'
18643 else
18644 if $test X"$gidsize" = X"$intsize"; then
18645 gidformat='"d"'
18646 else
18647 if $test X"$gidsize" = X"$shortsize"; then
18648 gidformat='"hd"'
18649 fi
18650 fi
18651 fi
18652 fi
18653 ;;
18654*) if $test X"$gidsize" = X"$uvsize"; then
18655 gidformat="$uvuformat"
18656 else
18657 if $test X"$gidsize" = X"$longsize"; then
18658 gidformat='"lu"'
18659 else
18660 if $test X"$gidsize" = X"$intsize"; then
18661 gidformat='"u"'
18662 else
18663 if $test X"$gidsize" = X"$shortsize"; then
18664 gidformat='"hu"'
18665 fi
18666 fi
18667 fi
18668 fi
18669 ;;
18670esac
18671
18672: see if getgroups exists
18673set getgroups d_getgrps
18674eval $inlibc
18675
18676: see if setgroups exists
18677set setgroups d_setgrps
18678eval $inlibc
18679
18680
18681: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18682echo " "
18683case "$d_getgrps$d_setgrps" in
18684*define*)
18685 case "$groupstype" in
18686 '') dflt="$gidtype" ;;
18687 *) dflt="$groupstype" ;;
18688 esac
18689 $cat <<EOM
18690What type of pointer is the second argument to getgroups() and setgroups()?
18691Usually this is the same as group ids, $gidtype, but not always.
18692
18693EOM
18694 rp='What type pointer is the second argument to getgroups() and setgroups()?'
18695 . ./myread
18696 groupstype="$ans"
18697 ;;
18698*) groupstype="$gidtype";;
18699esac
18700
18701echo " "
18702echo "Checking if your $make program sets \$(MAKE)..." >&4
18703case "$make_set_make" in
18704'')
18705 $sed 's/^X //' > testmake.mak << 'EOF'
18706Xall:
18707X @echo 'maketemp="$(MAKE)"'
18708EOF
18709 case "`$make -f testmake.mak 2>/dev/null`" in
18710 *maketemp=*) make_set_make='#' ;;
18711 *) make_set_make="MAKE=$make" ;;
18712 esac
18713 $rm -f testmake.mak
18714 ;;
18715esac
18716case "$make_set_make" in
18717'#') echo "Yup, it does.";;
18718*) echo "Nope, it doesn't.";;
18719esac
18720
18721: see what type is used for mode_t
18722rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18723set mode_t modetype int stdio.h sys/types.h
18724eval $typedef_ask
18725
2cc61e15
DD
18726: see if stdarg is available
18727echo " "
18728if $test `./findhdr stdarg.h`; then
18729 echo "<stdarg.h> found." >&4
18730 valstd="$define"
18731else
18732 echo "<stdarg.h> NOT found." >&4
18733 valstd="$undef"
18734fi
18735
18736: see if varags is available
18737echo " "
18738if $test `./findhdr varargs.h`; then
18739 echo "<varargs.h> found." >&4
18740else
18741 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18742fi
18743
18744: set up the varargs testing programs
18745$cat > varargs.c <<EOP
18746#ifdef I_STDARG
18747#include <stdarg.h>
18748#endif
18749#ifdef I_VARARGS
18750#include <varargs.h>
18751#endif
18752
18753#ifdef I_STDARG
18754int f(char *p, ...)
18755#else
18756int f(va_alist)
18757va_dcl
18758#endif
18759{
18760 va_list ap;
18761#ifndef I_STDARG
18762 char *p;
18763#endif
18764#ifdef I_STDARG
18765 va_start(ap,p);
18766#else
18767 va_start(ap);
18768 p = va_arg(ap, char *);
18769#endif
18770 va_end(ap);
18771}
18772EOP
18773$cat > varargs <<EOP
18774$startsh
18775if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18776 echo "true"
18777else
18778 echo "false"
18779fi
18780$rm -f varargs$_o
18781EOP
18782chmod +x varargs
18783
18784: now check which varargs header should be included
18785echo " "
18786i_varhdr=''
18787case "$valstd" in
18788"$define")
18789 if `./varargs I_STDARG`; then
18790 val='stdarg.h'
18791 elif `./varargs I_VARARGS`; then
18792 val='varargs.h'
18793 fi
18794 ;;
18795*)
18796 if `./varargs I_VARARGS`; then
18797 val='varargs.h'
18798 fi
18799 ;;
18800esac
18801case "$val" in
18802'')
18803echo "I could not find the definition for va_dcl... You have problems..." >&4
18804 val="$undef"; set i_stdarg; eval $setvar
18805 val="$undef"; set i_varargs; eval $setvar
18806 ;;
18807*)
18808 set i_varhdr
18809 eval $setvar
18810 case "$i_varhdr" in
18811 stdarg.h)
18812 val="$define"; set i_stdarg; eval $setvar
18813 val="$undef"; set i_varargs; eval $setvar
18814 ;;
18815 varargs.h)
18816 val="$undef"; set i_stdarg; eval $setvar
18817 val="$define"; set i_varargs; eval $setvar
18818 ;;
18819 esac
18820 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18821esac
18822$rm -f varargs*
18823
18824: see if we need va_copy
18825echo " "
18826case "$i_stdarg" in
18827"$define")
18828 $cat >try.c <<EOCP
18829#include <stdarg.h>
18830#include <stdio.h>
85c8a686
DD
18831#$i_stdlib I_STDLIB
18832#ifdef I_STDLIB
18833#include <stdlib.h>
18834#endif
18835#include <signal.h>
2cc61e15
DD
18836
18837int
18838ivfprintf(FILE *f, const char *fmt, va_list *valp)
18839{
18840 return vfprintf(f, fmt, *valp);
18841}
18842
18843int
18844myvfprintf(FILE *f, const char *fmt, va_list val)
18845{
18846 return ivfprintf(f, fmt, &val);
18847}
18848
18849int
18850myprintf(char *fmt, ...)
18851{
18852 va_list val;
18853 va_start(val, fmt);
18854 return myvfprintf(stdout, fmt, val);
18855}
18856
18857int
18858main(int ac, char **av)
18859{
85c8a686
DD
18860 signal(SIGSEGV, exit);
18861
2cc61e15
DD
18862 myprintf("%s%cs all right, then\n", "that", '\'');
18863 exit(0);
18864}
18865EOCP
18866 set try
5440bc8e
JH
18867 if eval $compile && $run ./try 2>&1 >/dev/null; then
18868 case "`$run ./try`" in
2cc61e15
DD
18869 "that's all right, then")
18870 okay=yes
18871 ;;
18872 esac
18873 fi
18874 case "$okay" in
18875 yes) echo "It seems that you don't need va_copy()." >&4
18876 need_va_copy="$undef"
18877 ;;
18878 *) echo "It seems that va_copy() or similar will be needed." >&4
18879 need_va_copy="$define"
18880 ;;
18881 esac
18882 $rm -f try.* core core.* *.core *.core.*
18883 ;;
18884*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18885 ;;
18886esac
18887
b4eb6b3d
JH
18888: see what type is used for size_t
18889rp="What is the type used for the length parameter for string functions?"
18890set size_t sizetype 'unsigned int' stdio.h sys/types.h
18891eval $typedef_ask
18892
18893: check for type of arguments to gethostbyaddr.
18894if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18895 case "$d_gethbyaddr" in
18896 $define)
18897 $cat <<EOM
18898
18899Checking to see what type of arguments are accepted by gethostbyaddr().
18900EOM
18901 hdrs="$define sys/types.h
18902 $d_socket sys/socket.h
18903 $i_niin netinet/in.h
18904 $i_netdb netdb.h
18905 $i_unistd unistd.h"
18906 : The first arg can 'char *' or 'void *'
18907 : The second arg is some of integral type
18908 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18909 for yyy in size_t long int; do
18910 case "$netdb_host_type" in
18911 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18912 if ./protochk "$try" $hdrs; then
18913 echo "Your system accepts $xxx for the first arg."
18914 echo "...and $yyy for the second arg."
18915 netdb_host_type="$xxx"
18916 netdb_hlen_type="$yyy"
18917 fi
18918 ;;
18919 esac
18920 done
18921 done
18922 : In case none of those worked, prompt the user.
18923 case "$netdb_host_type" in
18924 '') rp='What is the type for the 1st argument to gethostbyaddr?'
18925 dflt='char *'
18926 . ./myread
18927 netdb_host_type=$ans
18928 rp='What is the type for the 2nd argument to gethostbyaddr?'
18929 dflt="$sizetype"
18930 . ./myread
18931 netdb_hlen_type=$ans
18932 ;;
18933 esac
18934 ;;
18935 *) : no gethostbyaddr, so pick harmless defaults
18936 netdb_host_type='char *'
18937 netdb_hlen_type="$sizetype"
18938 ;;
18939 esac
18940 # Remove the "const" if needed. -- but then we'll have a
18941 # prototype clash!
18942 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18943fi
18944
18945: check for type of argument to gethostbyname.
18946if test "X$netdb_name_type" = X ; then
18947 case "$d_gethbyname" in
18948 $define)
18949 $cat <<EOM
18950
18951Checking to see what type of argument is accepted by gethostbyname().
18952EOM
18953 hdrs="$define sys/types.h
18954 $d_socket sys/socket.h
18955 $i_niin netinet/in.h
18956 $i_netdb netdb.h
18957 $i_unistd unistd.h"
18958 for xxx in "const char *" "char *"; do
18959 case "$netdb_name_type" in
18960 '') try="extern struct hostent *gethostbyname($xxx);"
18961 if ./protochk "$try" $hdrs; then
18962 echo "Your system accepts $xxx."
18963 netdb_name_type="$xxx"
18964 fi
18965 ;;
18966 esac
18967 done
18968 : In case none of those worked, prompt the user.
18969 case "$netdb_name_type" in
18970 '') rp='What is the type for the 1st argument to gethostbyname?'
18971 dflt='char *'
18972 . ./myread
18973 netdb_name_type=$ans
18974 ;;
18975 esac
18976 ;;
18977 *) : no gethostbyname, so pick harmless default
18978 netdb_name_type='char *'
18979 ;;
18980 esac
18981fi
18982
18983: check for type of 1st argument to getnetbyaddr.
18984if test "X$netdb_net_type" = X ; then
18985 case "$d_getnbyaddr" in
18986 $define)
18987 $cat <<EOM
18988
18989Checking to see what type of 1st argument is accepted by getnetbyaddr().
18990EOM
18991 hdrs="$define sys/types.h
18992 $d_socket sys/socket.h
18993 $i_niin netinet/in.h
18994 $i_netdb netdb.h
18995 $i_unistd unistd.h"
18996 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
18997 case "$netdb_net_type" in
18998 '') try="extern struct netent *getnetbyaddr($xxx, int);"
18999 if ./protochk "$try" $hdrs; then
19000 echo "Your system accepts $xxx."
19001 netdb_net_type="$xxx"
19002 fi
19003 ;;
19004 esac
19005 done
19006 : In case none of those worked, prompt the user.
19007 case "$netdb_net_type" in
19008 '') rp='What is the type for the 1st argument to getnetbyaddr?'
19009 dflt='long'
19010 . ./myread
19011 netdb_net_type=$ans
19012 ;;
19013 esac
19014 ;;
19015 *) : no getnetbyaddr, so pick harmless default
19016 netdb_net_type='long'
19017 ;;
19018 esac
19019fi
19020: locate the preferred pager for this system
d604bb53 19021fn=f/
b4eb6b3d
JH
19022case "$pager" in
19023'')
19024 dflt=''
19025 case "$pg" in
19026 /*) dflt=$pg;;
19027 [a-zA-Z]:/*) dflt=$pg;;
19028 esac
19029 case "$more" in
19030 /*) dflt=$more;;
19031 [a-zA-Z]:/*) dflt=$more;;
19032 esac
19033 case "$less" in
19034 /*) dflt=$less;;
19035 [a-zA-Z]:/*) dflt=$less;;
19036 esac
19037 case "$dflt" in
19038 '') dflt=/usr/ucb/more;;
19039 esac
19040 ;;
d604bb53
JH
19041*) dflt="$pager"
19042 : Instruct ./getfile to trust the hinted or previous pager value,
19043 : even if it does not begin with a slash. For example, on os2,
19044 : pager might be cmd /c more. See comments in UU/getfile.
19045 fn="f/($pager)"
19046 ;;
b4eb6b3d
JH
19047esac
19048echo " "
b4eb6b3d
JH
19049rp='What pager is used on your system?'
19050. ./getfile
19051pager="$ans"
19052
19053: see what type pids are declared as in the kernel
19054rp="What is the type of process ids on this system?"
19055set pid_t pidtype int stdio.h sys/types.h
19056eval $typedef_ask
19057
b4eb6b3d
JH
19058: see if ar generates random libraries by itself
19059echo " "
19060echo "Checking how to generate random libraries on your machine..." >&4
19061echo 'int bar1() { return bar2(); }' > bar1.c
19062echo 'int bar2() { return 2; }' > bar2.c
55954f19
JH
19063$cat > foo.c <<EOP
19064#$i_stdlib I_STDLIB
19065#ifdef I_STDLIB
19066#include <stdlib.h>
19067#endif
b4eb6b3d
JH
19068int main() { printf("%d\n", bar1()); exit(0); }
19069EOP
19070$cc $ccflags -c bar1.c >/dev/null 2>&1
19071$cc $ccflags -c bar2.c >/dev/null 2>&1
19072$cc $ccflags -c foo.c >/dev/null 2>&1
19073$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 19074if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19075 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19076 echo "$ar appears to generate random libraries itself."
19077 orderlib=false
19078 ranlib=":"
19079elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 19080 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19081 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19082 echo "a table of contents needs to be added with '$ar ts'."
19083 orderlib=false
19084 ranlib="$ar ts"
19085else
19086 case "$ranlib" in
19087 :) ranlib='';;
19088 '')
19089 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19090 $test -f $ranlib || ranlib=''
19091 ;;
19092 esac
19093 if $test -n "$ranlib"; then
19094 echo "your system has '$ranlib'; we'll use that."
19095 orderlib=false
19096 else
19097 echo "your system doesn't seem to support random libraries"
19098 echo "so we'll use lorder and tsort to order the libraries."
19099 orderlib=true
19100 ranlib=":"
19101 fi
19102fi
19103$rm -f foo* bar*
19104
19105: check for type of arguments to select.
19106case "$selecttype" in
19107'') case "$d_select" in
19108 $define)
19109 echo " "
19110 $cat <<EOM
19111Checking to see what type of arguments are accepted by select().
19112EOM
19113 hdrs="$define sys/types.h
19114 $i_systime sys/time.h
19115 $i_sysselct sys/select.h
19116 $d_socket sys/socket.h"
19117 : The first arg can be int, unsigned, or size_t
19118 : The last arg may or may not be 'const'
19119 val=''
19120 : void pointer has been seen but using that
19121 : breaks the selectminbits test
19122 for xxx in 'fd_set *' 'int *'; do
19123 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19124 for tmo in 'struct timeval *' 'const struct timeval *'; do
19125 case "$val" in
19126 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19127 if ./protochk "$try" $hdrs; then
19128 echo "Your system accepts $xxx."
19129 val="$xxx"
19130 fi
19131 ;;
19132 esac
19133 done
19134 done
19135 done
19136 case "$val" in
19137 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19138 case "$d_fd_set" in
19139 $define) dflt="fd_set *" ;;
19140 *) dflt="int *" ;;
19141 esac
19142 . ./myread
19143 val=$ans
19144 ;;
19145 esac
19146 selecttype="$val"
19147 ;;
19148 *) : no select, so pick a harmless default
19149 selecttype='int *'
19150 ;;
19151 esac
19152 ;;
19153esac
19154
19155: check for the select 'width'
19156case "$selectminbits" in
e6e7e605
JH
19157'') safebits=`expr $ptrsize \* 8`
19158 case "$d_select" in
b4eb6b3d
JH
19159 $define)
19160 $cat <<EOM
19161
19162Checking to see on how many bits at a time your select() operates...
19163EOM
19164 $cat >try.c <<EOCP
19165#include <sys/types.h>
19166#$i_time I_TIME
19167#$i_systime I_SYS_TIME
19168#$i_systimek I_SYS_TIME_KERNEL
19169#ifdef I_TIME
19170# include <time.h>
19171#endif
19172#ifdef I_SYS_TIME
19173# ifdef I_SYS_TIME_KERNEL
19174# define KERNEL
19175# endif
19176# include <sys/time.h>
19177# ifdef I_SYS_TIME_KERNEL
19178# undef KERNEL
19179# endif
19180#endif
19181#$i_sysselct I_SYS_SELECT
19182#ifdef I_SYS_SELECT
19183#include <sys/select.h>
19184#endif
19185#$d_socket HAS_SOCKET
19186#ifdef HAS_SOCKET
19187# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19188#endif
19189#include <stdio.h>
d1daaddf
JH
19190#$i_stdlib I_STDLIB
19191#ifdef I_STDLIB
19192#include <stdlib.h>
19193#endif
b4eb6b3d
JH
19194$selecttype b;
19195#define S sizeof(*(b))
19196#define MINBITS 64
19197#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19198#define NBITS (NBYTES * 8)
19199int main() {
e6e7e605 19200 char *s = malloc(NBYTES);
b4eb6b3d
JH
19201 struct timeval t;
19202 int i;
19203 FILE* fp;
19204 int fd;
19205
e6e7e605
JH
19206 if (!s)
19207 exit(1);
b4eb6b3d
JH
19208 fclose(stdin);
19209 fp = fopen("try.c", "r");
19210 if (fp == 0)
e6e7e605 19211 exit(2);
b4eb6b3d
JH
19212 fd = fileno(fp);
19213 if (fd < 0)
e6e7e605 19214 exit(3);
b4eb6b3d
JH
19215 b = ($selecttype)s;
19216 for (i = 0; i < NBITS; i++)
19217 FD_SET(i, b);
19218 t.tv_sec = 0;
19219 t.tv_usec = 0;
19220 select(fd + 1, b, 0, 0, &t);
19221 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
e6e7e605 19222 free(s);
b4eb6b3d
JH
19223 printf("%d\n", i + 1);
19224 return 0;
19225}
19226EOCP
19227 set try
19228 if eval $compile_ok; then
5440bc8e 19229 selectminbits=`$run ./try`
b4eb6b3d
JH
19230 case "$selectminbits" in
19231 '') cat >&4 <<EOM
19232Cannot figure out on how many bits at a time your select() operates.
e6e7e605 19233I'll play safe and guess it is $safebits bits.
b4eb6b3d 19234EOM
e6e7e605
JH
19235 selectminbits=$safebits
19236 bits="$safebits bits"
b4eb6b3d
JH
19237 ;;
19238 1) bits="1 bit" ;;
19239 *) bits="$selectminbits bits" ;;
19240 esac
19241 echo "Your select() operates on $bits at a time." >&4
19242 else
19243 rp='What is the minimum number of bits your select() operates on?'
19244 case "$byteorder" in
e6e7e605
JH
19245 12345678) dflt=64 ;;
19246 1234) dflt=32 ;;
b4eb6b3d
JH
19247 *) dflt=1 ;;
19248 esac
19249 . ./myread
19250 val=$ans
19251 selectminbits="$val"
19252 fi
19253 $rm -f try.* try
19254 ;;
19255 *) : no select, so pick a harmless default
e6e7e605 19256 selectminbits=$safebits
b4eb6b3d
JH
19257 ;;
19258 esac
19259 ;;
19260esac
19261
19262: Trace out the files included by signal.h, then look for SIGxxx names.
19263: Remove SIGARRAYSIZE used by HPUX.
19264: Remove SIGSTKSIZE used by Linux.
19265: Remove SIGSTKSZ used by Posix.
19266: Remove SIGTYP void lines used by OS2.
19267: Some cpps, like os390, dont give the file name anywhere
19268if [ "X$fieldn" = X ]; then
19269 : Just make some guesses. We check them later.
19270 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19271else
19272 xxx=`echo '#include <signal.h>' |
19273 $cppstdin $cppminus $cppflags 2>/dev/null |
19274 $grep '^[ ]*#.*include' |
a938a3bb 19275 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
19276fi
19277: Check this list of files to be sure we have parsed the cpp output ok.
19278: This will also avoid potentially non-existent files, such
19279: as ../foo/bar.h
19280xxxfiles=''
19281for xx in $xxx /dev/null ; do
19282 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19283done
19284: If we have found no files, at least try signal.h
19285case "$xxxfiles" in
19286'') xxxfiles=`./findhdr signal.h` ;;
19287esac
19288xxx=`awk '
19289$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19290 print substr($2, 4, 20)
19291}
19292$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19293 print substr($3, 4, 20)
19294}' $xxxfiles`
19295: Append some common names just in case the awk scan failed.
19296xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19297xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19298xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19299xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19300xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19301
19302: generate a few handy files for later
55954f19 19303$cat > signal.c <<EOCP
b4eb6b3d
JH
19304#include <sys/types.h>
19305#include <signal.h>
55954f19
JH
19306#$i_stdlib I_STDLIB
19307#ifdef I_STDLIB
19308#include <stdlib.h>
19309#endif
b4eb6b3d
JH
19310#include <stdio.h>
19311int main() {
19312
19313/* Strange style to avoid deeply-nested #if/#else/#endif */
19314#ifndef NSIG
19315# ifdef _NSIG
19316# define NSIG (_NSIG)
19317# endif
19318#endif
19319
19320#ifndef NSIG
19321# ifdef SIGMAX
19322# define NSIG (SIGMAX+1)
19323# endif
19324#endif
19325
19326#ifndef NSIG
19327# ifdef SIG_MAX
19328# define NSIG (SIG_MAX+1)
19329# endif
19330#endif
19331
19332#ifndef NSIG
19333# ifdef MAXSIG
19334# define NSIG (MAXSIG+1)
19335# endif
19336#endif
19337
19338#ifndef NSIG
19339# ifdef MAX_SIG
19340# define NSIG (MAX_SIG+1)
19341# endif
19342#endif
19343
19344#ifndef NSIG
19345# ifdef SIGARRAYSIZE
19346# define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
19347# endif
19348#endif
19349
19350#ifndef NSIG
19351# ifdef _sys_nsig
19352# define NSIG (_sys_nsig) /* Solaris 2.5 */
19353# endif
19354#endif
19355
19356/* Default to some arbitrary number that's big enough to get most
19357 of the common signals.
19358*/
19359#ifndef NSIG
19360# define NSIG 50
19361#endif
19362
19363printf("NSIG %d\n", NSIG);
19364
19365#ifndef JUST_NSIG
19366
19367EOCP
19368
19369echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19370{
19371 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 19372 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
19373 printf $1; printf ");\n"
19374 printf "#endif\n"
19375}
19376END {
19377 printf "#endif /* JUST_NSIG */\n";
19378 printf "exit(0);\n}\n";
19379}
19380' >>signal.c
19381$cat >signal.awk <<'EOP'
19382BEGIN { ndups = 0 }
65197d93 19383$1 ~ /^NSIG$/ { nsig = $2 }
1ebe1ffb 19384($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
19385 if ($2 > maxsig) { maxsig = $2 }
19386 if (sig_name[$2]) {
19387 dup_name[ndups] = $1
19388 dup_num[ndups] = $2
b4eb6b3d
JH
19389 ndups++
19390 }
1ebe1ffb 19391 else {
65197d93
JH
19392 sig_name[$2] = $1
19393 sig_num[$2] = $2
b4eb6b3d
JH
19394 }
19395}
19396END {
19397 if (nsig == 0) {
19398 nsig = maxsig + 1
19399 }
19400 printf("NSIG %d\n", nsig);
19401 for (n = 1; n < nsig; n++) {
19402 if (sig_name[n]) {
19403 printf("%s %d\n", sig_name[n], sig_num[n])
19404 }
19405 else {
19406 printf("NUM%d %d\n", n, n)
19407 }
19408 }
19409 for (n = 0; n < ndups; n++) {
19410 printf("%s %d\n", dup_name[n], dup_num[n])
19411 }
19412}
19413EOP
19414$cat >signal_cmd <<EOS
19415$startsh
19416if $test -s signal.lst; then
19417 echo "Using your existing signal.lst file"
19418 exit 0
19419fi
19420xxx="$xxx"
19421EOS
19422$cat >>signal_cmd <<'EOS'
19423
19424set signal
19425if eval $compile_ok; then
1eb9ad5b 19426 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
19427else
19428 echo "(I can't seem be able to compile the whole test program)" >&4
19429 echo "(I'll try it in little pieces.)" >&4
19430 set signal -DJUST_NSIG
19431 if eval $compile_ok; then
5440bc8e 19432 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
19433 $cat signal.nsg
19434 else
19435 echo "I can't seem to figure out how many signals you have." >&4
19436 echo "Guessing 50." >&4
19437 echo 'NSIG 50' > signal.nsg
19438 fi
19439 : Now look at all the signal names, one at a time.
19440 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19441 $cat > signal.c <<EOCP
19442#include <sys/types.h>
19443#include <signal.h>
19444#include <stdio.h>
19445int main() {
19446printf("$xx %d\n", SIG${xx});
19447return 0;
19448}
19449EOCP
19450 set signal
19451 if eval $compile; then
19452 echo "SIG${xx} found."
5440bc8e 19453 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
19454 else
19455 echo "SIG${xx} NOT found."
19456 fi
19457 done
19458 if $test -s signal.ls1; then
19459 $cat signal.nsg signal.ls1 |
65197d93 19460 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
19461 fi
19462
19463fi
19464if $test -s signal.lst; then
19465 :
19466else
19467 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19468 echo 'kill -l' >signal
19469 set X `csh -f <signal`
19470 $rm -f signal
19471 shift
19472 case $# in
19473 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19474 esac
19475 echo $@ | $tr ' ' $trnl | \
19476 $awk '{ printf "%s %d\n", $1, ++s; }
19477 END { printf "NSIG %d\n", ++s }' >signal.lst
19478fi
19479$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19480EOS
19481chmod a+x signal_cmd
19482$eunicefix signal_cmd
19483
19484: generate list of signal names
19485echo " "
19486case "$sig_name_init" in
19487'') doinit=yes ;;
19488*) case "$sig_num_init" in
19489 ''|*,*) doinit=yes ;;
19490 esac ;;
19491esac
19492case "$doinit" in
19493yes)
19494 echo "Generating a list of signal names and numbers..." >&4
19495 . ./signal_cmd
19496 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19497 sig_name=`$awk 'BEGIN { printf "ZERO " }
19498 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19499 sig_num=`$awk 'BEGIN { printf "0 " }
19500 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19501 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
19502 !/^NSIG/ { printf "\"%s\", ", $1 }
19503 END { printf "0\n" }' signal.lst`
19504 sig_num_init=`$awk 'BEGIN { printf "0, " }
19505 !/^NSIG/ { printf "%d, ", $2}
19506 END { printf "0\n"}' signal.lst`
19507 ;;
19508esac
19509echo "The following $sig_count signals are available:"
19510echo " "
19511echo $sig_name | $awk \
19512'BEGIN { linelen = 0 }
19513{
19514 for (i = 1; i <= NF; i++) {
19515 name = "SIG" $i " "
19516 linelen = linelen + length(name)
19517 if (linelen > 70) {
19518 printf "\n"
19519 linelen = length(name)
19520 }
19521 printf "%s", name
19522 }
19523 printf "\n"
19524}'
76d3c696 19525sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
19526$rm -f signal signal.c signal.awk signal.lst signal_cmd
19527
19528echo " "
19529case "$sizetype" in
19530*_t) zzz="$sizetype" ;;
19531*) zzz="filesize" ;;
19532esac
19533echo "Checking the size of $zzz..." >&4
19534cat > try.c <<EOCP
19535#include <sys/types.h>
19536#include <stdio.h>
d1daaddf
JH
19537#$i_stdlib I_STDLIB
19538#ifdef I_STDLIB
19539#include <stdlib.h>
19540#endif
b4eb6b3d
JH
19541int main() {
19542 printf("%d\n", (int)sizeof($sizetype));
19543 exit(0);
19544}
19545EOCP
19546set try
19547if eval $compile_ok; then
5440bc8e 19548 yyy=`$run ./try`
b4eb6b3d
JH
19549 case "$yyy" in
19550 '') sizesize=4
19551 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19552 ;;
19553 *) sizesize=$yyy
19554 echo "Your $zzz size is $sizesize bytes."
19555 ;;
19556 esac
19557else
19558 sizesize=4
19559 echo "(I can't compile the test program--guessing $sizesize.)" >&4
19560fi
19561
19562
19563: check for socklen_t
19564echo " "
19565echo "Checking to see if you have socklen_t..." >&4
19566$cat >try.c <<EOCP
19567#include <sys/types.h>
19568#$d_socket HAS_SOCKET
19569#ifdef HAS_SOCKET
19570#include <sys/socket.h>
19571#endif
19572int main() { socklen_t x = 16; }
19573EOCP
19574set try
19575if eval $compile; then
19576 val="$define"
19577 echo "You have socklen_t."
19578else
19579 val="$undef"
19580 echo "You do not have socklen_t."
19581 case "$sizetype" in
19582 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19583 esac
19584fi
19585$rm -f try try.*
19586set d_socklen_t
19587eval $setvar
19588
a7710f8d
JH
19589: see if this is a socks.h system
19590set socks.h i_socks
19591eval $inhdr
19592
b4eb6b3d
JH
19593: check for type of the size argument to socket calls
19594case "$d_socket" in
19595"$define")
19596 $cat <<EOM
19597
19598Checking to see what type is the last argument of accept().
19599EOM
b4eb6b3d
JH
19600 yyy=''
19601 case "$d_socklen_t" in
19602 "$define") yyy="$yyy socklen_t"
19603 esac
19604 yyy="$yyy $sizetype int long unsigned"
19605 for xxx in $yyy; do
19606 case "$socksizetype" in
19607 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
19608 case "$usesocks" in
19609 "$define")
19610 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19611 echo "Your system accepts '$xxx *' for the last argument of accept()."
19612 socksizetype="$xxx"
19613 fi
19614 ;;
19615 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
19616 echo "Your system accepts '$xxx *' for the last argument of accept()."
19617 socksizetype="$xxx"
19618 fi
19619 ;;
19620 esac
b4eb6b3d
JH
19621 ;;
19622 esac
19623 done
19624: In case none of those worked, prompt the user.
19625 case "$socksizetype" in
19626 '') rp='What is the type for socket address structure sizes?'
19627 dflt='int'
19628 . ./myread
19629 socksizetype=$ans
19630 ;;
19631 esac
19632 ;;
19633*) : no sockets, so pick relatively harmless default
19634 socksizetype='int'
19635 ;;
19636esac
19637
19638: see what type is used for signed size_t
19639set ssize_t ssizetype int stdio.h sys/types.h
19640eval $typedef
19641dflt="$ssizetype"
5440bc8e 19642$cat > try.c <<EOM
b4eb6b3d 19643#include <stdio.h>
d1daaddf
JH
19644#$i_stdlib I_STDLIB
19645#ifdef I_STDLIB
19646#include <stdlib.h>
19647#endif
b4eb6b3d
JH
19648#include <sys/types.h>
19649#define Size_t $sizetype
19650#define SSize_t $dflt
19651int main()
19652{
19653 if (sizeof(Size_t) == sizeof(SSize_t))
19654 printf("$dflt\n");
19655 else if (sizeof(Size_t) == sizeof(int))
19656 printf("int\n");
19657 else
19658 printf("long\n");
19659 exit(0);
19660}
19661EOM
19662echo " "
5440bc8e
JH
19663set try
19664if eval $compile_ok && $run ./try > /dev/null; then
19665 ssizetype=`$run ./try`
b4eb6b3d
JH
19666 echo "I'll be using $ssizetype for functions returning a byte count." >&4
19667else
19668 $cat >&4 <<EOM
19669Help! I can't compile and run the ssize_t test program: please enlighten me!
19670(This is probably a misconfiguration in your system or libraries, and
19671you really ought to fix it. Still, I'll try anyway.)
19672
19673I need a type that is the same size as $sizetype, but is guaranteed to
19674be signed. Common values are ssize_t, int and long.
19675
19676EOM
19677 rp="What signed type is the same size as $sizetype?"
19678 . ./myread
19679 ssizetype="$ans"
19680fi
5440bc8e 19681$rm -f try try.*
b4eb6b3d
JH
19682
19683: see what type of char stdio uses.
19684echo " "
aa517f50
JH
19685echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
19686if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
19687 echo "Your stdio uses unsigned chars." >&4
19688 stdchar="unsigned char"
19689else
aa517f50
JH
19690 echo "Your stdio uses signed chars." >&4
19691 stdchar="char"
b4eb6b3d 19692fi
aa517f50
JH
19693$rm -f stdioh
19694
19695
b4eb6b3d 19696
b4eb6b3d
JH
19697: see what type uids are declared as in the kernel
19698echo " "
19699echo "Looking for the type for user ids returned by getuid()."
19700set uid_t uidtype xxx stdio.h sys/types.h
19701eval $typedef
19702case "$uidtype" in
19703xxx)
19704 xxx=`./findhdr sys/user.h`
19705 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19706 case $1 in
19707 unsigned) dflt="$1 $2" ;;
19708 *) dflt="$1" ;;
19709 esac
19710 ;;
19711*) dflt="$uidtype";;
19712esac
19713case "$uidtype" in
19714uid_t) echo "uid_t found." ;;
19715*) rp="What is the type for user ids returned by getuid()?"
19716 . ./myread
19717 uidtype="$ans"
19718 ;;
19719esac
19720
19721echo " "
19722case "$uidtype" in
19723*_t) zzz="$uidtype" ;;
19724*) zzz="uid" ;;
19725esac
19726echo "Checking the size of $zzz..." >&4
19727cat > try.c <<EOCP
19728#include <sys/types.h>
19729#include <stdio.h>
d1daaddf
JH
19730#$i_stdlib I_STDLIB
19731#ifdef I_STDLIB
19732#include <stdlib.h>
19733#endif
b4eb6b3d
JH
19734int main() {
19735 printf("%d\n", (int)sizeof($uidtype));
19736 exit(0);
19737}
19738EOCP
19739set try
19740if eval $compile_ok; then
5440bc8e 19741 yyy=`$run ./try`
b4eb6b3d
JH
19742 case "$yyy" in
19743 '') uidsize=4
19744 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19745 ;;
19746 *) uidsize=$yyy
19747 echo "Your $zzz is $uidsize bytes long."
19748 ;;
19749 esac
19750else
19751 uidsize=4
19752 echo "(I can't compile the test program--guessing $uidsize.)" >&4
19753fi
19754
19755echo " "
19756case "$uidtype" in
19757*_t) zzz="$uidtype" ;;
19758*) zzz="uid" ;;
19759esac
19760echo "Checking the sign of $zzz..." >&4
19761cat > try.c <<EOCP
19762#include <sys/types.h>
19763#include <stdio.h>
19764int main() {
19765 $uidtype foo = -1;
19766 if (foo < 0)
19767 printf("-1\n");
19768 else
19769 printf("1\n");
19770}
19771EOCP
19772set try
19773if eval $compile; then
5440bc8e 19774 yyy=`$run ./try`
b4eb6b3d
JH
19775 case "$yyy" in
19776 '') uidsign=1
19777 echo "(I can't execute the test program--guessing unsigned.)" >&4
19778 ;;
19779 *) uidsign=$yyy
19780 case "$uidsign" in
19781 1) echo "Your $zzz is unsigned." ;;
19782 -1) echo "Your $zzz is signed." ;;
19783 esac
19784 ;;
19785 esac
19786else
19787 uidsign=1
19788 echo "(I can't compile the test program--guessing unsigned.)" >&4
19789fi
19790
19791
19792
19793echo " "
19794$echo "Checking the format string to be used for uids..." >&4
19795
19796case "$uidsign" in
19797-1) if $test X"$uidsize" = X"$ivsize"; then
19798 uidformat="$ivdformat"
19799 else
19800 if $test X"$uidsize" = X"$longsize"; then
19801 uidformat='"ld"'
19802 else
19803 if $test X"$uidsize" = X"$intsize"; then
19804 uidformat='"d"'
19805 else
19806 if $test X"$uidsize" = X"$shortsize"; then
19807 uidformat='"hd"'
19808 fi
19809 fi
19810 fi
19811 fi
19812 ;;
19813*) if $test X"$uidsize" = X"$uvsize"; then
19814 uidformat="$uvuformat"
19815 else
19816 if $test X"$uidsize" = X"$longsize"; then
19817 uidformat='"lu"'
19818 else
19819 if $test X"$uidsize" = X"$intsize"; then
19820 uidformat='"u"'
19821 else
19822 if $test X"$uidsize" = X"$shortsize"; then
19823 uidformat='"hu"'
19824 fi
19825 fi
19826 fi
19827 fi
19828 ;;
19829esac
19830
4afd418c
MB
19831
19832case "$usesitecustomize" in
19833 $define|true|[Yy]*)
19834 usesitecustomize="$define"
19835 ;;
19836 *)
19837 usesitecustomize="$undef"
19838 ;;
19839 esac
19840
3659ebf1
JH
19841: determine compiler compiler
19842case "$yacc" in
19843'')
19844 dflt=yacc;;
19845*)
19846 dflt="$yacc";;
19847esac
19848echo " "
19849comp='yacc'
3c728e00 19850if $test -f "$byacc$_exe"; then
3659ebf1
JH
19851 dflt="$byacc"
19852 comp="byacc or $comp"
19853fi
3c728e00 19854if $test -f "$bison$_exe"; then
3659ebf1
JH
19855 comp="$comp or bison -y"
19856fi
19857rp="Which compiler compiler ($comp) shall I use?"
19858. ./myread
19859yacc="$ans"
19860case "$yacc" in
19861*bis*)
19862 case "$yacc" in
19863 *-y*) ;;
19864 *)
19865 yacc="$yacc -y"
19866 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19867 ;;
19868 esac
19869 ;;
19870esac
19871
758a5d79
JH
19872: see if this is a fp.h system
19873set fp.h i_fp
19874eval $inhdr
19875
19876: see if this is a fp_class.h system
19877set fp_class.h i_fp_class
19878eval $inhdr
19879
b4eb6b3d 19880: see if this is a ieeefp.h system
b5b9f165
JH
19881case "$i_ieeefp" in
19882'' ) set ieeefp.h i_ieeefp
19883 eval $inhdr
19884 ;;
19885esac
b4eb6b3d
JH
19886
19887: see if this is a libutil.h system
19888set libutil.h i_libutil
19889eval $inhdr
19890
b4eb6b3d
JH
19891: see if mach cthreads are available
19892if test "X$usethreads" = "X$define"; then
19893 set mach/cthreads.h i_machcthr
19894 eval $inhdr
19895else
19896 i_machcthr="$undef"
19897fi
19898
19899
19900
b4eb6b3d
JH
19901: see if this is a mntent.h system
19902set mntent.h i_mntent
19903eval $inhdr
19904
19905: see if ndbm.h is available
19906set ndbm.h t_ndbm
19907eval $inhdr
1c6861ad
JS
19908
19909case "$t_ndbm" in
19910$undef)
19911 # Some Linux distributions such as RedHat 7.1 put the
19912 # ndbm.h header in /usr/include/gdbm/ndbm.h.
19913 if $test -f /usr/include/gdbm/ndbm.h; then
d11b91bf 19914 echo '<gdbm/ndbm.h> found.'
1c6861ad
JS
19915 ccflags="$ccflags -I/usr/include/gdbm"
19916 cppflags="$cppflags -I/usr/include/gdbm"
19917 t_ndbm=$define
19918 fi
19919 ;;
19920esac
19921
b4eb6b3d
JH
19922case "$t_ndbm" in
19923$define)
19924 : see if dbm_open exists
19925 set dbm_open d_dbm_open
19926 eval $inlibc
19927 case "$d_dbm_open" in
19928 $undef)
19929 t_ndbm="$undef"
19930 echo "We won't be including <ndbm.h>"
19931 ;;
19932 esac
19933 ;;
19934esac
19935val="$t_ndbm"
19936set i_ndbm
19937eval $setvar
19938
19939: see if net/errno.h is available
19940val=''
19941set net/errno.h val
19942eval $inhdr
19943
19944: Unfortunately, it causes problems on some systems. Arrgh.
19945case "$val" in
19946$define)
19947 cat > try.c <<'EOM'
19948#include <stdio.h>
19949#include <errno.h>
19950#include <net/errno.h>
19951int func()
19952{
19953 return ENOTSOCK;
19954}
19955EOM
19956 if $cc $ccflags -c try.c >/dev/null 2>&1; then
19957 echo "We'll be including <net/errno.h>." >&4
19958 else
19959 echo "We won't be including <net/errno.h>." >&4
19960 val="$undef"
19961 fi
19962 $rm -f try.* try
19963 ;;
19964esac
19965set i_neterrno
19966eval $setvar
19967
19968: see if netinet/tcp.h is available
19969set netinet/tcp.h i_netinettcp
19970eval $inhdr
19971
19972: see if this is a poll.h system
19973set poll.h i_poll
19974eval $inhdr
19975
19976: see if this is a prot.h system
19977set prot.h i_prot
19978eval $inhdr
19979
19980echo " "
19981$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
19982$cat <<'EOSH' > Cppsym.know
19983a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
19984AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
d46c9a2d
JH
19985alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
19986ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
19987BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
19988BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
19989bull c cadmus clipper CMU COFF COMPILER_VERSION
19990concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
8b7d8421 19991CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
19992Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
19993FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
19994GLIBC GLIBC_MINOR
19995GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
19996H3050R H3050RX hbullx20 hcx host_mips
19997hp200 hp300 hp700 HP700 hp800 hp9000
19998hp9000s200 hp9000s300 hp9000s400 hp9000s500
19999hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20000i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 20001IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
20002INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20003LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20004LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20005Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20006LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20007M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20008M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20009M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20010MATH_HAS_NO_SIDE_EFFECTS
20011mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20012mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20013mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20014MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20015mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20016NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 20017news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
20018ns32016 ns32332 ns32k nsc32000
20019OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20020pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20021pc532 pdp11 PGC PIC plexus PORTAR posix
20022POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20023POSIX_C_SOURCE POSIX_SOURCE POWER
20024PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 20025riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
20026SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20027sony sony_news sonyrisc sparc sparclite spectrum
20028stardent stdc STDC_EXT stratos sun sun3 sun386
20029Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20030SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20031SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20032sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 20033TM3200 TM5400 TM5600
b4eb6b3d
JH
20034tower tower32 tower32_200 tower32_600 tower32_700
20035tower32_800 tower32_850 tss
20036u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20037ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
20038unix UNIX95 UNIX99 unixpc unos
20039USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20040USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20041USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20042USGr4 USGr4_2
b4eb6b3d
JH
20043Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
20044XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20045XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20046z8000
20047EOSH
20048# Maybe put other stuff here too.
20049cat <<EOSH >>Cppsym.know
20050$osname
20051EOSH
20052./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20053./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20054$cat Cppsym.know > Cppsym.c
381aa1ff 20055$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
20056$rm -f Cppsym.a Cppsym.b Cppsym.c
20057cat <<EOSH > Cppsym
20058$startsh
20059if $test \$# -gt 0; then
20060 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20061 if $test -s Cppsym.got; then
20062 $rm -f Cppsym.got
20063 exit 0
20064 fi
20065 $rm -f Cppsym.got
20066 exit 1
20067else
20068 $tr " " "$trnl" | ./Cppsym.try
20069 exit 0
20070fi
20071EOSH
20072chmod +x Cppsym
20073$eunicefix Cppsym
20074cat <<EOSH > Cppsym.try
20075$startsh
20076cat <<'EOCP' > try.c
20077#include <stdio.h>
20078int main() {
20079EOCP
20080$awk \\
20081EOSH
20082cat <<'EOSH' >> Cppsym.try
20083'length($1) > 0 {
2ef53570
JH
20084 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
20085 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
20086 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
20087 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 20088}' >> try.c
2ef53570 20089echo 'return 0;}' >> try.c
b4eb6b3d
JH
20090EOSH
20091cat <<EOSH >> Cppsym.try
20092ccflags="$ccflags"
20093case "$osname-$gccversion" in
20094irix-) ccflags="\$ccflags -woff 1178" ;;
20095os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20096esac
5440bc8e 20097$cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
b4eb6b3d
JH
20098EOSH
20099chmod +x Cppsym.try
20100$eunicefix Cppsym.try
20101./Cppsym < Cppsym.know > Cppsym.true
20102: now check the C compiler for additional symbols
20103postprocess_cc_v=''
20104case "$osname" in
20105aix) postprocess_cc_v="|$tr , ' '" ;;
20106esac
20107$cat >ccsym <<EOS
20108$startsh
20109$cat >tmp.c <<EOF
20110extern int foo;
20111EOF
20112for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20113do
20114 case "\$i" in
20115 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 20116 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
20117 esac
20118done
20119$rm -f try.c
20120EOS
20121postprocess_cc_v=''
20122chmod +x ccsym
20123$eunicefix ccsym
20124./ccsym > ccsym1.raw
20125if $test -s ccsym1.raw; then
20126 $sort ccsym1.raw | $uniq >ccsym.raw
20127else
20128 mv ccsym1.raw ccsym.raw
20129fi
20130
20131$awk '/\=/ { print $0; next }
20132 { print $0"=1" }' ccsym.raw >ccsym.list
20133$awk '/\=/ { print $0; next }
20134 { print $0"=1" }' Cppsym.true >ccsym.true
20135$comm -13 ccsym.true ccsym.list >ccsym.own
20136$comm -12 ccsym.true ccsym.list >ccsym.com
20137$comm -23 ccsym.true ccsym.list >ccsym.cpp
20138also=''
20139if $test -z ccsym.raw; then
20140 echo "Your C compiler doesn't seem to define any symbols!" >&4
20141 echo " "
20142 echo "However, your C preprocessor defines the following symbols:"
20143 $cat Cppsym.true
20144 ccsymbols=''
20145 cppsymbols=`$cat Cppsym.true`
20146 cppsymbols=`echo $cppsymbols`
20147 cppccsymbols="$cppsymbols"
20148else
20149 if $test -s ccsym.com; then
20150 echo "Your C compiler and pre-processor define these symbols:"
20151 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20152 also='also '
20153 symbols='ones'
20154 cppccsymbols=`$cat ccsym.com`
20155 cppccsymbols=`echo $cppccsymbols`
20156 $test "$silent" || sleep 1
20157 fi
20158 if $test -s ccsym.cpp; then
20159 $test "$also" && echo " "
20160 echo "Your C pre-processor ${also}defines the following symbols:"
20161 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20162 also='further '
20163 cppsymbols=`$cat ccsym.cpp`
20164 cppsymbols=`echo $cppsymbols`
20165 $test "$silent" || sleep 1
20166 fi
20167 if $test -s ccsym.own; then
20168 $test "$also" && echo " "
20169 echo "Your C compiler ${also}defines the following cpp symbols:"
20170 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20171 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20172 ccsymbols=`$cat ccsym.own`
20173 ccsymbols=`echo $ccsymbols`
20174 $test "$silent" || sleep 1
20175 fi
20176fi
b4eb6b3d
JH
20177
20178: see if this is a termio system
20179val="$undef"
20180val2="$undef"
20181val3="$undef"
20182if $test `./findhdr termios.h`; then
20183 set tcsetattr i_termios
20184 eval $inlibc
20185 val3="$i_termios"
20186fi
20187echo " "
20188case "$val3" in
20189"$define") echo "You have POSIX termios.h... good!" >&4;;
20190*) if ./Cppsym pyr; then
20191 case "`/bin/universe`" in
20192 ucb) if $test `./findhdr sgtty.h`; then
20193 val2="$define"
20194 echo "<sgtty.h> found." >&4
20195 else
20196 echo "System is pyramid with BSD universe."
20197 echo "<sgtty.h> not found--you could have problems." >&4
20198 fi;;
20199 *) if $test `./findhdr termio.h`; then
20200 val="$define"
20201 echo "<termio.h> found." >&4
20202 else
20203 echo "System is pyramid with USG universe."
20204 echo "<termio.h> not found--you could have problems." >&4
20205 fi;;
20206 esac
20207 elif ./usg; then
20208 if $test `./findhdr termio.h`; then
20209 echo "<termio.h> found." >&4
20210 val="$define"
20211 elif $test `./findhdr sgtty.h`; then
20212 echo "<sgtty.h> found." >&4
20213 val2="$define"
20214 else
20215echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20216 fi
20217 else
20218 if $test `./findhdr sgtty.h`; then
20219 echo "<sgtty.h> found." >&4
20220 val2="$define"
20221 elif $test `./findhdr termio.h`; then
20222 echo "<termio.h> found." >&4
20223 val="$define"
20224 else
20225echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20226 fi
20227 fi;;
20228esac
20229set i_termio; eval $setvar
20230val=$val2; set i_sgtty; eval $setvar
20231val=$val3; set i_termios; eval $setvar
20232
b4eb6b3d
JH
20233: see if stddef is available
20234set stddef.h i_stddef
20235eval $inhdr
923fc586 20236
b4eb6b3d
JH
20237: see if this is a sunmath.h system
20238set sunmath.h i_sunmath
20239eval $inhdr
5f80c64f 20240
b4eb6b3d
JH
20241: see if sys/access.h is available
20242set sys/access.h i_sysaccess
20243eval $inhdr
20244
20245: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20246set sys/filio.h i_sysfilio
20247eval $inhdr
20248echo " "
20249if $test `./findhdr sys/ioctl.h`; then
20250 val="$define"
20251 echo '<sys/ioctl.h> found.' >&4
20252else
20253 val="$undef"
20254 if $test $i_sysfilio = "$define"; then
20255 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 20256 else
b4eb6b3d
JH
20257 $test $i_sgtty = "$define" && xxx="sgtty.h"
20258 $test $i_termio = "$define" && xxx="termio.h"
20259 $test $i_termios = "$define" && xxx="termios.h"
20260echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20261 fi
20262fi
20263set i_sysioctl
20264eval $setvar
20265
49a78c82
JH
20266: see if socket ioctl defs are in sys/sockio.h
20267echo " "
20268xxx=`./findhdr sys/sockio.h`
20269if $test "$xxx"; then
20270 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20271 val="$define"
20272 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20273 else
20274 val="$undef"
20275 echo "No socket ioctls found in <sys/sockio.h>." >&4
20276 fi
20277else
20278 val="$undef"
20279 $cat <<EOM
20280<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20281EOM
20282fi
20283set i_syssockio
20284eval $setvar
20285
b4eb6b3d
JH
20286
20287: see if this is a syslog.h system
20288set syslog.h i_syslog
20289eval $inhdr
20290
20291
20292: see if this is a sys/mode.h system
20293set sys/mode.h i_sysmode
20294eval $inhdr
20295
20296: see if sys/resource.h has to be included
20297set sys/resource.h i_sysresrc
20298eval $inhdr
20299
20300: see if sys/security.h is available
20301set sys/security.h i_syssecrt
20302eval $inhdr
20303
20304: see if this is a sys/statvfs.h system
20305set sys/statvfs.h i_sysstatvfs
20306eval $inhdr
20307
b4eb6b3d
JH
20308: see if this is a sys/un.h system
20309set sys/un.h i_sysun
20310eval $inhdr
20311
20312
20313: see if this is a sys/utsname.h system
20314set sys/utsname.h i_sysutsname
20315eval $inhdr
20316
20317: see if this is a syswait system
20318set sys/wait.h i_syswait
20319eval $inhdr
20320
20321: see if this is a ustat.h system
20322set ustat.h i_ustat
20323eval $inhdr
20324
20325: see if this is an utime system
20326set utime.h i_utime
20327eval $inhdr
20328
20329: see if this is a values.h system
20330set values.h i_values
20331eval $inhdr
20332
20333: see if this is a vfork system
20334case "$d_vfork" in
20335"$define")
20336 set vfork.h i_vfork
20337 eval $inhdr
20338 ;;
20339*)
20340 i_vfork="$undef"
20341 ;;
20342esac
20343
20344: see if gdbm.h is available
20345set gdbm.h t_gdbm
20346eval $inhdr
20347case "$t_gdbm" in
20348$define)
20349 : see if gdbm_open exists
20350 set gdbm_open d_gdbm_open
20351 eval $inlibc
20352 case "$d_gdbm_open" in
20353 $undef)
20354 t_gdbm="$undef"
20355 echo "We won't be including <gdbm.h>"
5f80c64f 20356 ;;
b4eb6b3d
JH
20357 esac
20358 ;;
20359esac
20360val="$t_gdbm"
20361set i_gdbm
20362eval $setvar
20363
20364echo " "
20365echo "Looking for extensions..." >&4
20366: If we are using the old config.sh, known_extensions may contain
20367: old or inaccurate or duplicate values.
20368known_extensions=''
20369nonxs_extensions=''
20370: We do not use find because it might not be available.
20371: We do not just use MANIFEST because the user may have dropped
20372: some additional extensions into the source tree and expect them
20373: to be built.
20374
20375: Function to recursively find available extensions, ignoring DynaLoader
20376: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20377find_extensions='
20378 for xxx in *; do
20379 case "$xxx" in
20380 DynaLoader|dynaload) ;;
20381 *)
20382 if $test -f $xxx/$xxx.xs; then
20383 known_extensions="$known_extensions $1$xxx";
20384 elif $test -f $xxx/Makefile.PL; then
20385 nonxs_extensions="$nonxs_extensions $1$xxx";
20386 else
20387 if $test -d $xxx -a $# -lt 10; then
20388 set $1$xxx/ $*;
6904989c 20389 cd "$xxx";
b4eb6b3d
JH
20390 eval $find_extensions;
20391 cd ..;
20392 shift;
20393 fi;
20394 fi
20395 ;;
20396 esac;
20397 done'
20398tdir=`pwd`
6904989c 20399cd "$rsrc/ext"
b4eb6b3d
JH
20400set X
20401shift
20402eval $find_extensions
4e1a6d26
AD
20403# Special case: Add in threads/shared since it is not picked up by the
20404# recursive find above (and adding in general recursive finding breaks
20405# SDBM_File/sdbm). A.D. 10/25/2001.
998b396c 20406known_extensions="$known_extensions threads/shared"
b4eb6b3d
JH
20407set X $nonxs_extensions
20408shift
20409nonxs_extensions="$*"
20410set X $known_extensions
20411shift
20412known_extensions="$*"
6904989c 20413cd "$tdir"
b4eb6b3d
JH
20414
20415: Now see which are supported on this system.
20416avail_ext=''
20417for xxx in $known_extensions ; do
20418 case "$xxx" in
20419 DB_File|db_file)
20420 case "$i_db" in
20421 $define) avail_ext="$avail_ext $xxx" ;;
20422 esac
20423 ;;
20424 GDBM_File|gdbm_fil)
20425 case "$i_gdbm" in
20426 $define) avail_ext="$avail_ext $xxx" ;;
20427 esac
20428 ;;
1d59c593 20429 I18N/Langinfo|i18n_lan)
4bbcc6e8
JH
20430 case "$i_langinfo$d_nl_langinfo" in
20431 $define$define) avail_ext="$avail_ext $xxx" ;;
20432 esac
20433 ;;
b4eb6b3d
JH
20434 NDBM_File|ndbm_fil)
20435 case "$i_ndbm" in
20436 $define)
20437 case "$osname-$use64bitint" in
0be9fa5d 20438 hpux-define)
b4eb6b3d
JH
20439 case "$libs" in
20440 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20441 esac
20442 ;;
20443 *) avail_ext="$avail_ext $xxx" ;;
20444 esac
20445 ;;
20446 esac
20447 ;;
20448 ODBM_File|odbm_fil)
20449 case "${i_dbm}${i_rpcsvcdbm}" in
20450 *"${define}"*)
20451 case "$osname-$use64bitint" in
0be9fa5d 20452 hpux-define)
b4eb6b3d
JH
20453 case "$libs" in
20454 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20455 esac
20456 ;;
20457 *) avail_ext="$avail_ext $xxx" ;;
20458 esac
20459 ;;
20460 esac
20461 ;;
20462 POSIX|posix)
20463 case "$useposix" in
20464 true|define|y) avail_ext="$avail_ext $xxx" ;;
20465 esac
20466 ;;
20467 Opcode|opcode)
20468 case "$useopcode" in
20469 true|define|y) avail_ext="$avail_ext $xxx" ;;
20470 esac
20471 ;;
20472 Socket|socket)
20473 case "$d_socket" in
4a9f028c
JH
20474 true|$define|y)
20475 case "$osname" in
20476 beos) ;; # not unless BONE
20477 *) avail_ext="$avail_ext $xxx" ;;
20478 esac
20479 ;;
b4eb6b3d
JH
20480 esac
20481 ;;
20482 Sys/Syslog|sys/syslog)
20483 : XXX syslog requires socket
20484 case "$d_socket" in
20485 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20486 esac
20487 ;;
20488 Thread|thread)
b00ec89b
AB
20489 case "$usethreads" in
20490 true|$define|y)
20491 case "$useithreads" in
20492 $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20493 esac
b4eb6b3d
JH
20494 esac
20495 ;;
f9b6ed1c
AD
20496 XS/APItest|xs/apitest)
20497 # This is just for testing. Skip it unless we have dynamic loading.
20498
20499 case "$usedl" in
20500 $define) avail_ext="$avail_ext $xxx" ;;
20501 esac
20502 ;;
20503 XS/Typemap|xs/typemap)
20504 # This is just for testing. Skip it unless we have dynamic loading.
20505 case "$usedl" in
20506 $define) avail_ext="$avail_ext $xxx" ;;
20507 esac
20508 ;;
7deadc5f 20509 threads|threads/shared)
73e09c8f
JH
20510 # threads and threads::shared are special cases.
20511 # To stop people from asking "Perl 5.8.0 was supposed
20512 # to have this new fancy threads implementation but my
20513 # perl doesn't have it" and from people trying to
20514 # (re)install the threads module using CPAN.pm and
20515 # CPAN.pm then offering to reinstall Perl 5.8.0,
20516 # the threads.pm and threads/shared.pm will always be
20517 # there, croaking informatively ("you need to rebuild
20518 # all of Perl with threads, sorry") when threads haven't
20519 # been compiled in.
20520 # --jhi
20521 avail_ext="$avail_ext $xxx"
1dca008a 20522 ;;
b4eb6b3d
JH
20523 IPC/SysV|ipc/sysv)
20524 : XXX Do we need a useipcsysv variable here
20525 case "${d_msg}${d_sem}${d_shm}" in
20526 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20527 esac
20528 ;;
20529 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
20530 ;;
20531 esac
b4eb6b3d 20532done
5f80c64f 20533
b4eb6b3d
JH
20534set X $avail_ext
20535shift
20536avail_ext="$*"
5f80c64f 20537
ef0c5be8
JH
20538case "$onlyextensions" in
20539'') ;;
20540*) keepextensions=''
20541 echo "You have requested that only certains extensions be included..." >&4
20542 for i in $onlyextensions; do
20543 case " $avail_ext " in
20544 *" $i "*)
20545 echo "Keeping extension $i."
20546 keepextensions="$keepextensions $i"
20547 ;;
20548 *) echo "Ignoring extension $i." ;;
20549 esac
20550 done
20551 avail_ext="$keepextensions"
20552 ;;
20553esac
20554
20555case "$noextensions" in
20556'') ;;
20557*) keepextensions=''
20558 echo "You have requested that certain extensions be ignored..." >&4
20559 for i in $avail_ext; do
c3dadc13
AD
20560 case " $noextensions " in
20561 *" $i "*) echo "Ignoring extension $i." ;;
ef0c5be8
JH
20562 *) echo "Keeping extension $i.";
20563 keepextensions="$keepextensions $i"
20564 ;;
20565 esac
20566 done
20567 avail_ext="$keepextensions"
20568 ;;
20569esac
20570
b4eb6b3d
JH
20571: Now see which nonxs extensions are supported on this system.
20572: For now assume all are.
20573nonxs_ext=''
20574for xxx in $nonxs_extensions ; do
20575 case "$xxx" in
20576 *) nonxs_ext="$nonxs_ext $xxx"
20577 ;;
20578 esac
20579done
5f80c64f 20580
b4eb6b3d
JH
20581set X $nonxs_ext
20582shift
20583nonxs_ext="$*"
20584
20585case $usedl in
20586$define)
20587 $cat <<EOM
20588A number of extensions are supplied with $package. You may choose to
20589compile these extensions for dynamic loading (the default), compile
20590them into the $package executable (static loading), or not include
20591them at all. Answer "none" to include no extensions.
20592Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
20593
20594EOM
b4eb6b3d 20595 case "$dynamic_ext" in
736accd3
YST
20596 '')
20597 : Exclude those listed in static_ext
20598 dflt=''
20599 for xxx in $avail_ext; do
20600 case " $static_ext " in
20601 *" $xxx "*) ;;
20602 *) dflt="$dflt $xxx" ;;
20603 esac
20604 done
20605 set X $dflt
20606 shift
20607 dflt="$*"
20608 ;;
b4eb6b3d
JH
20609 *) dflt="$dynamic_ext"
20610 # Perhaps we are reusing an old out-of-date config.sh.
20611 case "$hint" in
20612 previous)
20613 if test X"$dynamic_ext" != X"$avail_ext"; then
20614 $cat <<EOM
20615NOTICE: Your previous config.sh list may be incorrect.
20616The extensions now available to you are
20617 ${avail_ext}
20618but the default list from your previous config.sh is
20619 ${dynamic_ext}
9c839522 20620
b4eb6b3d
JH
20621EOM
20622 fi
9c839522
PM
20623 ;;
20624 esac
b4eb6b3d
JH
20625 ;;
20626 esac
5f80c64f 20627 case "$dflt" in
b4eb6b3d
JH
20628 '') dflt=none;;
20629 esac
20630 rp="What extensions do you wish to load dynamically?"
20631 . ./myread
20632 case "$ans" in
20633 none) dynamic_ext=' ' ;;
20634 *) dynamic_ext="$ans" ;;
5f80c64f 20635 esac
5f80c64f 20636
b4eb6b3d
JH
20637 case "$static_ext" in
20638 '')
20639 : Exclude those already listed in dynamic linking
20640 dflt=''
20641 for xxx in $avail_ext; do
20642 case " $dynamic_ext " in
20643 *" $xxx "*) ;;
20644 *) dflt="$dflt $xxx" ;;
20645 esac
20646 done
20647 set X $dflt
20648 shift
20649 dflt="$*"
20650 ;;
20651 *) dflt="$static_ext"
20652 ;;
20653 esac
9c839522 20654
b4eb6b3d
JH
20655 case "$dflt" in
20656 '') dflt=none;;
20657 esac
20658 rp="What extensions do you wish to load statically?"
20659 . ./myread
20660 case "$ans" in
20661 none) static_ext=' ' ;;
20662 *) static_ext="$ans" ;;
20663 esac
20664 ;;
20665*)
20666 $cat <<EOM
20667A number of extensions are supplied with $package. Answer "none"
20668to include no extensions.
20669Note that DynaLoader is always built and need not be mentioned here.
9c839522 20670
b4eb6b3d
JH
20671EOM
20672 case "$static_ext" in
20673 '') dflt="$avail_ext" ;;
20674 *) dflt="$static_ext"
20675 # Perhaps we are reusing an old out-of-date config.sh.
20676 case "$hint" in
20677 previous)
20678 if test X"$static_ext" != X"$avail_ext"; then
20679 $cat <<EOM
20680NOTICE: Your previous config.sh list may be incorrect.
20681The extensions now available to you are
20682 ${avail_ext}
20683but the default list from your previous config.sh is
20684 ${static_ext}
5f80c64f
JH
20685
20686EOM
b4eb6b3d
JH
20687 fi
20688 ;;
20689 esac
20690 ;;
20691 esac
20692 : Exclude those that are not xs extensions
20693 case "$dflt" in
20694 '') dflt=none;;
20695 esac
20696 rp="What extensions do you wish to include?"
20697 . ./myread
20698 case "$ans" in
20699 none) static_ext=' ' ;;
20700 *) static_ext="$ans" ;;
20701 esac
20702 ;;
5f80c64f 20703esac
f1f6834f
AD
20704#
20705# Encode is a special case. If we are building Encode as a static
20706# extension, we need to explicitly list its subextensions as well.
20707# For other nested extensions, this is handled automatically by
20708# the appropriate Makefile.PL.
20709case " $static_ext " in
20710 *" Encode "*) # Add the subextensions of Encode
20711 cd "$rsrc/ext"
20712 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20713 static_ext="$static_ext Encode/$xxx"
20714 done
20715 cd "$tdir"
20716 ;;
20717esac
5f80c64f 20718
b4eb6b3d
JH
20719set X $dynamic_ext $static_ext $nonxs_ext
20720shift
20721extensions="$*"
20722
93a2cd18
AD
20723# Sanity check: We require an extension suitable for use with
20724# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
20725# should show up as failures in the test suite, but it's helpful to
20726# catch them now.) The 'extensions' list is normally sorted
20727# alphabetically, so we need to accept either
20728# DB_File ... Fcntl ... IO ....
20729# or something like
20730# Fcntl ... NDBM_File ... IO ....
42fde7b2
JH
20731case " $extensions" in
20732*"_File "*" Fcntl "*" IO "*) ;; # DB_File
20733*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
20734*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
7a8675bc
JH
20735*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
20736 echo "WARNING: The Perl you are building will be quite crippled." >& 4
20737 ;;
20738esac
20739
9c839522
PM
20740: Remove libraries needed only for extensions
20741: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
20742: The exception is SunOS 4.x, which needs them.
20743case "${osname}X${osvers}" in
20744sunos*X4*)
20745 perllibs="$libs"
20746 ;;
20747*) case "$usedl" in
20748 $define|true|[yY]*)
20749 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
20750 shift
20751 perllibs="$*"
20752 ;;
20753 *) perllibs="$libs"
20754 ;;
20755 esac
20756 ;;
9c839522 20757esac
5f80c64f
JH
20758
20759: Remove build directory name from cppstdin so it can be used from
20760: either the present location or the final installed location.
20761echo " "
20762: Get out of the UU directory to get correct path name.
20763cd ..
20764case "$cppstdin" in
20765`pwd`/cppstdin)
20766 echo "Stripping down cppstdin path name"
20767 cppstdin=cppstdin
20768 ;;
20769esac
20770cd UU
20771
20772: end of configuration questions
20773echo " "
20774echo "End of configuration questions."
20775echo " "
20776
20777: back to where it started
20778if test -d ../UU; then
20779 cd ..
20780fi
20781
48370efc
JH
20782: configuration may be patched via a 'config.arch' file
20783if $test -f config.arch; then
20784 echo "I see a config.arch file, loading it."
20785 . ./config.arch
20786fi
20787
5f80c64f
JH
20788: configuration may be patched via a 'config.over' file
20789if $test -f config.over; then
20790 echo " "
20791 dflt=y
20792 rp='I see a config.over file. Do you wish to load it?'
20793 . UU/myread
20794 case "$ans" in
20795 n*) echo "OK, I'll ignore it.";;
20796 *) . ./config.over
20797 echo "Configuration override changes have been loaded."
20798 ;;
20799 esac
20800fi
20801
20802: in case they want portability, strip down executable paths
20803case "$d_portable" in
20804"$define")
20805 echo " "
20806 echo "Stripping down executable paths..." >&4
20807 for file in $loclist $trylist; do
534ac15a
JH
20808 eval temp=\$$file
20809 eval $file=`basename $temp`
5f80c64f
JH
20810 done
20811 ;;
20812esac
20813
20814: create config.sh file
20815echo " "
20816echo "Creating config.sh..." >&4
20817$spitshell <<EOT >config.sh
20818$startsh
20819#
20820# This file was produced by running the Configure script. It holds all the
20821# definitions figured out by Configure. Should you modify one of these values,
20822# do not forget to propagate your changes by running "Configure -der". You may
20823# instead choose to run each of the .SH files by yourself, or "Configure -S".
20824#
20825
20826# Package name : $package
20827# Source directory : $src
20828# Configuration time: $cf_time
20829# Configured by : $cf_by
20830# Target system : $myuname
20831
20832Author='$Author'
20833Date='$Date'
20834Header='$Header'
20835Id='$Id'
20836Locker='$Locker'
20837Log='$Log'
20838Mcc='$Mcc'
20839RCSfile='$RCSfile'
20840Revision='$Revision'
20841Source='$Source'
20842State='$State'
20843_a='$_a'
20844_exe='$_exe'
20845_o='$_o'
b4eb6b3d 20846afs='$afs'
a6d26a0d 20847afsroot='$afsroot'
b4eb6b3d
JH
20848alignbytes='$alignbytes'
20849ansi2knr='$ansi2knr'
20850aphostname='$aphostname'
20851api_revision='$api_revision'
20852api_subversion='$api_subversion'
20853api_version='$api_version'
20854api_versionstring='$api_versionstring'
5f80c64f 20855ar='$ar'
b4eb6b3d
JH
20856archlib='$archlib'
20857archlibexp='$archlibexp'
20858archname64='$archname64'
20859archname='$archname'
5f80c64f 20860archobjs='$archobjs'
10bc17b6 20861asctime_r_proto='$asctime_r_proto'
5f80c64f 20862awk='$awk'
b4eb6b3d 20863baserev='$baserev'
5f80c64f 20864bash='$bash'
b4eb6b3d 20865bin='$bin'
b4eb6b3d 20866binexp='$binexp'
5f80c64f
JH
20867bison='$bison'
20868byacc='$byacc'
b4eb6b3d 20869byteorder='$byteorder'
5f80c64f 20870c='$c'
b4eb6b3d 20871castflags='$castflags'
5f80c64f
JH
20872cat='$cat'
20873cc='$cc'
20874cccdlflags='$cccdlflags'
20875ccdlflags='$ccdlflags'
20876ccflags='$ccflags'
b4eb6b3d 20877ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 20878ccname='$ccname'
b4eb6b3d 20879ccsymbols='$ccsymbols'
6b356c8e 20880ccversion='$ccversion'
5f80c64f 20881cf_by='$cf_by'
b4eb6b3d 20882cf_email='$cf_email'
5f80c64f 20883cf_time='$cf_time'
b4eb6b3d 20884charsize='$charsize'
5f80c64f
JH
20885chgrp='$chgrp'
20886chmod='$chmod'
20887chown='$chown'
b4eb6b3d 20888clocktype='$clocktype'
5f80c64f
JH
20889comm='$comm'
20890compress='$compress'
20891contains='$contains'
20892cp='$cp'
20893cpio='$cpio'
20894cpp='$cpp'
b4eb6b3d
JH
20895cpp_stuff='$cpp_stuff'
20896cppccsymbols='$cppccsymbols'
5f80c64f
JH
20897cppflags='$cppflags'
20898cpplast='$cpplast'
20899cppminus='$cppminus'
20900cpprun='$cpprun'
20901cppstdin='$cppstdin'
b4eb6b3d 20902cppsymbols='$cppsymbols'
10bc17b6 20903crypt_r_proto='$crypt_r_proto'
b4eb6b3d 20904cryptlib='$cryptlib'
5f80c64f 20905csh='$csh'
10bc17b6
JH
20906ctermid_r_proto='$ctermid_r_proto'
20907ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
20908d_Gconvert='$d_Gconvert'
20909d_PRIEUldbl='$d_PRIEUldbl'
20910d_PRIFUldbl='$d_PRIFUldbl'
20911d_PRIGUldbl='$d_PRIGUldbl'
20912d_PRIXU64='$d_PRIXU64'
20913d_PRId64='$d_PRId64'
20914d_PRIeldbl='$d_PRIeldbl'
20915d_PRIfldbl='$d_PRIfldbl'
20916d_PRIgldbl='$d_PRIgldbl'
20917d_PRIi64='$d_PRIi64'
20918d_PRIo64='$d_PRIo64'
20919d_PRIu64='$d_PRIu64'
20920d_PRIx64='$d_PRIx64'
20921d_SCNfldbl='$d_SCNfldbl'
74cac757 20922d__fwalk='$d__fwalk'
b4eb6b3d
JH
20923d_access='$d_access'
20924d_accessx='$d_accessx'
55954f19 20925d_aintl='$d_aintl'
b4eb6b3d
JH
20926d_alarm='$d_alarm'
20927d_archlib='$d_archlib'
10bc17b6 20928d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
20929d_atolf='$d_atolf'
20930d_atoll='$d_atoll'
0dbb1585
AL
20931d_attribute_format='$d_attribute_format'
20932d_attribute_malloc='$d_attribute_malloc'
20933d_attribute_nonnull='$d_attribute_nonnull'
20934d_attribute_noreturn='$d_attribute_noreturn'
20935d_attribute_pure='$d_attribute_pure'
20936d_attribute_unused='$d_attribute_unused'
20937d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
b4eb6b3d
JH
20938d_bcmp='$d_bcmp'
20939d_bcopy='$d_bcopy'
5f80c64f 20940d_bsd='$d_bsd'
b4eb6b3d
JH
20941d_bsdgetpgrp='$d_bsdgetpgrp'
20942d_bsdsetpgrp='$d_bsdsetpgrp'
20943d_bzero='$d_bzero'
20944d_casti32='$d_casti32'
20945d_castneg='$d_castneg'
20946d_charvspr='$d_charvspr'
20947d_chown='$d_chown'
20948d_chroot='$d_chroot'
20949d_chsize='$d_chsize'
758a5d79 20950d_class='$d_class'
b4eb6b3d 20951d_closedir='$d_closedir'
4e0554ec 20952d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 20953d_const='$d_const'
55954f19 20954d_copysignl='$d_copysignl'
b4eb6b3d 20955d_crypt='$d_crypt'
10bc17b6 20956d_crypt_r='$d_crypt_r'
b4eb6b3d 20957d_csh='$d_csh'
10bc17b6
JH
20958d_ctermid_r='$d_ctermid_r'
20959d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
20960d_cuserid='$d_cuserid'
20961d_dbl_dig='$d_dbl_dig'
2ef53570 20962d_dbminitproto='$d_dbminitproto'
b4eb6b3d 20963d_difftime='$d_difftime'
ae0e3d3b 20964d_dirfd='$d_dirfd'
b4eb6b3d
JH
20965d_dirnamlen='$d_dirnamlen'
20966d_dlerror='$d_dlerror'
5f80c64f 20967d_dlopen='$d_dlopen'
b4eb6b3d
JH
20968d_dlsymun='$d_dlsymun'
20969d_dosuid='$d_dosuid'
10bc17b6 20970d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
20971d_drand48proto='$d_drand48proto'
20972d_dup2='$d_dup2'
20973d_eaccess='$d_eaccess'
20974d_endgrent='$d_endgrent'
10bc17b6 20975d_endgrent_r='$d_endgrent_r'
b4eb6b3d 20976d_endhent='$d_endhent'
10bc17b6 20977d_endhostent_r='$d_endhostent_r'
b4eb6b3d 20978d_endnent='$d_endnent'
10bc17b6 20979d_endnetent_r='$d_endnetent_r'
b4eb6b3d 20980d_endpent='$d_endpent'
10bc17b6 20981d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 20982d_endpwent='$d_endpwent'
10bc17b6 20983d_endpwent_r='$d_endpwent_r'
b4eb6b3d 20984d_endsent='$d_endsent'
10bc17b6 20985d_endservent_r='$d_endservent_r'
b4eb6b3d 20986d_eofnblk='$d_eofnblk'
5f80c64f 20987d_eunice='$d_eunice'
15b61c98 20988d_faststdio='$d_faststdio'
b363b713 20989d_fchdir='$d_fchdir'
b4eb6b3d
JH
20990d_fchmod='$d_fchmod'
20991d_fchown='$d_fchown'
20992d_fcntl='$d_fcntl'
9d9004a9 20993d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
20994d_fd_macros='$d_fd_macros'
20995d_fd_set='$d_fd_set'
20996d_fds_bits='$d_fds_bits'
20997d_fgetpos='$d_fgetpos'
758a5d79
JH
20998d_finite='$d_finite'
20999d_finitel='$d_finitel'
b4eb6b3d
JH
21000d_flexfnam='$d_flexfnam'
21001d_flock='$d_flock'
2ef53570 21002d_flockproto='$d_flockproto'
b4eb6b3d 21003d_fork='$d_fork'
758a5d79 21004d_fp_class='$d_fp_class'
b4eb6b3d 21005d_fpathconf='$d_fpathconf'
758a5d79
JH
21006d_fpclass='$d_fpclass'
21007d_fpclassify='$d_fpclassify'
21008d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
21009d_fpos64_t='$d_fpos64_t'
21010d_frexpl='$d_frexpl'
21011d_fs_data_s='$d_fs_data_s'
21012d_fseeko='$d_fseeko'
21013d_fsetpos='$d_fsetpos'
21014d_fstatfs='$d_fstatfs'
21015d_fstatvfs='$d_fstatvfs'
411ab01c 21016d_fsync='$d_fsync'
b4eb6b3d
JH
21017d_ftello='$d_ftello'
21018d_ftime='$d_ftime'
21019d_getcwd='$d_getcwd'
21020d_getespwnam='$d_getespwnam'
21021d_getfsstat='$d_getfsstat'
21022d_getgrent='$d_getgrent'
10bc17b6
JH
21023d_getgrent_r='$d_getgrent_r'
21024d_getgrgid_r='$d_getgrgid_r'
21025d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
21026d_getgrps='$d_getgrps'
21027d_gethbyaddr='$d_gethbyaddr'
21028d_gethbyname='$d_gethbyname'
21029d_gethent='$d_gethent'
21030d_gethname='$d_gethname'
10bc17b6
JH
21031d_gethostbyaddr_r='$d_gethostbyaddr_r'
21032d_gethostbyname_r='$d_gethostbyname_r'
21033d_gethostent_r='$d_gethostent_r'
b4eb6b3d 21034d_gethostprotos='$d_gethostprotos'
4e0554ec 21035d_getitimer='$d_getitimer'
b4eb6b3d 21036d_getlogin='$d_getlogin'
10bc17b6 21037d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
21038d_getmnt='$d_getmnt'
21039d_getmntent='$d_getmntent'
21040d_getnbyaddr='$d_getnbyaddr'
21041d_getnbyname='$d_getnbyname'
21042d_getnent='$d_getnent'
10bc17b6
JH
21043d_getnetbyaddr_r='$d_getnetbyaddr_r'
21044d_getnetbyname_r='$d_getnetbyname_r'
21045d_getnetent_r='$d_getnetent_r'
b4eb6b3d 21046d_getnetprotos='$d_getnetprotos'
0c0643d0 21047d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
21048d_getpbyname='$d_getpbyname'
21049d_getpbynumber='$d_getpbynumber'
21050d_getpent='$d_getpent'
21051d_getpgid='$d_getpgid'
21052d_getpgrp2='$d_getpgrp2'
21053d_getpgrp='$d_getpgrp'
21054d_getppid='$d_getppid'
21055d_getprior='$d_getprior'
10bc17b6
JH
21056d_getprotobyname_r='$d_getprotobyname_r'
21057d_getprotobynumber_r='$d_getprotobynumber_r'
21058d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
21059d_getprotoprotos='$d_getprotoprotos'
21060d_getprpwnam='$d_getprpwnam'
21061d_getpwent='$d_getpwent'
10bc17b6
JH
21062d_getpwent_r='$d_getpwent_r'
21063d_getpwnam_r='$d_getpwnam_r'
21064d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
21065d_getsbyname='$d_getsbyname'
21066d_getsbyport='$d_getsbyport'
21067d_getsent='$d_getsent'
10bc17b6
JH
21068d_getservbyname_r='$d_getservbyname_r'
21069d_getservbyport_r='$d_getservbyport_r'
21070d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
21071d_getservprotos='$d_getservprotos'
21072d_getspnam='$d_getspnam'
10bc17b6 21073d_getspnam_r='$d_getspnam_r'
b4eb6b3d 21074d_gettimeod='$d_gettimeod'
10bc17b6 21075d_gmtime_r='$d_gmtime_r'
5f80c64f 21076d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
21077d_grpasswd='$d_grpasswd'
21078d_hasmntopt='$d_hasmntopt'
21079d_htonl='$d_htonl'
55954f19 21080d_ilogbl='$d_ilogbl'
b4eb6b3d
JH
21081d_index='$d_index'
21082d_inetaton='$d_inetaton'
21083d_int64_t='$d_int64_t'
21084d_isascii='$d_isascii'
758a5d79
JH
21085d_isfinite='$d_isfinite'
21086d_isinf='$d_isinf'
b4eb6b3d
JH
21087d_isnan='$d_isnan'
21088d_isnanl='$d_isnanl'
21089d_killpg='$d_killpg'
21090d_lchown='$d_lchown'
21091d_ldbl_dig='$d_ldbl_dig'
0a0abfba 21092d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 21093d_link='$d_link'
10bc17b6 21094d_localtime_r='$d_localtime_r'
b4eb6b3d
JH
21095d_locconv='$d_locconv'
21096d_lockf='$d_lockf'
21097d_longdbl='$d_longdbl'
21098d_longlong='$d_longlong'
21099d_lseekproto='$d_lseekproto'
21100d_lstat='$d_lstat'
21101d_madvise='$d_madvise'
21102d_mblen='$d_mblen'
21103d_mbstowcs='$d_mbstowcs'
21104d_mbtowc='$d_mbtowc'
21105d_memchr='$d_memchr'
21106d_memcmp='$d_memcmp'
21107d_memcpy='$d_memcpy'
21108d_memmove='$d_memmove'
21109d_memset='$d_memset'
21110d_mkdir='$d_mkdir'
21111d_mkdtemp='$d_mkdtemp'
21112d_mkfifo='$d_mkfifo'
21113d_mkstemp='$d_mkstemp'
21114d_mkstemps='$d_mkstemps'
21115d_mktime='$d_mktime'
21116d_mmap='$d_mmap'
21117d_modfl='$d_modfl'
e67aeab1 21118d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 21119d_modflproto='$d_modflproto'
b4eb6b3d
JH
21120d_mprotect='$d_mprotect'
21121d_msg='$d_msg'
21122d_msg_ctrunc='$d_msg_ctrunc'
21123d_msg_dontroute='$d_msg_dontroute'
21124d_msg_oob='$d_msg_oob'
21125d_msg_peek='$d_msg_peek'
21126d_msg_proxy='$d_msg_proxy'
21127d_msgctl='$d_msgctl'
21128d_msgget='$d_msgget'
4e0554ec 21129d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
21130d_msgrcv='$d_msgrcv'
21131d_msgsnd='$d_msgsnd'
21132d_msync='$d_msync'
21133d_munmap='$d_munmap'
21134d_mymalloc='$d_mymalloc'
21135d_nice='$d_nice'
2765b840 21136d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 21137d_nv_preserves_uv='$d_nv_preserves_uv'
f607920a 21138d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
b4eb6b3d
JH
21139d_off64_t='$d_off64_t'
21140d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21141d_oldpthreads='$d_oldpthreads'
21142d_oldsock='$d_oldsock'
21143d_open3='$d_open3'
21144d_pathconf='$d_pathconf'
21145d_pause='$d_pause'
21146d_perl_otherlibdirs='$d_perl_otherlibdirs'
21147d_phostname='$d_phostname'
21148d_pipe='$d_pipe'
21149d_poll='$d_poll'
5f80c64f 21150d_portable='$d_portable'
c7aff470 21151d_procselfexe='$d_procselfexe'
d6483fcc 21152d_pthread_atfork='$d_pthread_atfork'
58d975c3 21153d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
21154d_pthread_yield='$d_pthread_yield'
21155d_pwage='$d_pwage'
21156d_pwchange='$d_pwchange'
21157d_pwclass='$d_pwclass'
21158d_pwcomment='$d_pwcomment'
21159d_pwexpire='$d_pwexpire'
21160d_pwgecos='$d_pwgecos'
21161d_pwpasswd='$d_pwpasswd'
21162d_pwquota='$d_pwquota'
21163d_qgcvt='$d_qgcvt'
21164d_quad='$d_quad'
10bc17b6
JH
21165d_random_r='$d_random_r'
21166d_readdir64_r='$d_readdir64_r'
b4eb6b3d 21167d_readdir='$d_readdir'
10bc17b6 21168d_readdir_r='$d_readdir_r'
b4eb6b3d 21169d_readlink='$d_readlink'
4e0554ec
JH
21170d_readv='$d_readv'
21171d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
21172d_rename='$d_rename'
21173d_rewinddir='$d_rewinddir'
21174d_rmdir='$d_rmdir'
21175d_safebcpy='$d_safebcpy'
21176d_safemcpy='$d_safemcpy'
21177d_sanemcmp='$d_sanemcmp'
ef9f17be 21178d_sbrkproto='$d_sbrkproto'
55954f19 21179d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
21180d_sched_yield='$d_sched_yield'
21181d_scm_rights='$d_scm_rights'
21182d_seekdir='$d_seekdir'
21183d_select='$d_select'
21184d_sem='$d_sem'
21185d_semctl='$d_semctl'
21186d_semctl_semid_ds='$d_semctl_semid_ds'
21187d_semctl_semun='$d_semctl_semun'
21188d_semget='$d_semget'
21189d_semop='$d_semop'
4e0554ec 21190d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
21191d_setegid='$d_setegid'
21192d_seteuid='$d_seteuid'
21193d_setgrent='$d_setgrent'
10bc17b6 21194d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
21195d_setgrps='$d_setgrps'
21196d_sethent='$d_sethent'
10bc17b6 21197d_sethostent_r='$d_sethostent_r'
4e0554ec 21198d_setitimer='$d_setitimer'
b4eb6b3d
JH
21199d_setlinebuf='$d_setlinebuf'
21200d_setlocale='$d_setlocale'
10bc17b6 21201d_setlocale_r='$d_setlocale_r'
b4eb6b3d 21202d_setnent='$d_setnent'
10bc17b6 21203d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
21204d_setpent='$d_setpent'
21205d_setpgid='$d_setpgid'
21206d_setpgrp2='$d_setpgrp2'
21207d_setpgrp='$d_setpgrp'
21208d_setprior='$d_setprior'
21209d_setproctitle='$d_setproctitle'
10bc17b6 21210d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 21211d_setpwent='$d_setpwent'
10bc17b6 21212d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
21213d_setregid='$d_setregid'
21214d_setresgid='$d_setresgid'
21215d_setresuid='$d_setresuid'
21216d_setreuid='$d_setreuid'
21217d_setrgid='$d_setrgid'
21218d_setruid='$d_setruid'
21219d_setsent='$d_setsent'
10bc17b6 21220d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
21221d_setsid='$d_setsid'
21222d_setvbuf='$d_setvbuf'
21223d_sfio='$d_sfio'
21224d_shm='$d_shm'
21225d_shmat='$d_shmat'
21226d_shmatprototype='$d_shmatprototype'
21227d_shmctl='$d_shmctl'
21228d_shmdt='$d_shmdt'
21229d_shmget='$d_shmget'
21230d_sigaction='$d_sigaction'
983dbef6 21231d_sigprocmask='$d_sigprocmask'
b4eb6b3d 21232d_sigsetjmp='$d_sigsetjmp'
49a78c82 21233d_sockatmark='$d_sockatmark'
2ef53570 21234d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
21235d_socket='$d_socket'
21236d_socklen_t='$d_socklen_t'
21237d_sockpair='$d_sockpair'
21238d_socks5_init='$d_socks5_init'
21239d_sqrtl='$d_sqrtl'
10bc17b6
JH
21240d_srand48_r='$d_srand48_r'
21241d_srandom_r='$d_srandom_r'
eef837ea 21242d_sresgproto='$d_sresgproto'
640374d0 21243d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
21244d_statblks='$d_statblks'
21245d_statfs_f_flags='$d_statfs_f_flags'
21246d_statfs_s='$d_statfs_s'
21247d_statvfs='$d_statvfs'
21248d_stdio_cnt_lval='$d_stdio_cnt_lval'
21249d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
21250d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21251d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
21252d_stdio_stream_array='$d_stdio_stream_array'
21253d_stdiobase='$d_stdiobase'
21254d_stdstdio='$d_stdstdio'
21255d_strchr='$d_strchr'
21256d_strcoll='$d_strcoll'
21257d_strctcpy='$d_strctcpy'
21258d_strerrm='$d_strerrm'
21259d_strerror='$d_strerror'
10bc17b6 21260d_strerror_r='$d_strerror_r'
b3c85772 21261d_strftime='$d_strftime'
08c92000
MB
21262d_strlcat='$d_strlcat'
21263d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
21264d_strtod='$d_strtod'
21265d_strtol='$d_strtol'
21266d_strtold='$d_strtold'
21267d_strtoll='$d_strtoll'
28e5dec8 21268d_strtoq='$d_strtoq'
b4eb6b3d
JH
21269d_strtoul='$d_strtoul'
21270d_strtoull='$d_strtoull'
21271d_strtouq='$d_strtouq'
21272d_strxfrm='$d_strxfrm'
21273d_suidsafe='$d_suidsafe'
21274d_symlink='$d_symlink'
21275d_syscall='$d_syscall'
2ef53570 21276d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
21277d_sysconf='$d_sysconf'
21278d_sysernlst='$d_sysernlst'
21279d_syserrlst='$d_syserrlst'
21280d_system='$d_system'
21281d_tcgetpgrp='$d_tcgetpgrp'
21282d_tcsetpgrp='$d_tcsetpgrp'
21283d_telldir='$d_telldir'
21284d_telldirproto='$d_telldirproto'
21285d_time='$d_time'
21286d_times='$d_times'
14b90194
JH
21287d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21288d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 21289d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 21290d_truncate='$d_truncate'
10bc17b6 21291d_ttyname_r='$d_ttyname_r'
b4eb6b3d 21292d_tzname='$d_tzname'
4e0554ec
JH
21293d_u32align='$d_u32align'
21294d_ualarm='$d_ualarm'
b4eb6b3d
JH
21295d_umask='$d_umask'
21296d_uname='$d_uname'
21297d_union_semun='$d_union_semun'
758a5d79 21298d_unordered='$d_unordered'
4e0554ec 21299d_usleep='$d_usleep'
2ef53570 21300d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
21301d_ustat='$d_ustat'
21302d_vendorarch='$d_vendorarch'
21303d_vendorbin='$d_vendorbin'
21304d_vendorlib='$d_vendorlib'
6e1038e0 21305d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
21306d_vfork='$d_vfork'
21307d_void_closedir='$d_void_closedir'
21308d_voidsig='$d_voidsig'
21309d_voidtty='$d_voidtty'
21310d_volatile='$d_volatile'
21311d_vprintf='$d_vprintf'
21312d_wait4='$d_wait4'
21313d_waitpid='$d_waitpid'
21314d_wcstombs='$d_wcstombs'
21315d_wctomb='$d_wctomb'
4e0554ec 21316d_writev='$d_writev'
5f80c64f
JH
21317d_xenix='$d_xenix'
21318date='$date'
b4eb6b3d
JH
21319db_hashtype='$db_hashtype'
21320db_prefixtype='$db_prefixtype'
640374d0
JH
21321db_version_major='$db_version_major'
21322db_version_minor='$db_version_minor'
21323db_version_patch='$db_version_patch'
b4eb6b3d
JH
21324defvoidused='$defvoidused'
21325direntrytype='$direntrytype'
21326dlext='$dlext'
5f80c64f 21327dlsrc='$dlsrc'
b4eb6b3d
JH
21328doublesize='$doublesize'
21329drand01='$drand01'
10bc17b6 21330drand48_r_proto='$drand48_r_proto'
b4eb6b3d
JH
21331dynamic_ext='$dynamic_ext'
21332eagain='$eagain'
21333ebcdic='$ebcdic'
5f80c64f
JH
21334echo='$echo'
21335egrep='$egrep'
21336emacs='$emacs'
10bc17b6
JH
21337endgrent_r_proto='$endgrent_r_proto'
21338endhostent_r_proto='$endhostent_r_proto'
21339endnetent_r_proto='$endnetent_r_proto'
21340endprotoent_r_proto='$endprotoent_r_proto'
21341endpwent_r_proto='$endpwent_r_proto'
21342endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
21343eunicefix='$eunicefix'
21344exe_ext='$exe_ext'
21345expr='$expr'
b4eb6b3d 21346extensions='$extensions'
6fcddf3b 21347extras='$extras'
b4eb6b3d
JH
21348fflushNULL='$fflushNULL'
21349fflushall='$fflushall'
5f80c64f
JH
21350find='$find'
21351firstmakefile='$firstmakefile'
21352flex='$flex'
b4eb6b3d
JH
21353fpossize='$fpossize'
21354fpostype='$fpostype'
21355freetype='$freetype'
5440bc8e 21356from='$from'
b4eb6b3d
JH
21357full_ar='$full_ar'
21358full_csh='$full_csh'
21359full_sed='$full_sed'
2d736872 21360gccansipedantic='$gccansipedantic'
5b463ca7 21361gccosandvers='$gccosandvers'
5f80c64f 21362gccversion='$gccversion'
10bc17b6
JH
21363getgrent_r_proto='$getgrent_r_proto'
21364getgrgid_r_proto='$getgrgid_r_proto'
21365getgrnam_r_proto='$getgrnam_r_proto'
21366gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21367gethostbyname_r_proto='$gethostbyname_r_proto'
21368gethostent_r_proto='$gethostent_r_proto'
21369getlogin_r_proto='$getlogin_r_proto'
21370getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21371getnetbyname_r_proto='$getnetbyname_r_proto'
21372getnetent_r_proto='$getnetent_r_proto'
21373getprotobyname_r_proto='$getprotobyname_r_proto'
21374getprotobynumber_r_proto='$getprotobynumber_r_proto'
21375getprotoent_r_proto='$getprotoent_r_proto'
21376getpwent_r_proto='$getpwent_r_proto'
21377getpwnam_r_proto='$getpwnam_r_proto'
21378getpwuid_r_proto='$getpwuid_r_proto'
21379getservbyname_r_proto='$getservbyname_r_proto'
21380getservbyport_r_proto='$getservbyport_r_proto'
21381getservent_r_proto='$getservent_r_proto'
21382getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
21383gidformat='$gidformat'
21384gidsign='$gidsign'
21385gidsize='$gidsize'
21386gidtype='$gidtype'
5f80c64f 21387glibpth='$glibpth'
3c728e00 21388gmake='$gmake'
10bc17b6 21389gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 21390gnulibc_version='$gnulibc_version'
5f80c64f 21391grep='$grep'
b4eb6b3d
JH
21392groupcat='$groupcat'
21393groupstype='$groupstype'
5f80c64f 21394gzip='$gzip'
b4eb6b3d
JH
21395h_fcntl='$h_fcntl'
21396h_sysfile='$h_sysfile'
5f80c64f 21397hint='$hint'
b4eb6b3d 21398hostcat='$hostcat'
6e1038e0
MB
21399html1dir='$html1dir'
21400html1direxp='$html1direxp'
21401html3dir='$html3dir'
21402html3direxp='$html3direxp'
b4eb6b3d
JH
21403i16size='$i16size'
21404i16type='$i16type'
21405i32size='$i32size'
21406i32type='$i32type'
21407i64size='$i64size'
21408i64type='$i64type'
21409i8size='$i8size'
21410i8type='$i8type'
21411i_arpainet='$i_arpainet'
21412i_bsdioctl='$i_bsdioctl'
10bc17b6 21413i_crypt='$i_crypt'
b4eb6b3d
JH
21414i_db='$i_db'
21415i_dbm='$i_dbm'
21416i_dirent='$i_dirent'
5f80c64f 21417i_dld='$i_dld'
b4eb6b3d
JH
21418i_dlfcn='$i_dlfcn'
21419i_fcntl='$i_fcntl'
21420i_float='$i_float'
758a5d79
JH
21421i_fp='$i_fp'
21422i_fp_class='$i_fp_class'
b4eb6b3d
JH
21423i_gdbm='$i_gdbm'
21424i_grp='$i_grp'
b4eb6b3d
JH
21425i_ieeefp='$i_ieeefp'
21426i_inttypes='$i_inttypes'
2765b840 21427i_langinfo='$i_langinfo'
b4eb6b3d
JH
21428i_libutil='$i_libutil'
21429i_limits='$i_limits'
21430i_locale='$i_locale'
21431i_machcthr='$i_machcthr'
21432i_malloc='$i_malloc'
21433i_math='$i_math'
21434i_memory='$i_memory'
21435i_mntent='$i_mntent'
21436i_ndbm='$i_ndbm'
21437i_netdb='$i_netdb'
21438i_neterrno='$i_neterrno'
21439i_netinettcp='$i_netinettcp'
21440i_niin='$i_niin'
21441i_poll='$i_poll'
21442i_prot='$i_prot'
21443i_pthread='$i_pthread'
21444i_pwd='$i_pwd'
21445i_rpcsvcdbm='$i_rpcsvcdbm'
21446i_sfio='$i_sfio'
21447i_sgtty='$i_sgtty'
21448i_shadow='$i_shadow'
21449i_socks='$i_socks'
21450i_stdarg='$i_stdarg'
21451i_stddef='$i_stddef'
21452i_stdlib='$i_stdlib'
21453i_string='$i_string'
21454i_sunmath='$i_sunmath'
21455i_sysaccess='$i_sysaccess'
21456i_sysdir='$i_sysdir'
21457i_sysfile='$i_sysfile'
21458i_sysfilio='$i_sysfilio'
21459i_sysin='$i_sysin'
21460i_sysioctl='$i_sysioctl'
21461i_syslog='$i_syslog'
21462i_sysmman='$i_sysmman'
21463i_sysmode='$i_sysmode'
21464i_sysmount='$i_sysmount'
21465i_sysndir='$i_sysndir'
21466i_sysparam='$i_sysparam'
21467i_sysresrc='$i_sysresrc'
21468i_syssecrt='$i_syssecrt'
21469i_sysselct='$i_sysselct'
21470i_syssockio='$i_syssockio'
21471i_sysstat='$i_sysstat'
21472i_sysstatfs='$i_sysstatfs'
21473i_sysstatvfs='$i_sysstatvfs'
21474i_systime='$i_systime'
21475i_systimek='$i_systimek'
21476i_systimes='$i_systimes'
21477i_systypes='$i_systypes'
21478i_sysuio='$i_sysuio'
21479i_sysun='$i_sysun'
21480i_sysutsname='$i_sysutsname'
21481i_sysvfs='$i_sysvfs'
21482i_syswait='$i_syswait'
21483i_termio='$i_termio'
21484i_termios='$i_termios'
21485i_time='$i_time'
21486i_unistd='$i_unistd'
21487i_ustat='$i_ustat'
21488i_utime='$i_utime'
21489i_values='$i_values'
21490i_varargs='$i_varargs'
21491i_varhdr='$i_varhdr'
21492i_vfork='$i_vfork'
5f80c64f 21493ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
21494inc_version_list='$inc_version_list'
21495inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
21496incpath='$incpath'
21497inews='$inews'
b4eb6b3d
JH
21498installarchlib='$installarchlib'
21499installbin='$installbin'
6e1038e0
MB
21500installhtml1dir='$installhtml1dir'
21501installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
21502installman1dir='$installman1dir'
21503installman3dir='$installman3dir'
21504installprefix='$installprefix'
21505installprefixexp='$installprefixexp'
21506installprivlib='$installprivlib'
21507installscript='$installscript'
21508installsitearch='$installsitearch'
21509installsitebin='$installsitebin'
8d2cbf27
JH
21510installsitehtml1dir='$installsitehtml1dir'
21511installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 21512installsitelib='$installsitelib'
91e123a8
JH
21513installsiteman1dir='$installsiteman1dir'
21514installsiteman3dir='$installsiteman3dir'
6e1038e0 21515installsitescript='$installsitescript'
b4eb6b3d
JH
21516installstyle='$installstyle'
21517installusrbinperl='$installusrbinperl'
21518installvendorarch='$installvendorarch'
21519installvendorbin='$installvendorbin'
8d2cbf27
JH
21520installvendorhtml1dir='$installvendorhtml1dir'
21521installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 21522installvendorlib='$installvendorlib'
91e123a8
JH
21523installvendorman1dir='$installvendorman1dir'
21524installvendorman3dir='$installvendorman3dir'
6e1038e0 21525installvendorscript='$installvendorscript'
b4eb6b3d 21526intsize='$intsize'
4b661809 21527issymlink='$issymlink'
b4eb6b3d
JH
21528ivdformat='$ivdformat'
21529ivsize='$ivsize'
21530ivtype='$ivtype'
21531known_extensions='$known_extensions'
5f80c64f 21532ksh='$ksh'
5f80c64f
JH
21533ld='$ld'
21534lddlflags='$lddlflags'
21535ldflags='$ldflags'
b4eb6b3d
JH
21536ldflags_uselargefiles='$ldflags_uselargefiles'
21537ldlibpthname='$ldlibpthname'
5f80c64f
JH
21538less='$less'
21539lib_ext='$lib_ext'
21540libc='$libc'
b4eb6b3d 21541libperl='$libperl'
5f80c64f
JH
21542libpth='$libpth'
21543libs='$libs'
43999f95
JH
21544libsdirs='$libsdirs'
21545libsfiles='$libsfiles'
21546libsfound='$libsfound'
13b3f787 21547libspath='$libspath'
5f80c64f 21548libswanted='$libswanted'
b4eb6b3d 21549libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
21550line='$line'
21551lint='$lint'
21552lkflags='$lkflags'
21553ln='$ln'
21554lns='$lns'
10bc17b6 21555localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
21556locincpth='$locincpth'
21557loclibpth='$loclibpth'
b4eb6b3d
JH
21558longdblsize='$longdblsize'
21559longlongsize='$longlongsize'
21560longsize='$longsize'
5f80c64f
JH
21561lp='$lp'
21562lpr='$lpr'
21563ls='$ls'
b4eb6b3d
JH
21564lseeksize='$lseeksize'
21565lseektype='$lseektype'
5f80c64f
JH
21566mail='$mail'
21567mailx='$mailx'
21568make='$make'
21569make_set_make='$make_set_make'
b4eb6b3d
JH
21570mallocobj='$mallocobj'
21571mallocsrc='$mallocsrc'
21572malloctype='$malloctype'
21573man1dir='$man1dir'
21574man1direxp='$man1direxp'
21575man1ext='$man1ext'
21576man3dir='$man3dir'
21577man3direxp='$man3direxp'
21578man3ext='$man3ext'
5f80c64f 21579mips_type='$mips_type'
5129fff4 21580mistrustnm='$mistrustnm'
5f80c64f 21581mkdir='$mkdir'
b4eb6b3d
JH
21582mmaptype='$mmaptype'
21583modetype='$modetype'
5f80c64f 21584more='$more'
b4eb6b3d 21585multiarch='$multiarch'
5f80c64f 21586mv='$mv'
b4eb6b3d
JH
21587myarchname='$myarchname'
21588mydomain='$mydomain'
21589myhostname='$myhostname'
5f80c64f
JH
21590myuname='$myuname'
21591n='$n'
2cc61e15 21592need_va_copy='$need_va_copy'
b4eb6b3d
JH
21593netdb_hlen_type='$netdb_hlen_type'
21594netdb_host_type='$netdb_host_type'
21595netdb_name_type='$netdb_name_type'
21596netdb_net_type='$netdb_net_type'
5f80c64f
JH
21597nm='$nm'
21598nm_opt='$nm_opt'
21599nm_so_opt='$nm_so_opt'
b4eb6b3d 21600nonxs_ext='$nonxs_ext'
5f80c64f 21601nroff='$nroff'
b4eb6b3d
JH
21602nvEUformat='$nvEUformat'
21603nvFUformat='$nvFUformat'
21604nvGUformat='$nvGUformat'
53133ed1 21605nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
21606nveformat='$nveformat'
21607nvfformat='$nvfformat'
21608nvgformat='$nvgformat'
21609nvsize='$nvsize'
21610nvtype='$nvtype'
21611o_nonblock='$o_nonblock'
5f80c64f 21612obj_ext='$obj_ext'
b4eb6b3d 21613old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 21614optimize='$optimize'
b4eb6b3d 21615orderlib='$orderlib'
5f80c64f
JH
21616osname='$osname'
21617osvers='$osvers'
b4eb6b3d 21618otherlibdirs='$otherlibdirs'
5f80c64f 21619package='$package'
b4eb6b3d
JH
21620pager='$pager'
21621passcat='$passcat'
21622patchlevel='$patchlevel'
5f80c64f 21623path_sep='$path_sep'
b4eb6b3d 21624perl5='$perl5'
5f80c64f 21625perl='$perl'
151e6568 21626perl_patchlevel='$perl_patchlevel'
b4eb6b3d 21627perladmin='$perladmin'
9c839522 21628perllibs='$perllibs'
b4eb6b3d 21629perlpath='$perlpath'
5f80c64f 21630pg='$pg'
b4eb6b3d
JH
21631phostname='$phostname'
21632pidtype='$pidtype'
5f80c64f
JH
21633plibpth='$plibpth'
21634pmake='$pmake'
21635pr='$pr'
b4eb6b3d
JH
21636prefix='$prefix'
21637prefixexp='$prefixexp'
21638privlib='$privlib'
21639privlibexp='$privlibexp'
f24dbf84 21640procselfexe='$procselfexe'
b4eb6b3d
JH
21641prototype='$prototype'
21642ptrsize='$ptrsize'
21643quadkind='$quadkind'
21644quadtype='$quadtype'
21645randbits='$randbits'
21646randfunc='$randfunc'
10bc17b6 21647random_r_proto='$random_r_proto'
b4eb6b3d
JH
21648randseedtype='$randseedtype'
21649ranlib='$ranlib'
21650rd_nodata='$rd_nodata'
10bc17b6
JH
21651readdir64_r_proto='$readdir64_r_proto'
21652readdir_r_proto='$readdir_r_proto'
b4eb6b3d 21653revision='$revision'
5f80c64f
JH
21654rm='$rm'
21655rmail='$rmail'
5440bc8e 21656run='$run'
5f80c64f 21657runnm='$runnm'
b4eb6b3d
JH
21658sPRIEUldbl='$sPRIEUldbl'
21659sPRIFUldbl='$sPRIFUldbl'
21660sPRIGUldbl='$sPRIGUldbl'
21661sPRIXU64='$sPRIXU64'
21662sPRId64='$sPRId64'
21663sPRIeldbl='$sPRIeldbl'
21664sPRIfldbl='$sPRIfldbl'
21665sPRIgldbl='$sPRIgldbl'
21666sPRIi64='$sPRIi64'
21667sPRIo64='$sPRIo64'
21668sPRIu64='$sPRIu64'
21669sPRIx64='$sPRIx64'
21670sSCNfldbl='$sSCNfldbl'
21671sched_yield='$sched_yield'
21672scriptdir='$scriptdir'
21673scriptdirexp='$scriptdirexp'
5f80c64f 21674sed='$sed'
b4eb6b3d
JH
21675seedfunc='$seedfunc'
21676selectminbits='$selectminbits'
21677selecttype='$selecttype'
5f80c64f 21678sendmail='$sendmail'
10bc17b6
JH
21679setgrent_r_proto='$setgrent_r_proto'
21680sethostent_r_proto='$sethostent_r_proto'
21681setlocale_r_proto='$setlocale_r_proto'
21682setnetent_r_proto='$setnetent_r_proto'
21683setprotoent_r_proto='$setprotoent_r_proto'
21684setpwent_r_proto='$setpwent_r_proto'
21685setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
21686sh='$sh'
21687shar='$shar'
21688sharpbang='$sharpbang'
b4eb6b3d
JH
21689shmattype='$shmattype'
21690shortsize='$shortsize'
21691shrpenv='$shrpenv'
5f80c64f 21692shsharp='$shsharp'
b4eb6b3d
JH
21693sig_count='$sig_count'
21694sig_name='$sig_name'
21695sig_name_init='$sig_name_init'
21696sig_num='$sig_num'
21697sig_num_init='$sig_num_init'
76d3c696 21698sig_size='$sig_size'
b4eb6b3d
JH
21699signal_t='$signal_t'
21700sitearch='$sitearch'
21701sitearchexp='$sitearchexp'
21702sitebin='$sitebin'
21703sitebinexp='$sitebinexp'
8d2cbf27
JH
21704sitehtml1dir='$sitehtml1dir'
21705sitehtml1direxp='$sitehtml1direxp'
21706sitehtml3dir='$sitehtml3dir'
21707sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
21708sitelib='$sitelib'
21709sitelib_stem='$sitelib_stem'
21710sitelibexp='$sitelibexp'
91e123a8
JH
21711siteman1dir='$siteman1dir'
21712siteman1direxp='$siteman1direxp'
21713siteman3dir='$siteman3dir'
21714siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
21715siteprefix='$siteprefix'
21716siteprefixexp='$siteprefixexp'
6e1038e0
MB
21717sitescript='$sitescript'
21718sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
21719sizesize='$sizesize'
21720sizetype='$sizetype'
5f80c64f
JH
21721sleep='$sleep'
21722smail='$smail'
5f80c64f 21723so='$so'
b4eb6b3d
JH
21724sockethdr='$sockethdr'
21725socketlib='$socketlib'
21726socksizetype='$socksizetype'
5f80c64f
JH
21727sort='$sort'
21728spackage='$spackage'
21729spitshell='$spitshell'
10bc17b6
JH
21730srand48_r_proto='$srand48_r_proto'
21731srandom_r_proto='$srandom_r_proto'
5f80c64f 21732src='$src'
b4eb6b3d
JH
21733ssizetype='$ssizetype'
21734startperl='$startperl'
5f80c64f 21735startsh='$startsh'
b4eb6b3d
JH
21736static_ext='$static_ext'
21737stdchar='$stdchar'
21738stdio_base='$stdio_base'
21739stdio_bufsiz='$stdio_bufsiz'
21740stdio_cnt='$stdio_cnt'
21741stdio_filbuf='$stdio_filbuf'
21742stdio_ptr='$stdio_ptr'
21743stdio_stream_array='$stdio_stream_array'
10bc17b6 21744strerror_r_proto='$strerror_r_proto'
b4eb6b3d 21745strings='$strings'
5f80c64f 21746submit='$submit'
b4eb6b3d
JH
21747subversion='$subversion'
21748sysman='$sysman'
5f80c64f
JH
21749tail='$tail'
21750tar='$tar'
5440bc8e 21751targetarch='$targetarch'
5f80c64f
JH
21752tbl='$tbl'
21753tee='$tee'
21754test='$test'
b4eb6b3d
JH
21755timeincl='$timeincl'
21756timetype='$timetype'
10bc17b6 21757tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 21758to='$to'
5f80c64f
JH
21759touch='$touch'
21760tr='$tr'
21761trnl='$trnl'
21762troff='$troff'
10bc17b6 21763ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
21764u16size='$u16size'
21765u16type='$u16type'
21766u32size='$u32size'
21767u32type='$u32type'
21768u64size='$u64size'
21769u64type='$u64type'
21770u8size='$u8size'
21771u8type='$u8type'
21772uidformat='$uidformat'
21773uidsign='$uidsign'
21774uidsize='$uidsize'
21775uidtype='$uidtype'
5f80c64f
JH
21776uname='$uname'
21777uniq='$uniq'
b4eb6b3d
JH
21778uquadtype='$uquadtype'
21779use5005threads='$use5005threads'
21780use64bitall='$use64bitall'
21781use64bitint='$use64bitint'
5440bc8e 21782usecrosscompile='$usecrosscompile'
5f80c64f 21783usedl='$usedl'
15b61c98 21784usefaststdio='$usefaststdio'
b4eb6b3d
JH
21785useithreads='$useithreads'
21786uselargefiles='$uselargefiles'
21787uselongdouble='$uselongdouble'
19a100ff 21788usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
21789usemorebits='$usemorebits'
21790usemultiplicity='$usemultiplicity'
21791usemymalloc='$usemymalloc'
5f80c64f 21792usenm='$usenm'
b4eb6b3d
JH
21793useopcode='$useopcode'
21794useperlio='$useperlio'
21795useposix='$useposix'
9514c62b 21796usereentrant='$usereentrant'
d51aaa9d 21797userelocatableinc='$userelocatableinc'
b4eb6b3d
JH
21798usesfio='$usesfio'
21799useshrplib='$useshrplib'
5f106f9c 21800usesitecustomize='$usesitecustomize'
29209bc5 21801usesocks='$usesocks'
b4eb6b3d
JH
21802usethreads='$usethreads'
21803usevendorprefix='$usevendorprefix'
21804usevfork='$usevfork'
5f80c64f
JH
21805usrinc='$usrinc'
21806uuname='$uuname'
b4eb6b3d
JH
21807uvXUformat='$uvXUformat'
21808uvoformat='$uvoformat'
21809uvsize='$uvsize'
21810uvtype='$uvtype'
21811uvuformat='$uvuformat'
21812uvxformat='$uvxformat'
21813vendorarch='$vendorarch'
21814vendorarchexp='$vendorarchexp'
21815vendorbin='$vendorbin'
21816vendorbinexp='$vendorbinexp'
8d2cbf27
JH
21817vendorhtml1dir='$vendorhtml1dir'
21818vendorhtml1direxp='$vendorhtml1direxp'
21819vendorhtml3dir='$vendorhtml3dir'
21820vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
21821vendorlib='$vendorlib'
21822vendorlib_stem='$vendorlib_stem'
21823vendorlibexp='$vendorlibexp'
91e123a8
JH
21824vendorman1dir='$vendorman1dir'
21825vendorman1direxp='$vendorman1direxp'
21826vendorman3dir='$vendorman3dir'
21827vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
21828vendorprefix='$vendorprefix'
21829vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
21830vendorscript='$vendorscript'
21831vendorscriptexp='$vendorscriptexp'
b4eb6b3d 21832version='$version'
861eb78d 21833version_patchlevel_string='$version_patchlevel_string'
d56c5707 21834versiononly='$versiononly'
5f80c64f 21835vi='$vi'
b4eb6b3d 21836voidflags='$voidflags'
5f80c64f 21837xlibpth='$xlibpth'
3659ebf1
JH
21838yacc='$yacc'
21839yaccflags='$yaccflags'
5f80c64f
JH
21840zcat='$zcat'
21841zip='$zip'
21842EOT
21843
21844: Add in command line options if available
21845$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21846
21847: add special variables
21848$test -f $src/patchlevel.h && \
d00b958f 21849awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 21850echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 21851echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
21852
21853: propagate old symbols
21854if $test -f UU/config.sh; then
381aa1ff 21855 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 21856 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 21857 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
21858 set X `cat UU/oldsyms`
21859 shift
21860 case $# in
21861 0) ;;
21862 *)
21863 cat <<EOM
21864Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21865EOM
21866 echo "# Variables propagated from previous config.sh file." >>config.sh
21867 for sym in `cat UU/oldsyms`; do
21868 echo " Propagating $hint variable "'$'"$sym..."
21869 eval 'tmp="$'"${sym}"'"'
21870 echo "$tmp" | \
21871 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21872 done
21873 ;;
21874 esac
21875fi
21876
21877: Finish up by extracting the .SH files
21878case "$alldone" in
21879exit)
21880 $rm -rf UU
24ccb310 21881 echo "Extraction done."
5f80c64f
JH
21882 exit 0
21883 ;;
21884cont)
21885 ;;
21886'')
21887 dflt=''
21888 nostick=true
21889 $cat <<EOM
21890
21891If you'd like to make any changes to the config.sh file before I begin
21892to configure things, do it as a shell escape now (e.g. !vi config.sh).
21893
21894EOM
21895 rp="Press return or use a shell escape to edit config.sh:"
21896 . UU/myread
21897 nostick=''
21898 case "$ans" in
21899 '') ;;
21900 *) : in case they cannot read
21901 sh 1>&4 -c "$ans";;
21902 esac
21903 ;;
21904esac
21905
21906: if this fails, just run all the .SH files by hand
21907. ./config.sh
21908
21909echo " "
21910exec 1>&4
a43e8593 21911pwd=`pwd`
5f80c64f 21912. ./UU/extract
6904989c 21913cd "$pwd"
5f80c64f
JH
21914
21915if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
21916 dflt=y
21917 case "$silent" in
21918 true) ;;
21919 *)
21920 $cat <<EOM
21921
21922Now you need to generate make dependencies by running "$make depend".
21923You might prefer to run it in background: "$make depend > makedepend.out &"
21924It can take a while, so you might not want to run it right now.
21925
21926EOM
21927 ;;
21928 esac
21929 rp="Run $make depend now?"
21930 . UU/myread
21931 case "$ans" in
21932 y*)
3d5d58b1 21933 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
21934 ;;
21935 *)
21936 echo "You must run '$make depend' then '$make'."
21937 ;;
21938 esac
21939elif test -f [Mm]akefile; then
21940 echo " "
21941 echo "Now you must run a $make."
21942else
24ccb310 21943 echo "Configure done."
5f80c64f
JH
21944fi
21945
21946if $test -f Policy.sh; then
21947 $cat <<EOM
21948
21949If you compile $package on a different machine or from a different object
21950directory, copy the Policy.sh file from this object directory to the
21951new one before you run Configure -- this will help you with most of
21952the policy defaults.
21953
21954EOM
21955fi
21956if $test -f config.msg; then
21957 echo "Hmm. I also noted the following information while running:"
21958 echo " "
21959 $cat config.msg >&4
21960 $rm -f config.msg
21961fi
21962$rm -f kit*isdone ark*isdone
21963$rm -rf UU
21964
21965: End of Configure
21966