This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
On scope end, delete localized array elements that should not exist anymore, so that...
[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#
613d6c3e 14# Note: this Configure script was generated automatically. Rather than
2304df62 15# working with this copy of Configure, you may wish to get metaconfig.
613d6c3e
MB
16# The dist package (which contains metaconfig) is available via SVN:
17# svn co https://svn.sourceforge.net/svnroot/dist/trunk/dist
2304df62 18#
5cadb3f3
MB
19#
20# Though this script was generated by metaconfig, it is OK to send
21# patches against it. It's up to the Configure pumpkin to backport
22# the patch to the metaunits if it is accepted.
23# See Porting/pumpkin.pod for more information on metaconfig.
24#
2304df62 25
613d6c3e 26# $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $
2304df62 27#
0f04e85f 28# Generated on Thu Dec 25 12:54:36 CET 2008 [metaconfig 3.5 PL0]
7f2de2d2 29# (with additional metaconfig patches by perlbug@perl.org)
2304df62 30
283fdd21 31cat >c1$$ <<EOF
2304df62
AD
32ARGGGHHHH!!!!!
33
34SCO csh still thinks true is false. Write to SCO today and tell them that next
35year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
36
37(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
38we'd have to do is go in and swap the && and || tokens, wherever they are.)
39
40[End of diatribe. We now return you to your regularly scheduled programming...]
41EOF
283fdd21 42cat >c2$$ <<EOF
2304df62
AD
43
44OOPS! You naughty creature! You didn't run Configure with sh!
45I will attempt to remedy the situation by running sh for you...
46EOF
47
283fdd21 48true || cat c1$$ c2$$
2304df62
AD
49true || exec sh $0 $argv:q
50
283fdd21 51(exit $?0) || cat c2$$
2304df62 52(exit $?0) || exec sh $0 $argv:q
283fdd21 53rm -f c1$$ c2$$
2304df62 54
f6538904 55if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
cbee2ce6
JH
56 cat >&4 <<EOF
57***
58*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
59*** Configure that well. (Plan 9 is close to UNIX but not close enough.)
60*** Please read the README.plan9 for further instructions.
61*** Cannot continue, aborting.
62***
63EOF
64 exit 1
65fi
66
f8e2af1d
MC
67if test ! -c /dev/null ; then
68 cat >&4 <<EOF
69***
70*** I'm sorry, but /dev/null appears to be a file rather than a device.
71*** Please consult your operating sytem's notes for making a device
72*** in /dev.
73*** Cannot continue, aborting.
74***
75EOF
76 exit 1
77fi
78
a0d0e21e
LW
79: compute my invocation name
80me=$0
81case "$0" in
82*/*)
83 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
84 test "$me" || me=$0
85 ;;
86esac
87
dfe9444c 88: Proper separator for the PATH environment variable
8e07c86e 89p_=:
613d6c3e 90: On OS/2 this directory should exist if this is not floppy only system ":-]"
5c728af0 91if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
613d6c3e 92 if test -n "$OS2_SHELL"; then
dfe9444c
AD
93 p_=\;
94 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
95 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
5c728af0 96 is_os2=yes
c4f23d77 97 elif test -n "$DJGPP"; then
495e2cbe
MB
98 case "X${MACHTYPE:-nonesuchmach}" in
99 *cygwin) ;;
100 *) p_=\; ;;
101 esac
dfe9444c 102 fi
39e571d4 103fi
a0d0e21e
LW
104
105: Proper PATH setting
106paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 107paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 108paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 109paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e 110paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
87bdd940 111paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
232e078e
AD
112paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
113paths="$paths /sbin /usr/sbin /usr/libexec"
3c728e00 114paths="$paths /system/gnu_library/bin"
a0d0e21e
LW
115
116for p in $paths
117do
8e07c86e
AD
118 case "$p_$PATH$p_" in
119 *$p_$p$p_*) ;;
120 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
121 esac
122done
123
8e07c86e 124PATH=.$p_$PATH
2304df62
AD
125export PATH
126
dfe9444c
AD
127: shall we be using ksh?
128inksh=''
129needksh=''
130avoidksh=''
131newsh=/bin/ksh
132changesh=''
ff0cee69 133if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
134 inksh=true
135fi
136if test -f /hp-ux -a -f /bin/ksh; then
137 needksh='to avoid sh bug in "here document" expansion'
138fi
139if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
140 if test X`/usr/bin/uname -v` = X4; then
141 avoidksh="to avoid AIX 4's /bin/sh"
142 newsh=/usr/bin/bsh
2304df62 143 fi
dfe9444c 144fi
cf04f91f
JH
145if test -f /osf_boot -a -f /usr/sbin/setld; then
146 if test X`/usr/bin/uname -s` = XOSF1; then
613d6c3e
MB
147 avoidksh="to avoid Digital UNIX' ksh"
148 newsh=/bin/sh
149 unset BIN_SH
cf04f91f
JH
150 fi
151fi
dfe9444c
AD
152case "$inksh/$needksh" in
153/[a-z]*)
c4f23d77 154 ENV=''
dfe9444c
AD
155 changesh=true
156 reason="$needksh"
157 ;;
158esac
159case "$inksh/$avoidksh" in
160true/[a-z]*)
161 changesh=true
162 reason="$avoidksh"
163 ;;
164esac
165case "$inksh/$needksh-$avoidksh-" in
166true/--)
a0d0e21e
LW
167 cat <<EOM
168(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 169mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 170EOM
dfe9444c
AD
171 ;;
172esac
173case "$changesh" in
174true)
2e2a97a6 175 export newsh
dfe9444c
AD
176 echo "(Feeding myself to $newsh $reason.)"
177 case "$0" in
178 Configure|*/Configure) exec $newsh $0 "$@";;
179 *) exec $newsh Configure "$@";;
180 esac
181 ;;
182esac
7730b9f4 183test -x "${newsh}" || unset newsh
2304df62 184
613d6c3e 185: if needed, set CDPATH to a harmless value that is not chatty
bfb7748a
AD
186: avoid bash 2.02 problems with empty CDPATH.
187case "$CDPATH" in
188'') ;;
189*) case "$SHELL" in
613d6c3e
MB
190 *bash*) CDPATH='.' ;;
191 *) CDPATH='' ;;
bfb7748a
AD
192 esac
193 ;;
194esac
613d6c3e 195
2304df62
AD
196: Configure runs within the UU subdirectory
197test -d UU || mkdir UU
8e07c86e 198cd UU && rm -f ./*
2304df62 199
6b356c8e
JH
200ccname=''
201ccversion=''
b4eb6b3d
JH
202ccsymbols=''
203cppccsymbols=''
204cppsymbols=''
5440bc8e
JH
205from=''
206run=''
207targetarch=''
208to=''
209usecrosscompile=''
61c26d18 210extern_C=''
6b34ded5 211mistrustnm=''
1be1b388 212usedevel=''
9c839522 213perllibs=''
b4eb6b3d
JH
214dynamic_ext=''
215extensions=''
216known_extensions=''
217nonxs_ext=''
218static_ext=''
219useopcode=''
220useposix=''
6fcddf3b 221extras=''
ecfc5424 222d_bsd=''
40a7a20a 223d_eunice=''
2304df62
AD
224d_xenix=''
225eunicefix=''
dfe9444c 226ar=''
2304df62
AD
227awk=''
228bash=''
229bison=''
230byacc=''
231cat=''
232chgrp=''
233chmod=''
234chown=''
ecfc5424 235comm=''
2304df62
AD
236compress=''
237cp=''
238cpio=''
239cpp=''
240csh=''
241date=''
242echo=''
243egrep=''
244emacs=''
245expr=''
246find=''
247flex=''
3c728e00 248gmake=''
2304df62 249grep=''
8ff267be 250gzip=''
2304df62
AD
251inews=''
252ksh=''
253less=''
254line=''
255lint=''
256ln=''
257lp=''
258lpr=''
259ls=''
260mail=''
261mailx=''
dfe9444c 262make=''
2304df62
AD
263mkdir=''
264more=''
265mv=''
693762b4 266nm=''
2304df62
AD
267nroff=''
268perl=''
269pg=''
270pmake=''
271pr=''
272rm=''
273rmail=''
274sed=''
275sendmail=''
2304df62
AD
276shar=''
277sleep=''
278smail=''
279sort=''
280submit=''
281tail=''
282tar=''
283tbl=''
693762b4 284tee=''
2304df62
AD
285test=''
286touch=''
287tr=''
288troff=''
289uname=''
290uniq=''
291uuname=''
292vi=''
293zcat=''
8ff267be 294zip=''
b4eb6b3d
JH
295full_ar=''
296full_sed=''
a0d0e21e 297libswanted=''
2304df62
AD
298hint=''
299myuname=''
85e6fe83
LW
300osname=''
301osvers=''
2304df62
AD
302Author=''
303Date=''
304Header=''
305Id=''
306Locker=''
307Log=''
308RCSfile=''
309Revision=''
310Source=''
311State=''
dfe9444c
AD
312_a=''
313_exe=''
314_o=''
4633a7c4
LW
315archobjs=''
316exe_ext=''
317firstmakefile=''
318lib_ext=''
319obj_ext=''
320path_sep=''
5b813a60 321rm_try=''
b4eb6b3d 322afs=''
a6d26a0d 323afsroot=''
b4eb6b3d
JH
324alignbytes=''
325ansi2knr=''
326archlib=''
327archlibexp=''
328d_archlib=''
329installarchlib=''
330archname=''
331myarchname=''
332d_atolf=''
333d_atoll=''
334baserev=''
335bin=''
336binexp=''
f3f1a2d8 337initialinstalllocation=''
b4eb6b3d 338installbin=''
f3f1a2d8 339userelocatableinc=''
b4eb6b3d 340byteorder=''
2304df62 341cc=''
2304df62
AD
342ccflags=''
343cppflags=''
344ldflags=''
345lkflags=''
8e07c86e 346locincpth=''
2304df62 347optimize=''
b4eb6b3d 348cf_email=''
2304df62
AD
349cf_by=''
350cf_time=''
351contains=''
b4eb6b3d 352cpp_stuff=''
2304df62
AD
353cpplast=''
354cppminus=''
355cpprun=''
356cppstdin=''
74cac757 357d__fwalk=''
b4eb6b3d
JH
358d_access=''
359d_accessx=''
55954f19 360d_aintl=''
b4eb6b3d 361d_alarm=''
10bc17b6
JH
362asctime_r_proto=''
363d_asctime_r=''
fcdf39cf 364d_attribute_deprecated=''
0dbb1585
AL
365d_attribute_format=''
366d_attribute_malloc=''
367d_attribute_nonnull=''
368d_attribute_noreturn=''
369d_attribute_pure=''
370d_attribute_unused=''
371d_attribute_warn_unused_result=''
dcb594bc 372d_printf_format_null=''
b4eb6b3d
JH
373d_bcmp=''
374d_bcopy=''
635aebb7
AL
375d_builtin_choose_expr=''
376d_builtin_expect=''
b4eb6b3d 377d_bzero=''
a2d23ec2 378d_c99_variadic_macros=''
b4eb6b3d
JH
379d_casti32=''
380castflags=''
381d_castneg=''
382d_chown=''
383d_chroot=''
384d_chsize=''
758a5d79 385d_class=''
b0a2e8e6 386d_clearenv=''
b4eb6b3d
JH
387d_closedir=''
388d_void_closedir=''
4e0554ec 389d_cmsghdr_s=''
b4eb6b3d 390d_const=''
36adc09b 391d_copysignl=''
666ea192 392d_cplusplus=''
b4eb6b3d
JH
393cryptlib=''
394d_crypt=''
10bc17b6
JH
395crypt_r_proto=''
396d_crypt_r=''
b4eb6b3d
JH
397d_csh=''
398full_csh=''
13cfc98d 399d_ctermid=''
10bc17b6
JH
400ctermid_r_proto=''
401d_ctermid_r=''
402ctime_r_proto=''
403d_ctime_r=''
b4eb6b3d
JH
404d_cuserid=''
405d_dbl_dig=''
2ef53570 406d_dbminitproto=''
b4eb6b3d 407d_difftime=''
de52168c 408d_dir_dd_fd=''
ae0e3d3b 409d_dirfd=''
b4eb6b3d 410d_dlerror=''
a0d0e21e 411d_dlopen=''
b4eb6b3d
JH
412d_dlsymun=''
413d_dosuid=''
414d_suidsafe=''
10bc17b6
JH
415d_drand48_r=''
416drand48_r_proto=''
b4eb6b3d
JH
417d_drand48proto=''
418d_dup2=''
419d_eaccess=''
420d_endgrent=''
10bc17b6
JH
421d_endgrent_r=''
422endgrent_r_proto=''
b4eb6b3d 423d_endhent=''
10bc17b6
JH
424d_endhostent_r=''
425endhostent_r_proto=''
b4eb6b3d 426d_endnent=''
10bc17b6
JH
427d_endnetent_r=''
428endnetent_r_proto=''
b4eb6b3d 429d_endpent=''
10bc17b6
JH
430d_endprotoent_r=''
431endprotoent_r_proto=''
b4eb6b3d 432d_endpwent=''
10bc17b6
JH
433d_endpwent_r=''
434endpwent_r_proto=''
b4eb6b3d 435d_endsent=''
10bc17b6
JH
436d_endservent_r=''
437endservent_r_proto=''
15b61c98 438d_faststdio=''
b363b713 439d_fchdir=''
b4eb6b3d
JH
440d_fchmod=''
441d_fchown=''
442d_fcntl=''
9d9004a9 443d_fcntl_can_lock=''
b4eb6b3d
JH
444d_fd_macros=''
445d_fd_set=''
446d_fds_bits=''
447d_fgetpos=''
758a5d79
JH
448d_finite=''
449d_finitel=''
b4eb6b3d
JH
450d_flexfnam=''
451d_flock=''
2ef53570 452d_flockproto=''
b4eb6b3d 453d_fork=''
758a5d79
JH
454d_fp_class=''
455d_fpclass=''
456d_fpclassify=''
457d_fpclassl=''
b4eb6b3d
JH
458d_fpos64_t=''
459d_frexpl=''
460d_fs_data_s=''
461d_fseeko=''
462d_fsetpos=''
463d_fstatfs=''
411ab01c 464d_fsync=''
b4eb6b3d
JH
465d_ftello=''
466d_ftime=''
467d_gettimeod=''
dc814df1 468d_futimes=''
b4eb6b3d
JH
469d_Gconvert=''
470d_getcwd=''
471d_getespwnam=''
472d_getfsstat=''
473d_getgrent=''
10bc17b6
JH
474d_getgrent_r=''
475getgrent_r_proto=''
476d_getgrgid_r=''
477getgrgid_r_proto=''
478d_getgrnam_r=''
479getgrnam_r_proto=''
b4eb6b3d
JH
480d_getgrps=''
481d_gethbyaddr=''
482d_gethbyname=''
483d_gethent=''
484aphostname=''
485d_gethname=''
486d_phostname=''
487d_uname=''
10bc17b6
JH
488d_gethostbyaddr_r=''
489gethostbyaddr_r_proto=''
490d_gethostbyname_r=''
491gethostbyname_r_proto=''
492d_gethostent_r=''
493gethostent_r_proto=''
b4eb6b3d 494d_gethostprotos=''
4e0554ec 495d_getitimer=''
b4eb6b3d 496d_getlogin=''
10bc17b6
JH
497d_getlogin_r=''
498getlogin_r_proto=''
b4eb6b3d
JH
499d_getmnt=''
500d_getmntent=''
501d_getnbyaddr=''
502d_getnbyname=''
503d_getnent=''
10bc17b6
JH
504d_getnetbyaddr_r=''
505getnetbyaddr_r_proto=''
506d_getnetbyname_r=''
507getnetbyname_r_proto=''
508d_getnetent_r=''
509getnetent_r_proto=''
b4eb6b3d 510d_getnetprotos=''
0c0643d0 511d_getpagsz=''
b4eb6b3d
JH
512d_getpent=''
513d_getpgid=''
514d_getpgrp2=''
515d_bsdgetpgrp=''
516d_getpgrp=''
517d_getppid=''
518d_getprior=''
519d_getpbyname=''
520d_getpbynumber=''
10bc17b6
JH
521d_getprotobyname_r=''
522getprotobyname_r_proto=''
523d_getprotobynumber_r=''
524getprotobynumber_r_proto=''
525d_getprotoent_r=''
526getprotoent_r_proto=''
b4eb6b3d
JH
527d_getprotoprotos=''
528d_getprpwnam=''
529d_getpwent=''
10bc17b6
JH
530d_getpwent_r=''
531getpwent_r_proto=''
532d_getpwnam_r=''
533getpwnam_r_proto=''
534d_getpwuid_r=''
535getpwuid_r_proto=''
b4eb6b3d 536d_getsent=''
10bc17b6
JH
537d_getservbyname_r=''
538getservbyname_r_proto=''
539d_getservbyport_r=''
540getservbyport_r_proto=''
541d_getservent_r=''
542getservent_r_proto=''
b4eb6b3d
JH
543d_getservprotos=''
544d_getspnam=''
10bc17b6
JH
545d_getspnam_r=''
546getspnam_r_proto=''
b4eb6b3d
JH
547d_getsbyname=''
548d_getsbyport=''
10bc17b6
JH
549d_gmtime_r=''
550gmtime_r_proto=''
a4f3eea9 551d_gnulibc=''
5f6e0ee4 552gnulibc_version=''
b4eb6b3d
JH
553d_hasmntopt=''
554d_htonl=''
55954f19 555d_ilogbl=''
b4eb6b3d
JH
556d_inetaton=''
557d_int64_t=''
558d_isascii=''
758a5d79
JH
559d_isfinite=''
560d_isinf=''
b4eb6b3d
JH
561d_isnan=''
562d_isnanl=''
563d_killpg=''
564d_lchown=''
565d_ldbl_dig=''
0a0abfba 566d_libm_lib_version=''
b4eb6b3d 567d_link=''
10bc17b6 568d_localtime_r=''
8572b25d 569d_localtime_r_needs_tzset=''
10bc17b6 570localtime_r_proto=''
b4eb6b3d
JH
571d_locconv=''
572d_lockf=''
573d_longdbl=''
574longdblsize=''
575d_longlong=''
576longlongsize=''
577d_lseekproto=''
578d_lstat=''
579d_madvise=''
7dd121ae
MB
580d_malloc_good_size=''
581d_malloc_size=''
b4eb6b3d
JH
582d_mblen=''
583d_mbstowcs=''
584d_mbtowc=''
585d_memchr=''
586d_memcmp=''
587d_memcpy=''
588d_memmove=''
589d_memset=''
590d_mkdir=''
591d_mkdtemp=''
592d_mkfifo=''
593d_mkstemp=''
594d_mkstemps=''
595d_mktime=''
596d_mmap=''
597mmaptype=''
598d_modfl=''
e67aeab1 599d_modfl_pow32_bug=''
bc9a1b2c 600d_modflproto=''
b4eb6b3d
JH
601d_mprotect=''
602d_msg=''
603d_msgctl=''
604d_msgget=''
4e0554ec 605d_msghdr_s=''
b4eb6b3d
JH
606d_msgrcv=''
607d_msgsnd=''
608d_msync=''
609d_munmap=''
610d_nice=''
2765b840 611d_nl_langinfo=''
b4eb6b3d
JH
612d_off64_t=''
613d_open3=''
614d_fpathconf=''
615d_pathconf=''
616d_pause=''
617d_pipe=''
618d_poll=''
2304df62 619d_portable=''
a33c94aa 620d_procselfexe=''
f24dbf84 621procselfexe=''
b4eb6b3d
JH
622d_old_pthread_create_joinable=''
623old_pthread_create_joinable=''
d6483fcc 624d_pthread_atfork=''
58d975c3 625d_pthread_attr_setscope=''
b4eb6b3d
JH
626d_pthread_yield=''
627d_sched_yield=''
628sched_yield=''
629d_qgcvt=''
10bc17b6
JH
630d_random_r=''
631random_r_proto=''
632d_readdir64_r=''
633readdir64_r_proto=''
b4eb6b3d
JH
634d_readdir=''
635d_rewinddir=''
636d_seekdir=''
637d_telldir=''
10bc17b6
JH
638d_readdir_r=''
639readdir_r_proto=''
b4eb6b3d 640d_readlink=''
4e0554ec
JH
641d_readv=''
642d_recvmsg=''
b4eb6b3d
JH
643d_rename=''
644d_rmdir=''
645d_safebcpy=''
646d_safemcpy=''
647d_sanemcmp=''
ef9f17be 648d_sbrkproto=''
55954f19 649d_scalbnl=''
b4eb6b3d
JH
650d_select=''
651d_sem=''
652d_semctl=''
653d_semget=''
654d_semop=''
4e0554ec 655d_sendmsg=''
b4eb6b3d
JH
656d_setegid=''
657d_seteuid=''
658d_setgrent=''
10bc17b6
JH
659d_setgrent_r=''
660setgrent_r_proto=''
b4eb6b3d
JH
661d_setgrps=''
662d_sethent=''
10bc17b6
JH
663d_sethostent_r=''
664sethostent_r_proto=''
4e0554ec 665d_setitimer=''
b4eb6b3d
JH
666d_setlinebuf=''
667d_setlocale=''
10bc17b6
JH
668d_setlocale_r=''
669setlocale_r_proto=''
b4eb6b3d 670d_setnent=''
10bc17b6
JH
671d_setnetent_r=''
672setnetent_r_proto=''
b4eb6b3d
JH
673d_setpent=''
674d_setpgid=''
675d_setpgrp2=''
676d_bsdsetpgrp=''
677d_setpgrp=''
678d_setprior=''
679d_setproctitle=''
10bc17b6
JH
680d_setprotoent_r=''
681setprotoent_r_proto=''
b4eb6b3d 682d_setpwent=''
10bc17b6
JH
683d_setpwent_r=''
684setpwent_r_proto=''
b4eb6b3d
JH
685d_setregid=''
686d_setresgid=''
687d_setresuid=''
688d_setreuid=''
689d_setrgid=''
690d_setruid=''
691d_setsent=''
10bc17b6
JH
692d_setservent_r=''
693setservent_r_proto=''
b4eb6b3d
JH
694d_setsid=''
695d_setvbuf=''
696d_sfio=''
697usesfio=''
698d_shm=''
699d_shmat=''
700d_shmatprototype=''
701shmattype=''
702d_shmctl=''
703d_shmdt=''
704d_shmget=''
705d_sigaction=''
ed140128 706d_signbit=''
983dbef6 707d_sigprocmask=''
b4eb6b3d 708d_sigsetjmp=''
5f106f9c 709usesitecustomize=''
4f5da3e9
SP
710d_snprintf=''
711d_vsnprintf=''
49a78c82 712d_sockatmark=''
2ef53570 713d_sockatmarkproto=''
b4eb6b3d
JH
714d_msg_ctrunc=''
715d_msg_dontroute=''
716d_msg_oob=''
717d_msg_peek=''
718d_msg_proxy=''
719d_oldsock=''
720d_scm_rights=''
721d_socket=''
722d_sockpair=''
723sockethdr=''
724socketlib=''
725d_socklen_t=''
726d_socks5_init=''
360321b3 727d_sprintf_returns_strlen=''
b4eb6b3d 728d_sqrtl=''
10bc17b6
JH
729d_srand48_r=''
730srand48_r_proto=''
731d_srandom_r=''
732srandom_r_proto=''
eef837ea 733d_sresgproto=''
640374d0 734d_sresuproto=''
b4eb6b3d
JH
735d_statblks=''
736d_statfs_f_flags=''
737d_statfs_s=''
738d_fstatvfs=''
739d_statvfs=''
740d_stdio_cnt_lval=''
741d_stdio_ptr_lval=''
a7ffa9b9
NC
742d_stdio_ptr_lval_nochange_cnt=''
743d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
744d_stdiobase=''
745d_stdstdio=''
746stdio_base=''
747stdio_bufsiz=''
748stdio_cnt=''
749stdio_filbuf=''
750stdio_ptr=''
751d_index=''
752d_strchr=''
753d_strcoll=''
754d_strctcpy=''
755d_strerrm=''
756d_strerror=''
757d_sysernlst=''
758d_syserrlst=''
10bc17b6
JH
759d_strerror_r=''
760strerror_r_proto=''
b3c85772 761d_strftime=''
08c92000
MB
762d_strlcat=''
763d_strlcpy=''
b4eb6b3d
JH
764d_strtod=''
765d_strtol=''
766d_strtold=''
767d_strtoll=''
28e5dec8 768d_strtoq=''
b4eb6b3d
JH
769d_strtoul=''
770d_strtoull=''
771d_strtouq=''
772d_strxfrm=''
773d_symlink=''
774d_syscall=''
2ef53570 775d_syscallproto=''
b4eb6b3d
JH
776d_sysconf=''
777d_system=''
778d_tcgetpgrp=''
779d_tcsetpgrp=''
780d_telldirproto=''
781d_time=''
782timetype=''
96938616
MB
783d_asctime64=''
784d_ctime64=''
785d_difftime64=''
786d_gmtime64=''
787d_localtime64=''
788d_mktime64=''
cbb9e8a7 789d_timegm=''
b4eb6b3d
JH
790clocktype=''
791d_times=''
10bc17b6
JH
792d_tmpnam_r=''
793tmpnam_r_proto=''
b4eb6b3d 794d_truncate=''
10bc17b6
JH
795d_ttyname_r=''
796ttyname_r_proto=''
b4eb6b3d 797d_tzname=''
4e0554ec
JH
798d_u32align=''
799d_ualarm=''
b4eb6b3d
JH
800d_umask=''
801d_semctl_semid_ds=''
802d_semctl_semun=''
803d_union_semun=''
758a5d79 804d_unordered=''
bdf33aa7 805d_unsetenv=''
4e0554ec 806d_usleep=''
2ef53570 807d_usleepproto=''
b4eb6b3d 808d_ustat=''
233e16ce 809d_pseudofork=''
b4eb6b3d
JH
810d_vfork=''
811usevfork=''
812d_voidsig=''
813signal_t=''
814d_volatile=''
815d_charvspr=''
816d_vprintf=''
817d_wait4=''
818d_waitpid=''
819d_wcstombs=''
820d_wctomb=''
4e0554ec 821d_writev=''
b4eb6b3d 822dlext=''
85e6fe83
LW
823cccdlflags=''
824ccdlflags=''
2304df62 825dlsrc=''
232e078e 826ld=''
85e6fe83 827lddlflags=''
2304df62 828usedl=''
b4eb6b3d
JH
829doublesize=''
830ebcdic=''
831fflushNULL=''
832fflushall=''
833fpossize=''
834fpostype=''
2d736872 835gccansipedantic=''
5b463ca7 836gccosandvers=''
8a27cf78 837gccversion=''
b4eb6b3d
JH
838gidformat=''
839gidsign=''
840gidsize=''
841gidtype=''
842groupstype=''
843h_fcntl=''
844h_sysfile=''
6e1038e0
MB
845html1dir=''
846html1direxp=''
847installhtml1dir=''
848html3dir=''
849html3direxp=''
850installhtml3dir=''
b4eb6b3d 851i_arpainet=''
c0bacbef 852i_assert=''
10bc17b6 853i_crypt=''
b4eb6b3d
JH
854db_hashtype=''
855db_prefixtype=''
640374d0
JH
856db_version_major=''
857db_version_minor=''
858db_version_patch=''
b4eb6b3d
JH
859i_db=''
860i_dbm=''
861i_rpcsvcdbm=''
862d_dirnamlen=''
863direntrytype=''
864i_dirent=''
a0d0e21e 865i_dld=''
b4eb6b3d
JH
866i_dlfcn=''
867i_fcntl=''
868i_float=''
758a5d79
JH
869i_fp=''
870i_fp_class=''
b4eb6b3d
JH
871i_gdbm=''
872d_grpasswd=''
873i_grp=''
b4eb6b3d
JH
874i_ieeefp=''
875i_inttypes=''
2765b840 876i_langinfo=''
b4eb6b3d
JH
877i_libutil=''
878i_limits=''
879i_locale=''
880i_machcthr=''
881i_malloc=''
1cd66f7c 882i_mallocmalloc=''
b4eb6b3d
JH
883i_math=''
884i_memory=''
885i_mntent=''
e74475c7
MHM
886d_gdbm_ndbm_h_uses_prototypes=''
887d_gdbmndbm_h_uses_prototypes=''
a33f2d9f 888d_ndbm=''
e74475c7 889d_ndbm_h_uses_prototypes=''
a33f2d9f
AD
890i_gdbm_ndbm=''
891i_gdbmndbm=''
b4eb6b3d
JH
892i_ndbm=''
893i_netdb=''
894i_neterrno=''
895i_netinettcp=''
896i_niin=''
897i_sysin=''
898i_poll=''
899i_prot=''
900i_pthread=''
901d_pwage=''
902d_pwchange=''
903d_pwclass=''
904d_pwcomment=''
905d_pwexpire=''
906d_pwgecos=''
907d_pwpasswd=''
908d_pwquota=''
909i_pwd=''
910i_sfio=''
911i_shadow=''
912i_socks=''
913i_stddef=''
914i_stdlib=''
915i_string=''
916strings=''
917i_sunmath=''
918i_sysaccess=''
919i_sysdir=''
920i_sysfile=''
921d_voidtty=''
922i_bsdioctl=''
923i_sysfilio=''
924i_sysioctl=''
925i_syssockio=''
926i_syslog=''
927i_sysmman=''
928i_sysmode=''
929i_sysmount=''
930i_sysndir=''
931i_sysparam=''
216dac04 932i_syspoll=''
b4eb6b3d
JH
933i_sysresrc=''
934i_syssecrt=''
935i_sysselct=''
936i_sysstat=''
937i_sysstatfs=''
938i_sysstatvfs=''
939i_systimes=''
940i_systypes=''
941i_sysuio=''
942i_sysun=''
943i_sysutsname=''
944i_sysvfs=''
945i_syswait=''
946i_sgtty=''
947i_termio=''
948i_termios=''
14b90194
JH
949d_tm_tm_gmtoff=''
950d_tm_tm_zone=''
b4eb6b3d
JH
951i_systime=''
952i_systimek=''
953i_time=''
954timeincl=''
955i_unistd=''
956i_ustat=''
957i_utime=''
958i_values=''
959i_stdarg=''
960i_varargs=''
961i_varhdr=''
962i_vfork=''
f3f1a2d8 963d_inc_version_list=''
b4eb6b3d
JH
964inc_version_list=''
965inc_version_list_init=''
966installprefix=''
967installprefixexp=''
968installstyle=''
969installusrbinperl=''
970intsize=''
971longsize=''
972shortsize=''
4b661809 973issymlink=''
2304df62 974libc=''
b4eb6b3d
JH
975ldlibpthname=''
976libperl=''
977shrpenv=''
978useshrplib=''
a0d0e21e 979glibpth=''
2304df62 980libpth=''
8e07c86e 981loclibpth=''
2304df62
AD
982plibpth=''
983xlibpth=''
1cfa4ec7 984ignore_versioned_solibs=''
2304df62 985libs=''
43999f95
JH
986libsdirs=''
987libsfiles=''
988libsfound=''
13b3f787 989libspath=''
85e6fe83 990lns=''
b4eb6b3d
JH
991d_PRIEUldbl=''
992d_PRIFUldbl=''
993d_PRIGUldbl=''
994d_PRIeldbl=''
995d_PRIfldbl=''
996d_PRIgldbl=''
997d_SCNfldbl=''
998sPRIEUldbl=''
999sPRIFUldbl=''
1000sPRIGUldbl=''
1001sPRIeldbl=''
1002sPRIfldbl=''
1003sPRIgldbl=''
1004sSCNfldbl=''
1005lseeksize=''
1006lseektype=''
d620c7b3 1007mad=''
00e74f14
NC
1008madlyh=''
1009madlyobj=''
1010madlysrc=''
f3f1a2d8
MB
1011make_set_make=''
1012d_mymalloc=''
1013freetype=''
b4eb6b3d
JH
1014mallocobj=''
1015mallocsrc=''
1016malloctype=''
9df442c2 1017usemallocwrap=''
b4eb6b3d
JH
1018usemymalloc=''
1019installman1dir=''
1020man1dir=''
1021man1direxp=''
1022man1ext=''
1023installman3dir=''
1024man3dir=''
1025man3direxp=''
1026man3ext=''
1027modetype=''
1028multiarch=''
1029mydomain=''
1030myhostname=''
1031phostname=''
2304df62
AD
1032c=''
1033n=''
b4eb6b3d
JH
1034d_eofnblk=''
1035eagain=''
1036o_nonblock=''
1037rd_nodata=''
2cc61e15 1038need_va_copy=''
b4eb6b3d
JH
1039netdb_hlen_type=''
1040netdb_host_type=''
1041netdb_name_type=''
1042netdb_net_type=''
1043groupcat=''
1044hostcat=''
1045passcat=''
1046orderlib=''
1047ranlib=''
1048d_perl_otherlibdirs=''
1049otherlibdirs=''
2304df62
AD
1050package=''
1051spackage=''
b4eb6b3d
JH
1052pager=''
1053api_revision=''
1054api_subversion=''
1055api_version=''
1056api_versionstring=''
1057patchlevel=''
151e6568 1058perl_patchlevel=''
b4eb6b3d
JH
1059revision=''
1060subversion=''
1061version=''
861eb78d 1062version_patchlevel_string=''
b4eb6b3d
JH
1063perl5=''
1064perladmin=''
1065perlpath=''
1066d_nv_preserves_uv=''
f607920a 1067d_nv_zero_is_allbits_zero=''
b4eb6b3d
JH
1068i16size=''
1069i16type=''
1070i32size=''
1071i32type=''
1072i64size=''
1073i64type=''
1074i8size=''
1075i8type=''
1076ivsize=''
1077ivtype=''
b68c599a 1078nv_overflows_integers_at=''
4137585d 1079nv_preserves_uv_bits=''
b4eb6b3d
JH
1080nvsize=''
1081nvtype=''
1082u16size=''
1083u16type=''
1084u32size=''
1085u32type=''
1086u64size=''
1087u64type=''
1088u8size=''
1089u8type=''
1090uvsize=''
1091uvtype=''
1092ivdformat=''
1093nvEUformat=''
1094nvFUformat=''
1095nvGUformat=''
1096nveformat=''
1097nvfformat=''
1098nvgformat=''
1099uvXUformat=''
1100uvoformat=''
1101uvuformat=''
1102uvxformat=''
1103pidtype=''
1104prefix=''
1105prefixexp=''
1106installprivlib=''
1107privlib=''
1108privlibexp=''
1109prototype=''
1110ptrsize=''
1111d_PRIXU64=''
1112d_PRId64=''
1113d_PRIi64=''
1114d_PRIo64=''
1115d_PRIu64=''
1116d_PRIx64=''
1117sPRIXU64=''
1118sPRId64=''
1119sPRIi64=''
1120sPRIo64=''
1121sPRIu64=''
1122sPRIx64=''
1123d_quad=''
1124quadkind=''
1125quadtype=''
1126uquadtype=''
1127drand01=''
1128randbits=''
1129randfunc=''
1130randseedtype=''
1131seedfunc=''
1132installscript=''
1133scriptdir=''
1134scriptdirexp=''
1135selectminbits=''
1136selecttype=''
8ff267be 1137sh=''
b4eb6b3d
JH
1138sig_count=''
1139sig_name=''
1140sig_name_init=''
1141sig_num=''
1142sig_num_init=''
76d3c696 1143sig_size=''
f3f1a2d8 1144d_sitearch=''
b4eb6b3d
JH
1145installsitearch=''
1146sitearch=''
1147sitearchexp=''
1148installsitebin=''
1149sitebin=''
1150sitebinexp=''
8d2cbf27
JH
1151installsitehtml1dir=''
1152sitehtml1dir=''
1153sitehtml1direxp=''
1154installsitehtml3dir=''
1155sitehtml3dir=''
1156sitehtml3direxp=''
b4eb6b3d
JH
1157installsitelib=''
1158sitelib=''
1159sitelib_stem=''
1160sitelibexp=''
91e123a8
JH
1161installsiteman1dir=''
1162siteman1dir=''
1163siteman1direxp=''
1164installsiteman3dir=''
1165siteman3dir=''
1166siteman3direxp=''
b4eb6b3d
JH
1167siteprefix=''
1168siteprefixexp=''
6e1038e0
MB
1169installsitescript=''
1170sitescript=''
1171sitescriptexp=''
b4eb6b3d
JH
1172sizesize=''
1173sizetype=''
a0d0e21e 1174so=''
b4eb6b3d 1175socksizetype=''
2304df62
AD
1176sharpbang=''
1177shsharp=''
1178spitshell=''
dfe9444c 1179src=''
b4eb6b3d
JH
1180ssizetype=''
1181startperl=''
2304df62 1182startsh=''
b4eb6b3d
JH
1183stdchar=''
1184d_stdio_stream_array=''
1185stdio_stream_array=''
1186sysman=''
81c4fd9e
MB
1187sGMTIME_max=''
1188sGMTIME_min=''
73e6e416
MB
1189sLOCALTIME_max=''
1190sLOCALTIME_min=''
5ff3f7a4 1191trnl=''
b4eb6b3d
JH
1192uidformat=''
1193uidsign=''
1194uidsize=''
1195uidtype=''
1196archname64=''
1197use64bitall=''
1198use64bitint=''
34f1896b
MB
1199dtrace=''
1200usedtrace=''
15b61c98 1201usefaststdio=''
b4eb6b3d
JH
1202ccflags_uselargefiles=''
1203ldflags_uselargefiles=''
1204libswanted_uselargefiles=''
1205uselargefiles=''
1206uselongdouble=''
1207usemorebits=''
1208usemultiplicity=''
2304df62 1209nm_opt=''
40a7a20a 1210nm_so_opt=''
2304df62
AD
1211runnm=''
1212usenm=''
b4eb6b3d 1213useperlio=''
29209bc5 1214usesocks=''
b4eb6b3d
JH
1215d_oldpthreads=''
1216use5005threads=''
1217useithreads=''
9514c62b 1218usereentrant=''
b4eb6b3d 1219usethreads=''
2304df62 1220incpath=''
2304df62
AD
1221mips_type=''
1222usrinc=''
b4eb6b3d
JH
1223d_vendorarch=''
1224installvendorarch=''
1225vendorarch=''
1226vendorarchexp=''
1227d_vendorbin=''
1228installvendorbin=''
1229vendorbin=''
1230vendorbinexp=''
8d2cbf27
JH
1231installvendorhtml1dir=''
1232vendorhtml1dir=''
1233vendorhtml1direxp=''
1234installvendorhtml3dir=''
1235vendorhtml3dir=''
1236vendorhtml3direxp=''
b4eb6b3d
JH
1237d_vendorlib=''
1238installvendorlib=''
1239vendorlib=''
1240vendorlib_stem=''
1241vendorlibexp=''
91e123a8
JH
1242installvendorman1dir=''
1243vendorman1dir=''
1244vendorman1direxp=''
1245installvendorman3dir=''
1246vendorman3dir=''
1247vendorman3direxp=''
b4eb6b3d
JH
1248usevendorprefix=''
1249vendorprefix=''
1250vendorprefixexp=''
6e1038e0
MB
1251d_vendorscript=''
1252installvendorscript=''
1253vendorscript=''
1254vendorscriptexp=''
d56c5707 1255versiononly=''
b4eb6b3d
JH
1256defvoidused=''
1257voidflags=''
3659ebf1
JH
1258yacc=''
1259yaccflags=''
2304df62
AD
1260CONFIG=''
1261
34f1896b 1262: Detect odd OSs
ecfc5424
AD
1263define='define'
1264undef='undef'
1265smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1266rmlist=''
1267
1268: We must find out about Eunice early
1269eunicefix=':'
1270if test -f /etc/unixtovms; then
1271 eunicefix=/etc/unixtovms
1272fi
1273if test -f /etc/unixtovms.exe; then
1274 eunicefix=/etc/unixtovms.exe
1275fi
1276
cfb04860 1277: Set executable suffix now -- needed before hints available
6153ba32
PG
1278if test -f "/libs/version.library"; then
1279: Amiga OS
1280 _exe=""
1281elif test -f "/system/gnu_library/bin/ar.pm"; then
1282: Stratus VOS
cfb04860 1283 _exe=".pm"
6153ba32
PG
1284elif test -n "$DJGPP"; then
1285: DOS DJGPP
cfb04860 1286 _exe=".exe"
5c728af0 1287elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1288: OS/2 or cygwin
ba863942
JH
1289 _exe=".exe"
1290fi
868439a2 1291
1d8eaf8c 1292groupstype=''
b4eb6b3d 1293i_whoami=''
9da7673b
MB
1294: Trailing extension. Override this in a hint file, if needed.
1295: Extra object files, if any, needed on this platform.
1296archobjs=''
1297archname=''
64615a5e 1298libnames=''
732c9516
JH
1299: change the next line if compiling for Xenix/286 on Xenix/386
1300xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1301: Possible local library directories to search.
1302loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1303loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1304
1305: general looking path for locating libraries
5869b1f1 1306glibpth="/lib /usr/lib $xlibpth"
732c9516 1307glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1308test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1309test -f /shlib/libc.so && glibpth="/shlib $glibpth"
faae14e6 1310test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
732c9516
JH
1311
1312: Private path used by Configure to find libraries. Its value
1313: is prepended to libpth. This variable takes care of special
1314: machines, like the mips. Usually, it should be empty.
1315plibpth=''
1316
1cfa4ec7
GS
1317: default library list
1318libswanted=''
921b2963 1319: some systems want to use only the non-versioned libso:s
1cfa4ec7 1320ignore_versioned_solibs=''
ed140128
AD
1321: set usethreads on the Configure command line to enable threads.
1322usereentrant='undef'
1323: full support for void wanted by default
1324defvoidused=15
1325
1326: Possible local include directories to search.
1327: Set locincpth to "" in a hint file to defeat local include searches.
1328locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1329locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1330:
1331: no include file wanted by default
1332inclwanted=''
1333
1334: Enable -DEBUGGING and -DDEBUGGING from the command line
1335EBUGGING=''
1336DEBUGGING=old
1337
1338ccname=''
1339ccversion=''
1340perllibs=''
1341: set useposix=false in your hint file to disable the POSIX extension.
1342useposix=true
1343: set useopcode=false in your hint file to disable the Opcode extension.
1344useopcode=true
b4eb6b3d
JH
1345archname64=''
1346ccflags_uselargefiles=''
1347ldflags_uselargefiles=''
1348libswanted_uselargefiles=''
1349: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1350: set usesocks on the Configure command line to enable socks.
ecfc5424 1351: List of libraries we want.
15431986 1352: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef 1353libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
8119684f 1354libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1355: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1356: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1357glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1358glibpth="/usr/shlib $glibpth"
1359: Do not use vfork unless overridden by a hint file.
1360usevfork=false
1361
8ff267be 1362: Find the basic shell for Bourne shell scripts
1363case "$sh" in
1364'')
8ff267be 1365 case "$SYSTYPE" in
1366 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1367 *) xxx='/bin/sh';;
1368 esac
1369 if test -f "$xxx"; then
1370 sh="$xxx"
1371 else
1372 : Build up a list and do a single loop so we can 'break' out.
1373 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1374 for xxx in sh bash ksh pdksh ash; do
1375 for p in $pth; do
1376 try="$try ${p}/${xxx}"
1377 done
1378 done
1379 for xxx in $try; do
1380 if test -f "$xxx"; then
1381 sh="$xxx";
8ff267be 1382 break
a5a94ea5
JH
1383 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1384 sh="$xxx";
1385 break
8ff267be 1386 elif test -f "$xxx.exe"; then
1387 sh="$xxx";
8ff267be 1388 break
1389 fi
1390 done
1391 fi
1392 ;;
1393esac
1394
1395case "$sh" in
a33c94aa 1396'') cat >&2 <<EOM
8ff267be 1397$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1398
8ff267be 1399Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1400Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1401we'll try to straighten this all out.
8ff267be 1402EOM
1403 exit 1
1404 ;;
1405esac
1406
760ac839 1407: see if sh knows # comments
73614538 1408if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1409 shsharp=true
1410 spitshell=cat
760ac839 1411 xcat=/bin/cat
a931254c
JH
1412 test -f $xcat$_exe || xcat=/usr/bin/cat
1413 if test ! -f $xcat$_exe; then
4bdb8fb5 1414 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1415 if test -f $p/cat$_exe; then
1deb0a86 1416 xcat=$p/cat
3c728e00
JH
1417 break
1418 fi
1419 done
1deb0a86
JH
1420 if test ! -f $xcat$_exe; then
1421 echo "Can't find cat anywhere!"
3c728e00
JH
1422 exit 1
1423 fi
1424 fi
5440bc8e
JH
1425 echo "#!$xcat" >sharp
1426 $eunicefix sharp
1427 chmod +x sharp
1d8eaf8c 1428 ./sharp > today 2>/dev/null
760ac839 1429 if test -s today; then
760ac839
LW
1430 sharpbang='#!'
1431 else
5440bc8e
JH
1432 echo "#! $xcat" > sharp
1433 $eunicefix sharp
1434 chmod +x sharp
1d8eaf8c 1435 ./sharp > today 2>/dev/null
760ac839 1436 if test -s today; then
760ac839
LW
1437 sharpbang='#! '
1438 else
760ac839
LW
1439 sharpbang=': use '
1440 fi
1441 fi
1442else
dfe9444c 1443 echo " "
8ff267be 1444 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1445 shsharp=false
1446 cd ..
1447 echo "exec grep -v '^[ ]*#'" >spitshell
1448 chmod +x spitshell
1449 $eunicefix spitshell
1450 spitshell=`pwd`/spitshell
1451 cd UU
1452 echo "I presume that if # doesn't work, #! won't work either!"
1453 sharpbang=': use '
1454fi
5440bc8e 1455rm -f sharp today
760ac839
LW
1456
1457: figure out how to guarantee sh startup
8ff267be 1458case "$startsh" in
1459'') startsh=${sharpbang}${sh} ;;
1460*)
760ac839 1461esac
5440bc8e 1462cat >sharp <<EOSS
760ac839
LW
1463$startsh
1464set abc
1465test "$?abc" != 1
1466EOSS
1467
5440bc8e
JH
1468chmod +x sharp
1469$eunicefix sharp
1470if ./sharp; then
8ff267be 1471 : echo "Yup, it does."
760ac839 1472else
dfe9444c
AD
1473 echo "Hmm... '$startsh' does not guarantee sh startup..."
1474 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1475fi
5440bc8e 1476rm -f sharp
760ac839 1477
aebf16e7
AD
1478: Save command line options in file UU/cmdline.opt for later use in
1479: generating config.sh.
1480cat > cmdline.opt <<EOSH
613d6c3e 1481: Configure command line arguments.
aebf16e7
AD
1482config_arg0='$0'
1483config_args='$*'
1484config_argc=$#
1485EOSH
1486argn=1
ee45ea83
IZ
1487args_exp=''
1488args_sep=''
aebf16e7
AD
1489for arg in "$@"; do
1490 cat >>cmdline.opt <<EOSH
1491config_arg$argn='$arg'
1492EOSH
ee45ea83
IZ
1493 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1494$arg
1495EOC
1496 arg_exp=`cat cmdl.opt`
1497 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1498 argn=`expr $argn + 1`
ee45ea83 1499 args_sep=' '
aebf16e7 1500done
ee45ea83 1501rm -f cmdl.opt
aebf16e7 1502
2304df62
AD
1503: produce awk script to parse command line options
1504cat >options.awk <<'EOF'
1505BEGIN {
02e93a22 1506 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1507
1508 len = length(optstr);
1509 for (i = 1; i <= len; i++) {
1510 c = substr(optstr, i, 1);
1511 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1512 if (a == ":") {
1513 arg[c] = 1;
1514 i++;
1515 }
1516 opt[c] = 1;
1517 }
1518}
1519{
1520 expect = 0;
1521 str = $0;
1522 if (substr(str, 1, 1) != "-") {
1523 printf("'%s'\n", str);
1524 next;
1525 }
1526 len = length($0);
1527 for (i = 2; i <= len; i++) {
1528 c = substr(str, i, 1);
1529 if (!opt[c]) {
1530 printf("-%s\n", substr(str, i));
1531 next;
1532 }
1533 printf("-%s\n", c);
1534 if (arg[c]) {
1535 if (i < len)
1536 printf("'%s'\n", substr(str, i + 1));
1537 else
1538 expect = 1;
1539 next;
1540 }
1541 }
1542}
1543END {
1544 if (expect)
1545 print "?";
1546}
1547EOF
1548
1549: process the command line options
4633a7c4
LW
1550set X `for arg in "$@"; do echo "X$arg"; done |
1551 sed -e s/X// | awk -f options.awk`
2304df62
AD
1552eval "set $*"
1553shift
1554rm -f options.awk
1555
1556: set up default values
1557fastread=''
1558reuseval=false
1559config_sh=''
1560alldone=''
1561error=''
1562silent=''
1563extractsh=''
ecfc5424 1564override=''
16d20bd9 1565knowitall=''
02e93a22 1566rm -f optdef.sh posthint.sh
28757baa 1567cat >optdef.sh <<EOS
1568$startsh
1569EOS
2304df62 1570
dfe9444c 1571
2304df62
AD
1572: option parsing
1573while test $# -gt 0; do
1574 case "$1" in
1575 -d) shift; fastread=yes;;
1576 -e) shift; alldone=cont;;
1577 -f)
1578 shift
1579 cd ..
1580 if test -r "$1"; then
1581 config_sh="$1"
1582 else
a0d0e21e 1583 echo "$me: cannot read config file $1." >&2
2304df62
AD
1584 error=true
1585 fi
1586 cd UU
1587 shift;;
3f30fabf 1588 --help|\
2304df62
AD
1589 -h) shift; error=true;;
1590 -r) shift; reuseval=true;;
dfe9444c 1591 -s) shift; silent=true; realsilent=true;;
2304df62 1592 -E) shift; alldone=exit;;
16d20bd9 1593 -K) shift; knowitall=true;;
ecfc5424 1594 -O) shift; override=true;;
dfe9444c 1595 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1596 -D)
1597 shift
1598 case "$1" in
1599 *=)
1600 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1601 echo "$me: ignoring -D $1" >&2
1602 ;;
ecfc5424 1603 *=*) echo "$1" | \
1aef975c
AD
1604 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1605 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1606 esac
1607 shift
1608 ;;
1609 -U)
1610 shift
1611 case "$1" in
1aef975c 1612 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1613 *=*)
1614 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1615 echo "$me: ignoring -U $1" >&2
1616 ;;
1aef975c 1617 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1618 esac
1619 shift
1620 ;;
02e93a22
JH
1621 -A)
1622 shift
1623 xxx=''
1624 yyy="$1"
02e93a22 1625 zzz=''
5f83a3e9 1626 uuu=undef
02e93a22 1627 case "$yyy" in
f7c31117 1628 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1629 case "$zzz" in
1630 *:*) zzz='' ;;
1631 *) xxx=append
613d6c3e 1632 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
f7c31117 1633 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1634 esac
1635 ;;
1636 esac
1637 case "$xxx" in
1638 '') case "$yyy" in
f7c31117
JH
1639 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1640 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1641 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1642 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1643 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1644 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9 1645 esac
613d6c3e 1646 ;;
5f83a3e9 1647 esac
02e93a22
JH
1648 case "$xxx" in
1649 append)
5f83a3e9 1650 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1651 clear)
5f83a3e9 1652 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1653 define)
1654 case "$zzz" in
1655 '') zzz=define ;;
1656 esac
5f83a3e9 1657 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1658 eval)
5f83a3e9 1659 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1660 prepend)
5f83a3e9 1661 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1662 undef)
1663 case "$zzz" in
1664 '') zzz="$uuu" ;;
1665 esac
5f83a3e9
JH
1666 echo "$yyy=$zzz" >> posthint.sh ;;
1667 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1668 esac
bde6b06b 1669 shift
02e93a22 1670 ;;
216dac04 1671 -V) echo "$me generated by metaconfig 3.5 PL0." >&2
5f83a3e9 1672 exit 0;;
2304df62 1673 --) break;;
a0d0e21e 1674 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1675 *) break;;
1676 esac
1677done
1678
1679case "$error" in
1680true)
1681 cat >&2 <<EOM
2afac517 1682Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1683 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1684 -d : use defaults for all answers.
1685 -e : go on without questioning past the production of config.sh.
1686 -f : specify an alternate default configuration file.
1687 -h : print this help message and exit (with an error status).
1688 -r : reuse C symbols value if possible (skips costly nm extraction).
1689 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1690 -D : define symbol to have some value:
1691 -D symbol symbol gets the value 'define'
1692 -D symbol=value symbol gets the value 'value'
3f30fabf
MB
1693 common used examples (see INSTALL for more info):
1694 -Duse64bitint use 64bit integers
b79e0b55 1695 -Duse64bitall use 64bit integers and pointers
3f30fabf 1696 -Dusethreads use thread support
b79e0b55 1697 -Dinc_version_list=none do not include older perl trees in @INC
3f30fabf
MB
1698 -DEBUGGING=none DEBUGGING options
1699 -Dcc=gcc choose your compiler
1700 -Dprefix=/opt/perl5 choose your destination
2304df62 1701 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1702 -K : do not use unless you know what you are doing.
ecfc5424 1703 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1704 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1705 -U : undefine symbol:
1706 -U symbol symbol gets the value 'undef'
1707 -U symbol= symbol gets completely empty
3f30fabf 1708 e.g.: -Uversiononly
02e93a22 1709 -A : manipulate symbol after the platform specific hints have been applied:
2ac814f3
MB
1710 -A append:symbol=value append value to symbol
1711 -A symbol=value like append:, but with a separating space
1712 -A define:symbol=value define symbol to have value
1713 -A clear:symbol define symbol to be ''
1714 -A define:symbol define symbol to be 'define'
1715 -A eval:symbol=value define symbol to be eval of value
1716 -A prepend:symbol=value prepend value to symbol
1717 -A undef:symbol define symbol to be 'undef'
1718 -A undef:symbol= define symbol to be ''
3f30fabf 1719 e.g.: -A prepend:libswanted='cl pthread '
2ac814f3 1720 -A ccflags=-DSOME_MACRO
2304df62
AD
1721 -V : print version number and exit (with a zero status).
1722EOM
1723 exit 1
1724 ;;
1725esac
1726
dfe9444c
AD
1727: Sanity checks
1728case "$fastread$alldone" in
1729yescont|yesexit) ;;
1730*)
aaeb8e51
GS
1731 case "$extractsh" in
1732 true) ;;
1733 *)
1734 if test ! -t 0; then
1735 echo "Say 'sh Configure', not 'sh <Configure'"
1736 exit 1
1737 fi
1738 ;;
1739 esac
dfe9444c
AD
1740 ;;
1741esac
1742
2304df62
AD
1743exec 4>&1
1744case "$silent" in
1745true) exec 1>/dev/null;;
1746esac
1747
ecfc5424 1748: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1749touch optdef.sh
1750. ./optdef.sh
02e93a22
JH
1751: create the posthint manipulation script and leave the file out there...
1752touch posthint.sh
a0d0e21e 1753
2304df62 1754: set package name
34f1896b 1755package='perl5'
b4eb6b3d
JH
1756first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1757last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1758case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1759ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1760*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1761esac
2304df62 1762
2304df62
AD
1763: Some greps do not return status, grrr.
1764echo "grimblepritz" >grimble
1765if grep blurfldyick grimble >/dev/null 2>&1 ; then
1766 contains=contains
1767elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1768 contains=grep
1769else
1770 contains=contains
1771fi
1772rm -f grimble
1773: the following should work in any shell
1774case "$contains" in
1775contains*)
1776 echo " "
1777 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1778 cat >contains <<'EOSS'
1779grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1780EOSS
1781chmod +x contains
1782esac
1783
dfe9444c
AD
1784: Find the path to the source tree
1785case "$src" in
1786'') case "$0" in
b233458b
JH
1787 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1788 case "$src" in
1789 /*) ;;
8504afb7 1790 .) ;;
b233458b
JH
1791 *) src=`cd ../$src && pwd` ;;
1792 esac
1793 ;;
dfe9444c
AD
1794 *) src='.';;
1795 esac;;
1796esac
1797case "$src" in
1798'') src=/
1799 rsrc=/
1800 ;;
34f1896b
MB
1801/*) rsrc="$src";;
1802*) rsrc="../$src";;
dfe9444c
AD
1803esac
1804if test -f $rsrc/Configure && \
34f1896b 1805 $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
dfe9444c
AD
1806then
1807 : found it, so we are ok.
1808else
1809 rsrc=''
1810 for src in . .. ../.. ../../.. ../../../..; do
1811 if test -f ../$src/Configure && \
1812 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1813 then
1814 rsrc=../$src
1815 break
1816 fi
1817 done
1818fi
1819case "$rsrc" in
1820'')
1821 cat <<EOM >&4
1822
1823Sorry, I can't seem to locate the source dir for $package. Please start
1824Configure with an explicit path -- i.e. /some/path/Configure.
1825
1826EOM
1827 exit 1
1828 ;;
1829../.) rsrc='..';;
1830*)
1831 echo " "
1832 echo "Sources for $package found in \"$src\"." >&4
1833 ;;
1834esac
1835
1836: script used to extract .SH files with variable substitutions
1837cat >extract <<'EOS'
a02608de 1838PERL_CONFIG_SH=true
dfe9444c 1839echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1840if test -f MANIFEST; then
1841 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1842else
1843 echo "(Looking for .SH files under the source directory.)"
6904989c 1844 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1845fi
1846shift
1847case $# in
6904989c 18480) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1849esac
6904989c 1850if test ! -f "$src/$1"; then
dfe9444c
AD
1851 shift
1852fi
1853mkdir_p='
1854name=$1;
1855create="";
1856while test $name; do
1857 if test ! -d "$name"; then
1858 create="$name $create";
1859 name=`echo $name | sed -e "s|^[^/]*$||"`;
1860 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1861 else
1862 name="";
1863 fi;
1864done;
1865for file in $create; do
1866 mkdir $file;
1867done
1868'
1869for file in $*; do
1870 case "$src" in
1871 ".")
1872 case "$file" in
1873 */*)
1874 dir=`expr X$file : 'X\(.*\)/'`
1875 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1876 (cd "$dir" && . ./$file)
dfe9444c
AD
1877 ;;
1878 *)
1879 . ./$file
1880 ;;
1881 esac
1882 ;;
1883 *)
1884 case "$file" in
1885 */*)
1886 dir=`expr X$file : 'X\(.*\)/'`
1887 file=`expr X$file : 'X.*/\(.*\)'`
1888 (set x $dir; shift; eval $mkdir_p)
6904989c 1889 sh <"$src/$dir/$file"
dfe9444c
AD
1890 ;;
1891 *)
6904989c 1892 sh <"$src/$file"
dfe9444c
AD
1893 ;;
1894 esac
1895 ;;
1896 esac
1897done
6904989c 1898if test -f "$src/config_h.SH"; then
dfe9444c
AD
1899 if test ! -f config.h; then
1900 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1901 . "$src/config_h.SH"
dfe9444c
AD
1902 fi
1903fi
1904EOS
1905
1906: extract files and exit if asked to do so
1907case "$extractsh" in
1908true)
1909 case "$realsilent" in
1910 true) ;;
1911 *) exec 1>&4;;
1912 esac
1913 case "$config_sh" in
1914 '') config_sh='config.sh';;
1915 esac
1916 echo " "
1917 echo "Fetching answers from $config_sh..."
1918 cd ..
1919 . $config_sh
1920 test "$override" && . ./optdef.sh
1921 echo " "
1922 . UU/extract
1923 rm -rf UU
24ccb310 1924 echo "Extraction done."
dfe9444c
AD
1925 exit 0
1926 ;;
1927esac
1928
1929: Eunice requires " " instead of "", can you believe it
1930echo " "
1931: Here we go...
1932echo "Beginning of configuration questions for $package."
1933
1934trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1935
2304df62
AD
1936: first determine how to suppress newline on echo command
1937echo " "
1938echo "Checking echo to see how to suppress newlines..."
1939(echo "hi there\c" ; echo " ") >.echotmp
1940if $contains c .echotmp >/dev/null 2>&1 ; then
1941 echo "...using -n."
1942 n='-n'
1943 c=''
1944else
1945 cat <<'EOM'
1946...using \c
1947EOM
1948 n=''
1949 c='\c'
1950fi
1951echo $n "The star should be here-->$c"
1952echo '*'
1953rm -f .echotmp
1954
1955: Now test for existence of everything in MANIFEST
1956echo " "
6904989c 1957if test -f "$rsrc/MANIFEST"; then
2304df62 1958 echo "First let's make sure your kit is complete. Checking..." >&4
1d8eaf8c 1959 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
776a38e3 1960 (split -l 50 2>/dev/null || split -50)
2304df62 1961 rm -f missing
dfe9444c 1962 tmppwd=`pwd`
2304df62 1963 for filelist in x??; do
776a38e3
MB
1964 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1965 >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1966 done
1967 if test -s missing; then
1968 cat missing >&4
1969 cat >&4 <<'EOM'
1970
1971THIS PACKAGE SEEMS TO BE INCOMPLETE.
1972
1973You have the option of continuing the configuration process, despite the
1974distinct possibility that your kit is damaged, by typing 'y'es. If you
1975do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1976and contact the author (perlbug@perl.org).
2304df62
AD
1977
1978EOM
1979 echo $n "Continue? [n] $c" >&4
1980 read ans
1981 case "$ans" in
1982 y*)
1983 echo "Continuing..." >&4
1984 rm -f missing
1985 ;;
1986 *)
1987 echo "ABORTING..." >&4
1988 kill $$
1989 ;;
1990 esac
1991 else
dfe9444c 1992 echo "Looks good..."
2304df62
AD
1993 fi
1994else
1995 echo "There is no MANIFEST file. I hope your kit is complete !"
1996fi
1997rm -f missing x??
1998
5ff3f7a4 1999: Find the appropriate value for a newline for tr
613d6c3e 2000echo " "
5ff3f7a4
GS
2001if test -n "$DJGPP"; then
2002 trnl='\012'
2003fi
2004if test X"$trnl" = X; then
2005 case "`echo foo|tr '\n' x 2>/dev/null`" in
2006 foox) trnl='\n' ;;
2007 esac
2008fi
2009if test X"$trnl" = X; then
2010 case "`echo foo|tr '\012' x 2>/dev/null`" in
2011 foox) trnl='\012' ;;
2012 esac
2013fi
2014if test X"$trnl" = X; then
8be2c24c
JH
2015 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2016 fooxy) trnl='\n\r' ;;
2017 esac
2018fi
2019if test X"$trnl" = X; then
5ff3f7a4
GS
2020 cat <<EOM >&2
2021
2022$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2023
2024EOM
2025 exit 1
2026fi
2027
2304df62
AD
2028: compute the number of columns on the terminal for proper question formatting
2029case "$COLUMNS" in
2030'') COLUMNS='80';;
2031esac
2032
2033: set up the echo used in my read
2034myecho="case \"\$xxxm\" in
2035'') echo $n \"\$rp $c\" >&4;;
2036*) case \"\$rp\" in
2037 '') echo $n \"[\$xxxm] $c\";;
2038 *)
2039 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
2040 echo \"\$rp\" >&4
2041 echo $n \"[\$xxxm] $c\" >&4
2042 else
2043 echo $n \"\$rp [\$xxxm] $c\" >&4
2044 fi
2045 ;;
2046 esac;;
2047esac"
2048
2049: now set up to do reads with possible shell escape and default assignment
2050cat <<EOSC >myread
28757baa 2051$startsh
2304df62
AD
2052xxxm=\$dflt
2053$myecho
2054ans='!'
2055case "\$fastread" in
2056yes) case "\$dflt" in
2057 '') ;;
2058 *) ans='';
2059 case "\$silent-\$rp" in
2060 true-) ;;
2061 *) echo " " >&4;;
2062 esac;;
2063 esac;;
2064*) case "\$silent" in
2065 true) case "\$rp" in
2066 '') ans='';;
2067 esac;;
2068 esac;;
2069esac
2070while expr "X\$ans" : "X!" >/dev/null; do
2071 read answ
2072 set x \$xxxm
2073 shift
dfe9444c 2074 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 2075 case "\$answ" in
dfe9444c
AD
2076 "!")
2077 sh 1>&4
2078 echo " "
2079 $myecho
2080 ;;
2081 !*)
2082 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2083 shift
2084 sh 1>&4 -c "\$*"
2085 echo " "
2086 $myecho
2087 ;;
2304df62
AD
2088 "\$ans")
2089 case "\$ans" in
ecfc5424
AD
2090 \\&*)
2091 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2092 shift
2093 case "\$1" in
2094 -d)
2095 fastread=yes
40a7a20a 2096 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2097 ;;
2098 -*)
40a7a20a 2099 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2100 ;;
2101 esac
2102 $myecho
2103 ans=!
2104 ;;
2304df62
AD
2105 esac;;
2106 *)
2107 case "\$aok" in
2108 y)
2109 echo "*** Substitution done -- please confirm."
2110 xxxm="\$ans"
c9795ab7 2111 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2112 xxxm="\$ans"
2113 ans=!
2114 ;;
2115 *)
2116 echo "*** Error -- try again."
2117 ans=!
2118 ;;
2119 esac
2120 $myecho
2121 ;;
2122 esac
2123 case "\$ans\$xxxm\$nostick" in
2124 '')
2125 ans=!
2126 $myecho
2127 ;;
2128 esac
2129done
2130case "\$ans" in
2131'') ans="\$xxxm";;
2132esac
2133EOSC
2134
2135: create .config dir to save info across Configure sessions
2136test -d ../.config || mkdir ../.config
2137cat >../.config/README <<EOF
2138This directory created by Configure to save information that should
dfe9444c 2139persist across sessions for $package.
2304df62
AD
2140
2141You may safely delete it if you wish.
2142EOF
2143
613d6c3e 2144: See if we are using a devel version and want that
9507cadf 2145xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2146case "$usedevel" in
1be1b388
MB
2147$define|true|[yY]*)
2148 usedevel="$define" ;;
9507cadf 2149*) case "$xversion" in
0107c034
JH
2150 *[13579])
2151 cat >&4 <<EOH
2152*** WHOA THERE!!! ***
2153
2154 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2155 The version of this $package distribution is $xversion, that is, odd,
2156 (as opposed to even) and that signifies a development release.
3d5d58b1 2157 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2158
2159 Do ***NOT*** install this into production use.
2160 Data corruption and crashes are possible.
2161
2162 It is most seriously suggested that you do not continue any further
2163 unless you want to help in developing and debugging Perl.
2164
6adc6a45
JH
2165 If you *still* want to build perl, you can answer 'y' now,
2166 or pass -Dusedevel to Configure.
2167
0107c034
JH
2168EOH
2169 rp='Do you really want to continue?'
2170 dflt='n'
2171 . ./myread
2172 case "$ans" in
8feeef0e
JH
2173 [yY]) echo >&4 "Okay, continuing."
2174 usedevel="$define" ;;
0107c034
JH
2175 *) echo >&4 "Okay, bye."
2176 exit 1
2177 ;;
2178 esac
2179 ;;
2180 esac
1be1b388 2181 usedevel="$undef"
0107c034
JH
2182 ;;
2183esac
8feeef0e
JH
2184case "$usedevel" in
2185$define|true|[yY]*)
2186 case "$versiononly" in
2187 '') versiononly="$define" ;;
2188 esac
2189 case "$installusrbinperl" in
2190 '') installusrbinperl="$undef" ;;
2191 esac
2192 ;;
2193esac
0107c034 2194
2304df62
AD
2195: general instructions
2196needman=true
2197firsttime=true
760ac839 2198user=`(logname) 2>/dev/null`
dfe9444c
AD
2199case "$user" in
2200'') user=`whoami 2>&1`;;
760ac839 2201esac
2304df62
AD
2202if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2203 firsttime=false
2204 echo " "
2205 rp='Would you like to see the instructions?'
2206 dflt=n
2207 . ./myread
2208 case "$ans" in
2209 [yY]*) ;;
2210 *) needman=false;;
2211 esac
2212fi
2213if $needman; then
2214 cat <<EOH
4e2a5f63 2215
2304df62 2216This installation shell script will examine your system and ask you questions
a0d0e21e 2217to determine how the perl5 package should be installed. If you get
2304df62
AD
2218stuck on a question, you may use a ! shell escape to start a subshell or
2219execute a command. Many of the questions will have default answers in square
2220brackets; typing carriage return will give you the default.
2221
2222On some of the questions which ask for file or directory names you are allowed
2223to use the ~name construct to specify the login directory belonging to "name",
2224even if you don't have a shell which knows about that. Questions where this is
2225allowed will be marked "(~name ok)".
2226
2227EOH
2228 rp=''
2229 dflt='Type carriage return to continue'
2230 . ./myread
2231 cat <<'EOH'
2232
2233The prompter used in this script allows you to use shell variables and
2234backticks in your answers. You may use $1, $2, etc... to refer to the words
2235in the default answer, as if the default line was a set of arguments given to a
2236script shell. This means you may also use $* to repeat the whole default line,
2237so you do not have to re-type everything to add something to the default.
2238
2239Everytime there is a substitution, you will have to confirm. If there is an
2240error (e.g. an unmatched backtick), the default answer will remain unchanged
2241and you will be prompted again.
2242
2243If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2244the questions and use the computed defaults (or the previous answers if there
2245was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2246You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2247on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2248
2249EOH
2250 . ./myread
2251 cat <<EOH
2252
2253Much effort has been expended to ensure that this shell script will run on any
2254Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2255Configure and run it again. If you can't run Configure for some reason,
2256you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2257have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2258
2259This installation script affects things in two ways:
2260
22611) it may do direct variable substitutions on some of the files included
2262 in this kit.
22632) it builds a config.h file for inclusion in C programs. You may edit
2264 any of these files as the need arises after running this script.
2265
2266If you make a mistake on a question, there is no easy way to back up to it
2267currently. The easiest thing to do is to edit config.sh and rerun all the SH
2268files. Configure will offer to let you do this before it runs the SH files.
2269
2270EOH
2271 dflt='Type carriage return to continue'
2272 . ./myread
2273 case "$firsttime" in
2274 true) echo $user >>../.config/instruct;;
2275 esac
2276fi
2277
2304df62
AD
2278: find out where common programs are
2279echo " "
2280echo "Locating common programs..." >&4
2281cat <<EOSC >loc
2282$startsh
2283case \$# in
22840) exit 1;;
2285esac
2286thing=\$1
2287shift
2288dflt=\$1
2289shift
2290for dir in \$*; do
2291 case "\$thing" in
2292 .)
2293 if test -d \$dir/\$thing; then
2294 echo \$dir
2295 exit 0
2296 fi
2297 ;;
2298 *)
a0d0e21e 2299 for thisthing in \$dir/\$thing; do
ecfc5424 2300 : just loop through to pick last item
a0d0e21e 2301 done
25f94b33 2302 if test -f \$thisthing; then
a0d0e21e 2303 echo \$thisthing
2304df62 2304 exit 0
a5a94ea5
JH
2305 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2306 echo \$thisthing
776a38e3 2307 exit 0
2304df62 2308 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2309 if test -n "$DJGPP"; then
2310 echo \$dir/\$thing.exe
b921d661 2311 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2312 : on Eunice apparently
2313 echo \$dir/\$thing
2314 fi
2d736872 2315 exit 0
2304df62
AD
2316 fi
2317 ;;
2318 esac
2319done
2320echo \$dflt
2321exit 1
2322EOSC
2323chmod +x loc
2324$eunicefix loc
2325loclist="
2326awk
2327cat
f8006fac 2328chmod
b4eb6b3d
JH
2329comm
2330cp
2304df62
AD
2331echo
2332expr
2333grep
a0d0e21e 2334ls
b4eb6b3d 2335mkdir
2304df62
AD
2336rm
2337sed
b4eb6b3d 2338sort
85e6fe83 2339touch
2304df62 2340tr
b4eb6b3d 2341uniq
2304df62
AD
2342"
2343trylist="
dfe9444c 2344ar
3659ebf1 2345bison
b4eb6b3d 2346byacc
2304df62 2347cpp
b4eb6b3d 2348csh
2304df62
AD
2349date
2350egrep
1fef16b3 2351gmake
8ff267be 2352gzip
b4eb6b3d 2353less
8ff267be 2354ln
3c728e00 2355make
b4eb6b3d 2356more
693762b4 2357nm
b4eb6b3d
JH
2358nroff
2359pg
2304df62
AD
2360test
2361uname
8ff267be 2362zip
2304df62 2363"
8e07c86e 2364pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2365pth="$pth /lib /usr/lib"
2366for file in $loclist; do
dfe9444c
AD
2367 eval xxx=\$$file
2368 case "$xxx" in
2369 /*|?:[\\/]*)
2370 if test -f "$xxx"; then
2371 : ok
2372 else
2373 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2374 xxx=`./loc $file $file $pth`
2375 fi
2376 ;;
2377 '') xxx=`./loc $file $file $pth`;;
2378 *) xxx=`./loc $xxx $xxx $pth`;;
2379 esac
a5a94ea5 2380 eval $file=$xxx$_exe
2304df62
AD
2381 eval _$file=$xxx
2382 case "$xxx" in
2383 /*)
2384 echo $file is in $xxx.
2385 ;;
8e07c86e
AD
2386 ?:[\\/]*)
2387 echo $file is in $xxx.
2388 ;;
2304df62 2389 *)
25f94b33
AD
2390 echo "I don't know where '$file' is, and my life depends on it." >&4
2391 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2392 exit 1
2304df62
AD
2393 ;;
2394 esac
2395done
2396echo " "
2397echo "Don't worry if any of the following aren't found..."
2398say=offhand
2399for file in $trylist; do
dfe9444c
AD
2400 eval xxx=\$$file
2401 case "$xxx" in
2402 /*|?:[\\/]*)
2403 if test -f "$xxx"; then
2404 : ok
2405 else
2406 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2407 xxx=`./loc $file $file $pth`
2408 fi
2409 ;;
2410 '') xxx=`./loc $file $file $pth`;;
2411 *) xxx=`./loc $xxx $xxx $pth`;;
2412 esac
306a8474 2413 eval $file=$xxx$_exe
2304df62
AD
2414 eval _$file=$xxx
2415 case "$xxx" in
2416 /*)
2417 echo $file is in $xxx.
2418 ;;
8e07c86e
AD
2419 ?:[\\/]*)
2420 echo $file is in $xxx.
2421 ;;
2304df62
AD
2422 *)
2423 echo "I don't see $file out there, $say."
2424 say=either
2425 ;;
2426 esac
2427done
2428case "$egrep" in
1fef16b3 2429egrep)
2304df62
AD
2430 echo "Substituting grep for egrep."
2431 egrep=$grep
868439a2 2432 _egrep=$grep
2304df62
AD
2433 ;;
2434esac
8ff267be 2435case "$ln" in
1fef16b3 2436ln)
8ff267be 2437 echo "Substituting cp for ln."
2438 ln=$cp
868439a2 2439 _ln=$cp
8ff267be 2440 ;;
2441esac
2e26f1d5 2442case "$make" in
613d6c3e 2443make)
2e26f1d5
JH
2444 case "$gmake" in
2445 gmake)
2446 echo "I can't find make or gmake, and my life depends on it." >&4
2447 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2448 exit 1
2449 ;;
2450 esac
2451 ;;
613d6c3e 2452esac
2e26f1d5
JH
2453case "$gmake" in
2454gmake) ;;
2455*) # We can't have osname yet.
1fef16b3
JH
2456 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2457 # Assume that gmake, if found, is definitely GNU make
2458 # and prefer it over the system make.
2459 echo "Substituting gmake for make."
2460 make=$gmake
868439a2 2461 _make=$gmake
1fef16b3
JH
2462 fi
2463 ;;
a5a94ea5 2464esac
2304df62
AD
2465case "$test" in
2466test)
2467 echo "Hopefully test is built into your sh."
2468 ;;
2469*)
73614538 2470 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2471 echo "Using the test built into your sh."
2304df62
AD
2472 test=test
2473 _test=test
2474 fi
2475 ;;
2476esac
2477case "$echo" in
2478echo)
2479 echo "Hopefully echo is built into your sh."
2480 ;;
2481'') ;;
2482*)
2483 echo " "
2484echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2485 $echo $n "hi there$c" >foo1
2486 echo $n "hi there$c" >foo2
2487 if cmp foo1 foo2 >/dev/null 2>&1; then
2488 echo "They are compatible. In fact, they may be identical."
2489 else
2490 case "$n" in
2491 '-n') n='' c='\c';;
2492 *) n='-n' c='';;
2493 esac
2494 cat <<FOO
2495They are not compatible! You are probably running ksh on a non-USG system.
2496I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2497have echo built in and we may have to run some Bourne shell scripts. That
2498means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2499
2500FOO
2501 $echo $n "The star should be here-->$c"
2502 $echo "*"
2503 fi
2504 $rm -f foo1 foo2
2505 ;;
2506esac
2507
2f88d857
MB
2508# This question was auctioned at YAPC::Europe-2007 in Vienna
2509# I never promised you could answer it. I only auctioned the question.
2510cat <<FOO
2511The following message is sponsored by
2512
2513 Dresden.pm<--The stars should be here.
2514
2515Dear Perl user, system administrator or package
2516maintainer, the Perl community sends greetings to
2517you. Do you (emblematical) greet back [Y/n]? n
2518
2519FOO
2520
613d6c3e 2521: Check what type of C compiler we use
6b769f8f 2522cat <<EOS >trygcc
2573c5f9
JH
2523$startsh
2524EOS
6b769f8f 2525cat <<'EOSC' >>trygcc
2573c5f9
JH
2526case "$cc" in
2527'') ;;
2528*) $rm -f try try.*
2529 $cat >try.c <<EOM
2530int main(int argc, char *argv[]) {
2531 return 0;
2532}
2533EOM
e4778687 2534 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2535 :
2536 else
2537 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2538 despair=yes
2539 trygcc=yes
2540 case "$cc" in
2541 *gcc*) trygcc=no ;;
2542 esac
dce40316
AD
2543 # Skip this test because it gives a false match on output like:
2544 # ./trygcc: line 23: cc: command not found
2545 # case "`$cc -v -c try.c 2>&1`" in
2546 # *gcc*) trygcc=no ;;
2547 # esac
2573c5f9
JH
2548 if $test X"$trygcc" = Xyes; then
2549 if gcc -o try -c try.c; then
2550 echo " "
2551 echo "You seem to have a working gcc, though." >&4
dce40316
AD
2552 # Switching compilers may undo the work of hints files.
2553 # The most common problem is -D_REENTRANT for threads.
2554 # This heuristic catches that case, but gets false positives
2555 # if -Dusethreads was not actually specified. Better to
2556 # bail out here with a useful message than fail
2557 # mysteriously later. Should we perhaps just try to
2558 # re-invoke Configure -Dcc=gcc config_args ?
2559 if $test -f usethreads.cbu; then
2560 $cat >&4 <<EOM
2561
2562*** However, any setting of the C compiler flags (e.g. for thread support)
2563*** will be lost. It may be necessary for you to restart Configure and
2564*** add -Dcc=gcc to your Configure command line.
2565
2566EOM
2567 rp="Would you like to go ahead and try gcc anyway?"
2568 dflt=n
2569 else
2570 rp="Would you like to use it?"
2571 dflt=y
2572 fi
2573c5f9
JH
2573 if $test -f myread; then
2574 . ./myread
2575 else
2576 if $test -f UU/myread; then
2577 . ./UU/myread
2578 else
2579 echo "Cannot find myread, sorry. Aborting." >&2
2580 exit 1
2581 fi
2582 fi
2583 case "$ans" in
6371411c 2584 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2573c5f9
JH
2585 esac
2586 fi
2587 fi
6b769f8f
RB
2588 fi
2589 $rm -f try try.*
2590 ;;
2591esac
2592EOSC
2593
2594cat <<EOS >checkcc
2595$startsh
2596EOS
2597cat <<'EOSC' >>checkcc
2598case "$cc" in
2599'') ;;
2600*) $rm -f try try.*
2601 $cat >try.c <<EOM
2602int main(int argc, char *argv[]) {
2603 return 0;
2604}
2605EOM
2606 if $cc -o try $ccflags $ldflags try.c; then
2607 :
2608 else
2573c5f9 2609 if $test X"$despair" = Xyes; then
6b769f8f
RB
2610 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2611 fi
2612 $cat >&4 <<EOM
5dd4fbdf
MB
2613You need to find a working C compiler.
2614Either (purchase and) install the C compiler supplied by your OS vendor,
2615or for a free C compiler try http://gcc.gnu.org/
2616I cannot continue any further, aborting.
2617EOM
6b769f8f 2618 exit 1
2573c5f9
JH
2619 fi
2620 $rm -f try try.*
2621 ;;
2622esac
2623EOSC
2624
a0d0e21e
LW
2625: determine whether symbolic links are supported
2626echo " "
2627$touch blurfl
2628if $ln -s blurfl sym > /dev/null 2>&1 ; then
2629 echo "Symbolic links are supported." >&4
818f00be 2630 lns="$ln -s"
a0d0e21e
LW
2631else
2632 echo "Symbolic links are NOT supported." >&4
2633 lns="$ln"
2634fi
2635$rm -f blurfl sym
2636
dafca956
JH
2637: determine whether symbolic links are supported
2638echo " "
2639case "$lns" in
18ea2752 2640*"ln"*" -s")
dafca956
JH
2641 echo "Checking how to test for symbolic links..." >&4
2642 $lns blurfl sym
4b661809 2643 if $test "X$issymlink" = X; then
2e2a97a6
JH
2644 case "$newsh" in
2645 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2646 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2647 esac
5d644a95
MB
2648 if test $? = 0; then
2649 issymlink="test -h"
2e2a97a6
JH
2650 else
2651 echo "Your builtin 'test -h' may be broken." >&4
2652 case "$test" in
2653 /*) ;;
2654 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2655 for p in $pth
2656 do
2657 if test -f "$p/$test"; then
2658 test="$p/$test"
2659 break
2660 fi
2661 done
2662 ;;
2663 esac
2664 case "$test" in
2665 /*)
2666 echo "Trying external '$test -h'." >&4
2667 issymlink="$test -h"
2668 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2669 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2670 issymlink=''
2671 fi
2672 ;;
2673 *) issymlink='' ;;
2674 esac
5d644a95
MB
2675 fi
2676 fi
4b661809 2677 if $test "X$issymlink" = X; then
dafca956 2678 if $test -L sym 2>/dev/null; then
5d644a95 2679 issymlink="$test -L"
2e2a97a6 2680 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2681 fi
2682 fi
4b661809 2683 if $test "X$issymlink" != X; then
5d644a95 2684 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2685 else
2686 echo "I do not know how you can test for symbolic links." >&4
2687 fi
2688 $rm -f blurfl sym
2689 ;;
2690*) echo "No symbolic links, so not testing for their testing..." >&4
2691 ;;
2692esac
2693echo " "
2694
34f1896b 2695: Make symlinks util
dafca956
JH
2696case "$mksymlinks" in
2697$define|true|[yY]*)
2698 case "$src" in
2699 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2700 exit 1
2701 ;;
4b661809 2702 *) case "$lns:$issymlink" in
f314eb9f 2703 *"ln"*" -s:"*"test -"?)
dafca956
JH
2704 echo "Creating the symbolic links..." >&4
2705 echo "(First creating the subdirectories...)" >&4
2706 cd ..
2707 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2708 read directory
2709 test -z "$directory" && break
2710 mkdir -p $directory
2711 done
2712 # Sanity check 1.
2713 if test ! -d t/base; then
2714 echo "Failed to create the subdirectories. Aborting." >&4
2715 exit 1
2716 fi
2717 echo "(Then creating the symlinks...)" >&4
2718 awk '{print $1}' $src/MANIFEST | while true; do
2719 read filename
2720 test -z "$filename" && break
2721 if test -f $filename; then
5d644a95 2722 if $issymlink $filename; then
dafca956
JH
2723 rm -f $filename
2724 fi
2725 fi
2726 if test -f $filename; then
2727 echo "$filename already exists, not symlinking."
2728 else
2729 ln -s $src/$filename $filename
2730 fi
2731 done
2732 # Sanity check 2.
a0d24b8a
JH
2733 if test ! -f t/base/lex.t; then
2734 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2735 exit 1
2736 fi
2737 cd UU
2738 ;;
2739 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2740 ;;
2741 esac
2742 ;;
2743 esac
2744 ;;
2745esac
2746
613d6c3e 2747: Check for Cross-Compilation
5440bc8e
JH
2748case "$usecrosscompile" in
2749$define|true|[yY]*)
93bc48fa 2750 $echo "Cross-compiling..."
5440bc8e
JH
2751 croak=''
2752 case "$cc" in
2753 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2754 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2755 ar=$targetarch-ar
2756 # leave out ld, choosing it is more complex
2757 nm=$targetarch-nm
2758 ranlib=$targetarch-ranlib
93bc48fa 2759 $echo 'extern int foo;' > try.c
f8006fac 2760 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2761 shift
2762 if $test $# -gt 0; then
2763 incpth="$incpth $*"
f8006fac
JH
2764 incpth="`$echo $incpth|$sed 's/^ //'`"
2765 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2766 for i in $*; do
f8006fac 2767 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2768 if $test -d $j; then
2769 libpth="$libpth $j"
2770 fi
2771 done
f8006fac
JH
2772 libpth="`$echo $libpth|$sed 's/^ //'`"
2773 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2774 fi
2775 $rm -f try.c
5440bc8e
JH
2776 ;;
2777 esac
2778 case "$targetarch" in
93bc48fa
JH
2779 '') echo "Targetarch not defined." >&4; croak=y ;;
2780 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2781 esac
2782 case "$incpth" in
93bc48fa 2783 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2784 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2785 esac
2786 case "$libpth" in
93bc48fa 2787 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2788 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2789 esac
93bc48fa
JH
2790 case "$usrinc" in
2791 '') for i in $incpth; do
2792 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2793 usrinc=$i
2794 echo "Guessing usrinc $usrinc." >&4
2795 break
2796 fi
2797 done
2798 case "$usrinc" in
2799 '') echo "Usrinc not defined." >&4; croak=y ;;
2800 esac
2801 ;;
2802 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2803 esac
93bc48fa
JH
2804 case "$targethost" in
2805 '') echo "Targethost not defined." >&4; croak=y ;;
2806 *) echo "Using targethost $targethost." >&4
5440bc8e 2807 esac
93bc48fa
JH
2808 locincpth=' '
2809 loclibpth=' '
5440bc8e 2810 case "$croak" in
93bc48fa 2811 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2812 esac
2813 case "$src" in
2814 /*) run=$src/Cross/run
93c0359c 2815 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2816 to=$src/Cross/to
2817 from=$src/Cross/from
2818 ;;
93bc48fa 2819 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2820 run=$pwd/Cross/run
f8006fac 2821 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2822 to=$pwd/Cross/to
2823 from=$pwd/Cross/from
2824 ;;
2825 esac
2826 case "$targetrun" in
2827 '') targetrun=ssh ;;
2828 esac
2829 case "$targetto" in
2830 '') targetto=scp ;;
2831 esac
2832 case "$targetfrom" in
2833 '') targetfrom=scp ;;
2834 esac
2835 run=$run-$targetrun
2836 to=$to-$targetto
2837 from=$from-$targetfrom
93bc48fa
JH
2838 case "$targetdir" in
2839 '') targetdir=/tmp
2840 echo "Guessing targetdir $targetdir." >&4
2841 ;;
2842 esac
5440bc8e 2843 case "$targetuser" in
93bc48fa
JH
2844 '') targetuser=root
2845 echo "Guessing targetuser $targetuser." >&4
2846 ;;
5440bc8e
JH
2847 esac
2848 case "$targetfrom" in
2849 scp) q=-q ;;
2850 *) q='' ;;
2851 esac
2852 case "$targetrun" in
2853 ssh|rsh)
2854 cat >$run <<EOF
2855#!/bin/sh
93c0359c
JH
2856case "\$1" in
2857-cwd)
2858 shift
2859 cwd=\$1
2860 shift
2861 ;;
2862esac
2863case "\$cwd" in
2864'') cwd=$targetdir ;;
2865esac
5440bc8e
JH
2866exe=\$1
2867shift
93c0359c
JH
2868if $test ! -f \$exe.xok; then
2869 $to \$exe
2870 $touch \$exe.xok
2871fi
2872$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2873EOF
2874 ;;
93bc48fa 2875 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2876 exit 1
2877 ;;
2878 esac
93c0359c
JH
2879 case "$targetmkdir" in
2880 */Cross/mkdir)
2881 cat >$targetmkdir <<EOF
2882#!/bin/sh
2883$targetrun -l $targetuser $targethost "mkdir -p \$@"
2884EOF
f8006fac 2885 $chmod a+rx $targetmkdir
93c0359c
JH
2886 ;;
2887 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2888 exit 1
2889 ;;
2890 esac
5440bc8e
JH
2891 case "$targetto" in
2892 scp|rcp)
2893 cat >$to <<EOF
2894#!/bin/sh
2895for f in \$@
2896do
93c0359c
JH
2897 case "\$f" in
2898 /*)
2899 $targetmkdir \`dirname \$f\`
2900 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2901 ;;
2902 *)
2903 $targetmkdir $targetdir/\`dirname \$f\`
2904 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2905 ;;
2906 esac
5440bc8e
JH
2907done
2908exit 0
2909EOF
2910 ;;
2911 cp) cat >$to <<EOF
2912#!/bin/sh
93c0359c
JH
2913for f in \$@
2914do
2915 case "\$f" in
2916 /*)
2917 $mkdir -p $targetdir/\`dirname \$f\`
2918 $cp \$f $targetdir/\$f || exit 1
2919 ;;
2920 *)
2921 $targetmkdir $targetdir/\`dirname \$f\`
2922 $cp \$f $targetdir/\$f || exit 1
2923 ;;
2924 esac
2925done
2926exit 0
5440bc8e
JH
2927EOF
2928 ;;
93bc48fa 2929 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2930 exit 1
2931 ;;
2932 esac
2933 case "$targetfrom" in
2934 scp|rcp)
2935 cat >$from <<EOF
2936#!/bin/sh
2937for f in \$@
2938do
93c0359c 2939 $rm -f \$f
5440bc8e
JH
2940 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2941done
2942exit 0
2943EOF
2944 ;;
2945 cp) cat >$from <<EOF
2946#!/bin/sh
2947for f in \$@
2948do
93c0359c 2949 $rm -f \$f
5440bc8e
JH
2950 cp $targetdir/\$f . || exit 1
2951done
2952exit 0
2953EOF
2954 ;;
93bc48fa 2955 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2956 exit 1
2957 ;;
2958 esac
93bc48fa
JH
2959 if $test ! -f $run; then
2960 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2961 else
f8006fac 2962 $chmod a+rx $run
5440bc8e 2963 fi
93bc48fa
JH
2964 if $test ! -f $to; then
2965 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2966 else
f8006fac 2967 $chmod a+rx $to
5440bc8e 2968 fi
93bc48fa
JH
2969 if $test ! -f $from; then
2970 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2971 else
f8006fac 2972 $chmod a+rx $from
5440bc8e 2973 fi
93bc48fa 2974 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2975 exit 1
2976 fi
2977 cat >&4 <<EOF
f8006fac
JH
2978Using '$run' for remote execution,
2979and '$from' and '$to'
93bc48fa 2980for remote file transfer.
5440bc8e
JH
2981EOF
2982 ;;
2983*) run=''
2984 to=:
2985 from=:
2986 usecrosscompile='undef'
2987 targetarch=''
2988 ;;
2989esac
2990
ecfc5424
AD
2991: see whether [:lower:] and [:upper:] are supported character classes
2992echo " "
ecfc5424
AD
2993case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2994ABYZ)
2995 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2996 up='[:upper:]'
2997 low='[:lower:]'
2998 ;;
416d0bea
MB
2999*) # There is a discontinuity in EBCDIC between 'R' and 'S'
3000 # (0xd9 and 0xe2), therefore that is a nice testing point.
3001 if test "X$up" = X -o "X$low" = X; then
3002 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3003 rs) up='[A-Z]'
3004 low='[a-z]'
28e8609d
JH
3005 ;;
3006 esac
416d0bea 3007 fi
28e8609d 3008 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3009 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3010 rs) up='A-Z'
28e8609d
JH
3011 low='a-z'
3012 ;;
3013 esac
416d0bea 3014 fi
28e8609d 3015 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3016 case "`echo RS | od -x 2>/dev/null`" in
3017 *D9E2*|*d9e2*)
28e8609d
JH
3018 echo "Hey, this might be EBCDIC." >&4
3019 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3020 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3021 rs) up='[A-IJ-RS-Z]'
3022 low='[a-ij-rs-z]'
28e8609d
JH
3023 ;;
3024 esac
3025 fi
3026 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3027 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3028 rs) up='A-IJ-RS-Z'
3029 low='a-ij-rs-z'
28e8609d
JH
3030 ;;
3031 esac
3032 fi
3033 ;;
3034 esac
3035 fi
3036esac
416d0bea
MB
3037case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3038rs)
28e8609d
JH
3039 echo "Using $up and $low to convert case." >&4
3040 ;;
ecfc5424 3041*)
28e8609d
JH
3042 echo "I don't know how to translate letters from upper to lower case." >&4
3043 echo "Your tr is not acting any way I know of." >&4
3044 exit 1
3045 ;;
ecfc5424
AD
3046esac
3047: set up the translation script tr, must be called with ./tr of course
3048cat >tr <<EOSC
3049$startsh
3050case "\$1\$2" in
3051'[A-Z][a-z]') exec $tr '$up' '$low';;
3052'[a-z][A-Z]') exec $tr '$low' '$up';;
3053esac
3054exec $tr "\$@"
3055EOSC
3056chmod +x tr
3057$eunicefix tr
3058
2304df62
AD
3059: Try to determine whether config.sh was made on this system
3060case "$config_sh" in
3061'')
43999f95
JH
3062myuname=`$uname -a 2>/dev/null`
3063$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
3064# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3065# because the A-Z/a-z are not consecutive.
34e09935 3066myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3eaeeeae 3067 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 3068newmyuname="$myuname"
2304df62 3069dflt=n
16d20bd9
AD
3070case "$knowitall" in
3071'')
3072 if test -f ../config.sh; then
3073 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3074 eval "`grep myuname= ../config.sh`"
3075 fi
3076 if test "X$myuname" = "X$newmyuname"; then
3077 dflt=y
3078 fi
2304df62 3079 fi
16d20bd9
AD
3080 ;;
3081*) dflt=y;;
3082esac
2304df62
AD
3083
3084: Get old answers from old config file if Configure was run on the
3085: same system, otherwise use the hints.
3086hint=default
3087cd ..
3088if test -f config.sh; then
16d20bd9
AD
3089 echo " "
3090 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
3091 . UU/myread
3092 case "$ans" in
f83701cd
AD
3093 n*|N*) echo "OK, I'll ignore it."
3094 mv config.sh config.sh.old
3095 myuname="$newmyuname"
3096 ;;
2304df62 3097 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
3098 tmp_n="$n"
3099 tmp_c="$c"
85cad39c 3100 tmp_sh="$sh"
2304df62
AD
3101 . ./config.sh
3102 cp config.sh UU
ecfc5424
AD
3103 n="$tmp_n"
3104 c="$tmp_c"
85cad39c 3105 : Older versions did not always set $sh. Catch re-use of such
3106 : an old config.sh.
3107 case "$sh" in
3108 '') sh="$tmp_sh" ;;
3109 esac
2304df62
AD
3110 hint=previous
3111 ;;
3112 esac
3113fi
2573c5f9 3114. ./UU/checkcc
2304df62
AD
3115if test ! -f config.sh; then
3116 $cat <<EOM
3117
4e2a5f63
AD
3118First time through, eh? I have some defaults handy for some systems
3119that need some extra help getting the Configure answers right:
2304df62
AD
3120
3121EOM
dfe9444c 3122 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3123 dflt=''
3124 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3125 : tests or hints, please send them to perlbug@perl.org
2304df62 3126 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3127 $test -f /irix && osname=irix
85e6fe83
LW
3128 $test -f /xenix && osname=sco_xenix
3129 $test -f /dynix && osname=dynix
3130 $test -f /dnix && osname=dnix
5f05dabc 3131 $test -f /lynx.os && osname=lynxos
3132 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3133 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3134 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3135 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3136 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3137 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3138 $test -d /usr/apollo/bin && osname=apollo
3139 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3140 $test -d /usr/include/minix && osname=minix
d54344fc 3141 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3142 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3143 osname=machten
4633a7c4 3144 if $test -x /sbin/version; then
dfe9444c 3145 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3146 $sed -e 's/[A-Za-z]$//'`
3147 elif $test -x /usr/etc/version; then
dfe9444c 3148 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3149 $sed -e 's/[A-Za-z]$//'`
3150 else
3151 osvers="$2.$3"
3152 fi
3153 fi
aaacdc8b
GS
3154
3155 $test -f /sys/posix.dll &&
3156 $test -f /usr/bin/what &&
3157 set X `/usr/bin/what /sys/posix.dll` &&
3158 $test "$3" = UWIN &&
3159 osname=uwin &&
3160 osvers="$5"
3161
2304df62
AD
3162 if $test -f $uname; then
3163 set X $myuname
3164 shift
3165
2304df62 3166 case "$5" in
85e6fe83 3167 fps*) osname=fps ;;
2304df62
AD
3168 mips*)
3169 case "$4" in
85e6fe83
LW
3170 umips) osname=umips ;;
3171 *) osname=mips ;;
2304df62 3172 esac;;
85e6fe83
LW
3173 [23]100) osname=mips ;;
3174 next*) osname=next ;;
ecfc5424 3175 i386*)
c6912327
JH
3176 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3177 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3178 osname='sco'
3179 osvers=$tmp
3180 elif $test -f /etc/kconfig; then
ecfc5424 3181 osname=isc
bd628c73 3182 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3183 osvers=4
3184 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3185 osvers=3
2304df62 3186 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3187 osvers=2
ecfc5424
AD
3188 fi
3189 fi
2000072c 3190 tmp=''
ecfc5424 3191 ;;
c4f23d77
AD
3192 pc*)
3193 if test -n "$DJGPP"; then
3194 osname=dos
3195 osvers=djgpp
3196 fi
3197 ;;
2304df62
AD
3198 esac
3199
3200 case "$1" in
a0d0e21e
LW
3201 aix) osname=aix
3202 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3203 case "$tmp" in
e81c5c2a
NC
3204 # oslevel can fail with:
3205 # oslevel: Unable to acquire lock.
3206 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3207 '<3240'|'<>3240') osvers=3.2.0 ;;
3208 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3209 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3210 *) osvers=$tmp;;
a0d0e21e
LW
3211 esac
3212 ;;
aaacdc8b
GS
3213 bsd386) osname=bsd386
3214 osvers=`$uname -r`
3215 ;;
3216 cygwin*) osname=cygwin
3217 osvers="$3"
3218 ;;
23f87696
SZ
3219 *dc.osx) osname=dcosx
3220 osvers="$3"
3221 ;;
a0d0e21e
LW
3222 dnix) osname=dnix
3223 osvers="$3"
3224 ;;
3225 domainos) osname=apollo
3226 osvers="$3"
3227 ;;
a774dfe6
RSG
3228 dgux) osname=dgux
3229 osvers="$3"
3230 ;;
3231 dragonfly) osname=dragonfly
a0d0e21e
LW
3232 osvers="$3"
3233 ;;
760ac839 3234 dynixptx*) osname=dynixptx
e58e581d 3235 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3236 ;;
a774dfe6 3237 freebsd) osname=freebsd
a0d0e21e 3238 osvers="$3" ;;
761ee4e8
BD
3239 genix) osname=genix ;;
3240 gnu) osname=gnu
3241 osvers="$3" ;;
a774dfe6 3242 hp*) osname=hpux
bfb7748a 3243 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3244 ;;
761ee4e8 3245 irix*) osname=irix
a0d0e21e
LW
3246 case "$3" in
3247 4*) osvers=4 ;;
3248 5*) osvers=5 ;;
ecfc5424 3249 *) osvers="$3" ;;
a0d0e21e
LW
3250 esac
3251 ;;
761ee4e8 3252 linux) osname=linux
a0d0e21e 3253 case "$3" in
a0d0e21e
LW
3254 *) osvers="$3" ;;
3255 esac
3256 ;;
761ee4e8 3257 MiNT) osname=mint
28e8609d
JH
3258 ;;
3259 netbsd*) osname=netbsd
ecfc5424
AD
3260 osvers="$3"
3261 ;;
4e81affe
MM
3262 news-os) osvers="$3"
3263 case "$3" in
3264 4*) osname=newsos4 ;;
3265 *) osname=newsos ;;
3266 esac
3267 ;;
aaacdc8b 3268 next*) osname=next ;;
28bb1e2c 3269 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3270 openbsd) osname=openbsd
3271 osvers="$3"
3272 ;;
5c728af0
IZ
3273 os2) osname=os2
3274 osvers="$4"
3275 ;;
aaacdc8b
GS
3276 POSIX-BC | posix-bc ) osname=posix-bc
3277 osvers="$3"
a0d0e21e 3278 ;;
ae3afa4e
TH
3279 powerux | power_ux | powermax_os | powermaxos | \
3280 powerunix | power_unix) osname=powerux
3281 osvers="$3"
3282 ;;
aaacdc8b
GS
3283 qnx) osname=qnx
3284 osvers="$4"
3285 ;;
a0d0e21e
LW
3286 solaris) osname=solaris
3287 case "$3" in
3288 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3289 *) osvers="$3" ;;
a0d0e21e
LW
3290 esac
3291 ;;
85e6fe83
LW
3292 sunos) osname=sunos
3293 case "$3" in
85e6fe83
LW
3294 5*) osname=solaris
3295 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3296 *) osvers="$3" ;;
2304df62
AD
3297 esac
3298 ;;
a0d0e21e 3299 titanos) osname=titanos
85e6fe83 3300 case "$3" in
a0d0e21e
LW
3301 1*) osvers=1 ;;
3302 2*) osvers=2 ;;
3303 3*) osvers=3 ;;
3304 4*) osvers=4 ;;
ecfc5424 3305 *) osvers="$3" ;;
2304df62
AD
3306 esac
3307 ;;
85e6fe83 3308 ultrix) osname=ultrix
ecfc5424 3309 osvers="$3"
2304df62 3310 ;;
28757baa 3311 osf1|mls+) case "$5" in
fed7345c
AD
3312 alpha)
3313 osname=dec_osf
fdd85a03 3314 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3315 case "$osvers" in
3316 [1-9].[0-9]*) ;;
3317 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3318 esac
ecfc5424
AD
3319 ;;
3320 hp*) osname=hp_osf1 ;;
3321 mips) osname=mips_osf1 ;;
85e6fe83
LW
3322 esac
3323 ;;
af1ff193 3324 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3325 openunix|unixware) osname=svr5
0337d152
BG
3326 osvers="$4"
3327 ;;
3c728e00 3328 uts) osname=uts
a0d0e21e
LW
3329 osvers="$3"
3330 ;;
3c728e00
JH
3331 vos) osvers="$3"
3332 ;;
85e6fe83 3333 $2) case "$osname" in
2304df62 3334 *isc*) ;;
a0d0e21e 3335 *freebsd*) ;;
5f05dabc 3336 svr*)
a0d0e21e 3337 : svr4.x or possibly later
a774dfe6 3338 case "svr$3" in
a0d0e21e
LW
3339 ${osname}*)
3340 osname=svr$3
3341 osvers=$4
3342 ;;
3343 esac
3344 case "$osname" in
3345 svr4.0)
3346 : Check for ESIX
3347 if test -f /stand/boot ; then
3348 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3349 if test -n "$INITPROG" -a -f "$INITPROG"; then
3350 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3351 if test -n "$isesix"; then
a0d0e21e
LW
3352 osname=esix4
3353 fi
3354 fi
3355 fi
3356 ;;
3357 esac
3358 ;;
2304df62 3359 *) if test -f /etc/systemid; then
a0d0e21e
LW
3360 osname=sco
3361 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3362 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3363 osvers=$1.$2.$3
c4f23d77 3364 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3365 osvers=$1.$2
c4f23d77 3366 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3367 osvers=$1
2304df62 3368 fi
a0d0e21e
LW
3369 else
3370 case "$osname" in
3371 '') : Still unknown. Probably a generic Sys V.
3372 osname="sysv"
3373 osvers="$3"
3374 ;;
3375 esac
2304df62
AD
3376 fi
3377 ;;
3378 esac
3379 ;;
a0d0e21e
LW
3380 *) case "$osname" in
3381 '') : Still unknown. Probably a generic BSD.
3382 osname="$1"
3383 osvers="$3"
3384 ;;
3385 esac
3386 ;;
2304df62
AD
3387 esac
3388 else
dfe9444c
AD
3389 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3390 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3391 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3392 osname=news_os
2304df62 3393 fi
dfe9444c 3394 $rm -f UU/kernel.what
5c728af0 3395 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3396 set X $myuname
3397 osname=os2
3398 osvers="$5"
2304df62
AD
3399 fi
3400 fi
a774dfe6 3401
5440bc8e
JH
3402 case "$targetarch" in
3403 '') ;;
3404 *) hostarch=$osname
3405 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3406 osvers=''
3407 ;;
3408 esac
3409
a0d0e21e
LW
3410 : Now look for a hint file osname_osvers, unless one has been
3411 : specified already.
3412 case "$hintfile" in
3413 ''|' ')
1e127011 3414 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3415 : Also try without trailing minor version numbers.
1e127011
DD
3416 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3417 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3418 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3419 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3420 case "$file" in
3421 '') dflt=none ;;
3422 *) case "$osvers" in
3423 '') dflt=$file
3424 ;;
dfe9444c 3425 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3426 dflt=$file
dfe9444c 3427 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3428 dflt=$xfile
dfe9444c 3429 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3430 dflt=$xxfile
dfe9444c 3431 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3432 dflt=$xxxfile
dfe9444c 3433 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3434 dflt=$xxxxfile
dfe9444c 3435 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3436 dflt="${osname}"
3437 else
3438 dflt=none
3439 fi
3440 ;;
3441 esac
85e6fe83
LW
3442 ;;
3443 esac
4e2a5f63
AD
3444 if $test -f Policy.sh ; then
3445 case "$dflt" in
3446 *Policy*) ;;
3447 none) dflt="Policy" ;;
3448 *) dflt="Policy $dflt" ;;
3449 esac
3450 fi
85e6fe83 3451 ;;
a0d0e21e 3452 *)
ecfc5424 3453 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3454 ;;
2304df62 3455 esac
1aef975c 3456
4e2a5f63
AD
3457 if $test -f Policy.sh ; then
3458 $cat <<EOM
3459
3460There's also a Policy hint file available, which should make the
3461site-specific (policy) questions easier to answer.
3462EOM
3463
3464 fi
3465
2304df62
AD
3466 $cat <<EOM
3467
3468You may give one or more space-separated answers, or "none" if appropriate.
a2d23ec2
MB
3469If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3470previous run of Configure, you may specify it as well as or instead of
3471OS-specific hints. If hints are provided for your OS, you should use them:
3472although Perl can probably be built without hints on many platforms, using
3473hints often improve performance and may enable features that Configure can't
3474set up on its own. If there are no hints that match your OS, specify "none";
3475DO NOT give a wrong version or a wrong OS.
2304df62
AD
3476
3477EOM
4e2a5f63 3478
2304df62 3479 rp="Which of these apply, if any?"
dfe9444c 3480 . UU/myread
85e6fe83
LW
3481 tans=$ans
3482 for file in $tans; do
4e2a5f63
AD
3483 if $test X$file = XPolicy -a -f Policy.sh; then
3484 . Policy.sh
3485 $cat Policy.sh >> UU/config.sh
3486 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3487 . $src/hints/$file.sh
3488 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3489 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3490 : nothing
3491 else
85e6fe83
LW
3492 : Give one chance to correct a possible typo.
3493 echo "$file.sh does not exist"
3494 dflt=$file
3495 rp="hint to use instead?"
dfe9444c 3496 . UU/myread
85e6fe83 3497 for file in $ans; do
dfe9444c
AD
3498 if $test -f "$src/hints/$file.sh"; then
3499 . $src/hints/$file.sh
3500 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3501 elif $test X$ans = X -o X$ans = Xnone ; then
3502 : nothing
3503 else
3504 echo "$file.sh does not exist -- ignored."
3505 fi
3506 done
2304df62
AD
3507 fi
3508 done
85e6fe83 3509
2304df62 3510 hint=recommended
85e6fe83 3511 : Remember our hint file for later.
dfe9444c 3512 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3513 hintfile="$file"
85e6fe83 3514 else
a0d0e21e 3515 hintfile=''
85e6fe83 3516 fi
2304df62
AD
3517fi
3518cd UU
3519;;
3520*)
3521 echo " "
3522 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3523 tmp_n="$n"
3524 tmp_c="$c"
2304df62
AD
3525 cd ..
3526 cp $config_sh config.sh 2>/dev/null
a78b0d02 3527 chmod +w config.sh
2304df62
AD
3528 . ./config.sh
3529 cd UU
3530 cp ../config.sh .
ecfc5424
AD
3531 n="$tmp_n"
3532 c="$tmp_c"
2304df62
AD
3533 hint=previous
3534 ;;
3535esac
1aef975c 3536test "$override" && . ./optdef.sh
2304df62
AD
3537
3538: Restore computed paths
3539for file in $loclist $trylist; do
3540 eval $file="\$_$file"
3541done
3542
85e6fe83 3543cat << EOM
a0d0e21e 3544
85e6fe83 3545Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3546The default value is probably right if the name rings a bell. Otherwise,
3547since spelling matters for me, either accept the default or answer "none"
3548to leave it blank.
a0d0e21e 3549
85e6fe83 3550EOM
85e6fe83 3551case "$osname" in
a0d0e21e 3552 ''|' ')
85e6fe83 3553 case "$hintfile" in
a0d0e21e 3554 ''|' '|none) dflt=none ;;
ecfc5424 3555 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3556 esac
3557 ;;
3558 *) dflt="$osname" ;;
3559esac
3560rp="Operating system name?"
3561. ./myread
3562case "$ans" in
ecfc5424
AD
3563none) osname='' ;;
3564*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3565esac
8ff267be 3566echo " "
3567case "$osvers" in
3568 ''|' ')
3569 case "$hintfile" in
3570 ''|' '|none) dflt=none ;;
3571 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3572 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3573 case "$dflt" in
3574 ''|' ') dflt=none ;;
3575 esac
3576 ;;
3577 esac
3578 ;;
3579 *) dflt="$osvers" ;;
3580esac
3581rp="Operating system version?"
3582. ./myread
3583case "$ans" in
3584none) osvers='' ;;
3585*) osvers="$ans" ;;
3586esac
3587
02e93a22
JH
3588
3589. ./posthint.sh
3590
2304df62 3591: who configured the system
59b83a6f 3592cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3593case "$cf_by" in
3594"")
7c04078e 3595 cf_by=`(logname) 2>/dev/null`
dfe9444c 3596 case "$cf_by" in
7c04078e
GA
3597 "")
3598 cf_by=`(whoami) 2>/dev/null`
3599 case "$cf_by" in
3600 "") cf_by=unknown ;;
3601 esac ;;
8ff267be 3602 esac ;;
3603esac
2304df62 3604
f3f1a2d8
MB
3605: decide how portable to be. Allow command line overrides.
3606case "$d_portable" in
3607"$undef") ;;
3608*) d_portable="$define" ;;
b4eb6b3d 3609esac
b4eb6b3d 3610
f3f1a2d8
MB
3611: set up shell script to do ~ expansion
3612cat >filexp <<EOSS
3613$startsh
3614: expand filename
3615case "\$1" in
f16e9d76 3616 \~/*|\~)
f3f1a2d8
MB
3617 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3618 ;;
4137585d 3619 \~*)
f3f1a2d8
MB
3620 if $test -f /bin/csh; then
3621 /bin/csh -f -c "glob \$1"
3622 failed=\$?
3623 echo ""
3624 exit \$failed
3625 else
3626 name=\`$expr x\$1 : '..\([^/]*\)'\`
3627 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3628 if $test ! -d "\$dir"; then
3629 me=\`basename \$0\`
3630 echo "\$me: can't locate home directory for: \$name" >&2
3631 exit 1
3632 fi
3633 case "\$1" in
3634 */*)
3635 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3636 ;;
3637 *)
3638 echo \$dir
3639 ;;
3640 esac
3641 fi
3642 ;;
3643*)
3644 echo \$1
3645 ;;
b29b105d 3646esac
f3f1a2d8
MB
3647EOSS
3648chmod +x filexp
3649$eunicefix filexp
b29b105d 3650
f3f1a2d8
MB
3651: now set up to get a file name
3652cat <<EOS >getfile
3653$startsh
3654EOS
3655cat <<'EOSC' >>getfile
3656tilde=''
3657fullpath=''
3658already=''
3659skip=''
3660none_ok=''
3661exp_file=''
3662nopath_ok=''
3663orig_rp="$rp"
3664orig_dflt="$dflt"
3665case "$gfpth" in
3666'') gfpth='.' ;;
b29b105d 3667esac
b29b105d 3668
f3f1a2d8
MB
3669case "$fn" in
3670*\(*)
3671 : getfile will accept an answer from the comma-separated list
3672 : enclosed in parentheses even if it does not meet other criteria.
3673 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3674 fn=`echo $fn | sed 's/(.*)//'`
3675 ;;
b29b105d
JH
3676esac
3677
f3f1a2d8
MB
3678case "$fn" in
3679*:*)
3680 loc_file=`expr $fn : '.*:\(.*\)'`
3681 fn=`expr $fn : '\(.*\):.*'`
3682 ;;
b29b105d 3683esac
b29b105d 3684
f3f1a2d8
MB
3685case "$fn" in
3686*~*) tilde=true;;
3687esac
3688case "$fn" in
3689*/*) fullpath=true;;
3690esac
3691case "$fn" in
3692*+*) skip=true;;
3693esac
3694case "$fn" in
3695*n*) none_ok=true;;
3696esac
3697case "$fn" in
3698*e*) exp_file=true;;
3699esac
3700case "$fn" in
3701*p*) nopath_ok=true;;
b29b105d 3702esac
b29b105d 3703
f3f1a2d8
MB
3704case "$fn" in
3705*f*) type='File';;
3706*d*) type='Directory';;
3707*l*) type='Locate';;
3708esac
b29b105d 3709
f3f1a2d8
MB
3710what="$type"
3711case "$what" in
3712Locate) what='File';;
3713esac
b29b105d 3714
f3f1a2d8
MB
3715case "$exp_file" in
3716'')
3717 case "$d_portable" in
3718 "$define") ;;
3719 *) exp_file=true;;
b29b105d
JH
3720 esac
3721 ;;
3722esac
3723
f3f1a2d8
MB
3724cd ..
3725while test "$type"; do
3726 redo=''
3727 rp="$orig_rp"
3728 dflt="$orig_dflt"
3729 case "$tilde" in
3730 true) rp="$rp (~name ok)";;
3731 esac
3732 . UU/myread
3733 if test -f UU/getfile.ok && \
3734 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3735 then
3736 value="$ans"
3737 ansexp="$ans"
3738 break
3739 fi
3740 case "$ans" in
3741 none)
3742 value=''
3743 ansexp=''
3744 case "$none_ok" in
3745 true) type='';;
b29b105d
JH
3746 esac
3747 ;;
f3f1a2d8
MB
3748 *)
3749 case "$tilde" in
3750 '') value="$ans"
3751 ansexp="$ans";;
3752 *)
3753 value=`UU/filexp $ans`
3754 case $? in
3755 0)
3756 if test "$ans" != "$value"; then
3757 echo "(That expands to $value on this system.)"
3758 fi
3759 ;;
3760 *) value="$ans";;
3761 esac
3762 ansexp="$value"
3763 case "$exp_file" in
3764 '') value="$ans";;
3765 esac
3766 ;;
3767 esac
3768 case "$fullpath" in
3769 true)
3770 case "$ansexp" in
3771 /*) value="$ansexp" ;;
3772 [a-zA-Z]:/*) value="$ansexp" ;;
3773 *)
3774 redo=true
3775 case "$already" in
3776 true)
3777 echo "I shall only accept a full path name, as in /bin/ls." >&4
3778 echo "Use a ! shell escape if you wish to check pathnames." >&4
3779 ;;
3780 *)
3781 echo "Please give a full path name, starting with slash." >&4
3782 case "$tilde" in
3783 true)
3784 echo "Note that using ~name is ok provided it expands well." >&4
3785 already=true
3786 ;;
3787 esac
3788 esac
3789 ;;
3790 esac
3791 ;;
3792 esac
3793 case "$redo" in
3794 '')
3795 case "$type" in
3796 File)
3797 for fp in $gfpth; do
3798 if test "X$fp" = X.; then
3799 pf="$ansexp"
3800 else
3801 pf="$fp/$ansexp"
3802 fi
3803 if test -f "$pf"; then
3804 type=''
3805 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3806 then
3807 echo "($value is not a plain file, but that's ok.)"
3808 type=''
3809 fi
3810 if test X"$type" = X; then
3811 value="$pf"
3812 break
3813 fi
3814 done
3815 ;;
3816 Directory)
3817 for fp in $gfpth; do
3818 if test "X$fp" = X.; then
3819 dir="$ans"
3820 direxp="$ansexp"
3821 else
3822 dir="$fp/$ansexp"
3823 direxp="$fp/$ansexp"
3824 fi
3825 if test -d "$direxp"; then
3826 type=''
3827 value="$dir"
3828 break
3829 fi
3830 done
3831 ;;
3832 Locate)
3833 if test -d "$ansexp"; then
3834 echo "(Looking for $loc_file in directory $value.)"
3835 value="$value/$loc_file"
3836 ansexp="$ansexp/$loc_file"
3837 fi
3838 if test -f "$ansexp"; then
3839 type=''
3840 fi
3841 case "$nopath_ok" in
3842 true) case "$value" in
3843 */*) ;;
3844 *) echo "Assuming $value will be in people's path."
3845 type=''
3846 ;;
3847 esac
3848 ;;
3849 esac
3850 ;;
3851 esac
b4eb6b3d 3852
f3f1a2d8
MB
3853 case "$skip" in
3854 true) type='';
3855 esac
3856
3857 case "$type" in
3858 '') ;;
3859 *)
3860 if test "$fastread" = yes; then
3861 dflt=y
3862 else
3863 dflt=n
3864 fi
3865 rp="$what $value doesn't exist. Use that name anyway?"
3866 . UU/myread
3867 dflt=''
3868 case "$ans" in
3869 y*) type='';;
3870 *) echo " ";;
3871 esac
3872 ;;
3873 esac
3874 ;;
3875 esac
3876 ;;
b4eb6b3d 3877 esac
f3f1a2d8
MB
3878done
3879cd UU
3880ans="$value"
3881rp="$orig_rp"
3882dflt="$orig_dflt"
3883rm -f getfile.ok
3884test "X$gfpthkeep" != Xy && gfpth=""
3885EOSC
3886
3887: determine root of directory hierarchy where package will be installed.
3888case "$prefix" in
3889'')
3890 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3891 ;;
3892*?/)
3893 dflt=`echo "$prefix" | sed 's/.$//'`
b4eb6b3d
JH
3894 ;;
3895*)
f3f1a2d8 3896 dflt="$prefix"
b4eb6b3d
JH
3897 ;;
3898esac
f3f1a2d8 3899$cat <<EOM
b4eb6b3d 3900
f3f1a2d8
MB
3901By default, $package will be installed in $dflt/bin, manual pages
3902under $dflt/man, etc..., i.e. with $dflt as prefix for all
3903installation directories. Typically this is something like /usr/local.
3904If you wish to have binaries under /usr/bin but other parts of the
3905installation under /usr/local, that's ok: you will be prompted
3906separately for each of the installation directories, the prefix being
3907only used to set the defaults.
c915ce7f
JH
3908
3909EOM
f3f1a2d8
MB
3910fn=d~
3911rp='Installation prefix to use?'
3912. ./getfile
3913oldprefix=''
3914case "$prefix" in
3915'') ;;
3916*)
3917 case "$ans" in
3918 "$prefix") ;;
3919 *) oldprefix="$prefix";;
3920 esac
c915ce7f
JH
3921 ;;
3922esac
f3f1a2d8
MB
3923prefix="$ans"
3924prefixexp="$ansexp"
c915ce7f 3925
776a38e3 3926: allow them to override the AFS root
f3f1a2d8
MB
3927case "$afsroot" in
3928'') afsroot=/afs ;;
3929*) afsroot=$afsroot ;;
b4eb6b3d 3930esac
b4eb6b3d 3931
776a38e3 3932: is AFS running?
f3f1a2d8
MB
3933echo " "
3934case "$afs" in
3935$define|true) afs=true ;;
3936$undef|false) afs=false ;;
776a38e3 3937*) if $test -d $afsroot; then
f3f1a2d8
MB
3938 afs=true
3939 else
3940 afs=false
3941 fi
b4eb6b3d 3942 ;;
f3f1a2d8
MB
3943esac
3944if $afs; then
3945 echo "AFS may be running... I'll be extra cautious then..." >&4
3946else
3947 echo "AFS does not seem to be running..." >&4
9da7673b 3948fi
b4eb6b3d 3949
f3f1a2d8
MB
3950: determine installation prefix for where package is to be installed.
3951if $afs; then
3952$cat <<EOM
3953
3954Since you are running AFS, I need to distinguish the directory in which
3955files will reside from the directory in which they are installed (and from
3956which they are presumably copied to the former directory by occult means).
b4eb6b3d 3957
b4eb6b3d 3958EOM
f3f1a2d8
MB
3959 case "$installprefix" in
3960 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3961 *) dflt="$installprefix";;
3962 esac
3963else
3964$cat <<EOM
b4eb6b3d 3965
f3f1a2d8
MB
3966In some special cases, particularly when building $package for distribution,
3967it is convenient to distinguish the directory in which files should be
3968installed from the directory ($prefix) in which they will
3969eventually reside. For most users, these two directories are the same.
3970
3971EOM
3972 case "$installprefix" in
3973 '') dflt=$prefix ;;
3974 *) dflt=$installprefix;;
3975 esac
3976fi
3977fn=d~
3978rp='What installation prefix should I use for installing files?'
3979. ./getfile
3980installprefix="$ans"
3981installprefixexp="$ansexp"
3982
3983: Perform the prefixexp/installprefixexp correction if necessary
3984cat <<EOS >installprefix
3985$startsh
3986EOS
3987cat <<'EOSC' >>installprefix
3988: Change installation prefix, if necessary.
3989if $test X"$prefix" != X"$installprefix"; then
3990 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3991else
3992 eval "install${prefixvar}=\"\$${prefixvar}exp\""
3993fi
3994EOSC
3995chmod +x installprefix
3996$eunicefix installprefix
3997
3998: Set variables such as privlib and privlibexp from the output of ./getfile
3999: performing the prefixexp/installprefixexp correction if necessary.
4000cat <<EOS >setprefixvar
4001$startsh
4002EOS
4003cat <<'EOSC' >>setprefixvar
4004eval "${prefixvar}=\"\$ans\""
4005eval "${prefixvar}exp=\"\$ansexp\""
4006. ./installprefix
4007EOSC
4008chmod +x setprefixvar
4009$eunicefix setprefixvar
4010
4011: set up the script used to warn in case of inconsistency
4012cat <<EOS >whoa
4013$startsh
4014EOS
4015cat <<'EOSC' >>whoa
4016dflt=y
dcb594bc
MB
4017case "$hint" in
4018 recommended)
4019 case "$hintfile" in
4020 '') echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4021 ;;
4022 *) echo "Hmm. Based on the hints in hints/$hintfile.sh, " >&4
4023 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4024 ;;
4025 esac
4026 ;;
4027 *) echo " "
4028 echo "*** WHOA THERE!!! ***" >&4
4029 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
4030 ;;
4031esac
f3f1a2d8
MB
4032rp=" Keep the $hint value?"
4033. ./myread
4034case "$ans" in
4035y) td=$was; tu=$was;;
4036esac
4037EOSC
4038
216dac04 4039: function used to set '$1' to '$val'
f3f1a2d8
MB
4040setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4041case "$val$was" in
4042$define$undef) . ./whoa; eval "$var=\$td";;
4043$undef$define) . ./whoa; eval "$var=\$tu";;
4044*) eval "$var=$val";;
4045esac'
4046
34f1896b 4047: Check is we will use socks
f3f1a2d8
MB
4048case "$usesocks" in
4049$define|true|[yY]*) dflt='y';;
4050*) dflt='n';;
4051esac
4052cat <<EOM
4053
4054Perl can be built to use the SOCKS proxy protocol library. To do so,
4055Configure must be run with -Dusesocks. If you use SOCKS you also need
4056to use the PerlIO abstraction layer, this will be implicitly selected.
4057
4058If this doesn't make any sense to you, just accept the default '$dflt'.
4059EOM
4060rp='Build Perl for SOCKS?'
4061. ./myread
4062case "$ans" in
613d6c3e 4063y|Y) val="$define" ;;
f3f1a2d8
MB
4064*) val="$undef" ;;
4065esac
4066set usesocks
4067eval $setvar
4068
4069case "$usesocks" in
4070$define|true|[yY]*) useperlio="$define";;
4071esac
4072
34f1896b 4073: Check if we want perlio
f3f1a2d8
MB
4074case "$useperlio" in
4075$define|true|[yY]*|'') dflt='y';;
4076*) dflt='n';;
4077esac
4078cat <<EOM
4079
4080Previous version of $package used the standard IO mechanisms as
4081defined in <stdio.h>. Versions 5.003_02 and later of $package allow
4082alternate IO mechanisms via the PerlIO abstraction layer, but the
4083stdio mechanism is still available if needed. The abstraction layer
4084can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4085Using PerlIO with sfio may cause problems with some extension modules.
4086
4087If this doesn't make any sense to you, just accept the default '$dflt'.
b4eb6b3d 4088EOM
f3f1a2d8
MB
4089rp='Use the PerlIO abstraction layer?'
4090. ./myread
4091case "$ans" in
34f1896b 4092y|Y)
b4eb6b3d
JH
4093 val="$define"
4094 ;;
34f1896b 4095*)
f3f1a2d8
MB
4096 echo "Ok, doing things the stdio way."
4097 val="$undef"
4098 ;;
4099esac
4100set useperlio
34f1896b 4101eval $setvar
f3f1a2d8
MB
4102
4103case "$usesocks" in
4104$define|true|[yY]*)
4105 case "$useperlio" in
4106 $define|true|[yY]*) ;;
4107 *) cat >&4 <<EOM
4108
4109You are using the SOCKS proxy protocol library which means that you
4110should also use the PerlIO layer. You may be headed for trouble.
4111
4112EOM
4113 ;;
b4eb6b3d 4114 esac
f3f1a2d8
MB
4115 ;;
4116esac
4117
5c40187f
MB
4118: get the patchlevel
4119echo " "
4120echo "Getting the current patchlevel..." >&4
4121if $test -r $rsrc/patchlevel.h;then
4122 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4123 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4124 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4125 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4126 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4127 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
ff803615 4128 perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
5c40187f
MB
4129else
4130 revision=0
4131 patchlevel=0
4132 subversion=0
4133 api_revision=0
4134 api_version=0
4135 api_subversion=0
4136 perl_patchlevel=0
4137 $echo "(You do not have patchlevel.h. Eek.)"
4138fi
4139if $test -r $rsrc/.patch ; then
4140 if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4141 perl_patchlevel=`cat $rsrc/.patch`
4142 fi
4143fi
4144: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4145version_patchlevel_string="version $patchlevel subversion $subversion"
4146case "$perl_patchlevel" in
41470|'') ;;
0f04e85f
MB
4148*) perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4149 version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4150 ;;
5c40187f
MB
4151esac
4152
4153$echo "(You have $package $version_patchlevel_string.)"
4154
4155case "$osname" in
4156dos|vms)
4157 : XXX Should be a Configure test for double-dots in filenames.
4158 version=`echo $revision $patchlevel $subversion | \
4159 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4160 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4161 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4162 ;;
4163*)
4164 version=`echo $revision $patchlevel $subversion | \
4165 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4166 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4167 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4168 ;;
4169esac
4170: Special case the 5.005_xx maintenance series, which used 5.005
4171: without any subversion label as a subdirectory in $sitelib
4172if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4173 api_versionstring='5.005'
4174fi
4175
613d6c3e 4176: Do we want threads support and if so, what type
f3f1a2d8
MB
4177case "$usethreads" in
4178$define|true|[yY]*) dflt='y';;
4179*) # Catch case where user specified ithreads or 5005threads but
4180 # forgot -Dusethreads (A.D. 4/2002)
4181 case "$useithreads$use5005threads" in
613d6c3e 4182 *$define*)
f3f1a2d8
MB
4183 case "$useperlio" in
4184 "$define") dflt='y' ;;
4185 *) dflt='n' ;;
4186 esac
4187 ;;
4188 *) dflt='n';;
4189 esac
4190 ;;
4191esac
4192cat <<EOM
4193
4194Perl can be built to take advantage of threads on some systems.
4195To do so, Configure can be run with -Dusethreads.
4196
4197Note that Perl built with threading support runs slightly slower
4198and uses more memory than plain Perl. The current implementation
4199is believed to be stable, but it is fairly new, and so should be
4200treated with caution.
4201
4202If this doesn't make any sense to you, just accept the default '$dflt'.
4203EOM
4204rp='Build a threading Perl?'
4205. ./myread
4206case "$ans" in
4207y|Y) val="$define" ;;
4208*) val="$undef" ;;
4209esac
4210set usethreads
4211eval $setvar
4212
5c40187f
MB
4213if $test $patchlevel -lt 9; then
4214 case "$usethreads" in
4215 $define)
f3f1a2d8
MB
4216 $cat <<EOM
4217
4218Since release 5.6, Perl has had two different threading implementations,
4219the newer interpreter-based version (ithreads) with one interpreter per
4220thread, and the older 5.005 version (5005threads).
4221The 5005threads version is effectively unmaintained and will probably be
4222removed in Perl 5.10, so there should be no need to build a Perl using it
4223unless needed for backwards compatibility with some existing 5.005threads
4224code.
4225
4226EOM
4227 : Default to ithreads unless overridden on command line or with
4228 : old config.sh
4229 dflt='y'
4230 case "$use5005threads" in
4231 $define|true|[yY]*) dflt='n';;
4232 esac
4233 case "$useithreads" in
4234 $undef|false|[nN]*) dflt='n';;
4235 esac
4236 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
4237 . ./myread
4238 case "$ans" in
f3f1a2d8 4239 y|Y) val="$define" ;;
b4eb6b3d
JH
4240 *) val="$undef" ;;
4241 esac
f3f1a2d8
MB
4242 set useithreads
4243 eval $setvar
4244 : Now set use5005threads to the opposite value.
4245 case "$useithreads" in
4246 $define) val="$undef" ;;
4247 *) val="$define" ;;
4248 esac
4249 set use5005threads
4250 eval $setvar
4251 ;;
5c40187f 4252 *)
f3f1a2d8
MB
4253 useithreads="$undef"
4254 use5005threads="$undef"
b4eb6b3d 4255 ;;
5c40187f 4256 esac
b4eb6b3d 4257
5c40187f
MB
4258 case "$useithreads$use5005threads" in
4259 "$define$define")
f3f1a2d8 4260 $cat >&4 <<EOM
96056487 4261
f3f1a2d8
MB
4262You cannot have both the ithreads and the 5.005 threads enabled
4263at the same time. Disabling the 5.005 threads since they are
4264much less stable than the ithreads.
4265
4266EOM
4267 use5005threads="$undef"
96056487 4268 ;;
5c40187f
MB
4269 esac
4270
4271else
4272: perl-5.9.x and later
4273
47f9f84c 4274 if test X"$usethreads" = "X$define"; then
3f30fabf
MB
4275 case "$use5005threads" in
4276 $define|true|[yY]*)
4277 $cat >&4 <<EOM
47f9f84c
JH
4278
42795.005 threads has been removed for 5.10. Perl will be built using ithreads.
5c40187f 4280
47f9f84c 4281EOM
3f30fabf
MB
4282 ;;
4283 esac
47f9f84c 4284 fi
3f30fabf 4285
47f9f84c
JH
4286 use5005threads="$undef"
4287 useithreads="$usethreads"
5c40187f 4288fi
96056487 4289
f3f1a2d8
MB
4290if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4291 cat >&4 <<EOF
4292***
4293*** To build with ithreads you must also use the PerlIO layer.
4294*** Cannot continue, aborting.
4295***
4296EOF
4297 exit 1
4298fi
4299
4300case "$d_oldpthreads" in
4301'') : Configure tests would be welcome here. For now, assume undef.
4302 val="$undef" ;;
4303*) val="$d_oldpthreads" ;;
4304esac
4305set d_oldpthreads
4306eval $setvar
4307
4308
4309: Look for a hint-file generated 'call-back-unit'. If the
4310: user has specified that a threading perl is to be built,
4311: we may need to set or change some other defaults.
4312if $test -f usethreads.cbu; then
4313 echo "Your platform has some specific hints regarding threaded builds, using them..."
4314 . ./usethreads.cbu
4315else
4316 case "$usethreads" in
4317 "$define"|true|[yY]*)
4318 $cat <<EOM
4319(Your platform does not have any specific hints for threaded builds.
4320 Assuming POSIX threads, then.)
4321EOM
4322 ;;
4323 esac
4324fi
4325
34f1896b 4326: Check if multiplicity is required
f3f1a2d8
MB
4327cat <<EOM
4328
4329Perl can be built so that multiple Perl interpreters can coexist
4330within the same Perl executable.
4331EOM
4332
4333case "$useithreads" in
4334$define)
4335 cat <<EOM
4336This multiple interpreter support is required for interpreter-based threads.
4337EOM
4338 val="$define"
4339 ;;
4340*) case "$usemultiplicity" in
4341 $define|true|[yY]*) dflt='y';;
4342 *) dflt='n';;
4343 esac
4344 echo " "
4345 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4346 rp='Build Perl for multiplicity?'
4347 . ./myread
4348 case "$ans" in
4349 y|Y) val="$define" ;;
4350 *) val="$undef" ;;
4351 esac
4352 ;;
4353esac
4354set usemultiplicity
4355eval $setvar
4356
34f1896b 4357: Check if morebits is requested
f3f1a2d8
MB
4358case "$usemorebits" in
4359"$define"|true|[yY]*)
4360 use64bitint="$define"
4361 uselongdouble="$define"
4362 usemorebits="$define"
4363 ;;
4364*) usemorebits="$undef"
4365 ;;
4366esac
4367
776a38e3
MB
4368: Determine the C compiler to be used
4369echo " "
4370case "$cc" in
4371'') dflt=cc;;
4372*) dflt="$cc";;
4373esac
4374rp="Use which C compiler?"
4375. ./myread
4376cc="$ans"
4377
4378: See whether they have no cc but they do have gcc
4379. ./trygcc
4380if $test -f cc.cbu; then
4381 . ./cc.cbu
4382fi
4383. ./checkcc
4384
f3f1a2d8
MB
4385: make some quick guesses about what we are up against
4386echo " "
4387$echo $n "Hmm... $c"
4388echo exit 1 >bsd
4389echo exit 1 >usg
4390echo exit 1 >v7
4391echo exit 1 >osf1
4392echo exit 1 >eunice
4393echo exit 1 >xenix
4394echo exit 1 >venix
4395echo exit 1 >os2
4396d_bsd="$undef"
4397$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4398if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
e5e20432
JH
4399then
4400 echo "Looks kind of like an OSF/1 system, but we'll see..."
4401 echo exit 0 >osf1
381aa1ff 4402elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
4403 xxx=`./loc addbib blurfl $pth`
4404 if $test -f $xxx; then
4405 echo "Looks kind of like a USG system with BSD features, but we'll see..."
4406 echo exit 0 >bsd
4407 echo exit 0 >usg
4408 else
4409 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4410 echo "Looks kind of like an extended USG system, but we'll see..."
4411 else
4412 echo "Looks kind of like a USG system, but we'll see..."
4413 fi
4414 echo exit 0 >usg
4415 fi
4416elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4417 echo "Looks kind of like a BSD system, but we'll see..."
4418 d_bsd="$define"
4419 echo exit 0 >bsd
4420else
4421 echo "Looks kind of like a Version 7 system, but we'll see..."
4422 echo exit 0 >v7
4423fi
4424case "$eunicefix" in
4425*unixtovms*)
4426 $cat <<'EOI'
4427There is, however, a strange, musty smell in the air that reminds me of
4428something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4429EOI
4430 echo exit 0 >eunice
4431 d_eunice="$define"
4432: it so happens the Eunice I know will not run shell scripts in Unix format
4433 ;;
4434*)
4435 echo " "
4436 echo "Congratulations. You aren't running Eunice."
4437 d_eunice="$undef"
4438 ;;
4439esac
4440: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
4441: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4442: semicolon as a patch separator
e5e20432
JH
4443case "$p_" in
4444:) ;;
4445*)
4446 $cat <<'EOI'
4447I have the feeling something is not exactly right, however...don't tell me...
4448lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 4449(Or you may be running DOS with DJGPP.)
e5e20432
JH
4450EOI
4451 echo exit 0 >os2
4452 ;;
4453esac
4454if test -f /xenix; then
4455 echo "Actually, this looks more like a XENIX system..."
4456 echo exit 0 >xenix
4457 d_xenix="$define"
4458else
4459 echo " "
4460 echo "It's not Xenix..."
4461 d_xenix="$undef"
4462fi
4463chmod +x xenix
4464$eunicefix xenix
4465if test -f /venix; then
4466 echo "Actually, this looks more like a VENIX system..."
4467 echo exit 0 >venix
4468else
4469 echo " "
4470 if ./xenix; then
4471 : null
4472 else
4473 echo "Nor is it Venix..."
4474 fi
4475fi
4476chmod +x bsd usg v7 osf1 eunice xenix venix os2
4477$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4478$rm -f foo
4479
613d6c3e 4480: Check if we are using GNU gcc and what its version is
e5e20432
JH
4481echo " "
4482echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 4483$cat >try.c <<EOM
e5e20432
JH
4484#include <stdio.h>
4485int main() {
7686528e 4486#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
e5e20432
JH
4487#ifdef __VERSION__
4488 printf("%s\n", __VERSION__);
4489#else
4490 printf("%s\n", "1");
4491#endif
4492#endif
073b6de5 4493 return(0);
e5e20432
JH
4494}
4495EOM
5440bc8e
JH
4496if $cc -o try $ccflags $ldflags try.c; then
4497 gccversion=`$run ./try`
f3f1a2d8
MB
4498 case "$gccversion" in
4499 '') echo "You are not using GNU cc." ;;
4500 *) echo "You are using GNU cc $gccversion."
4501 ccname=gcc
4502 ;;
4503 esac
4504else
4505 echo " "
4506 echo "*** WHOA THERE!!! ***" >&4
4507 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
4508 case "$knowitall" in
4509 '')
4510 echo " You'd better start hunting for one and let me know about it." >&4
4511 exit 1
2304df62
AD
4512 ;;
4513 esac
f3f1a2d8
MB
4514fi
4515$rm -f try try.*
4516case "$gccversion" in
45171*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4518esac
4519case "$gccversion" in
4520'') gccosandvers='' ;;
4521*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4522 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4523 gccshortvers=''
4524 case "$gccosandvers" in
4525 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4526 $osname$osvers) ;; # looking good
4527 $osname*) cat <<EOM >&4
4528
4529*** WHOA THERE!!! ***
4530
4531 Your gcc has not been compiled for the exact release of
4532 your operating system ($gccosandvers versus $osname$osvers).
4533
4534 In general it is a good idea to keep gcc synchronized with
4535 the operating system because otherwise serious problems
4536 may ensue when trying to compile software, like Perl.
4537
4538 I'm trying to be optimistic here, though, and will continue.
4539 If later during the configuration and build icky compilation
4540 problems appear (headerfile conflicts being the most common
4541 manifestation), I suggest reinstalling the gcc to match
4542 your operating system release.
4543
4544EOM
4545 ;;
4546 *) gccosandvers='' ;; # failed to parse, better be silent
4547 esac
4548 ;;
4549esac
4550case "$ccname" in
4551'') ccname="$cc" ;;
4552esac
4553
4554# gcc 3.* complain about adding -Idirectories that they already know about,
4555# so we will take those off from locincpth.
4556case "$gccversion" in
45573*)
4558 echo "main(){}">try.c
4559 for incdir in $locincpth; do
4560 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4561 grep '^c[cp]p*[01]: warning: changing search order '`
4562 if test "X$warn" != X; then
4563 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4564 fi
4565 done
4566 $rm -f try try.*
4567esac
2304df62 4568
bd9b35c9
JH
4569: What should the include directory be ?
4570echo " "
4571$echo $n "Hmm... $c"
4572dflt='/usr/include'
4573incpath=''
4574mips_type=''
4575if $test -f /bin/mips && /bin/mips; then
4576 echo "Looks like a MIPS system..."
4577 $cat >usr.c <<'EOCP'
4578#ifdef SYSTYPE_BSD43
4579/bsd43
4580#endif
4581EOCP
8a27cf78 4582 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4583 dflt='/bsd43/usr/include'
4584 incpath='/bsd43'
4585 mips_type='BSD 4.3'
4586 else
4587 mips_type='System V'
4588 fi
4589 $rm -f usr.c usr.out
4590 echo "and you're compiling with the $mips_type compiler and libraries."
4591 xxx_prompt=y
4592 echo "exit 0" >mips
4593else
4594 echo "Doesn't look like a MIPS system."
4595 xxx_prompt=n
4596 echo "exit 1" >mips
4597fi
4598chmod +x mips
4599$eunicefix mips
4600case "$usrinc" in
4601'') ;;
4602*) dflt="$usrinc";;
4603esac
4604case "$xxx_prompt" in
4605y) fn=d/
4606 echo " "
4607 rp='Where are the include files you want to use?'
4608 . ./getfile
4609 usrinc="$ans"
8e07c86e 4610 ;;
bd9b35c9 4611*) usrinc="$dflt"
8e07c86e
AD
4612 ;;
4613esac
2304df62 4614
96056487
JH
4615: see how we invoke the C preprocessor
4616echo " "
4617echo "Now, how can we feed standard input to your C preprocessor..." >&4
4618cat <<'EOT' >testcpp.c
4619#define ABC abc
4620#define XYZ xyz
4621ABC.XYZ
4622EOT
4623cd ..
4624if test ! -f cppstdin; then
4625 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4626 # AIX cc -E doesn't show the absolute headerfile
4627 # locations but we'll cheat by using the -M flag.
4628 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
4629 else
4630 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4631 fi
4632else
4633 echo "Keeping your $hint cppstdin wrapper."
4634fi
4635chmod 755 cppstdin
4636wrapper=`pwd`/cppstdin
4637ok='false'
4638cd UU
4639
4640if $test "X$cppstdin" != "X" && \
4641 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4642 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4643then
4644 echo "You used to use $cppstdin $cppminus so we'll use that again."
4645 case "$cpprun" in
4646 '') echo "But let's see if we can live without a wrapper..." ;;
4647 *)
4648 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4649 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4650 then
4651 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4652 ok='true'
4653 else
4654 echo "(However, $cpprun $cpplast does not work, let's see...)"
4655 fi
4656 ;;
4657 esac
4658else
4659 case "$cppstdin" in
4660 '') ;;
4661 *)
4662 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4663 ;;
4664 esac
4665fi
4666
4667if $ok; then
4668 : nothing
4669elif echo 'Maybe "'"$cc"' -E" will work...'; \
4670 $cc -E <testcpp.c >testcpp.out 2>&1; \
4671 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4672 echo "Yup, it does."
4673 x_cpp="$cc -E"
4674 x_minus='';
4675elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4676 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4677 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4678 echo "Yup, it does."
4679 x_cpp="$cc -E"
4680 x_minus='-';
4681elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4682 $cc -P <testcpp.c >testcpp.out 2>&1; \
4683 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4684 echo "Yipee, that works!"
4685 x_cpp="$cc -P"
4686 x_minus='';
4687elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4688 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4689 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4690 echo "At long last!"
4691 x_cpp="$cc -P"
4692 x_minus='-';
4693elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4694 $cpp <testcpp.c >testcpp.out 2>&1; \
4695 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4696 echo "It works!"
4697 x_cpp="$cpp"
4698 x_minus='';
4699elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4700 $cpp - <testcpp.c >testcpp.out 2>&1; \
4701 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4702 echo "Hooray, it works! I was beginning to wonder."
4703 x_cpp="$cpp"
4704 x_minus='-';
4705elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4706 $wrapper <testcpp.c >testcpp.out 2>&1; \
4707 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4708 x_cpp="$wrapper"
4709 x_minus=''
4710 echo "Eureka!"
4711else
4712 dflt=''
4713 rp="No dice. I can't find a C preprocessor. Name one:"
4714 . ./myread
4715 x_cpp="$ans"
4716 x_minus=''
4717 $x_cpp <testcpp.c >testcpp.out 2>&1
4718 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4719 echo "OK, that will do." >&4
4720 else
4721echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4722 exit 1
4723 fi
4724fi
4725
4726case "$ok" in
4727false)
4728 cppstdin="$x_cpp"
4729 cppminus="$x_minus"
4730 cpprun="$x_cpp"
4731 cpplast="$x_minus"
4732 set X $x_cpp
4733 shift
4734 case "$1" in
4735 "$cpp")
4736 echo "Perhaps can we force $cc -E using a wrapper..."
4737 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4738 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4739 then
4740 echo "Yup, we can."
4741 cppstdin="$wrapper"
4742 cppminus='';
4743 else
4744 echo "Nope, we'll have to live without it..."
4745 fi
4746 ;;
4747 esac
4748 case "$cpprun" in
4749 "$wrapper")
4750 cpprun=''
4751 cpplast=''
4752 ;;
4753 esac
4754 ;;
4755esac
4756
4757case "$cppstdin" in
4758"$wrapper"|'cppstdin') ;;
4759*) $rm -f $wrapper;;
4760esac
4761$rm -f testcpp.c testcpp.out
4762
bd9b35c9
JH
4763: Set private lib path
4764case "$plibpth" in
4765'') if ./mips; then
4766 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4767 fi;;
4768esac
4769case "$libpth" in
4770' ') dlist='';;
4771'') dlist="$loclibpth $plibpth $glibpth";;
4772*) dlist="$libpth";;
4773esac
4774
4775: Now check and see which directories actually exist, avoiding duplicates
4776libpth=''
4777for xxx in $dlist
4778do
4779 if $test -d $xxx; then
4780 case " $libpth " in
4781 *" $xxx "*) ;;
4782 *) libpth="$libpth $xxx";;
4783 esac
4784 fi
4785done
4786$cat <<'EOM'
4787
4788Some systems have incompatible or broken versions of libraries. Among
4789the directories listed in the question below, please remove any you
4790know not to be holding relevant libraries, and add any that are needed.
4791Say "none" for none.
8e07c86e
AD
4792
4793EOM
bd9b35c9
JH
4794case "$libpth" in
4795'') dflt='none';;
8e07c86e 4796*)
bd9b35c9
JH
4797 set X $libpth
4798 shift
4799 dflt=${1+"$@"}
8e07c86e 4800 ;;
a0d0e21e 4801esac
bd9b35c9
JH
4802rp="Directories to use for library searches?"
4803. ./myread
4804case "$ans" in
4805none) libpth=' ';;
4806*) libpth="$ans";;
4807esac
a0d0e21e 4808
bd9b35c9
JH
4809: compute shared library extension
4810case "$so" in
4811'')
4812 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4813 dflt='sl'
dd4e71fd 4814 else
bd9b35c9 4815 dflt='so'
dd4e71fd
JH
4816 fi
4817 ;;
bd9b35c9 4818*) dflt="$so";;
dd4e71fd 4819esac
dd4e71fd
JH
4820$cat <<EOM
4821
bd9b35c9 4822On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4823you want to suppress searching of shared libraries for the remainder
bd9b35c9 4824of this configuration.
dd4e71fd
JH
4825
4826EOM
bd9b35c9
JH
4827rp='What is the file extension used for shared libraries?'
4828. ./myread
4829so="$ans"
dd4e71fd 4830
bd9b35c9
JH
4831: Define several unixisms.
4832: Hints files or command line option can be used to override them.
4833: The convoluted testing is in case hints files set either the old
4834: or the new name.
4835case "$_exe" in
4836'') case "$exe_ext" in
1fef16b3 4837 '') ;;
bd9b35c9 4838 *) _exe="$exe_ext" ;;
dd4e71fd 4839 esac
bd9b35c9 4840 ;;
bfb7748a 4841esac
bd9b35c9
JH
4842case "$_a" in
4843'') case "$lib_ext" in
4844 '') _a='.a';;
4845 *) _a="$lib_ext" ;;
dd4e71fd
JH
4846 esac
4847 ;;
dd4e71fd 4848esac
bd9b35c9
JH
4849case "$_o" in
4850'') case "$obj_ext" in
4851 '') _o='.o';;
4852 *) _o="$obj_ext";;
4853 esac
4854 ;;
4855esac
4856case "$p_" in
4857'') case "$path_sep" in
4858 '') p_=':';;
4859 *) p_="$path_sep";;
4860 esac
4861 ;;
4862esac
4863exe_ext=$_exe
4864lib_ext=$_a
4865obj_ext=$_o
4866path_sep=$p_
dd4e71fd 4867
5b813a60
MB
4868rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4869
b4eb6b3d
JH
4870: Which makefile gets called first. This is used by make depend.
4871case "$firstmakefile" in
4872'') firstmakefile='makefile';;
4633a7c4 4873esac
4633a7c4 4874
34f1896b 4875: Check for uselongdouble support
1f603089
JH
4876case "$ccflags" in
4877*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4878esac
4879
4880case "$uselongdouble" in
4881$define|true|[yY]*) dflt='y';;
4882*) dflt='n';;
4883esac
4884cat <<EOM
4885
4886Perl can be built to take advantage of long doubles which
4887(if available) may give more accuracy and range for floating point numbers.
4888
4889If this doesn't make any sense to you, just accept the default '$dflt'.
4890EOM
4891rp='Try to use long doubles if available?'
4892. ./myread
4893case "$ans" in
4894y|Y) val="$define" ;;
4895*) val="$undef" ;;
4896esac
4897set uselongdouble
4898eval $setvar
4899
4900case "$uselongdouble" in
4901true|[yY]*) uselongdouble="$define" ;;
4902esac
4903
1f603089
JH
4904: Look for a hint-file generated 'call-back-unit'. If the
4905: user has specified that long doubles should be used,
4906: we may need to set or change some other defaults.
9da7673b
MB
4907if $test -f uselongdouble.cbu; then
4908 echo "Your platform has some specific hints regarding long doubles, using them..."
4909 . ./uselongdouble.cbu
4910else
4911 case "$uselongdouble" in
4912 $define)
1f603089 4913 $cat <<EOM
9da7673b 4914(Your platform does not have any specific hints for long doubles.)
1f603089 4915EOM
1f603089 4916 ;;
9da7673b
MB
4917 esac
4918fi
1f603089 4919
bd9b35c9
JH
4920: Looking for optional libraries
4921echo " "
4922echo "Checking for optional libraries..." >&4
4923case "$libs" in
4924' '|'') dflt='';;
4925*) dflt="$libs";;
4926esac
4927case "$libswanted" in
4928'') libswanted='c_s';;
4929esac
4930case "$usesocks" in
923fc586 4931"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4932esac
68435ea7
JH
4933libsfound=''
4934libsfiles=''
4935libsdirs=''
13b3f787
JH
4936libspath=''
4937for thisdir in $libpth $xlibpth; do
4938 test -d $thisdir && libspath="$libspath $thisdir"
4939done
bd9b35c9 4940for thislib in $libswanted; do
13b3f787 4941 for thisdir in $libspath; do
f7dd4e7f
JH
4942 xxx=''
4943 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4944 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4945 $test -f "$xxx" && eval $libscheck
4946 $test -f "$xxx" && libstyle=shared
4947 fi
4948 if test ! -f "$xxx"; then
4949 xxx=$thisdir/lib$thislib.$so
4950 $test -f "$xxx" && eval $libscheck
4951 $test -f "$xxx" && libstyle=shared
613d6c3e 4952 fi
f7dd4e7f
JH
4953 if test ! -f "$xxx"; then
4954 xxx=$thisdir/lib$thislib$_a
4955 $test -f "$xxx" && eval $libscheck
4956 $test -f "$xxx" && libstyle=static
4957 fi
4958 if test ! -f "$xxx"; then
4959 xxx=$thisdir/$thislib$_a
4960 $test -f "$xxx" && eval $libscheck
4961 $test -f "$xxx" && libstyle=static
4962 fi
4963 if test ! -f "$xxx"; then
4964 xxx=$thisdir/lib${thislib}_s$_a
4965 $test -f "$xxx" && eval $libscheck
4966 $test -f "$xxx" && libstyle=static
09ea5ba9 4967 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4968 fi
4969 if test ! -f "$xxx"; then
4970 xxx=$thisdir/Slib$thislib$_a
4971 $test -f "$xxx" && eval $libscheck
4972 $test -f "$xxx" && libstyle=static
4973 fi
4974 if $test -f "$xxx"; then
43999f95 4975 case "$libstyle" in
f7dd4e7f
JH
4976 shared) echo "Found -l$thislib (shared)." ;;
4977 static) echo "Found -l$thislib." ;;
4978 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4979 esac
bd9b35c9
JH
4980 case " $dflt " in
4981 *"-l$thislib "*);;
f7dd4e7f 4982 *) dflt="$dflt -l$thislib"
43999f95
JH
4983 libsfound="$libsfound $xxx"
4984 yyy=`basename $xxx`
4985 libsfiles="$libsfiles $yyy"
1e127011 4986 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4987 case " $libsdirs " in
4988 *" $yyy "*) ;;
4989 *) libsdirs="$libsdirs $yyy" ;;
4990 esac
4991 ;;
bd9b35c9 4992 esac
f7dd4e7f 4993 break
613d6c3e 4994 fi
f7dd4e7f
JH
4995 done
4996 if $test ! -f "$xxx"; then
4997 echo "No -l$thislib."
bd9b35c9
JH
4998 fi
4999done
5000set X $dflt
5001shift
5002dflt="$*"
5003case "$libs" in
5004'') dflt="$dflt";;
5005*) dflt="$libs";;
5006esac
5007case "$dflt" in
5008' '|'') dflt='none';;
5009esac
4633a7c4 5010
bd9b35c9 5011$cat <<EOM
4633a7c4 5012
bd9b35c9
JH
5013In order to compile $package on your machine, a number of libraries
5014are usually needed. Include any other special libraries here as well.
5015Say "none" for none. The default list is almost always right.
8e07c86e 5016EOM
8e07c86e 5017
bd9b35c9
JH
5018echo " "
5019rp="What libraries to use?"
5020. ./myread
5021case "$ans" in
5022none) libs=' ';;
5023*) libs="$ans";;
5024esac
d71b2b6b 5025
bd9b35c9
JH
5026: determine optimization, if desired, or use for debug flag also
5027case "$optimize" in
5028' '|$undef) dflt='none';;
5029'') dflt='-O';;
5030*) dflt="$optimize";;
5031esac
5032$cat <<EOH
d71b2b6b 5033
bd9b35c9
JH
5034By default, $package compiles with the -O flag to use the optimizer.
5035Alternately, you might want to use the symbolic debugger, which uses
5036the -g flag (on traditional Unix systems). Either flag can be
5037specified here. To use neither flag, specify the word "none".
d71b2b6b 5038
bd9b35c9
JH
5039EOH
5040rp="What optimizer/debugger flag should be used?"
5041. ./myread
5042optimize="$ans"
5043case "$optimize" in
5044'none') optimize=" ";;
5045esac
5046
eaf812ae
MB
5047: Check what DEBUGGING is required from the command line
5048: -DEBUGGING or -DDEBUGGING or
5049: -DEBUGGING=both = -g + -DDEBUGGING
5050: -DEBUGGING=-g or -Doptimize=-g = -g
5051: -DEBUGGING=none or -UDEBUGGING =
5052: -DEBUGGING=old or -DEBUGGING=default = ? $optimize
5053case "$EBUGGING" in
5054'') ;;
5055*) DEBUGGING=$EBUGGING ;;
5056esac
5057
5058case "$DEBUGGING" in
5a7c70d6 5059-g|both|$define)
eaf812ae
MB
5060 case "$optimize" in
5061 *-g*) ;;
5062 *) optimize="$optimize -g" ;;
5063 esac ;;
5064none|$undef)
5065 case "$optimize" in
5066 *-g*) set `echo "X $optimize " | sed 's/ -g / /'`
5067 shift
5068 optimize="$*"
5069 ;;
5070 esac ;;
5071esac
5072
bd9b35c9 5073dflt=''
eaf812ae
MB
5074case "$DEBUGGING" in
5075both|$define) dflt='-DDEBUGGING'
5076esac
5077
c34316b3
NC
5078: argument order is deliberate, as the flag will start with - which set could
5079: think is an option
6682be1c 5080checkccflag='check=$1; flag=$2; callback=$3;
c34316b3
NC
5081echo " ";
5082echo "Checking if your compiler accepts $flag" 2>&1;
5083echo "int main(void) { return 0; }" > gcctest.c;
04b62921 5084if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
c34316b3 5085 echo "Yes, it does." 2>&1;
580e570e 5086 if $test -s gcctest.out ; then
04b62921
MB
5087 echo "But your platform does not like it:";
5088 cat gcctest.out;
5089 else
5090 case "$ccflags" in
5091 *$check*)
5092 echo "Leaving current flags $ccflags alone." 2>&1
5093 ;;
5094 *) dflt="$dflt $flag";
5095 eval $callback
5096 ;;
5097 esac
5098 fi
c34316b3
NC
5099else
5100 echo "Nope, it does not, but that is ok." 2>&1;
5101fi
5102'
5103
bd9b35c9
JH
5104: We will not override a previous value, but we might want to
5105: augment a hint file
5106case "$hint" in
5107default|recommended)
5108 case "$gccversion" in
eaf812ae 5109 1*) dflt="$dflt -fpcc-struct-return" ;;
d71b2b6b 5110 esac
eaf812ae
MB
5111 case "$optimize:$DEBUGGING" in
5112 *-g*:old) dflt="$dflt -DDEBUGGING";;
d71b2b6b 5113 esac
bd9b35c9 5114 case "$gccversion" in
580e570e 5115 2*) if $test -d /etc/conf/kconfig.d &&
bd9b35c9
JH
5116 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5117 then
00e89ad4 5118 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
5119 dflt="$dflt -posix"
5120 fi
f0d04425 5121 ;;
bd9b35c9
JH
5122 esac
5123 case "$gccversion" in
5124 1*) ;;
5125 2.[0-8]*) ;;
c0bacbef 5126 ?*) set strict-aliasing -fno-strict-aliasing
c34316b3 5127 eval $checkccflag
f0d04425 5128 ;;
e5e20432 5129 esac
00e89ad4
AD
5130 # For gcc, adding -pipe speeds up compilations for some, but apparently
5131 # some assemblers can't read from stdin. (It also slows down compilations
5132 # in other cases, but those are apparently rarer these days.) AD 5/2004.
5133 case "$gccversion" in
c34316b3
NC
5134 ?*) set pipe -pipe
5135 eval $checkccflag
00e89ad4
AD
5136 ;;
5137 esac
6682be1c
NC
5138
5139 # on x86_64 (at least) we require an extra library (libssp) in the
5140 # link command line. This library is not named, so I infer that it is
5141 # an implementation detail that may change. Hence the safest approach
5142 # is to add the flag to the flags passed to the compiler at link time,
5143 # as that way the compiler can do the right implementation dependant
5144 # thing. (NWC)
5145 case "$gccversion" in
8f68b0e6 5146 ?*) set stack-protector -fstack-protector
6682be1c
NC
5147 eval $checkccflag
5148 ;;
5149 esac
e5e20432
JH
5150 ;;
5151esac
5152
bd9b35c9
JH
5153case "$mips_type" in
5154*BSD*|'') inclwanted="$locincpth $usrinc";;
5155*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5156esac
5157for thisincl in $inclwanted; do
5158 if $test -d $thisincl; then
5159 if $test x$thisincl != x$usrinc; then
5160 case "$dflt" in
00e89ad4
AD
5161 *" -I$thisincl "*);;
5162 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
5163 esac
5164 fi
5165 fi
5166done
40a7a20a 5167
bd9b35c9
JH
5168inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5169 xxx=true;
5170elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5171 xxx=true;
5172else
5173 xxx=false;
5174fi;
5175if $xxx; then
5176 case "$dflt" in
5177 *$2*);;
5178 *) dflt="$dflt -D$2";;
5179 esac;
5180fi'
40a7a20a 5181
bd9b35c9 5182set signal.h LANGUAGE_C; eval $inctest
40a7a20a 5183
bd9b35c9
JH
5184case "$usesocks" in
5185$define)
5186 ccflags="$ccflags -DSOCKS"
5187 ;;
5188esac
40a7a20a 5189
bd9b35c9
JH
5190case "$hint" in
5191default|recommended) dflt="$ccflags $dflt" ;;
5192*) dflt="$ccflags";;
5193esac
40a7a20a 5194
bd9b35c9
JH
5195case "$dflt" in
5196''|' ') dflt=none;;
5197esac
422af00a 5198
bd9b35c9 5199$cat <<EOH
40a7a20a 5200
bd9b35c9
JH
5201Your C compiler may want other flags. For this question you should include
5202-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5203but you should NOT include libraries or ld flags like -lwhatever. If you
5204want $package to honor its debug switch, you should include -DDEBUGGING here.
5205Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 5206
bd9b35c9 5207To use no flags, specify the word "none".
40a7a20a 5208
bd9b35c9
JH
5209EOH
5210set X $dflt
5211shift
5212dflt=${1+"$@"}
5213rp="Any additional cc flags?"
5214. ./myread
5215case "$ans" in
5216none) ccflags='';;
5217*) ccflags="$ans";;
5218esac
8e07c86e 5219
bd9b35c9 5220: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
5221case "$cppflags" in
5222'') cppflags="$ccflags" ;;
5223*) cppflags="$cppflags $ccflags" ;;
5224esac
bd9b35c9
JH
5225case "$gccversion" in
52261*) cppflags="$cppflags -D__GNUC__"
4633a7c4 5227esac
bd9b35c9
JH
5228case "$mips_type" in
5229'');;
5230*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5231esac
5232case "$cppflags" in
5233'');;
5234*)
5235 echo " "
5236 echo "Let me guess what the preprocessor flags are..." >&4
5237 set X $cppflags
5238 shift
5239 cppflags=''
5240 $cat >cpp.c <<'EOM'
5241#define BLURFL foo
8e07c86e 5242
bd9b35c9
JH
5243BLURFL xx LFRULB
5244EOM
5245 previous=''
5246 for flag in $*
5247 do
5248 case "$flag" in
5249 -*) ftry="$flag";;
5250 *) ftry="$previous $flag";;
5251 esac
5252 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5253 >cpp1.out 2>/dev/null && \
5254 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5255 >cpp2.out 2>/dev/null && \
5256 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5257 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5258 then
5259 cppflags="$cppflags $ftry"
5260 previous=''
5261 else
5262 previous="$flag"
5263 fi
5264 done
5265 set X $cppflags
5266 shift
5267 cppflags=${1+"$@"}
5268 case "$cppflags" in
5269 *-*) echo "They appear to be: $cppflags";;
5270 esac
5271 $rm -f cpp.c cpp?.out
2afac517 5272 ;;
5273esac
8e07c86e 5274
bd9b35c9
JH
5275: flags used in final linking phase
5276case "$ldflags" in
5277'') if ./venix; then
5278 dflt='-i -z'
10a23457 5279 else
bd9b35c9 5280 dflt=''
10a23457 5281 fi
bd9b35c9
JH
5282 case "$ccflags" in
5283 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 5284 esac
bd9b35c9
JH
5285 ;;
5286*) dflt="$ldflags";;
5287esac
b2f871ed
AD
5288# See note above about -fstack-protector
5289case "$ccflags" in
5290*-fstack-protector*)
5291 case "$dflt" in
5292 *-fstack-protector*) ;; # Don't add it again
5293 *) dflt="$dflt -fstack-protector" ;;
5294 esac
5295 ;;
5296esac
bd9b35c9
JH
5297
5298: Try to guess additional flags to pick up local libraries.
5299for thislibdir in $libpth; do
5300 case " $loclibpth " in
5301 *" $thislibdir "*)
00e89ad4 5302 case "$dflt " in
bd9b35c9
JH
5303 *"-L$thislibdir "*) ;;
5304 *) dflt="$dflt -L$thislibdir" ;;
5305 esac
c4f23d77
AD
5306 ;;
5307 esac
bd9b35c9 5308done
c4f23d77 5309
bd9b35c9
JH
5310case "$dflt" in
5311'') dflt='none' ;;
5312esac
c4f23d77 5313
bd9b35c9
JH
5314$cat <<EOH
5315
5316Your C linker may need flags. For this question you should
5317include -L/whatever and any other flags used by the C linker, but you
5318should NOT include libraries like -lwhatever.
5319
5320Make sure you include the appropriate -L/path flags if your C linker
5321does not normally search all of the directories you specified above,
5322namely
5323 $libpth
5324To use no flags, specify the word "none".
5325
5326EOH
5327
5328rp="Any additional ld flags (NOT including libraries)?"
5329. ./myread
5330case "$ans" in
5331none) ldflags='';;
5332*) ldflags="$ans";;
5333esac
5334rmlist="$rmlist pdp11"
5335
5336: coherency check
5337echo " "
5338echo "Checking your choice of C compiler and flags for coherency..." >&4
5339$cat > try.c <<'EOF'
5340#include <stdio.h>
55954f19 5341int main() { printf("Ok\n"); return(0); }
bd9b35c9 5342EOF
7a282f6d 5343set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
5344shift
5345$cat >try.msg <<'EOM'
5346I've tried to compile and run the following simple program:
5347
5348EOM
5349$cat try.c >> try.msg
5350
5351$cat >> try.msg <<EOM
5352
5353I used the command:
5354
5355 $*
5440bc8e 5356 $run ./try
bd9b35c9
JH
5357
5358and I got the following output:
5359
5360EOM
5361dflt=y
73614538 5362if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
613d6c3e 5363 if $sh -c "$run ./try " >>try.msg 2>&1; then
5440bc8e 5364 xxx=`$run ./try`
bd9b35c9
JH
5365 case "$xxx" in
5366 "Ok") dflt=n ;;
5367 *) echo 'The program compiled OK, but produced no output.' >> try.msg
5368 case " $libs " in
5369 *" -lsfio "*)
5370 cat >> try.msg <<'EOQS'
5371If $libs contains -lsfio, and sfio is mis-configured, then it
5372sometimes (apparently) runs and exits with a 0 status, but with no
5373output! It may have to do with sfio's use of _exit vs. exit.
5374
5375EOQS
5376 rp="You have a big problem. Shall I abort Configure"
5377 dflt=y
5378 ;;
5379 esac
5380 ;;
5381 esac
5382 else
5383 echo "The program compiled OK, but exited with status $?." >>try.msg
5384 rp="You have a problem. Shall I abort Configure"
5385 dflt=y
5386 fi
5387else
5388 echo "I can't compile the test program." >>try.msg
5389 rp="You have a BIG problem. Shall I abort Configure"
5390 dflt=y
5391fi
5392case "$dflt" in
5393y)
5394 $cat try.msg >&4
5395 case "$knowitall" in
5396 '')
5397 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5398 ;;
bd9b35c9 5399 *) dflt=n;;
c4f23d77 5400 esac
bd9b35c9
JH
5401 echo " "
5402 . ./myread
5403 case "$ans" in
5404 n*|N*) ;;
5405 *) echo "Ok. Stopping Configure." >&4
5406 exit 1
c4f23d77
AD
5407 ;;
5408 esac
5409 ;;
bd9b35c9 5410n) echo "OK, that should do.";;
c4f23d77 5411esac
613d6c3e 5412$rm_try gcctest gcctest.out
c4f23d77 5413
bd9b35c9
JH
5414: define a shorthand compile call
5415compile='
5416mc_file=$1;
5417shift;
08593cf4
NC
5418case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5419echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5420exit 1;
5421fi;
5422esac;
08413ebc 5423$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5424: define a shorthand compile call for compilations that should be ok.
5425compile_ok='
5426mc_file=$1;
5427shift;
7a282f6d 5428$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5429
8dfa8df9
JH
5430: determine filename position in cpp output
5431echo " "
5432echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5433case "$osname" in
5434vos) testaccess=-e ;;
5435*) testaccess=-r ;;
5436esac
8dfa8df9
JH
5437echo '#include <stdio.h>' > foo.c
5438$cat >fieldn <<EOF
5439$startsh
5440$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5441$grep '^[ ]*#.*stdio\.h' | \
5442while read cline; do
5443 pos=1
5444 set \$cline
5445 while $test \$# -gt 0; do
a5a94ea5 5446 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5447 echo "\$pos"
5448 exit 0
5449 fi
5450 shift
5451 pos=\`expr \$pos + 1\`
5452 done
5453done
5454EOF
5455chmod +x fieldn
5456fieldn=`./fieldn`
5457$rm -f foo.c fieldn
5458case $fieldn in
5459'') pos='???';;
54601) pos=first;;
54612) pos=second;;
54623) pos=third;;
5463*) pos="${fieldn}th";;
5464esac
5465echo "Your cpp writes the filename in the $pos field of the line."
5466
3c728e00
JH
5467case "$osname" in
5468vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5c728af0 5469os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5470*) cppfilter='' ;;
5471esac
8dfa8df9
JH
5472: locate header file
5473$cat >findhdr <<EOF
5474$startsh
5475wanted=\$1
5476name=''
5477for usrincdir in $usrinc
5478do
5479 if test -f \$usrincdir/\$wanted; then
5480 echo "\$usrincdir/\$wanted"
5481 exit 0
5482 fi
5483done
5484awkprg='{ print \$$fieldn }'
5485echo "#include <\$wanted>" > foo\$\$.c
5486$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5487$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5488while read cline; do
5489 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5490 case "\$name" in
5491 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5492 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5493 *) exit 2;;
5494 esac;
5495done;
5496#
5497# status = 0: grep returned 0 lines, case statement not executed
5498# status = 1: headerfile found
5499# status = 2: while loop executed, no headerfile found
5500#
5501status=\$?
5502$rm -f foo\$\$.c;
5503if test \$status -eq 1; then
5504 exit 0;
5505fi
5506exit 1
5507EOF
5508chmod +x findhdr
5509
5510: define an alternate in-header-list? function
5511inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5512cont=true; xxf="echo \"<\$1> found.\" >&4";
5513case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5514*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5515esac;
5516case $# in 4) instead=instead;; *) instead="at last";; esac;
5517while $test "$cont"; do
5518 xxx=`./findhdr $1`
5519 var=$2; eval "was=\$$2";
5520 if $test "$xxx" && $test -r "$xxx";
5521 then eval $xxf;
5522 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5523 cont="";
5524 else eval $xxnf;
5525 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5526 set $yyy; shift; shift; yyy=$@;
5527 case $# in 0) cont="";;
5528 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5529 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5530 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5531 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5532 esac;
5533done;
5534while $test "$yyy";
5535do set $yyy; var=$2; eval "was=\$$2";
5536 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5537 set $yyy; shift; shift; yyy=$@;
5538done'
5539
d1daaddf
JH
5540: see if stdlib is available
5541set stdlib.h i_stdlib
5542eval $inhdr
5543
5544: check for lengths of integral types
5545echo " "
5546case "$intsize" in
5547'')
5548 echo "Checking to see how big your integers are..." >&4
c63dfae1 5549 $cat >try.c <<EOCP
d1daaddf
JH
5550#include <stdio.h>
5551#$i_stdlib I_STDLIB
5552#ifdef I_STDLIB
5553#include <stdlib.h>
5554#endif
5555int main()
5556{
5557 printf("intsize=%d;\n", (int)sizeof(int));
5558 printf("longsize=%d;\n", (int)sizeof(long));
5559 printf("shortsize=%d;\n", (int)sizeof(short));
5560 exit(0);
5561}
5562EOCP
5563 set try
5564 if eval $compile_ok && $run ./try > /dev/null; then
5565 eval `$run ./try`
5566 echo "Your integers are $intsize bytes long."
5567 echo "Your long integers are $longsize bytes long."
5568 echo "Your short integers are $shortsize bytes long."
5569 else
5570 $cat >&4 <<EOM
5571!
5572Help! I can't compile and run the intsize test program: please enlighten me!
5573(This is probably a misconfiguration in your system or libraries, and
5574you really ought to fix it. Still, I'll try anyway.)
5575!
5576EOM
5577 dflt=4
5578 rp="What is the size of an integer (in bytes)?"
5579 . ./myread
5580 intsize="$ans"
5581 dflt=$intsize
5582 rp="What is the size of a long integer (in bytes)?"
5583 . ./myread
5584 longsize="$ans"
5585 dflt=2
5586 rp="What is the size of a short integer (in bytes)?"
5587 . ./myread
5588 shortsize="$ans"
5589 fi
5590 ;;
5591esac
5b813a60 5592$rm_try
d1daaddf
JH
5593
5594: check for long long
5595echo " "
5596echo "Checking to see if you have long long..." >&4
5597echo 'int main() { long long x = 7; return 0; }' > try.c
5598set try
5599if eval $compile; then
5600 val="$define"
5601 echo "You have long long."
5602else
5603 val="$undef"
5604 echo "You do not have long long."
5605fi
5b813a60 5606$rm_try
d1daaddf
JH
5607set d_longlong
5608eval $setvar
5609
5610: check for length of long long
5611case "${d_longlong}${longlongsize}" in
5612$define)
5613 echo " "
5614 echo "Checking to see how big your long longs are..." >&4
5615 $cat >try.c <<'EOCP'
5616#include <stdio.h>
5617int main()
5618{
5619 printf("%d\n", (int)sizeof(long long));
5620 return(0);
5621}
5622EOCP
5623 set try
5624 if eval $compile_ok; then
5625 longlongsize=`$run ./try`
5626 echo "Your long longs are $longlongsize bytes long."
5627 else
5628 dflt='8'
5629 echo " "
5630 echo "(I can't seem to compile the test program. Guessing...)"
5631 rp="What is the size of a long long (in bytes)?"
5632 . ./myread
5633 longlongsize="$ans"
5634 fi
5635 if $test "X$longsize" = "X$longlongsize"; then
5636 echo "(That isn't any different from an ordinary long.)"
5b813a60 5637 fi
d1daaddf
JH
5638 ;;
5639esac
5b813a60 5640$rm_try
d1daaddf 5641
8dfa8df9
JH
5642: see if inttypes.h is available
5643: we want a real compile instead of Inhdr because some systems
5644: have an inttypes.h which includes non-existent headers
5645echo " "
5646$cat >try.c <<EOCP
5647#include <inttypes.h>
5648int main() {
5649 static int32_t foo32 = 0x12345678;
5650}
5651EOCP
5652set try
5653if eval $compile; then
5654 echo "<inttypes.h> found." >&4
5655 val="$define"
5656else
5657 echo "<inttypes.h> NOT found." >&4
5658 val="$undef"
5659fi
5b813a60 5660$rm_try
8dfa8df9
JH
5661set i_inttypes
5662eval $setvar
5663
5664: check for int64_t
5665echo " "
5666echo "Checking to see if you have int64_t..." >&4
5667$cat >try.c <<EOCP
5668#include <sys/types.h>
5669#$i_inttypes I_INTTYPES
5670#ifdef I_INTTYPES
5671#include <inttypes.h>
5672#endif
5673int main() { int64_t x = 7; }
5674EOCP
5675set try
5676if eval $compile; then
5677 val="$define"
5678 echo "You have int64_t."
5679else
5680 val="$undef"
5681 echo "You do not have int64_t."
5682fi
5b813a60 5683$rm_try
8dfa8df9
JH
5684set d_int64_t
5685eval $setvar
5686
613d6c3e 5687: Check if 64bit ints have a quad type
8dfa8df9
JH
5688echo " "
5689echo "Checking which 64-bit integer type we could use..." >&4
5690
5691case "$intsize" in
56928) val=int
5693 set quadtype
5694 eval $setvar
5695 val='"unsigned int"'
5696 set uquadtype
5697 eval $setvar
5698 quadkind=1
5699 ;;
5700*) case "$longsize" in
5701 8) val=long
5702 set quadtype
5703 eval $setvar
5704 val='"unsigned long"'
5705 set uquadtype
5706 eval $setvar
5707 quadkind=2
5708 ;;
5709 *) case "$d_longlong:$longlongsize" in
5710 define:8)
5711 val='"long long"'
5712 set quadtype
5713 eval $setvar
5714 val='"unsigned long long"'
5715 set uquadtype
5716 eval $setvar
5717 quadkind=3
5718 ;;
5719 *) case "$d_int64_t" in
5720 define)
5721 val=int64_t
5722 set quadtype
5723 eval $setvar
5724 val=uint64_t
5725 set uquadtype
5726 eval $setvar
5727 quadkind=4
5728 ;;
5729 esac
5730 ;;
5731 esac
5732 ;;
5733 esac
5734 ;;
5735esac
5736
5737case "$quadtype" in
5738'') echo "Alas, no 64-bit integer types in sight." >&4
5739 d_quad="$undef"
5740 ;;
5741*) echo "We could use '$quadtype' for 64-bit integers." >&4
5742 d_quad="$define"
5743 ;;
5744esac
5745
34f1896b 5746: Do we want 64bit support
b4eb6b3d
JH
5747case "$uselonglong" in
5748"$define"|true|[yY]*)
5749 cat <<EOM >&4
5750
5751*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5752EOM
5753 use64bitint="$define"
5754 ;;
613d6c3e 5755esac
b4eb6b3d
JH
5756case "$use64bits" in
5757"$define"|true|[yY]*)
5758 cat <<EOM >&4
5759
5760*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5761EOM
5762 use64bitint="$define"
5763 ;;
613d6c3e 5764esac
b4eb6b3d
JH
5765case "$use64bitints" in
5766"$define"|true|[yY]*)
5767 cat <<EOM >&4
5768
5769*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5770EOM
5771 use64bitint="$define"
5772 ;;
613d6c3e 5773esac
b4eb6b3d
JH
5774case "$use64bitsint" in
5775"$define"|true|[yY]*)
5776 cat <<EOM >&4
5777
5778*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5779EOM
5780 use64bitint="$define"
5781 ;;
613d6c3e 5782esac
b4eb6b3d
JH
5783case "$uselonglongs" in
5784"$define"|true|[yY]*)
5785 cat <<EOM >&4
5786
5787*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5788EOM
5789 use64bitint="$define"
5790 ;;
613d6c3e 5791esac
b4eb6b3d
JH
5792case "$use64bitsall" in
5793"$define"|true|[yY]*)
5794 cat <<EOM >&4
5795
5796*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5797EOM
5798 use64bitall="$define"
5799 ;;
613d6c3e 5800esac
b4eb6b3d
JH
5801
5802case "$ccflags" in
5803*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5804esac
5805case "$use64bitall" in
5806"$define"|true|[yY]*) use64bitint="$define" ;;
5807esac
5808
5809case "$longsize" in
58108) cat <<EOM
5811
5812You have natively 64-bit long integers.
5813EOM
5814 val="$define"
5815 ;;
5816*) case "$use64bitint" in
5817 "$define"|true|[yY]*) dflt='y';;
5818 *) dflt='n';;
5819 esac
8dfa8df9
JH
5820 case "$d_quad" in
5821 "$define") ;;
5822 *) dflt='n' ;;
5823 esac
b4eb6b3d
JH
5824 cat <<EOM
5825
5826Perl can be built to take advantage of 64-bit integer types
5827on some systems. To do so, Configure can be run with -Duse64bitint.
5828Choosing this option will most probably introduce binary incompatibilities.
5829
5830If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5831(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5832EOM
5833 rp='Try to use 64-bit integers, if available?'
5834 . ./myread
5835 case "$ans" in
5836 [yY]*) val="$define" ;;
5837 *) val="$undef" ;;
5838 esac
5839 ;;
5840esac
5841set use64bitint
5842eval $setvar
5843
5844case "$use64bitall" in
5845"$define"|true|[yY]*) dflt='y' ;;
5846*) case "$longsize" in
5847 8) dflt='y' ;;
5848 *) dflt='n' ;;
5849 esac
5850 ;;
613d6c3e 5851esac
b4eb6b3d
JH
5852cat <<EOM
5853
5854You may also choose to try maximal 64-bitness. It means using as much
585564-bitness as possible on the platform. This in turn means even more
5856binary incompatibilities. On the other hand, your platform may not
5857have any more 64-bitness available than what you already have chosen.
5858
5859If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5860(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5861EOM
5862rp='Try to use maximal 64-bit support, if available?'
5863. ./myread
5864case "$ans" in
5865[yY]*) val="$define" ;;
5866*) val="$undef" ;;
5867esac
5868set use64bitall
5869eval $setvar
5870case "$use64bitall" in
5871"$define")
5872 case "$use64bitint" in
5873 "$undef")
5874 cat <<EOM
5875
5876Since you have chosen a maximally 64-bit build, I'm also turning on
5877the use of 64-bit integers.
5878EOM
5879 use64bitint="$define" ;;
5880 esac
5881 ;;
5882esac
5883
b4eb6b3d
JH
5884: Look for a hint-file generated 'call-back-unit'. If the
5885: user has specified that a 64-bit perl is to be built,
5886: we may need to set or change some other defaults.
19a100ff 5887if $test -f use64bitint.cbu; then
9da7673b 5888 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
19a100ff
MB
5889 . ./use64bitint.cbu
5890fi
9da7673b
MB
5891case "$use64bitint" in
5892"$define"|true|[yY]*)
b4eb6b3d
JH
5893 case "$longsize" in
5894 4) case "$archname64" in
5895 '') archname64=64int ;;
5896 esac
5897 ;;
5898 esac
5899 ;;
5900esac
5901
b4eb6b3d
JH
5902: Look for a hint-file generated 'call-back-unit'. If the
5903: user has specified that a maximally 64-bit perl is to be built,
5904: we may need to set or change some other defaults.
19a100ff 5905if $test -f use64bitall.cbu; then
9da7673b 5906 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
19a100ff
MB
5907 . ./use64bitall.cbu
5908fi
9da7673b
MB
5909case "$use64bitall" in
5910"$define"|true|[yY]*)
b4eb6b3d
JH
5911 case "$longsize" in
5912 4) case "$archname64" in
5913 ''|64int) archname64=64all ;;
5914 esac
5915 ;;
5916 esac
5917 ;;
5918esac
5919
1911a026
JH
5920case "$d_quad:$use64bitint" in
5921$undef:$define)
5922 cat >&4 <<EOF
5923
5924*** You have chosen to use 64-bit integers,
19a100ff 5925*** but none can be found.
09b58c7b 5926*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
1911a026
JH
5927*** Cannot continue, aborting.
5928
5929EOF
5930 exit 1
5931 ;;
5932esac
5933
36adc09b
JH
5934: check for length of double
5935echo " "
5936case "$doublesize" in
5937'')
5938 echo "Checking to see how big your double precision numbers are..." >&4
5939 $cat >try.c <<EOCP
5940#include <stdio.h>
1911a026
JH
5941#$i_stdlib I_STDLIB
5942#ifdef I_STDLIB
5943#include <stdlib.h>
5944#endif
36adc09b
JH
5945int main()
5946{
5947 printf("%d\n", (int)sizeof(double));
1911a026 5948 exit(0);
36adc09b
JH
5949}
5950EOCP
5951 set try
5952 if eval $compile_ok; then
5953 doublesize=`$run ./try`
5954 echo "Your double is $doublesize bytes long."
5955 else
5956 dflt='8'
5957 echo "(I can't seem to compile the test program. Guessing...)"
5958 rp="What is the size of a double precision number (in bytes)?"
5959 . ./myread
5960 doublesize="$ans"
5961 fi
5962 ;;
5963esac
5b813a60 5964$rm_try
36adc09b
JH
5965
5966: check for long doubles
5967echo " "
5968echo "Checking to see if you have long double..." >&4
5969echo 'int main() { long double x = 7.0; }' > try.c
5970set try
5971if eval $compile; then
5972 val="$define"
5973 echo "You have long double."
5974else
5975 val="$undef"
5976 echo "You do not have long double."
5977fi
5b813a60 5978$rm_try
36adc09b
JH
5979set d_longdbl
5980eval $setvar
5981
5982: check for length of long double
5983case "${d_longdbl}${longdblsize}" in
5984$define)
5985 echo " "
5986 echo "Checking to see how big your long doubles are..." >&4
5987 $cat >try.c <<'EOCP'
5988#include <stdio.h>
5989int main()
5990{
5991 printf("%d\n", sizeof(long double));
5992}
5993EOCP
5994 set try
5995 set try
5996 if eval $compile; then
5997 longdblsize=`$run ./try`
5998 echo "Your long doubles are $longdblsize bytes long."
5999 else
6000 dflt='8'
6001 echo " "
6002 echo "(I can't seem to compile the test program. Guessing...)" >&4
6003 rp="What is the size of a long double (in bytes)?"
6004 . ./myread
6005 longdblsize="$ans"
6006 fi
6007 if $test "X$doublesize" = "X$longdblsize"; then
7ad90562
AD
6008 echo "That isn't any different from an ordinary double."
6009 echo "I'll keep your setting anyway, but you may see some"
6010 echo "harmless compilation warnings."
5b813a60 6011 fi
36adc09b
JH
6012 ;;
6013esac
5b813a60 6014$rm_try
36adc09b 6015
89ce900e 6016: determine the architecture name
b4eb6b3d 6017echo " "
89ce900e
JH
6018if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6019 tarch=`arch`"-$osname"
6020elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6021 if uname -m > tmparch 2>&1 ; then
6022 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6023 -e 's/$/'"-$osname/" tmparch`
6024 else
6025 tarch="$osname"
6026 fi
6027 $rm -f tmparch
b4eb6b3d 6028else
89ce900e 6029 tarch="$osname"
b4eb6b3d 6030fi
89ce900e
JH
6031case "$myarchname" in
6032''|"$tarch") ;;
6033*)
6034 echo "(Your architecture name used to be $myarchname.)"
6035 archname=''
6036 ;;
6037esac
6038case "$targetarch" in
6039'') ;;
6040*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6041esac
6042myarchname="$tarch"
6043case "$archname" in
6044'') dflt="$tarch";;
6045*) dflt="$archname";;
6046esac
6047rp='What is your architecture name'
6048. ./myread
6049archname="$ans"
6050case "$usethreads" in
6051$define)
6052 echo "Threads selected." >&4
6053 case "$archname" in
6054 *-thread*) echo "...and architecture name already has -thread." >&4
6055 ;;
6056 *) archname="$archname-thread"
6057 echo "...setting architecture name to $archname." >&4
6058 ;;
6059 esac
6060 ;;
6061esac
6062case "$usemultiplicity" in
6063$define)
6064 echo "Multiplicity selected." >&4
6065 case "$archname" in
6066 *-multi*) echo "...and architecture name already has -multi." >&4
6067 ;;
6068 *) archname="$archname-multi"
6069 echo "...setting architecture name to $archname." >&4
6070 ;;
6071 esac
6072 ;;
6073esac
6074case "$use64bitint$use64bitall" in
6075*"$define"*)
6076 case "$archname64" in
6077 '')
6078 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
bd9b35c9 6079 ;;
89ce900e
JH
6080 *)
6081 case "$use64bitint" in
6082 "$define") echo "64 bit integers selected." >&4 ;;
6083 esac
6084 case "$use64bitall" in
6085 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6086 esac
6087 case "$archname" in
6088 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6089 ;;
6090 *) archname="$archname-$archname64"
6091 echo "...setting architecture name to $archname." >&4
6092 ;;
6093 esac
c1a7f87b
JH
6094 ;;
6095 esac
89ce900e
JH
6096esac
6097case "$uselongdouble" in
6098$define)
6099 echo "Long doubles selected." >&4
6100 case "$longdblsize" in
6101 $doublesize)
6102 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6103 ;;
6104 *)
6105 case "$archname" in
6106 *-ld*) echo "...and architecture name already has -ld." >&4
6107 ;;
6108 *) archname="$archname-ld"
6109 echo "...setting architecture name to $archname." >&4
6110 ;;
6111 esac
bd9b35c9
JH
6112 ;;
6113 esac
bd9b35c9 6114 ;;
89ce900e
JH
6115esac
6116case "$useperlio" in
6117$define)
6118 echo "Perlio selected." >&4
6119 ;;
bd9b35c9 6120*)
89ce900e
JH
6121 echo "Perlio not selected, using stdio." >&4
6122 case "$archname" in
6123 *-stdio*) echo "...and architecture name already has -stdio." >&4
6124 ;;
6125 *) archname="$archname-stdio"
6126 echo "...setting architecture name to $archname." >&4
6127 ;;
6128 esac
bd9b35c9
JH
6129 ;;
6130esac
d2e0c6f7
JH
6131if $test -f archname.cbu; then
6132 echo "Your platform has some specific hints for architecture name, using them..."
6133 . ./archname.cbu
6134fi
bd9b35c9 6135
b4eb6b3d
JH
6136: set the prefixit variable, to compute a suitable default value
6137prefixit='case "$3" in
6138""|none)
6139 case "$oldprefix" in
6140 "") eval "$1=\"\$$2\"";;
6141 *)
6142 case "$3" in
6143 "") eval "$1=";;
6144 none)
6145 eval "tp=\"\$$2\"";
6146 case "$tp" in
6147 ""|" ") eval "$1=\"\$$2\"";;
6148 *) eval "$1=";;
6149 esac;;
6150 esac;;
6151 esac;;
6152*)
6153 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6154 case "$tp" in
6155 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6156 /*-$oldprefix/*|\~*-$oldprefix/*)
6157 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6158 *) eval "$1=\"\$$2\"";;
6159 esac;;
6160esac'
6161
f3f1a2d8
MB
6162: determine installation style
6163: For now, try to deduce it from prefix unless it is already set.
6164: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6165case "$installstyle" in
6166'') case "$prefix" in
6167 *perl*) dflt='lib';;
6168 *) dflt='lib/perl5' ;;
6169 esac
6170 ;;
6171*) dflt="$installstyle" ;;
4d20abad 6172esac
f3f1a2d8
MB
6173: Probably not worth prompting for this since we prompt for all
6174: the directories individually, and the prompt would be too long and
6175: confusing anyway.
6176installstyle=$dflt
4d20abad 6177
eaf812ae
MB
6178: determine where public executables go
6179echo " "
6180set dflt bin bin
6181eval $prefixit
6182fn=d~
6183rp='Pathname where the public executables will reside?'
6184. ./getfile
6185if $test "X$ansexp" != "X$binexp"; then
6186 installbin=''
6187fi
6188prefixvar=bin
6189: XXX Bug? -- ignores Configure -Dinstallprefix setting.
d0e36aa9 6190: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
a2d23ec2 6191: this via initialinstalllocation
eaf812ae
MB
6192. ./setprefixvar
6193
6194case "$userelocatableinc" in
6195$define|true|[yY]*) dflt='y' ;;
6196*) dflt='n' ;;
6197esac
6198cat <<EOM
6199
6200Would you like to build Perl so that the installation is relocatable, so that
6201library paths in @INC are determined relative to the path of the perl binary?
6202This is not advised for system Perl installs, or if you need to run setid
6203scripts or scripts under taint mode.
6204
6205If this doesn't make any sense to you, just accept the default '$dflt'.
6206EOM
6207rp='Use relocatable @INC?'
6208. ./myread
6209case "$ans" in
6210y|Y) val="$define" ;;
6211*) val="$undef" ;;
6212esac
6213set userelocatableinc
6214eval $setvar
6215
ea7d701d 6216initialinstalllocation="$binexp"
eaf812ae
MB
6217: Default prefix is now "up one level from where the binaries are"
6218case "$userelocatableinc" in
6219$define|true|[yY]*)
eaf812ae
MB
6220 bin=".../"
6221 binexp=".../"
6222 prefix=".../.."
6223 prefixexp=".../.."
6224 installprefixexp=".../.."
6225 ;;
6226esac
6227
b4eb6b3d
JH
6228: determine where private library files go
6229: Usual default is /usr/local/lib/perl5/$version.
f3f1a2d8 6230: Also allow things like /opt/perl/lib/$version, since
b4eb6b3d
JH
6231: /opt/perl/lib/perl5... would be redundant.
6232: The default "style" setting is made in installstyle.U
6233case "$installstyle" in
6234*lib/perl5*) set dflt privlib lib/$package/$version ;;
6235*) set dflt privlib lib/$version ;;
6236esac
6237eval $prefixit
6238$cat <<EOM
6239
6240There are some auxiliary files for $package that need to be put into a
6241private library directory that is accessible by everyone.
6242
6243EOM
eaf812ae 6244fn=$binexp
b4eb6b3d
JH
6245fn=d~+
6246rp='Pathname where the private library files will reside?'
6247. ./getfile
79522dd2
NC
6248prefixvar=privlib
6249. ./setprefixvar
b4eb6b3d
JH
6250
6251: set the prefixup variable, to restore leading tilda escape
6252prefixup='case "$prefixexp" in
6253"$prefix") ;;
6254*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6255esac'
6256
6257: determine where public architecture dependent libraries go
6258set archlib archlib
6259eval $prefixit
6260: privlib default is /usr/local/lib/$package/$version
6261: archlib default is /usr/local/lib/$package/$version/$archname
6262: privlib may have an optional trailing /share.
6263tdflt=`echo $privlib | $sed 's,/share$,,'`
6264tdflt=$tdflt/$archname
6265case "$archlib" in
6266'') dflt=$tdflt
6267 ;;
6268*) dflt="$archlib"
6269 ;;
6270esac
6271$cat <<EOM
6272
6273$spackage contains architecture-dependent library files. If you are
6274sharing libraries in a heterogeneous environment, you might store
6275these files in a separate location. Otherwise, you can just include
6276them with the rest of the public library files.
6277
6278EOM
eaf812ae 6279fn=$binexp
b4eb6b3d
JH
6280fn=d+~
6281rp='Where do you want to put the public architecture-dependent libraries?'
6282. ./getfile
79522dd2
NC
6283prefixvar=archlib
6284. ./setprefixvar
b4eb6b3d
JH
6285if $test X"$archlib" = X"$privlib"; then
6286 d_archlib="$undef"
6287else
6288 d_archlib="$define"
6289fi
b4eb6b3d 6290
b4eb6b3d
JH
6291: see if setuid scripts can be secure
6292$cat <<EOM
6293
6294Some kernels have a bug that prevents setuid #! scripts from being
6295secure. Some sites have disabled setuid #! scripts because of this.
6296
6297First let's decide if your kernel supports secure setuid #! scripts.
6298(If setuid #! scripts would be secure but have been disabled anyway,
6299don't say that they are secure if asked.)
6300
6301EOM
6302
6303val="$undef"
6304if $test -d /dev/fd; then
6305 echo "#!$ls" >reflect
6306 chmod +x,u+s reflect
6307 ./reflect >flect 2>&1
6308 if $contains "/dev/fd" flect >/dev/null; then
6309 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6310 val="$define"
6311 else
6312 $cat <<EOM
6313If you are not sure if they are secure, I can check but I'll need a
6314username and password different from the one you are using right now.
6315If you don't have such a username or don't want me to test, simply
6316enter 'none'.
6317
6318EOM
6319 rp='Other username to test security of setuid scripts with?'
6320 dflt='none'
6321 . ./myread
6322 case "$ans" in
6323 n|none)
6324 case "$d_suidsafe" in
6325 '') echo "I'll assume setuid scripts are *not* secure." >&4
6326 dflt=n;;
6327 "$undef")
6328 echo "Well, the $hint value is *not* secure." >&4
6329 dflt=n;;
6330 *) echo "Well, the $hint value *is* secure." >&4
6331 dflt=y;;
6332 esac
c1a7f87b 6333 ;;
b4eb6b3d
JH
6334 *)
6335 $rm -f reflect flect
6336 echo "#!$ls" >reflect
6337 chmod +x,u+s reflect
6338 echo >flect
6339 chmod a+w flect
6340 echo '"su" will (probably) prompt you for '"$ans's password."
6341 su $ans -c './reflect >flect'
6342 if $contains "/dev/fd" flect >/dev/null; then
6343 echo "Okay, it looks like setuid scripts are secure." >&4
6344 dflt=y
6345 else
6346 echo "I don't think setuid scripts are secure." >&4
6347 dflt=n
6348 fi
6349 ;;
6350 esac
6351 rp='Does your kernel have *secure* setuid scripts?'
6352 . ./myread
6353 case "$ans" in
6354 [yY]*) val="$define";;
6355 *) val="$undef";;
6356 esac
6357 fi
6358else
6359 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6360 echo "(That's for file descriptors, not floppy disks.)"
6361 val="$undef"
6362fi
6363set d_suidsafe
6364eval $setvar
6365
6366$rm -f reflect flect
6367
6368: now see if they want to do setuid emulation
6369echo " "
6370val="$undef"
6371case "$d_suidsafe" in
6372"$define")
6373 val="$undef"
3c728e00 6374 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d 6375 ;;
f3f1a2d8
MB
6376*)
6377 $cat <<EOM
6378Some systems have disabled setuid scripts, especially systems where
6379setuid scripts cannot be secure. On systems where setuid scripts have
6380been disabled, the setuid/setgid bits on scripts are currently
6381useless. It is possible for $package to detect those bits and emulate
6382setuid/setgid in a secure fashion. This emulation will only work if
6383setuid scripts have been disabled in your kernel.
6384
6385EOM
6386 case "$d_dosuid" in
6387 "$define") dflt=y ;;
6388 *) dflt=n ;;
6389 esac
6390 rp="Do you want to do setuid/setgid emulation?"
6391 . ./myread
6392 case "$ans" in
6393 [yY]*) val="$define";;
6394 *) val="$undef";;
6395 esac
6396 ;;
6397esac
6398set d_dosuid
6399eval $setvar
6400
f3f1a2d8
MB
6401: Find perl5.005 or later.
6402echo "Looking for a previously installed perl5.005 or later... "
6403case "$perl5" in
6404'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6405 : Check if this perl is recent and can load a simple module
6406 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6407 perl5=$tdir/perl
6408 break;
6409 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6410 perl5=$tdir/perl5
6411 break;
6412 fi
6413 done
6414 ;;
6415*) perl5="$perl5"
6416 ;;
6417esac
6418case "$perl5" in
6419'') echo "None found. That's ok.";;
6420*) echo "Using $perl5." ;;
6421esac
6422
613d6c3e 6423: Set the siteprefix variables
f3f1a2d8
MB
6424$cat <<EOM
6425
6426After $package is installed, you may wish to install various
6427add-on modules and utilities. Typically, these add-ons will
6428be installed under $prefix with the rest
6429of this package. However, you may wish to install such add-ons
6430elsewhere under a different prefix.
6431
6432If you do not wish to put everything under a single prefix, that's
6433ok. You will be prompted for the individual locations; this siteprefix
6434is only used to suggest the defaults.
6435
6436The default should be fine for most people.
6437
6438EOM
6439fn=d~+
6440rp='Installation prefix to use for add-on modules and utilities?'
6441: XXX Here might be another good place for an installstyle setting.
6442case "$siteprefix" in
6443'') dflt=$prefix ;;
6444*) dflt=$siteprefix ;;
6445esac
6446. ./getfile
6447: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6448oldsiteprefix=''
6449case "$siteprefix" in
6450'') ;;
6451*) case "$ans" in
6452 "$prefix") ;;
6453 *) oldsiteprefix="$prefix";;
6454 esac
6455 ;;
6456esac
6457siteprefix="$ans"
6458siteprefixexp="$ansexp"
6459
6460: determine where site specific libraries go.
6461: Usual default is /usr/local/lib/perl5/site_perl/$version
6462: The default "style" setting is made in installstyle.U
6463: XXX No longer works with Prefixit stuff.
6464prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6465case "$sitelib" in
6466'') case "$installstyle" in
6467 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6468 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6469 esac
6470 ;;
6471*) dflt="$sitelib"
6472 ;;
6473esac
6474$cat <<EOM
6475
6476The installation process will create a directory for
6477site-specific extensions and modules. Most users find it convenient
6478to place all site-specific files in this directory rather than in the
6479main distribution directory.
6480
6481EOM
6482fn=d~+
6483rp='Pathname for the site-specific library files?'
6484. ./getfile
6485prefixvar=sitelib
6486. ./setprefixvar
6487sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6488
6489: Determine list of previous versions to include in @INC
6490$cat > getverlist <<EOPL
6491#!$perl5 -w
6492use File::Basename;
6493\$api_versionstring = "$api_versionstring";
6494\$version = "$version";
6495\$stem = "$sitelib_stem";
6496\$archname = "$archname";
6497EOPL
6498 $cat >> getverlist <<'EOPL'
13cfc98d
MB
6499# The list found is store twice for each entry: the original name, and
6500# the binary broken down version as pack "sss", so sorting is easy and
6501# unambiguous. This will work for all versions that have a maximum of
6502# three digit groups, separate by '.'s or '_'s. Names are extended with
6503# ".0.0" to ensure at least three elements for the pack.
6504# -- H.Merijn Brand (m)'06 23-10-2006
6505
f3f1a2d8
MB
6506# Can't have leading @ because metaconfig interprets it as a command!
6507;@inc_version_list=();
6508# XXX Redo to do opendir/readdir?
6509if (-d $stem) {
6510 chdir($stem);
13cfc98d
MB
6511 ;@candidates = map {
6512 [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
f3f1a2d8
MB
6513}
6514else {
6515 ;@candidates = ();
6516}
6517
13cfc98d
MB
6518($pversion, $aversion, $vsn5005) = map {
6519 pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
f3f1a2d8 6520foreach $d (@candidates) {
13cfc98d
MB
6521 if ($d->[1] lt $pversion) {
6522 if ($d->[1] ge $aversion) {
6523 unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
f3f1a2d8 6524 }
13cfc98d
MB
6525 elsif ($d->[1] ge $vsn5005) {
6526 unshift(@inc_version_list, grep { -d } $d->[0]);
f3f1a2d8
MB
6527 }
6528 }
6529 else {
6530 # Skip newer version. I.e. don't look in
6531 # 5.7.0 if we're installing 5.6.1.
6532 }
6533}
6534
6535if (@inc_version_list) {
6536 print join(' ', @inc_version_list);
6537}
6538else {
6539 # Blank space to preserve value for next Configure run.
6540 print " ";
6541}
6542EOPL
6543chmod +x getverlist
6544case "$inc_version_list" in
6545'') if test -x "$perl5$exe_ext"; then
6546 dflt=`$perl5 getverlist`
6547 else
6548 dflt='none'
6549 fi
6550 ;;
6551$undef) dflt='none' ;;
6552*) eval dflt=\"$inc_version_list\" ;;
6553esac
6554case "$dflt" in
6555''|' ') dflt=none ;;
6556esac
6557case "$dflt" in
65585.005) dflt=none ;;
6559esac
6560$cat <<EOM
6561
6562In order to ease the process of upgrading, this version of perl
6563can be configured to use modules built and installed with earlier
6564versions of perl that were installed under $prefix. Specify here
6565the list of earlier versions that this version of perl should check.
6566If Configure detected no earlier versions of perl installed under
6567$prefix, then the list will be empty. Answer 'none' to tell perl
6568to not search earlier versions.
b4eb6b3d 6569
f3f1a2d8
MB
6570The default should almost always be sensible, so if you're not sure,
6571just accept the default.
b4eb6b3d 6572EOM
f3f1a2d8
MB
6573
6574rp='List of earlier versions to include in @INC?'
6575. ./myread
6576case "$ans" in
6577[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6578*) inc_version_list="$ans" ;;
6579esac
6580case "$inc_version_list" in
6581''|' ')
6582 inc_version_list_init='0'
6583 d_inc_version_list="$undef"
6584 ;;
6585*) inc_version_list_init=`echo $inc_version_list |
6586 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6587 d_inc_version_list="$define"
b4eb6b3d
JH
6588 ;;
6589esac
f3f1a2d8 6590$rm -f getverlist
b4eb6b3d 6591
1cd66f7c
DD
6592: see if malloc/malloc.h has to be included
6593set malloc/malloc.h i_mallocmalloc
6594eval $inhdr
6595
b4eb6b3d 6596: see if this is a malloc.h system
01d07975
YST
6597: we want a real compile instead of Inhdr because some systems have a
6598: malloc.h that just gives a compile error saying to use stdlib.h instead
6599echo " "
6600$cat >try.c <<EOCP
6601#include <stdlib.h>
6602#include <malloc.h>
f25eda10 6603#$i_mallocmalloc I_MALLOCMALLOC
1cd66f7c
DD
6604#ifdef I_MALLOCMALLOC
6605# include <malloc/malloc.h>
6606#endif
6607
01d07975
YST
6608int main () { return 0; }
6609EOCP
6610set try
6611if eval $compile; then
6612 echo "<malloc.h> found." >&4
6613 val="$define"
6614else
6615 echo "<malloc.h> NOT found." >&4
6616 val="$undef"
6617fi
5b813a60 6618$rm_try
01d07975
YST
6619set i_malloc
6620eval $setvar
b4eb6b3d 6621
c8b93cf9
JH
6622: check for void type
6623echo " "
6624echo "Checking to see how well your C compiler groks the void type..." >&4
6625case "$voidflags" in
6626'')
c727eafa 6627 $cat >try.c <<EOCP
d1daaddf
JH
6628#$i_stdlib I_STDLIB
6629#ifdef I_STDLIB
6630#include <stdlib.h>
6631#endif
c8b93cf9
JH
6632#if TRY & 1
6633void sub() {
6634#else
6635sub() {
6636#endif
6637 extern void moo(); /* function returning void */
6638 void (*goo)(); /* ptr to func returning void */
6639#if TRY & 8
6640 void *hue; /* generic ptr */
6641#endif
6642#if TRY & 2
6643 void (*foo[10])();
6644#endif
6645
6646#if TRY & 4
6647 if(goo == moo) {
6648 exit(0);
6649 }
6650#endif
6651 exit(0);
6652}
6653int main() { sub(); }
6654EOCP
6655 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6656 voidflags=$defvoidused
6657 echo "Good. It appears to support void to the level $package wants.">&4
6658 if $contains warning .out >/dev/null 2>&1; then
6659 echo "However, you might get some warnings that look like this:"
6660 $cat .out
6661 fi
6662 else
6663echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6664 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6665 echo "It supports 1..."
6666 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6667 echo "It also supports 2..."
6668 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6669 voidflags=7
6670 echo "And it supports 4 but not 8 definitely."
6671 else
6672 echo "It doesn't support 4..."
6673 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6674 voidflags=11
6675 echo "But it supports 8."
6676 else
6677 voidflags=3
6678 echo "Neither does it support 8."
6679 fi
6680 fi
6681 else
6682 echo "It does not support 2..."
6683 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6684 voidflags=13
6685 echo "But it supports 4 and 8."
6686 else
6687 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6688 voidflags=5
6689 echo "And it supports 4 but has not heard about 8."
6690 else
6691 echo "However it supports 8 but not 4."
6692 fi
6693 fi
6694 fi
6695 else
6696 echo "There is no support at all for void."
6697 voidflags=0
6698 fi
6699 fi
6700esac
6701case "$voidflags" in
6702"$defvoidused") ;;
6703*) $cat >&4 <<'EOM'
6704 Support flag bits are:
6705 1: basic void declarations.
6706 2: arrays of pointers to functions returning void.
6707 4: operations between pointers to and addresses of void functions.
6708 8: generic void pointers.
6709EOM
6710 dflt="$voidflags";
6711 rp="Your void support flags add up to what?"
6712 . ./myread
6713 voidflags="$ans"
6714 ;;
6715esac
5b813a60 6716$rm_try
c8b93cf9
JH
6717
6718: check for length of pointer
6719echo " "
6720case "$ptrsize" in
6721'')
6722 echo "Checking to see how big your pointers are..." >&4
6723 if test "$voidflags" -gt 7; then
6724 echo '#define VOID_PTR char *' > try.c
6725 else
6726 echo '#define VOID_PTR void *' > try.c
6727 fi
74d00865 6728 $cat >>try.c <<EOCP
c8b93cf9 6729#include <stdio.h>
d1daaddf
JH
6730#$i_stdlib I_STDLIB
6731#ifdef I_STDLIB
6732#include <stdlib.h>
6733#endif
c8b93cf9
JH
6734int main()
6735{
6736 printf("%d\n", (int)sizeof(VOID_PTR));
6737 exit(0);
6738}
6739EOCP
6740 set try
6741 if eval $compile_ok; then
6742 ptrsize=`$run ./try`
6743 echo "Your pointers are $ptrsize bytes long."
6744 else
6745 dflt='4'
6746 echo "(I can't seem to compile the test program. Guessing...)" >&4
6747 rp="What is the size of a pointer (in bytes)?"
6748 . ./myread
6749 ptrsize="$ans"
6750 fi
6751 ;;
6752esac
5b813a60 6753$rm_try
c8b93cf9
JH
6754case "$use64bitall" in
6755"$define"|true|[yY]*)
6756 case "$ptrsize" in
6757 4) cat <<EOM >&4
6758
1911a026
JH
6759*** You have chosen a maximally 64-bit build,
6760*** but your pointers are only 4 bytes wide.
09b58c7b
JH
6761*** Please rerun Configure without -Duse64bitall.
6762EOM
6763 case "$d_quad" in
6764 define)
6765 cat <<EOM >&4
6766*** Since you have quads, you could possibly try with -Duse64bitint.
6767EOM
6768 ;;
6769 esac
6770 cat <<EOM >&4
1911a026 6771*** Cannot continue, aborting.
c8b93cf9
JH
6772
6773EOM
09b58c7b 6774
1911a026 6775 exit 1
c8b93cf9
JH
6776 ;;
6777 esac
6778 ;;
6779esac
6780
19a100ff 6781
9df442c2
NC
6782: determine whether to use malloc wrapping
6783echo " "
6784case "$usemallocwrap" in
6785[yY]*|true|$define) dflt='y' ;;
6786[nN]*|false|$undef) dflt='n' ;;
6787*) case "$usedevel" in
6788 [yY]*|true|$define) dflt='y' ;;
6789 *) dflt='n' ;;
6790 esac
6791 ;;
6792esac
6793rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6794. ./myread
6795usemallocwrap="$ans"
6796case "$ans" in
6797y*|true)
6798 usemallocwrap="$define" ;;
6799*)
6800 usemallocwrap="$undef" ;;
6801esac
c8b93cf9 6802
b4eb6b3d
JH
6803: determine which malloc to compile in
6804echo " "
6805case "$usemymalloc" in
c4163172
JH
6806[yY]*|true|$define) dflt='y' ;;
6807[nN]*|false|$undef) dflt='n' ;;
6808*) case "$ptrsize" in
6809 4) dflt='y' ;;
6810 *) dflt='n' ;;
6811 esac
6812 ;;
8dfa8df9 6813esac
b4eb6b3d
JH
6814rp="Do you wish to attempt to use the malloc that comes with $package?"
6815. ./myread
6816usemymalloc="$ans"
6817case "$ans" in
6818y*|true)
6819 usemymalloc='y'
6820 mallocsrc='malloc.c'
6821 mallocobj="malloc$_o"
6822 d_mymalloc="$define"
6823 case "$libs" in
6824 *-lmalloc*)
6825 : Remove malloc from list of libraries to use
6826 echo "Removing unneeded -lmalloc from library list" >&4
6827 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6828 shift
6829 libs="$*"
6830 echo "libs = $libs" >&4
6831 ;;
6832 esac
6833 ;;
6834*)
6835 usemymalloc='n'
6836 mallocsrc=''
6837 mallocobj=''
6838 d_mymalloc="$undef"
6839 ;;
6840esac
6841
6842: compute the return types of malloc and free
6843echo " "
6844$cat >malloc.c <<END
6845#$i_malloc I_MALLOC
6846#$i_stdlib I_STDLIB
6847#include <stdio.h>
6848#include <sys/types.h>
6849#ifdef I_MALLOC
6850#include <malloc.h>
6851#endif
6852#ifdef I_STDLIB
6853#include <stdlib.h>
6854#endif
6855#ifdef TRY_MALLOC
6856void *malloc();
6857#endif
6858#ifdef TRY_FREE
6859void free();
6860#endif
6861END
6862case "$malloctype" in
6863'')
6864 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6865 malloctype='void *'
6866 else
6867 malloctype='char *'
6868 fi
6869 ;;
6870esac
6871echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6872
6873case "$freetype" in
6874'')
6875 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6876 freetype='void'
6877 else
6878 freetype='int'
6879 fi
6880 ;;
6881esac
6882echo "Your system uses $freetype free(), it would seem." >&4
6883$rm -f malloc.[co]
b4eb6b3d
JH
6884: determine where site specific architecture-dependent libraries go.
6885: sitelib default is /usr/local/lib/perl5/site_perl/$version
6886: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6887: sitelib may have an optional trailing /share.
6888case "$sitearch" in
6889'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6890 dflt="$dflt/$archname"
6891 ;;
6892*) dflt="$sitearch"
6893 ;;
6894esac
6895set sitearch sitearch none
6896eval $prefixit
6897$cat <<EOM
6898
6899The installation process will also create a directory for
6900architecture-dependent site-specific extensions and modules.
6901
6902EOM
6903fn=d~+
6904rp='Pathname for the site-specific architecture-dependent library files?'
6905. ./getfile
79522dd2
NC
6906prefixvar=sitearch
6907. ./setprefixvar
c95d0e17
GA
6908if $test X"$sitearch" = X"$sitelib"; then
6909 d_sitearch="$undef"
6910else
6911 d_sitearch="$define"
6912fi
b4eb6b3d 6913
613d6c3e 6914: Set the vendorprefix variables
b4eb6b3d
JH
6915$cat <<EOM
6916
6917The installation process will also create a directory for
6918vendor-supplied add-ons. Vendors who supply perl with their system
6919may find it convenient to place all vendor-supplied files in this
6920directory rather than in the main distribution directory. This will
6921ease upgrades between binary-compatible maintenance versions of perl.
6922
6923Of course you may also use these directories in whatever way you see
6924fit. For example, you might use them to access modules shared over a
6925company-wide network.
6926
6927The default answer should be fine for most people.
6928This causes further questions about vendor add-ons to be skipped
6929and no vendor-specific directories will be configured for perl.
6930
6931EOM
6932rp='Do you want to configure vendor-specific add-on directories?'
6933case "$usevendorprefix" in
6934define|true|[yY]*) dflt=y ;;
6935*) : User may have set vendorprefix directly on Configure command line.
6936 case "$vendorprefix" in
6937 ''|' ') dflt=n ;;
6938 *) dflt=y ;;
6939 esac
6940 ;;
6941esac
6942. ./myread
6943case "$ans" in
6944[yY]*) fn=d~+
6945 rp='Installation prefix to use for vendor-supplied add-ons?'
6946 case "$vendorprefix" in
6947 '') dflt='' ;;
6948 *) dflt=$vendorprefix ;;
6949 esac
6950 . ./getfile
6951 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6952 oldvendorprefix=''
6953 case "$vendorprefix" in
6954 '') ;;
6955 *) case "$ans" in
6956 "$prefix") ;;
6957 *) oldvendorprefix="$prefix";;
6958 esac
6959 ;;
6960 esac
6961 usevendorprefix="$define"
6962 vendorprefix="$ans"
6963 vendorprefixexp="$ansexp"
6964 ;;
6965*) usevendorprefix="$undef"
6966 vendorprefix=''
6967 vendorprefixexp=''
6968 ;;
6969esac
6970
613d6c3e 6971: Set the vendorlib variables
b4eb6b3d
JH
6972case "$vendorprefix" in
6973'') d_vendorlib="$undef"
6974 vendorlib=''
6975 vendorlibexp=''
6976 ;;
6977*) d_vendorlib="$define"
6978 : determine where vendor-supplied modules go.
6979 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6980 case "$vendorlib" in
6981 '')
6982 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6983 case "$installstyle" in
6984 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6985 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6986 esac
6987 ;;
6988 *) dflt="$vendorlib"
6989 ;;
6990 esac
6991 fn=d~+
6992 rp='Pathname for the vendor-supplied library files?'
6993 . ./getfile
6994 vendorlib="$ans"
6995 vendorlibexp="$ansexp"
6996 ;;
6997esac
6998vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
a092d240
NC
6999prefixvar=vendorlib
7000. ./installprefix
b4eb6b3d 7001
613d6c3e 7002: Set the vendorarch variables
b4eb6b3d
JH
7003case "$vendorprefix" in
7004'') d_vendorarch="$undef"
7005 vendorarch=''
7006 vendorarchexp=''
7007 ;;
7008*) d_vendorarch="$define"
7009 : determine where vendor-supplied architecture-dependent libraries go.
7010 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
7011 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7012 : vendorlib may have an optional trailing /share.
7013 case "$vendorarch" in
7014 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
7015 dflt="$dflt/$archname"
7016 ;;
7017 *) dflt="$vendorarch" ;;
7018 esac
7019 fn=d~+
7020 rp='Pathname for vendor-supplied architecture-dependent files?'
7021 . ./getfile
7022 vendorarch="$ans"
7023 vendorarchexp="$ansexp"
7024 ;;
7025esac
a092d240
NC
7026prefixvar=vendorarch
7027. ./installprefix
1be1b388
MB
7028if $test X"$vendorarch" = X"$vendorlib"; then
7029 d_vendorarch="$undef"
7030else
7031 d_vendorarch="$define"
7032fi
b4eb6b3d
JH
7033
7034: Final catch-all directories to search
7035$cat <<EOM
7036
7037Lastly, you can have perl look in other directories for extensions and
7038modules in addition to those already specified.
7039These directories will be searched after
7040 $sitearch
7041 $sitelib
7042EOM
7043test X"$vendorlib" != "X" && echo ' ' $vendorlib
7044test X"$vendorarch" != "X" && echo ' ' $vendorarch
7045echo ' '
7046case "$otherlibdirs" in
7047''|' ') dflt='none' ;;
7048*) dflt="$otherlibdirs" ;;
7049esac
7050$cat <<EOM
7051Enter a colon-separated set of extra paths to include in perl's @INC
7052search path, or enter 'none' for no extra paths.
7053
7054EOM
7055
7056rp='Colon-separated list of additional directories for perl to search?'
7057. ./myread
7058case "$ans" in
7059' '|''|none) otherlibdirs=' ' ;;
7060*) otherlibdirs="$ans" ;;
7061esac
7062case "$otherlibdirs" in
7063' ') val=$undef ;;
7064*) val=$define ;;
7065esac
7066set d_perl_otherlibdirs
7067eval $setvar
7068
7069: Cruising for prototypes
7070echo " "
7071echo "Checking out function prototypes..." >&4
55954f19
JH
7072$cat >prototype.c <<EOCP
7073#$i_stdlib I_STDLIB
7074#ifdef I_STDLIB
7075#include <stdlib.h>
7076#endif
b4eb6b3d
JH
7077int main(int argc, char *argv[]) {
7078 exit(0);}
7079EOCP
7080if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7081 echo "Your C compiler appears to support function prototypes."
7082 val="$define"
7083else
7084 echo "Your C compiler doesn't seem to understand function prototypes."
7085 val="$undef"
7086fi
7087set prototype
7088eval $setvar
7089$rm -f prototype*
7090
613d6c3e 7091: Check if ansi2knr is required
b4eb6b3d
JH
7092case "$prototype" in
7093"$define") ;;
7094*) ansi2knr='ansi2knr'
7095 echo " "
7096 cat <<EOM >&4
7097
7098$me: FATAL ERROR:
7099This version of $package can only be compiled by a compiler that
7100understands function prototypes. Unfortunately, your C compiler
7101 $cc $ccflags
7102doesn't seem to understand them. Sorry about that.
7103
7104If GNU cc is available for your system, perhaps you could try that instead.
7105
7106Eventually, we hope to support building Perl with pre-ANSI compilers.
7107If you would like to help in that effort, please contact <perlbug@perl.org>.
7108
7109Aborting Configure now.
7110EOM
7111 exit 2
7112 ;;
7113esac
7114
34f1896b
MB
7115: DTrace support
7116dflt_dtrace='/usr/sbin/dtrace'
7117cat <<EOM
7118
7119Perl can be built to support DTrace on platforms that support it.
7120DTrace is a diagnosis and performance analysis tool from Sun.
7121
7122If this doesn't make any sense to you, just accept the default '$dflt'.
7123EOM
7124
7125while $test 1 ; do
7126 case "$usedtrace" in
7127 $define|true|[yY]*)
7128 dflt='y'
7129 ;;
7130 ?*)
7131 dflt='y'
7132 dflt_dtrace=$usedtrace
7133 ;;
7134 *)
7135 dflt='n'
7136 ;;
7137 esac
7138
7139 rp='Support DTrace if available?'
7140 . ./myread
7141 case "$ans" in
7142 y|Y) val="$define" ;;
7143 *) val="$undef" ;;
7144 esac
7145 set usedtrace
7146 eval $setvar
7147
7148 test "X$usedtrace" != "X$define" && break
7149
7150 echo " "
7151 rp='Where is the dtrace executable?'
7152 dflt=$dflt_dtrace
7153 . ./getfile
7154 val="$ans"
7155 set dtrace
7156 eval $setvar
7157
7158 if $test -f $dtrace
7159 then
7160 if $dtrace -h -s ../perldtrace.d \
7161 -o perldtrace.tmp >/dev/null 2>&1 \
7162 && rm -f perldtrace.tmp
7163 then
7164 echo " "
7165 echo "Good: your $dtrace knows about the -h flag."
7166 else
7167 cat >&2 <<EOM
7168
7169*** $me: Fatal Error: $dtrace doesn't support -h flag
7170***
7171*** Your installed dtrace doesn't support the -h switch to compile a D
7172*** program into a C header. Can't continue.
7173
7174EOM
7175 exit 1
7176 fi
7177 break;
7178 fi
7179
7180 case "$fastread" in
7181 yes)
7182 cat >&2 <<EOM
7183
7184*** $me: Fatal Error: $dtrace not found.
7185*** Can't continue.
7186
7187EOM
7188 exit 1
7189 ;;
7190 *)
7191 echo "*** $dtrace was not found."
7192 echo " "
7193 ;;
7194 esac
7195done
7196
613d6c3e 7197: See if we want extra modules installed
6fcddf3b 7198echo " "
6fcddf3b 7199case "$extras" in
bf35c3f6
JH
7200'') dflt='n';;
7201*) dflt='y';;
6fcddf3b
JH
7202esac
7203cat <<EOM
7204Perl can be built with extra modules or bundles of modules which
7205will be fetched from the CPAN and installed alongside Perl.
7206
7207Notice that you will need access to the CPAN; either via the Internet,
7208or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
7209be asked later to configure the CPAN.pm module which will in turn do
7210the installation of the rest of the extra modules or bundles.)
7211
7212Notice also that if the modules require any external software such as
dd2de242
JH
7213libraries and headers (the libz library and the zlib.h header for the
7214Compress::Zlib module, for example) you MUST have any such software
7215already installed, this configuration process will NOT install such
7216things for you.
6fcddf3b
JH
7217
7218If this doesn't make any sense to you, just accept the default '$dflt'.
7219EOM
dd2de242 7220rp='Install any extra modules (y or n)?'
6fcddf3b
JH
7221. ./myread
7222case "$ans" in
7223y|Y)
7224 cat <<EOM
7225
7226Please list any extra modules or bundles to be installed from CPAN,
7227with spaces between the names. The names can be in any format the
dd2de242
JH
7228'install' command of CPAN.pm will understand. (Answer 'none',
7229without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
7230EOM
7231 rp='Extras?'
7232 dflt="$extras"
7233 . ./myread
7234 extras="$ans"
7235esac
7236case "$extras" in
7237''|'none')
7238 val=''
7239 $rm -f ../extras.lst
7240 ;;
7241*) echo "(Saving the list of extras for later...)"
dd2de242
JH
7242 echo "$extras" > ../extras.lst
7243 val="'$extras'"
6fcddf3b
JH
7244 ;;
7245esac
7246set extras
7247eval $setvar
7248echo " "
7249
6e1038e0
MB
7250: determine where html pages for programs go
7251set html1dir html1dir none
7252eval $prefixit
7253$cat <<EOM
7254
f3f1a2d8 7255If you wish to install html files for programs in $spackage, indicate
6e1038e0
MB
7256the appropriate directory here. To skip installing html files,
7257answer "none".
7258EOM
7259case "$html1dir" in
7260''|none|$undef|' ') dflt=none ;;
7261*) dflt=$html1dir ;;
7262esac
7263fn=dn+~
7264rp="Directory for the main $spackage html pages?"
7265. ./getfile
79522dd2
NC
7266prefixvar=html1dir
7267. ./setprefixvar
6e1038e0
MB
7268: Use ' ' for none so value is preserved next time through Configure
7269$test X"$html1dir" = "X" && html1dir=' '
6e1038e0
MB
7270
7271: determine where html pages for libraries and modules go
7272set html3dir html3dir none
7273eval $prefixit
7274$cat <<EOM
7275
7276If you wish to install html files for modules associated with $spackage,
7277indicate the appropriate directory here. To skip installing html files,
7278answer "none".
7279EOM
7280: There is no obvious default. If they have specified html1dir, then
7281: try to key off that, possibly changing .../html1 into .../html3.
7282case "$html3dir" in
7283'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7284*) dflt=$html3dir ;;
7285esac
7286fn=dn+~
7287rp="Directory for the $spackage module html pages?"
7288. ./getfile
79522dd2
NC
7289prefixvar=html3dir
7290. ./setprefixvar
6e1038e0
MB
7291: Use ' ' for none so value is preserved next time through Configure
7292$test X"$html3dir" = "X" && html3dir=' '
6e1038e0 7293
89ce900e
JH
7294: determine whether to install perl also as /usr/bin/perl
7295
7296echo " "
7297if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7298 $cat <<EOM
7299Many scripts expect perl to be installed as /usr/bin/perl.
7300
7301If you want to, I can install the perl you are about to compile
7302as /usr/bin/perl (in addition to $bin/perl).
7303EOM
7304 if test -f /usr/bin/perl; then
7305 $cat <<EOM
7306
7307However, please note that because you already have a /usr/bin/perl,
7308overwriting that with a new Perl would very probably cause problems.
7309Therefore I'm assuming you don't want to do that (unless you insist).
7310
7311EOM
7312 case "$installusrbinperl" in
7313 "$define"|[yY]*) dflt='y';;
7314 *) dflt='n';;
7315 esac
7316 else
7317 $cat <<EOM
7318
7319Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7320
7321EOM
7322 case "$installusrbinperl" in
7323 "$undef"|[nN]*) dflt='n';;
7324 *) dflt='y';;
7325 esac
7326 fi
7327 rp="Do you want to install perl as /usr/bin/perl?"
7328 . ./myread
7329 case "$ans" in
7330 [yY]*) val="$define";;
7331 *) val="$undef" ;;
7332 esac
7333else
7334 val="$undef"
7335fi
7336set installusrbinperl
7337eval $setvar
7338
613d6c3e 7339: Check if we are using the GNU C library
89ce900e
JH
7340echo " "
7341echo "Checking for GNU C Library..." >&4
7342cat >try.c <<'EOCP'
7343/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7344 alone are insufficient to distinguish different versions, such as
7345 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7346 libc version 2.1.0. A. Dougherty, June 3, 2002.
7347*/
7348#include <stdio.h>
7349int main(void)
7350{
7351#ifdef __GLIBC__
7352# ifdef __GLIBC_MINOR__
4fb7dc7d 7353# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
89ce900e
JH
7354# include <gnu/libc-version.h>
7355 printf("%s\n", gnu_get_libc_version());
7356# else
7357 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7358# endif
7359# else
7360 printf("%d\n", __GLIBC__);
7361# endif
7362 return 0;
7363#else
7364 return 1;
7365#endif
7366}
7367EOCP
7368set try
7369if eval $compile_ok && $run ./try > glibc.ver; then
7370 val="$define"
7371 gnulibc_version=`$cat glibc.ver`
7372 echo "You are using the GNU C Library version $gnulibc_version"
7373else
7374 val="$undef"
7375 gnulibc_version=''
7376 echo "You are not using the GNU C Library"
7377fi
5b813a60 7378$rm_try glibc.ver
89ce900e
JH
7379set d_gnulibc
7380eval $setvar
7381
7382: see if nm is to be used to determine whether a symbol is defined or not
7383case "$usenm" in
7384'')
7385 dflt=''
7386 case "$d_gnulibc" in
7387 "$define")
7388 echo " "
7389 echo "nm probably won't work on the GNU C Library." >&4
7390 dflt=n
7391 ;;
7392 esac
7393 case "$dflt" in
7394 '')
7395 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7396 echo " "
7397 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7398 echo "'nm' won't be sufficient on this sytem." >&4
7399 dflt=n
7400 fi
7401 ;;
7402 esac
7403 case "$dflt" in
7404 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7405 if $test $dflt -gt 20; then
7406 dflt=y
7407 else
7408 dflt=n
7409 fi
7410 ;;
7411 esac
b4eb6b3d 7412 ;;
89ce900e
JH
7413*)
7414 case "$usenm" in
7415 true|$define) dflt=y;;
7416 *) dflt=n;;
7417 esac
b4eb6b3d
JH
7418 ;;
7419esac
89ce900e 7420$cat <<EOM
b4eb6b3d 7421
89ce900e
JH
7422I can use $nm to extract the symbols from your C libraries. This
7423is a time consuming task which may generate huge output on the disk (up
7424to 3 megabytes) but that should make the symbols extraction faster. The
7425alternative is to skip the 'nm' extraction part and to compile a small
7426test program instead to determine whether each symbol is present. If
7427you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7428this may be the best solution.
b4eb6b3d 7429
89ce900e 7430You probably shouldn't let me use 'nm' if you are using the GNU C Library.
b4eb6b3d 7431
89ce900e
JH
7432EOM
7433rp="Shall I use $nm to extract C symbols from the libraries?"
7434. ./myread
7435case "$ans" in
7436[Nn]*) usenm=false;;
7437*) usenm=true;;
b4eb6b3d 7438esac
89ce900e
JH
7439
7440runnm=$usenm
7441case "$reuseval" in
7442true) runnm=false;;
b4eb6b3d 7443esac
b4eb6b3d 7444
89ce900e
JH
7445: nm options which may be necessary
7446case "$nm_opt" in
7447'') if $test -f /mach_boot; then
7448 nm_opt='' # Mach
7449 elif $test -d /usr/ccs/lib; then
7450 nm_opt='-p' # Solaris (and SunOS?)
7451 elif $test -f /dgux; then
7452 nm_opt='-p' # DG-UX
7453 elif $test -f /lib64/rld; then
7454 nm_opt='-p' # 64-bit Irix
7455 else
7456 nm_opt=''
7457 fi;;
7458esac
b4eb6b3d 7459
89ce900e
JH
7460: nm options which may be necessary for shared libraries but illegal
7461: for archive libraries. Thank you, Linux.
7462case "$nm_so_opt" in
7463'') case "$myuname" in
fb2e1bc0 7464 *linux*|gnu*)
89ce900e
JH
7465 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7466 nm_so_opt='--dynamic'
7467 fi
7468 ;;
7469 esac
7470 ;;
7471esac
b4eb6b3d 7472
1d8eaf8c 7473: Figure out where the libc is located
89ce900e
JH
7474case "$runnm" in
7475true)
1d8eaf8c 7476: get list of predefined functions in a handy place
89ce900e
JH
7477echo " "
7478case "$libc" in
7479'') libc=unknown
7480 case "$libs" in
7481 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7482 esac
7483 ;;
b4eb6b3d 7484esac
89ce900e
JH
7485case "$libs" in
7486'') ;;
7487*) for thislib in $libs; do
7488 case "$thislib" in
7489 -lc|-lc_s)
7490 : Handle C library specially below.
7491 ;;
7492 -l*)
7493 thislib=`echo $thislib | $sed -e 's/^-l//'`
7494 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7495 :
7496 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7497 :
7498 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7499 :
7500 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7501 :
7502 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7503 :
7504 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7505 :
7506 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7507 :
7508 else
7509 try=''
7510 fi
7511 libnames="$libnames $try"
7512 ;;
7513 *) libnames="$libnames $thislib" ;;
7514 esac
7515 done
b4eb6b3d
JH
7516 ;;
7517esac
89ce900e
JH
7518xxx=normal
7519case "$libc" in
7520unknown)
7521 set /lib/libc.$so
7522 for xxx in $libpth; do
7523 $test -r $1 || set $xxx/libc.$so
7524 : The messy sed command sorts on library version numbers.
7525 $test -r $1 || \
7526 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7527 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7528 h
7529 s/[0-9][0-9]*/0000&/g
7530 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7531 G
7532 s/\n/ /' | \
7533 $sort | $sed -e 's/^.* //'`
7534 eval set \$$#
7535 done
7536 $test -r $1 || set /usr/ccs/lib/libc.$so
7537 $test -r $1 || set /lib/libsys_s$_a
7538 ;;
7539*)
7540 set blurfl
7541 ;;
7542esac
7543if $test -r "$1"; then
7544 echo "Your (shared) C library seems to be in $1."
7545 libc="$1"
7546elif $test -r /lib/libc && $test -r /lib/clib; then
7547 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7548 xxx=apollo
7549 libc='/lib/clib /lib/libc'
7550 if $test -r /lib/syslib; then
7551 echo "(Your math library is in /lib/syslib.)"
7552 libc="$libc /lib/syslib"
7553 fi
7554elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7555 echo "Your C library seems to be in $libc, as you said before."
7556elif $test -r $incpath/usr/lib/libc$_a; then
7557 libc=$incpath/usr/lib/libc$_a;
7558 echo "Your C library seems to be in $libc. That's fine."
7559elif $test -r /lib/libc$_a; then
7560 libc=/lib/libc$_a;
7561 echo "Your C library seems to be in $libc. You're normal."
7562else
7563 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7564 :
7565 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7566 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7567 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7568 :
7569 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7570 :
7571 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7572 :
7573 else
7574 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7575 fi
7576 if $test -r "$tans"; then
7577 echo "Your C library seems to be in $tans, of all places."
7578 libc=$tans
7579 else
7580 libc='blurfl'
7581 fi
7582fi
7583if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7584 dflt="$libc"
7585 cat <<EOM
b4eb6b3d 7586
89ce900e
JH
7587If the guess above is wrong (which it might be if you're using a strange
7588compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7589
89ce900e
JH
7590EOM
7591else
7592 dflt=''
7593 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7594 cat >&4 <<EOM
7595I can't seem to find your C library. I've looked in the following places:
5e366f65 7596
b4eb6b3d 7597EOM
89ce900e
JH
7598 $sed 's/^/ /' libpath
7599 cat <<EOM
5e366f65 7600
89ce900e 7601None of these seems to contain your C library. I need to get its name...
5e366f65
JH
7602
7603EOM
89ce900e
JH
7604fi
7605fn=f
7606rp='Where is your C library?'
7607. ./getfile
7608libc="$ans"
5e366f65 7609
89ce900e
JH
7610echo " "
7611echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7612set X `cat libnames`
7613shift
7614xxx=files
7615case $# in 1) xxx=file; esac
7616echo "Extracting names from the following $xxx for later perusal:" >&4
7617echo " "
7618$sed 's/^/ /' libnames >&4
7619echo " "
7620$echo $n "This may take a while...$c" >&4
5e366f65 7621
89ce900e
JH
7622for file in $*; do
7623 case $file in
7624 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7625 *) $nm $nm_opt $file 2>/dev/null;;
b4eb6b3d 7626 esac
89ce900e
JH
7627done >libc.tmp
7628
7629$echo $n ".$c"
7630$grep fprintf libc.tmp > libc.ptf
7631xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7632xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7633xxx='[ADTSIW]'
ab900c53 7634if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
89ce900e
JH
7635 eval $xscan;\
7636 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7637 eval $xrun
7638elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7639 eval $xscan;\
7640 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7641 eval $xrun
7642elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7643 eval $xscan;\
7644 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7645 eval $xrun
7646elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7647 eval $xscan;\
7648 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7649 eval $xrun
7650elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7651 eval $xscan;\
7652 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7653 eval $xrun
7654elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7655 eval $xscan;\
7656 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7657 eval $xrun
7658elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7659 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7660 eval $xscan;\
7661 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7662 eval $xrun
7663elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7664 eval $xscan;\
7665 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7666 eval $xrun
7667elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7668 eval $xscan;\
7669 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7670 eval $xrun
7671elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7672 eval $xscan;\
7673 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7674 eval $xrun
7675elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7676 eval $xscan;\
7677 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7678 eval $xrun
7679elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7680 eval $xscan;\
7681 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7682 eval $xrun
7683elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7684 eval $xscan;\
7685 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7686 eval $xrun
7687elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7688 eval $xscan;\
7689 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7690 eval $xrun
b4eb6b3d 7691else
89ce900e
JH
7692 $nm -p $* 2>/dev/null >libc.tmp
7693 $grep fprintf libc.tmp > libc.ptf
7694 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7695 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7696 then
7697 nm_opt='-p'
7698 eval $xrun
7699 else
7700 echo " "
7701 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7702 com=''
1d8eaf8c
MB
7703 if $ar t $libc > libc.tmp && \
7704 $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7705 then
89ce900e
JH
7706 for thisname in $libnames $libc; do
7707 $ar t $thisname >>libc.tmp
7708 done
7709 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7710 echo "Ok." >&4
7711 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
89ce900e
JH
7712 for thisname in $libnames $libc; do
7713 $ar tv $thisname >>libc.tmp
89ce900e
JH
7714 emximp -o tmp.imp $thisname \
7715 2>/dev/null && \
7716 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7717 < tmp.imp >>libc.tmp
1d8eaf8c 7718 $rm -f tmp.imp
89ce900e
JH
7719 done
7720 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7721 echo "Ok." >&4
7722 else
7723 echo "$ar didn't seem to work right." >&4
7724 echo "Maybe this is a Cray...trying bld instead..." >&4
1d8eaf8c
MB
7725 if bld t $libc | \
7726 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7727 $test -s libc.list
89ce900e
JH
7728 then
7729 for thisname in $libnames; do
7730 bld t $libnames | \
7731 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7732 $ar t $thisname >>libc.tmp
7733 done
7734 echo "Ok." >&4
7735 else
7736 echo "That didn't work either. Giving up." >&4
7737 exit 1
7738 fi
7739 fi
7740 fi
b4eb6b3d 7741fi
89ce900e
JH
7742nm_extract="$com"
7743case "$PASE" in
7744define)
7745 echo " "
7746 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7747 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7748 ;;
7749*) if $test -f /lib/syscalls.exp; then
7750 echo " "
7751 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
1d8eaf8c
MB
7752 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' \
7753 /lib/syscalls.exp >>libc.list
89ce900e
JH
7754 fi
7755 ;;
7756esac
7757;;
7758esac
7759$rm -f libnames libpath
b4eb6b3d
JH
7760
7761: see if dld is available
7762set dld.h i_dld
7763eval $inhdr
7764
613d6c3e 7765: Check if we are using C++
43dddb59
MB
7766echo " "
7767echo "Checking for C++..." >&4
20e87299 7768$cat >try.c <<'EOCP'
43dddb59
MB
7769#include <stdio.h>
7770int main(void)
7771{
7772#ifdef __cplusplus
20e87299 7773 return 0;
43dddb59 7774#else
20e87299 7775 return 1;
43dddb59 7776#endif
43dddb59
MB
7777}
7778EOCP
7779set try
20e87299
AD
7780if eval $compile_ok && $run ./try; then
7781 val="$define"
43dddb59
MB
7782 echo "You are using a C++ compiler."
7783else
7784 val="$undef"
7785 echo "You are not using a C++ compiler."
7786fi
5b813a60 7787$rm_try cplusplus$$
43dddb59
MB
7788set d_cplusplus
7789eval $setvar
7790
89ce900e
JH
7791: is a C symbol defined?
7792csym='tlook=$1;
7793case "$3" in
373dfab3
JH
7794-v) tf=libc.tmp; tdc="";;
7795-a) tf=libc.tmp; tdc="[]";;
7796*) tlook="^$1\$"; tf=libc.list; tdc="()";;
89ce900e 7797esac;
61c26d18
MHM
7798case "$d_cplusplus" in
7799 $define) extern_C="extern \"C\"" ;;
7800 *) extern_C="extern" ;;
7801esac;
89ce900e
JH
7802tx=yes;
7803case "$reuseval-$4" in
7804true-) ;;
7805true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7806esac;
7807case "$tx" in
7808yes)
43dddb59 7809 tval=false;
5129fff4
JH
7810 if $test "$runnm" = true; then
7811 if $contains $tlook $tf >/dev/null 2>&1; then
ab900c53 7812 tval=true;
5129fff4 7813 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
61c26d18 7814 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7815 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
373dfab3 7816 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
5b813a60 7817 $rm_try;
89ce900e 7818 fi;
5129fff4 7819 else
61c26d18 7820 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7821 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
5b813a60 7822 $rm_try;
ab900c53
AB
7823 fi;
7824 ;;
89ce900e
JH
7825*)
7826 case "$tval" in
7827 $define) tval=true;;
7828 *) tval=false;;
ab900c53
AB
7829 esac;
7830 ;;
89ce900e
JH
7831esac;
7832eval "$2=$tval"'
7833
7834: define an is-in-libc? function
7835inlibc='echo " "; td=$define; tu=$undef;
7836sym=$1; var=$2; eval "was=\$$2";
7837tx=yes;
7838case "$reuseval$was" in
7839true) ;;
7840true*) tx=no;;
7841esac;
7842case "$tx" in
7843yes)
7844 set $sym tres -f;
7845 eval $csym;
7846 case "$tres" in
7847 true)
7848 echo "$sym() found." >&4;
7849 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7850 *)
7851 echo "$sym() NOT found." >&4;
7852 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7853 esac;;
7854*)
7855 case "$was" in
7856 $define) echo "$sym() found." >&4;;
7857 *) echo "$sym() NOT found." >&4;;
7858 esac;;
7859esac'
7860
b4eb6b3d
JH
7861: see if dlopen exists
7862xxx_runnm="$runnm"
666ea192 7863xxx_ccflags="$ccflags"
b4eb6b3d 7864runnm=false
666ea192
JH
7865: with g++ one needs -shared to get is-in-libc to work for dlopen
7866case "$gccversion" in
7867'') ;;
7868*) case "$d_cplusplus" in
7869 "$define") ccflags="$ccflags -shared" ;;
7870 esac
7871 ;;
7872esac
b4eb6b3d
JH
7873set dlopen d_dlopen
7874eval $inlibc
7875runnm="$xxx_runnm"
666ea192 7876ccflags="$xxx_ccflags"
b4eb6b3d 7877
4fb7dc7d
JH
7878: see if this is a unistd.h system
7879set unistd.h i_unistd
7880eval $inhdr
7881
b4eb6b3d
JH
7882: determine which dynamic loading, if any, to compile in
7883echo " "
7884dldir="ext/DynaLoader"
7885case "$usedl" in
7886$define|y|true)
7887 dflt='y'
7888 usedl="$define"
7889 ;;
7890$undef|n|false)
7891 dflt='n'
7892 usedl="$undef"
7893 ;;
5b813a60 7894*)
b4eb6b3d
JH
7895 dflt='n'
7896 case "$d_dlopen" in
7897 $define) dflt='y' ;;
7898 esac
7899 case "$i_dld" in
7900 $define) dflt='y' ;;
7901 esac
7902 : Does a dl_xxx.xs file exist for this operating system
7903 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7904 ;;
7905esac
7906rp="Do you wish to use dynamic loading?"
7907. ./myread
7908usedl="$ans"
7909case "$ans" in
7910y*) usedl="$define"
7911 case "$dlsrc" in
7912 '')
7913 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7914 dflt="$dldir/dl_${osname}.xs"
7915 elif $test "$d_dlopen" = "$define" ; then
7916 dflt="$dldir/dl_dlopen.xs"
7917 elif $test "$i_dld" = "$define" ; then
7918 dflt="$dldir/dl_dld.xs"
7919 else
7920 dflt=''
7921 fi
7922 ;;
7923 *) dflt="$dldir/$dlsrc"
7924 ;;
7925 esac
7926 echo "The following dynamic loading files are available:"
7927 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7928 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7929 rp="Source file to use for dynamic loading"
7930 fn="fne"
7931 gfpth="$src"
7932 . ./getfile
7933 usedl="$define"
7934 : emulate basename
7935 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7936
7937 $cat << EOM
7938
7939Some systems may require passing special flags to $cc -c to
7940compile modules that will be used to create a shared library.
7941To use no flags, say "none".
7942
7943EOM
7944 case "$cccdlflags" in
7945 '') case "$gccversion" in
7946 '') case "$osname" in
7947 hpux) dflt='+z' ;;
7948 next) dflt='none' ;;
7949 irix*) dflt='-KPIC' ;;
48bcfe03 7950 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7951 sunos) dflt='-pic' ;;
7952 *) dflt='none' ;;
7953 esac
7954 ;;
7955 *) case "$osname" in
b6cc0f4c 7956 darwin) dflt='none' ;;
15fcae63 7957 linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7958 *) dflt='-fpic' ;;
7959 esac ;;
7960 esac ;;
7961 ' ') dflt='none' ;;
7962 *) dflt="$cccdlflags" ;;
7963 esac
7964 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7965 . ./myread
7966 case "$ans" in
7967 none) cccdlflags=' ' ;;
7968 *) cccdlflags="$ans" ;;
7969 esac
7970
7971 cat << EOM
7972
7973Some systems use ld to create libraries that can be dynamically loaded,
7974while other systems (such as those using ELF) use $cc.
7975
7976EOM
7977 case "$ld" in
55954f19 7978 '') $cat >try.c <<EOM
b4eb6b3d
JH
7979/* Test for whether ELF binaries are produced */
7980#include <fcntl.h>
55954f19
JH
7981#$i_stdlib I_STDLIB
7982#ifdef I_STDLIB
b4eb6b3d 7983#include <stdlib.h>
55954f19 7984#endif
4fb7dc7d
JH
7985#$i_unistd I_UNISTD
7986#ifdef I_UNISTD
7987#include <unistd.h>
7988#endif
b4eb6b3d
JH
7989int main() {
7990 char b[4];
7991 int i = open("a.out",O_RDONLY);
5b813a60 7992 if(i == -1)
b4eb6b3d
JH
7993 exit(1); /* fail */
7994 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7995 exit(0); /* succeed (yes, it's ELF) */
7996 else
7997 exit(1); /* fail */
7998}
7999EOM
5440bc8e 8000 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
8001 cat <<EOM
8002You appear to have ELF support. I'll use $cc to build dynamic libraries.
8003EOM
8004 dflt="$cc"
8005 else
8006 echo "I'll use ld to build dynamic libraries."
8007 dflt='ld'
8008 fi
5b813a60 8009 $rm_try
b4eb6b3d
JH
8010 ;;
8011 *) dflt="$ld"
8012 ;;
8013 esac
8014
8015 rp="What command should be used to create dynamic libraries?"
8016 . ./myread
8017 ld="$ans"
8018
8019 cat << EOM
8020
8021Some systems may require passing special flags to $ld to create a
8022library that can be dynamically loaded. If your ld flags include
8023-L/other/path options to locate libraries outside your loader's normal
8024search path, you may need to specify those -L options here as well. To
8025use no flags, say "none".
8026
8027EOM
8028 case "$lddlflags" in
8029 '') case "$osname" in
8030 beos) dflt='-nostart' ;;
df00ff3b 8031 haiku) dflt='-shared' ;;
b4eb6b3d
JH
8032 hpux) dflt='-b';
8033 case "$gccversion" in
8034 '') dflt="$dflt +vnocompatwarnings" ;;
8035 esac
5b813a60 8036 ;;
15fcae63 8037 linux|irix*|gnu*) dflt="-shared $optimize" ;;
b4eb6b3d
JH
8038 next) dflt='none' ;;
8039 solaris) dflt='-G' ;;
8040 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 8041 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
8042 *) dflt='none' ;;
8043 esac
8044 ;;
8045 *) dflt="$lddlflags" ;;
8046 esac
8047
8048 : Try to guess additional flags to pick up local libraries.
8049 : Be careful not to append to a plain 'none'
8050 case "$dflt" in
8051 none) dflt='' ;;
8052 esac
8053 for thisflag in $ldflags; do
8054 case "$thisflag" in
b5b9f165 8055 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
8056 case " $dflt " in
8057 *" $thisflag "*) ;;
8058 *) dflt="$dflt $thisflag" ;;
8059 esac
8060 ;;
8061 esac
8062 done
8063
8064 case "$dflt" in
8065 ''|' ') dflt='none' ;;
8066 esac
8067
8f68b0e6
AD
8068 case "$ldflags" in
8069 *-fstack-protector*)
8070 case "$dflt" in
8071 *-fstack-protector*) ;; # Don't add it again
8072 *) dflt="$dflt -fstack-protector" ;;
8073 esac
8074 ;;
8075 esac
8076
8077
b4eb6b3d
JH
8078 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8079 . ./myread
8080 case "$ans" in
8081 none) lddlflags=' ' ;;
8082 *) lddlflags="$ans" ;;
8083 esac
8084
8085 cat <<EOM
8086
8087Some systems may require passing special flags to $cc to indicate that
8088the resulting executable will use dynamic linking. To use no flags,
8089say "none".
8090
8091EOM
8092 case "$ccdlflags" in
8093 '') case "$osname" in
fb2e1bc0 8094 linux|hpux|gnu*) dflt='-Wl,-E' ;;
91fc0aa5
AH
8095 next|sunos) dflt='none' ;;
8096 *) dflt='none' ;;
b4eb6b3d
JH
8097 esac ;;
8098 ' ') dflt='none' ;;
8099 *) dflt="$ccdlflags" ;;
8100 esac
8101 rp="Any special flags to pass to $cc to use dynamic linking?"
8102 . ./myread
8103 case "$ans" in
8104 none) ccdlflags=' ' ;;
8105 *) ccdlflags="$ans" ;;
8106 esac
8107 ;;
8108*) usedl="$undef"
8109 ld='ld'
8110 dlsrc='dl_none.xs'
8111 lddlflags=''
8112 ccdlflags=''
8113 ;;
8114esac
8115
34f1896b 8116: Do we want a shared libperl?
b4eb6b3d
JH
8117also=''
8118case "$usedl" in
8119$undef)
8120 # No dynamic loading being used, so don't bother even to prompt.
8121 useshrplib='false'
8122 ;;
8123*) case "$useshrplib" in
8124 '') case "$osname" in
df00ff3b 8125 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
b4eb6b3d
JH
8126 dflt=y
8127 also='Building a shared libperl is required for dynamic loading to work on your system.'
8128 ;;
8129 next*)
8130 case "$osvers" in
8131 4*) dflt=y
8132 also='Building a shared libperl is needed for MAB support.'
8133 ;;
8134 *) dflt=n
8135 ;;
8136 esac
8137 ;;
8138 *) dflt=n
8139 ;;
8140 esac
8141 ;;
8142 $define|true|[Yy]*)
8143 dflt=y
8144 ;;
8145 *) dflt=n
8146 ;;
8147 esac
8148 $cat << EOM
8149
8150The perl executable is normally obtained by linking perlmain.c with
8151libperl${_a}, any static extensions (usually just DynaLoader), and
8152any other libraries needed on this system (such as -lm, etc.). Since
8153your system supports dynamic loading, it is probably possible to build
8154a shared libperl.$so. If you will have more than one executable linked
8155to libperl.$so, this will significantly reduce the size of each
5cadb3f3 8156executable, but it may have a noticeable effect on performance. The
b4eb6b3d
JH
8157default is probably sensible for your system.
8158$also
8159
8160EOM
8161 rp="Build a shared libperl.$so (y/n)"
8162 . ./myread
8163 case "$ans" in
8164 true|$define|[Yy]*)
8165 useshrplib='true' ;;
8166 *) useshrplib='false' ;;
8167 esac
8168 ;;
8169esac
8170
8171case "$useshrplib" in
8172true)
8173 case "$libperl" in
8174 '')
8175 # Figure out a good name for libperl.so. Since it gets stored in
8176 # a version-specific architecture-dependent library, the version
8177 # number isn't really that important, except for making cc/ld happy.
8178 #
56e771c1 8179 # A name such as libperl.so.10.1
b4eb6b3d 8180 majmin="libperl.$so.$patchlevel.$subversion"
56e771c1 8181 # A name such as libperl.so.100
b4eb6b3d
JH
8182 majonly=`echo $patchlevel $subversion |
8183 $awk '{printf "%d%02d", $1, $2}'`
8184 majonly=libperl.$so.$majonly
8185 # I'd prefer to keep the os-specific stuff here to a minimum, and
8186 # rely on figuring it out from the naming of libc.
8187 case "${osname}${osvers}" in
8188 next4*)
8189 dflt=libperl.5.$so
8190 # XXX How handle the --version stuff for MAB?
8191 ;;
fb2e1bc0 8192 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
8193 dflt=libperl.$so
8194 ;;
56e771c1
RU
8195 cygwin*) # ld links now against the dll directly
8196 majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8197 majonly=`echo $patchlevel $subversion |
8198 $awk '{printf "%03d%03d", $1, $2}'`
8199 majonly=cygperl5.$majonly.$so
8200 dflt=$majmin
b4eb6b3d
JH
8201 ;;
8202 *) # Try to guess based on whether libc has major.minor.
8203 case "$libc" in
8204 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8205 *libc.$so.[0-9]*) dflt=$majonly ;;
8206 *) dflt=libperl.$so ;;
8207 esac
8208 ;;
8209 esac
8210 ;;
8211 *) dflt=$libperl
8212 ;;
8213 esac
8214 cat << EOM
8215
8216I need to select a good name for the shared libperl. If your system uses
8217library names with major and minor numbers, then you might want something
8218like $majmin. Alternatively, if your system uses a single version
8219number for shared libraries, then you might want to use $majonly.
8220Or, your system might be quite happy with a simple libperl.$so.
8221
8222Since the shared libperl will get installed into a version-specific
8223architecture-dependent directory, the version number of the shared perl
8224library probably isn't important, so the default should be o.k.
8225
8226EOM
8227 rp='What name do you want to give to the shared libperl?'
8228 . ./myread
8229 libperl=$ans
8230 echo "Ok, I'll use $libperl"
8231 ;;
8232*)
8233 libperl="libperl${_a}"
8234 ;;
8235esac
8236
8237# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8238case "$shrpdir" in
8239'') ;;
8240*) $cat >&4 <<EOM
8241WARNING: Use of the shrpdir variable for the installation location of
8242the shared $libperl is not supported. It was never documented and
8243will not work in this version. Let me (perlbug@perl.org)
8244know of any problems this may cause.
8245
8246EOM
8247 case "$shrpdir" in
8248 "$archlibexp/CORE")
8249 $cat >&4 <<EOM
8250But your current setting of $shrpdir is
8251the default anyway, so it's harmless.
8252EOM
8253 ;;
8254 *)
8255 $cat >&4 <<EOM
8256Further, your current attempted setting of $shrpdir
8257conflicts with the value of $archlibexp/CORE
8258that installperl will use.
8259EOM
8260 ;;
8261 esac
8262 ;;
8263esac
8264
8265# How will the perl executable find the installed shared $libperl?
8266# Add $xxx to ccdlflags.
8267# If we can't figure out a command-line option, use $shrpenv to
8268# set env LD_RUN_PATH. The main perl makefile uses this.
8269shrpdir=$archlibexp/CORE
8270xxx=''
8271tmp_shrpenv=''
8272if "$useshrplib"; then
34f1896b 8273 case "$osname" in
b4eb6b3d
JH
8274 aix)
8275 # We'll set it in Makefile.SH...
8276 ;;
b5b9f165 8277 solaris)
b4eb6b3d
JH
8278 xxx="-R $shrpdir"
8279 ;;
a774dfe6 8280 freebsd|netbsd|openbsd|interix|dragonfly)
b4eb6b3d
JH
8281 xxx="-Wl,-R$shrpdir"
8282 ;;
fb2e1bc0 8283 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
8284 xxx="-Wl,-rpath,$shrpdir"
8285 ;;
8286 next)
8287 # next doesn't like the default...
8288 ;;
8289 beos)
8290 # beos doesn't like the default, either.
8291 ;;
df00ff3b
IW
8292 haiku)
8293 # Haiku doesn't like the default, either.
8294 ;;
b4eb6b3d
JH
8295 hpux*)
8296 # hpux doesn't like the default, either.
8297 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8298 ;;
56e771c1
RU
8299 cygwin)
8300 # cygwin needs only ldlibpth
8301 ;;
b4eb6b3d
JH
8302 *)
8303 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8304 ;;
8305 esac
8306 case "$xxx" in
8307 '') ;;
34f1896b 8308 *)
b4eb6b3d
JH
8309 # Only add $xxx if it isn't already in ccdlflags.
8310 case " $ccdlflags " in
8311 *" $xxx "*) ;;
8312 *) ccdlflags="$ccdlflags $xxx"
8313 cat <<EOM >&4
8314
8315Adding $xxx to the flags
34f1896b 8316passed to $ld so that the perl executable will find the
b4eb6b3d
JH
8317installed shared $libperl.
8318
8319EOM
8320 ;;
8321 esac
8322 ;;
8323 esac
8324fi
8325# Fix ccdlflags in AIX for building external extensions.
8326# (For building Perl itself bare -bE:perl.exp is needed,
8327# Makefile.SH takes care of this.)
8328case "$osname" in
8329aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8330esac
8331# Respect a hint or command-line value.
8332case "$shrpenv" in
8333'') shrpenv="$tmp_shrpenv" ;;
8334esac
8335case "$ldlibpthname" in
8336'') ldlibpthname=LD_LIBRARY_PATH ;;
8337none) ldlibpthname='' ;;
8338esac
8339
8340: determine where manual pages are on this system
8341echo " "
8342case "$sysman" in
8343'')
4a0a3829
SD
8344 syspath='/usr/share/man/man1 /usr/man/man1'
8345 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8346 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
8347 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8348 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8349 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8350 sysman=`./loc . /usr/man/man1 $syspath`
8351 ;;
8352esac
8353if $test -d "$sysman"; then
8354 echo "System manual is in $sysman." >&4
8355else
8356 echo "Could not find manual pages in source form." >&4
8357fi
8358
8359: determine where manual pages go
8360set man1dir man1dir none
8361eval $prefixit
8362$cat <<EOM
8363
8364$spackage has manual pages available in source form.
8365EOM
8366case "$nroff" in
8367nroff)
8368 echo "However, you don't have nroff, so they're probably useless to you."
8369 case "$man1dir" in
8370 '') man1dir="none";;
8371 esac;;
8372esac
8373echo "If you don't want the manual sources installed, answer 'none'."
8374case "$man1dir" in
8375' ') dflt=none
8376 ;;
8377'')
4a0a3829
SD
8378 lookpath="$prefixexp/share/man/man1"
8379 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
8380 lookpath="$lookpath $prefixexp/man/p_man/man1"
8381 lookpath="$lookpath $prefixexp/man/u_man/man1"
8382 lookpath="$lookpath $prefixexp/man/man.1"
8383 case "$sysman" in
8384 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8385 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8386 esac
8387 set dflt
8388 eval $prefixup
8389 ;;
8390*) dflt="$man1dir"
8391 ;;
8392esac
8393echo " "
8394fn=dn+~
8395rp="Where do the main $spackage manual pages (source) go?"
8396. ./getfile
8397if $test "X$man1direxp" != "X$ansexp"; then
8398 installman1dir=''
8399fi
79522dd2
NC
8400prefixvar=man1dir
8401. ./setprefixvar
8402
477140ee
NC
8403case "$man1dir" in
8404'') man1dir=' '
8405 installman1dir='';;
8406esac
b4eb6b3d
JH
8407
8408: What suffix to use on installed man pages
8409
8410case "$man1dir" in
8411' ')
8412 man1ext='0'
8413 ;;
8414*)
8415 rp="What suffix should be used for the main $spackage man pages?"
8416 case "$man1ext" in
8417 '') case "$man1dir" in
8418 *1) dflt=1 ;;
8419 *1p) dflt=1p ;;
8420 *1pm) dflt=1pm ;;
8421 *l) dflt=l;;
8422 *n) dflt=n;;
8423 *o) dflt=o;;
8424 *p) dflt=p;;
8425 *C) dflt=C;;
8426 *L) dflt=L;;
8427 *L1) dflt=L1;;
8428 *) dflt=1;;
8429 esac
8430 ;;
8431 *) dflt="$man1ext";;
8432 esac
8433 . ./myread
8434 man1ext="$ans"
8435 ;;
8436esac
8437
8438: see if we can have long filenames
8439echo " "
8440first=123456789abcdef
8441$rm -f $first
8442if (echo hi >$first) 2>/dev/null; then
8443 if $test -f 123456789abcde; then
8444 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8445 val="$undef"
8446 else
8447 echo 'You can have filenames longer than 14 characters.'>&4
8448 val="$define"
8449 fi
8450else
8451 $cat <<'EOM'
8452You can't have filenames longer than 14 chars.
8453You can't even think about them!
8454EOM
8455 val="$undef"
776a38e3 8456fi
b4eb6b3d
JH
8457set d_flexfnam
8458eval $setvar
8459$rm -rf 123456789abcde*
8460
8461: determine where library module manual pages go
8462set man3dir man3dir none
8463eval $prefixit
8464$cat <<EOM
8465
8466$spackage has manual pages for many of the library modules.
8467EOM
8468
8469case "$nroff" in
8470nroff)
8471 $cat <<'EOM'
8472However, you don't have nroff, so they're probably useless to you.
8473EOM
8474 case "$man3dir" in
8475 '') man3dir="none";;
8476 esac;;
8477esac
8478
8479case "$d_flexfnam" in
8480undef)
8481 $cat <<'EOM'
f3f1a2d8 8482However, your system can't handle the long file names like File::Basename.3.
b4eb6b3d
JH
8483EOM
8484 case "$man3dir" in
8485 '') man3dir="none";;
8486 esac;;
8487esac
8488
8489echo "If you don't want the manual sources installed, answer 'none'."
8490prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8491case "$man3dir" in
8492'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8493 if $test -d "$privlib/man/man3"; then
8494 cat <<EOM >&4
8495
8496WARNING: Previous versions of perl installed man3 pages into
f3f1a2d8
MB
8497$privlib/man/man3. This version will suggest a
8498new default of $dflt.
b4eb6b3d
JH
8499EOM
8500 tdflt=$dflt
8501 dflt='n'
8502 rp='Do you wish to preserve the old behavior?(y/n)'
8503 . ./myread
8504 case "$ans" in
8505 y*) dflt="$privlib/man/man3" ;;
8506 *) dflt=$tdflt ;;
8507 esac
8508 fi
8509 ;;
8510*) dflt="$man3dir" ;;
8511esac
8512case "$dflt" in
8513' ') dflt=none ;;
8514esac
8515echo " "
8516fn=dn+~
8517rp="Where do the $package library man pages (source) go?"
8518. ./getfile
79522dd2
NC
8519prefixvar=man3dir
8520. ./setprefixvar
8521
477140ee
NC
8522case "$man3dir" in
8523'') man3dir=' '
8524 installman3dir='';;
8525esac
b4eb6b3d
JH
8526
8527: What suffix to use on installed man pages
8528case "$man3dir" in
8529' ')
8530 man3ext='0'
8531 ;;
8532*)
8533 rp="What suffix should be used for the $package library man pages?"
8534 case "$man3ext" in
8535 '') case "$man3dir" in
8536 *3) dflt=3 ;;
8537 *3p) dflt=3p ;;
8538 *3pm) dflt=3pm ;;
8539 *l) dflt=l;;
8540 *n) dflt=n;;
8541 *o) dflt=o;;
8542 *p) dflt=p;;
8543 *C) dflt=C;;
8544 *L) dflt=L;;
8545 *L3) dflt=L3;;
8546 *) dflt=3;;
8547 esac
8548 ;;
8549 *) dflt="$man3ext";;
8550 esac
8551 . ./myread
8552 man3ext="$ans"
8553 ;;
8554esac
8555
8556: see if we have to deal with yellow pages, now NIS.
0384a54a 8557if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8558 if $test -f /usr/etc/nibindd; then
8559 echo " "
8560 echo "I'm fairly confident you're on a NeXT."
8561 echo " "
8562 rp='Do you get the hosts file via NetInfo?'
8563 dflt=y
8564 case "$hostcat" in
8565 nidump*) ;;
8566 '') ;;
8567 *) dflt=n;;
8568 esac
8569 . ./myread
8570 case "$ans" in
8571 y*) hostcat='nidump hosts .';;
8572 *) case "$hostcat" in
8573 nidump*) hostcat='';;
8574 esac
8575 ;;
8576 esac
8577 fi
8578 case "$hostcat" in
8579 nidump*) ;;
8580 *)
8581 case "$hostcat" in
8582 *ypcat*) dflt=y;;
8583 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8584 dflt=y
8585 else
8586 dflt=n
8587 fi;;
8588 *) dflt=n;;
8589 esac
8590 echo " "
8591 rp='Are you getting the hosts file via yellow pages?'
8592 . ./myread
8593 case "$ans" in
8594 y*) hostcat='ypcat hosts';;
8595 *) hostcat='cat /etc/hosts';;
8596 esac
8597 ;;
8598 esac
8599fi
8600case "$hostcat" in
8601'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8602esac
8603case "$groupcat" in
8604'') test -f /etc/group && groupcat='cat /etc/group';;
8605esac
8606case "$passcat" in
8607'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8608esac
8609
8610: now get the host name
8611echo " "
8612echo "Figuring out host name..." >&4
8613case "$myhostname" in
8614'') cont=true
8615 echo 'Maybe "hostname" will work...'
73614538 8616 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8617 myhostname=$tans
8618 phostname=hostname
8619 cont=''
8620 fi
8621 ;;
8622*) cont='';;
8623esac
8624if $test "$cont"; then
8625 if ./xenix; then
8626 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8627 if tans=`cat /etc/systemid 2>&1` ; then
8628 myhostname=$tans
8629 phostname='cat /etc/systemid'
8630 echo "Whadyaknow. Xenix always was a bit strange..."
8631 cont=''
8632 fi
8633 elif $test -r /etc/systemid; then
8634 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8635 fi
8636fi
8637if $test "$cont"; then
8638 echo 'No, maybe "uuname -l" will work...'
73614538 8639 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8640 myhostname=$tans
8641 phostname='uuname -l'
8642 else
8643 echo 'Strange. Maybe "uname -n" will work...'
73614538 8644 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8645 myhostname=$tans
8646 phostname='uname -n'
8647 else
8648 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8649 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8650 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8651 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8652 else
8653 case "$myhostname" in
8654 '') echo "Does this machine have an identity crisis or something?"
8655 phostname='';;
8656 *)
8657 echo "Well, you said $myhostname before..."
8658 phostname='echo $myhostname';;
8659 esac
8660 fi
8661 fi
8662 fi
8663fi
52a549d0
JH
8664case "$myhostname" in
8665'') myhostname=noname ;;
8666esac
b4eb6b3d
JH
8667: you do not want to know about this
8668set $myhostname
8669myhostname=$1
8670
8671: verify guess
8672if $test "$myhostname" ; then
8673 dflt=y
8674 rp='Your host name appears to be "'$myhostname'".'" Right?"
8675 . ./myread
8676 case "$ans" in
8677 y*) ;;
8678 *) myhostname='';;
8679 esac
8680fi
8681
8682: bad guess or no guess
8683while $test "X$myhostname" = X ; do
8684 dflt=''
8685 rp="Please type the (one word) name of your host:"
8686 . ./myread
8687 myhostname="$ans"
8688done
8689
8690: translate upper to lower if necessary
8691case "$myhostname" in
8692*[A-Z]*)
8693 echo "(Normalizing case in your host name)"
8694 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8695 ;;
8696esac
8697
8698case "$myhostname" in
8699*.*)
8700 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8701 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8702 echo "(Trimming domain name from host name--host name is now $myhostname)"
8703 ;;
8704*) case "$mydomain" in
8705 '')
8706 {
8707 test "X$hostcat" = "Xypcat hosts" &&
8708 ypmatch "$myhostname" hosts 2>/dev/null |\
8709 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8710 $test -s hosts
8711 } || {
8712 test "X$hostcat" != "X" &&
8713 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8714 /[ ]$myhostname[ . ]/p" > hosts
8715 }
8716 tmp_re="[ . ]"
f08cbdd1
PP
8717 if $test -f hosts; then
8718 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8719 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8720 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8721 hosts | $sort | $uniq | \
8722 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8723 case `$echo X$dflt` in
8724 X*\ *) echo "(Several hosts in the database matched hostname)"
8725 dflt=.
8726 ;;
8727 X.) echo "(You do not have fully-qualified names in the hosts database)"
8728 ;;
8729 esac
8730 else
8731 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8732 dflt=.
f08cbdd1 8733 fi
b4eb6b3d
JH
8734 case "$dflt" in
8735 .)
8736 tans=`./loc resolv.conf X /etc /usr/etc`
8737 if $test -f "$tans"; then
8738 echo "(Attempting domain name extraction from $tans)"
8739 dflt=.`$sed -n -e 's/ / /g' \
8740 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
1d40d392 8741 -e 1q 2>/dev/null`
b4eb6b3d
JH
8742 case "$dflt" in
8743 .) dflt=.`$sed -n -e 's/ / /g' \
8744 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
1d40d392 8745 -e 1q 2>/dev/null`
b4eb6b3d
JH
8746 ;;
8747 esac
8748 fi
8749 ;;
8750 esac
8751 case "$dflt" in
8752 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8753 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8754 case "$dflt" in
8755 '') dflt='.';;
8756 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8757 esac
8758 ;;
8759 esac
59c9e5d6
PP
8760 case "$dflt$osname" in
8761 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8762 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8763 ;;
8764 esac
b4eb6b3d
JH
8765 case "$dflt" in
8766 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8767 dflt='.nonet'
b4eb6b3d
JH
8768 ;;
8769 esac
8770 $rm -f hosts
8771 ;;
8772 *) dflt="$mydomain";;
8773 esac;;
8774esac
8775echo " "
8776rp="What is your domain name?"
8777. ./myread
8778tans="$ans"
8779case "$ans" in
8780'') ;;
8781.*) ;;
8782*) tans=".$tans";;
8783esac
8784mydomain="$tans"
8785
8786: translate upper to lower if necessary
8787case "$mydomain" in
8788*[A-Z]*)
8789 echo "(Normalizing case in your domain name)"
8790 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8791 ;;
8792esac
8793
8794: a little sanity check here
8795case "$phostname" in
8796'') ;;
8797*)
8798 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8799 $myhostname$mydomain|$myhostname) ;;
8800 *)
8801 case "$phostname" in
8802 sed*)
8803 echo "(That doesn't agree with your whoami.h file, by the way.)"
8804 ;;
8805 *)
8806 echo "(That doesn't agree with your $phostname command, by the way.)"
8807 ;;
8808 esac
8809 ;;
8810 esac
8811 ;;
8812esac
8813
776a38e3 8814: determine the e-mail address of the user who is running us
b4eb6b3d
JH
8815$cat <<EOM
8816
8817I need to get your e-mail address in Internet format if possible, i.e.
8818something like user@host.domain. Please answer accurately since I have
8819no easy means to double check it. The default value provided below
8820is most probably close to reality but may not be valid from outside
8821your organization...
8822
8823EOM
8824cont=x
8825while test "$cont"; do
8826 case "$cf_email" in
8827 '') dflt="$cf_by@$myhostname$mydomain";;
8828 *) dflt="$cf_email";;
8829 esac
8830 rp='What is your e-mail address?'
8831 . ./myread
8832 cf_email="$ans"
8833 case "$cf_email" in
8834 *@*.*) cont='' ;;
8835 *)
8836 rp='Address does not look like an Internet one. Use it anyway?'
8837 case "$fastread" in
8838 yes) dflt=y ;;
8839 *) dflt=n ;;
8840 esac
8841 . ./myread
8842 case "$ans" in
8843 y*) cont='' ;;
8844 *) echo " " ;;
8845 esac
8846 ;;
8847 esac
8848done
8849
34f1896b 8850: Ask e-mail of administrator
b4eb6b3d
JH
8851$cat <<EOM
8852
8853If you or somebody else will be maintaining perl at your site, please
8854fill in the correct e-mail address here so that they may be contacted
8855if necessary. Currently, the "perlbug" program included with perl
8856will send mail to this address in addition to perlbug@perl.org. You may
8857enter "none" for no administrator.
8858
8859EOM
8860case "$perladmin" in
8861'') dflt="$cf_email";;
8862*) dflt="$perladmin";;
8863esac
8864rp='Perl administrator e-mail address'
8865. ./myread
8866perladmin="$ans"
8867
674912d7
RB
8868: determine whether to only install version-specific parts.
8869echo " "
8870$cat <<EOM
8871Do you want to install only the version-specific parts of the perl
8872distribution? Usually you do *not* want to do this.
8873EOM
8874case "$versiononly" in
8875"$define"|[Yy]*|true) dflt='y' ;;
8876*) dflt='n';
8877esac
8878rp="Do you want to install only the version-specific parts of perl?"
8879. ./myread
8880case "$ans" in
8881[yY]*) val="$define";;
8882*) val="$undef" ;;
8883esac
8884set versiononly
8885eval $setvar
8886
ad493445
MB
8887case "$versiononly" in
8888"$define") inc_version_list=''
8889 inc_version_list_init=0
8890 ;;
8891esac
8892
b4eb6b3d 8893: figure out how to guarantee perl startup
d0e36aa9 8894: XXX Note that this currently takes advantage of the bug that binexp ignores
a2d23ec2
MB
8895: the Configure -Dinstallprefix setting, which in turn means that under
8896: relocatable @INC, initialinstalllocation is what binexp started as.
b4eb6b3d
JH
8897case "$startperl" in
8898'')
8899 case "$sharpbang" in
8900 *!)
8901 $cat <<EOH
8902
8903I can use the #! construct to start perl on your system. This will
8904make startup of perl scripts faster, but may cause problems if you
8905want to share those scripts and perl is not in a standard place
a2d23ec2
MB
8906($initialinstalllocation/perl) on all your platforms. The alternative
8907is to force a shell by starting the script with a single ':' character.
b4eb6b3d
JH
8908
8909EOH
674912d7 8910 case "$versiononly" in
a2d23ec2 8911 "$define") dflt="$initialinstalllocation/perl$version";;
d0e36aa9 8912 *) dflt="$initialinstalllocation/perl";;
674912d7 8913 esac
b4eb6b3d
JH
8914 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8915 . ./myread
8916 case "$ans" in
8917 none) startperl=": # use perl";;
8918 *) startperl="#!$ans"
8919 if $test 30 -lt `echo "$ans" | wc -c`; then
8920 $cat >&4 <<EOM
8921
8922WARNING: Some systems limit the #! command to 32 characters.
8923If you experience difficulty running Perl scripts with #!, try
8924installing Perl in a directory with a shorter pathname.
8925
8926EOM
8927 fi ;;
8928 esac
8929 ;;
8930 *) startperl=": # use perl"
8931 ;;
8932 esac
8933 ;;
8934esac
8935echo "I'll use $startperl to start perl scripts."
8936
8937: figure best path for perl in scripts
8938case "$perlpath" in
8939'')
5e20a8ca 8940 case "$versiononly" in
d0e36aa9
NC
8941 "$define") perlpath="$initialinstalllocation/perl$version";;
8942 *) perlpath="$initialinstalllocation/perl";;
5e20a8ca 8943 esac
b4eb6b3d
JH
8944 case "$startperl" in
8945 *!*) ;;
8946 *)
8947 $cat <<EOH
8948
8949I will use the "eval 'exec'" idiom to start Perl on your system.
8950I can use the full path of your Perl binary for this purpose, but
8951doing so may cause problems if you want to share those scripts and
d0e36aa9 8952Perl is not always in a standard place ($initialinstalllocation/perl).
b4eb6b3d
JH
8953
8954EOH
d0e36aa9 8955 dflt="$initialinstalllocation/perl"
b4eb6b3d
JH
8956 rp="What path shall I use in \"eval 'exec'\"?"
8957 . ./myread
8958 perlpath="$ans"
8959 ;;
8960 esac
8961 ;;
8962esac
8963case "$startperl" in
8964*!*) ;;
8965*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8966esac
8967
8968: determine where public executable scripts go
8969set scriptdir scriptdir
8970eval $prefixit
8971case "$scriptdir" in
8972'')
8973 dflt="$bin"
8974 : guess some guesses
8975 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8976 $test -d /usr/share/bin && dflt=/usr/share/bin
8977 $test -d /usr/local/script && dflt=/usr/local/script
8978 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8979 $test -d $prefixexp/script && dflt=$prefixexp/script
8980 set dflt
8981 eval $prefixup
8982 ;;
8983*) dflt="$scriptdir"
8984 ;;
8985esac
8986$cat <<EOM
f3f1a2d8 8987
b4eb6b3d
JH
8988Some installations have a separate directory just for executable scripts so
8989that they can mount it across multiple architectures but keep the scripts in
8990one spot. You might, for example, have a subdirectory of /usr/share for this.
8991Or you might just lump your scripts in with all your other executables.
f3f1a2d8 8992
b4eb6b3d
JH
8993EOM
8994fn=d~
8995rp='Where do you keep publicly executable scripts?'
8996. ./getfile
8997if $test "X$ansexp" != "X$scriptdirexp"; then
8998 installscript=''
8999fi
f3f1a2d8 9000installscriptdir=''
79522dd2
NC
9001prefixvar=scriptdir
9002. ./setprefixvar
9003: A little fix up for an irregularly named variable.
9004installscript="$installscriptdir"
9005
b4eb6b3d
JH
9006: determine where add-on public executables go
9007case "$sitebin" in
9008'') dflt=$siteprefix/bin ;;
9009*) dflt=$sitebin ;;
9010esac
9011fn=d~
9012rp='Pathname where the add-on public executables should be installed?'
9013. ./getfile
79522dd2
NC
9014prefixvar=sitebin
9015. ./setprefixvar
b4eb6b3d 9016
6e1038e0 9017: determine where add-on html pages go
8d2cbf27 9018: There is no standard location, so try to copy the previously-selected
6e1038e0 9019: directory structure for the core html pages.
8d2cbf27
JH
9020case "$sitehtml1dir" in
9021'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9022*) dflt=$sitehtml1dir ;;
6e1038e0
MB
9023esac
9024case "$dflt" in
9025''|' ') dflt=none ;;
9026esac
9027fn=dn+~
9028rp='Pathname where the site-specific html pages should be installed?'
9029. ./getfile
79522dd2
NC
9030prefixvar=sitehtml1dir
9031. ./setprefixvar
6e1038e0
MB
9032
9033: determine where add-on library html pages go
9034: There is no standard location, so try to copy the previously-selected
9035: directory structure for the core html pages.
8d2cbf27
JH
9036case "$sitehtml3dir" in
9037'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9038*) dflt=$sitehtml3dir ;;
6e1038e0
MB
9039esac
9040case "$dflt" in
9041''|' ') dflt=none ;;
9042esac
9043fn=dn+~
9044rp='Pathname where the site-specific library html pages should be installed?'
9045. ./getfile
79522dd2
NC
9046prefixvar=sitehtml3dir
9047. ./setprefixvar
6e1038e0
MB
9048
9049: determine where add-on manual pages go
91e123a8
JH
9050case "$siteman1dir" in
9051'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 9052*) dflt=$siteman1dir ;;
6e1038e0 9053esac
257059b5
JH
9054case "$dflt" in
9055''|' ') dflt=none ;;
9056esac
6e1038e0
MB
9057fn=dn+~
9058rp='Pathname where the site-specific manual pages should be installed?'
9059. ./getfile
79522dd2
NC
9060prefixvar=siteman1dir
9061. ./setprefixvar
6e1038e0
MB
9062
9063: determine where add-on library man pages go
91e123a8
JH
9064case "$siteman3dir" in
9065'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 9066*) dflt=$siteman3dir ;;
6e1038e0 9067esac
257059b5
JH
9068case "$dflt" in
9069''|' ') dflt=none ;;
9070esac
6e1038e0
MB
9071fn=dn+~
9072rp='Pathname where the site-specific library manual pages should be installed?'
9073. ./getfile
79522dd2
NC
9074prefixvar=siteman3dir
9075. ./setprefixvar
6e1038e0
MB
9076
9077: determine where add-on public executable scripts go
9078case "$sitescript" in
9079'') dflt=$siteprefix/script
9080 $test -d $dflt || dflt=$sitebin ;;
9081*) dflt="$sitescript" ;;
9082esac
9083fn=d~+
9084rp='Pathname where add-on public executable scripts should be installed?'
9085. ./getfile
79522dd2
NC
9086prefixvar=sitescript
9087. ./setprefixvar
6e1038e0 9088
34f1896b 9089: Check if faststdio is requested and available
15b61c98
JH
9090case "$usefaststdio" in
9091$define|true|[yY]*|'')
9092 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9093 case "$xversion" in
9094 [68]) dflt='y' ;;
9095 *) dflt='n' ;;
9096 esac
9097 ;;
9098*) dflt='n';;
9099esac
9100cat <<EOM
9101
9102Perl can be built to use 'fast stdio', which means using the stdio
9103library but also directly manipulating the stdio buffers to enable
9104faster I/O. Using stdio is better for backward compatibility (especially
9105for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9106interface has been preferred instead of stdio.
9107
9108If this doesn't make any sense to you, just accept the default '$dflt'.
9109EOM
9110rp='Use the "fast stdio" if available?'
9111. ./myread
9112case "$ans" in
34f1896b 9113y|Y) val="$define" ;;
15b61c98
JH
9114*) val="$undef" ;;
9115esac
9116set usefaststdio
9117eval $setvar
9118
9119
96056487
JH
9120: define an is-a-typedef? function
9121typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9122case "$inclist" in
9123"") inclist="sys/types.h";;
9124esac;
9125eval "varval=\$$var";
9126case "$varval" in
9127"")
9128 $rm -f temp.c;
9129 for inc in $inclist; do
9130 echo "#include <$inc>" >>temp.c;
9131 done;
9132 echo "#ifdef $type" >> temp.c;
9133 echo "printf(\"We have $type\");" >> temp.c;
9134 echo "#endif" >> temp.c;
9135 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9136 if $contains $type temp.E >/dev/null 2>&1; then
9137 eval "$var=\$type";
9138 else
9139 eval "$var=\$def";
9140 fi;
9141 $rm -f temp.?;;
9142*) eval "$var=\$varval";;
9143esac'
9144
9145: define an is-a-typedef? function that prompts if the type is not available.
9146typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9147case "$inclist" in
9148"") inclist="sys/types.h";;
9149esac;
9150eval "varval=\$$var";
9151case "$varval" in
9152"")
9153 $rm -f temp.c;
9154 for inc in $inclist; do
9155 echo "#include <$inc>" >>temp.c;
9156 done;
9157 echo "#ifdef $type" >> temp.c;
9158 echo "printf(\"We have $type\");" >> temp.c;
9159 echo "#endif" >> temp.c;
9160 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9161 echo " " ;
9162 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9163 if $contains $type temp.E >/dev/null 2>&1; then
9164 echo "$type found." >&4;
9165 eval "$var=\$type";
9166 else
9167 echo "$type NOT found." >&4;
9168 dflt="$def";
9169 . ./myread ;
9170 eval "$var=\$ans";
9171 fi;
9172 $rm -f temp.?;;
9173*) eval "$var=\$varval";;
9174esac'
9175
9176: see what type lseek is declared as in the kernel
9177rp="What is the type used for lseek's offset on this system?"
9178set off_t lseektype long stdio.h sys/types.h
9179eval $typedef_ask
9180
9181echo " "
9182echo "Checking to see how big your file offsets are..." >&4
9183$cat >try.c <<EOCP
9184#include <sys/types.h>
9185#include <stdio.h>
9186int main()
9187{
9188 printf("%d\n", (int)sizeof($lseektype));
5b813a60 9189 return(0);
96056487
JH
9190}
9191EOCP
9192set try
9193if eval $compile_ok; then
9194 lseeksize=`$run ./try`
9195 echo "Your file offsets are $lseeksize bytes long."
9196else
9197 dflt=$longsize
9198 echo " "
9199 echo "(I can't seem to compile the test program. Guessing...)"
9200 rp="What is the size of your file offsets (in bytes)?"
9201 . ./myread
9202 lseeksize="$ans"
9203fi
5b813a60 9204$rm_try
96056487
JH
9205
9206: see what type file positions are declared as in the library
9207rp="What is the type for file position used by fsetpos()?"
9208set fpos_t fpostype long stdio.h sys/types.h
9209eval $typedef_ask
9210
613d6c3e 9211: Check size for Fpos_t
96056487
JH
9212echo " "
9213case "$fpostype" in
9214*_t) zzz="$fpostype" ;;
9215*) zzz="fpos_t" ;;
9216esac
613d6c3e 9217echo "Checking the size of $zzz..." >&4
96056487
JH
9218cat > try.c <<EOCP
9219#include <sys/types.h>
9220#include <stdio.h>
d1daaddf
JH
9221#$i_stdlib I_STDLIB
9222#ifdef I_STDLIB
9223#include <stdlib.h>
9224#endif
96056487
JH
9225int main() {
9226 printf("%d\n", (int)sizeof($fpostype));
9227 exit(0);
9228}
9229EOCP
9230set try
9231if eval $compile_ok; then
9232 yyy=`$run ./try`
9233 case "$yyy" in
9234 '') fpossize=4
9235 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9236 ;;
9237 *) fpossize=$yyy
9238 echo "Your $zzz is $fpossize bytes long."
9239 ;;
9240 esac
9241else
9242 dflt="$longsize"
9243 echo " " >&4
9244 echo "(I can't compile the test program. Guessing...)" >&4
9245 rp="What is the size of your file positions (in bytes)?"
9246 . ./myread
9247 fpossize="$ans"
9248fi
9249
613d6c3e 9250: Check for large file support
96056487
JH
9251# Backward compatibility (uselfs is deprecated).
9252case "$uselfs" in
9253"$define"|true|[yY]*)
9254 cat <<EOM >&4
9255
9256*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9257EOM
9258 uselargefiles="$define"
9259 ;;
5b813a60 9260esac
96056487
JH
9261
9262case "$lseeksize:$fpossize" in
92638:8) cat <<EOM
9264
9265You can have files larger than 2 gigabytes.
9266EOM
9267 val="$define" ;;
9268*) case "$uselargefiles" in
9269 "$undef"|false|[nN]*) dflt='n' ;;
9270 *) dflt='y' ;;
9271 esac
9272 cat <<EOM
9273
9274Perl can be built to understand large files (files larger than 2 gigabytes)
9275on some systems. To do so, Configure can be run with -Duselargefiles.
9276
9277If this doesn't make any sense to you, just accept the default '$dflt'.
9278EOM
9279 rp='Try to understand large files, if available?'
9280 . ./myread
9281 case "$ans" in
9282 y|Y) val="$define" ;;
9283 *) val="$undef" ;;
9284 esac
9285 ;;
9286esac
9287set uselargefiles
9288eval $setvar
96056487
JH
9289: Look for a hint-file generated 'call-back-unit'. If the
9290: user has specified that a large files perl is to be built,
9291: we may need to set or change some other defaults.
9da7673b
MB
9292if $test -f uselargefiles.cbu; then
9293 echo "Your platform has some specific hints regarding large file builds, using them..."
9294 . ./uselargefiles.cbu
9295fi
9296case "$uselargefiles" in
9297"$define")
96056487 9298 if $test -f uselargefiles.cbu; then
96056487
JH
9299 echo " "
9300 echo "Rechecking to see how big your file offsets are..." >&4
9301 $cat >try.c <<EOCP
9302#include <sys/types.h>
9303#include <stdio.h>
9304int main()
9305{
9306 printf("%d\n", (int)sizeof($lseektype));
5b813a60 9307 return(0);
96056487
JH
9308}
9309EOCP
9310 set try
9311 if eval $compile_ok; then
9312 lseeksize=`$run ./try`
9313 $echo "Your file offsets are now $lseeksize bytes long."
9314 else
9315 dflt="$lseeksize"
9316 echo " "
9317 echo "(I can't seem to compile the test program. Guessing...)"
9318 rp="What is the size of your file offsets (in bytes)?"
9319 . ./myread
9320 lseeksize="$ans"
9321 fi
9322 case "$fpostype" in
9323 *_t) zzz="$fpostype" ;;
9324 *) zzz="fpos_t" ;;
9325 esac
5b813a60 9326 $echo $n "Rechecking the size of $zzz...$c" >&4
96056487
JH
9327 $cat > try.c <<EOCP
9328#include <sys/types.h>
9329#include <stdio.h>
55954f19
JH
9330#$i_stdlib I_STDLIB
9331#ifdef I_STDLIB
9332#include <stdlib.h>
9333#endif
96056487
JH
9334int main() {
9335 printf("%d\n", (int)sizeof($fpostype));
073b6de5 9336 return(0);
96056487
JH
9337}
9338EOCP
9339 set try
9340 if eval $compile_ok; then
9341 yyy=`$run ./try`
9342 dflt="$lseeksize"
9343 case "$yyy" in
9344 '') echo " "
9345 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9346 ;;
9347 *) fpossize=$yyy
9348 echo " $fpossize bytes." >&4
9349 ;;
9350 esac
9351 else
9352 dflt="$fpossize"
9353 echo " "
9354 echo "(I can't compile the test program. Guessing...)" >&4
9355 rp="What is the size of your file positions (in bytes)?"
9356 . ./myread
9357 fpossize="$ans"
9358 fi
5b813a60 9359 $rm_try
96056487
JH
9360 fi
9361 ;;
9362esac
9363
613d6c3e 9364: Set the vendorbin variables
b4eb6b3d
JH
9365case "$vendorprefix" in
9366'') d_vendorbin="$undef"
9367 vendorbin=''
9368 vendorbinexp=''
9369 ;;
9370*) d_vendorbin="$define"
9371 : determine where vendor-supplied executables go.
9372 case "$vendorbin" in
9373 '') dflt=$vendorprefix/bin ;;
9374 *) dflt="$vendorbin" ;;
9375 esac
9376 fn=d~+
9377 rp='Pathname for the vendor-supplied executables directory?'
9378 . ./getfile
9379 vendorbin="$ans"
9380 vendorbinexp="$ansexp"
9381 ;;
9382esac
a092d240
NC
9383prefixvar=vendorbin
9384. ./installprefix
b4eb6b3d 9385
613d6c3e 9386: Set the vendorhtml1dir variables
6e1038e0 9387case "$vendorprefix" in
8d2cbf27
JH
9388'') vendorhtml1dir=''
9389 vendorhtml1direxp=''
6e1038e0
MB
9390 ;;
9391*) : determine where vendor-supplied html pages go.
9392 : There is no standard location, so try to copy the previously-selected
9393 : directory structure for the core html pages.
9394 : XXX Better default suggestions would be welcome.
8d2cbf27 9395 case "$vendorhtml1dir" in
6e1038e0 9396 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9397 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9398 esac
9399 case "$dflt" in
9400 ''|' ') dflt=none ;;
9401 esac
9402 fn=dn+~
9403 rp='Pathname for the vendor-supplied html pages?'
9404 . ./getfile
8d2cbf27
JH
9405 vendorhtml1dir="$ans"
9406 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9407 ;;
9408esac
9409: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9410$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
a092d240
NC
9411prefixvar=vendorhtml1dir
9412. ./installprefix
6e1038e0 9413
613d6c3e 9414: Set the vendorhtml3dir variables
6e1038e0 9415case "$vendorprefix" in
8d2cbf27
JH
9416'') vendorhtml3dir=''
9417 vendorhtml3direxp=''
6e1038e0
MB
9418 ;;
9419*) : determine where vendor-supplied module html pages go.
9420 : There is no standard location, so try to copy the previously-selected
9421 : directory structure for the core html pages.
9422 : XXX Better default suggestions would be welcome.
8d2cbf27 9423 case "$vendorhtml3dir" in
6e1038e0 9424 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9425 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9426 esac
9427 case "$dflt" in
9428 ''|' ') dflt=none ;;
9429 esac
9430 fn=dn+~
9431 rp='Pathname for the vendor-supplied html pages?'
9432 . ./getfile
8d2cbf27
JH
9433 vendorhtml3dir="$ans"
9434 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9435 ;;
9436esac
9437: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9438$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
a092d240
NC
9439prefixvar=vendorhtml3dir
9440. ./installprefix
6e1038e0 9441
613d6c3e 9442: Set the vendorman1dir variables
6e1038e0 9443case "$vendorprefix" in
91e123a8
JH
9444'') vendorman1dir=''
9445 vendorman1direxp=''
6e1038e0
MB
9446 ;;
9447*) : determine where vendor-supplied manual pages go.
91e123a8 9448 case "$vendorman1dir" in
6e1038e0 9449 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9450 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9451 esac
9452 case "$dflt" in
9453 ''|' ') dflt=none ;;
9454 esac
9455 fn=nd~+
9456 rp='Pathname for the vendor-supplied manual section 1 pages?'
9457 . ./getfile
91e123a8
JH
9458 vendorman1dir="$ans"
9459 vendorman1direxp="$ansexp"
6e1038e0
MB
9460 ;;
9461esac
9462: Use ' ' for none so value is preserved next time through Configure
91e123a8 9463$test X"$vendorman1dir" = "X" && vendorman1dir=' '
a092d240
NC
9464prefixvar=vendorman1dir
9465. ./installprefix
6e1038e0 9466
613d6c3e 9467: Set the vendorman3dir variables
6e1038e0 9468case "$vendorprefix" in
91e123a8
JH
9469'') vendorman3dir=''
9470 vendorman3direxp=''
6e1038e0
MB
9471 ;;
9472*) : determine where vendor-supplied module manual pages go.
91e123a8 9473 case "$vendorman3dir" in
6e1038e0 9474 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9475 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9476 esac
9477 case "$dflt" in
9478 ''|' ') dflt=none ;;
9479 esac
9480 fn=nd~+
9481 rp='Pathname for the vendor-supplied manual section 3 pages?'
9482 . ./getfile
91e123a8
JH
9483 vendorman3dir="$ans"
9484 vendorman3direxp="$ansexp"
6e1038e0
MB
9485 ;;
9486esac
9487: Use ' ' for none so value is preserved next time through Configure
91e123a8 9488$test X"$vendorman3dir" = "X" && vendorman3dir=' '
a092d240
NC
9489prefixvar=vendorman3dir
9490. ./installprefix
6e1038e0 9491
613d6c3e 9492: Set the vendorscript variables
6e1038e0
MB
9493case "$vendorprefix" in
9494'') d_vendorscript="$undef"
9495 vendorscript=''
9496 vendorscriptexp=''
9497 ;;
9498*) d_vendorscript="$define"
9499 : determine where vendor-supplied scripts go.
9500 case "$vendorscript" in
9501 '') dflt=$vendorprefix/script
9502 $test -d $dflt || dflt=$vendorbin ;;
9503 *) dflt="$vendorscript" ;;
9504 esac
9505 $cat <<EOM
9506
f3f1a2d8 9507The installation process will create a directory for
6e1038e0
MB
9508vendor-supplied scripts.
9509
9510EOM
9511 fn=d~+
9512 rp='Pathname for the vendor-supplied scripts directory?'
9513 . ./getfile
9514 vendorscript="$ans"
9515 vendorscriptexp="$ansexp"
9516 ;;
9517esac
a092d240
NC
9518prefixvar=vendorscript
9519. ./installprefix
6e1038e0 9520
f47f1645
TC
9521: script used to emit important warnings
9522cat >warn <<EOS
9523$startsh
9524if test \$# -gt 0; then
9525 echo "\$@" >msg
9526else
9527 cat >msg
9528fi
9529echo "*** WARNING:" >&4
9530sed -e 's/^/*** /' <msg >&4
9531echo "*** " >&4
9532cat msg >>config.msg
9533echo " " >>config.msg
9534rm -f msg
9535EOS
9536chmod +x warn
9537$eunicefix warn
9538
9539: see which of string.h or strings.h is needed
9540echo " "
9541strings=`./findhdr string.h`
9542if $test "$strings" && $test -r "$strings"; then
9543 echo "Using <string.h> instead of <strings.h>." >&4
9544 val="$define"
9545else
9546 val="$undef"
9547 strings=`./findhdr strings.h`
9548 if $test "$strings" && $test -r "$strings"; then
9549 echo "Using <strings.h> instead of <string.h>." >&4
9550 else
9551 ./warn "No string header found -- You'll surely have problems."
9552 fi
9553fi
9554set i_string
9555eval $setvar
9556case "$i_string" in
9557"$undef") strings=`./findhdr strings.h`;;
9558*) strings=`./findhdr string.h`;;
9559esac
9560
b4eb6b3d
JH
9561: see if qgcvt exists
9562set qgcvt d_qgcvt
9563eval $inlibc
9564
613d6c3e 9565: Check print/scan long double stuff
89ce900e
JH
9566echo " "
9567
9568if $test X"$d_longdbl" = X"$define"; then
9569
9570echo "Checking how to print long doubles..." >&4
9571
9572if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9573 $cat >try.c <<'EOCP'
9574#include <sys/types.h>
9575#include <stdio.h>
9576int main() {
9577 double d = 123.456;
9578 printf("%.3f\n", d);
9579}
9580EOCP
9581 set try
9582 if eval $compile; then
9583 yyy=`$run ./try`
9584 case "$yyy" in
9585 123.456)
9586 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9587 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9588 echo "We will use %f."
9589 ;;
9590 esac
9591 fi
9592fi
9593
9594if $test X"$sPRIfldbl" = X; then
9595 $cat >try.c <<'EOCP'
9596#include <sys/types.h>
9597#include <stdio.h>
9598int main() {
9599 long double d = 123.456;
9600 printf("%.3Lf\n", d);
9601}
9602EOCP
9603 set try
9604 if eval $compile; then
9605 yyy=`$run ./try`
9606 case "$yyy" in
9607 123.456)
9608 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9609 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9610 echo "We will use %Lf."
9611 ;;
9612 esac
9613 fi
9614fi
9615
9616if $test X"$sPRIfldbl" = X; then
9617 $cat >try.c <<'EOCP'
9618#include <sys/types.h>
9619#include <stdio.h>
9620int main() {
9621 long double d = 123.456;
9622 printf("%.3llf\n", d);
9623}
9624EOCP
9625 set try
9626 if eval $compile; then
9627 yyy=`$run ./try`
9628 case "$yyy" in
9629 123.456)
9630 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9631 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9632 echo "We will use %llf."
9633 ;;
9634 esac
9635 fi
9636fi
9637
9638if $test X"$sPRIfldbl" = X; then
9639 $cat >try.c <<'EOCP'
9640#include <sys/types.h>
9641#include <stdio.h>
9642int main() {
9643 long double d = 123.456;
9644 printf("%.3lf\n", d);
9645}
9646EOCP
9647 set try
9648 if eval $compile; then
9649 yyy=`$run ./try`
9650 case "$yyy" in
9651 123.456)
9652 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9653 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9654 echo "We will use %lf."
9655 ;;
9656 esac
9657 fi
9658fi
9659
9660if $test X"$sPRIfldbl" = X; then
9661 echo "Cannot figure out how to print long doubles." >&4
9662else
9663 sSCNfldbl=$sPRIfldbl # expect consistency
9664fi
9665
5b813a60 9666$rm_try
89ce900e
JH
9667
9668fi # d_longdbl
9669
9670case "$sPRIfldbl" in
5b813a60
MB
9671'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9672 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
89ce900e
JH
9673 d_SCNfldbl="$undef";
9674 ;;
5b813a60
MB
9675*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9676 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
89ce900e
JH
9677 d_SCNfldbl="$define";
9678 ;;
9679esac
9680
b4eb6b3d 9681: Check how to convert floats to strings.
a5b10d80
YST
9682
9683if test "X$d_Gconvert" = X; then
9684
b4eb6b3d
JH
9685echo " "
9686echo "Checking for an efficient way to convert floats to strings."
9687echo " " > try.c
9688case "$uselongdouble" in
9689"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9690esac
9691case "$d_longdbl" in
9692"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9693esac
9694case "$d_PRIgldbl" in
9695"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9696esac
9697$cat >>try.c <<EOP
9698#ifdef TRY_gconvert
9699#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9700char *myname = "gconvert";
9701#endif
9702#ifdef TRY_gcvt
9703#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9704char *myname = "gcvt";
9705#endif
9706#ifdef TRY_qgcvt
9707#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9708char *myname = "qgcvt";
9709#define DOUBLETYPE long double
9710#endif
9711#ifdef TRY_sprintf
a5b10d80
YST
9712#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9713#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9714#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9715#else
a5b10d80
YST
9716#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9717#endif
9718#else
b4eb6b3d
JH
9719#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9720#endif
9721char *myname = "sprintf";
9722#endif
9723
9724#ifndef DOUBLETYPE
9725#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9726#define DOUBLETYPE long double
9727#else
9728#define DOUBLETYPE double
9729#endif
9730#endif
9731
9732#include <stdio.h>
9733
f47f1645 9734#$i_stdlib I_STDLIB
b4eb6b3d
JH
9735#ifdef I_STDLIB
9736#include <stdlib.h>
9737#endif
f47f1645
TC
9738#$i_string I_STRING
9739#ifdef I_STRING
9740# include <string.h>
9741#else
9742# include <strings.h>
9743#endif
b4eb6b3d 9744
f47f1645 9745int checkit(char *expect, char *got)
b4eb6b3d
JH
9746{
9747 if (strcmp(expect, got)) {
9748 printf("%s oddity: Expected %s, got %s\n",
9749 myname, expect, got);
9750 exit(1);
9751 }
9752}
9753
9754int main()
5b813a60
MB
9755{
9756 char buf[64];
b4eb6b3d
JH
9757 buf[63] = '\0';
9758
9759 /* This must be 1st test on (which?) platform */
9760 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9761 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9762 checkit("0.1", buf);
9763
5b813a60 9764 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
a5b10d80
YST
9765 checkit("0.01", buf);
9766
5b813a60 9767 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
a5b10d80
YST
9768 checkit("0.001", buf);
9769
5b813a60 9770 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
a5b10d80
YST
9771 checkit("0.0001", buf);
9772
9773 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9774 if (strlen(buf) > 5)
9775 checkit("9e-005", buf); /* for Microsoft ?? */
9776 else
9777 checkit("9e-05", buf);
9778
5b813a60 9779 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
b4eb6b3d
JH
9780 checkit("1", buf);
9781
5b813a60 9782 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
b4eb6b3d
JH
9783 checkit("1.1", buf);
9784
5b813a60 9785 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
b4eb6b3d
JH
9786 checkit("1.01", buf);
9787
5b813a60 9788 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
b4eb6b3d
JH
9789 checkit("1.001", buf);
9790
5b813a60 9791 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
b4eb6b3d
JH
9792 checkit("1.0001", buf);
9793
5b813a60 9794 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
b4eb6b3d
JH
9795 checkit("1.00001", buf);
9796
5b813a60 9797 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
b4eb6b3d
JH
9798 checkit("1.000001", buf);
9799
5b813a60 9800 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
b4eb6b3d
JH
9801 checkit("0", buf);
9802
5b813a60 9803 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
b4eb6b3d
JH
9804 checkit("-1", buf);
9805
9806 /* Some Linux gcvt's give 1.e+5 here. */
5b813a60 9807 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
b4eb6b3d 9808 checkit("100000", buf);
5b813a60 9809
b4eb6b3d 9810 /* Some Linux gcvt's give -1.e+5 here. */
5b813a60 9811 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
b4eb6b3d
JH
9812 checkit("-100000", buf);
9813
5b813a60 9814 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
b4eb6b3d
JH
9815 checkit("123.456", buf);
9816
ab6ca9f4 9817 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9818 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9819 /* 34 should be enough to scare even long double
9820 * places into using the e notation. */
ab6ca9f4 9821 if (strlen(buf) > 5)
94b339ad 9822 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9823 else
94b339ad 9824 checkit("1e+34", buf);
8e2a5ede 9825
d1eb8299
YST
9826 /* For Perl, if you add additional tests here, also add them to
9827 * t/base/num.t for benefit of platforms not using Configure or
9828 * overriding d_Gconvert */
9829
b4eb6b3d
JH
9830 exit(0);
9831}
9832EOP
ab6ca9f4 9833: first add preferred functions to our list
a5b10d80 9834xxx_list=""
ab6ca9f4 9835for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9836 case $xxx_convert in
9837 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9838 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
5b813a60 9839 esac
a5b10d80
YST
9840done
9841: then add any others
9842for xxx_convert in gconvert gcvt sprintf; do
9843 case "$xxx_list" in
9844 *$xxx_convert*) ;;
9845 *) xxx_list="$xxx_list $xxx_convert" ;;
5b813a60 9846 esac
a5b10d80
YST
9847done
9848
9849case "$d_longdbl$uselongdouble" in
9850"$define$define")
9851 : again, add prefered functions to our list first
9852 xxx_ld_list=""
ab6ca9f4 9853 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9854 case $xxx_convert in
9855 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9856 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9857 esac
9858 done
9859 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9860 for xxx_convert in qgcvt sprintf $xxx_list; do
9861 case "$xxx_ld_list" in
9862 $xxx_convert*|*" $xxx_convert"*) ;;
9863 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9864 esac
9865 done
9866 : if sprintf cannot do long doubles, move it to the end
9867 if test "$d_PRIgldbl" != "$define"; then
9868 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9869 fi
9870 : if no qgcvt, remove it
9871 if test "$d_qgcvt" != "$define"; then
9872 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9873 fi
9874 : use the ld_list
9875 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9876 ;;
9877esac
9878
9879for xxx_convert in $xxx_list; do
9880 echo "Trying $xxx_convert..."
93451a0d 9881 $rm -f try try$_o core
b4eb6b3d
JH
9882 set try -DTRY_$xxx_convert
9883 if eval $compile; then
9884 echo "$xxx_convert() found." >&4
5440bc8e 9885 if $run ./try; then
b4eb6b3d
JH
9886 echo "I'll use $xxx_convert to convert floats into a string." >&4
9887 break;
9888 else
9889 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9890 xxx_convert=''
b4eb6b3d
JH
9891 fi
9892 else
9893 echo "$xxx_convert NOT found." >&4
9894 fi
9895done
ab6ca9f4 9896
a5b10d80
YST
9897if test X$xxx_convert = X; then
9898 echo "*** WHOA THERE!!! ***" >&4
9899 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9900 xxx_convert=sprintf
9901fi
9902
b4eb6b3d
JH
9903case "$xxx_convert" in
9904gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9905gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9906qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9907*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9908 "$define$define$define")
9909 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9910 "$define$define$undef")
9911 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9912 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9913 esac
5b813a60 9914 ;;
b4eb6b3d
JH
9915esac
9916
a5b10d80 9917fi
93451a0d 9918$rm_try
a5b10d80 9919
74cac757
JH
9920: see if _fwalk exists
9921set fwalk d__fwalk
9922eval $inlibc
9923
b4eb6b3d
JH
9924: Initialize h_fcntl
9925h_fcntl=false
9926
9927: Initialize h_sysfile
9928h_sysfile=false
9929
9930: access call always available on UNIX
9931set access d_access
9932eval $inlibc
9933
9934: locate the flags for 'access()'
9935case "$d_access" in
9936"$define")
9937 echo " "
55954f19 9938 $cat >access.c <<EOCP
b4eb6b3d
JH
9939#include <sys/types.h>
9940#ifdef I_FCNTL
9941#include <fcntl.h>
9942#endif
9943#ifdef I_SYS_FILE
9944#include <sys/file.h>
9945#endif
9946#ifdef I_UNISTD
9947#include <unistd.h>
9948#endif
55954f19
JH
9949#$i_stdlib I_STDLIB
9950#ifdef I_STDLIB
9951#include <stdlib.h>
9952#endif
b4eb6b3d
JH
9953int main() {
9954 exit(R_OK);
9955}
9956EOCP
9957 : check sys/file.h first, no particular reason here
9958 if $test `./findhdr sys/file.h` && \
7a282f6d 9959 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9960 h_sysfile=true;
9961 echo "<sys/file.h> defines the *_OK access constants." >&4
9962 elif $test `./findhdr fcntl.h` && \
7a282f6d 9963 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9964 h_fcntl=true;
9965 echo "<fcntl.h> defines the *_OK access constants." >&4
9966 elif $test `./findhdr unistd.h` && \
7a282f6d 9967 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9968 echo "<unistd.h> defines the *_OK access constants." >&4
9969 else
9970 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9971 fi
9972 ;;
9973esac
9974$rm -f access*
9975
9976: see if accessx exists
9977set accessx d_accessx
9978eval $inlibc
9979
89ce900e
JH
9980: see if aintl exists
9981set aintl d_aintl
9982eval $inlibc
9983
b4eb6b3d
JH
9984: see if alarm exists
9985set alarm d_alarm
9986eval $inlibc
9987
96938616
MB
9988: see if 64bit time functions exists
9989
9990set ctime64 d_ctime64
9991eval $inlibc
9992
9993set localtime64 d_localtime64
9994eval $inlibc
9995
9996set gmtime64 d_gmtime64
9997eval $inlibc
9998
9999set mktime64 d_mktime64
10000eval $inlibc
10001
10002set difftime64 d_difftime64
10003eval $inlibc
10004
10005set asctime64 d_asctime64
10006eval $inlibc
10007
a9dade78
JH
10008: see if POSIX threads are available
10009set pthread.h i_pthread
10010eval $inhdr
10011
10bc17b6
JH
10012: define a fucntion to check prototypes
10013$cat > protochk <<EOSH
10014$startsh
10015cc="$cc"
10016optimize="$optimize"
10017ccflags="$ccflags"
10018prototype="$prototype"
10019define="$define"
c944cfb9 10020rm_try="$rm_try"
a9dade78
JH
10021usethreads=$usethreads
10022i_pthread=$i_pthread
10023pthread_h_first=$pthread_h_first
10bc17b6
JH
10024EOSH
10025
10026$cat >> protochk <<'EOSH'
10027
5b813a60 10028$rm_try
10bc17b6
JH
10029foo="$1"
10030shift
10031while test $# -ge 2; do
10032 case "$1" in
10033 $define) echo "#include <$2>" >> try.c ;;
10034 literal) echo "$2" >> try.c ;;
10035 esac
cce6a207
MB
10036 # Extra magic for the benefit of systems that need pthread.h
10037 # to be included early to correctly detect threadsafe functions.
10038 # Such functions must guarantee themselves, though, that the usethreads
10039 # and i_pthread have been defined, before calling protochk.
10040 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10041 echo "#include <pthread.h>" >> try.c
10042 pthread_h_done=yes
10043 fi
10bc17b6
JH
10044 shift 2
10045done
10046test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
10047cat >> try.c <<'EOCP'
10048#ifdef CAN_PROTOTYPE
10049#define _(args) args
10050#else
10051#define _(args) ()
10052#endif
10053EOCP
10054echo "$foo" >> try.c
10055echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10056$cc $optimize $ccflags -c try.c > /dev/null 2>&1
10057status=$?
5b813a60 10058$rm_try
10bc17b6
JH
10059exit $status
10060EOSH
10061chmod +x protochk
10062$eunicefix protochk
10063
34f1896b 10064: Define hasproto macro for Configure internal use
89ce900e
JH
10065hasproto='varname=$1; func=$2; shift; shift;
10066while $test $# -ge 2; do
10067 case "$1" in
10068 $define) echo "#include <$2>";;
10069 esac ;
10070 shift 2;
10071done > try.c;
10072$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10073if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10074 echo "$func() prototype found.";
10075 val="$define";
10076else
10077 echo "$func() prototype NOT found.";
10078 val="$undef";
10079fi;
10080set $varname;
10081eval $setvar;
5b813a60 10082$rm_try tryout.c'
89ce900e 10083
10bc17b6
JH
10084: see if sys/types.h has to be included
10085set sys/types.h i_systypes
10086eval $inhdr
10087
10088: see if sys/select.h has to be included
10089set sys/select.h i_sysselct
10090eval $inhdr
10091
34f1896b 10092: Define hasfield macro for Configure internal use
10bc17b6
JH
10093hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10094while $test $# -ge 2; do
10095 case "$1" in
10096 $define) echo "#include <$2>";;
10097 esac ;
10098 shift 2;
10099done > try.c;
10100echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10101set try;
10102if eval $compile; then
10103 val="$define";
10104else
10105 val="$undef";
10106fi;
10107set $varname;
10108eval $setvar;
5b813a60 10109$rm_try'
10bc17b6
JH
10110
10111: see if we should include time.h, sys/time.h, or both
10112echo " "
10113if test "X$timeincl" = X; then
10114 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10115 $echo $n "I'm now running the test program...$c"
55954f19 10116 $cat >try.c <<EOCP
10bc17b6
JH
10117#include <sys/types.h>
10118#ifdef I_TIME
10119#include <time.h>
10120#endif
10121#ifdef I_SYSTIME
10122#ifdef SYSTIMEKERNEL
10123#define KERNEL
10124#endif
10125#include <sys/time.h>
10126#endif
10127#ifdef I_SYSSELECT
10128#include <sys/select.h>
10129#endif
55954f19
JH
10130#$i_stdlib I_STDLIB
10131#ifdef I_STDLIB
10132#include <stdlib.h>
10133#endif
10bc17b6
JH
10134int main()
10135{
10136 struct tm foo;
10137#ifdef S_TIMEVAL
10138 struct timeval bar;
10139#endif
10140#ifdef S_TIMEZONE
10141 struct timezone tzp;
10142#endif
10143 if (foo.tm_sec == foo.tm_sec)
10144 exit(0);
10145#ifdef S_TIMEVAL
10146 if (bar.tv_sec == bar.tv_sec)
10147 exit(0);
10148#endif
10149 exit(1);
10150}
10151EOCP
10152 flags=''
10153 for s_timezone in '-DS_TIMEZONE' ''; do
10154 sysselect=''
10155 for s_timeval in '-DS_TIMEVAL' ''; do
10156 for i_systimek in '' '-DSYSTIMEKERNEL'; do
10157 for i_time in '' '-DI_TIME'; do
10158 for i_systime in '-DI_SYSTIME' ''; do
10159 case "$flags" in
10160 '') $echo $n ".$c"
10161 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10162 if eval $compile; then
10163 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10164 shift
10165 flags="$*"
10166 echo " "
10167 $echo $n "Succeeded with $flags$c"
10168 fi
10169 ;;
10170 esac
10171 done
10172 done
10173 done
10174 done
10175 done
10176 timeincl=''
10177 echo " "
10178 case "$flags" in
10179 *SYSTIMEKERNEL*) i_systimek="$define"
10180 timeincl=`./findhdr sys/time.h`
10181 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10182 *) i_systimek="$undef";;
10183 esac
10184 case "$flags" in
10185 *I_TIME*) i_time="$define"
10186 timeincl=`./findhdr time.h`" $timeincl"
10187 echo "We'll include <time.h>." >&4;;
10188 *) i_time="$undef";;
10189 esac
10190 case "$flags" in
10191 *I_SYSTIME*) i_systime="$define"
10192 timeincl=`./findhdr sys/time.h`" $timeincl"
10193 echo "We'll include <sys/time.h>." >&4;;
10194 *) i_systime="$undef";;
10195 esac
5b813a60 10196 $rm_try
10bc17b6
JH
10197fi
10198: see if struct tm knows about tm_zone
10199case "$i_systime$i_time" in
5b813a60 10200*$define*)
10bc17b6
JH
10201 echo " "
10202 echo "Checking to see if your struct tm has tm_zone field..." >&4
10203 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10204 eval $hasfield
10205 ;;
10206*) val="$undef"
10207 set d_tm_tm_zone
10208 eval $setvar
10209 ;;
10210esac
10211case "$d_tm_tm_zone" in
10212"$define") echo "Yes, it does." ;;
10213*) echo "No, it doesn't." ;;
10214esac
10215: see if struct tm knows about tm_gmtoff
10216case "$i_systime$i_time" in
5b813a60 10217*$define*)
10bc17b6
JH
10218 echo " "
10219 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10220 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10221 eval $hasfield
10222 ;;
10223*) val="$undef"
10224 set d_tm_tm_gmtoff
10225 eval $setvar
10226 ;;
10227esac
10228case "$d_tm_tm_gmtoff" in
10229"$define") echo "Yes, it does." ;;
10230*) echo "No, it doesn't." ;;
10231esac
10232
10233: see if asctime_r exists
10234set asctime_r d_asctime_r
10235eval $inlibc
10236case "$d_asctime_r" in
10237"$define")
d63eadf0 10238 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
10239 case "$d_asctime_r_proto:$usethreads" in
10240 ":define") d_asctime_r_proto=define
a48ec845
JH
10241 set d_asctime_r_proto asctime_r $hdrs
10242 eval $hasproto ;;
10243 *) ;;
10244 esac
10245 case "$d_asctime_r_proto" in
10246 define)
10bc17b6
JH
10247 case "$asctime_r_proto" in
10248 ''|0) try='char* asctime_r(const struct tm*, char*);'
61c26d18 10249 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10bc17b6
JH
10250 esac
10251 case "$asctime_r_proto" in
10252 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
61c26d18 10253 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10bc17b6
JH
10254 esac
10255 case "$asctime_r_proto" in
10256 ''|0) try='int asctime_r(const struct tm*, char*);'
61c26d18 10257 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10bc17b6
JH
10258 esac
10259 case "$asctime_r_proto" in
10260 ''|0) try='int asctime_r(const struct tm*, char*, int);'
61c26d18 10261 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10bc17b6
JH
10262 esac
10263 case "$asctime_r_proto" in
90e831dc 10264 ''|0) d_asctime_r=undef
10bc17b6 10265 asctime_r_proto=0
a48ec845 10266 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10267 * ) case "$asctime_r_proto" in
10268 REENTRANT_PROTO*) ;;
10269 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10270 esac
10271 echo "Prototype: $try" ;;
10272 esac
10273 ;;
c18e646a
JH
10274 *) case "$usethreads" in
10275 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10276 esac
90e831dc
SB
10277 d_asctime_r=undef
10278 asctime_r_proto=0
c18e646a 10279 ;;
a48ec845
JH
10280 esac
10281 ;;
10bc17b6
JH
10282*) asctime_r_proto=0
10283 ;;
10284esac
10285
b4eb6b3d
JH
10286: see if atolf exists
10287set atolf d_atolf
10288eval $inlibc
10289
10290: see if atoll exists
10291set atoll d_atoll
10292eval $inlibc
10293
0dbb1585
AL
10294: Look for GCC-style attribute format
10295case "$d_attribute_format" in
bde30f85 10296'')
b4eb6b3d 10297echo " "
0dbb1585 10298echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
b4eb6b3d
JH
10299$cat >attrib.c <<'EOCP'
10300#include <stdio.h>
0dbb1585 10301void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
b4eb6b3d
JH
10302EOCP
10303if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10304 if $contains 'warning' attrib.out >/dev/null 2>&1; then
0dbb1585 10305 echo "Your C compiler doesn't support __attribute__((format))."
b4eb6b3d
JH
10306 val="$undef"
10307 else
0dbb1585 10308 echo "Your C compiler supports __attribute__((format))."
b4eb6b3d
JH
10309 val="$define"
10310 fi
10311else
10312 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10313 val="$undef"
10314fi
bde30f85 10315;;
0dbb1585 10316*) val="$d_attribute_format" ;;
bde30f85 10317esac
0dbb1585
AL
10318set d_attribute_format
10319eval $setvar
10320$rm -f attrib*
10321
dcb594bc
MB
10322: Look for GCC-style attribute format with null format allowed
10323case "$d_printf_format_null" in
10324'') case "$d_attribute_format" in
10325 $define)
10326 echo " "
10327 echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10328$cat >attrib.c <<EOCP
10329#include <stdio.h>
10330#$i_stdlib I_STDLIB
10331#ifdef I_STDLIB
10332#include <stdlib.h>
10333#endif
10334int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10335int null_printf (char* pat,...) { return (int)pat; }
10336int main () { exit(null_printf(NULL)); }
10337EOCP
10338 if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10339 : run the executable in case it produces a run-time warning
10340 if $run ./attrib >>attrib.out 2>&1; then
10341 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10342 echo "Your C compiler doesn't allow __printf__ format to be null."
10343 val="$undef"
10344 else
10345 echo "Your C compiler allows __printf__ format to be null."
10346 val="$define"
10347 fi
10348 else
10349 echo "Your C compiler executable failed with __printf__ format null."
10350 val="$undef"
10351 fi
10352 else
10353 echo "Your C compiler fails with __printf__ format null."
10354 val="$undef"
10355 fi
10356 ;;
10357 *) val="$undef" ;;
10358 esac
10359;;
10360*) val="$d_printf_format_null" ;;
10361esac
10362set d_printf_format_null
10363eval $setvar
10364$rm -f attrib*
10365
0dbb1585
AL
10366: Look for GCC-style attribute malloc
10367case "$d_attribute_malloc" in
10368'')
10369echo " "
10370echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10371$cat >attrib.c <<'EOCP'
10372#include <stdio.h>
10373char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10374EOCP
10375if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10376 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10377 echo "Your C compiler doesn't support __attribute__((malloc))."
10378 val="$undef"
10379 else
10380 echo "Your C compiler supports __attribute__((malloc))."
10381 val="$define"
10382 fi
10383else
10384 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10385 val="$undef"
10386fi
10387;;
10388*) val="$d_attribute_malloc" ;;
10389esac
10390set d_attribute_malloc
10391eval $setvar
10392$rm -f attrib*
10393
10394: Look for GCC-style attribute nonnull
10395case "$d_attribute_nonnull" in
10396'')
10397echo " "
10398echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10399$cat >attrib.c <<'EOCP'
10400#include <stdio.h>
10401void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10402EOCP
10403if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10404 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10405 echo "Your C compiler doesn't support __attribute__((nonnull))."
10406 val="$undef"
10407 else
10408 echo "Your C compiler supports __attribute__((nonnull))."
10409 val="$define"
10410 fi
10411else
10412 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10413 val="$undef"
10414fi
10415;;
10416*) val="$d_attribute_nonnull" ;;
10417esac
10418set d_attribute_nonnull
10419eval $setvar
10420$rm -f attrib*
10421
10422: Look for GCC-style attribute noreturn
10423case "$d_attribute_noreturn" in
10424'')
10425echo " "
10426echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10427$cat >attrib.c <<'EOCP'
10428#include <stdio.h>
10429void fall_over_dead( void ) __attribute__((noreturn));
10430EOCP
10431if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10432 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10433 echo "Your C compiler doesn't support __attribute__((noreturn))."
10434 val="$undef"
10435 else
10436 echo "Your C compiler supports __attribute__((noreturn))."
10437 val="$define"
10438 fi
10439else
10440 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10441 val="$undef"
10442fi
10443;;
10444*) val="$d_attribute_noreturn" ;;
10445esac
10446set d_attribute_noreturn
10447eval $setvar
10448$rm -f attrib*
10449
10450: Look for GCC-style attribute pure
10451case "$d_attribute_pure" in
10452'')
10453echo " "
10454echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10455$cat >attrib.c <<'EOCP'
10456#include <stdio.h>
10457int square( int n ) __attribute__((pure));
10458EOCP
10459if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10460 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10461 echo "Your C compiler doesn't support __attribute__((pure))."
10462 val="$undef"
10463 else
10464 echo "Your C compiler supports __attribute__((pure))."
10465 val="$define"
10466 fi
10467else
10468 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10469 val="$undef"
10470fi
10471;;
10472*) val="$d_attribute_pure" ;;
10473esac
10474set d_attribute_pure
10475eval $setvar
10476$rm -f attrib*
10477
10478: Look for GCC-style attribute unused
10479case "$d_attribute_unused" in
10480'')
10481echo " "
10482echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10483$cat >attrib.c <<'EOCP'
10484#include <stdio.h>
10485int do_something( int dummy __attribute__((unused)), int n );
10486EOCP
10487if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10488 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10489 echo "Your C compiler doesn't support __attribute__((unused))."
10490 val="$undef"
10491 else
10492 echo "Your C compiler supports __attribute__((unused))."
10493 val="$define"
10494 fi
10495else
10496 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10497 val="$undef"
10498fi
10499;;
10500*) val="$d_attribute_unused" ;;
10501esac
10502set d_attribute_unused
10503eval $setvar
10504$rm -f attrib*
10505
fcdf39cf
RGS
10506: Look for GCC-style attribute deprecated
10507case "$d_attribute_deprecated" in
10508'')
10509echo " "
10510echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10511$cat >attrib.c <<'EOCP'
10512#include <stdio.h>
10513int I_am_deprecated(void) __attribute__((deprecated));
10514EOCP
10515if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10516 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10517 echo "Your C compiler doesn't support __attribute__((deprecated))."
10518 val="$undef"
10519 else
10520 echo "Your C compiler supports __attribute__((deprecated))."
10521 val="$define"
10522 fi
10523else
10524 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10525 val="$undef"
10526fi
10527;;
10528*) val="$d_attribute_deprecated" ;;
10529esac
10530set d_attribute_deprecated
10531eval $setvar
10532$rm -f attrib*
10533
0dbb1585
AL
10534: Look for GCC-style attribute warn_unused_result
10535case "$d_attribute_warn_unused_result" in
10536'')
10537echo " "
10538echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10539$cat >attrib.c <<'EOCP'
10540#include <stdio.h>
10541int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10542EOCP
10543if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10544 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10545 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10546 val="$undef"
10547 else
10548 echo "Your C compiler supports __attribute__((warn_unused_result))."
10549 val="$define"
10550 fi
10551else
10552 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10553 val="$undef"
10554fi
10555;;
10556*) val="$d_attribute_warn_unused_result" ;;
10557esac
10558set d_attribute_warn_unused_result
b4eb6b3d
JH
10559eval $setvar
10560$rm -f attrib*
10561
10562: see if bcmp exists
10563set bcmp d_bcmp
10564eval $inlibc
10565
10566: see if bcopy exists
10567set bcopy d_bcopy
10568eval $inlibc
10569
b4eb6b3d
JH
10570: see if getpgrp exists
10571set getpgrp d_getpgrp
10572eval $inlibc
10573
10574case "$d_getpgrp" in
10575"$define")
10576 echo " "
10577 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 10578 $cat >try.c <<EOP
b4eb6b3d
JH
10579#$i_unistd I_UNISTD
10580#include <sys/types.h>
10581#ifdef I_UNISTD
10582# include <unistd.h>
10583#endif
55954f19
JH
10584#$i_stdlib I_STDLIB
10585#ifdef I_STDLIB
10586#include <stdlib.h>
10587#endif
b4eb6b3d
JH
10588int main()
10589{
10590 if (getuid() == 0) {
10591 printf("(I see you are running Configure as super-user...)\n");
10592 setuid(1);
10593 }
10594#ifdef TRY_BSD_PGRP
10595 if (getpgrp(1) == 0)
10596 exit(0);
10597#else
10598 if (getpgrp() > 0)
10599 exit(0);
10600#endif
10601 exit(1);
10602}
10603EOP
5440bc8e 10604 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10605 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10606 val="$define"
5440bc8e 10607 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10608 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10609 val="$undef"
10610 else
10611 echo "I can't seem to compile and run the test program."
10612 if ./usg; then
10613 xxx="a USG one, i.e. you use getpgrp()."
10614 else
10615 # SVR4 systems can appear rather BSD-ish.
10616 case "$i_unistd" in
10617 $undef)
10618 xxx="a BSD one, i.e. you use getpgrp(pid)."
10619 val="$define"
10620 ;;
10621 $define)
10622 xxx="probably a USG one, i.e. you use getpgrp()."
10623 val="$undef"
10624 ;;
10625 esac
10626 fi
10627 echo "Assuming your getpgrp is $xxx" >&4
10628 fi
10629 ;;
10630*) val="$undef";;
10631esac
10632set d_bsdgetpgrp
10633eval $setvar
5b813a60 10634$rm_try
b4eb6b3d
JH
10635
10636: see if setpgrp exists
10637set setpgrp d_setpgrp
10638eval $inlibc
10639
10640case "$d_setpgrp" in
10641"$define")
10642 echo " "
10643 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 10644 $cat >try.c <<EOP
b4eb6b3d
JH
10645#$i_unistd I_UNISTD
10646#include <sys/types.h>
10647#ifdef I_UNISTD
10648# include <unistd.h>
10649#endif
55954f19
JH
10650#$i_stdlib I_STDLIB
10651#ifdef I_STDLIB
10652#include <stdlib.h>
10653#endif
b4eb6b3d
JH
10654int main()
10655{
10656 if (getuid() == 0) {
10657 printf("(I see you are running Configure as super-user...)\n");
10658 setuid(1);
10659 }
10660#ifdef TRY_BSD_PGRP
10661 if (-1 == setpgrp(1, 1))
10662 exit(0);
10663#else
10664 if (setpgrp() != -1)
10665 exit(0);
10666#endif
10667 exit(1);
10668}
10669EOP
5440bc8e 10670 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10671 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10672 val="$define"
5440bc8e 10673 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10674 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10675 val="$undef"
10676 else
10677 echo "(I can't seem to compile and run the test program.)"
10678 if ./usg; then
10679 xxx="a USG one, i.e. you use setpgrp()."
10680 else
10681 # SVR4 systems can appear rather BSD-ish.
10682 case "$i_unistd" in
10683 $undef)
10684 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10685 val="$define"
10686 ;;
10687 $define)
10688 xxx="probably a USG one, i.e. you use setpgrp()."
10689 val="$undef"
10690 ;;
10691 esac
10692 fi
10693 echo "Assuming your setpgrp is $xxx" >&4
10694 fi
10695 ;;
10696*) val="$undef";;
10697esac
10698set d_bsdsetpgrp
10699eval $setvar
5b813a60
MB
10700$rm_try
10701
635aebb7
AL
10702: Look for GCC-style __builtin_choose_expr
10703case "$d_builtin_choose_expr" in
10704'')
10705 echo " "
10706 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10707 $cat >try.c <<'EOCP'
10708#include <assert.h>
10709#include <stdlib.h>
10710#include <stdio.h>
10711
10712#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10713
10714int main(void) {
10715 assert( SYRINX(1) == 2112 );
10716 assert( SYRINX(1) != 5150 );
10717 assert( SYRINX(0) == 5150 );
10718 assert( SYRINX(0) != 2112 );
10719 puts( "All good!" );
10720 exit(0);
10721}
10722
10723EOCP
10724 set try
70ceb34a 10725 if eval $compile && $run ./try; then
635aebb7
AL
10726 echo "Your C compiler supports __builtin_choose_expr."
10727 val="$define"
10728 else
10729 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10730 val="$undef"
10731 fi
10732;;
10733*) val="$d_builtin_choose_expr" ;;
10734esac
10735
10736set d_builtin_choose_expr
10737eval $setvar
5b813a60 10738$rm_try
635aebb7
AL
10739
10740: Look for GCC-style __builtin_expect
10741case "$d_builtin_expect" in
10742'')
10743 echo " "
10744 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
70ceb34a 10745 $cat >try.c <<'EOCP'
635aebb7
AL
10746int main(void) {
10747 int n = 50;
10748 if ( __builtin_expect(n, 0) ) n = 1;
70ceb34a
NC
10749 /* Remember shell exit code truth is 0, C truth is non-zero */
10750 return !(n == 1);
635aebb7
AL
10751}
10752EOCP
10753 set try
70ceb34a
NC
10754 if eval $compile && $run ./try; then
10755 echo "Your C compiler supports __builtin_expect."
635aebb7
AL
10756 val="$define"
10757 else
70ceb34a 10758 echo "Your C compiler doesn't seem to understand __builtin_expect."
635aebb7
AL
10759 val="$undef"
10760 fi
10761 ;;
10762*) val="$d_builtin_expect" ;;
10763esac
10764
10765set d_builtin_expect
10766eval $setvar
5b813a60 10767$rm_try
635aebb7 10768
b4eb6b3d
JH
10769: see if bzero exists
10770set bzero d_bzero
10771eval $inlibc
10772
a2d23ec2
MB
10773: see if stdarg is available
10774echo " "
10775if $test `./findhdr stdarg.h`; then
10776 echo "<stdarg.h> found." >&4
10777 valstd="$define"
10778else
10779 echo "<stdarg.h> NOT found." >&4
10780 valstd="$undef"
10781fi
10782
10783: see if varags is available
10784echo " "
10785if $test `./findhdr varargs.h`; then
10786 echo "<varargs.h> found." >&4
10787else
10788 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10789fi
10790
10791: set up the varargs testing programs
10792$cat > varargs.c <<EOP
10793#ifdef I_STDARG
10794#include <stdarg.h>
10795#endif
10796#ifdef I_VARARGS
10797#include <varargs.h>
10798#endif
10799
10800#ifdef I_STDARG
10801int f(char *p, ...)
10802#else
10803int f(va_alist)
10804va_dcl
10805#endif
10806{
10807 va_list ap;
10808#ifndef I_STDARG
10809 char *p;
10810#endif
10811#ifdef I_STDARG
10812 va_start(ap,p);
10813#else
10814 va_start(ap);
10815 p = va_arg(ap, char *);
10816#endif
10817 va_end(ap);
4fb7dc7d 10818 return 0;
a2d23ec2
MB
10819}
10820EOP
10821$cat > varargs <<EOP
10822$startsh
10823if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10824 echo "true"
10825else
10826 echo "false"
10827fi
10828$rm -f varargs$_o
10829EOP
10830chmod +x varargs
10831
10832: now check which varargs header should be included
10833echo " "
10834i_varhdr=''
10835case "$valstd" in
10836"$define")
10837 if `./varargs I_STDARG`; then
10838 val='stdarg.h'
10839 elif `./varargs I_VARARGS`; then
10840 val='varargs.h'
10841 fi
10842 ;;
10843*)
10844 if `./varargs I_VARARGS`; then
10845 val='varargs.h'
10846 fi
10847 ;;
10848esac
10849case "$val" in
10850'')
10851echo "I could not find the definition for va_dcl... You have problems..." >&4
10852 val="$undef"; set i_stdarg; eval $setvar
10853 val="$undef"; set i_varargs; eval $setvar
10854 ;;
613d6c3e 10855*)
a2d23ec2
MB
10856 set i_varhdr
10857 eval $setvar
10858 case "$i_varhdr" in
10859 stdarg.h)
10860 val="$define"; set i_stdarg; eval $setvar
10861 val="$undef"; set i_varargs; eval $setvar
10862 ;;
10863 varargs.h)
10864 val="$undef"; set i_stdarg; eval $setvar
10865 val="$define"; set i_varargs; eval $setvar
10866 ;;
10867 esac
10868 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10869esac
10870$rm -f varargs*
10871
10872: see if the Compiler supports C99 variadic macros
10873case "$i_stdarg$i_stdlib" in
10874 "$define$define")
10875 echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10876 $cat >try.c <<EOCP
10877#include <stdio.h>
10878#include <stdarg.h>
10879
10880#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10881
10882int main() {
10883 char buf[20];
10884 foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10885 puts(buf);
10886 return 0;
10887}
10888EOCP
10889 set try
10890 if eval $compile && $run ./try 2>&1 >/dev/null; then
10891 case "`$run ./try`" in
10892 "123 456 789")
10893 echo "You have C99 variadic macros." >&4
10894 d_c99_variadic_macros="$define"
10895 ;;
10896 *)
10897 echo "You don't have functional C99 variadic macros." >&4
10898 d_c99_variadic_macros="$undef"
10899 ;;
10900 esac
10901 else
10902 echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10903 d_c99_variadic_macros="$undef"
10904 fi
5b813a60 10905 $rm_try
a2d23ec2
MB
10906 ;;
10907 *)
10908 echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10909 d_c99_variadic_macros="$undef"
10910 ;;
10911esac
10912
b4eb6b3d
JH
10913: see if signal is declared as pointer to function returning int or void
10914echo " "
10915xxx=`./findhdr signal.h`
10916$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10917if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10918 echo "You have int (*signal())() instead of void." >&4
10919 val="$undef"
10920elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10921 echo "You have void (*signal())()." >&4
10922 val="$define"
10923elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10924 echo "You have int (*signal())() instead of void." >&4
10925 val="$undef"
10926elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10927 echo "You have void (*signal())()." >&4
10928 val="$define"
10929else
10930 case "$d_voidsig" in
10931 '')
10932 echo "I can't determine whether signal handler returns void or int..." >&4
10933 dflt=void
10934 rp="What type does your signal handler return?"
10935 . ./myread
10936 case "$ans" in
10937 v*) val="$define";;
10938 *) val="$undef";;
10939 esac;;
10940 "$define")
10941 echo "As you already told me, signal handler returns void." >&4
10942 val="$define"
10943 ;;
10944 *) echo "As you already told me, signal handler returns int." >&4
10945 val="$undef"
10946 ;;
10947 esac
10948fi
10949set d_voidsig
10950eval $setvar
10951case "$d_voidsig" in
10952"$define") signal_t="void";;
10953*) signal_t="int";;
10954esac
10955$rm -f $$.tmp
10956
10957: check for ability to cast large floats to 32-bit ints.
10958echo " "
10959echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10960if $test "$intsize" -ge 4; then
10961 xxx=int
10962else
10963 xxx=long
10964fi
10965$cat >try.c <<EOCP
10966#include <stdio.h>
d1daaddf
JH
10967#$i_stdlib I_STDLIB
10968#ifdef I_STDLIB
10969#include <stdlib.h>
10970#endif
b4eb6b3d
JH
10971#include <sys/types.h>
10972#include <signal.h>
7090f861 10973$signal_t blech(int s) { exit(3); }
b4eb6b3d
JH
10974int main()
10975{
10976 $xxx i32;
10977 double f, g;
10978 int result = 0;
10979 char str[16];
10980 signal(SIGFPE, blech);
10981
5b813a60 10982 /* Don't let compiler optimize the test away. Store the number
b4eb6b3d
JH
10983 in a writable string for gcc to pass to sscanf under HP/UX.
10984 */
10985 sprintf(str, "2147483647");
10986 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10987 g = 10 * f;
10988 i32 = ($xxx) g;
10989
10990 /* x86 processors will probably give 0x8000 0000, which is a
4a39fcde 10991 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
10992 behavior here, which is to preserve the sign and give
10993 back 0x7fff ffff.
10994 */
10995 if (i32 != ($xxx) f)
10996 result |= 1;
10997 exit(result);
10998}
10999EOCP
11000set try
11001if eval $compile_ok; then
5440bc8e 11002 $run ./try
b4eb6b3d
JH
11003 yyy=$?
11004else
11005 echo "(I can't seem to compile the test program--assuming it can't)"
11006 yyy=1
11007fi
11008case "$yyy" in
110090) val="$define"
11010 echo "Yup, it can."
11011 ;;
11012*) val="$undef"
11013 echo "Nope, it can't."
11014 ;;
11015esac
11016set d_casti32
11017eval $setvar
5b813a60 11018$rm_try
b4eb6b3d
JH
11019
11020: check for ability to cast negative floats to unsigned
11021echo " "
11022echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11023$cat >try.c <<EOCP
11024#include <stdio.h>
d1daaddf
JH
11025#$i_stdlib I_STDLIB
11026#ifdef I_STDLIB
11027#include <stdlib.h>
11028#endif
b4eb6b3d
JH
11029#include <sys/types.h>
11030#include <signal.h>
7090f861
JH
11031$signal_t blech(int s) { exit(7); }
11032$signal_t blech_in_list(int s) { exit(4); }
11033unsigned long dummy_long(unsigned long p) { return p; }
11034unsigned int dummy_int(unsigned int p) { return p; }
11035unsigned short dummy_short(unsigned short p) { return p; }
b4eb6b3d
JH
11036int main()
11037{
11038 double f;
11039 unsigned long along;
11040 unsigned int aint;
11041 unsigned short ashort;
11042 int result = 0;
11043 char str[16];
5b813a60 11044
b4eb6b3d
JH
11045 /* Frustrate gcc-2.7.2's optimizer which failed this test with
11046 a direct f = -123. assignment. gcc-2.8.0 reportedly
11047 optimized the whole file away
11048 */
5b813a60 11049 /* Store the number in a writable string for gcc to pass to
b4eb6b3d
JH
11050 sscanf under HP/UX.
11051 */
11052 sprintf(str, "-123");
11053 sscanf(str, "%lf", &f); /* f = -123.; */
11054
11055 signal(SIGFPE, blech);
11056 along = (unsigned long)f;
11057 aint = (unsigned int)f;
11058 ashort = (unsigned short)f;
11059 if (along != (unsigned long)-123)
11060 result |= 1;
11061 if (aint != (unsigned int)-123)
11062 result |= 1;
11063 if (ashort != (unsigned short)-123)
11064 result |= 1;
11065 sprintf(str, "1073741824.");
11066 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11067 f = f + f;
11068 along = 0;
11069 along = (unsigned long)f;
11070 if (along != 0x80000000)
11071 result |= 2;
11072 f -= 1.;
11073 along = 0;
11074 along = (unsigned long)f;
11075 if (along != 0x7fffffff)
11076 result |= 1;
11077 f += 2.;
11078 along = 0;
11079 along = (unsigned long)f;
11080 if (along != 0x80000001)
11081 result |= 2;
11082 if (result)
11083 exit(result);
11084 signal(SIGFPE, blech_in_list);
11085 sprintf(str, "123.");
11086 sscanf(str, "%lf", &f); /* f = 123.; */
11087 along = dummy_long((unsigned long)f);
11088 aint = dummy_int((unsigned int)f);
11089 ashort = dummy_short((unsigned short)f);
11090 if (along != (unsigned long)123)
11091 result |= 4;
11092 if (aint != (unsigned int)123)
11093 result |= 4;
11094 if (ashort != (unsigned short)123)
11095 result |= 4;
11096 exit(result);
11097
11098}
11099EOCP
11100set try
11101if eval $compile_ok; then
5440bc8e 11102 $run ./try
b4eb6b3d
JH
11103 castflags=$?
11104else
11105 echo "(I can't seem to compile the test program--assuming it can't)"
11106 castflags=7
11107fi
11108case "$castflags" in
111090) val="$define"
11110 echo "Yup, it can."
11111 ;;
11112*) val="$undef"
11113 echo "Nope, it can't."
11114 ;;
11115esac
11116set d_castneg
11117eval $setvar
5b813a60 11118$rm_try
b4eb6b3d
JH
11119
11120: see if vprintf exists
11121echo " "
11122if set vprintf val -f d_vprintf; eval $csym; $val; then
11123 echo 'vprintf() found.' >&4
11124 val="$define"
55954f19 11125 $cat >try.c <<EOF
d0bc9cc8
AD
11126#$i_stdarg I_STDARG /* Only one of these can be defined by i_varhrd */
11127#$i_varargs I_VARARGS
11128
55954f19 11129#$i_stdlib I_STDLIB
d0bc9cc8
AD
11130#$i_unistd I_UNISTD
11131
11132#ifdef I_STDARG
11133# include <stdarg.h>
11134#else /* I_VARARGS */
11135# include <varargs.h>
11136#endif
11137
11138#ifdef I_UNISTD
11139# include <unistd.h>
11140#endif
11141
55954f19 11142#ifdef I_STDLIB
d0bc9cc8 11143# include <stdlib.h>
55954f19 11144#endif
b4eb6b3d 11145
d0bc9cc8
AD
11146#include <stdio.h> /* vsprintf prototype */
11147
11148#ifdef I_STDARG
11149void xxx(int n, ...)
11150{
11151 va_list args;
11152 char buf[10];
11153 va_start(args, n);
11154 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11155}
11156int main() { xxx(1, "foo"); }
11157
11158#else /* I_VARARGS */
b4eb6b3d
JH
11159
11160xxx(va_alist)
11161va_dcl
11162{
d0bc9cc8
AD
11163 va_list args;
11164 char buf[10];
11165 va_start(args);
11166 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
b4eb6b3d 11167}
d0bc9cc8
AD
11168int main() { xxx("foo"); }
11169
11170#endif
11171
b4eb6b3d 11172EOF
5440bc8e 11173 set try
d0bc9cc8
AD
11174 if eval $compile_ok; then
11175 if $run ./try; then
11176 echo "Your vsprintf() returns (int)." >&4
11177 val2="$undef"
11178 else
11179 echo "Your vsprintf() returns (char*)." >&4
11180 val2="$define"
11181 fi
b4eb6b3d 11182 else
d0bc9cc8
AD
11183 echo 'I am unable to compile the vsprintf() test program.' >&4
11184 # We shouldn't get here. If we do, assume the standard signature,
11185 # not the old BSD one.
11186 echo 'Guessing that vsprintf() returns (int).' >&4
11187 val2="$undef"
b4eb6b3d
JH
11188 fi
11189else
11190 echo 'vprintf() NOT found.' >&4
d0bc9cc8
AD
11191 val="$undef"
11192 val2="$undef"
b4eb6b3d 11193fi
5b813a60 11194$rm_try
b4eb6b3d
JH
11195set d_vprintf
11196eval $setvar
11197val=$val2
11198set d_charvspr
11199eval $setvar
11200
11201: see if chown exists
11202set chown d_chown
11203eval $inlibc
11204
11205: see if chroot exists
11206set chroot d_chroot
11207eval $inlibc
11208
11209: see if chsize exists
11210set chsize d_chsize
11211eval $inlibc
11212
758a5d79
JH
11213: see if class exists
11214set class d_class
11215eval $inlibc
11216
b0a2e8e6
MB
11217: see if clearenv exists
11218set clearenv d_clearenv
11219eval $inlibc
11220
34f1896b 11221: Define hasstruct macro for Configure internal use
4e0554ec
JH
11222hasstruct='varname=$1; struct=$2; shift; shift;
11223while $test $# -ge 2; do
11224 case "$1" in
11225 $define) echo "#include <$2>";;
11226 esac ;
11227 shift 2;
11228done > try.c;
11229echo "int main () { struct $struct foo; }" >> try.c;
11230set try;
11231if eval $compile; then
11232 val="$define";
11233else
11234 val="$undef";
11235fi;
11236set $varname;
11237eval $setvar;
5b813a60 11238$rm_try'
4e0554ec 11239
34f1896b 11240: see whether socket exists
4e0554ec
JH
11241socketlib=''
11242sockethdr=''
4e0554ec
JH
11243echo " "
11244$echo $n "Hmm... $c" >&4
11245if set socket val -f d_socket; eval $csym; $val; then
11246 echo "Looks like you have Berkeley networking support." >&4
11247 d_socket="$define"
11248 if set setsockopt val -f; eval $csym; $val; then
11249 d_oldsock="$undef"
11250 else
11251 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11252 d_oldsock="$define"
11253 fi
11254else
11255 if $contains socklib libc.list >/dev/null 2>&1; then
11256 echo "Looks like you have Berkeley networking support." >&4
11257 d_socket="$define"
11258 : we will have to assume that it supports the 4.2 BSD interface
11259 d_oldsock="$undef"
11260 else
11261 echo "You don't have Berkeley networking in libc$_a..." >&4
11262 if test "X$d_socket" = "X$define"; then
11263 echo "...but you seem to believe that you have sockets." >&4
11264 else
11265 for net in net socket
11266 do
11267 if test -f /usr/lib/lib$net$_a; then
11268 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
11269 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11270 if $contains socket libc.list >/dev/null 2>&1; then
11271 d_socket="$define"
11272 socketlib="-l$net"
11273 case "$net" in
11274 net)
11275 echo "...but the Wollongong group seems to have hacked it in." >&4
11276 sockethdr="-I/usr/netinclude"
11277 ;;
11278 esac
5b813a60 11279 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
11280 if $contains setsockopt libc.list >/dev/null 2>&1; then
11281 d_oldsock="$undef"
11282 else
11283 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11284 d_oldsock="$define"
11285 fi
11286 break
11287 fi
11288 fi
11289 done
11290 if test "X$d_socket" != "X$define"; then
11291 echo "or anywhere else I see." >&4
11292 d_socket="$undef"
11293 d_oldsock="$undef"
11294 fi
11295 fi
11296 fi
11297fi
11298
11299: see if socketpair exists
11300set socketpair d_sockpair
11301eval $inlibc
11302
11303
11304echo " "
3c728e00 11305echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
11306for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11307 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11308 $cat >try.c <<EOF
11309#include <sys/types.h>
11310#include <sys/socket.h>
11311int main() {
11312 int i = $ENUM;
11313}
11314EOF
11315 val="$undef"
11316 set try; if eval $compile; then
11317 val="$define"
11318 fi
11319 set d_${enum}; eval $setvar
5b813a60 11320 $rm_try
4e0554ec
JH
11321done
11322
11323: see if this is a sys/uio.h system
11324set sys/uio.h i_sysuio
11325eval $inhdr
11326
34f1896b 11327: Check for cmsghdr support
4e0554ec
JH
11328echo " "
11329echo "Checking to see if your system supports struct cmsghdr..." >&4
11330set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11331eval $hasstruct
11332case "$d_cmsghdr_s" in
11333"$define") echo "Yes, it does." ;;
11334*) echo "No, it doesn't." ;;
11335esac
11336
11337
b4eb6b3d
JH
11338: check for const keyword
11339echo " "
11340echo 'Checking to see if your C compiler knows about "const"...' >&4
11341$cat >const.c <<'EOCP'
11342typedef struct spug { int drokk; } spug;
76f47787 11343int main()
b4eb6b3d
JH
11344{
11345 const char *foo;
666ea192 11346 const spug y = { 0 };
b4eb6b3d
JH
11347}
11348EOCP
11349if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11350 val="$define"
11351 echo "Yup, it does."
11352else
11353 val="$undef"
11354 echo "Nope, it doesn't."
11355fi
11356set d_const
11357eval $setvar
11358
89ce900e
JH
11359: see if copysignl exists
11360set copysignl d_copysignl
11361eval $inlibc
11362
b4eb6b3d
JH
11363: see if crypt exists
11364echo " "
a5a94ea5
JH
11365set crypt d_crypt
11366eval $inlibc
11367case "$d_crypt" in
11368$define) cryptlib='' ;;
11369*) if set crypt val -f d_crypt; eval $csym; $val; then
11370 echo 'crypt() found.' >&4
b4eb6b3d 11371 val="$define"
a5a94ea5
JH
11372 cryptlib=''
11373 else
11374 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11375 if $test -z "$cryptlib"; then
11376 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11377 else
11378 cryptlib=-lcrypt
11379 fi
11380 if $test -z "$cryptlib"; then
11381 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11382 else
11383 cryptlib=-lcrypt
11384 fi
11385 if $test -z "$cryptlib"; then
11386 cryptlib=`./loc libcrypt$_a "" $libpth`
11387 else
11388 cryptlib=-lcrypt
11389 fi
11390 if $test -z "$cryptlib"; then
11391 echo 'crypt() NOT found.' >&4
11392 val="$undef"
11393 else
11394 val="$define"
11395 fi
b4eb6b3d 11396 fi
a5a94ea5
JH
11397 set d_crypt
11398 eval $setvar
11399 ;;
11400esac
b4eb6b3d 11401
10bc17b6
JH
11402: see if this is a crypt.h system
11403set crypt.h i_crypt
11404eval $inhdr
11405
11406: see if crypt_r exists
11407set crypt_r d_crypt_r
11408eval $inlibc
11409case "$d_crypt_r" in
11410"$define")
11411 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
11412 case "$d_crypt_r_proto:$usethreads" in
11413 ":define") d_crypt_r_proto=define
a48ec845
JH
11414 set d_crypt_r_proto crypt_r $hdrs
11415 eval $hasproto ;;
11416 *) ;;
11417 esac
11418 case "$d_crypt_r_proto" in
11419 define)
10bc17b6
JH
11420 case "$crypt_r_proto" in
11421 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
61c26d18 11422 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
10bc17b6
JH
11423 esac
11424 case "$crypt_r_proto" in
b430fd04 11425 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
61c26d18 11426 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
b430fd04
JH
11427 esac
11428 case "$crypt_r_proto" in
90e831dc 11429 ''|0) d_crypt_r=undef
10bc17b6 11430 crypt_r_proto=0
a48ec845 11431 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11432 * ) case "$crypt_r_proto" in
11433 REENTRANT_PROTO*) ;;
11434 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11435 esac
11436 echo "Prototype: $try" ;;
11437 esac
11438 ;;
c18e646a
JH
11439 *) case "$usethreads" in
11440 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11441 esac
90e831dc
SB
11442 d_crypt_r=undef
11443 crypt_r_proto=0
c18e646a 11444 ;;
a48ec845
JH
11445 esac
11446 ;;
10bc17b6
JH
11447*) crypt_r_proto=0
11448 ;;
11449esac
11450
b4eb6b3d
JH
11451: get csh whereabouts
11452case "$csh" in
11453'csh') val="$undef" ;;
11454*) val="$define" ;;
11455esac
11456set d_csh
11457eval $setvar
11458: Respect a hint or command line value for full_csh.
11459case "$full_csh" in
11460'') full_csh=$csh ;;
11461esac
11462
13cfc98d
MB
11463: see if ctermid exists
11464set ctermid d_ctermid
11465eval $inlibc
11466
10bc17b6
JH
11467: see if ctermid_r exists
11468set ctermid_r d_ctermid_r
11469eval $inlibc
11470case "$d_ctermid_r" in
11471"$define")
31ee0cb7 11472 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
11473 case "$d_ctermid_r_proto:$usethreads" in
11474 ":define") d_ctermid_r_proto=define
a48ec845
JH
11475 set d_ctermid_r_proto ctermid_r $hdrs
11476 eval $hasproto ;;
11477 *) ;;
11478 esac
11479 case "$d_ctermid_r_proto" in
11480 define)
10bc17b6
JH
11481 case "$ctermid_r_proto" in
11482 ''|0) try='char* ctermid_r(char*);'
61c26d18 11483 ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
10bc17b6
JH
11484 esac
11485 case "$ctermid_r_proto" in
90e831dc 11486 ''|0) d_ctermid_r=undef
10bc17b6 11487 ctermid_r_proto=0
a48ec845 11488 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11489 * ) case "$ctermid_r_proto" in
11490 REENTRANT_PROTO*) ;;
11491 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11492 esac
11493 echo "Prototype: $try" ;;
11494 esac
11495 ;;
c18e646a
JH
11496 *) case "$usethreads" in
11497 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11498 esac
90e831dc
SB
11499 d_ctermid_r=undef
11500 ctermid_r_proto=0
c18e646a 11501 ;;
a48ec845
JH
11502 esac
11503 ;;
10bc17b6
JH
11504*) ctermid_r_proto=0
11505 ;;
11506esac
11507
11508: see if ctime_r exists
11509set ctime_r d_ctime_r
11510eval $inlibc
11511case "$d_ctime_r" in
11512"$define")
d63eadf0 11513 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
11514 case "$d_ctime_r_proto:$usethreads" in
11515 ":define") d_ctime_r_proto=define
a48ec845
JH
11516 set d_ctime_r_proto ctime_r $hdrs
11517 eval $hasproto ;;
11518 *) ;;
11519 esac
11520 case "$d_ctime_r_proto" in
11521 define)
10bc17b6
JH
11522 case "$ctime_r_proto" in
11523 ''|0) try='char* ctime_r(const time_t*, char*);'
61c26d18 11524 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
10bc17b6
JH
11525 esac
11526 case "$ctime_r_proto" in
11527 ''|0) try='char* ctime_r(const time_t*, char*, int);'
61c26d18 11528 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
10bc17b6
JH
11529 esac
11530 case "$ctime_r_proto" in
11531 ''|0) try='int ctime_r(const time_t*, char*);'
61c26d18 11532 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
10bc17b6
JH
11533 esac
11534 case "$ctime_r_proto" in
11535 ''|0) try='int ctime_r(const time_t*, char*, int);'
61c26d18 11536 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
10bc17b6
JH
11537 esac
11538 case "$ctime_r_proto" in
90e831dc 11539 ''|0) d_ctime_r=undef
10bc17b6 11540 ctime_r_proto=0
a48ec845 11541 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11542 * ) case "$ctime_r_proto" in
11543 REENTRANT_PROTO*) ;;
11544 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11545 esac
11546 echo "Prototype: $try" ;;
11547 esac
11548 ;;
c18e646a
JH
11549 *) case "$usethreads" in
11550 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11551 esac
90e831dc
SB
11552 d_ctime_r=undef
11553 ctime_r_proto=0
c18e646a 11554 ;;
a48ec845
JH
11555 esac
11556 ;;
10bc17b6
JH
11557*) ctime_r_proto=0
11558 ;;
11559esac
11560
b4eb6b3d
JH
11561: see if cuserid exists
11562set cuserid d_cuserid
11563eval $inlibc
11564
11565: see if this is a limits.h system
11566set limits.h i_limits
11567eval $inhdr
11568
11569: see if this is a float.h system
11570set float.h i_float
11571eval $inhdr
11572
11573: See if number of significant digits in a double precision number is known
11574echo " "
11575$cat >dbl_dig.c <<EOM
11576#$i_limits I_LIMITS
11577#$i_float I_FLOAT
11578#ifdef I_LIMITS
11579#include <limits.h>
11580#endif
11581#ifdef I_FLOAT
11582#include <float.h>
11583#endif
11584#ifdef DBL_DIG
11585printf("Contains DBL_DIG");
11586#endif
11587EOM
11588$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11589if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11590 echo "DBL_DIG found." >&4
11591 val="$define"
11592else
11593 echo "DBL_DIG NOT found." >&4
11594 val="$undef"
11595fi
11596$rm -f dbl_dig.?
11597set d_dbl_dig
11598eval $setvar
11599
2ef53570
JH
11600: see if dbm.h is available
11601: see if dbmclose exists
11602set dbmclose d_dbmclose
11603eval $inlibc
11604
11605case "$d_dbmclose" in
11606$define)
11607 set dbm.h i_dbm
11608 eval $inhdr
11609 case "$i_dbm" in
11610 $define)
11611 val="$undef"
11612 set i_rpcsvcdbm
11613 eval $setvar
11614 ;;
11615 *) set rpcsvc/dbm.h i_rpcsvcdbm
11616 eval $inhdr
11617 ;;
11618 esac
11619 ;;
11620*) echo "We won't be including <dbm.h>"
11621 val="$undef"
11622 set i_dbm
11623 eval $setvar
11624 val="$undef"
11625 set i_rpcsvcdbm
11626 eval $setvar
11627 ;;
11628esac
11629
11630: see if prototype for dbminit is available
11631echo " "
11632set d_dbminitproto dbminit $i_dbm dbm.h
11633eval $hasproto
11634
b4eb6b3d
JH
11635: see if difftime exists
11636set difftime d_difftime
11637eval $inlibc
11638
11639: see if this is a dirent system
11640echo " "
11641if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11642 val="$define"
11643 echo "<dirent.h> found." >&4
11644else
11645 val="$undef"
11646 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11647 echo "<sys/dir.h> found." >&4
11648 echo " "
11649 else
11650 xinc=`./findhdr sys/ndir.h`
11651 fi
11652 echo "<dirent.h> NOT found." >&4
11653fi
11654set i_dirent
11655eval $setvar
11656
11657: Look for type of directory structure.
11658echo " "
11659$cppstdin $cppflags $cppminus < "$xinc" > try.c
11660
11661case "$direntrytype" in
11662''|' ')
11663 case "$i_dirent" in
11664 $define) guess1='struct dirent' ;;
11665 *) guess1='struct direct' ;;
11666 esac
11667 ;;
11668*) guess1="$direntrytype"
11669 ;;
11670esac
11671
11672case "$guess1" in
11673'struct dirent') guess2='struct direct' ;;
11674*) guess2='struct dirent' ;;
11675esac
5b813a60 11676
b4eb6b3d
JH
11677if $contains "$guess1" try.c >/dev/null 2>&1; then
11678 direntrytype="$guess1"
11679 echo "Your directory entries are $direntrytype." >&4
11680elif $contains "$guess2" try.c >/dev/null 2>&1; then
11681 direntrytype="$guess2"
11682 echo "Your directory entries seem to be $direntrytype." >&4
11683else
11684 echo "I don't recognize your system's directory entries." >&4
11685 rp="What type is used for directory entries on this system?"
11686 dflt="$guess1"
11687 . ./myread
11688 direntrytype="$ans"
11689fi
5b813a60 11690$rm_try
b4eb6b3d
JH
11691
11692: see if the directory entry stores field length
11693echo " "
11694$cppstdin $cppflags $cppminus < "$xinc" > try.c
11695if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11696 echo "Good, your directory entry keeps length information in d_namlen." >&4
11697 val="$define"
11698else
11699 echo "Your directory entry does not know about the d_namlen field." >&4
11700 val="$undef"
11701fi
11702set d_dirnamlen
11703eval $setvar
5b813a60 11704$rm_try
b4eb6b3d 11705
de52168c
SP
11706: Look for DIR.dd_fd
11707case "$i_dirent" in
11708"$define")
11709 echo "Checking to see if DIR has a dd_fd member variable" >&4
11710 $cat >try.c <<EOCP
11711#$i_stdlib I_STDLIB
11712#ifdef I_STDLIB
11713#include <stdlib.h>
11714#endif
11715#include <dirent.h>
11716
11717int main() {
11718 DIR dir;
11719 dir.dd_fd = 1;
11720 return 0;
11721}
11722EOCP
11723 val=$undef
11724 set try
11725 if eval $compile; then
11726 echo "Yes, it does."
11727 val="$define"
11728 else
11729 echo "No, it does not."
11730 val="$undef"
11731 fi
11732 ;;
11733*)
11734 echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11735 val="$undef"
11736 ;;
11737esac
11738set d_dir_dd_fd
11739eval $setvar
5b813a60 11740$rm_try
de52168c 11741
ae0e3d3b
JH
11742: see if this is an sysdir system
11743set sys/dir.h i_sysdir
11744eval $inhdr
11745
11746: see if this is an sysndir system
11747set sys/ndir.h i_sysndir
11748eval $inhdr
11749
11750: Look for dirfd
11751echo " "
11752$cat >dirfd.c <<EOM
11753#include <stdio.h>
55954f19
JH
11754#$i_stdlib I_STDLIB
11755#ifdef I_STDLIB
11756#include <stdlib.h>
11757#endif
ae0e3d3b
JH
11758#$i_dirent I_DIRENT /**/
11759#$i_sysdir I_SYS_DIR /**/
11760#$i_sysndir I_SYS_NDIR /**/
11761#$i_systypes I_SYS_TYPES /**/
11762#if defined(I_SYS_TYPES)
11763#include <sys/types.h>
11764#endif
11765#if defined(I_DIRENT)
11766#include <dirent.h>
11767#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11768#include <sys/dir.h>
11769#endif
11770#else
11771#ifdef I_SYS_NDIR
11772#include <sys/ndir.h>
11773#else
11774#ifdef I_SYS_DIR
11775#ifdef hp9000s500
11776#include <ndir.h> /* may be wrong in the future */
11777#else
11778#include <sys/dir.h>
11779#endif
11780#endif
11781#endif
11782#endif
11783int main() {
11784 DIR *dirp = opendir(".");
11785 if (dirfd(dirp) >= 0)
11786 exit(0);
11787 else
11788 exit(1);
11789}
11790EOM
5cadb3f3 11791val=$undef
ae0e3d3b
JH
11792set dirfd
11793if eval $compile; then
11794 val="$define"
11795fi
11796case "$val" in
11797$define) echo "dirfd() found." >&4 ;;
11798*) echo "dirfd() NOT found." >&4 ;;
11799esac
11800set d_dirfd
11801eval $setvar
11802$rm -f dirfd*
11803
b4eb6b3d
JH
11804: see if dlerror exists
11805xxx_runnm="$runnm"
11806runnm=false
11807set dlerror d_dlerror
11808eval $inlibc
11809runnm="$xxx_runnm"
11810
11811: see if dlfcn is available
11812set dlfcn.h i_dlfcn
11813eval $inhdr
11814
34f1896b 11815: Check what extension to use for shared libs
b4eb6b3d
JH
11816case "$usedl" in
11817$define|y|true)
11818 $cat << EOM
11819
11820On a few systems, the dynamically loaded modules that perl generates and uses
11821will need a different extension than shared libs. The default will probably
11822be appropriate.
11823
11824EOM
11825 case "$dlext" in
11826 '') dflt="$so" ;;
11827 *) dflt="$dlext" ;;
11828 esac
11829 rp='What is the extension of dynamically loaded modules'
11830 . ./myread
11831 dlext="$ans"
11832 ;;
11833*)
11834 dlext="none"
11835 ;;
11836esac
11837
11838: Check if dlsym need a leading underscore
11839echo " "
11840val="$undef"
11841
11842case "$dlsrc" in
11843dl_dlopen.xs)
11844 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11845 $cat >dyna.c <<'EOM'
11846fred () { }
11847EOM
11848
11849$cat >fred.c<<EOM
11850
11851#include <stdio.h>
55954f19
JH
11852#$i_stdlib I_STDLIB
11853#ifdef I_STDLIB
11854#include <stdlib.h>
11855#endif
b4eb6b3d
JH
11856#$i_dlfcn I_DLFCN
11857#ifdef I_DLFCN
5440bc8e 11858#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
11859#else
11860#include <sys/types.h>
11861#include <nlist.h>
11862#include <link.h>
11863#endif
11864
11865extern int fred() ;
11866
11867int main()
11868{
11869 void * handle ;
11870 void * symbol ;
11871#ifndef RTLD_LAZY
11872 int mode = 1 ;
11873#else
11874 int mode = RTLD_LAZY ;
11875#endif
11876 handle = dlopen("./dyna.$dlext", mode) ;
11877 if (handle == NULL) {
11878 printf ("1\n") ;
11879 fflush (stdout) ;
11880 exit(0);
11881 }
11882 symbol = dlsym(handle, "fred") ;
11883 if (symbol == NULL) {
11884 /* try putting a leading underscore */
11885 symbol = dlsym(handle, "_fred") ;
11886 if (symbol == NULL) {
11887 printf ("2\n") ;
11888 fflush (stdout) ;
11889 exit(0);
11890 }
11891 printf ("3\n") ;
11892 }
11893 else
11894 printf ("4\n") ;
11895 fflush (stdout) ;
11896 exit(0);
11897}
11898EOM
11899 : Call the object file tmp-dyna.o in case dlext=o.
613d6c3e
MB
11900 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11901 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11902 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
11903 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11904 xxx=`$run ./fred`
b4eb6b3d
JH
11905 case $xxx in
11906 1) echo "Test program failed using dlopen." >&4
11907 echo "Perhaps you should not use dynamic loading." >&4;;
11908 2) echo "Test program failed using dlsym." >&4
11909 echo "Perhaps you should not use dynamic loading." >&4;;
11910 3) echo "dlsym needs a leading underscore" >&4
11911 val="$define" ;;
11912 4) echo "dlsym doesn't need a leading underscore." >&4;;
11913 esac
11914 else
11915 echo "I can't compile and run the test program." >&4
11916 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11917 fi
11918 ;;
11919esac
613d6c3e 11920
3c728e00 11921$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
11922
11923set d_dlsymun
11924eval $setvar
11925
10bc17b6
JH
11926: see if drand48_r exists
11927set drand48_r d_drand48_r
11928eval $inlibc
11929case "$d_drand48_r" in
11930"$define")
11931 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
11932 case "$d_drand48_r_proto:$usethreads" in
11933 ":define") d_drand48_r_proto=define
a48ec845
JH
11934 set d_drand48_r_proto drand48_r $hdrs
11935 eval $hasproto ;;
11936 *) ;;
11937 esac
11938 case "$d_drand48_r_proto" in
11939 define)
10bc17b6
JH
11940 case "$drand48_r_proto" in
11941 ''|0) try='int drand48_r(struct drand48_data*, double*);'
61c26d18 11942 ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
10bc17b6
JH
11943 esac
11944 case "$drand48_r_proto" in
90e831dc 11945 ''|0) d_drand48_r=undef
10bc17b6 11946 drand48_r_proto=0
a48ec845 11947 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11948 * ) case "$drand48_r_proto" in
11949 REENTRANT_PROTO*) ;;
11950 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11951 esac
11952 echo "Prototype: $try" ;;
11953 esac
11954 ;;
c18e646a
JH
11955 *) case "$usethreads" in
11956 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11957 esac
90e831dc
SB
11958 d_drand48_r=undef
11959 drand48_r_proto=0
c18e646a 11960 ;;
a48ec845
JH
11961 esac
11962 ;;
10bc17b6
JH
11963*) drand48_r_proto=0
11964 ;;
11965esac
11966
11967: see if prototype for drand48 is available
11968echo " "
11969set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11970eval $hasproto
11971
b4eb6b3d
JH
11972: see if dup2 exists
11973set dup2 d_dup2
11974eval $inlibc
11975
11976: see if eaccess exists
11977set eaccess d_eaccess
11978eval $inlibc
11979
11980: see if endgrent exists
11981set endgrent d_endgrent
11982eval $inlibc
11983
10bc17b6
JH
11984: see if this is an grp system
11985set grp.h i_grp
11986eval $inhdr
11987
11988case "$i_grp" in
11989$define)
11990 xxx=`./findhdr grp.h`
11991 $cppstdin $cppflags $cppminus < $xxx >$$.h
11992
11993 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11994 val="$define"
11995 else
11996 val="$undef"
11997 fi
11998 set d_grpasswd
11999 eval $setvar
12000
12001 $rm -f $$.h
12002 ;;
12003*)
12004 val="$undef";
12005 set d_grpasswd; eval $setvar
12006 ;;
12007esac
12008
12009: see if endgrent_r exists
12010set endgrent_r d_endgrent_r
12011eval $inlibc
12012case "$d_endgrent_r" in
12013"$define")
12014 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12015 case "$d_endgrent_r_proto:$usethreads" in
12016 ":define") d_endgrent_r_proto=define
a48ec845
JH
12017 set d_endgrent_r_proto endgrent_r $hdrs
12018 eval $hasproto ;;
12019 *) ;;
12020 esac
12021 case "$d_endgrent_r_proto" in
12022 define)
10bc17b6
JH
12023 case "$endgrent_r_proto" in
12024 ''|0) try='int endgrent_r(FILE**);'
61c26d18 12025 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
10bc17b6
JH
12026 esac
12027 case "$endgrent_r_proto" in
12028 ''|0) try='void endgrent_r(FILE**);'
61c26d18 12029 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
10bc17b6
JH
12030 esac
12031 case "$endgrent_r_proto" in
90e831dc 12032 ''|0) d_endgrent_r=undef
10bc17b6 12033 endgrent_r_proto=0
a48ec845 12034 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12035 * ) case "$endgrent_r_proto" in
12036 REENTRANT_PROTO*) ;;
12037 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12038 esac
12039 echo "Prototype: $try" ;;
12040 esac
12041 ;;
c18e646a
JH
12042 *) case "$usethreads" in
12043 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12044 esac
90e831dc
SB
12045 d_endgrent_r=undef
12046 endgrent_r_proto=0
c18e646a 12047 ;;
a48ec845
JH
12048 esac
12049 ;;
10bc17b6
JH
12050*) endgrent_r_proto=0
12051 ;;
12052esac
12053
b4eb6b3d
JH
12054: see if endhostent exists
12055set endhostent d_endhent
12056eval $inlibc
12057
10bc17b6
JH
12058: see if this is a netdb.h system
12059set netdb.h i_netdb
12060eval $inhdr
12061
12062: see if endhostent_r exists
12063set endhostent_r d_endhostent_r
12064eval $inlibc
12065case "$d_endhostent_r" in
12066"$define")
12067 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12068 case "$d_endhostent_r_proto:$usethreads" in
12069 ":define") d_endhostent_r_proto=define
a48ec845
JH
12070 set d_endhostent_r_proto endhostent_r $hdrs
12071 eval $hasproto ;;
12072 *) ;;
12073 esac
12074 case "$d_endhostent_r_proto" in
12075 define)
10bc17b6
JH
12076 case "$endhostent_r_proto" in
12077 ''|0) try='int endhostent_r(struct hostent_data*);'
61c26d18 12078 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
12079 esac
12080 case "$endhostent_r_proto" in
12081 ''|0) try='void endhostent_r(struct hostent_data*);'
61c26d18 12082 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
12083 esac
12084 case "$endhostent_r_proto" in
90e831dc 12085 ''|0) d_endhostent_r=undef
10bc17b6 12086 endhostent_r_proto=0
a48ec845 12087 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12088 * ) case "$endhostent_r_proto" in
12089 REENTRANT_PROTO*) ;;
12090 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12091 esac
12092 echo "Prototype: $try" ;;
12093 esac
12094 ;;
c18e646a
JH
12095 *) case "$usethreads" in
12096 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12097 esac
90e831dc
SB
12098 d_endhostent_r=undef
12099 endhostent_r_proto=0
c18e646a 12100 ;;
a48ec845
JH
12101 esac
12102 ;;
10bc17b6
JH
12103*) endhostent_r_proto=0
12104 ;;
12105esac
12106
b4eb6b3d
JH
12107: see if endnetent exists
12108set endnetent d_endnent
12109eval $inlibc
12110
10bc17b6
JH
12111: see if endnetent_r exists
12112set endnetent_r d_endnetent_r
12113eval $inlibc
12114case "$d_endnetent_r" in
12115"$define")
12116 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12117 case "$d_endnetent_r_proto:$usethreads" in
12118 ":define") d_endnetent_r_proto=define
a48ec845
JH
12119 set d_endnetent_r_proto endnetent_r $hdrs
12120 eval $hasproto ;;
12121 *) ;;
12122 esac
12123 case "$d_endnetent_r_proto" in
12124 define)
10bc17b6
JH
12125 case "$endnetent_r_proto" in
12126 ''|0) try='int endnetent_r(struct netent_data*);'
61c26d18 12127 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
12128 esac
12129 case "$endnetent_r_proto" in
12130 ''|0) try='void endnetent_r(struct netent_data*);'
61c26d18 12131 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
12132 esac
12133 case "$endnetent_r_proto" in
90e831dc 12134 ''|0) d_endnetent_r=undef
10bc17b6 12135 endnetent_r_proto=0
a48ec845 12136 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12137 * ) case "$endnetent_r_proto" in
12138 REENTRANT_PROTO*) ;;
12139 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12140 esac
12141 echo "Prototype: $try" ;;
12142 esac
12143 ;;
c18e646a
JH
12144 *) case "$usethreads" in
12145 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12146 esac
90e831dc
SB
12147 d_endnetent_r=undef
12148 endnetent_r_proto=0
c18e646a 12149 ;;
a48ec845
JH
12150 esac
12151 ;;
10bc17b6
JH
12152*) endnetent_r_proto=0
12153 ;;
12154esac
12155
b4eb6b3d
JH
12156: see if endprotoent exists
12157set endprotoent d_endpent
12158eval $inlibc
12159
10bc17b6
JH
12160: see if endprotoent_r exists
12161set endprotoent_r d_endprotoent_r
12162eval $inlibc
12163case "$d_endprotoent_r" in
12164"$define")
12165 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12166 case "$d_endprotoent_r_proto:$usethreads" in
12167 ":define") d_endprotoent_r_proto=define
a48ec845
JH
12168 set d_endprotoent_r_proto endprotoent_r $hdrs
12169 eval $hasproto ;;
12170 *) ;;
12171 esac
12172 case "$d_endprotoent_r_proto" in
12173 define)
10bc17b6
JH
12174 case "$endprotoent_r_proto" in
12175 ''|0) try='int endprotoent_r(struct protoent_data*);'
61c26d18 12176 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
12177 esac
12178 case "$endprotoent_r_proto" in
12179 ''|0) try='void endprotoent_r(struct protoent_data*);'
61c26d18 12180 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
12181 esac
12182 case "$endprotoent_r_proto" in
90e831dc 12183 ''|0) d_endprotoent_r=undef
10bc17b6 12184 endprotoent_r_proto=0
a48ec845 12185 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12186 * ) case "$endprotoent_r_proto" in
12187 REENTRANT_PROTO*) ;;
12188 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12189 esac
12190 echo "Prototype: $try" ;;
12191 esac
12192 ;;
c18e646a
JH
12193 *) case "$usethreads" in
12194 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12195 esac
90e831dc
SB
12196 d_endprotoent_r=undef
12197 endprotoent_r_proto=0
c18e646a 12198 ;;
a48ec845
JH
12199 esac
12200 ;;
10bc17b6
JH
12201*) endprotoent_r_proto=0
12202 ;;
12203esac
12204
b4eb6b3d
JH
12205: see if endpwent exists
12206set endpwent d_endpwent
12207eval $inlibc
12208
10bc17b6
JH
12209: see if this is a pwd.h system
12210set pwd.h i_pwd
12211eval $inhdr
12212
12213case "$i_pwd" in
12214$define)
12215 xxx=`./findhdr pwd.h`
12216 $cppstdin $cppflags $cppminus < $xxx >$$.h
12217
12218 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12219 val="$define"
12220 else
12221 val="$undef"
12222 fi
12223 set d_pwquota
12224 eval $setvar
12225
12226 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12227 val="$define"
12228 else
12229 val="$undef"
12230 fi
12231 set d_pwage
12232 eval $setvar
12233
12234 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12235 val="$define"
12236 else
12237 val="$undef"
12238 fi
12239 set d_pwchange
12240 eval $setvar
12241
12242 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12243 val="$define"
12244 else
12245 val="$undef"
12246 fi
12247 set d_pwclass
12248 eval $setvar
12249
12250 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12251 val="$define"
12252 else
12253 val="$undef"
12254 fi
12255 set d_pwexpire
12256 eval $setvar
12257
12258 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12259 val="$define"
12260 else
12261 val="$undef"
12262 fi
12263 set d_pwcomment
12264 eval $setvar
12265
12266 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12267 val="$define"
12268 else
12269 val="$undef"
12270 fi
12271 set d_pwgecos
12272 eval $setvar
12273
12274 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12275 val="$define"
12276 else
12277 val="$undef"
12278 fi
12279 set d_pwpasswd
12280 eval $setvar
12281
12282 $rm -f $$.h
12283 ;;
12284*)
12285 val="$undef";
12286 set d_pwquota; eval $setvar
12287 set d_pwage; eval $setvar
12288 set d_pwchange; eval $setvar
12289 set d_pwclass; eval $setvar
12290 set d_pwexpire; eval $setvar
12291 set d_pwcomment; eval $setvar
12292 set d_pwgecos; eval $setvar
12293 set d_pwpasswd; eval $setvar
12294 ;;
12295esac
12296
12297: see if endpwent_r exists
12298set endpwent_r d_endpwent_r
12299eval $inlibc
12300case "$d_endpwent_r" in
12301"$define")
12302 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
12303 case "$d_endpwent_r_proto:$usethreads" in
12304 ":define") d_endpwent_r_proto=define
a48ec845
JH
12305 set d_endpwent_r_proto endpwent_r $hdrs
12306 eval $hasproto ;;
12307 *) ;;
12308 esac
12309 case "$d_endpwent_r_proto" in
12310 define)
10bc17b6
JH
12311 case "$endpwent_r_proto" in
12312 ''|0) try='int endpwent_r(FILE**);'
61c26d18 12313 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
10bc17b6
JH
12314 esac
12315 case "$endpwent_r_proto" in
12316 ''|0) try='void endpwent_r(FILE**);'
61c26d18 12317 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
10bc17b6
JH
12318 esac
12319 case "$endpwent_r_proto" in
90e831dc 12320 ''|0) d_endpwent_r=undef
10bc17b6 12321 endpwent_r_proto=0
a48ec845 12322 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12323 * ) case "$endpwent_r_proto" in
12324 REENTRANT_PROTO*) ;;
12325 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12326 esac
12327 echo "Prototype: $try" ;;
12328 esac
12329 ;;
c18e646a
JH
12330 *) case "$usethreads" in
12331 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12332 esac
90e831dc
SB
12333 d_endpwent_r=undef
12334 endpwent_r_proto=0
c18e646a 12335 ;;
a48ec845
JH
12336 esac
12337 ;;
10bc17b6
JH
12338*) endpwent_r_proto=0
12339 ;;
12340esac
12341
b4eb6b3d
JH
12342: see if endservent exists
12343set endservent d_endsent
12344eval $inlibc
12345
10bc17b6
JH
12346: see if endservent_r exists
12347set endservent_r d_endservent_r
12348eval $inlibc
12349case "$d_endservent_r" in
12350"$define")
12351 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12352 case "$d_endservent_r_proto:$usethreads" in
12353 ":define") d_endservent_r_proto=define
a48ec845
JH
12354 set d_endservent_r_proto endservent_r $hdrs
12355 eval $hasproto ;;
12356 *) ;;
12357 esac
12358 case "$d_endservent_r_proto" in
12359 define)
10bc17b6
JH
12360 case "$endservent_r_proto" in
12361 ''|0) try='int endservent_r(struct servent_data*);'
61c26d18 12362 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
12363 esac
12364 case "$endservent_r_proto" in
12365 ''|0) try='void endservent_r(struct servent_data*);'
61c26d18 12366 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
12367 esac
12368 case "$endservent_r_proto" in
90e831dc 12369 ''|0) d_endservent_r=undef
10bc17b6 12370 endservent_r_proto=0
a48ec845 12371 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12372 * ) case "$endservent_r_proto" in
12373 REENTRANT_PROTO*) ;;
12374 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12375 esac
12376 echo "Prototype: $try" ;;
12377 esac
12378 ;;
c18e646a
JH
12379 *) case "$usethreads" in
12380 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12381 esac
90e831dc
SB
12382 d_endservent_r=undef
12383 endservent_r_proto=0
c18e646a 12384 ;;
a48ec845
JH
12385 esac
12386 ;;
10bc17b6
JH
12387*) endservent_r_proto=0
12388 ;;
12389esac
12390
b4eb6b3d
JH
12391: Locate the flags for 'open()'
12392echo " "
55954f19 12393$cat >try.c <<EOCP
b4eb6b3d
JH
12394#include <sys/types.h>
12395#ifdef I_FCNTL
12396#include <fcntl.h>
12397#endif
12398#ifdef I_SYS_FILE
12399#include <sys/file.h>
12400#endif
55954f19
JH
12401#$i_stdlib I_STDLIB
12402#ifdef I_STDLIB
12403#include <stdlib.h>
12404#endif
b4eb6b3d
JH
12405int main() {
12406 if(O_RDONLY);
12407#ifdef O_TRUNC
12408 exit(0);
12409#else
12410 exit(1);
12411#endif
12412}
12413EOCP
12414: check sys/file.h first to get FREAD on Sun
12415if $test `./findhdr sys/file.h` && \
5440bc8e 12416 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
12417 h_sysfile=true;
12418 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 12419 if $run ./try; then
b4eb6b3d
JH
12420 echo "and you have the 3 argument form of open()." >&4
12421 val="$define"
12422 else
12423 echo "but not the 3 argument form of open(). Oh, well." >&4
12424 val="$undef"
12425 fi
12426elif $test `./findhdr fcntl.h` && \
5440bc8e 12427 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
12428 h_fcntl=true;
12429 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 12430 if $run ./try; then
b4eb6b3d
JH
12431 echo "and you have the 3 argument form of open()." >&4
12432 val="$define"
12433 else
12434 echo "but not the 3 argument form of open(). Oh, well." >&4
12435 val="$undef"
12436 fi
12437else
12438 val="$undef"
12439 echo "I can't find the O_* constant definitions! You got problems." >&4
12440fi
12441set d_open3
12442eval $setvar
5b813a60 12443$rm_try
b4eb6b3d 12444
3c728e00
JH
12445: see if this is a sys/file.h system
12446val=''
12447set sys/file.h val
12448eval $inhdr
12449
12450: do we need to include sys/file.h ?
12451case "$val" in
12452"$define")
12453 echo " "
12454 if $h_sysfile; then
12455 val="$define"
12456 echo "We'll be including <sys/file.h>." >&4
12457 else
12458 val="$undef"
12459 echo "We won't be including <sys/file.h>." >&4
12460 fi
12461 ;;
12462*)
12463 h_sysfile=false
12464 ;;
12465esac
12466set i_sysfile
12467eval $setvar
12468
12469: see if fcntl.h is there
12470val=''
12471set fcntl.h val
12472eval $inhdr
12473
12474: see if we can include fcntl.h
12475case "$val" in
12476"$define")
12477 echo " "
12478 if $h_fcntl; then
12479 val="$define"
12480 echo "We'll be including <fcntl.h>." >&4
12481 else
12482 val="$undef"
12483 if $h_sysfile; then
12484 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12485 else
12486 echo "We won't be including <fcntl.h>." >&4
12487 fi
12488 fi
12489 ;;
12490*)
12491 h_fcntl=false
12492 val="$undef"
12493 ;;
12494esac
12495set i_fcntl
12496eval $setvar
12497
4dd8f9b3
JH
12498: see if fork exists
12499set fork d_fork
12500eval $inlibc
12501
12502: see if pipe exists
12503set pipe d_pipe
12504eval $inlibc
12505
b4eb6b3d
JH
12506: check for non-blocking I/O stuff
12507case "$h_sysfile" in
a0acbdc3
JH
12508true) echo "#include <sys/file.h>" > head.c;;
12509*)
12510 case "$h_fcntl" in
12511 true) echo "#include <fcntl.h>" > head.c;;
12512 *) echo "#include <sys/fcntl.h>" > head.c;;
12513 esac
12514 ;;
b4eb6b3d
JH
12515esac
12516echo " "
12517echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12518case "$o_nonblock" in
12519'')
12520 $cat head.c > try.c
3c728e00 12521 $cat >>try.c <<EOCP
b4eb6b3d 12522#include <stdio.h>
55954f19
JH
12523#$i_stdlib I_STDLIB
12524#ifdef I_STDLIB
80b3ef99 12525#include <stdlib.h>
55954f19 12526#endif
3c728e00
JH
12527#$i_fcntl I_FCNTL
12528#ifdef I_FCNTL
12529#include <fcntl.h>
12530#endif
b4eb6b3d
JH
12531int main() {
12532#ifdef O_NONBLOCK
12533 printf("O_NONBLOCK\n");
12534 exit(0);
12535#endif
12536#ifdef O_NDELAY
12537 printf("O_NDELAY\n");
12538 exit(0);
12539#endif
12540#ifdef FNDELAY
12541 printf("FNDELAY\n");
12542 exit(0);
12543#endif
12544 exit(0);
12545}
12546EOCP
12547 set try
12548 if eval $compile_ok; then
5440bc8e 12549 o_nonblock=`$run ./try`
b4eb6b3d
JH
12550 case "$o_nonblock" in
12551 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12552 *) echo "Seems like we can use $o_nonblock.";;
12553 esac
12554 else
12555 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12556 fi
12557 ;;
12558*) echo "Using $hint value $o_nonblock.";;
12559esac
5b813a60 12560$rm_try
b4eb6b3d
JH
12561
12562echo " "
12563echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12564case "$eagain" in
12565'')
4dd8f9b3
JH
12566 case "$d_fork:$d_pipe" in
12567 define:define)
b4eb6b3d
JH
12568 $cat head.c > try.c
12569 $cat >>try.c <<EOCP
12570#include <errno.h>
12571#include <sys/types.h>
12572#include <signal.h>
5b813a60 12573#include <stdio.h>
55954f19
JH
12574#$i_stdlib I_STDLIB
12575#ifdef I_STDLIB
12576#include <stdlib.h>
12577#endif
1deb0a86
JH
12578#$i_fcntl I_FCNTL
12579#ifdef I_FCNTL
12580#include <fcntl.h>
12581#endif
b4eb6b3d
JH
12582#define MY_O_NONBLOCK $o_nonblock
12583#ifndef errno /* XXX need better Configure test */
12584extern int errno;
12585#endif
12586#$i_unistd I_UNISTD
12587#ifdef I_UNISTD
12588#include <unistd.h>
12589#endif
12590#$i_string I_STRING
12591#ifdef I_STRING
12592#include <string.h>
12593#else
12594#include <strings.h>
12595#endif
7090f861 12596$signal_t blech(int x) { exit(3); }
b4eb6b3d
JH
12597EOCP
12598 $cat >> try.c <<'EOCP'
12599int main()
12600{
12601 int pd[2];
12602 int pu[2];
12603 char buf[1];
12604 char string[100];
12605
12606 pipe(pd); /* Down: child -> parent */
12607 pipe(pu); /* Up: parent -> child */
12608 if (0 != fork()) {
12609 int ret;
12610 close(pd[1]); /* Parent reads from pd[0] */
12611 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 12612#ifdef F_SETFL
b4eb6b3d
JH
12613 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12614 exit(1);
a0acbdc3
JH
12615#else
12616 exit(4);
12617#endif
b4eb6b3d
JH
12618 signal(SIGALRM, blech);
12619 alarm(5);
12620 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
12621 exit(2);
12622 sprintf(string, "%d\n", ret);
12623 write(2, string, strlen(string));
12624 alarm(0);
12625#ifdef EAGAIN
12626 if (errno == EAGAIN) {
12627 printf("EAGAIN\n");
12628 goto ok;
12629 }
12630#endif
12631#ifdef EWOULDBLOCK
12632 if (errno == EWOULDBLOCK)
12633 printf("EWOULDBLOCK\n");
12634#endif
12635 ok:
12636 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
12637 sleep(2); /* Give it time to close our pipe */
12638 alarm(5);
12639 ret = read(pd[0], buf, 1); /* Should read EOF */
12640 alarm(0);
12641 sprintf(string, "%d\n", ret);
868439a2 12642 write(4, string, strlen(string));
b4eb6b3d
JH
12643 exit(0);
12644 }
12645
12646 close(pd[0]); /* We write to pd[1] */
12647 close(pu[1]); /* We read from pu[0] */
12648 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
12649 close(pd[1]); /* Pipe pd is now fully closed! */
12650 exit(0); /* Bye bye, thank you for playing! */
12651}
12652EOCP
12653 set try
12654 if eval $compile_ok; then
12655 echo "$startsh" >mtry
868439a2 12656 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
12657 chmod +x mtry
12658 ./mtry >/dev/null 2>&1
12659 case $? in
12660 0) eagain=`$cat try.out`;;
12661 1) echo "Could not perform non-blocking setting!";;
12662 2) echo "I did a successful read() for something that was not there!";;
12663 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 12664 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
12665 *) echo "Something terribly wrong happened during testing.";;
12666 esac
12667 rd_nodata=`$cat try.ret`
12668 echo "A read() system call with no data present returns $rd_nodata."
12669 case "$rd_nodata" in
12670 0|-1) ;;
12671 *)
12672 echo "(That's peculiar, fixing that to be -1.)"
12673 rd_nodata=-1
12674 ;;
12675 esac
12676 case "$eagain" in
12677 '')
12678 echo "Forcing errno EAGAIN on read() with no data available."
12679 eagain=EAGAIN
12680 ;;
12681 *)
12682 echo "Your read() sets errno to $eagain when no data is available."
12683 ;;
12684 esac
12685 status=`$cat try.err`
12686 case "$status" in
12687 0) echo "And it correctly returns 0 to signal EOF.";;
12688 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12689 *) echo "However, your read() returns '$status' on EOF??";;
12690 esac
12691 val="$define"
12692 if test "$status" = "$rd_nodata"; then
12693 echo "WARNING: you can't distinguish between EOF and no data!"
12694 val="$undef"
12695 fi
12696 else
12697 echo "I can't compile the test program--assuming errno EAGAIN will do."
12698 eagain=EAGAIN
12699 fi
4dd8f9b3
JH
12700 ;;
12701 *) echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12702 eagain=EAGAIN
12703 val="$define"
12704 ;;
12705 esac
b4eb6b3d
JH
12706 set d_eofnblk
12707 eval $setvar
12708 ;;
12709*)
12710 echo "Using $hint value $eagain."
12711 echo "Your read() returns $rd_nodata when no data is present."
12712 case "$d_eofnblk" in
12713 "$define") echo "And you can see EOF because read() returns 0.";;
12714 "$undef") echo "But you can't see EOF status from read() returned value.";;
12715 *)
12716 echo "(Assuming you can't see EOF status from read anyway.)"
12717 d_eofnblk=$undef
12718 ;;
12719 esac
12720 ;;
12721esac
5b813a60 12722$rm_try head.c mtry
b4eb6b3d 12723
15b61c98
JH
12724: see if _ptr and _cnt from stdio act std
12725echo " "
b4eb6b3d 12726
15b61c98
JH
12727if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12728 echo "(Looks like you have stdio.h from BSD.)"
12729 case "$stdio_ptr" in
12730 '') stdio_ptr='((fp)->_p)'
12731 ptr_lval=$define
12732 ;;
12733 *) ptr_lval=$d_stdio_ptr_lval;;
12734 esac
12735 case "$stdio_cnt" in
12736 '') stdio_cnt='((fp)->_r)'
12737 cnt_lval=$define
12738 ;;
12739 *) cnt_lval=$d_stdio_cnt_lval;;
12740 esac
12741 case "$stdio_base" in
12742 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12743 esac
12744 case "$stdio_bufsiz" in
12745 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12746 esac
12747elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12748 echo "(Looks like you have stdio.h from Linux.)"
12749 case "$stdio_ptr" in
12750 '') stdio_ptr='((fp)->_IO_read_ptr)'
12751 ptr_lval=$define
12752 ;;
12753 *) ptr_lval=$d_stdio_ptr_lval;;
12754 esac
12755 case "$stdio_cnt" in
12756 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12757 cnt_lval=$undef
12758 ;;
12759 *) cnt_lval=$d_stdio_cnt_lval;;
12760 esac
12761 case "$stdio_base" in
12762 '') stdio_base='((fp)->_IO_read_base)';;
12763 esac
12764 case "$stdio_bufsiz" in
12765 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12766 esac
12767else
12768 case "$stdio_ptr" in
12769 '') stdio_ptr='((fp)->_ptr)'
12770 ptr_lval=$define
12771 ;;
12772 *) ptr_lval=$d_stdio_ptr_lval;;
12773 esac
12774 case "$stdio_cnt" in
12775 '') stdio_cnt='((fp)->_cnt)'
12776 cnt_lval=$define
12777 ;;
12778 *) cnt_lval=$d_stdio_cnt_lval;;
12779 esac
12780 case "$stdio_base" in
12781 '') stdio_base='((fp)->_base)';;
12782 esac
12783 case "$stdio_bufsiz" in
12784 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12785 esac
12786fi
b4eb6b3d 12787
15b61c98
JH
12788: test whether _ptr and _cnt really work
12789echo "Checking how std your stdio is..." >&4
12790$cat >try.c <<EOP
12791#include <stdio.h>
55954f19
JH
12792#$i_stdlib I_STDLIB
12793#ifdef I_STDLIB
9d9004a9 12794#include <stdlib.h>
55954f19 12795#endif
15b61c98
JH
12796#define FILE_ptr(fp) $stdio_ptr
12797#define FILE_cnt(fp) $stdio_cnt
9d9004a9 12798int main() {
15b61c98
JH
12799 FILE *fp = fopen("try.c", "r");
12800 char c = getc(fp);
12801 if (
12802 18 <= FILE_cnt(fp) &&
12803 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12804 )
12805 exit(0);
12806 exit(1);
9d9004a9 12807}
15b61c98
JH
12808EOP
12809val="$undef"
12810set try
12811if eval $compile && $to try.c; then
12812 if $run ./try; then
12813 echo "Your stdio acts pretty std."
12814 val="$define"
9d9004a9 12815 else
15b61c98 12816 echo "Your stdio isn't very std."
9d9004a9 12817 fi
15b61c98
JH
12818else
12819 echo "Your stdio doesn't appear very std."
12820fi
5b813a60 12821$rm_try
15b61c98
JH
12822
12823# glibc 2.2.90 and above apparently change stdio streams so Perl's
12824# direct buffer manipulation no longer works. The Configure tests
12825# should be changed to correctly detect this, but until then,
12826# the following check should at least let perl compile and run.
12827# (This quick fix should be updated before 5.8.1.)
12828# To be defensive, reject all unknown versions, and all versions > 2.2.9.
12829# A. Dougherty, June 3, 2002.
12830case "$d_gnulibc" in
12831$define)
12832 case "$gnulibc_version" in
12833 2.[01]*) ;;
12834 2.2) ;;
12835 2.2.[0-9]) ;;
12836 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12837 val="$undef"
12838 ;;
12839 esac
9d9004a9
AD
12840 ;;
12841esac
15b61c98 12842set d_stdstdio
9d9004a9 12843eval $setvar
9d9004a9 12844
15b61c98
JH
12845: Can _ptr be used as an lvalue?
12846case "$d_stdstdio$ptr_lval" in
12847$define$define) val=$define ;;
12848*) val=$undef ;;
12849esac
12850set d_stdio_ptr_lval
12851eval $setvar
9d9004a9 12852
15b61c98
JH
12853: Can _cnt be used as an lvalue?
12854case "$d_stdstdio$cnt_lval" in
12855$define$define) val=$define ;;
12856*) val=$undef ;;
12857esac
12858set d_stdio_cnt_lval
12859eval $setvar
b4eb6b3d 12860
15b61c98
JH
12861
12862: test whether setting _ptr sets _cnt as a side effect
12863d_stdio_ptr_lval_sets_cnt="$undef"
12864d_stdio_ptr_lval_nochange_cnt="$undef"
12865case "$d_stdio_ptr_lval$d_stdstdio" in
12866$define$define)
12867 echo "Checking to see what happens if we set the stdio ptr..." >&4
12868$cat >try.c <<EOP
12869#include <stdio.h>
12870/* Can we scream? */
12871/* Eat dust sed :-) */
12872/* In the buffer space, no one can hear you scream. */
55954f19
JH
12873#$i_stdlib I_STDLIB
12874#ifdef I_STDLIB
12875#include <stdlib.h>
12876#endif
15b61c98
JH
12877#define FILE_ptr(fp) $stdio_ptr
12878#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 12879#include <sys/types.h>
b4eb6b3d 12880int main() {
15b61c98
JH
12881 FILE *fp = fopen("try.c", "r");
12882 int c;
12883 char *ptr;
12884 size_t cnt;
12885 if (!fp) {
12886 puts("Fail even to read");
12887 exit(1);
12888 }
12889 c = getc(fp); /* Read away the first # */
12890 if (c == EOF) {
12891 puts("Fail even to read");
12892 exit(1);
12893 }
12894 if (!(
12895 18 <= FILE_cnt(fp) &&
12896 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12897 )) {
12898 puts("Fail even to read");
12899 exit (1);
12900 }
12901 ptr = (char*) FILE_ptr(fp);
12902 cnt = (size_t)FILE_cnt(fp);
12903
12904 FILE_ptr(fp) += 42;
12905
12906 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12907 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12908 exit (1);
12909 }
12910 if (FILE_cnt(fp) <= 20) {
12911 printf ("Fail (<20 chars to test)");
12912 exit (1);
12913 }
12914 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12915 puts("Fail compare");
12916 exit (1);
12917 }
12918 if (cnt == FILE_cnt(fp)) {
12919 puts("Pass_unchanged");
12920 exit (0);
5b813a60 12921 }
15b61c98
JH
12922 if (FILE_cnt(fp) == (cnt - 42)) {
12923 puts("Pass_changed");
12924 exit (0);
12925 }
12926 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12927 return 1;
12928
12929}
12930EOP
12931 set try
12932 if eval $compile && $to try.c; then
12933 case `$run ./try` in
12934 Pass_changed)
12935 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
12936 d_stdio_ptr_lval_sets_cnt="$define" ;;
12937 Pass_unchanged)
12938 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12939 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12940 Fail*)
12941 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12942 *)
12943 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12944 esac
12945 else
12946 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12947 fi
5b813a60 12948 $rm_try
15b61c98
JH
12949 ;;
12950esac
12951
12952: see if _base is also standard
12953val="$undef"
12954case "$d_stdstdio" in
12955$define)
12956 $cat >try.c <<EOP
12957#include <stdio.h>
12958#$i_stdlib I_STDLIB
12959#ifdef I_STDLIB
12960#include <stdlib.h>
12961#endif
12962#define FILE_base(fp) $stdio_base
12963#define FILE_bufsiz(fp) $stdio_bufsiz
12964int main() {
12965 FILE *fp = fopen("try.c", "r");
12966 char c = getc(fp);
12967 if (
12968 19 <= FILE_bufsiz(fp) &&
12969 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12970 )
12971 exit(0);
12972 exit(1);
12973}
12974EOP
12975 set try
12976 if eval $compile && $to try.c; then
12977 if $run ./try; then
12978 echo "And its _base field acts std."
12979 val="$define"
12980 else
12981 echo "But its _base field isn't std."
12982 fi
12983 else
12984 echo "However, it seems to be lacking the _base field."
12985 fi
5b813a60 12986 $rm_try
15b61c98
JH
12987 ;;
12988esac
12989set d_stdiobase
12990eval $setvar
12991
12992: see if fast_stdio exists
12993val="$undef"
12994case "$d_stdstdio:$d_stdio_ptr_lval" in
12995"$define:$define")
12996 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12997 *$define*)
12998 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12999 val="$define"
13000 ;;
13001 esac
13002 ;;
13003esac
13004set d_faststdio
13005eval $setvar
13006
13007
13008
13009: see if fchdir exists
13010set fchdir d_fchdir
13011eval $inlibc
13012
13013: see if fchmod exists
13014set fchmod d_fchmod
13015eval $inlibc
13016
13017: see if fchown exists
13018set fchown d_fchown
13019eval $inlibc
13020
13021: see if this is an fcntl system
13022set fcntl d_fcntl
13023eval $inlibc
13024
15b61c98 13025: See if fcntl-based locking works.
613d6c3e 13026echo " "
15b61c98
JH
13027$cat >try.c <<EOCP
13028#$i_stdlib I_STDLIB
13029#ifdef I_STDLIB
13030#include <stdlib.h>
13031#endif
13032#include <unistd.h>
13033#include <fcntl.h>
13034#include <signal.h>
7090f861 13035$signal_t blech(int x) { exit(3); }
15b61c98
JH
13036int main() {
13037#if defined(F_SETLK) && defined(F_SETLKW)
13038 struct flock flock;
13039 int retval, fd;
13040 fd = open("try.c", O_RDONLY);
13041 flock.l_type = F_RDLCK;
13042 flock.l_whence = SEEK_SET;
13043 flock.l_start = flock.l_len = 0;
13044 signal(SIGALRM, blech);
13045 alarm(10);
13046 retval = fcntl(fd, F_SETLK, &flock);
13047 close(fd);
13048 (retval < 0 ? exit(2) : exit(0));
13049#else
13050 exit(2);
13051#endif
13052}
13053EOCP
13054echo "Checking if fcntl-based file locking works... "
13055case "$d_fcntl" in
13056"$define")
13057 set try
13058 if eval $compile_ok; then
13059 if $run ./try; then
13060 echo "Yes, it seems to work."
13061 val="$define"
13062 else
13063 echo "Nope, it didn't work."
13064 val="$undef"
13065 case "$?" in
13066 3) $cat >&4 <<EOM
13067***
13068*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13069*** This is (almost) impossible.
13070*** If your NFS lock daemons are not feeling well, something like
13071*** this may happen, please investigate. Cannot continue, aborting.
13072***
13073EOM
13074 exit 1
13075 ;;
13076 esac
13077 fi
13078 else
13079 echo "I'm unable to compile the test program, so I'll assume not."
13080 val="$undef"
13081 fi
13082 ;;
13083*) val="$undef";
13084 echo "Nope, since you don't even have fcntl()."
13085 ;;
13086esac
13087set d_fcntl_can_lock
13088eval $setvar
5b813a60 13089$rm_try
15b61c98
JH
13090
13091: check for fd_set items
13092$cat <<EOM
13093
13094Checking to see how well your C compiler handles fd_set and friends ...
13095EOM
13096$cat >try.c <<EOCP
13097#$i_stdlib I_STDLIB
13098#ifdef I_STDLIB
13099#include <stdlib.h>
13100#endif
13101#$i_systime I_SYS_TIME
13102#$i_sysselct I_SYS_SELECT
13103#$d_socket HAS_SOCKET
13104#include <sys/types.h>
13105#ifdef HAS_SOCKET
13106#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13107#endif
13108#ifdef I_SYS_TIME
13109#include <sys/time.h>
13110#endif
13111#ifdef I_SYS_SELECT
13112#include <sys/select.h>
13113#endif
13114int main() {
13115 fd_set fds;
13116
13117#ifdef TRYBITS
13118 if(fds.fds_bits);
13119#endif
13120
13121#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13122 exit(0);
13123#else
13124 exit(1);
13125#endif
13126}
13127EOCP
13128set try -DTRYBITS
13129if eval $compile; then
13130 d_fds_bits="$define"
13131 d_fd_set="$define"
13132 echo "Well, your system knows about the normal fd_set typedef..." >&4
13133 if $run ./try; then
b4eb6b3d
JH
13134 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13135 d_fd_macros="$define"
13136 else
13137 $cat >&4 <<'EOM'
13138but not the normal fd_set macros! Gaaack! I'll have to cover for you.
13139EOM
13140 d_fd_macros="$undef"
13141 fi
13142else
13143 $cat <<'EOM'
13144Hmm, your compiler has some difficulty with fd_set. Checking further...
13145EOM
5440bc8e 13146 set try
b4eb6b3d
JH
13147 if eval $compile; then
13148 d_fds_bits="$undef"
13149 d_fd_set="$define"
13150 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 13151 if $run ./try; then
b4eb6b3d
JH
13152 echo "and you have the normal fd_set macros." >&4
13153 d_fd_macros="$define"
13154 else
13155 $cat <<'EOM'
13156but not the normal fd_set macros! Gross! More work for me...
13157EOM
13158 d_fd_macros="$undef"
13159 fi
13160 else
13161 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
13162 d_fd_set="$undef"
13163 d_fds_bits="$undef"
13164 d_fd_macros="$undef"
13165 fi
13166fi
5b813a60 13167$rm_try
b4eb6b3d
JH
13168
13169: see if fgetpos exists
13170set fgetpos d_fgetpos
13171eval $inlibc
13172
758a5d79
JH
13173: see if finite exists
13174set finite d_finite
13175eval $inlibc
13176
13177: see if finitel exists
13178set finitel d_finitel
13179eval $inlibc
13180
b4eb6b3d
JH
13181: see if flock exists
13182set flock d_flock
13183eval $inlibc
13184
2ef53570
JH
13185: see if prototype for flock is available
13186echo " "
13187set d_flockproto flock $i_sysfile sys/file.h
13188eval $hasproto
13189
758a5d79
JH
13190: see if fp_class exists
13191set fp_class d_fp_class
13192eval $inlibc
13193
b4eb6b3d
JH
13194: see if pathconf exists
13195set pathconf d_pathconf
13196eval $inlibc
13197
13198: see if fpathconf exists
13199set fpathconf d_fpathconf
13200eval $inlibc
13201
758a5d79
JH
13202: see if fpclass exists
13203set fpclass d_fpclass
13204eval $inlibc
13205
13206: see if fpclassify exists
13207set fpclassify d_fpclassify
13208eval $inlibc
13209
13210: see if fpclassl exists
13211set fpclassl d_fpclassl
13212eval $inlibc
13213
b4eb6b3d
JH
13214: check for fpos64_t
13215echo " "
13216echo "Checking to see if you have fpos64_t..." >&4
13217$cat >try.c <<EOCP
13218#include <stdio.h>
13219int main() { fpos64_t x = 7; }
13220EOCP
13221set try
13222if eval $compile; then
13223 val="$define"
13224 echo "You have fpos64_t."
13225else
13226 val="$undef"
13227 echo "You do not have fpos64_t."
13228 case "$fpossize" in
13229 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13230 esac
13231fi
5b813a60 13232$rm_try
b4eb6b3d
JH
13233set d_fpos64_t
13234eval $setvar
13235
13236: see if frexpl exists
13237set frexpl d_frexpl
13238eval $inlibc
13239
b4eb6b3d
JH
13240: see if this is a sys/param system
13241set sys/param.h i_sysparam
13242eval $inhdr
13243
13244: see if this is a sys/mount.h system
13245set sys/mount.h i_sysmount
13246eval $inhdr
13247
34f1896b 13248: Check for fs_data_s
b4eb6b3d
JH
13249echo " "
13250echo "Checking to see if your system supports struct fs_data..." >&4
13251set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13252eval $hasstruct
13253case "$d_fs_data_s" in
13254"$define") echo "Yes, it does." ;;
13255*) echo "No, it doesn't." ;;
13256esac
13257
13258: see if fseeko exists
13259set fseeko d_fseeko
13260eval $inlibc
13261case "$longsize" in
132628) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13263esac
13264
13265: see if fsetpos exists
13266set fsetpos d_fsetpos
13267eval $inlibc
13268
b4eb6b3d
JH
13269: see if fstatfs exists
13270set fstatfs d_fstatfs
13271eval $inlibc
13272
b4eb6b3d
JH
13273: see if statvfs exists
13274set statvfs d_statvfs
13275eval $inlibc
13276
13277: see if fstatvfs exists
13278set fstatvfs d_fstatvfs
13279eval $inlibc
13280
13281
411ab01c
JH
13282: see if fsync exists
13283set fsync d_fsync
13284eval $inlibc
13285
b4eb6b3d
JH
13286: see if ftello exists
13287set ftello d_ftello
13288eval $inlibc
13289case "$longsize" in
132908) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13291esac
13292
bff98e24 13293: check for a working futimes
613d6c3e 13294d_futimes="$undef"
bff98e24 13295echo " "
5b813a60 13296echo "Checking if you have a working futimes()" >&4
bff98e24
SP
13297$cat >try.c <<EOCP
13298#include <stdio.h>
13299#include <sys/time.h>
13300#include <errno.h>
13301#include <fcntl.h>
13302
13303int main ()
13304{
13305 int fd, rv;
13306 fd = open ("try.c", O_RDWR);
13307 if (-1 == fd) exit (1);
13308 rv = futimes (fd, NULL);
13309 exit (rv == -1 ? errno : 0);
13310}
13311EOCP
13312set try
13313if eval $compile; then
13314 `$run ./try`
13315 rc=$?
13316 case "$rc" in
5b813a60 13317 0) echo "Yes, you have" >&4
bff98e24
SP
13318 d_futimes="$define"
13319 ;;
5b813a60 13320 *) echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
bff98e24
SP
13321 ;;
13322 esac
13323else
43dddb59 13324 echo "No, it does not (probably harmless)" >&4
bff98e24 13325fi
5b813a60 13326$rm_try
dc814df1 13327
e74475c7
MHM
13328: see if ndbm.h is available
13329set ndbm.h i_ndbm
13330eval $inhdr
13331: Compatibility location for RedHat 7.1
13332set gdbm/ndbm.h i_gdbmndbm
13333eval $inhdr
13334: Compatibility location for Debian 4.0
13335set gdbm-ndbm.h i_gdbm_ndbm
13336eval $inhdr
13337
13338val="$undef"
13339if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13340 : see if dbm_open exists
13341 set dbm_open d_dbm_open
13342 eval $inlibc
13343 case "$d_dbm_open" in
13344 $undef)
13345 i_ndbm="$undef"
13346 i_gdbmndbm="$undef"
13347 i_gdbm_ndbm="$undef"
13348 echo "We won't be including <ndbm.h>"
13349 val="$undef"
13350 ;;
13351 *) val="$define"
13352 ;;
13353 esac
13354fi
13355set d_ndbm
13356eval $setvar
13357
13358ndbm_hdr_protochk='name=$1; hdr=$2;
13359eval "ihdr=\$""i_$name";
13360val="$undef";
13361if $test "$ihdr" = "$define"; then
13362 $echo "Checking if your <$hdr> uses prototypes..." >&4;
13363 case "$d_cplusplus" in
13364 $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13365 *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13366 esac;
13367 case "$val" in
13368 $define) $echo "Your <$hdr> seems to have prototypes";;
13369 *) $echo "Your <$hdr> does not seem to have prototypes";;
13370 esac;
13371fi;
13372set "d_${name}_h_uses_prototypes";
13373eval $setvar'
13374
13375set ndbm ndbm.h
13376eval $ndbm_hdr_protochk
13377set gdbmndbm gdbm/ndbm.h
13378eval $ndbm_hdr_protochk
13379set gdbm_ndbm gdbm-ndbm.h
13380eval $ndbm_hdr_protochk
13381
b4eb6b3d
JH
13382: see if getcwd exists
13383set getcwd d_getcwd
13384eval $inlibc
13385
13386: see if getespwnam exists
13387set getespwnam d_getespwnam
13388eval $inlibc
13389
b4eb6b3d
JH
13390: see if getfsstat exists
13391set getfsstat d_getfsstat
13392eval $inlibc
13393
13394: see if getgrent exists
13395set getgrent d_getgrent
13396eval $inlibc
13397
10bc17b6
JH
13398: see if getgrent_r exists
13399set getgrent_r d_getgrent_r
13400eval $inlibc
13401case "$d_getgrent_r" in
13402"$define")
13403 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13404 case "$d_getgrent_r_proto:$usethreads" in
13405 ":define") d_getgrent_r_proto=define
a48ec845
JH
13406 set d_getgrent_r_proto getgrent_r $hdrs
13407 eval $hasproto ;;
13408 *) ;;
13409 esac
13410 case "$d_getgrent_r_proto" in
13411 define)
10bc17b6
JH
13412 case "$getgrent_r_proto" in
13413 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
61c26d18 13414 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
10bc17b6
JH
13415 esac
13416 case "$getgrent_r_proto" in
13417 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
61c26d18 13418 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
10bc17b6
JH
13419 esac
13420 case "$getgrent_r_proto" in
13421 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
61c26d18 13422 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
10bc17b6
JH
13423 esac
13424 case "$getgrent_r_proto" in
13425 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
61c26d18 13426 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
10bc17b6
JH
13427 esac
13428 case "$getgrent_r_proto" in
13429 ''|0) try='int getgrent_r(struct group*, char*, int);'
61c26d18 13430 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
10bc17b6
JH
13431 esac
13432 case "$getgrent_r_proto" in
13433 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
61c26d18 13434 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
10bc17b6
JH
13435 esac
13436 case "$getgrent_r_proto" in
90e831dc 13437 ''|0) d_getgrent_r=undef
10bc17b6 13438 getgrent_r_proto=0
a48ec845 13439 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13440 * ) case "$getgrent_r_proto" in
13441 REENTRANT_PROTO*) ;;
13442 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13443 esac
13444 echo "Prototype: $try" ;;
13445 esac
13446 ;;
c18e646a
JH
13447 *) case "$usethreads" in
13448 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13449 esac
90e831dc
SB
13450 d_getgrent_r=undef
13451 getgrent_r_proto=0
c18e646a 13452 ;;
a48ec845
JH
13453 esac
13454 ;;
10bc17b6
JH
13455*) getgrent_r_proto=0
13456 ;;
13457esac
13458
13459: see if getgrgid_r exists
13460set getgrgid_r d_getgrgid_r
13461eval $inlibc
13462case "$d_getgrgid_r" in
13463"$define")
13464 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13465 case "$d_getgrgid_r_proto:$usethreads" in
13466 ":define") d_getgrgid_r_proto=define
a48ec845
JH
13467 set d_getgrgid_r_proto getgrgid_r $hdrs
13468 eval $hasproto ;;
13469 *) ;;
13470 esac
13471 case "$d_getgrgid_r_proto" in
13472 define)
10bc17b6
JH
13473 case "$getgrgid_r_proto" in
13474 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
61c26d18 13475 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
10bc17b6
JH
13476 esac
13477 case "$getgrgid_r_proto" in
13478 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
61c26d18 13479 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
10bc17b6
JH
13480 esac
13481 case "$getgrgid_r_proto" in
13482 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
61c26d18 13483 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
10bc17b6
JH
13484 esac
13485 case "$getgrgid_r_proto" in
13486 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
61c26d18 13487 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
10bc17b6
JH
13488 esac
13489 case "$getgrgid_r_proto" in
90e831dc 13490 ''|0) d_getgrgid_r=undef
10bc17b6 13491 getgrgid_r_proto=0
a48ec845 13492 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13493 * ) case "$getgrgid_r_proto" in
13494 REENTRANT_PROTO*) ;;
13495 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13496 esac
13497 echo "Prototype: $try" ;;
13498 esac
13499 ;;
c18e646a
JH
13500 *) case "$usethreads" in
13501 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13502 esac
90e831dc
SB
13503 d_getgrgid_r=undef
13504 getgrgid_r_proto=0
c18e646a 13505 ;;
a48ec845
JH
13506 esac
13507 ;;
10bc17b6
JH
13508*) getgrgid_r_proto=0
13509 ;;
13510esac
13511
13512: see if getgrnam_r exists
13513set getgrnam_r d_getgrnam_r
13514eval $inlibc
13515case "$d_getgrnam_r" in
13516"$define")
13517 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13518 case "$d_getgrnam_r_proto:$usethreads" in
13519 ":define") d_getgrnam_r_proto=define
a48ec845
JH
13520 set d_getgrnam_r_proto getgrnam_r $hdrs
13521 eval $hasproto ;;
13522 *) ;;
13523 esac
13524 case "$d_getgrnam_r_proto" in
13525 define)
10bc17b6
JH
13526 case "$getgrnam_r_proto" in
13527 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
61c26d18 13528 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
10bc17b6
JH
13529 esac
13530 case "$getgrnam_r_proto" in
13531 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
61c26d18 13532 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
10bc17b6
JH
13533 esac
13534 case "$getgrnam_r_proto" in
13535 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
61c26d18 13536 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
10bc17b6
JH
13537 esac
13538 case "$getgrnam_r_proto" in
13539 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
61c26d18 13540 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
10bc17b6
JH
13541 esac
13542 case "$getgrnam_r_proto" in
13543 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
61c26d18 13544 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
10bc17b6
JH
13545 esac
13546 case "$getgrnam_r_proto" in
90e831dc 13547 ''|0) d_getgrnam_r=undef
10bc17b6 13548 getgrnam_r_proto=0
a48ec845 13549 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13550 * ) case "$getgrnam_r_proto" in
13551 REENTRANT_PROTO*) ;;
13552 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13553 esac
13554 echo "Prototype: $try" ;;
13555 esac
13556 ;;
c18e646a
JH
13557 *) case "$usethreads" in
13558 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13559 esac
90e831dc
SB
13560 d_getgrnam_r=undef
13561 getgrnam_r_proto=0
c18e646a 13562 ;;
a48ec845
JH
13563 esac
13564 ;;
10bc17b6
JH
13565*) getgrnam_r_proto=0
13566 ;;
13567esac
13568
b4eb6b3d
JH
13569: see if gethostbyaddr exists
13570set gethostbyaddr d_gethbyaddr
13571eval $inlibc
13572
13573: see if gethostbyname exists
13574set gethostbyname d_gethbyname
13575eval $inlibc
13576
13577: see if gethostent exists
13578set gethostent d_gethent
13579eval $inlibc
13580
13581: see how we will look up host name
13582echo " "
13583call=''
13584if set gethostname val -f d_gethname; eval $csym; $val; then
13585 echo 'gethostname() found.' >&4
13586 d_gethname="$define"
13587 call=gethostname
13588fi
13589if set uname val -f d_uname; eval $csym; $val; then
13590 if ./xenix; then
13591 $cat <<'EOM'
13592uname() was found, but you're running xenix, and older versions of xenix
13593have a broken uname(). If you don't really know whether your xenix is old
13594enough to have a broken system call, use the default answer.
13595
13596EOM
13597 dflt=y
13598 case "$d_uname" in
13599 "$define") dflt=n;;
13600 esac
13601 rp='Is your uname() broken?'
13602 . ./myread
13603 case "$ans" in
13604 n*) d_uname="$define"; call=uname;;
13605 esac
13606 else
13607 echo 'uname() found.' >&4
13608 d_uname="$define"
13609 case "$call" in
13610 '') call=uname ;;
13611 esac
13612 fi
13613fi
13614case "$d_gethname" in
13615'') d_gethname="$undef";;
13616esac
13617case "$d_uname" in
13618'') d_uname="$undef";;
13619esac
13620case "$d_uname$d_gethname" in
13621*define*)
13622 dflt=n
13623 cat <<EOM
613d6c3e 13624
b4eb6b3d
JH
13625Every now and then someone has a $call() that lies about the hostname
13626but can't be fixed for political or economic reasons. If you wish, I can
13627pretend $call() isn't there and maybe compute hostname at run-time
13628thanks to the '$phostname' command.
13629
13630EOM
13631 rp="Shall I ignore $call() from now on?"
13632 . ./myread
13633 case "$ans" in
13634 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13635 esac;;
13636esac
13637case "$phostname" in
13638'') aphostname='';;
13639*) case "$aphostname" in
13640 /*) ;;
13641 *) set X $phostname
13642 shift
13643 file=$1
13644 shift
13645 file=`./loc $file $file $pth`
13646 aphostname=`echo $file $*`
13647 ;;
13648 esac
13649 ;;
13650esac
13651case "$d_uname$d_gethname" in
13652*define*) ;;
13653*)
13654 case "$phostname" in
13655 '')
13656 echo "There will be no way for $package to get your hostname." >&4;;
13657 *)
13658 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13659 ;;
13660 esac;;
13661esac
13662case "$d_phostname" in
13663'') d_phostname="$undef";;
13664esac
13665
10bc17b6
JH
13666: see if gethostbyaddr_r exists
13667set gethostbyaddr_r d_gethostbyaddr_r
13668eval $inlibc
13669case "$d_gethostbyaddr_r" in
13670"$define")
13671 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13672 case "$d_gethostbyaddr_r_proto:$usethreads" in
13673 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
13674 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13675 eval $hasproto ;;
13676 *) ;;
13677 esac
13678 case "$d_gethostbyaddr_r_proto" in
13679 define)
10bc17b6
JH
13680 case "$gethostbyaddr_r_proto" in
13681 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13682 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
10bc17b6
JH
13683 esac
13684 case "$gethostbyaddr_r_proto" in
13685 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
61c26d18 13686 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
10bc17b6
JH
13687 esac
13688 case "$gethostbyaddr_r_proto" in
13689 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
61c26d18 13690 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
10bc17b6
JH
13691 esac
13692 case "$gethostbyaddr_r_proto" in
13693 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
61c26d18 13694 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
10bc17b6
JH
13695 esac
13696 case "$gethostbyaddr_r_proto" in
13697 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
61c26d18 13698 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
10bc17b6
JH
13699 esac
13700 case "$gethostbyaddr_r_proto" in
13701 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
61c26d18 13702 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
10bc17b6
JH
13703 esac
13704 case "$gethostbyaddr_r_proto" in
13705 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
61c26d18 13706 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
10bc17b6
JH
13707 esac
13708 case "$gethostbyaddr_r_proto" in
13709 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
61c26d18 13710 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
10bc17b6
JH
13711 esac
13712 case "$gethostbyaddr_r_proto" in
13713 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
61c26d18 13714 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
10bc17b6
JH
13715 esac
13716 case "$gethostbyaddr_r_proto" in
13717 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
61c26d18 13718 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
10bc17b6
JH
13719 esac
13720 case "$gethostbyaddr_r_proto" in
a845a0d4 13721 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13722 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
a845a0d4
JH
13723 esac
13724 case "$gethostbyaddr_r_proto" in
90e831dc 13725 ''|0) d_gethostbyaddr_r=undef
10bc17b6 13726 gethostbyaddr_r_proto=0
a48ec845 13727 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13728 * ) case "$gethostbyaddr_r_proto" in
13729 REENTRANT_PROTO*) ;;
13730 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13731 esac
13732 echo "Prototype: $try" ;;
13733 esac
13734 ;;
c18e646a
JH
13735 *) case "$usethreads" in
13736 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13737 esac
90e831dc
SB
13738 d_gethostbyaddr_r=undef
13739 gethostbyaddr_r_proto=0
c18e646a 13740 ;;
a48ec845
JH
13741 esac
13742 ;;
10bc17b6
JH
13743*) gethostbyaddr_r_proto=0
13744 ;;
13745esac
13746
13747: see if gethostbyname_r exists
13748set gethostbyname_r d_gethostbyname_r
13749eval $inlibc
13750case "$d_gethostbyname_r" in
13751"$define")
13752 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13753 case "$d_gethostbyname_r_proto:$usethreads" in
13754 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
13755 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13756 eval $hasproto ;;
13757 *) ;;
13758 esac
13759 case "$d_gethostbyname_r_proto" in
13760 define)
10bc17b6
JH
13761 case "$gethostbyname_r_proto" in
13762 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13763 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
10bc17b6
JH
13764 esac
13765 case "$gethostbyname_r_proto" in
13766 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
61c26d18 13767 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
10bc17b6
JH
13768 esac
13769 case "$gethostbyname_r_proto" in
13770 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
61c26d18 13771 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
10bc17b6
JH
13772 esac
13773 case "$gethostbyname_r_proto" in
90e831dc 13774 ''|0) d_gethostbyname_r=undef
10bc17b6 13775 gethostbyname_r_proto=0
a48ec845 13776 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13777 * ) case "$gethostbyname_r_proto" in
13778 REENTRANT_PROTO*) ;;
13779 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13780 esac
13781 echo "Prototype: $try" ;;
13782 esac
13783 ;;
c18e646a
JH
13784 *) case "$usethreads" in
13785 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13786 esac
90e831dc
SB
13787 d_gethostbyname_r=undef
13788 gethostbyname_r_proto=0
c18e646a 13789 ;;
a48ec845
JH
13790 esac
13791 ;;
10bc17b6
JH
13792*) gethostbyname_r_proto=0
13793 ;;
13794esac
13795
13796: see if gethostent_r exists
13797set gethostent_r d_gethostent_r
13798eval $inlibc
13799case "$d_gethostent_r" in
13800"$define")
13801 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13802 case "$d_gethostent_r_proto:$usethreads" in
13803 ":define") d_gethostent_r_proto=define
a48ec845
JH
13804 set d_gethostent_r_proto gethostent_r $hdrs
13805 eval $hasproto ;;
13806 *) ;;
13807 esac
13808 case "$d_gethostent_r_proto" in
13809 define)
10bc17b6
JH
13810 case "$gethostent_r_proto" in
13811 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13812 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
10bc17b6
JH
13813 esac
13814 case "$gethostent_r_proto" in
13815 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
61c26d18 13816 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
10bc17b6
JH
13817 esac
13818 case "$gethostent_r_proto" in
13819 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
61c26d18 13820 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
10bc17b6
JH
13821 esac
13822 case "$gethostent_r_proto" in
13823 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
61c26d18 13824 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
10bc17b6
JH
13825 esac
13826 case "$gethostent_r_proto" in
13827 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
61c26d18 13828 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
10bc17b6
JH
13829 esac
13830 case "$gethostent_r_proto" in
13831 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
61c26d18 13832 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
10bc17b6
JH
13833 esac
13834 case "$gethostent_r_proto" in
90e831dc 13835 ''|0) d_gethostent_r=undef
10bc17b6 13836 gethostent_r_proto=0
a48ec845 13837 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13838 * ) case "$gethostent_r_proto" in
13839 REENTRANT_PROTO*) ;;
13840 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13841 esac
13842 echo "Prototype: $try" ;;
13843 esac
13844 ;;
c18e646a
JH
13845 *) case "$usethreads" in
13846 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13847 esac
90e831dc
SB
13848 d_gethostent_r=undef
13849 gethostent_r_proto=0
c18e646a 13850 ;;
a48ec845
JH
13851 esac
13852 ;;
10bc17b6
JH
13853*) gethostent_r_proto=0
13854 ;;
13855esac
b4eb6b3d
JH
13856
13857: see if prototypes for various gethostxxx netdb.h functions are available
13858echo " "
13859set d_gethostprotos gethostent $i_netdb netdb.h
13860eval $hasproto
13861
4e0554ec
JH
13862: see if getitimer exists
13863set getitimer d_getitimer
13864eval $inlibc
13865
b4eb6b3d
JH
13866: see if getlogin exists
13867set getlogin d_getlogin
13868eval $inlibc
13869
10bc17b6
JH
13870: see if getlogin_r exists
13871set getlogin_r d_getlogin_r
13872eval $inlibc
13873case "$d_getlogin_r" in
13874"$define")
13875 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
13876 case "$d_getlogin_r_proto:$usethreads" in
13877 ":define") d_getlogin_r_proto=define
a48ec845
JH
13878 set d_getlogin_r_proto getlogin_r $hdrs
13879 eval $hasproto ;;
13880 *) ;;
13881 esac
13882 case "$d_getlogin_r_proto" in
13883 define)
10bc17b6
JH
13884 case "$getlogin_r_proto" in
13885 ''|0) try='int getlogin_r(char*, size_t);'
61c26d18 13886 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
10bc17b6
JH
13887 esac
13888 case "$getlogin_r_proto" in
13889 ''|0) try='int getlogin_r(char*, int);'
61c26d18 13890 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
10bc17b6
JH
13891 esac
13892 case "$getlogin_r_proto" in
13893 ''|0) try='char* getlogin_r(char*, size_t);'
61c26d18 13894 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
10bc17b6
JH
13895 esac
13896 case "$getlogin_r_proto" in
13897 ''|0) try='char* getlogin_r(char*, int);'
61c26d18 13898 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
10bc17b6
JH
13899 esac
13900 case "$getlogin_r_proto" in
90e831dc 13901 ''|0) d_getlogin_r=undef
10bc17b6 13902 getlogin_r_proto=0
a48ec845 13903 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13904 * ) case "$getlogin_r_proto" in
13905 REENTRANT_PROTO*) ;;
13906 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13907 esac
13908 echo "Prototype: $try" ;;
13909 esac
13910 ;;
c18e646a
JH
13911 *) case "$usethreads" in
13912 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13913 esac
90e831dc
SB
13914 d_getlogin_r=undef
13915 getlogin_r_proto=0
c18e646a 13916 ;;
a48ec845
JH
13917 esac
13918 ;;
10bc17b6
JH
13919*) getlogin_r_proto=0
13920 ;;
13921esac
13922
b4eb6b3d
JH
13923: see if getmnt exists
13924set getmnt d_getmnt
13925eval $inlibc
13926
13927: see if getmntent exists
13928set getmntent d_getmntent
13929eval $inlibc
13930
13931: see if getnetbyaddr exists
13932set getnetbyaddr d_getnbyaddr
13933eval $inlibc
13934
13935: see if getnetbyname exists
13936set getnetbyname d_getnbyname
13937eval $inlibc
13938
13939: see if getnetent exists
13940set getnetent d_getnent
13941eval $inlibc
13942
10bc17b6
JH
13943: see if getnetbyaddr_r exists
13944set getnetbyaddr_r d_getnetbyaddr_r
13945eval $inlibc
13946case "$d_getnetbyaddr_r" in
13947"$define")
13948 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13949 case "$d_getnetbyaddr_r_proto:$usethreads" in
13950 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
13951 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13952 eval $hasproto ;;
13953 *) ;;
13954 esac
13955 case "$d_getnetbyaddr_r_proto" in
13956 define)
10bc17b6
JH
13957 case "$getnetbyaddr_r_proto" in
13958 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 13959 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
10bc17b6
JH
13960 esac
13961 case "$getnetbyaddr_r_proto" in
13962 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
61c26d18 13963 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
10bc17b6
JH
13964 esac
13965 case "$getnetbyaddr_r_proto" in
13966 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
61c26d18 13967 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
10bc17b6
JH
13968 esac
13969 case "$getnetbyaddr_r_proto" in
13970 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
61c26d18 13971 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
10bc17b6
JH
13972 esac
13973 case "$getnetbyaddr_r_proto" in
13974 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
61c26d18 13975 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
10bc17b6
JH
13976 esac
13977 case "$getnetbyaddr_r_proto" in
13978 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
61c26d18 13979 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
10bc17b6
JH
13980 esac
13981 case "$getnetbyaddr_r_proto" in
13982 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
61c26d18 13983 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
10bc17b6
JH
13984 esac
13985 case "$getnetbyaddr_r_proto" in
a845a0d4 13986 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 13987 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
a845a0d4
JH
13988 esac
13989 case "$getnetbyaddr_r_proto" in
90e831dc 13990 ''|0) d_getnetbyaddr_r=undef
10bc17b6 13991 getnetbyaddr_r_proto=0
a48ec845 13992 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13993 * ) case "$getnetbyaddr_r_proto" in
13994 REENTRANT_PROTO*) ;;
13995 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13996 esac
13997 echo "Prototype: $try" ;;
13998 esac
13999 ;;
c18e646a
JH
14000 *) case "$usethreads" in
14001 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14002 esac
90e831dc
SB
14003 d_getnetbyaddr_r=undef
14004 getnetbyaddr_r_proto=0
c18e646a 14005 ;;
a48ec845
JH
14006 esac
14007 ;;
10bc17b6
JH
14008*) getnetbyaddr_r_proto=0
14009 ;;
14010esac
14011
14012: see if getnetbyname_r exists
14013set getnetbyname_r d_getnetbyname_r
14014eval $inlibc
14015case "$d_getnetbyname_r" in
14016"$define")
14017 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14018 case "$d_getnetbyname_r_proto:$usethreads" in
14019 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
14020 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14021 eval $hasproto ;;
14022 *) ;;
14023 esac
14024 case "$d_getnetbyname_r_proto" in
14025 define)
10bc17b6
JH
14026 case "$getnetbyname_r_proto" in
14027 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14028 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
10bc17b6
JH
14029 esac
14030 case "$getnetbyname_r_proto" in
14031 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
61c26d18 14032 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
10bc17b6
JH
14033 esac
14034 case "$getnetbyname_r_proto" in
14035 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
61c26d18 14036 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
10bc17b6
JH
14037 esac
14038 case "$getnetbyname_r_proto" in
14039 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
61c26d18 14040 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
10bc17b6
JH
14041 esac
14042 case "$getnetbyname_r_proto" in
90e831dc 14043 ''|0) d_getnetbyname_r=undef
10bc17b6 14044 getnetbyname_r_proto=0
a48ec845 14045 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14046 * ) case "$getnetbyname_r_proto" in
14047 REENTRANT_PROTO*) ;;
14048 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14049 esac
14050 echo "Prototype: $try" ;;
14051 esac
14052 ;;
c18e646a
JH
14053 *) case "$usethreads" in
14054 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14055 esac
90e831dc
SB
14056 d_getnetbyname_r=undef
14057 getnetbyname_r_proto=0
c18e646a 14058 ;;
a48ec845
JH
14059 esac
14060 ;;
10bc17b6
JH
14061*) getnetbyname_r_proto=0
14062 ;;
14063esac
14064
14065: see if getnetent_r exists
14066set getnetent_r d_getnetent_r
14067eval $inlibc
14068case "$d_getnetent_r" in
14069"$define")
14070 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14071 case "$d_getnetent_r_proto:$usethreads" in
14072 ":define") d_getnetent_r_proto=define
a48ec845
JH
14073 set d_getnetent_r_proto getnetent_r $hdrs
14074 eval $hasproto ;;
14075 *) ;;
14076 esac
14077 case "$d_getnetent_r_proto" in
14078 define)
10bc17b6
JH
14079 case "$getnetent_r_proto" in
14080 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14081 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
10bc17b6
JH
14082 esac
14083 case "$getnetent_r_proto" in
14084 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
61c26d18 14085 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
10bc17b6
JH
14086 esac
14087 case "$getnetent_r_proto" in
14088 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
61c26d18 14089 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
10bc17b6
JH
14090 esac
14091 case "$getnetent_r_proto" in
14092 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
61c26d18 14093 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
10bc17b6
JH
14094 esac
14095 case "$getnetent_r_proto" in
14096 ''|0) try='int getnetent_r(struct netent*, char*, int);'
61c26d18 14097 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
10bc17b6
JH
14098 esac
14099 case "$getnetent_r_proto" in
14100 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
61c26d18 14101 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
10bc17b6
JH
14102 esac
14103 case "$getnetent_r_proto" in
90e831dc 14104 ''|0) d_getnetent_r=undef
10bc17b6 14105 getnetent_r_proto=0
a48ec845 14106 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14107 * ) case "$getnetent_r_proto" in
14108 REENTRANT_PROTO*) ;;
14109 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14110 esac
14111 echo "Prototype: $try" ;;
14112 esac
14113 ;;
c18e646a
JH
14114 *) case "$usethreads" in
14115 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14116 esac
90e831dc
SB
14117 d_getnetent_r=undef
14118 getnetent_r_proto=0
c18e646a 14119 ;;
a48ec845
JH
14120 esac
14121 ;;
10bc17b6
JH
14122*) getnetent_r_proto=0
14123 ;;
14124esac
14125
b4eb6b3d
JH
14126: see if prototypes for various getnetxxx netdb.h functions are available
14127echo " "
14128set d_getnetprotos getnetent $i_netdb netdb.h
14129eval $hasproto
14130
0c0643d0
JH
14131: see if getpagesize exists
14132set getpagesize d_getpagsz
14133eval $inlibc
14134
34f1896b 14135: Optional checks for getprotobyname and getprotobynumber
b4eb6b3d
JH
14136
14137: see if getprotobyname exists
14138set getprotobyname d_getpbyname
14139eval $inlibc
14140
14141: see if getprotobynumber exists
14142set getprotobynumber d_getpbynumber
14143eval $inlibc
14144
14145: see if getprotoent exists
14146set getprotoent d_getpent
14147eval $inlibc
14148
14149: see if getpgid exists
14150set getpgid d_getpgid
14151eval $inlibc
14152
14153: see if getpgrp2 exists
14154set getpgrp2 d_getpgrp2
14155eval $inlibc
14156
14157: see if getppid exists
14158set getppid d_getppid
14159eval $inlibc
14160
14161: see if getpriority exists
14162set getpriority d_getprior
14163eval $inlibc
14164
10bc17b6
JH
14165: see if getprotobyname_r exists
14166set getprotobyname_r d_getprotobyname_r
14167eval $inlibc
14168case "$d_getprotobyname_r" in
14169"$define")
14170 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14171 case "$d_getprotobyname_r_proto:$usethreads" in
14172 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
14173 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14174 eval $hasproto ;;
14175 *) ;;
14176 esac
14177 case "$d_getprotobyname_r_proto" in
14178 define)
10bc17b6
JH
14179 case "$getprotobyname_r_proto" in
14180 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14181 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
10bc17b6
JH
14182 esac
14183 case "$getprotobyname_r_proto" in
14184 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
61c26d18 14185 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
10bc17b6
JH
14186 esac
14187 case "$getprotobyname_r_proto" in
14188 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
61c26d18 14189 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
10bc17b6
JH
14190 esac
14191 case "$getprotobyname_r_proto" in
90e831dc 14192 ''|0) d_getprotobyname_r=undef
10bc17b6 14193 getprotobyname_r_proto=0
a48ec845 14194 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14195 * ) case "$getprotobyname_r_proto" in
14196 REENTRANT_PROTO*) ;;
14197 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14198 esac
14199 echo "Prototype: $try" ;;
14200 esac
14201 ;;
c18e646a
JH
14202 *) case "$usethreads" in
14203 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14204 esac
90e831dc
SB
14205 d_getprotobyname_r=undef
14206 getprotobyname_r_proto=0
c18e646a 14207 ;;
a48ec845
JH
14208 esac
14209 ;;
10bc17b6
JH
14210*) getprotobyname_r_proto=0
14211 ;;
14212esac
14213
14214: see if getprotobynumber_r exists
14215set getprotobynumber_r d_getprotobynumber_r
14216eval $inlibc
14217case "$d_getprotobynumber_r" in
14218"$define")
14219 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14220 case "$d_getprotobynumber_r_proto:$usethreads" in
14221 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
14222 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14223 eval $hasproto ;;
14224 *) ;;
14225 esac
14226 case "$d_getprotobynumber_r_proto" in
14227 define)
10bc17b6
JH
14228 case "$getprotobynumber_r_proto" in
14229 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14230 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
10bc17b6
JH
14231 esac
14232 case "$getprotobynumber_r_proto" in
14233 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
61c26d18 14234 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
10bc17b6
JH
14235 esac
14236 case "$getprotobynumber_r_proto" in
14237 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
61c26d18 14238 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
10bc17b6
JH
14239 esac
14240 case "$getprotobynumber_r_proto" in
90e831dc 14241 ''|0) d_getprotobynumber_r=undef
10bc17b6 14242 getprotobynumber_r_proto=0
a48ec845 14243 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14244 * ) case "$getprotobynumber_r_proto" in
14245 REENTRANT_PROTO*) ;;
14246 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14247 esac
14248 echo "Prototype: $try" ;;
14249 esac
14250 ;;
c18e646a
JH
14251 *) case "$usethreads" in
14252 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14253 esac
90e831dc
SB
14254 d_getprotobynumber_r=undef
14255 getprotobynumber_r_proto=0
c18e646a 14256 ;;
a48ec845
JH
14257 esac
14258 ;;
10bc17b6
JH
14259*) getprotobynumber_r_proto=0
14260 ;;
14261esac
14262
14263: see if getprotoent_r exists
14264set getprotoent_r d_getprotoent_r
14265eval $inlibc
14266case "$d_getprotoent_r" in
14267"$define")
14268 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14269 case "$d_getprotoent_r_proto:$usethreads" in
14270 ":define") d_getprotoent_r_proto=define
a48ec845
JH
14271 set d_getprotoent_r_proto getprotoent_r $hdrs
14272 eval $hasproto ;;
14273 *) ;;
14274 esac
14275 case "$d_getprotoent_r_proto" in
14276 define)
10bc17b6
JH
14277 case "$getprotoent_r_proto" in
14278 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14279 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
10bc17b6
JH
14280 esac
14281 case "$getprotoent_r_proto" in
14282 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
61c26d18 14283 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
10bc17b6
JH
14284 esac
14285 case "$getprotoent_r_proto" in
14286 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
61c26d18 14287 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
10bc17b6
JH
14288 esac
14289 case "$getprotoent_r_proto" in
14290 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
61c26d18 14291 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
10bc17b6
JH
14292 esac
14293 case "$getprotoent_r_proto" in
90e831dc 14294 ''|0) d_getprotoent_r=undef
10bc17b6 14295 getprotoent_r_proto=0
a48ec845 14296 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14297 * ) case "$getprotoent_r_proto" in
14298 REENTRANT_PROTO*) ;;
14299 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14300 esac
14301 echo "Prototype: $try" ;;
14302 esac
14303 ;;
c18e646a
JH
14304 *) case "$usethreads" in
14305 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14306 esac
90e831dc
SB
14307 d_getprotoent_r=undef
14308 getprotoent_r_proto=0
c18e646a 14309 ;;
a48ec845
JH
14310 esac
14311 ;;
10bc17b6
JH
14312*) getprotoent_r_proto=0
14313 ;;
14314esac
14315
b4eb6b3d
JH
14316: see if prototypes for various getprotoxxx netdb.h functions are available
14317echo " "
14318set d_getprotoprotos getprotoent $i_netdb netdb.h
14319eval $hasproto
14320
14321: see if getprpwnam exists
14322set getprpwnam d_getprpwnam
14323eval $inlibc
14324
14325: see if getpwent exists
14326set getpwent d_getpwent
14327eval $inlibc
14328
10bc17b6
JH
14329: see if getpwent_r exists
14330set getpwent_r d_getpwent_r
14331eval $inlibc
14332case "$d_getpwent_r" in
14333"$define")
14334 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14335 case "$d_getpwent_r_proto:$usethreads" in
14336 ":define") d_getpwent_r_proto=define
a48ec845
JH
14337 set d_getpwent_r_proto getpwent_r $hdrs
14338 eval $hasproto ;;
14339 *) ;;
14340 esac
14341 case "$d_getpwent_r_proto" in
14342 define)
10bc17b6
JH
14343 case "$getpwent_r_proto" in
14344 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14345 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
10bc17b6
JH
14346 esac
14347 case "$getpwent_r_proto" in
14348 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
61c26d18 14349 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
10bc17b6
JH
14350 esac
14351 case "$getpwent_r_proto" in
14352 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
61c26d18 14353 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
10bc17b6
JH
14354 esac
14355 case "$getpwent_r_proto" in
14356 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
61c26d18 14357 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
10bc17b6
JH
14358 esac
14359 case "$getpwent_r_proto" in
14360 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
61c26d18 14361 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
10bc17b6
JH
14362 esac
14363 case "$getpwent_r_proto" in
14364 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
61c26d18 14365 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
10bc17b6
JH
14366 esac
14367 case "$getpwent_r_proto" in
90e831dc 14368 ''|0) d_getpwent_r=undef
10bc17b6 14369 getpwent_r_proto=0
a48ec845 14370 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14371 * ) case "$getpwent_r_proto" in
14372 REENTRANT_PROTO*) ;;
14373 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14374 esac
14375 echo "Prototype: $try" ;;
14376 esac
14377 ;;
c18e646a
JH
14378 *) case "$usethreads" in
14379 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14380 esac
90e831dc
SB
14381 d_getpwent_r=undef
14382 getpwent_r_proto=0
c18e646a 14383 ;;
a48ec845
JH
14384 esac
14385 ;;
10bc17b6
JH
14386*) getpwent_r_proto=0
14387 ;;
14388esac
14389
14390: see if getpwnam_r exists
14391set getpwnam_r d_getpwnam_r
14392eval $inlibc
14393case "$d_getpwnam_r" in
14394"$define")
14395 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14396 case "$d_getpwnam_r_proto:$usethreads" in
14397 ":define") d_getpwnam_r_proto=define
a48ec845
JH
14398 set d_getpwnam_r_proto getpwnam_r $hdrs
14399 eval $hasproto ;;
14400 *) ;;
14401 esac
14402 case "$d_getpwnam_r_proto" in
14403 define)
10bc17b6
JH
14404 case "$getpwnam_r_proto" in
14405 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14406 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
10bc17b6
JH
14407 esac
14408 case "$getpwnam_r_proto" in
14409 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
61c26d18 14410 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
10bc17b6
JH
14411 esac
14412 case "$getpwnam_r_proto" in
14413 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
61c26d18 14414 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
10bc17b6
JH
14415 esac
14416 case "$getpwnam_r_proto" in
14417 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
61c26d18 14418 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
10bc17b6
JH
14419 esac
14420 case "$getpwnam_r_proto" in
90e831dc 14421 ''|0) d_getpwnam_r=undef
10bc17b6 14422 getpwnam_r_proto=0
a48ec845 14423 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14424 * ) case "$getpwnam_r_proto" in
14425 REENTRANT_PROTO*) ;;
14426 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14427 esac
14428 echo "Prototype: $try" ;;
14429 esac
14430 ;;
c18e646a
JH
14431 *) case "$usethreads" in
14432 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14433 esac
90e831dc
SB
14434 d_getpwnam_r=undef
14435 getpwnam_r_proto=0
c18e646a 14436 ;;
a48ec845
JH
14437 esac
14438 ;;
10bc17b6
JH
14439*) getpwnam_r_proto=0
14440 ;;
14441esac
14442
14443: see if getpwuid_r exists
14444set getpwuid_r d_getpwuid_r
14445eval $inlibc
14446case "$d_getpwuid_r" in
14447"$define")
14448 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14449 case "$d_getpwuid_r_proto:$usethreads" in
14450 ":define") d_getpwuid_r_proto=define
a48ec845
JH
14451 set d_getpwuid_r_proto getpwuid_r $hdrs
14452 eval $hasproto ;;
14453 *) ;;
14454 esac
14455 case "$d_getpwuid_r_proto" in
14456 define)
10bc17b6
JH
14457 case "$getpwuid_r_proto" in
14458 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14459 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
10bc17b6
JH
14460 esac
14461 case "$getpwuid_r_proto" in
14462 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
61c26d18 14463 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
10bc17b6
JH
14464 esac
14465 case "$getpwuid_r_proto" in
14466 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
61c26d18 14467 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
10bc17b6
JH
14468 esac
14469 case "$getpwuid_r_proto" in
14470 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
61c26d18 14471 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
10bc17b6
JH
14472 esac
14473 case "$getpwuid_r_proto" in
90e831dc 14474 ''|0) d_getpwuid_r=undef
10bc17b6 14475 getpwuid_r_proto=0
a48ec845 14476 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14477 * ) case "$getpwuid_r_proto" in
14478 REENTRANT_PROTO*) ;;
14479 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14480 esac
14481 echo "Prototype: $try" ;;
14482 esac
14483 ;;
c18e646a
JH
14484 *) case "$usethreads" in
14485 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14486 esac
90e831dc
SB
14487 d_getpwuid_r=undef
14488 getpwuid_r_proto=0
c18e646a 14489 ;;
a48ec845
JH
14490 esac
14491 ;;
10bc17b6
JH
14492*) getpwuid_r_proto=0
14493 ;;
14494esac
14495
34f1896b 14496: Optional checks for getsbyname and getsbyport
b4eb6b3d
JH
14497
14498: see if getservbyname exists
14499set getservbyname d_getsbyname
14500eval $inlibc
14501
14502: see if getservbyport exists
14503set getservbyport d_getsbyport
14504eval $inlibc
14505
14506: see if getservent exists
14507set getservent d_getsent
14508eval $inlibc
14509
10bc17b6
JH
14510: see if getservbyname_r exists
14511set getservbyname_r d_getservbyname_r
14512eval $inlibc
14513case "$d_getservbyname_r" in
14514"$define")
14515 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14516 case "$d_getservbyname_r_proto:$usethreads" in
14517 ":define") d_getservbyname_r_proto=define
a48ec845
JH
14518 set d_getservbyname_r_proto getservbyname_r $hdrs
14519 eval $hasproto ;;
14520 *) ;;
14521 esac
14522 case "$d_getservbyname_r_proto" in
14523 define)
10bc17b6
JH
14524 case "$getservbyname_r_proto" in
14525 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
61c26d18 14526 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
10bc17b6
JH
14527 esac
14528 case "$getservbyname_r_proto" in
14529 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
61c26d18 14530 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
10bc17b6
JH
14531 esac
14532 case "$getservbyname_r_proto" in
14533 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
61c26d18 14534 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
10bc17b6
JH
14535 esac
14536 case "$getservbyname_r_proto" in
90e831dc 14537 ''|0) d_getservbyname_r=undef
10bc17b6 14538 getservbyname_r_proto=0
a48ec845 14539 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14540 * ) case "$getservbyname_r_proto" in
14541 REENTRANT_PROTO*) ;;
14542 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14543 esac
14544 echo "Prototype: $try" ;;
14545 esac
14546 ;;
c18e646a
JH
14547 *) case "$usethreads" in
14548 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14549 esac
90e831dc
SB
14550 d_getservbyname_r=undef
14551 getservbyname_r_proto=0
c18e646a 14552 ;;
a48ec845
JH
14553 esac
14554 ;;
10bc17b6
JH
14555*) getservbyname_r_proto=0
14556 ;;
14557esac
14558
14559: see if getservbyport_r exists
14560set getservbyport_r d_getservbyport_r
14561eval $inlibc
14562case "$d_getservbyport_r" in
14563"$define")
14564 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14565 case "$d_getservbyport_r_proto:$usethreads" in
14566 ":define") d_getservbyport_r_proto=define
a48ec845
JH
14567 set d_getservbyport_r_proto getservbyport_r $hdrs
14568 eval $hasproto ;;
14569 *) ;;
14570 esac
14571 case "$d_getservbyport_r_proto" in
14572 define)
10bc17b6
JH
14573 case "$getservbyport_r_proto" in
14574 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
61c26d18 14575 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
10bc17b6
JH
14576 esac
14577 case "$getservbyport_r_proto" in
14578 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
61c26d18 14579 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
10bc17b6
JH
14580 esac
14581 case "$getservbyport_r_proto" in
14582 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
61c26d18 14583 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
10bc17b6
JH
14584 esac
14585 case "$getservbyport_r_proto" in
90e831dc 14586 ''|0) d_getservbyport_r=undef
10bc17b6 14587 getservbyport_r_proto=0
a48ec845 14588 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14589 * ) case "$getservbyport_r_proto" in
14590 REENTRANT_PROTO*) ;;
14591 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14592 esac
14593 echo "Prototype: $try" ;;
14594 esac
14595 ;;
c18e646a
JH
14596 *) case "$usethreads" in
14597 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14598 esac
90e831dc
SB
14599 d_getservbyport_r=undef
14600 getservbyport_r_proto=0
c18e646a 14601 ;;
a48ec845
JH
14602 esac
14603 ;;
10bc17b6
JH
14604*) getservbyport_r_proto=0
14605 ;;
14606esac
14607
14608: see if getservent_r exists
14609set getservent_r d_getservent_r
14610eval $inlibc
14611case "$d_getservent_r" in
14612"$define")
14613 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14614 case "$d_getservent_r_proto:$usethreads" in
14615 ":define") d_getservent_r_proto=define
a48ec845
JH
14616 set d_getservent_r_proto getservent_r $hdrs
14617 eval $hasproto ;;
14618 *) ;;
14619 esac
14620 case "$d_getservent_r_proto" in
14621 define)
10bc17b6
JH
14622 case "$getservent_r_proto" in
14623 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
61c26d18 14624 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
10bc17b6
JH
14625 esac
14626 case "$getservent_r_proto" in
14627 ''|0) try='int getservent_r(struct servent*, char*, int);'
61c26d18 14628 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
10bc17b6
JH
14629 esac
14630 case "$getservent_r_proto" in
14631 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
61c26d18 14632 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
10bc17b6
JH
14633 esac
14634 case "$getservent_r_proto" in
14635 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
61c26d18 14636 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
10bc17b6
JH
14637 esac
14638 case "$getservent_r_proto" in
90e831dc 14639 ''|0) d_getservent_r=undef
10bc17b6 14640 getservent_r_proto=0
a48ec845 14641 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14642 * ) case "$getservent_r_proto" in
14643 REENTRANT_PROTO*) ;;
14644 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14645 esac
14646 echo "Prototype: $try" ;;
14647 esac
14648 ;;
c18e646a
JH
14649 *) case "$usethreads" in
14650 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14651 esac
90e831dc
SB
14652 d_getservent_r=undef
14653 getservent_r_proto=0
c18e646a 14654 ;;
a48ec845
JH
14655 esac
14656 ;;
10bc17b6
JH
14657*) getservent_r_proto=0
14658 ;;
14659esac
14660
b4eb6b3d
JH
14661: see if prototypes for various getservxxx netdb.h functions are available
14662echo " "
14663set d_getservprotos getservent $i_netdb netdb.h
14664eval $hasproto
14665
14666: see if getspnam exists
14667set getspnam d_getspnam
14668eval $inlibc
14669
10bc17b6
JH
14670: see if this is a shadow.h system
14671set shadow.h i_shadow
14672eval $inhdr
14673
14674: see if getspnam_r exists
14675set getspnam_r d_getspnam_r
14676eval $inlibc
14677case "$d_getspnam_r" in
14678"$define")
14679 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
14680 case "$d_getspnam_r_proto:$usethreads" in
14681 ":define") d_getspnam_r_proto=define
a48ec845
JH
14682 set d_getspnam_r_proto getspnam_r $hdrs
14683 eval $hasproto ;;
14684 *) ;;
14685 esac
14686 case "$d_getspnam_r_proto" in
14687 define)
10bc17b6
JH
14688 case "$getspnam_r_proto" in
14689 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
61c26d18 14690 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
10bc17b6
JH
14691 esac
14692 case "$getspnam_r_proto" in
14693 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
61c26d18 14694 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
10bc17b6
JH
14695 esac
14696 case "$getspnam_r_proto" in
90e831dc 14697 ''|0) d_getspnam_r=undef
10bc17b6 14698 getspnam_r_proto=0
a48ec845 14699 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14700 * ) case "$getspnam_r_proto" in
14701 REENTRANT_PROTO*) ;;
14702 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14703 esac
14704 echo "Prototype: $try" ;;
14705 esac
14706 ;;
c18e646a
JH
14707 *) case "$usethreads" in
14708 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14709 esac
90e831dc
SB
14710 d_getspnam_r=undef
14711 getspnam_r_proto=0
c18e646a 14712 ;;
a48ec845
JH
14713 esac
14714 ;;
10bc17b6
JH
14715*) getspnam_r_proto=0
14716 ;;
14717esac
14718
b4eb6b3d
JH
14719: see if gettimeofday or ftime exists
14720set gettimeofday d_gettimeod
14721eval $inlibc
14722case "$d_gettimeod" in
14723"$undef")
14724 set ftime d_ftime
14725 eval $inlibc
14726 ;;
14727*)
14728 val="$undef"; set d_ftime; eval $setvar
14729 ;;
14730esac
14731case "$d_gettimeod$d_ftime" in
14732"$undef$undef")
14733 echo " "
14734 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14735 ;;
14736esac
14737
10bc17b6
JH
14738: see if gmtime_r exists
14739set gmtime_r d_gmtime_r
14740eval $inlibc
14741case "$d_gmtime_r" in
14742"$define")
d63eadf0 14743 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14744 case "$d_gmtime_r_proto:$usethreads" in
14745 ":define") d_gmtime_r_proto=define
a48ec845
JH
14746 set d_gmtime_r_proto gmtime_r $hdrs
14747 eval $hasproto ;;
14748 *) ;;
14749 esac
14750 case "$d_gmtime_r_proto" in
14751 define)
10bc17b6
JH
14752 case "$gmtime_r_proto" in
14753 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
61c26d18 14754 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
10bc17b6
JH
14755 esac
14756 case "$gmtime_r_proto" in
14757 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
61c26d18 14758 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
10bc17b6
JH
14759 esac
14760 case "$gmtime_r_proto" in
90e831dc 14761 ''|0) d_gmtime_r=undef
10bc17b6 14762 gmtime_r_proto=0
a48ec845 14763 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14764 * ) case "$gmtime_r_proto" in
14765 REENTRANT_PROTO*) ;;
14766 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14767 esac
14768 echo "Prototype: $try" ;;
14769 esac
b4eb6b3d 14770 ;;
c18e646a
JH
14771 *) case "$usethreads" in
14772 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14773 esac
90e831dc
SB
14774 d_gmtime_r=undef
14775 gmtime_r_proto=0
c18e646a 14776 ;;
a48ec845
JH
14777 esac
14778 ;;
10bc17b6 14779*) gmtime_r_proto=0
b4eb6b3d
JH
14780 ;;
14781esac
14782
14783: see if hasmntopt exists
14784set hasmntopt d_hasmntopt
14785eval $inlibc
14786
14787: see if this is a netinet/in.h or sys/in.h system
14788set netinet/in.h i_niin sys/in.h i_sysin
14789eval $inhdr
14790
14791: see if arpa/inet.h has to be included
14792set arpa/inet.h i_arpainet
14793eval $inhdr
14794
14795: see if htonl --and friends-- exists
14796val=''
14797set htonl val
14798eval $inlibc
14799
14800: Maybe they are macros.
14801case "$val" in
14802$undef)
14803 $cat >htonl.c <<EOM
14804#include <stdio.h>
14805#include <sys/types.h>
14806#$i_niin I_NETINET_IN
14807#$i_sysin I_SYS_IN
14808#$i_arpainet I_ARPA_INET
14809#ifdef I_NETINET_IN
14810#include <netinet/in.h>
14811#endif
14812#ifdef I_SYS_IN
14813#include <sys/in.h>
14814#endif
14815#ifdef I_ARPA_INET
14816#include <arpa/inet.h>
14817#endif
14818#ifdef htonl
14819printf("Defined as a macro.");
14820#endif
14821EOM
14822 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14823 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14824 val="$define"
14825 echo "But it seems to be defined as a macro." >&4
14826 fi
14827 $rm -f htonl.?
14828 ;;
14829esac
14830set d_htonl
14831eval $setvar
14832
36adc09b
JH
14833: see if ilogbl exists
14834set ilogbl d_ilogbl
14835eval $inlibc
14836
b4eb6b3d
JH
14837: index or strchr
14838echo " "
14839if set index val -f; eval $csym; $val; then
14840 if set strchr val -f d_strchr; eval $csym; $val; then
14841 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14842 val="$define"
14843 vali="$undef"
14844 echo "strchr() found." >&4
14845 else
14846 val="$undef"
14847 vali="$define"
14848 echo "index() found." >&4
14849 fi
14850 else
14851 val="$undef"
14852 vali="$define"
8dfa8df9
JH
14853 echo "index() found." >&4
14854 fi
b4eb6b3d 14855else
8dfa8df9
JH
14856 if set strchr val -f d_strchr; eval $csym; $val; then
14857 val="$define"
14858 vali="$undef"
14859 echo "strchr() found." >&4
14860 else
14861 echo "No index() or strchr() found!" >&4
14862 val="$undef"
14863 vali="$undef"
14864 fi
b4eb6b3d 14865fi
8dfa8df9
JH
14866set d_strchr; eval $setvar
14867val="$vali"
14868set d_index; eval $setvar
14869
14870: check whether inet_aton exists
14871set inet_aton d_inetaton
14872eval $inlibc
b4eb6b3d
JH
14873
14874: Look for isascii
14875echo " "
36adc09b 14876$cat >isascii.c <<EOCP
b4eb6b3d
JH
14877#include <stdio.h>
14878#include <ctype.h>
55954f19
JH
14879#$i_stdlib I_STDLIB
14880#ifdef I_STDLIB
14881#include <stdlib.h>
14882#endif
b4eb6b3d
JH
14883int main() {
14884 int c = 'A';
14885 if (isascii(c))
14886 exit(0);
14887 else
14888 exit(1);
14889}
14890EOCP
14891set isascii
14892if eval $compile; then
14893 echo "isascii() found." >&4
14894 val="$define"
14895else
14896 echo "isascii() NOT found." >&4
14897 val="$undef"
14898fi
14899set d_isascii
14900eval $setvar
14901$rm -f isascii*
14902
758a5d79
JH
14903: see if isfinite exists
14904set isfinite d_isfinite
14905eval $inlibc
14906
14907: see if isinf exists
14908set isinf d_isinf
14909eval $inlibc
14910
b4eb6b3d
JH
14911: see if isnan exists
14912set isnan d_isnan
14913eval $inlibc
14914
14915: see if isnanl exists
14916set isnanl d_isnanl
14917eval $inlibc
14918
14919: see if killpg exists
14920set killpg d_killpg
14921eval $inlibc
14922
14923: see if lchown exists
14924echo " "
14925$cat > try.c <<'EOCP'
14926/* System header to define __stub macros and hopefully few prototypes,
14927 which can conflict with char lchown(); below. */
14928#include <assert.h>
14929/* Override any gcc2 internal prototype to avoid an error. */
14930/* We use char because int might match the return type of a gcc2
14931 builtin and then its argument prototype would still apply. */
14932char lchown();
14933int main() {
14934 /* The GNU C library defines this for functions which it implements
14935 to always fail with ENOSYS. Some functions are actually named
14936 something starting with __ and the normal name is an alias. */
14937#if defined (__stub_lchown) || defined (__stub___lchown)
14938choke me
14939#else
14940lchown();
14941#endif
14942; return 0; }
14943EOCP
14944set try
14945if eval $compile; then
14946 $echo "lchown() found." >&4
14947 val="$define"
14948else
14949 $echo "lchown() NOT found." >&4
14950 val="$undef"
14951fi
14952set d_lchown
14953eval $setvar
14954
14955: See if number of significant digits in a double precision number is known
14956echo " "
14957$cat >ldbl_dig.c <<EOM
14958#$i_limits I_LIMITS
14959#$i_float I_FLOAT
14960#ifdef I_LIMITS
14961#include <limits.h>
14962#endif
14963#ifdef I_FLOAT
14964#include <float.h>
14965#endif
14966#ifdef LDBL_DIG
14967printf("Contains LDBL_DIG");
14968#endif
14969EOM
14970$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14971if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14972 echo "LDBL_DIG found." >&4
14973 val="$define"
14974else
14975 echo "LDBL_DIG NOT found." >&4
14976 val="$undef"
14977fi
14978$rm -f ldbl_dig.?
14979set d_ldbl_dig
14980eval $setvar
14981
0a0abfba
MB
14982: see if this is a math.h system
14983set math.h i_math
14984eval $inhdr
14985
613d6c3e 14986: check to see if math.h defines _LIB_VERSION
0a0abfba
MB
14987d_libm_lib_version="$undef"
14988case $i_math in
14989 $define)
0a0abfba
MB
14990 echo " "
14991 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14992 $cat >try.c <<EOCP
14993#include <unistd.h>
14994#include <math.h>
14995int main (int argc, char *argv[])
14996{
14997 printf ("%d\n", _LIB_VERSION);
14998 return (0);
14999 } /* main */
15000EOCP
15001 set try
15002 if eval $compile; then
15003 foo=`$run ./try`
15004 echo "Yes, it does ($foo)" >&4
15005 d_libm_lib_version="$define"
15006 else
4dd8f9b3 15007 echo "No, it does not (probably harmless)" >&4
0a0abfba 15008 fi
5b813a60 15009 $rm_try
0a0abfba
MB
15010 ;;
15011
15012 esac
15013
b4eb6b3d
JH
15014: see if link exists
15015set link d_link
15016eval $inlibc
15017
10bc17b6
JH
15018: see if localtime_r exists
15019set localtime_r d_localtime_r
15020eval $inlibc
15021case "$d_localtime_r" in
15022"$define")
d63eadf0 15023 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
15024 case "$d_localtime_r_proto:$usethreads" in
15025 ":define") d_localtime_r_proto=define
a48ec845
JH
15026 set d_localtime_r_proto localtime_r $hdrs
15027 eval $hasproto ;;
15028 *) ;;
15029 esac
15030 case "$d_localtime_r_proto" in
15031 define)
10bc17b6
JH
15032 case "$localtime_r_proto" in
15033 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
61c26d18 15034 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
10bc17b6
JH
15035 esac
15036 case "$localtime_r_proto" in
15037 ''|0) try='int localtime_r(const time_t*, struct tm*);'
61c26d18 15038 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
10bc17b6
JH
15039 esac
15040 case "$localtime_r_proto" in
90e831dc 15041 ''|0) d_localtime_r=undef
10bc17b6 15042 localtime_r_proto=0
a48ec845 15043 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15044 * ) case "$localtime_r_proto" in
15045 REENTRANT_PROTO*) ;;
15046 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15047 esac
15048 echo "Prototype: $try" ;;
15049 esac
15050 ;;
c18e646a
JH
15051 *) case "$usethreads" in
15052 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15053 esac
90e831dc
SB
15054 d_localtime_r=undef
15055 localtime_r_proto=0
c18e646a 15056 ;;
a48ec845
JH
15057 esac
15058 ;;
10bc17b6
JH
15059*) localtime_r_proto=0
15060 ;;
15061esac
15062
8572b25d
BH
15063: see if localtime_r calls tzset
15064case "$localtime_r_proto" in
15065REENTRANT_PROTO*)
15066 $cat >try.c <<EOCP
15067/* Does our libc's localtime_r call tzset ?
15068 * return 0 if so, 1 otherwise.
15069 */
61c26d18
MHM
15070#$i_systypes I_SYS_TYPES
15071#$i_unistd I_UNISTD
15072#$i_time I_TIME
15073#$i_stdlib I_STDLIB
15074#$i_string I_STRING
15075#$i_malloc I_MALLOC
15076#ifdef I_SYS_TYPES
15077# include <sys/types.h>
15078#endif
15079#ifdef I_UNISTD
15080# include <unistd.h>
15081#endif
15082#ifdef I_TIME
15083# include <time.h>
15084#endif
15085#ifdef I_STDLIB
15086#include <stdlib.h>
15087#endif
15088#ifdef I_STRING
15089# include <string.h>
15090#else
15091# include <strings.h>
15092#endif
15093#ifdef I_MALLOC
15094# include <malloc.h>
15095#endif
8572b25d
BH
15096int main()
15097{
15098 time_t t = time(0L);
15099 char w_tz[]="TZ" "=GMT+5",
15100 e_tz[]="TZ" "=GMT-5",
15101 *tz_e = (char*)malloc(16),
15102 *tz_w = (char*)malloc(16);
15103 struct tm tm_e, tm_w;
15104 memset(&tm_e,'\0',sizeof(struct tm));
15105 memset(&tm_w,'\0',sizeof(struct tm));
15106 strcpy(tz_e,e_tz);
15107 strcpy(tz_w,w_tz);
15108
15109 putenv(tz_e);
15110 localtime_r(&t, &tm_e);
15111
15112 putenv(tz_w);
15113 localtime_r(&t, &tm_w);
15114
15115 if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15116 return 1;
15117 return 0;
15118}
15119EOCP
15120 set try
15121 if eval $compile; then
43dddb59 15122 if $run ./try; then
8572b25d
BH
15123 d_localtime_r_needs_tzset=undef;
15124 else
15125 d_localtime_r_needs_tzset=define;
15126 fi;
15127 else
15128 d_localtime_r_needs_tzset=undef;
15129 fi;
15130 ;;
15131 *)
15132 d_localtime_r_needs_tzset=undef;
15133 ;;
15134esac
5b813a60 15135$rm_try
8572b25d 15136
b4eb6b3d
JH
15137: see if localeconv exists
15138set localeconv d_locconv
15139eval $inlibc
15140
15141: see if lockf exists
15142set lockf d_lockf
15143eval $inlibc
15144
b4eb6b3d
JH
15145: see if prototype for lseek is available
15146echo " "
4786929f 15147set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
15148eval $hasproto
15149
15150: see if lstat exists
15151set lstat d_lstat
15152eval $inlibc
15153
15154: see if madvise exists
15155set madvise d_madvise
15156eval $inlibc
15157
7dd121ae
MB
15158: see if malloc_size exists
15159set malloc_size d_malloc_size
15160eval $inlibc
15161
15162: see if malloc_size_good exists
15163set malloc_good_size d_malloc_good_size
15164eval $inlibc
15165
b4eb6b3d
JH
15166: see if mblen exists
15167set mblen d_mblen
15168eval $inlibc
15169
15170: see if mbstowcs exists
15171set mbstowcs d_mbstowcs
15172eval $inlibc
15173
15174: see if mbtowc exists
15175set mbtowc d_mbtowc
15176eval $inlibc
15177
15178: see if memchr exists
15179set memchr d_memchr
15180eval $inlibc
15181
15182: see if memcmp exists
15183set memcmp d_memcmp
15184eval $inlibc
15185
15186: see if memcpy exists
15187set memcpy d_memcpy
15188eval $inlibc
15189
15190: see if memmove exists
15191set memmove d_memmove
15192eval $inlibc
15193
15194: see if memset exists
15195set memset d_memset
15196eval $inlibc
15197
15198: see if mkdir exists
15199set mkdir d_mkdir
15200eval $inlibc
15201
15202: see if mkdtemp exists
15203set mkdtemp d_mkdtemp
15204eval $inlibc
15205
15206: see if mkfifo exists
15207set mkfifo d_mkfifo
15208eval $inlibc
15209
15210: see if mkstemp exists
15211set mkstemp d_mkstemp
15212eval $inlibc
15213
15214: see if mkstemps exists
15215set mkstemps d_mkstemps
15216eval $inlibc
15217
15218: see if mktime exists
15219set mktime d_mktime
15220eval $inlibc
15221
15222: see if this is a sys/mman.h system
15223set sys/mman.h i_sysmman
15224eval $inhdr
15225
15226: see if mmap exists
15227set mmap d_mmap
15228eval $inlibc
15229: see what shmat returns
15230: default to something harmless
15231mmaptype='void *'
15232case "$i_sysmman$d_mmap" in
15233"$define$define")
15234 $cat >mmap.c <<'END'
15235#include <sys/mman.h>
15236void *mmap();
15237END
15238 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15239 mmaptype='void *'
15240 else
15241 mmaptype='caddr_t'
15242 fi
15243 echo "and it returns ($mmaptype)." >&4
15244 ;;
15245esac
15246
15247
15248
89ce900e
JH
15249: see if sqrtl exists
15250set sqrtl d_sqrtl
15251eval $inlibc
15252
af1ff193
JH
15253: see if scalbnl exists
15254set scalbnl d_scalbnl
15255eval $inlibc
15256
89ce900e
JH
15257: see if modfl exists
15258set modfl d_modfl
15259eval $inlibc
15260
15261: see if prototype for modfl is available
15262echo " "
3a794506 15263set d_modflproto modfl $i_math math.h
89ce900e
JH
15264eval $hasproto
15265
15266d_modfl_pow32_bug="$undef"
15267
15268case "$d_longdbl$d_modfl" in
15269$define$define)
15270 $cat <<EOM
15271Checking to see whether your modfl() is okay for large values...
15272EOM
15273$cat >try.c <<EOCP
5b813a60 15274#include <math.h>
89ce900e
JH
15275#include <stdio.h>
15276EOCP
15277if $test "X$d_modflproto" != "X$define"; then
15278 $cat >>try.c <<EOCP
5b813a60 15279/* Sigh. many current glibcs provide the function, but do not prototype it. */
89ce900e
JH
15280long double modfl (long double, long double *);
15281EOCP
15282fi
15283$cat >>try.c <<EOCP
15284int main() {
15285 long double nv = 4294967303.15;
15286 long double v, w;
5b813a60 15287 v = modfl(nv, &w);
89ce900e
JH
15288#ifdef __GLIBC__
15289 printf("glibc");
15290#endif
15291 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15292 return 0;
15293}
15294EOCP
15295 case "$osname:$gccversion" in
15296 aix:) saveccflags="$ccflags"
15297 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15298 esac
15299 set try
15300 if eval $compile; then
15301 foo=`$run ./try`
15302 case "$foo" in
15303 *" 4294967303.150000 1.150000 4294967302.000000")
15304 echo >&4 "Your modfl() is broken for large values."
15305 d_modfl_pow32_bug="$define"
15306 case "$foo" in
15307 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15308 ;;
15309 esac
15310 ;;
15311 *" 4294967303.150000 0.150000 4294967303.000000")
15312 echo >&4 "Your modfl() seems okay for large values."
15313 ;;
15314 *) echo >&4 "I don't understand your modfl() at all."
15315 d_modfl="$undef"
15316 ;;
15317 esac
5b813a60 15318 $rm_try
89ce900e
JH
15319 else
15320 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15321 d_modfl="$undef"
15322 fi
15323 case "$osname:$gccversion" in
15324 aix:) ccflags="$saveccflags" ;; # restore
15325 esac
15326 ;;
15327esac
15328
15329if $test "$uselongdouble" = "$define"; then
af1ff193
JH
15330 message=""
15331 if $test "$d_sqrtl" != "$define"; then
15332 message="$message sqrtl"
15333 fi
15334 if $test "$d_modfl" != "$define"; then
89ce900e
JH
15335 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15336 echo "You have both aintl and copysignl, so I can emulate modfl."
15337 else
af1ff193 15338 message="$message modfl"
89ce900e 15339 fi
af1ff193
JH
15340 fi
15341 if $test "$d_frexpl" != "$define"; then
15342 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15343 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15344 else
15345 message="$message frexpl"
15346 fi
15347 fi
89ce900e 15348
af1ff193 15349 if $test "$message" != ""; then
89ce900e
JH
15350 $cat <<EOM >&4
15351
15352*** You requested the use of long doubles but you do not seem to have
af1ff193
JH
15353*** the following mathematical functions needed for long double support:
15354*** $message
fe63a0b4
JH
15355*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15356*** Cannot continue, aborting.
89ce900e
JH
15357
15358EOM
15359
fe63a0b4 15360 exit 1
89ce900e
JH
15361 fi
15362fi
15363
b4eb6b3d
JH
15364: see if mprotect exists
15365set mprotect d_mprotect
15366eval $inlibc
15367
15368: see if msgctl exists
15369set msgctl d_msgctl
15370eval $inlibc
15371
15372: see if msgget exists
15373set msgget d_msgget
15374eval $inlibc
15375
15376: see if msgsnd exists
15377set msgsnd d_msgsnd
15378eval $inlibc
15379
15380: see if msgrcv exists
15381set msgrcv d_msgrcv
15382eval $inlibc
15383
15384: see how much of the 'msg*(2)' library is present.
15385h_msg=true
15386echo " "
15387case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15388*"$undef"*) h_msg=false;;
15389esac
15390case "$osname" in
15391freebsd)
15392 case "`ipcs 2>&1`" in
15393 "SVID messages"*"not configured"*)
15394 echo "Your $osname does not have the msg*(2) configured." >&4
15395 h_msg=false
15396 val="$undef"
15397 set msgctl d_msgctl
15398 eval $setvar
15399 set msgget d_msgget
15400 eval $setvar
15401 set msgsnd d_msgsnd
15402 eval $setvar
15403 set msgrcv d_msgrcv
15404 eval $setvar
15405 ;;
15406 esac
15407 ;;
15408esac
15409: we could also check for sys/ipc.h ...
15410if $h_msg && $test `./findhdr sys/msg.h`; then
15411 echo "You have the full msg*(2) library." >&4
15412 val="$define"
15413else
15414 echo "You don't have the full msg*(2) library." >&4
15415 val="$undef"
15416fi
15417set d_msg
15418eval $setvar
15419
34f1896b 15420: Check for msghdr_s
4e0554ec
JH
15421echo " "
15422echo "Checking to see if your system supports struct msghdr..." >&4
15423set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15424eval $hasstruct
15425case "$d_msghdr_s" in
15426"$define") echo "Yes, it does." ;;
15427*) echo "No, it doesn't." ;;
15428esac
15429
15430
b4eb6b3d
JH
15431: see if msync exists
15432set msync d_msync
15433eval $inlibc
15434
15435: see if munmap exists
15436set munmap d_munmap
15437eval $inlibc
15438
15439: see if nice exists
15440set nice d_nice
15441eval $inlibc
15442
2765b840
JH
15443: see if this is a langinfo.h system
15444set langinfo.h i_langinfo
15445eval $inhdr
15446
15447: see if nl_langinfo exists
15448set nl_langinfo d_nl_langinfo
15449eval $inlibc
15450
1d1be0dc
NC
15451: check for volatile keyword
15452echo " "
15453echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15454$cat >try.c <<'EOCP'
76f47787 15455int main()
1d1be0dc
NC
15456{
15457 typedef struct _goo_struct goo_struct;
15458 goo_struct * volatile goo = ((goo_struct *)0);
15459 struct _goo_struct {
15460 long long_int;
15461 int reg_int;
15462 char char_var;
15463 };
15464 typedef unsigned short foo_t;
15465 char *volatile foo;
15466 volatile int bar;
15467 volatile foo_t blech;
15468 foo = foo;
15469}
15470EOCP
15471if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15472 val="$define"
15473 echo "Yup, it does."
15474else
15475 val="$undef"
15476 echo "Nope, it doesn't."
15477fi
15478set d_volatile
15479eval $setvar
5b813a60 15480$rm_try
1d1be0dc 15481
613d6c3e 15482: Check basic sizes
b4eb6b3d
JH
15483echo " "
15484$echo "Choosing the C types to be used for Perl's internal types..." >&4
15485
15486case "$use64bitint:$d_quad:$quadtype" in
15487define:define:?*)
15488 ivtype="$quadtype"
15489 uvtype="$uquadtype"
15490 ivsize=8
15491 uvsize=8
15492 ;;
15493*) ivtype="long"
15494 uvtype="unsigned long"
15495 ivsize=$longsize
15496 uvsize=$longsize
15497 ;;
15498esac
15499
15500case "$uselongdouble:$d_longdbl" in
15501define:define)
15502 nvtype="long double"
15503 nvsize=$longdblsize
15504 ;;
15505*) nvtype=double
15506 nvsize=$doublesize
15507 ;;
15508esac
15509
15510$echo "(IV will be "$ivtype", $ivsize bytes)"
15511$echo "(UV will be "$uvtype", $uvsize bytes)"
15512$echo "(NV will be "$nvtype", $nvsize bytes)"
15513
15514$cat >try.c <<EOCP
15515#$i_inttypes I_INTTYPES
15516#ifdef I_INTTYPES
15517#include <inttypes.h>
15518#endif
15519#include <stdio.h>
15520int main() {
15521#ifdef INT8
15522 int8_t i = INT8_MAX;
15523 uint8_t u = UINT8_MAX;
15524 printf("int8_t\n");
15525#endif
15526#ifdef INT16
15527 int16_t i = INT16_MAX;
15528 uint16_t i = UINT16_MAX;
15529 printf("int16_t\n");
15530#endif
15531#ifdef INT32
15532 int32_t i = INT32_MAX;
15533 uint32_t u = UINT32_MAX;
15534 printf("int32_t\n");
15535#endif
15536}
15537EOCP
15538
13187456 15539i8type="signed char"
0ab0821a
MB
15540u8type="unsigned char"
15541i8size=1
15542u8size=1
b4eb6b3d
JH
15543
15544case "$i16type" in
15545'') case "$shortsize" in
15546 2) i16type=short
15547 u16type="unsigned short"
15548 i16size=$shortsize
15549 u16size=$shortsize
15550 ;;
15551 esac
15552 ;;
15553esac
15554case "$i16type" in
15555'') set try -DINT16
15556 if eval $compile; then
5440bc8e 15557 case "`$run ./try`" in
b4eb6b3d
JH
15558 int16_t)
15559 i16type=int16_t
15560 u16type=uint16_t
15561 i16size=2
15562 u16size=2
15563 ;;
15564 esac
15565 fi
15566 ;;
15567esac
15568case "$i16type" in
15569'') if $test $shortsize -ge 2; then
15570 i16type=short
15571 u16type="unsigned short"
15572 i16size=$shortsize
15573 u16size=$shortsize
15574 fi
15575 ;;
15576esac
15577
15578case "$i32type" in
15579'') case "$longsize" in
15580 4) i32type=long
15581 u32type="unsigned long"
15582 i32size=$longsize
15583 u32size=$longsize
15584 ;;
15585 *) case "$intsize" in
15586 4) i32type=int
15587 u32type="unsigned int"
15588 i32size=$intsize
15589 u32size=$intsize
15590 ;;
15591 esac
15592 ;;
15593 esac
15594 ;;
15595esac
15596case "$i32type" in
15597'') set try -DINT32
15598 if eval $compile; then
5440bc8e 15599 case "`$run ./try`" in
b4eb6b3d
JH
15600 int32_t)
15601 i32type=int32_t
15602 u32type=uint32_t
15603 i32size=4
15604 u32size=4
15605 ;;
15606 esac
15607 fi
15608 ;;
15609esac
15610case "$i32type" in
15611'') if $test $intsize -ge 4; then
15612 i32type=int
15613 u32type="unsigned int"
15614 i32size=$intsize
15615 u32size=$intsize
15616 fi
15617 ;;
15618esac
15619
15620case "$i64type" in
15621'') case "$d_quad:$quadtype" in
15622 define:?*)
15623 i64type="$quadtype"
15624 u64type="$uquadtype"
15625 i64size=8
15626 u64size=8
15627 ;;
15628 esac
15629 ;;
15630esac
15631
1d1be0dc
NC
15632$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15633: volatile so that the compiler has to store it out to memory.
15634if test X"$d_volatile" = X"$define"; then
15635 volatile=volatile
15636fi
b4eb6b3d
JH
15637$cat <<EOP >try.c
15638#include <stdio.h>
55954f19
JH
15639#$i_stdlib I_STDLIB
15640#ifdef I_STDLIB
15641#include <stdlib.h>
15642#endif
1d1be0dc
NC
15643#include <sys/types.h>
15644#include <signal.h>
15645#ifdef SIGFPE
15646$volatile int bletched = 0;
7090f861 15647$signal_t blech(int s) { bletched = 1; }
1d1be0dc 15648#endif
b4eb6b3d
JH
15649int main() {
15650 $uvtype u = 0;
1d1be0dc 15651 $nvtype d;
b4eb6b3d
JH
15652 int n = 8 * $uvsize;
15653 int i;
1d1be0dc
NC
15654#ifdef SIGFPE
15655 signal(SIGFPE, blech);
15656#endif
15657
b4eb6b3d
JH
15658 for (i = 0; i < n; i++) {
15659 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
15660 d = ($nvtype)u;
15661 if (($uvtype)d != u)
b4eb6b3d 15662 break;
1d1be0dc
NC
15663 if (d <= 0)
15664 break;
15665 d = ($nvtype)(u - 1);
15666 if (($uvtype)d != (u - 1))
15667 break;
15668#ifdef SIGFPE
22676560 15669 if (bletched)
1d1be0dc
NC
15670 break;
15671#endif
b4eb6b3d 15672 }
efd1522b 15673 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
15674 exit(0);
15675}
15676EOP
1d1be0dc
NC
15677set try
15678
15679d_nv_preserves_uv="$undef"
15680if eval $compile; then
53133ed1 15681 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 15682fi
53133ed1 15683case "$nv_preserves_uv_bits" in
5b813a60 15684\-[1-9]*)
53133ed1
NC
15685 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15686 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 15687 d_nv_preserves_uv="$define"
b4eb6b3d 15688 ;;
53133ed1 15689[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
15690 d_nv_preserves_uv="$undef" ;;
15691*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
d6cc064f 15692 nv_preserves_uv_bits="0" ;;
b4eb6b3d 15693esac
5b813a60 15694$rm_try
1d1be0dc 15695
b68c599a
NC
15696$echo "Checking to find the largest integer value your NVs can hold..." >&4
15697: volatile so that the compiler has to store it out to memory.
15698if test X"$d_volatile" = X"$define"; then
15699 volatile=volatile
15700fi
15701$cat <<EOP >try.c
15702#include <stdio.h>
15703
15704typedef $nvtype NV;
15705
15706int
15707main() {
15708 NV value = 2;
15709 int count = 1;
15710
15711 while(count < 256) {
15712 $volatile NV up = value + 1.0;
15713 $volatile NV negated = -value;
15714 $volatile NV down = negated - 1.0;
15715 $volatile NV got_up = up - value;
15716 int up_good = got_up == 1.0;
15717 int got_down = down - negated;
15718 int down_good = got_down == -1.0;
15719
15720 if (down_good != up_good) {
15721 fprintf(stderr,
15722 "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15723 up_good, (double) got_up, down_good, (double) got_down,
15724 count, (double) value);
15725 return 1;
15726 }
15727 if (!up_good) {
15728 while (1) {
15729 if (count > 8) {
15730 count -= 8;
15731 fputs("256.0", stdout);
15732 } else {
15733 count--;
15734 fputs("2.0", stdout);
15735 }
15736 if (!count) {
15737 puts("");
15738 return 0;
15739 }
15740 fputs("*", stdout);
15741 }
15742 }
15743 value *= 2;
15744 ++count;
15745 }
15746 fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15747 count, (double) value);
15748 return 1;
15749}
15750EOP
15751set try
15752
15753nv_overflows_integers_at='0'
15754if eval $compile; then
15755 xxx="`$run ./try`"
15756 case "$?" in
15757 0)
15758 case "$xxx" in
15759 2*) cat >&4 <<EOM
15760The largest integer your NVs can preserve is equal to $xxx
15761EOM
15762 nv_overflows_integers_at="$xxx"
15763 ;;
15764 *) cat >&4 <<EOM
15765Cannot determine the largest integer value your NVs can hold, unexpected output
15766'$xxx'
15767EOM
15768 ;;
15769 esac
15770 ;;
15771 *) cat >&4 <<EOM
15772Cannot determine the largest integer value your NVs can hold
15773EOM
15774 ;;
15775 esac
15776fi
15777$rm_try
15778
f607920a
CB
15779$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15780: volatile so that the compiler has to store it out to memory.
15781if test X"$d_volatile" = X"$define"; then
15782 volatile=volatile
15783fi
15784$cat <<EOP >try.c
15785#include <stdio.h>
15786#$i_stdlib I_STDLIB
15787#ifdef I_STDLIB
15788#include <stdlib.h>
15789#endif
15790#$i_string I_STRING
15791#ifdef I_STRING
15792# include <string.h>
15793#else
15794# include <strings.h>
15795#endif
15796#include <sys/types.h>
15797#include <signal.h>
15798#ifdef SIGFPE
15799$volatile int bletched = 0;
7090f861 15800$signal_t blech(int s) { bletched = 1; }
f607920a
CB
15801#endif
15802
15803int checkit($nvtype d, char *where) {
15804 unsigned char *p = (char *)&d;
15805 unsigned char *end = p + sizeof(d);
15806 int fail = 0;
15807
15808 while (p < end)
15809 fail += *p++;
15810
15811 if (!fail)
17f6277d 15812 return 0;
f607920a
CB
15813
15814 p = (char *)&d;
15815 printf("No - %s: 0x", where);
15816 while (p < end)
15817 printf ("%02X", *p++);
15818 printf("\n");
15819 return 1;
15820}
15821
15822int main(int argc, char **argv) {
15823 $nvtype d = 0.0;
15824 int fail = 0;
15825 fail += checkit(d, "0.0");
15826
15827 /* The compiler shouldn't be assuming that bletched is 0 */
15828 d = bletched;
15829
15830 fail += checkit(d, "bleched");
15831
15832#ifdef SIGFPE
15833 signal(SIGFPE, blech);
15834#endif
15835
15836 /* Paranoia - the compiler should have no way of knowing that ANSI says
15837 that argv[argc] will always be NULL. Actually, if it did assume this it
15838 would be buggy, as this is C and main() can be called from elsewhere in
15839 the program. */
15840 d = argv[argc] ? 1 : 0;
15841
15842 if (d) {
15843 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15844 }
15845
15846 fail += checkit(d, "ternary");
15847
15848 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15849
15850 if (d != 0.0) {
15851 printf("No - memset doesn't give 0.0\n");
15852 /* This might just blow up: */
15853 printf("(gives %g)\n", d);
15854 return 1;
15855 }
5b813a60 15856
f607920a
CB
15857#ifdef SIGFPE
15858 if (bletched) {
15859 printf("No - something bleched\n");
15860 return 1;
15861 }
15862#endif
15863 if (fail) {
15864 printf("No - %d fail(s)\n", fail);
15865 return 1;
15866 }
15867 printf("Yes\n");
15868 return 0;
15869}
15870EOP
15871set try
15872
15873d_nv_zero_is_allbits_zero="$undef"
15874if eval $compile; then
15875 xxx="`$run ./try`"
15876 case "$?" in
15877 0)
15878 case "$xxx" in
15879 Yes) cat >&4 <<EOM
158800.0 is represented as all bits zero in memory
15881EOM
15882 d_nv_zero_is_allbits_zero="$define"
15883 ;;
15884 *) cat >&4 <<EOM
158850.0 is not represented as all bits zero in memory
15886EOM
15887 d_nv_zero_is_allbits_zero="$undef"
15888 ;;
15889 esac
15890 ;;
15891 *) cat >&4 <<EOM
158920.0 is not represented as all bits zero in memory
15893EOM
15894 d_nv_zero_is_allbits_zero="$undef"
15895 ;;
15896 esac
15897fi
5b813a60 15898$rm_try
b4eb6b3d
JH
15899
15900: check for off64_t
15901echo " "
15902echo "Checking to see if you have off64_t..." >&4
15903$cat >try.c <<EOCP
15904#include <sys/types.h>
15905#include <unistd.h>
15906int main() { off64_t x = 7; }
15907EOCP
15908set try
15909if eval $compile; then
15910 val="$define"
15911 echo "You have off64_t."
15912else
15913 val="$undef"
15914 echo "You do not have off64_t."
15915 case "$lseeksize" in
15916 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15917 esac
15918fi
5b813a60 15919$rm_try
b4eb6b3d
JH
15920set d_off64_t
15921eval $setvar
15922
b4eb6b3d
JH
15923: how to create joinable pthreads
15924if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15925 echo " "
5b813a60 15926 echo "Checking what constant to use for creating joinable pthreads..." >&4
b4eb6b3d
JH
15927 $cat >try.c <<'EOCP'
15928#include <pthread.h>
15929int main() {
15930 int detachstate = JOINABLE;
15931}
15932EOCP
15933 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15934 if eval $compile; then
15935 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15936 val="$undef" # Yes, undef.
15937 set d_old_pthread_create_joinable
15938 eval $setvar
15939 val=""
15940 set old_pthread_create_joinable
15941 eval $setvar
15942 else
15943 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15944 if eval $compile; then
15945 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15946 val="$define"
15947 set d_old_pthread_create_joinable
15948 eval $setvar
15949 val=PTHREAD_CREATE_UNDETACHED
15950 set old_pthread_create_joinable
15951 eval $setvar
5b813a60 15952 else
b4eb6b3d
JH
15953 set try -DJOINABLE=__UNDETACHED
15954 if eval $compile; then
15955 echo "You seem to use __UNDETACHED." >&4
15956 val="$define"
15957 set d_old_pthread_create_joinable
15958 eval $setvar
15959 val=__UNDETACHED
15960 set old_pthread_create_joinable
15961 eval $setvar
15962 else
15963 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
15964 val="$define"
15965 set d_old_pthread_create_joinable
15966 eval $setvar
15967 val=0
15968 set old_pthread_create_joinable
15969 eval $setvar
15970 fi
15971 fi
15972 fi
5b813a60 15973 $rm_try
b4eb6b3d
JH
15974else
15975 d_old_pthread_create_joinable="$undef"
15976 old_pthread_create_joinable=""
15977fi
15978
15979: see if pause exists
15980set pause d_pause
15981eval $inlibc
15982
b4eb6b3d
JH
15983: see if poll exists
15984set poll d_poll
15985eval $inlibc
15986
c7aff470
NIS
15987: see if readlink exists
15988set readlink d_readlink
15989eval $inlibc
15990
613d6c3e 15991: Check if exe is symlink to abs path of executing program
c7aff470 15992echo " "
f24dbf84 15993procselfexe=''
c7aff470 15994val="$undef"
a33c94aa
JH
15995case "$d_readlink" in
15996"$define")
c7aff470
NIS
15997 if $issymlink /proc/self/exe ; then
15998 $ls -l /proc/self/exe > reflect
51660ed5 15999 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 16000 echo "You have Linux-like /proc/self/exe."
92236451 16001 procselfexe='"/proc/self/exe"'
f24dbf84 16002 val="$define"
f24dbf84
JH
16003 fi
16004 fi
16005 if $issymlink /proc/curproc/file ; then
16006 $ls -l /proc/curproc/file > reflect
16007 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16008 echo "You have BSD-like /proc/curproc/file."
92236451 16009 procselfexe='"/proc/curproc/file"'
f24dbf84 16010 val="$define"
c7aff470 16011 fi
c7aff470 16012 fi
a33c94aa
JH
16013 ;;
16014esac
428dc699 16015$rm -f reflect
c7aff470
NIS
16016set d_procselfexe
16017eval $setvar
16018
233e16ce
MB
16019: backward compatibility for d_hvfork
16020if test X$d_hvfork != X; then
16021 d_vfork="$d_hvfork"
16022 d_hvfork=''
16023fi
16024: see if there is a vfork
16025val=''
16026set vfork val
16027eval $inlibc
16028
16029d_pseudofork=$undef
16030
16031: Ok, but do we want to use it. vfork is reportedly unreliable in
16032: perl on Solaris 2.x, and probably elsewhere.
16033case "$val" in
16034$define)
16035 echo " "
16036 case "$usevfork" in
16037 false) dflt='n';;
16038 *) dflt='y';;
16039 esac
16040 cat <<'EOM'
16041
16042Perl can only use a vfork() that doesn't suffer from strict
16043restrictions on calling functions or modifying global data in
16044the child. For example, glibc-2.1 contains such a vfork()
16045that is unsuitable. If your system provides a proper fork()
16046call, chances are that you do NOT want perl to use vfork().
16047
16048EOM
16049 rp="Do you still want to use vfork()?"
16050 . ./myread
16051 case "$ans" in
16052 y|Y) ;;
16053 *)
16054 echo "Ok, we won't use vfork()."
16055 val="$undef"
16056 ;;
16057 esac
16058 ;;
16059esac
16060set d_vfork
16061eval $setvar
16062case "$d_vfork" in
16063$define) usevfork='true';;
16064*) usevfork='false';;
16065esac
16066
263fee3f
JH
16067: see whether the pthread_atfork exists
16068$cat >try.c <<EOP
16069#include <pthread.h>
16070#include <stdio.h>
16071int main() {
16072#ifdef PTHREAD_ATFORK
16073 pthread_atfork(NULL,NULL,NULL);
16074#endif
16075}
16076EOP
16077
d6483fcc 16078: see if pthread_atfork exists
263fee3f
JH
16079set try -DPTHREAD_ATFORK
16080if eval $compile; then
16081 val="$define"
16082else
16083 val="$undef"
16084fi
16085case "$usethreads" in
16086$define)
16087 case "$val" in
16088 $define) echo 'pthread_atfork found.' >&4 ;;
16089 *) echo 'pthread_atfork NOT found.' >&4 ;;
16090 esac
16091esac
16092set d_pthread_atfork
16093eval $setvar
d6483fcc 16094
58d975c3
JH
16095: see if pthread_attr_setscope exists
16096set pthread_attr_setscope d_pthread_attr_setscope
16097eval $inlibc
16098
b4eb6b3d
JH
16099: see whether the various POSIXish _yields exist
16100$cat >try.c <<EOP
16101#include <pthread.h>
16102#include <stdio.h>
16103int main() {
16104#ifdef SCHED_YIELD
16105 sched_yield();
16106#else
16107#ifdef PTHREAD_YIELD
16108 pthread_yield();
16109#else
16110#ifdef PTHREAD_YIELD_NULL
16111 pthread_yield(NULL);
16112#endif
16113#endif
16114#endif
16115}
16116EOP
16117: see if sched_yield exists
16118set try -DSCHED_YIELD
16119if eval $compile; then
16120 val="$define"
16121 sched_yield='sched_yield()'
16122else
16123 val="$undef"
16124fi
16125case "$usethreads" in
16126$define)
16127 case "$val" in
16128 $define) echo 'sched_yield() found.' >&4 ;;
16129 *) echo 'sched_yield() NOT found.' >&4 ;;
16130 esac
16131esac
10bc17b6
JH
16132set d_sched_yield
16133eval $setvar
b4eb6b3d 16134
10bc17b6
JH
16135: see if pthread_yield exists
16136set try -DPTHREAD_YIELD
16137if eval $compile; then
16138 val="$define"
16139 case "$sched_yield" in
16140 '') sched_yield='pthread_yield()' ;;
16141 esac
16142else
16143 set try -DPTHREAD_YIELD_NULL
16144 if eval $compile; then
16145 val="$define"
16146 case "$sched_yield" in
16147 '') sched_yield='pthread_yield(NULL)' ;;
16148 esac
16149 else
16150 val="$undef"
16151 fi
16152fi
16153case "$usethreads" in
16154$define)
16155 case "$val" in
16156 $define) echo 'pthread_yield() found.' >&4 ;;
16157 *) echo 'pthread_yield() NOT found.' >&4 ;;
16158 esac
16159 ;;
16160esac
16161set d_pthread_yield
16162eval $setvar
10bc17b6
JH
16163case "$sched_yield" in
16164'') sched_yield=undef ;;
16165esac
5b813a60 16166$rm_try
10bc17b6
JH
16167
16168: see if random_r exists
16169set random_r d_random_r
16170eval $inlibc
16171case "$d_random_r" in
16172"$define")
16173 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16174 case "$d_random_r_proto:$usethreads" in
16175 ":define") d_random_r_proto=define
a48ec845
JH
16176 set d_random_r_proto random_r $hdrs
16177 eval $hasproto ;;
16178 *) ;;
16179 esac
16180 case "$d_random_r_proto" in
16181 define)
10bc17b6
JH
16182 case "$random_r_proto" in
16183 ''|0) try='int random_r(int*, struct random_data*);'
61c26d18 16184 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
a845a0d4
JH
16185 esac
16186 case "$random_r_proto" in
16187 ''|0) try='int random_r(long*, struct random_data*);'
61c26d18 16188 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
a845a0d4
JH
16189 esac
16190 case "$random_r_proto" in
16191 ''|0) try='int random_r(struct random_data*, int32_t*);'
61c26d18 16192 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
16193 esac
16194 case "$random_r_proto" in
90e831dc 16195 ''|0) d_random_r=undef
10bc17b6 16196 random_r_proto=0
a48ec845 16197 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16198 * ) case "$random_r_proto" in
16199 REENTRANT_PROTO*) ;;
16200 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16201 esac
16202 echo "Prototype: $try" ;;
16203 esac
b4eb6b3d 16204 ;;
c18e646a
JH
16205 *) case "$usethreads" in
16206 define) echo "random_r has no prototype, not using it." >&4 ;;
16207 esac
90e831dc
SB
16208 d_random_r=undef
16209 random_r_proto=0
c18e646a 16210 ;;
a48ec845
JH
16211 esac
16212 ;;
10bc17b6 16213*) random_r_proto=0
b4eb6b3d
JH
16214 ;;
16215esac
16216
16217: see if readdir and friends exist
16218set readdir d_readdir
16219eval $inlibc
16220set seekdir d_seekdir
16221eval $inlibc
16222set telldir d_telldir
16223eval $inlibc
16224set rewinddir d_rewinddir
16225eval $inlibc
16226
10bc17b6
JH
16227: see if readdir64_r exists
16228set readdir64_r d_readdir64_r
16229eval $inlibc
16230case "$d_readdir64_r" in
16231"$define")
16232 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
16233 case "$d_readdir64_r_proto:$usethreads" in
16234 ":define") d_readdir64_r_proto=define
a48ec845
JH
16235 set d_readdir64_r_proto readdir64_r $hdrs
16236 eval $hasproto ;;
16237 *) ;;
16238 esac
16239 case "$d_readdir64_r_proto" in
16240 define)
10bc17b6
JH
16241 case "$readdir64_r_proto" in
16242 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
61c26d18 16243 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
10bc17b6
JH
16244 esac
16245 case "$readdir64_r_proto" in
16246 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
61c26d18 16247 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
10bc17b6
JH
16248 esac
16249 case "$readdir64_r_proto" in
90e831dc 16250 ''|0) d_readdir64_r=undef
10bc17b6 16251 readdir64_r_proto=0
a48ec845 16252 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16253 * ) case "$readdir64_r_proto" in
16254 REENTRANT_PROTO*) ;;
16255 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16256 esac
16257 echo "Prototype: $try" ;;
16258 esac
16259 ;;
c18e646a
JH
16260 *) case "$usethreads" in
16261 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16262 esac
90e831dc
SB
16263 d_readdir64_r=undef
16264 readdir64_r_proto=0
c18e646a 16265 ;;
a48ec845
JH
16266 esac
16267 ;;
10bc17b6
JH
16268*) readdir64_r_proto=0
16269 ;;
16270esac
16271
16272: see if readdir_r exists
16273set readdir_r d_readdir_r
16274eval $inlibc
16275case "$d_readdir_r" in
16276"$define")
16277 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
16278 case "$d_readdir_r_proto:$usethreads" in
16279 ":define") d_readdir_r_proto=define
a48ec845
JH
16280 set d_readdir_r_proto readdir_r $hdrs
16281 eval $hasproto ;;
16282 *) ;;
16283 esac
16284 case "$d_readdir_r_proto" in
16285 define)
10bc17b6
JH
16286 case "$readdir_r_proto" in
16287 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
61c26d18 16288 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
10bc17b6
JH
16289 esac
16290 case "$readdir_r_proto" in
16291 ''|0) try='int readdir_r(DIR*, struct dirent*);'
61c26d18 16292 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
10bc17b6
JH
16293 esac
16294 case "$readdir_r_proto" in
90e831dc 16295 ''|0) d_readdir_r=undef
10bc17b6 16296 readdir_r_proto=0
a48ec845 16297 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16298 * ) case "$readdir_r_proto" in
16299 REENTRANT_PROTO*) ;;
16300 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16301 esac
16302 echo "Prototype: $try" ;;
16303 esac
16304 ;;
c18e646a
JH
16305 *) case "$usethreads" in
16306 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16307 esac
90e831dc
SB
16308 d_readdir_r=undef
16309 readdir_r_proto=0
c18e646a 16310 ;;
a48ec845
JH
16311 esac
16312 ;;
10bc17b6
JH
16313*) readdir_r_proto=0
16314 ;;
16315esac
16316
4e0554ec
JH
16317: see if readv exists
16318set readv d_readv
16319eval $inlibc
16320
16321: see if recvmsg exists
16322set recvmsg d_recvmsg
16323eval $inlibc
16324
b4eb6b3d
JH
16325: see if rename exists
16326set rename d_rename
16327eval $inlibc
16328
16329: see if rmdir exists
16330set rmdir d_rmdir
16331eval $inlibc
16332
16333: see if memory.h is available.
16334val=''
16335set memory.h val
16336eval $inhdr
16337
16338: See if it conflicts with string.h
16339case "$val" in
16340$define)
16341 case "$strings" in
16342 '') ;;
16343 *)
16344 $cppstdin $cppflags $cppminus < $strings > mem.h
16345 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16346 echo " "
16347 echo "We won't be including <memory.h>."
16348 val="$undef"
16349 fi
16350 $rm -f mem.h
16351 ;;
16352 esac
16353esac
16354set i_memory
16355eval $setvar
16356
16357: can bcopy handle overlapping blocks?
b6cc3bc4 16358echo " "
b4eb6b3d 16359val="$undef"
b6cc3bc4
AD
16360case "$d_memmove" in
16361"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16362*) case "$d_bcopy" in
16363 "$define")
16364 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16365 $cat >try.c <<EOCP
b4eb6b3d
JH
16366#$i_memory I_MEMORY
16367#$i_stdlib I_STDLIB
16368#$i_string I_STRING
16369#$i_unistd I_UNISTD
16370EOCP
16371 $cat >>try.c <<'EOCP'
16372#include <stdio.h>
16373#ifdef I_MEMORY
16374# include <memory.h>
16375#endif
16376#ifdef I_STDLIB
16377# include <stdlib.h>
16378#endif
16379#ifdef I_STRING
16380# include <string.h>
16381#else
16382# include <strings.h>
16383#endif
16384#ifdef I_UNISTD
16385# include <unistd.h> /* Needed for NetBSD */
16386#endif
16387int main()
16388{
16389char buf[128], abc[128];
16390char *b;
16391int len;
16392int off;
16393int align;
16394
b6cc3bc4
AD
16395/* Copy "abcde..." string to char abc[] so that gcc doesn't
16396 try to store the string in read-only memory. */
b4eb6b3d
JH
16397bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16398
16399for (align = 7; align >= 0; align--) {
16400 for (len = 36; len; len--) {
16401 b = buf+align;
16402 bcopy(abc, b, len);
16403 for (off = 1; off <= len; off++) {
16404 bcopy(b, b+off, len);
16405 bcopy(b+off, b, len);
16406 if (bcmp(b, abc, len))
16407 exit(1);
16408 }
16409 }
16410}
16411exit(0);
16412}
16413EOCP
b6cc3bc4
AD
16414 set try
16415 if eval $compile_ok; then
43dddb59 16416 if $run ./try 2>/dev/null; then
b6cc3bc4
AD
16417 echo "Yes, it can."
16418 val="$define"
16419 else
16420 echo "It can't, sorry."
16421 fi
b4eb6b3d 16422 else
b6cc3bc4 16423 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16424 fi
b6cc3bc4
AD
16425 ;;
16426 esac
5b813a60 16427 $rm_try
b4eb6b3d
JH
16428 ;;
16429esac
b4eb6b3d
JH
16430set d_safebcpy
16431eval $setvar
16432
16433: can memcpy handle overlapping blocks?
b6cc3bc4 16434echo " "
b4eb6b3d 16435val="$undef"
b6cc3bc4
AD
16436case "$d_memmove" in
16437"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16438*) case "$d_memcpy" in
16439 "$define")
16440 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16441 $cat >try.c <<EOCP
b4eb6b3d
JH
16442#$i_memory I_MEMORY
16443#$i_stdlib I_STDLIB
16444#$i_string I_STRING
16445#$i_unistd I_UNISTD
16446EOCP
16447 $cat >>try.c <<'EOCP'
16448#include <stdio.h>
16449#ifdef I_MEMORY
16450# include <memory.h>
16451#endif
16452#ifdef I_STDLIB
16453# include <stdlib.h>
16454#endif
16455#ifdef I_STRING
16456# include <string.h>
16457#else
16458# include <strings.h>
16459#endif
16460#ifdef I_UNISTD
16461# include <unistd.h> /* Needed for NetBSD */
16462#endif
16463int main()
16464{
16465char buf[128], abc[128];
16466char *b;
16467int len;
16468int off;
16469int align;
16470
16471/* Copy "abcde..." string to char abc[] so that gcc doesn't
16472 try to store the string in read-only memory. */
16473memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16474
16475for (align = 7; align >= 0; align--) {
16476 for (len = 36; len; len--) {
16477 b = buf+align;
16478 memcpy(b, abc, len);
16479 for (off = 1; off <= len; off++) {
16480 memcpy(b+off, b, len);
16481 memcpy(b, b+off, len);
16482 if (memcmp(b, abc, len))
16483 exit(1);
16484 }
16485 }
16486}
16487exit(0);
16488}
16489EOCP
b6cc3bc4
AD
16490 set try
16491 if eval $compile_ok; then
43dddb59 16492 if $run ./try 2>/dev/null; then
b6cc3bc4
AD
16493 echo "Yes, it can."
16494 val="$define"
16495 else
16496 echo "It can't, sorry."
16497 fi
b4eb6b3d 16498 else
b6cc3bc4 16499 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16500 fi
b6cc3bc4
AD
16501 ;;
16502 esac
5b813a60 16503 $rm_try
b4eb6b3d
JH
16504 ;;
16505esac
b4eb6b3d
JH
16506set d_safemcpy
16507eval $setvar
16508
16509: can memcmp be trusted to compare relative magnitude?
16510val="$undef"
16511case "$d_memcmp" in
16512"$define")
16513 echo " "
16514 echo "Checking if your memcmp() can compare relative magnitude..." >&4
16515 $cat >try.c <<EOCP
16516#$i_memory I_MEMORY
16517#$i_stdlib I_STDLIB
16518#$i_string I_STRING
16519#$i_unistd I_UNISTD
16520EOCP
16521 $cat >>try.c <<'EOCP'
16522#include <stdio.h>
16523#ifdef I_MEMORY
16524# include <memory.h>
16525#endif
16526#ifdef I_STDLIB
36adc09b 16527# include <stdlib.h>
b4eb6b3d
JH
16528#endif
16529#ifdef I_STRING
16530# include <string.h>
16531#else
16532# include <strings.h>
16533#endif
16534#ifdef I_UNISTD
16535# include <unistd.h> /* Needed for NetBSD */
16536#endif
16537int main()
16538{
16539char a = -1;
16540char b = 0;
16541if ((a < b) && memcmp(&a, &b, 1) < 0)
16542 exit(1);
16543exit(0);
16544}
16545EOCP
16546 set try
16547 if eval $compile_ok; then
5440bc8e 16548 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
16549 echo "Yes, it can."
16550 val="$define"
16551 else
16552 echo "No, it can't (it uses signed chars)."
16553 fi
16554 else
16555 echo "(I can't compile the test program, so we'll assume not...)"
16556 fi
16557 ;;
16558esac
5b813a60 16559$rm_try
b4eb6b3d
JH
16560set d_sanemcmp
16561eval $setvar
16562
ef9f17be
JH
16563: see if prototype for sbrk is available
16564echo " "
16565set d_sbrkproto sbrk $i_unistd unistd.h
16566eval $hasproto
16567
b4eb6b3d
JH
16568: see if select exists
16569set select d_select
16570eval $inlibc
16571
16572: see if semctl exists
16573set semctl d_semctl
16574eval $inlibc
16575
16576: see if semget exists
16577set semget d_semget
16578eval $inlibc
16579
16580: see if semop exists
16581set semop d_semop
16582eval $inlibc
16583
16584: see how much of the 'sem*(2)' library is present.
16585h_sem=true
16586echo " "
16587case "$d_semctl$d_semget$d_semop" in
16588*"$undef"*) h_sem=false;;
16589esac
16590case "$osname" in
16591freebsd)
16592 case "`ipcs 2>&1`" in
16593 "SVID messages"*"not configured"*)
16594 echo "Your $osname does not have the sem*(2) configured." >&4
16595 h_sem=false
16596 val="$undef"
16597 set semctl d_semctl
16598 eval $setvar
16599 set semget d_semget
16600 eval $setvar
16601 set semop d_semop
16602 eval $setvar
16603 ;;
16604 esac
16605 ;;
16606esac
16607: we could also check for sys/ipc.h ...
16608if $h_sem && $test `./findhdr sys/sem.h`; then
16609 echo "You have the full sem*(2) library." >&4
16610 val="$define"
16611else
16612 echo "You don't have the full sem*(2) library." >&4
16613 val="$undef"
16614fi
16615set d_sem
16616eval $setvar
16617
16618: see whether sys/sem.h defines union semun
16619echo " "
16620$cat > try.c <<'END'
16621#include <sys/types.h>
16622#include <sys/ipc.h>
16623#include <sys/sem.h>
16624int main () { union semun semun; semun.buf = 0; }
16625END
16626set try
16627if eval $compile; then
16628 echo "You have union semun in <sys/sem.h>." >&4
16629 val="$define"
16630else
16631 echo "You do not have union semun in <sys/sem.h>." >&4
16632 val="$undef"
16633fi
5b813a60 16634$rm_try
b4eb6b3d
JH
16635set d_union_semun
16636eval $setvar
16637
16638: see how to do semctl IPC_STAT
16639case "$d_sem" in
16640$define)
b4eb6b3d 16641 echo " "
93451a0d 16642 $cat > tryh.h <<END
b4eb6b3d
JH
16643#ifndef S_IRUSR
16644# ifdef S_IREAD
16645# define S_IRUSR S_IREAD
16646# define S_IWUSR S_IWRITE
16647# define S_IXUSR S_IEXEC
16648# else
16649# define S_IRUSR 0400
16650# define S_IWUSR 0200
16651# define S_IXUSR 0100
16652# endif
16653# define S_IRGRP (S_IRUSR>>3)
16654# define S_IWGRP (S_IWUSR>>3)
16655# define S_IXGRP (S_IXUSR>>3)
16656# define S_IROTH (S_IRUSR>>6)
16657# define S_IWOTH (S_IWUSR>>6)
16658# define S_IXOTH (S_IXUSR>>6)
16659#endif
16660#ifndef S_IRWXU
16661# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16662# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16663# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16664#endif
16665END
2fad75a1 16666 : see whether semctl IPC_STAT can use union semun
2fad75a1
JH
16667 case "$d_semctl_semun" in
16668 '')
35918792 16669 val="$undef"
2fad75a1 16670 $cat > try.c <<END
b4eb6b3d
JH
16671#include <sys/types.h>
16672#include <sys/ipc.h>
16673#include <sys/sem.h>
16674#include <sys/stat.h>
16675#include <stdio.h>
16676#include <errno.h>
93451a0d 16677#include "tryh.h"
b4eb6b3d
JH
16678#ifndef errno
16679extern int errno;
16680#endif
16681#$d_union_semun HAS_UNION_SEMUN
16682int main() {
16683 union semun
16684#ifndef HAS_UNION_SEMUN
16685 {
16686 int val;
16687 struct semid_ds *buf;
16688 unsigned short *array;
16689 }
16690#endif
16691 arg;
16692 int sem, st;
16693
16694#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16695 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16696 if (sem > -1) {
16697 struct semid_ds argbuf;
16698 arg.buf = &argbuf;
16699# ifdef IPC_STAT
16700 st = semctl(sem, 0, IPC_STAT, arg);
16701 if (st == 0)
16702 printf("semun\n");
16703 else
16704# endif /* IPC_STAT */
16705 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16706# ifdef IPC_RMID
16707 if (semctl(sem, 0, IPC_RMID, arg) != 0)
35918792 16708# endif /* IPC_RMID */
b4eb6b3d
JH
16709 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16710 } else
16711#endif /* IPC_PRIVATE && ... */
16712 printf("semget failed: errno = %d\n", errno);
16713 return 0;
16714}
16715END
2fad75a1
JH
16716 set try
16717 if eval $compile; then
16718 xxx=`$run ./try`
16719 case "$xxx" in
16720 semun) val="$define" ;;
16721 esac
16722 fi
5b813a60 16723 $rm_try
35918792
YST
16724 set d_semctl_semun
16725 eval $setvar
2fad75a1
JH
16726 ;;
16727 esac
b4eb6b3d
JH
16728 case "$d_semctl_semun" in
16729 $define)
16730 echo "You can use union semun for semctl IPC_STAT." >&4
16731 also='also'
16732 ;;
16733 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
16734 also=''
16735 ;;
16736 esac
16737
16738 : see whether semctl IPC_STAT can use struct semid_ds pointer
2fad75a1
JH
16739 case "$d_semctl_semid_ds" in
16740 '')
35918792 16741 val="$undef"
2fad75a1 16742 $cat > try.c <<'END'
b4eb6b3d
JH
16743#include <sys/types.h>
16744#include <sys/ipc.h>
16745#include <sys/sem.h>
16746#include <sys/stat.h>
93451a0d 16747#include "tryh.h"
b4eb6b3d
JH
16748#include <stdio.h>
16749#include <errno.h>
16750#ifndef errno
16751extern int errno;
16752#endif
16753int main() {
16754 struct semid_ds arg;
16755 int sem, st;
16756
16757#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16758 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16759 if (sem > -1) {
16760# ifdef IPC_STAT
16761 st = semctl(sem, 0, IPC_STAT, &arg);
16762 if (st == 0)
16763 printf("semid_ds\n");
16764 else
16765# endif /* IPC_STAT */
16766 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16767# ifdef IPC_RMID
16768 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16769# endif /* IPC_RMID */
16770 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16771 } else
16772#endif /* IPC_PRIVATE && ... */
16773 printf("semget failed: errno = %d\n", errno);
16774
16775 return 0;
16776}
16777END
2fad75a1
JH
16778 set try
16779 if eval $compile; then
16780 xxx=`$run ./try`
16781 case "$xxx" in
16782 semid_ds) val="$define" ;;
16783 esac
16784 fi
5b813a60 16785 $rm_try
35918792
YST
16786 set d_semctl_semid_ds
16787 eval $setvar
2fad75a1
JH
16788 ;;
16789 esac
b4eb6b3d
JH
16790 case "$d_semctl_semid_ds" in
16791 $define)
16792 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16793 ;;
16794 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16795 ;;
16796 esac
b4eb6b3d
JH
16797 ;;
16798*) val="$undef"
16799
16800 # We do not have the full sem*(2) library, so assume we can not
16801 # use either.
16802
16803 set d_semctl_semun
16804 eval $setvar
16805
16806 set d_semctl_semid_ds
16807 eval $setvar
16808 ;;
16809esac
93451a0d 16810$rm_try tryh.h
b4eb6b3d 16811
4e0554ec
JH
16812: see if sendmsg exists
16813set sendmsg d_sendmsg
16814eval $inlibc
16815
b4eb6b3d
JH
16816: see if setegid exists
16817set setegid d_setegid
16818eval $inlibc
16819
16820: see if seteuid exists
16821set seteuid d_seteuid
16822eval $inlibc
16823
16824: see if setgrent exists
16825set setgrent d_setgrent
16826eval $inlibc
16827
10bc17b6
JH
16828: see if setgrent_r exists
16829set setgrent_r d_setgrent_r
16830eval $inlibc
16831case "$d_setgrent_r" in
16832"$define")
16833 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
16834 case "$d_setgrent_r_proto:$usethreads" in
16835 ":define") d_setgrent_r_proto=define
a48ec845
JH
16836 set d_setgrent_r_proto setgrent_r $hdrs
16837 eval $hasproto ;;
16838 *) ;;
16839 esac
16840 case "$d_setgrent_r_proto" in
16841 define)
10bc17b6
JH
16842 case "$setgrent_r_proto" in
16843 ''|0) try='int setgrent_r(FILE**);'
61c26d18 16844 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
10bc17b6
JH
16845 esac
16846 case "$setgrent_r_proto" in
16847 ''|0) try='void setgrent_r(FILE**);'
61c26d18 16848 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
10bc17b6
JH
16849 esac
16850 case "$setgrent_r_proto" in
90e831dc 16851 ''|0) d_setgrent_r=undef
10bc17b6 16852 setgrent_r_proto=0
a48ec845 16853 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16854 * ) case "$setgrent_r_proto" in
16855 REENTRANT_PROTO*) ;;
16856 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16857 esac
16858 echo "Prototype: $try" ;;
16859 esac
16860 ;;
c18e646a
JH
16861 *) case "$usethreads" in
16862 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16863 esac
90e831dc
SB
16864 d_setgrent_r=undef
16865 setgrent_r_proto=0
c18e646a 16866 ;;
a48ec845
JH
16867 esac
16868 ;;
10bc17b6
JH
16869*) setgrent_r_proto=0
16870 ;;
16871esac
16872
b4eb6b3d
JH
16873: see if sethostent exists
16874set sethostent d_sethent
16875eval $inlibc
16876
10bc17b6
JH
16877: see if sethostent_r exists
16878set sethostent_r d_sethostent_r
16879eval $inlibc
16880case "$d_sethostent_r" in
16881"$define")
16882 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16883 case "$d_sethostent_r_proto:$usethreads" in
16884 ":define") d_sethostent_r_proto=define
a48ec845
JH
16885 set d_sethostent_r_proto sethostent_r $hdrs
16886 eval $hasproto ;;
16887 *) ;;
16888 esac
16889 case "$d_sethostent_r_proto" in
16890 define)
10bc17b6
JH
16891 case "$sethostent_r_proto" in
16892 ''|0) try='int sethostent_r(int, struct hostent_data*);'
61c26d18 16893 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
10bc17b6
JH
16894 esac
16895 case "$sethostent_r_proto" in
16896 ''|0) try='void sethostent_r(int, struct hostent_data*);'
61c26d18 16897 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
10bc17b6
JH
16898 esac
16899 case "$sethostent_r_proto" in
90e831dc 16900 ''|0) d_sethostent_r=undef
10bc17b6 16901 sethostent_r_proto=0
a48ec845 16902 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16903 * ) case "$sethostent_r_proto" in
16904 REENTRANT_PROTO*) ;;
16905 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16906 esac
16907 echo "Prototype: $try" ;;
16908 esac
16909 ;;
c18e646a
JH
16910 *) case "$usethreads" in
16911 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16912 esac
90e831dc
SB
16913 d_sethostent_r=undef
16914 sethostent_r_proto=0
c18e646a 16915 ;;
a48ec845
JH
16916 esac
16917 ;;
10bc17b6
JH
16918*) sethostent_r_proto=0
16919 ;;
16920esac
16921
4e0554ec
JH
16922: see if setitimer exists
16923set setitimer d_setitimer
16924eval $inlibc
16925
b4eb6b3d
JH
16926: see if setlinebuf exists
16927set setlinebuf d_setlinebuf
16928eval $inlibc
16929
16930: see if setlocale exists
16931set setlocale d_setlocale
16932eval $inlibc
16933
10bc17b6
JH
16934: see if locale.h is available
16935set locale.h i_locale
16936eval $inhdr
16937
16938: see if setlocale_r exists
16939set setlocale_r d_setlocale_r
16940eval $inlibc
16941case "$d_setlocale_r" in
16942"$define")
16943 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
16944 case "$d_setlocale_r_proto:$usethreads" in
16945 ":define") d_setlocale_r_proto=define
a48ec845
JH
16946 set d_setlocale_r_proto setlocale_r $hdrs
16947 eval $hasproto ;;
16948 *) ;;
16949 esac
16950 case "$d_setlocale_r_proto" in
16951 define)
10bc17b6
JH
16952 case "$setlocale_r_proto" in
16953 ''|0) try='int setlocale_r(int, const char*, char*, int);'
61c26d18 16954 ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
10bc17b6
JH
16955 esac
16956 case "$setlocale_r_proto" in
90e831dc 16957 ''|0) d_setlocale_r=undef
10bc17b6 16958 setlocale_r_proto=0
a48ec845 16959 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16960 * ) case "$setlocale_r_proto" in
16961 REENTRANT_PROTO*) ;;
16962 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16963 esac
16964 echo "Prototype: $try" ;;
16965 esac
16966 ;;
c18e646a
JH
16967 *) case "$usethreads" in
16968 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16969 esac
90e831dc
SB
16970 d_setlocale_r=undef
16971 setlocale_r_proto=0
c18e646a 16972 ;;
a48ec845
JH
16973 esac
16974 ;;
10bc17b6
JH
16975*) setlocale_r_proto=0
16976 ;;
16977esac
16978
b4eb6b3d
JH
16979: see if setnetent exists
16980set setnetent d_setnent
16981eval $inlibc
16982
10bc17b6
JH
16983: see if setnetent_r exists
16984set setnetent_r d_setnetent_r
16985eval $inlibc
16986case "$d_setnetent_r" in
16987"$define")
16988 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16989 case "$d_setnetent_r_proto:$usethreads" in
16990 ":define") d_setnetent_r_proto=define
a48ec845
JH
16991 set d_setnetent_r_proto setnetent_r $hdrs
16992 eval $hasproto ;;
16993 *) ;;
16994 esac
16995 case "$d_setnetent_r_proto" in
16996 define)
10bc17b6
JH
16997 case "$setnetent_r_proto" in
16998 ''|0) try='int setnetent_r(int, struct netent_data*);'
61c26d18 16999 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
10bc17b6
JH
17000 esac
17001 case "$setnetent_r_proto" in
17002 ''|0) try='void setnetent_r(int, struct netent_data*);'
61c26d18 17003 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
10bc17b6
JH
17004 esac
17005 case "$setnetent_r_proto" in
90e831dc 17006 ''|0) d_setnetent_r=undef
10bc17b6 17007 setnetent_r_proto=0
a48ec845 17008 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17009 * ) case "$setnetent_r_proto" in
17010 REENTRANT_PROTO*) ;;
17011 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17012 esac
17013 echo "Prototype: $try" ;;
17014 esac
17015 ;;
c18e646a
JH
17016 *) case "$usethreads" in
17017 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17018 esac
90e831dc
SB
17019 d_setnetent_r=undef
17020 setnetent_r_proto=0
c18e646a 17021 ;;
a48ec845
JH
17022 esac
17023 ;;
10bc17b6
JH
17024*) setnetent_r_proto=0
17025 ;;
17026esac
17027
b4eb6b3d
JH
17028: see if setprotoent exists
17029set setprotoent d_setpent
17030eval $inlibc
17031
17032: see if setpgid exists
17033set setpgid d_setpgid
17034eval $inlibc
17035
17036: see if setpgrp2 exists
17037set setpgrp2 d_setpgrp2
17038eval $inlibc
17039
17040: see if setpriority exists
17041set setpriority d_setprior
17042eval $inlibc
17043
17044: see if setproctitle exists
17045set setproctitle d_setproctitle
17046eval $inlibc
17047
10bc17b6
JH
17048: see if setprotoent_r exists
17049set setprotoent_r d_setprotoent_r
17050eval $inlibc
17051case "$d_setprotoent_r" in
17052"$define")
17053 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17054 case "$d_setprotoent_r_proto:$usethreads" in
17055 ":define") d_setprotoent_r_proto=define
a48ec845
JH
17056 set d_setprotoent_r_proto setprotoent_r $hdrs
17057 eval $hasproto ;;
17058 *) ;;
17059 esac
17060 case "$d_setprotoent_r_proto" in
17061 define)
10bc17b6
JH
17062 case "$setprotoent_r_proto" in
17063 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
61c26d18 17064 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
10bc17b6
JH
17065 esac
17066 case "$setprotoent_r_proto" in
17067 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
61c26d18 17068 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
10bc17b6
JH
17069 esac
17070 case "$setprotoent_r_proto" in
90e831dc 17071 ''|0) d_setprotoent_r=undef
10bc17b6 17072 setprotoent_r_proto=0
a48ec845 17073 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17074 * ) case "$setprotoent_r_proto" in
17075 REENTRANT_PROTO*) ;;
17076 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17077 esac
17078 echo "Prototype: $try" ;;
17079 esac
17080 ;;
c18e646a
JH
17081 *) case "$usethreads" in
17082 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17083 esac
90e831dc
SB
17084 d_setprotoent_r=undef
17085 setprotoent_r_proto=0
c18e646a 17086 ;;
a48ec845
JH
17087 esac
17088 ;;
10bc17b6
JH
17089*) setprotoent_r_proto=0
17090 ;;
17091esac
17092
b4eb6b3d
JH
17093: see if setpwent exists
17094set setpwent d_setpwent
17095eval $inlibc
17096
10bc17b6
JH
17097: see if setpwent_r exists
17098set setpwent_r d_setpwent_r
17099eval $inlibc
17100case "$d_setpwent_r" in
17101"$define")
17102 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
17103 case "$d_setpwent_r_proto:$usethreads" in
17104 ":define") d_setpwent_r_proto=define
a48ec845
JH
17105 set d_setpwent_r_proto setpwent_r $hdrs
17106 eval $hasproto ;;
17107 *) ;;
17108 esac
17109 case "$d_setpwent_r_proto" in
17110 define)
10bc17b6
JH
17111 case "$setpwent_r_proto" in
17112 ''|0) try='int setpwent_r(FILE**);'
61c26d18 17113 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
10bc17b6
JH
17114 esac
17115 case "$setpwent_r_proto" in
17116 ''|0) try='void setpwent_r(FILE**);'
61c26d18 17117 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
10bc17b6
JH
17118 esac
17119 case "$setpwent_r_proto" in
90e831dc 17120 ''|0) d_setpwent_r=undef
10bc17b6 17121 setpwent_r_proto=0
a48ec845 17122 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17123 * ) case "$setpwent_r_proto" in
17124 REENTRANT_PROTO*) ;;
17125 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17126 esac
17127 echo "Prototype: $try" ;;
17128 esac
17129 ;;
c18e646a
JH
17130 *) case "$usethreads" in
17131 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17132 esac
90e831dc
SB
17133 d_setpwent_r=undef
17134 setpwent_r_proto=0
c18e646a 17135 ;;
a48ec845
JH
17136 esac
17137 ;;
10bc17b6
JH
17138*) setpwent_r_proto=0
17139 ;;
17140esac
17141
b4eb6b3d
JH
17142: see if setregid exists
17143set setregid d_setregid
17144eval $inlibc
17145set setresgid d_setresgid
17146eval $inlibc
17147
17148: see if setreuid exists
17149set setreuid d_setreuid
17150eval $inlibc
17151set setresuid d_setresuid
17152eval $inlibc
17153
17154: see if setrgid exists
17155set setrgid d_setrgid
17156eval $inlibc
17157
17158: see if setruid exists
17159set setruid d_setruid
17160eval $inlibc
17161
17162: see if setservent exists
17163set setservent d_setsent
17164eval $inlibc
17165
10bc17b6
JH
17166: see if setservent_r exists
17167set setservent_r d_setservent_r
17168eval $inlibc
17169case "$d_setservent_r" in
17170"$define")
17171 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17172 case "$d_setservent_r_proto:$usethreads" in
17173 ":define") d_setservent_r_proto=define
a48ec845
JH
17174 set d_setservent_r_proto setservent_r $hdrs
17175 eval $hasproto ;;
17176 *) ;;
17177 esac
17178 case "$d_setservent_r_proto" in
17179 define)
10bc17b6
JH
17180 case "$setservent_r_proto" in
17181 ''|0) try='int setservent_r(int, struct servent_data*);'
61c26d18 17182 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
10bc17b6
JH
17183 esac
17184 case "$setservent_r_proto" in
17185 ''|0) try='void setservent_r(int, struct servent_data*);'
61c26d18 17186 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
10bc17b6
JH
17187 esac
17188 case "$setservent_r_proto" in
90e831dc 17189 ''|0) d_setservent_r=undef
10bc17b6 17190 setservent_r_proto=0
a48ec845 17191 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17192 * ) case "$setservent_r_proto" in
17193 REENTRANT_PROTO*) ;;
17194 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17195 esac
17196 echo "Prototype: $try" ;;
17197 esac
17198 ;;
c18e646a
JH
17199 *) case "$usethreads" in
17200 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17201 esac
90e831dc
SB
17202 d_setservent_r=undef
17203 setservent_r_proto=0
c18e646a 17204 ;;
a48ec845
JH
17205 esac
17206 ;;
10bc17b6
JH
17207*) setservent_r_proto=0
17208 ;;
17209esac
17210
b4eb6b3d
JH
17211: see if setsid exists
17212set setsid d_setsid
17213eval $inlibc
17214
17215: see if setvbuf exists
17216set setvbuf d_setvbuf
17217eval $inlibc
17218
17219: see if sfio.h is available
17220set sfio.h i_sfio
17221eval $inhdr
17222
b4eb6b3d
JH
17223: see if sfio library is available
17224case "$i_sfio" in
17225$define)
17226 val=''
17227 set sfreserve val
17228 eval $inlibc
17229 ;;
17230*)
17231 val="$undef"
17232 ;;
17233esac
17234: Ok, but do we want to use it.
17235case "$val" in
17236$define)
17237 case "$usesfio" in
17238 true|$define|[yY]*) dflt='y';;
17239 *) dflt='n';;
17240 esac
17241 echo "$package can use the sfio library, but it is experimental."
17242 case "$useperlio" in
17243 "$undef")
17244 echo "For sfio also the PerlIO abstraction layer is needed."
17245 echo "Earlier you said you wouldn't want that."
17246 ;;
17247 esac
17248 rp="You seem to have sfio available, do you want to try using it?"
17249 . ./myread
17250 case "$ans" in
17251 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
17252 useperlio="$define"
17253 val="$define"
17254 ;;
17255 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
17256 val="$undef"
b4eb6b3d
JH
17257 ;;
17258 esac
17259 ;;
17260*) case "$usesfio" in
17261 true|$define|[yY]*)
17262 echo "Sorry, cannot find sfio on this machine." >&4
17263 echo "Ignoring your setting of usesfio=$usesfio." >&4
17264 val="$undef"
17265 ;;
17266 esac
17267 ;;
17268esac
17269set d_sfio
17270eval $setvar
17271case "$d_sfio" in
17272$define) usesfio='true';;
17273*) usesfio='false';;
17274esac
3659ebf1
JH
17275case "$d_sfio" in
17276$define) ;;
17277*) : Remove sfio from list of libraries to use
7483f793
JH
17278 case "$libs" in
17279 *-lsfio*)
17280 echo "Removing unneeded -lsfio from library list" >&4
17281 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17282 shift
17283 libs="$*"
17284 echo "libs = $libs" >&4
17285 ;;
17286 esac
3659ebf1
JH
17287;;
17288esac
17289
b4eb6b3d
JH
17290
17291: see if shmctl exists
17292set shmctl d_shmctl
17293eval $inlibc
17294
17295: see if shmget exists
17296set shmget d_shmget
17297eval $inlibc
17298
17299: see if shmat exists
17300set shmat d_shmat
17301eval $inlibc
17302: see what shmat returns
17303case "$d_shmat" in
17304"$define")
17305 $cat >shmat.c <<'END'
17306#include <sys/shm.h>
17307void *shmat();
17308END
17309 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17310 shmattype='void *'
17311 else
17312 shmattype='char *'
17313 fi
17314 echo "and it returns ($shmattype)." >&4
17315 : see if a prototype for shmat is available
17316 xxx=`./findhdr sys/shm.h`
17317 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17318 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17319 val="$define"
17320 else
17321 val="$undef"
17322 fi
17323 $rm -f shmat.[co]
17324 ;;
17325*)
17326 val="$undef"
17327 ;;
17328esac
17329set d_shmatprototype
17330eval $setvar
17331
17332: see if shmdt exists
17333set shmdt d_shmdt
17334eval $inlibc
17335
17336: see how much of the 'shm*(2)' library is present.
17337h_shm=true
17338echo " "
17339case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17340*"$undef"*) h_shm=false;;
17341esac
17342case "$osname" in
17343freebsd)
17344 case "`ipcs 2>&1`" in
17345 "SVID shared memory"*"not configured"*)
17346 echo "Your $osname does not have the shm*(2) configured." >&4
17347 h_shm=false
17348 val="$undef"
17349 set shmctl d_shmctl
17350 evat $setvar
17351 set shmget d_shmget
17352 evat $setvar
17353 set shmat d_shmat
17354 evat $setvar
17355 set shmdt d_shmdt
17356 evat $setvar
17357 ;;
17358 esac
17359 ;;
17360esac
17361: we could also check for sys/ipc.h ...
17362if $h_shm && $test `./findhdr sys/shm.h`; then
17363 echo "You have the full shm*(2) library." >&4
17364 val="$define"
17365else
17366 echo "You don't have the full shm*(2) library." >&4
17367 val="$undef"
17368fi
17369set d_shm
17370eval $setvar
17371
b4eb6b3d 17372: see if we have sigaction
613d6c3e 17373echo " "
b4eb6b3d
JH
17374if set sigaction val -f d_sigaction; eval $csym; $val; then
17375 echo 'sigaction() found.' >&4
073b6de5 17376 $cat > try.c <<EOP
b4eb6b3d
JH
17377#include <stdio.h>
17378#include <sys/types.h>
17379#include <signal.h>
073b6de5
JH
17380#$i_stdlib I_STDLIB
17381#ifdef I_STDLIB
17382#include <stdlib.h>
17383#endif
b4eb6b3d
JH
17384int main()
17385{
17386 struct sigaction act, oact;
17387 act.sa_flags = 0;
17388 oact.sa_handler = 0;
17389 /* so that act and oact are used */
17390 exit(act.sa_flags == 0 && oact.sa_handler == 0);
17391}
17392EOP
17393 set try
17394 if eval $compile_ok; then
17395 val="$define"
17396 else
17397 echo "But you don't seem to have a useable struct sigaction." >&4
17398 val="$undef"
17399 fi
17400else
17401 echo 'sigaction NOT found.' >&4
17402 val="$undef"
17403fi
17404set d_sigaction; eval $setvar
5b813a60 17405$rm_try
b4eb6b3d 17406
ed140128
AD
17407: see if this is a sunmath.h system
17408set sunmath.h i_sunmath
17409eval $inhdr
17410
17411: see if signbit exists
17412$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17413$cat >try.c <<EOCP
17414#$i_math I_MATH
17415#$i_sunmath I_SUNMATH
17416#ifdef I_MATH
17417# include <math.h>
17418#endif
17419#ifdef I_SUNMATH /* Solaris special math library */
17420# include <sunmath.h>
17421#endif
17422#define NV $nvtype
17423int main(int argc, char **argv)
17424{
17425 NV x = 0.0;
17426 NV y = -0.0;
17427 if ((signbit(x) == 0) && (signbit(y) != 0))
17428 return 0;
17429 else
17430 return 1;
17431}
17432EOCP
17433val="$undef"
17434set try
17435if eval $compile; then
17436 if $run ./try; then
17437 $echo "Yes." >&4
17438 val="$define"
17439 else
17440 $echo "Signbit seems to be available, but doesn't work as I expected."
17441 $echo "I won't use it." >&4
17442 val="$undef"
17443 fi
17444else
17445 $echo "Nope." >&4
17446 dflt="$undef"
17447fi
17448set d_signbit
17449eval $setvar
5b813a60 17450$rm_try
ed140128 17451
983dbef6
JH
17452: see if sigprocmask exists
17453set sigprocmask d_sigprocmask
17454eval $inlibc
17455
b4eb6b3d
JH
17456: see if sigsetjmp exists
17457echo " "
17458case "$d_sigsetjmp" in
17459'')
c727eafa 17460 $cat >try.c <<EOP
b4eb6b3d 17461#include <setjmp.h>
d1daaddf
JH
17462#$i_stdlib I_STDLIB
17463#ifdef I_STDLIB
17464#include <stdlib.h>
17465#endif
b4eb6b3d
JH
17466sigjmp_buf env;
17467int set = 1;
17468int main()
17469{
17470 if (sigsetjmp(env,1))
17471 exit(set);
17472 set = 0;
17473 siglongjmp(env, 1);
17474 exit(1);
17475}
17476EOP
17477 set try
17478 if eval $compile; then
5440bc8e 17479 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
17480 echo "POSIX sigsetjmp found." >&4
17481 val="$define"
17482 else
17483 $cat >&4 <<EOM
17484Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17485I'll ignore them.
17486EOM
17487 val="$undef"
17488 fi
17489 else
17490 echo "sigsetjmp not found." >&4
17491 val="$undef"
17492 fi
17493 ;;
17494*) val="$d_sigsetjmp"
17495 case "$d_sigsetjmp" in
17496 $define) echo "POSIX sigsetjmp found." >&4;;
17497 $undef) echo "sigsetjmp not found." >&4;;
17498 esac
17499 ;;
17500esac
17501set d_sigsetjmp
17502eval $setvar
5b813a60 17503$rm_try
b4eb6b3d 17504
4f5da3e9
SP
17505: see if snprintf exists
17506set snprintf d_snprintf
17507eval $inlibc
17508
17509: see if vsnprintf exists
17510set vsnprintf d_vsnprintf
17511eval $inlibc
17512
2478f7a0
MB
17513case "$d_snprintf-$d_vsnprintf" in
17514"$define-$define")
17515 $cat <<EOM
17516Checking whether your snprintf() and vsnprintf() work okay...
17517EOM
17518 $cat >try.c <<'EOCP'
17519/* v?snprintf testing logic courtesy of Russ Allbery.
17520 * According to C99:
17521 * - if the buffer is too short it still must be \0-terminated
17522 * - if the buffer is too short the potentially required length
17523 * must be returned and not -1
17524 * - if the buffer is NULL the potentially required length
17525 * must be returned and not -1 or core dump
17526 */
17527#include <stdio.h>
17528#include <stdarg.h>
17529
17530char buf[2];
17531
17532int test (char *format, ...)
17533{
17534 va_list args;
17535 int count;
17536
17537 va_start (args, format);
17538 count = vsnprintf (buf, sizeof buf, format, args);
17539 va_end (args);
17540 return count;
17541}
17542
17543int main ()
17544{
17545 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17546 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17547}
17548EOCP
17549 set try
17550 if eval $compile; then
17551 `$run ./try`
17552 case "$?" in
17553 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17554 *) cat <<EOM >&4
17555Your snprintf() and snprintf() don't seem to be working okay.
17556EOM
17557 d_snprintf="$undef"
17558 d_vsnprintf="$undef"
17559 ;;
17560 esac
17561 else
17562 echo "(I can't seem to compile the test program--assuming they don't)"
17563 d_snprintf="$undef"
17564 d_vsnprintf="$undef"
17565 fi
5b813a60 17566 $rm_try
2478f7a0
MB
17567 ;;
17568esac
17569
49a78c82
JH
17570: see if sockatmark exists
17571set sockatmark d_sockatmark
17572eval $inlibc
17573
2ef53570
JH
17574: see if prototype for sockatmark is available
17575echo " "
17576set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17577eval $hasproto
17578
b4eb6b3d
JH
17579: see if socks5_init exists
17580set socks5_init d_socks5_init
17581eval $inlibc
17582
360321b3
YST
17583: see if sprintf returns the length of the string in the buffer as per ANSI
17584$echo "Checking whether sprintf returns the length of the string..." >&4
17585$cat <<EOP >try.c
17586#include <stdio.h>
17587#$i_stdlib I_STDLIB
17588#ifdef I_STDLIB
17589#include <stdlib.h>
17590#endif
17591#$i_string I_STRING
17592#ifdef I_STRING
17593# include <string.h>
17594#else
17595# include <strings.h>
17596#endif
17597#$i_math I_MATH
17598#ifdef I_MATH
17599#include <math.h>
17600#endif
17601
17602char buffer[256];
17603
17604int check (size_t expect, int test) {
17605 size_t got = strlen(buffer);
17606 if (expect == got)
17607 return 0;
17608
17609 printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17610 test, buffer);
17611 exit (test);
17612}
17613
17614int main(int argc, char **argv) {
17615 int test = 0;
17616
17617 check(sprintf(buffer, ""), ++test);
17618 check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17619 check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17620
17621 return 0;
17622}
17623EOP
17624set try
17625
360321b3
YST
17626if eval $compile; then
17627 xxx="`$run ./try`"
17628 case "$?" in
17629 0) cat >&4 <<EOM
17630sprintf returns the length of the string (as ANSI says it should)
17631EOM
17632 d_sprintf_returns_strlen="$define"
17633 ;;
17634 *) cat >&4 <<EOM
17635sprintf does not return the length of the string (how old is this system?)
17636EOM
17637 d_sprintf_returns_strlen="$undef"
17638 ;;
17639 esac
d2821e72 17640else
36a30365
JH
17641 echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17642 d_sprintf_returns_strlen="$undef"
360321b3 17643fi
5b813a60 17644$rm_try
360321b3 17645
10bc17b6
JH
17646: see if srand48_r exists
17647set srand48_r d_srand48_r
17648eval $inlibc
17649case "$d_srand48_r" in
17650"$define")
17651 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17652 case "$d_srand48_r_proto:$usethreads" in
17653 ":define") d_srand48_r_proto=define
a48ec845
JH
17654 set d_srand48_r_proto srand48_r $hdrs
17655 eval $hasproto ;;
17656 *) ;;
17657 esac
17658 case "$d_srand48_r_proto" in
17659 define)
10bc17b6
JH
17660 case "$srand48_r_proto" in
17661 ''|0) try='int srand48_r(long, struct drand48_data*);'
61c26d18 17662 ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
10bc17b6
JH
17663 esac
17664 case "$srand48_r_proto" in
90e831dc 17665 ''|0) d_srand48_r=undef
10bc17b6 17666 srand48_r_proto=0
a48ec845 17667 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17668 * ) case "$srand48_r_proto" in
17669 REENTRANT_PROTO*) ;;
17670 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17671 esac
17672 echo "Prototype: $try" ;;
17673 esac
17674 ;;
c18e646a
JH
17675 *) case "$usethreads" in
17676 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17677 esac
90e831dc
SB
17678 d_srand48_r=undef
17679 srand48_r_proto=0
c18e646a 17680 ;;
a48ec845
JH
17681 esac
17682 ;;
10bc17b6
JH
17683*) srand48_r_proto=0
17684 ;;
17685esac
17686
17687: see if srandom_r exists
17688set srandom_r d_srandom_r
17689eval $inlibc
17690case "$d_srandom_r" in
17691"$define")
17692 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17693 case "$d_srandom_r_proto:$usethreads" in
17694 ":define") d_srandom_r_proto=define
a48ec845
JH
17695 set d_srandom_r_proto srandom_r $hdrs
17696 eval $hasproto ;;
17697 *) ;;
17698 esac
17699 case "$d_srandom_r_proto" in
17700 define)
10bc17b6
JH
17701 case "$srandom_r_proto" in
17702 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
61c26d18 17703 ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
10bc17b6
JH
17704 esac
17705 case "$srandom_r_proto" in
90e831dc 17706 ''|0) d_srandom_r=undef
10bc17b6 17707 srandom_r_proto=0
a48ec845 17708 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17709 * ) case "$srandom_r_proto" in
17710 REENTRANT_PROTO*) ;;
17711 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17712 esac
17713 echo "Prototype: $try" ;;
17714 esac
17715 ;;
c18e646a
JH
17716 *) case "$usethreads" in
17717 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17718 esac
90e831dc
SB
17719 d_srandom_r=undef
17720 srandom_r_proto=0
c18e646a 17721 ;;
a48ec845
JH
17722 esac
17723 ;;
10bc17b6
JH
17724*) srandom_r_proto=0
17725 ;;
17726esac
17727
eef837ea
JH
17728: see if prototype for setresgid is available
17729echo " "
17730set d_sresgproto setresgid $i_unistd unistd.h
17731eval $hasproto
17732
640374d0
JH
17733: see if prototype for setresuid is available
17734echo " "
17735set d_sresuproto setresuid $i_unistd unistd.h
17736eval $hasproto
17737
b4eb6b3d
JH
17738: see if sys/stat.h is available
17739set sys/stat.h i_sysstat
17740eval $inhdr
17741
b4eb6b3d
JH
17742: see if stat knows about block sizes
17743echo " "
17744echo "Checking to see if your struct stat has st_blocks field..." >&4
17745set d_statblks stat st_blocks $i_sysstat sys/stat.h
17746eval $hasfield
17747
b4eb6b3d
JH
17748: see if this is a sys/vfs.h system
17749set sys/vfs.h i_sysvfs
17750eval $inhdr
17751
b4eb6b3d
JH
17752: see if this is a sys/statfs.h system
17753set sys/statfs.h i_sysstatfs
17754eval $inhdr
17755
34f1896b 17756: Check for statfs_s
b4eb6b3d
JH
17757echo " "
17758echo "Checking to see if your system supports struct statfs..." >&4
17759set 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
17760eval $hasstruct
17761case "$d_statfs_s" in
17762"$define") echo "Yes, it does." ;;
17763*) echo "No, it doesn't." ;;
17764esac
17765
17766
b4eb6b3d
JH
17767: see if struct statfs knows about f_flags
17768case "$d_statfs_s" in
34f1896b 17769define)
b4eb6b3d
JH
17770 echo " "
17771 echo "Checking to see if your struct statfs has f_flags field..." >&4
17772 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
17773 eval $hasfield
17774 ;;
17775*) val="$undef"
17776 set d_statfs_f_flags
17777 eval $setvar
17778 ;;
17779esac
17780case "$d_statfs_f_flags" in
17781"$define") echo "Yes, it does." ;;
17782*) echo "No, it doesn't." ;;
17783esac
17784
613d6c3e 17785: Check stream access
b4eb6b3d
JH
17786$cat >&4 <<EOM
17787Checking how to access stdio streams by file descriptor number...
17788EOM
17789case "$stdio_stream_array" in
17790'') $cat >try.c <<EOCP
17791#include <stdio.h>
17792int main() {
17793 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17794 printf("yes\n");
17795}
17796EOCP
17797 for s in _iob __iob __sF
17798 do
17799 set try -DSTDIO_STREAM_ARRAY=$s
17800 if eval $compile; then
5440bc8e 17801 case "`$run ./try`" in
b4eb6b3d
JH
17802 yes) stdio_stream_array=$s; break ;;
17803 esac
17804 fi
17805 done
5b813a60 17806 $rm_try
b4eb6b3d
JH
17807esac
17808case "$stdio_stream_array" in
17809'') $cat >&4 <<EOM
17810I can't figure out how to access stdio streams by file descriptor number.
17811EOM
17812 d_stdio_stream_array="$undef"
17813 ;;
17814*) $cat >&4 <<EOM
17815You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17816EOM
17817 d_stdio_stream_array="$define"
17818 ;;
17819esac
17820
17821: see if strcoll exists
17822set strcoll d_strcoll
17823eval $inlibc
17824
17825: check for structure copying
17826echo " "
17827echo "Checking to see if your C compiler can copy structs..." >&4
17828$cat >try.c <<'EOCP'
76f47787 17829int main()
b4eb6b3d
JH
17830{
17831 struct blurfl {
17832 int dyick;
17833 } foo, bar;
17834
17835 foo = bar;
17836}
17837EOCP
17838if $cc -c try.c >/dev/null 2>&1 ; then
17839 val="$define"
17840 echo "Yup, it can."
17841else
17842 val="$undef"
17843 echo "Nope, it can't."
17844fi
17845set d_strctcpy
17846eval $setvar
5b813a60 17847$rm_try
b4eb6b3d
JH
17848
17849: see if strerror and/or sys_errlist[] exist
17850echo " "
17851if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17852 if set strerror val -f d_strerror; eval $csym; $val; then
17853 echo 'strerror() found.' >&4
17854 d_strerror="$define"
17855 d_strerrm='strerror(e)'
17856 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17857 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
17858 d_syserrlst="$define"
17859 else
17860 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17861 d_syserrlst="$undef"
17862 fi
17863 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17864 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17865 echo 'strerror() found in string header.' >&4
17866 d_strerror="$define"
17867 d_strerrm='strerror(e)'
17868 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17869 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17870 d_syserrlst="$define"
17871 else
17872 echo "(You don't appear to have any sys_errlist[], how can this be?)"
17873 d_syserrlst="$undef"
17874 fi
17875 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17876 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17877 d_strerror="$undef"
17878 d_syserrlst="$define"
17879 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17880 else
17881 echo 'strerror() and sys_errlist[] NOT found.' >&4
17882 d_strerror="$undef"
17883 d_syserrlst="$undef"
17884 d_strerrm='"unknown"'
17885 fi
17886fi
17887
10bc17b6
JH
17888: see if strerror_r exists
17889set strerror_r d_strerror_r
17890eval $inlibc
17891case "$d_strerror_r" in
17892"$define")
17893 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
17894 case "$d_strerror_r_proto:$usethreads" in
17895 ":define") d_strerror_r_proto=define
a48ec845
JH
17896 set d_strerror_r_proto strerror_r $hdrs
17897 eval $hasproto ;;
17898 *) ;;
17899 esac
17900 case "$d_strerror_r_proto" in
17901 define)
10bc17b6
JH
17902 case "$strerror_r_proto" in
17903 ''|0) try='int strerror_r(int, char*, size_t);'
61c26d18 17904 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
10bc17b6
JH
17905 esac
17906 case "$strerror_r_proto" in
17907 ''|0) try='int strerror_r(int, char*, int);'
61c26d18 17908 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
10bc17b6
JH
17909 esac
17910 case "$strerror_r_proto" in
17911 ''|0) try='char* strerror_r(int, char*, size_t);'
61c26d18 17912 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
10bc17b6
JH
17913 esac
17914 case "$strerror_r_proto" in
90e831dc 17915 ''|0) d_strerror_r=undef
10bc17b6 17916 strerror_r_proto=0
a48ec845 17917 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17918 * ) case "$strerror_r_proto" in
17919 REENTRANT_PROTO*) ;;
17920 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17921 esac
17922 echo "Prototype: $try" ;;
17923 esac
17924 ;;
c18e646a
JH
17925 *) case "$usethreads" in
17926 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17927 esac
90e831dc
SB
17928 d_strerror_r=undef
17929 strerror_r_proto=0
c18e646a 17930 ;;
a48ec845
JH
17931 esac
17932 ;;
10bc17b6
JH
17933*) strerror_r_proto=0
17934 ;;
17935esac
17936
b3c85772
JH
17937: see if strftime exists
17938set strftime d_strftime
17939eval $inlibc
17940
08c92000
MB
17941: see if strlcat exists
17942set strlcat d_strlcat
17943eval $inlibc
17944
17945: see if strlcpy exists
17946set strlcpy d_strlcpy
17947eval $inlibc
17948
b4eb6b3d
JH
17949: see if strtod exists
17950set strtod d_strtod
17951eval $inlibc
17952
17953: see if strtol exists
17954set strtol d_strtol
17955eval $inlibc
17956
17957: see if strtold exists
17958set strtold d_strtold
17959eval $inlibc
17960
17961: see if strtoll exists
17962set strtoll d_strtoll
17963eval $inlibc
17964
17965case "$d_longlong-$d_strtoll" in
17966"$define-$define")
17967 $cat <<EOM
17968Checking whether your strtoll() works okay...
17969EOM
17970 $cat >try.c <<'EOCP'
17971#include <errno.h>
17972#ifdef __hpux
17973#define strtoll __strtoll
17974#endif
e75931a7
YST
17975#ifdef __EMX__
17976#define strtoll _strtoll
17977#endif
b4eb6b3d 17978#include <stdio.h>
613d6c3e 17979extern long long int strtoll(char *s, char **, int);
b4eb6b3d
JH
17980static int bad = 0;
17981int check(char *s, long long ell, int een) {
17982 long long gll;
17983 errno = 0;
17984 gll = strtoll(s, 0, 10);
17985 if (!((gll == ell) && (errno == een)))
17986 bad++;
17987}
17988int main() {
17989 check(" 1", 1LL, 0);
17990 check(" 0", 0LL, 0);
17991 check("-1", -1LL, 0);
17992 check("-9223372036854775808", -9223372036854775808LL, 0);
17993 check("-9223372036854775808", -9223372036854775808LL, 0);
17994 check(" 9223372036854775807", 9223372036854775807LL, 0);
17995 check("-9223372036854775808", -9223372036854775808LL, 0);
17996 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
17997 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17998 if (!bad)
17999 printf("ok\n");
18000}
18001EOCP
18002 set try
18003 if eval $compile; then
5440bc8e 18004 yyy=`$run ./try`
e75931a7 18005 case "$yyy" in
b4eb6b3d
JH
18006 ok) echo "Your strtoll() seems to be working okay." ;;
18007 *) cat <<EOM >&4
18008Your strtoll() doesn't seem to be working okay.
18009EOM
18010 d_strtoll="$undef"
18011 ;;
69eadf66 18012 esac
e75931a7
YST
18013 else
18014 echo "(I can't seem to compile the test program--assuming it doesn't)"
18015 d_strtoll="$undef"
b4eb6b3d
JH
18016 fi
18017 ;;
18018esac
18019
28e5dec8
JH
18020: see if strtoq exists
18021set strtoq d_strtoq
18022eval $inlibc
18023
b4eb6b3d
JH
18024: see if strtoul exists
18025set strtoul d_strtoul
18026eval $inlibc
18027
d0e6d399
NC
18028case "$d_strtoul" in
18029"$define")
18030 $cat <<EOM
18031Checking whether your strtoul() works okay...
18032EOM
18033 $cat >try.c <<'EOCP'
18034#include <errno.h>
18035#include <stdio.h>
613d6c3e 18036extern unsigned long int strtoul(char *s, char **, int);
d0e6d399
NC
18037static int bad = 0;
18038void check(char *s, unsigned long eul, int een) {
18039 unsigned long gul;
18040 errno = 0;
18041 gul = strtoul(s, 0, 10);
18042 if (!((gul == eul) && (errno == een)))
18043 bad++;
18044}
18045int main() {
18046 check(" 1", 1L, 0);
18047 check(" 0", 0L, 0);
18048EOCP
18049 case "$longsize" in
18050 8)
18051 $cat >>try.c <<'EOCP'
09c0d2c4
JH
18052 check("18446744073709551615", 18446744073709551615UL, 0);
18053 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 18054#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 18055 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
18056 check("-18446744073709551614", 2, 0);
18057 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
18058 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18059 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 18060#endif
d0e6d399
NC
18061EOCP
18062 ;;
18063 4)
18064 $cat >>try.c <<'EOCP'
18065 check("4294967295", 4294967295UL, 0);
18066 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 18067#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
18068 check("-1", 4294967295UL, 0);
18069 check("-4294967294", 2, 0);
18070 check("-4294967295", 1, 0);
18071 check("-4294967296", 4294967295UL, ERANGE);
18072 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 18073#endif
d0e6d399
NC
18074EOCP
18075 ;;
18076 *)
18077: Should we write these tests to be more portable by sprintf-ing
18078: ~0 and then manipulating that char string as input for strtol?
18079 ;;
18080 esac
18081 $cat >>try.c <<'EOCP'
18082 if (!bad)
18083 printf("ok\n");
18084 return 0;
18085}
18086EOCP
18087 set try
18088 if eval $compile; then
5440bc8e 18089 case "`$run ./try`" in
d0e6d399
NC
18090 ok) echo "Your strtoul() seems to be working okay." ;;
18091 *) cat <<EOM >&4
18092Your strtoul() doesn't seem to be working okay.
18093EOM
18094 d_strtoul="$undef"
18095 ;;
18096 esac
9597a80f
NC
18097 else
18098 echo "(I can't seem to compile the test program--assuming it doesn't)"
18099 d_strtoul="$undef"
d0e6d399
NC
18100 fi
18101 ;;
18102esac
18103
b4eb6b3d
JH
18104: see if strtoull exists
18105set strtoull d_strtoull
18106eval $inlibc
18107
18108case "$d_longlong-$d_strtoull" in
18109"$define-$define")
18110 $cat <<EOM
18111Checking whether your strtoull() works okay...
18112EOM
18113 $cat >try.c <<'EOCP'
18114#include <errno.h>
18115#ifdef __hpux
18116#define strtoull __strtoull
18117#endif
18118#include <stdio.h>
613d6c3e 18119extern unsigned long long int strtoull(char *s, char **, int);
b4eb6b3d
JH
18120static int bad = 0;
18121int check(char *s, long long eull, int een) {
18122 long long gull;
18123 errno = 0;
18124 gull = strtoull(s, 0, 10);
18125 if (!((gull == eull) && (errno == een)))
18126 bad++;
18127}
18128int main() {
d0e6d399
NC
18129 check(" 1", 1LL, 0);
18130 check(" 0", 0LL, 0);
18131 check("18446744073709551615", 18446744073709551615ULL, 0);
18132 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 18133#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
18134 check("-1", 18446744073709551615ULL, 0);
18135 check("-18446744073709551614", 2LL, 0);
18136 check("-18446744073709551615", 1LL, 0);
18137 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18138 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 18139#endif
b4eb6b3d
JH
18140 if (!bad)
18141 printf("ok\n");
18142}
18143EOCP
18144 set try
18145 if eval $compile; then
5440bc8e 18146 case "`$run ./try`" in
b4eb6b3d
JH
18147 ok) echo "Your strtoull() seems to be working okay." ;;
18148 *) cat <<EOM >&4
18149Your strtoull() doesn't seem to be working okay.
18150EOM
18151 d_strtoull="$undef"
18152 ;;
18153 esac
9597a80f
NC
18154 else
18155 echo "(I can't seem to compile the test program--assuming it doesn't)"
18156 d_strtoull="$undef"
b4eb6b3d
JH
18157 fi
18158 ;;
18159esac
18160
18161: see if strtouq exists
18162set strtouq d_strtouq
18163eval $inlibc
18164
d0e6d399
NC
18165case "$d_strtouq" in
18166"$define")
18167 $cat <<EOM
18168Checking whether your strtouq() works okay...
18169EOM
18170 $cat >try.c <<'EOCP'
18171#include <errno.h>
18172#include <stdio.h>
613d6c3e 18173extern unsigned long long int strtouq(char *s, char **, int);
d0e6d399
NC
18174static int bad = 0;
18175void check(char *s, unsigned long long eull, int een) {
18176 unsigned long long gull;
18177 errno = 0;
18178 gull = strtouq(s, 0, 10);
18179 if (!((gull == eull) && (errno == een)))
18180 bad++;
18181}
18182int main() {
18183 check(" 1", 1LL, 0);
18184 check(" 0", 0LL, 0);
18185 check("18446744073709551615", 18446744073709551615ULL, 0);
18186 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 18187#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
18188 check("-1", 18446744073709551615ULL, 0);
18189 check("-18446744073709551614", 2LL, 0);
18190 check("-18446744073709551615", 1LL, 0);
18191 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18192 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 18193#endif
d0e6d399
NC
18194 if (!bad)
18195 printf("ok\n");
18196 return 0;
18197}
18198EOCP
18199 set try
18200 if eval $compile; then
5440bc8e 18201 case "`$run ./try`" in
d0e6d399
NC
18202 ok) echo "Your strtouq() seems to be working okay." ;;
18203 *) cat <<EOM >&4
18204Your strtouq() doesn't seem to be working okay.
18205EOM
18206 d_strtouq="$undef"
18207 ;;
18208 esac
9597a80f
NC
18209 else
18210 echo "(I can't seem to compile the test program--assuming it doesn't)"
18211 d_strtouq="$undef"
d0e6d399
NC
18212 fi
18213 ;;
18214esac
18215
b4eb6b3d
JH
18216: see if strxfrm exists
18217set strxfrm d_strxfrm
18218eval $inlibc
18219
18220: see if symlink exists
18221set symlink d_symlink
18222eval $inlibc
18223
18224: see if syscall exists
18225set syscall d_syscall
18226eval $inlibc
18227
2ef53570
JH
18228: see if prototype for syscall is available
18229echo " "
18230set d_syscallproto syscall $i_unistd unistd.h
18231eval $hasproto
18232
b4eb6b3d
JH
18233: see if sysconf exists
18234set sysconf d_sysconf
18235eval $inlibc
18236
18237: see if system exists
18238set system d_system
18239eval $inlibc
18240
18241: see if tcgetpgrp exists
18242set tcgetpgrp d_tcgetpgrp
18243eval $inlibc
18244
18245: see if tcsetpgrp exists
18246set tcsetpgrp d_tcsetpgrp
18247eval $inlibc
18248
18249: see if prototype for telldir is available
18250echo " "
18251set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18252eval $hasproto
18253
ad493445
MB
18254: see if time exists
18255echo " "
18256if test "X$d_time" = X -o X"$timetype" = X; then
18257 if set time val -f d_time; eval $csym; $val; then
18258 echo 'time() found.' >&4
18259 val="$define"
18260 rp="What is the type returned by time() on this system?"
18261 set time_t timetype long stdio.h sys/types.h
18262 eval $typedef_ask
18263 else
18264 echo 'time() not found, hope that will do.' >&4
18265 val="$undef"
18266 timetype='int';
18267 fi
18268 set d_time
18269 eval $setvar
18270fi
18271
cbb9e8a7
MB
18272: see if timegm exists
18273set timegm d_timegm
18274eval $inlibc
18275
b4eb6b3d
JH
18276: see if this is a sys/times.h system
18277set sys/times.h i_systimes
18278eval $inhdr
18279
18280: see if times exists
18281echo " "
18282if set times val -f d_times; eval $csym; $val; then
18283 echo 'times() found.' >&4
18284 d_times="$define"
18285 inc=''
18286 case "$i_systimes" in
18287 "$define") inc='sys/times.h';;
18288 esac
18289 rp="What is the type returned by times() on this system?"
18290 set clock_t clocktype long stdio.h sys/types.h $inc
18291 eval $typedef_ask
18292else
18293 echo 'times() NOT found, hope that will do.' >&4
18294 d_times="$undef"
18295 clocktype='int'
18296fi
18297
10bc17b6
JH
18298: see if tmpnam_r exists
18299set tmpnam_r d_tmpnam_r
18300eval $inlibc
18301case "$d_tmpnam_r" in
18302"$define")
31ee0cb7 18303 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
18304 case "$d_tmpnam_r_proto:$usethreads" in
18305 ":define") d_tmpnam_r_proto=define
a48ec845
JH
18306 set d_tmpnam_r_proto tmpnam_r $hdrs
18307 eval $hasproto ;;
18308 *) ;;
18309 esac
18310 case "$d_tmpnam_r_proto" in
18311 define)
10bc17b6
JH
18312 case "$tmpnam_r_proto" in
18313 ''|0) try='char* tmpnam_r(char*);'
61c26d18 18314 ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
10bc17b6
JH
18315 esac
18316 case "$tmpnam_r_proto" in
90e831dc 18317 ''|0) d_tmpnam_r=undef
10bc17b6 18318 tmpnam_r_proto=0
a48ec845 18319 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18320 * ) case "$tmpnam_r_proto" in
18321 REENTRANT_PROTO*) ;;
18322 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18323 esac
18324 echo "Prototype: $try" ;;
18325 esac
18326 ;;
c18e646a
JH
18327 *) case "$usethreads" in
18328 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18329 esac
90e831dc
SB
18330 d_tmpnam_r=undef
18331 tmpnam_r_proto=0
c18e646a 18332 ;;
a48ec845
JH
18333 esac
18334 ;;
10bc17b6
JH
18335*) tmpnam_r_proto=0
18336 ;;
18337esac
18338
b4eb6b3d
JH
18339: see if truncate exists
18340set truncate d_truncate
18341eval $inlibc
18342
10bc17b6
JH
18343: see if ttyname_r exists
18344set ttyname_r d_ttyname_r
18345eval $inlibc
18346case "$d_ttyname_r" in
18347"$define")
18348 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
18349 case "$d_ttyname_r_proto:$usethreads" in
18350 ":define") d_ttyname_r_proto=define
a48ec845
JH
18351 set d_ttyname_r_proto ttyname_r $hdrs
18352 eval $hasproto ;;
18353 *) ;;
18354 esac
18355 case "$d_ttyname_r_proto" in
18356 define)
10bc17b6
JH
18357 case "$ttyname_r_proto" in
18358 ''|0) try='int ttyname_r(int, char*, size_t);'
61c26d18 18359 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
10bc17b6
JH
18360 esac
18361 case "$ttyname_r_proto" in
18362 ''|0) try='int ttyname_r(int, char*, int);'
61c26d18 18363 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
10bc17b6
JH
18364 esac
18365 case "$ttyname_r_proto" in
18366 ''|0) try='char* ttyname_r(int, char*, int);'
61c26d18 18367 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
10bc17b6
JH
18368 esac
18369 case "$ttyname_r_proto" in
90e831dc 18370 ''|0) d_ttyname_r=undef
10bc17b6 18371 ttyname_r_proto=0
a48ec845 18372 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18373 * ) case "$ttyname_r_proto" in
18374 REENTRANT_PROTO*) ;;
18375 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18376 esac
18377 echo "Prototype: $try" ;;
18378 esac
18379 ;;
c18e646a
JH
18380 *) case "$usethreads" in
18381 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18382 esac
90e831dc
SB
18383 d_ttyname_r=undef
18384 ttyname_r_proto=0
c18e646a 18385 ;;
a48ec845
JH
18386 esac
18387 ;;
10bc17b6
JH
18388*) ttyname_r_proto=0
18389 ;;
18390esac
18391
b4eb6b3d
JH
18392: see if tzname[] exists
18393echo " "
18394if set tzname val -a d_tzname; eval $csym; $val; then
18395 val="$define"
18396 echo 'tzname[] found.' >&4
18397else
18398 val="$undef"
18399 echo 'tzname[] NOT found.' >&4
18400fi
18401set d_tzname
18402eval $setvar
18403
613d6c3e 18404: Check if is a multiplatform env
4e0554ec
JH
18405case "$osname" in
18406next|rhapsody|darwin) multiarch="$define" ;;
18407esac
18408case "$multiarch" in
18409''|[nN]*) multiarch="$undef" ;;
18410esac
18411
24412007 18412: check for ordering of bytes in a UV
4e0554ec 18413echo " "
5440bc8e 18414case "$usecrosscompile$multiarch" in
4e0554ec
JH
18415*$define*)
18416 $cat <<EOM
18417You seem to be either cross-compiling or doing a multiarchitecture build,
18418skipping the byteorder check.
18419
18420EOM
5440bc8e 18421 byteorder='ffff'
4e0554ec
JH
18422 ;;
18423*)
18424 case "$byteorder" in
18425 '')
18426 $cat <<'EOM'
18427In the following, larger digits indicate more significance. A big-endian
18428machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18429little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18430machines may have weird orders like 3412. A Cray will report 87654321,
18431an Alpha will report 12345678. If the test program works the default is
18432probably right.
18433I'm now running the test program...
18434EOM
24412007 18435 $cat >try.c <<EOCP
4e0554ec 18436#include <stdio.h>
55954f19
JH
18437#$i_stdlib I_STDLIB
18438#ifdef I_STDLIB
18439#include <stdlib.h>
18440#endif
24412007
JH
18441#include <sys/types.h>
18442typedef $uvtype UV;
4e0554ec
JH
18443int main()
18444{
18445 int i;
18446 union {
24412007
JH
18447 UV l;
18448 char c[$uvsize];
4e0554ec
JH
18449 } u;
18450
24412007 18451 if ($uvsize > 4)
b5ded3e5 18452 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 18453 else
a4c53327 18454 u.l = (UV)0x04030201;
24412007 18455 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
18456 printf("%c", u.c[i]+'0');
18457 printf("\n");
18458 exit(0);
18459}
18460EOCP
18461 xxx_prompt=y
18462 set try
43dddb59 18463 if eval $compile && $run ./try > /dev/null; then
5440bc8e 18464 dflt=`$run ./try`
4e0554ec
JH
18465 case "$dflt" in
18466 [1-4][1-4][1-4][1-4]|12345678|87654321)
18467 echo "(The test program ran ok.)"
18468 echo "byteorder=$dflt"
18469 xxx_prompt=n
18470 ;;
18471 ????|????????) echo "(The test program ran ok.)" ;;
18472 *) echo "(The test program didn't run right for some reason.)" ;;
18473 esac
18474 else
18475 dflt='4321'
18476 cat <<'EOM'
18477(I can't seem to compile the test program. Guessing big-endian...)
18478EOM
18479 fi
18480 case "$xxx_prompt" in
18481 y)
24412007 18482 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
18483 . ./myread
18484 byteorder="$ans"
18485 ;;
18486 *) byteorder=$dflt
18487 ;;
18488 esac
18489 ;;
18490 esac
5b813a60 18491 $rm_try
4e0554ec
JH
18492 ;;
18493esac
18494
613d6c3e 18495: Checking 32bit aligndness
4e0554ec
JH
18496$cat <<EOM
18497
18498Checking to see whether you can access character data unalignedly...
18499EOM
dc7b0a4f
JH
18500case "$d_u32align" in
18501'') $cat >try.c <<EOCP
4e0554ec 18502#include <stdio.h>
d1daaddf
JH
18503#$i_stdlib I_STDLIB
18504#ifdef I_STDLIB
18505#include <stdlib.h>
18506#endif
4e0554ec 18507#define U32 $u32type
d308175a
JH
18508#define BYTEORDER 0x$byteorder
18509#define U8 $u8type
9958dc3c
JH
18510#include <signal.h>
18511#ifdef SIGBUS
7090f861 18512$signal_t bletch(int s) { exit(4); }
9958dc3c 18513#endif
4e0554ec
JH
18514int main() {
18515#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
8906a23e 18516 U8 buf[8];
4e0554ec
JH
18517 U32 *up;
18518 int i;
18519
18520 if (sizeof(U32) != 4) {
18521 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18522 exit(1);
18523 }
18524
18525 fflush(stdout);
18526
9958dc3c
JH
18527#ifdef SIGBUS
18528 signal(SIGBUS, bletch);
18529#endif
18530
8906a23e
JH
18531 buf[0] = 0;
18532 buf[1] = 0;
18533 buf[2] = 0;
18534 buf[3] = 1;
7eac3fd6 18535 buf[4] = 0;
8906a23e
JH
18536 buf[5] = 0;
18537 buf[6] = 0;
7eac3fd6 18538 buf[7] = 1;
8906a23e 18539
4e0554ec
JH
18540 for (i = 0; i < 4; i++) {
18541 up = (U32*)(buf + i);
18542 if (! ((*up == 1 << (8*i)) || /* big-endian */
18543 (*up == 1 << (8*(3-i))) /* little-endian */
18544 )
18545 )
18546 {
18547 printf("read failed (%x)\n", *up);
18548 exit(2);
18549 }
18550 }
18551
18552 /* write test */
18553 for (i = 0; i < 4; i++) {
18554 up = (U32*)(buf + i);
18555 *up = 0xBeef;
18556 if (*up != 0xBeef) {
18557 printf("write failed (%x)\n", *up);
18558 exit(3);
18559 }
18560 }
18561
18562 exit(0);
18563#else
18564 printf("1\n");
18565 exit(1);
18566#endif
18567 return 0;
18568}
18569EOCP
18570set try
18571if eval $compile_ok; then
d308175a 18572 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 18573 $run ./try 2>&1 >/dev/null
4e0554ec
JH
18574 case "$?" in
18575 0) cat >&4 <<EOM
18576You can access character data pretty unalignedly.
18577EOM
18578 d_u32align="$undef"
18579 ;;
18580 *) cat >&4 <<EOM
18581It seems that you must access character data in an aligned manner.
18582EOM
18583 d_u32align="$define"
18584 ;;
18585 esac
4e0554ec
JH
18586else
18587 rp='Can you access character data at unaligned addresses?'
18588 dflt='n'
18589 . ./myread
18590 case "$ans" in
18591 [yY]*) d_u32align="$undef" ;;
18592 *) d_u32align="$define" ;;
18593 esac
18594fi
5b813a60 18595$rm_try
dc7b0a4f
JH
18596;;
18597esac
4e0554ec
JH
18598
18599: see if ualarm exists
18600set ualarm d_ualarm
18601eval $inlibc
18602
b4eb6b3d
JH
18603: see if umask exists
18604set umask d_umask
18605eval $inlibc
18606
758a5d79
JH
18607: see if unordered exists
18608set unordered d_unordered
18609eval $inlibc
18610
bdf33aa7
SP
18611: see if unsetenv exists
18612set unsetenv d_unsetenv
18613eval $inlibc
18614
4e0554ec
JH
18615: see if usleep exists
18616set usleep d_usleep
18617eval $inlibc
18618
2ef53570
JH
18619: see if prototype for usleep is available
18620echo " "
18621set d_usleepproto usleep $i_unistd unistd.h
18622eval $hasproto
18623
b4eb6b3d
JH
18624: see if ustat exists
18625set ustat d_ustat
18626eval $inlibc
18627
b4eb6b3d
JH
18628: see if closedir exists
18629set closedir d_closedir
18630eval $inlibc
18631
18632case "$d_closedir" in
18633"$define")
18634 echo " "
18635 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 18636 cat > try.c <<EOM
b4eb6b3d
JH
18637#$i_dirent I_DIRENT /**/
18638#$i_sysdir I_SYS_DIR /**/
18639#$i_sysndir I_SYS_NDIR /**/
18640#$i_systypes I_SYS_TYPES /**/
18641
18642#if defined(I_SYS_TYPES)
18643#include <sys/types.h>
18644#endif
18645#if defined(I_DIRENT)
18646#include <dirent.h>
18647#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18648#include <sys/dir.h>
18649#endif
18650#else
18651#ifdef I_SYS_NDIR
18652#include <sys/ndir.h>
18653#else
18654#ifdef I_SYS_DIR
18655#ifdef hp9000s500
18656#include <ndir.h> /* may be wrong in the future */
18657#else
18658#include <sys/dir.h>
18659#endif
18660#endif
18661#endif
5b813a60 18662#endif
b4eb6b3d
JH
18663int main() { return closedir(opendir(".")); }
18664EOM
5440bc8e 18665 set try
b4eb6b3d 18666 if eval $compile_ok; then
5440bc8e 18667 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
18668 echo "Yes, it does."
18669 val="$undef"
18670 else
18671 echo "No, it doesn't."
18672 val="$define"
18673 fi
18674 else
18675 echo "(I can't seem to compile the test program--assuming it doesn't)"
18676 val="$define"
18677 fi
18678 ;;
18679*)
18680 val="$undef";
18681 ;;
18682esac
18683set d_void_closedir
18684eval $setvar
5b813a60
MB
18685$rm_try
18686
b4eb6b3d
JH
18687: see if there is a wait4
18688set wait4 d_wait4
18689eval $inlibc
18690
18691: see if waitpid exists
18692set waitpid d_waitpid
18693eval $inlibc
18694
18695: see if wcstombs exists
18696set wcstombs d_wcstombs
18697eval $inlibc
18698
18699: see if wctomb exists
18700set wctomb d_wctomb
18701eval $inlibc
18702
4e0554ec
JH
18703: see if writev exists
18704set writev d_writev
18705eval $inlibc
18706
b4eb6b3d
JH
18707: preserve RCS keywords in files with variable substitution, grrr
18708Date='$Date'
18709Id='$Id'
18710Log='$Log'
18711RCSfile='$RCSfile'
18712Revision='$Revision'
18713
b4eb6b3d
JH
18714: check for alignment requirements
18715echo " "
5440bc8e 18716case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
18717*$define*)
18718 $cat <<EOM
18719You seem to be either cross-compiling or doing a multiarchitecture build,
18720skipping the memory alignment check.
18721
18722EOM
18723 case "$alignbytes" in
18724 '') alignbytes=8 ;;
18725 esac
18726 ;;
18727*)
18728 case "$alignbytes" in
18729 '') echo "Checking alignment constraints..." >&4
18730 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18731 $cat >try.c <<'EOCP'
18732typedef long double NV;
18733EOCP
18734 else
18735 $cat >try.c <<'EOCP'
18736typedef double NV;
18737EOCP
18738 fi
18739 $cat >>try.c <<'EOCP'
18740#include <stdio.h>
18741struct foobar {
18742 char foo;
18743 NV bar;
18744} try_algn;
18745int main()
18746{
18747 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18748 return(0);
18749}
18750EOCP
18751 set try
18752 if eval $compile_ok; then
5440bc8e 18753 dflt=`$run ./try`
b4eb6b3d
JH
18754 else
18755 dflt='8'
18756 echo "(I can't seem to compile the test program...)"
18757 fi
18758 ;;
18759 *) dflt="$alignbytes"
18760 ;;
18761 esac
18762 rp="Doubles must be aligned on a how-many-byte boundary?"
18763 . ./myread
18764 alignbytes="$ans"
5b813a60 18765 $rm_try
b4eb6b3d
JH
18766 ;;
18767esac
18768
18769
18770: set the base revision
18771baserev=5.0
18772
3099fc99 18773: how do we concatenate cpp tokens here?
b4eb6b3d 18774echo " "
3099fc99 18775echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
18776$cat >cpp_stuff.c <<'EOCP'
18777#define RCAT(a,b)a/**/b
18778#define ACAT(a,b)a ## b
18779RCAT(Rei,ser)
18780ACAT(Cir,cus)
18781EOCP
18782$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18783if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18784 echo "Oh! Smells like ANSI's been here." >&4
18785 echo "We can catify or stringify, separately or together!"
18786 cpp_stuff=42
18787elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18788 echo "Ah, yes! The good old days!" >&4
18789 echo "However, in the good old days we don't know how to stringify and"
18790 echo "catify at the same time."
18791 cpp_stuff=1
18792else
18793 $cat >&4 <<EOM
3099fc99
CW
18794Hmm, I don't seem to be able to concatenate tokens with your cpp.
18795You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
18796EOM
18797 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18798fi
18799$rm -f cpp_stuff.*
18800
18801: see if this is a db.h system
18802set db.h i_db
18803eval $inhdr
18804
18805case "$i_db" in
18806$define)
18807 : Check db version.
18808 echo " "
18809 echo "Checking Berkeley DB version ..." >&4
18810 $cat >try.c <<EOCP
18811#$d_const HASCONST
18812#ifndef HASCONST
18813#define const
18814#endif
18815#include <sys/types.h>
18816#include <stdio.h>
55954f19
JH
18817#$i_stdlib I_STDLIB
18818#ifdef I_STDLIB
18819#include <stdlib.h>
18820#endif
b4eb6b3d 18821#include <db.h>
640374d0 18822int main(int argc, char *argv[])
b4eb6b3d
JH
18823{
18824#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18825 int Major, Minor, Patch ;
18826 unsigned long Version ;
18827 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
18828 if (argc == 2) {
18829 printf("%d %d %d %d %d %d\n",
18830 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18831 Major, Minor, Patch);
18832 exit(0);
18833 }
18834 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
18835
18836 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18837 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18838 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18839 Major, Minor, Patch) ;
18840
18841 /* check that db.h & libdb are compatible */
18842 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 18843 printf("db.h and libdb are incompatible.\n") ;
5b813a60 18844 exit(3);
b4eb6b3d
JH
18845 }
18846
640374d0 18847 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
18848
18849 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18850 + DB_VERSION_PATCH ;
18851
18852 /* needs to be >= 2.3.4 */
18853 if (Version < 2003004) {
18854 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 18855 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
5b813a60 18856 exit(2);
b4eb6b3d
JH
18857 }
18858
18859 exit(0);
18860#else
18861#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
18862 if (argc == 2) {
18863 printf("1 0 0\n");
18864 exit(0);
18865 }
18866 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
18867 exit(0); /* DB version < 2: the coast is clear. */
18868#else
18869 exit(1); /* <db.h> not Berkeley DB? */
18870#endif
18871#endif
18872}
18873EOCP
18874 set try
5440bc8e 18875 if eval $compile_ok && $run ./try; then
b4eb6b3d 18876 echo 'Looks OK.' >&4
5440bc8e 18877 set `$run ./try 1`
640374d0
JH
18878 db_version_major=$1
18879 db_version_minor=$2
18880 db_version_patch=$3
b4eb6b3d
JH
18881 else
18882 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
18883 i_db=$undef
18884 case " $libs " in
18885 *"-ldb "*)
18886 : Remove db from list of libraries to use
18887 echo "Removing unusable -ldb from library list" >&4
18888 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18889 shift
18890 libs="$*"
18891 echo "libs = $libs" >&4
18892 ;;
18893 esac
18894 fi
5b813a60 18895 $rm_try
b4eb6b3d
JH
18896 ;;
18897esac
18898
18899case "$i_db" in
18900define)
5b813a60 18901 : Check the return type needed for hash
b4eb6b3d
JH
18902 echo " "
18903 echo "Checking return type needed for hash for Berkeley DB ..." >&4
18904 $cat >try.c <<EOCP
18905#$d_const HASCONST
18906#ifndef HASCONST
18907#define const
18908#endif
18909#include <sys/types.h>
18910#include <db.h>
18911
18912#ifndef DB_VERSION_MAJOR
18913u_int32_t hash_cb (ptr, size)
18914const void *ptr;
18915size_t size;
18916{
18917}
18918HASHINFO info;
18919int main()
18920{
18921 info.hash = hash_cb;
18922}
18923#endif
18924EOCP
18925 if $cc $ccflags -c try.c >try.out 2>&1 ; then
18926 if $contains warning try.out >>/dev/null 2>&1 ; then
18927 db_hashtype='int'
18928 else
18929 db_hashtype='u_int32_t'
18930 fi
18931 else
18932 : XXX Maybe we should just give up here.
18933 db_hashtype=u_int32_t
18934 $cat try.out >&4
18935 echo "Help: I can't seem to compile the db test program." >&4
18936 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18937 fi
5b813a60 18938 $rm_try
b4eb6b3d
JH
18939 echo "Your version of Berkeley DB uses $db_hashtype for hash."
18940 ;;
18941*) db_hashtype=u_int32_t
18942 ;;
18943esac
18944case "$i_db" in
18945define)
5b813a60 18946 : Check the return type needed for prefix
b4eb6b3d
JH
18947 echo " "
18948 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18949 cat >try.c <<EOCP
18950#$d_const HASCONST
18951#ifndef HASCONST
18952#define const
18953#endif
18954#include <sys/types.h>
18955#include <db.h>
18956
18957#ifndef DB_VERSION_MAJOR
18958size_t prefix_cb (key1, key2)
18959const DBT *key1;
18960const DBT *key2;
18961{
18962}
18963BTREEINFO info;
18964int main()
18965{
18966 info.prefix = prefix_cb;
18967}
18968#endif
18969EOCP
18970 if $cc $ccflags -c try.c >try.out 2>&1 ; then
18971 if $contains warning try.out >>/dev/null 2>&1 ; then
18972 db_prefixtype='int'
18973 else
18974 db_prefixtype='size_t'
18975 fi
18976 else
18977 db_prefixtype='size_t'
18978 : XXX Maybe we should just give up here.
18979 $cat try.out >&4
18980 echo "Help: I can't seem to compile the db test program." >&4
18981 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18982 fi
5b813a60 18983 $rm_try
b4eb6b3d
JH
18984 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18985 ;;
18986*) db_prefixtype='size_t'
18987 ;;
18988esac
18989
b4eb6b3d
JH
18990: How can we generate normalized random numbers ?
18991echo " "
18992echo "Looking for a random number function..." >&4
18993case "$randfunc" in
18994'')
18995 if set drand48 val -f; eval $csym; $val; then
18996 dflt="drand48"
18997 echo "Good, found drand48()." >&4
18998 elif set random val -f; eval $csym; $val; then
18999 dflt="random"
19000 echo "OK, found random()." >&4
19001 else
19002 dflt="rand"
19003 echo "Yick, looks like I have to use rand()." >&4
19004 fi
19005 echo " "
19006 ;;
19007*)
19008 dflt="$randfunc"
19009 ;;
19010esac
19011cont=true
19012
19013case "$ccflags" in
19014*-Dmy_rand=*|*-Dmy_srand=*)
19015 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19016 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19017 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19018 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19019 ;;
19020esac
19021
19022while $test "$cont"; do
19023 rp="Use which function to generate random numbers?"
19024 . ./myread
19025 if $test "$ans" = "$dflt"; then
19026 : null
19027 else
19028 randbits=''
19029 fi
19030 randfunc="$ans"
19031 if set $ans val -f; eval $csym; $val; then
19032 cont=''
19033 else
19034 dflt=y
19035 rp="I cannot find function $ans. Use that name anyway?"
19036 . ./myread
19037 dflt=rand
19038 case "$ans" in
19039 [yY]*) cont='';;
19040 esac
19041 fi
19042 case "$cont" in
19043 '')
19044 case "$randfunc" in
19045 drand48)
19046 drand01="drand48()"
19047 seedfunc="srand48"
19048 randbits=48
19049 randseedtype=long
19050 ;;
19051 rand|random)
19052 case "$randbits" in
19053 '')
19054echo "Checking to see how many bits your $randfunc() function produces..." >&4
19055 $cat >try.c <<EOCP
19056#$i_unistd I_UNISTD
19057#$i_stdlib I_STDLIB
19058#include <stdio.h>
19059#ifdef I_UNISTD
19060# include <unistd.h>
19061#endif
19062#ifdef I_STDLIB
19063# include <stdlib.h>
19064#endif
19065int main()
19066{
19067 register int i;
19068 register unsigned long tmp;
19069 register unsigned long max = 0L;
19070
19071 for (i = 1000; i; i--) {
19072 tmp = (unsigned long) $randfunc();
19073 if (tmp > max) max = tmp;
19074 }
19075 for (i = 0; max; i++)
19076 max /= 2;
19077 printf("%d\n",i);
19078}
19079EOCP
19080 set try
19081 if eval $compile_ok; then
19082 dflt=`try`
19083 else
19084 dflt='?'
19085 echo "(I can't seem to compile the test program...)"
19086 fi
19087 ;;
19088 *)
19089 dflt="$randbits"
19090 ;;
19091 esac
19092 rp="How many bits does your $randfunc() function produce?"
19093 . ./myread
19094 randbits="$ans"
5b813a60 19095 $rm_try
b4eb6b3d
JH
19096 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19097 seedfunc="s$randfunc"
19098 randseedtype=unsigned
19099 ;;
19100 *)
19101 dflt="31"
19102 rp="How many bits does your $randfunc() function produce?"
19103 . ./myread
19104 randbits="$ans"
19105 seedfunc="s$randfunc"
19106 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19107 if set $seedfunc val -f; eval $csym; $val; then
19108 echo "(Using $seedfunc() to seed random generator)"
19109 else
19110 echo "(Warning: no $seedfunc() to seed random generator)"
19111 seedfunc=rand
19112 fi
19113 randseedtype=unsigned
19114 ;;
19115 esac
19116 ;;
19117 esac
19118done
19119
613d6c3e 19120: Determine if this is an EBCDIC system
b4eb6b3d
JH
19121echo " "
19122echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 19123$cat >try.c <<'EOM'
b4eb6b3d
JH
19124int main()
19125{
19126 if ('M'==0xd4) return 0;
19127 return 1;
19128}
19129EOM
19130
19131val=$undef
5440bc8e 19132set try
b4eb6b3d 19133if eval $compile_ok; then
5440bc8e 19134 if $run ./try; then
b4eb6b3d
JH
19135 echo "You seem to speak EBCDIC." >&4
19136 val="$define"
19137 else
5440bc8e 19138 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
19139 fi
19140else
19141 echo "I'm unable to compile the test program." >&4
19142 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19143fi
5b813a60 19144$rm_try
b4eb6b3d
JH
19145set ebcdic
19146eval $setvar
19147
613d6c3e 19148: Check how to flush
b4eb6b3d
JH
19149echo " "
19150$cat >&4 <<EOM
19151Checking how to flush all pending stdio output...
19152EOM
19153# I only know how to find the first 32 possibly open files on SunOS.
19154# See also hints/sunos_4_1.sh and util.c --AD
19155case "$osname" in
19156sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19157esac
19158$cat >>try.c <<EOCP
19159#include <stdio.h>
55954f19
JH
19160#$i_stdlib I_STDLIB
19161#ifdef I_STDLIB
19162#include <stdlib.h>
19163#endif
b4eb6b3d
JH
19164#$i_unistd I_UNISTD
19165#ifdef I_UNISTD
19166# include <unistd.h>
19167#endif
19168#$d_sysconf HAS_SYSCONF
19169#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19170#ifdef HAS_STDIO_STREAM_ARRAY
19171# define STDIO_STREAM_ARRAY $stdio_stream_array
19172#endif
19173int main() {
5440bc8e
JH
19174 FILE* p;
19175 unlink("try.out");
19176 p = fopen("try.out", "w");
b4eb6b3d
JH
19177#ifdef TRY_FPUTC
19178 fputc('x', p);
19179#else
19180# ifdef TRY_FPRINTF
19181 fprintf(p, "x");
19182# endif
19183#endif
19184#ifdef TRY_FFLUSH_NULL
19185 fflush(NULL);
19186#endif
19187#ifdef TRY_FFLUSH_ALL
19188 {
19189 long open_max = -1;
19190# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19191 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19192# else
19193# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19194 open_max = sysconf(_SC_OPEN_MAX);
19195# else
19196# ifdef FOPEN_MAX
19197 open_max = FOPEN_MAX;
19198# else
19199# ifdef OPEN_MAX
19200 open_max = OPEN_MAX;
19201# else
19202# ifdef _NFILE
19203 open_max = _NFILE;
19204# endif
19205# endif
19206# endif
19207# endif
5b813a60 19208# endif
b4eb6b3d
JH
19209# ifdef HAS_STDIO_STREAM_ARRAY
19210 if (open_max > 0) {
19211 long i;
19212 for (i = 0; i < open_max; i++)
19213 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19214 STDIO_STREAM_ARRAY[i]._file < open_max &&
19215 STDIO_STREAM_ARRAY[i]._flag)
19216 fflush(&STDIO_STREAM_ARRAY[i]);
5b813a60 19217 }
b4eb6b3d
JH
19218 }
19219# endif
19220#endif
19221 _exit(42);
19222}
19223EOCP
19224: first we have to find out how _not_ to flush
5440bc8e 19225$to try.c
b4eb6b3d
JH
19226if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19227 output=''
19228 set try -DTRY_FPUTC
19229 if eval $compile; then
fbe73d74 19230 $run ./try 2>/dev/null
28f5ac64 19231 code="$?"
5440bc8e 19232 $from try.out
28f5ac64 19233 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19234 output=-DTRY_FPUTC
19235 fi
19236 fi
19237 case "$output" in
19238 '')
19239 set try -DTRY_FPRINTF
b4eb6b3d 19240 if eval $compile; then
fbe73d74 19241 $run ./try 2>/dev/null
28f5ac64 19242 code="$?"
5440bc8e 19243 $from try.out
28f5ac64 19244 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19245 output=-DTRY_FPRINTF
19246 fi
19247 fi
19248 ;;
19249 esac
19250fi
19251: check for fflush NULL behaviour
19252case "$fflushNULL" in
19253'') set try -DTRY_FFLUSH_NULL $output
19254 if eval $compile; then
5440bc8e 19255 $run ./try 2>/dev/null
b4eb6b3d 19256 code="$?"
5440bc8e 19257 $from try.out
b4eb6b3d
JH
19258 if $test -s try.out -a "X$code" = X42; then
19259 fflushNULL="`$cat try.out`"
19260 else
19261 if $test "X$code" != X42; then
19262 $cat >&4 <<EOM
19263(If this test failed, don't worry, we'll try another method shortly.)
19264EOM
19265 fi
19266 fi
19267 fi
2c476adc 19268 $rm -f core try.core core.try.*
b4eb6b3d
JH
19269 case "$fflushNULL" in
19270 x) $cat >&4 <<EOM
19271Your fflush(NULL) works okay for output streams.
19272Let's see if it clobbers input pipes...
19273EOM
19274# As of mid-March 2000 all versions of Solaris appear to have a stdio
19275# bug that improperly flushes the input end of pipes. So we avoid the
19276# autoflush on fork/system/exec support for now. :-(
19277$cat >tryp.c <<EOCP
19278#include <stdio.h>
19279int
19280main(int argc, char **argv)
19281{
19282 char buf[1024];
19283 int i;
19284 char *bp = buf;
19285 while (1) {
19286 while ((i = getc(stdin)) != -1
19287 && (*bp++ = i) != '\n'
19288 && bp < &buf[1024])
19289 /* DO NOTHING */ ;
19290 *bp = '\0';
19291 fprintf(stdout, "%s", buf);
19292 fflush(NULL);
19293 if (i == -1)
19294 return 0;
19295 bp = buf;
19296 }
19297}
19298EOCP
19299 fflushNULL="$define"
19300 set tryp
19301 if eval $compile; then
19302 $rm -f tryp.out
5440bc8e 19303 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
19304 if cmp tryp.c tryp.out >/dev/null 2>&1; then
19305 $cat >&4 <<EOM
19306fflush(NULL) seems to behave okay with input streams.
19307EOM
19308 fflushNULL="$define"
19309 else
19310 $cat >&4 <<EOM
19311Ouch, fflush(NULL) clobbers input pipes! We will not use it.
19312EOM
19313 fflushNULL="$undef"
19314 fi
19315 fi
19316 $rm -f core tryp.c tryp.core core.tryp.*
19317 ;;
19318 '') $cat >&4 <<EOM
19319Your fflush(NULL) isn't working (contrary to ANSI C).
19320EOM
19321 fflushNULL="$undef"
19322 ;;
19323 *) $cat >&4 <<EOM
19324Cannot figure out whether your fflush(NULL) works or not.
19325I'm assuming it doesn't (contrary to ANSI C).
19326EOM
19327 fflushNULL="$undef"
19328 ;;
19329 esac
19330 ;;
19331$define|true|[yY]*)
19332 fflushNULL="$define"
19333 ;;
19334*)
19335 fflushNULL="$undef"
19336 ;;
19337esac
19338: check explicit looping only if NULL did not work, and if the pipe
19339: bug does not show up on an explicit flush too
19340case "$fflushNULL" in
19341"$undef")
19342 $cat >tryp.c <<EOCP
19343#include <stdio.h>
19344int
19345main(int argc, char **argv)
19346{
19347 char buf[1024];
19348 int i;
19349 char *bp = buf;
19350 while (1) {
19351 while ((i = getc(stdin)) != -1
19352 && (*bp++ = i) != '\n'
19353 && bp < &buf[1024])
19354 /* DO NOTHING */ ;
19355 *bp = '\0';
19356 fprintf(stdout, "%s", buf);
19357 fflush(stdin);
19358 if (i == -1)
19359 return 0;
19360 bp = buf;
19361 }
19362}
19363EOCP
19364 set tryp
19365 if eval $compile; then
19366 $rm -f tryp.out
5440bc8e 19367 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
19368 if cmp tryp.c tryp.out >/dev/null 2>&1; then
19369 $cat >&4 <<EOM
19370Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19371EOM
19372 : now check for fflushall behaviour
19373 case "$fflushall" in
19374 '') set try -DTRY_FFLUSH_ALL $output
19375 if eval $compile; then
19376 $cat >&4 <<EOM
19377(Now testing the other method--but note that this also may fail.)
19378EOM
5440bc8e 19379 $run ./try 2>/dev/null
28f5ac64 19380 code=$?
fbe73d74 19381 $from try.out
28f5ac64 19382 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19383 fflushall="`$cat try.out`"
19384 fi
19385 fi
5b813a60 19386 $rm_try
b4eb6b3d
JH
19387 case "$fflushall" in
19388 x) $cat >&4 <<EOM
19389Whew. Flushing explicitly all the stdio streams works.
19390EOM
19391 fflushall="$define"
19392 ;;
19393 '') $cat >&4 <<EOM
19394Sigh. Flushing explicitly all the stdio streams doesn't work.
19395EOM
19396 fflushall="$undef"
19397 ;;
19398 *) $cat >&4 <<EOM
19399Cannot figure out whether flushing stdio streams explicitly works or not.
19400I'm assuming it doesn't.
19401EOM
19402 fflushall="$undef"
19403 ;;
19404 esac
19405 ;;
19406 "$define"|true|[yY]*)
19407 fflushall="$define"
19408 ;;
19409 *)
19410 fflushall="$undef"
19411 ;;
19412 esac
19413 else
19414 $cat >&4 <<EOM
19415All is futile. Even fflush(stdin) clobbers input pipes!
19416EOM
19417 fflushall="$undef"
19418 fi
19419 else
19420 fflushall="$undef"
19421 fi
19422 $rm -f core tryp.c tryp.core core.tryp.*
19423 ;;
19424*) fflushall="$undef"
19425 ;;
19426esac
19427
19428case "$fflushNULL$fflushall" in
19429undefundef)
19430 $cat <<EOM
19431OK, I give up. I cannot figure out how to flush pending stdio output.
19432We won't be flushing handles at all before fork/exec/popen.
19433EOM
19434 ;;
19435esac
34f1896b 19436$rm_try tryp
b4eb6b3d
JH
19437
19438: Store the full pathname to the ar program for use in the C program
19439: Respect a hint or command line value for full_ar.
19440case "$full_ar" in
19441'') full_ar=$ar ;;
19442esac
19443
19444: Store the full pathname to the sed program for use in the C program
19445full_sed=$sed
19446
19447: see what type gids are declared as in the kernel
19448echo " "
19449echo "Looking for the type for group ids returned by getgid()."
19450set gid_t gidtype xxx stdio.h sys/types.h
19451eval $typedef
19452case "$gidtype" in
19453xxx)
19454 xxx=`./findhdr sys/user.h`
19455 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19456 case $1 in
19457 unsigned) dflt="$1 $2" ;;
19458 *) dflt="$1" ;;
19459 esac
19460 ;;
19461*) dflt="$gidtype";;
19462esac
19463case "$gidtype" in
19464gid_t) echo "gid_t found." ;;
19465*) rp="What is the type for group ids returned by getgid()?"
19466 . ./myread
19467 gidtype="$ans"
19468 ;;
19469esac
19470
613d6c3e 19471: Check the size of GID
b4eb6b3d
JH
19472echo " "
19473case "$gidtype" in
19474*_t) zzz="$gidtype" ;;
19475*) zzz="gid" ;;
19476esac
613d6c3e 19477echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
19478cat > try.c <<EOCP
19479#include <sys/types.h>
19480#include <stdio.h>
d1daaddf
JH
19481#$i_stdlib I_STDLIB
19482#ifdef I_STDLIB
19483#include <stdlib.h>
19484#endif
b4eb6b3d
JH
19485int main() {
19486 printf("%d\n", (int)sizeof($gidtype));
19487 exit(0);
19488}
19489EOCP
19490set try
19491if eval $compile_ok; then
5440bc8e 19492 yyy=`$run ./try`
b4eb6b3d
JH
19493 case "$yyy" in
19494 '') gidsize=4
19495 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19496 ;;
19497 *) gidsize=$yyy
19498 echo "Your $zzz is $gidsize bytes long."
19499 ;;
19500 esac
19501else
19502 gidsize=4
19503 echo "(I can't compile the test program--guessing $gidsize.)" >&4
19504fi
19505
19506
613d6c3e 19507: Check if GID is signed
b4eb6b3d
JH
19508echo " "
19509case "$gidtype" in
19510*_t) zzz="$gidtype" ;;
19511*) zzz="gid" ;;
19512esac
613d6c3e 19513echo "Checking the sign of $zzz..." >&4
b4eb6b3d
JH
19514cat > try.c <<EOCP
19515#include <sys/types.h>
19516#include <stdio.h>
19517int main() {
19518 $gidtype foo = -1;
19519 if (foo < 0)
19520 printf("-1\n");
19521 else
19522 printf("1\n");
19523}
19524EOCP
19525set try
19526if eval $compile; then
5440bc8e 19527 yyy=`$run ./try`
b4eb6b3d
JH
19528 case "$yyy" in
19529 '') gidsign=1
19530 echo "(I can't execute the test program--guessing unsigned.)" >&4
19531 ;;
19532 *) gidsign=$yyy
19533 case "$gidsign" in
19534 1) echo "Your $zzz is unsigned." ;;
19535 -1) echo "Your $zzz is signed." ;;
19536 esac
19537 ;;
19538 esac
19539else
19540 gidsign=1
19541 echo "(I can't compile the test program--guessing unsigned.)" >&4
19542fi
19543
19544
613d6c3e 19545: Check 64bit sizes
b4eb6b3d
JH
19546echo " "
19547
19548if $test X"$quadtype" != X; then
19549
19550echo "Checking how to print 64-bit integers..." >&4
19551
19552if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19553 $cat >try.c <<'EOCP'
19554#include <sys/types.h>
19555#include <stdio.h>
19556int main() {
19557 int q = 12345678901;
19558 printf("%ld\n", q);
19559}
19560EOCP
19561 set try
19562 if eval $compile; then
5440bc8e 19563 yyy=`$run ./try`
b4eb6b3d
JH
19564 case "$yyy" in
19565 12345678901)
19566 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19567 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19568 echo "We will use %d."
19569 ;;
19570 esac
19571 fi
19572fi
19573
19574if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19575 $cat >try.c <<'EOCP'
19576#include <sys/types.h>
19577#include <stdio.h>
19578int main() {
19579 long q = 12345678901;
19580 printf("%ld\n", q);
19581}
19582EOCP
19583 set try
19584 if eval $compile; then
5440bc8e 19585 yyy=`$run ./try`
b4eb6b3d
JH
19586 case "$yyy" in
19587 12345678901)
19588 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19589 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19590 echo "We will use %ld."
19591 ;;
19592 esac
19593 fi
19594fi
19595
19596if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19597 $cat >try.c <<'EOCP'
19598#include <sys/types.h>
19599#include <inttypes.h>
19600#include <stdio.h>
19601int main() {
19602 int64_t q = 12345678901;
19603 printf("%" PRId64 "\n", q);
19604}
19605EOCP
19606 set try
19607 if eval $compile; then
5440bc8e 19608 yyy=`$run ./try`
b4eb6b3d
JH
19609 case "$yyy" in
19610 12345678901)
19611 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19612 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19613 echo "We will use the C9X style."
19614 ;;
19615 esac
19616 fi
19617fi
19618
2ef53570
JH
19619if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19620 $cat >try.c <<EOCP
b4eb6b3d
JH
19621#include <sys/types.h>
19622#include <stdio.h>
19623int main() {
2ef53570
JH
19624 $quadtype q = 12345678901;
19625 printf("%Ld\n", q);
b4eb6b3d
JH
19626}
19627EOCP
19628 set try
19629 if eval $compile; then
5440bc8e 19630 yyy=`$run ./try`
b4eb6b3d
JH
19631 case "$yyy" in
19632 12345678901)
2ef53570
JH
19633 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19634 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19635 echo "We will use %Ld."
b4eb6b3d
JH
19636 ;;
19637 esac
19638 fi
19639fi
19640
2ef53570
JH
19641if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19642 $cat >try.c <<'EOCP'
b4eb6b3d
JH
19643#include <sys/types.h>
19644#include <stdio.h>
19645int main() {
2ef53570
JH
19646 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19647 printf("%lld\n", q);
b4eb6b3d
JH
19648}
19649EOCP
19650 set try
19651 if eval $compile; then
5440bc8e 19652 yyy=`$run ./try`
b4eb6b3d
JH
19653 case "$yyy" in
19654 12345678901)
2ef53570
JH
19655 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19656 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19657 echo "We will use the %lld style."
b4eb6b3d
JH
19658 ;;
19659 esac
19660 fi
19661fi
19662
19663if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19664 $cat >try.c <<EOCP
19665#include <sys/types.h>
19666#include <stdio.h>
19667int main() {
19668 $quadtype q = 12345678901;
19669 printf("%qd\n", q);
19670}
19671EOCP
19672 set try
19673 if eval $compile; then
5440bc8e 19674 yyy=`$run ./try`
b4eb6b3d
JH
19675 case "$yyy" in
19676 12345678901)
19677 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19678 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19679 echo "We will use %qd."
19680 ;;
19681 esac
19682 fi
19683fi
19684
19685if $test X"$sPRId64" = X; then
19686 echo "Cannot figure out how to print 64-bit integers." >&4
19687fi
5b813a60 19688$rm_try
b4eb6b3d
JH
19689
19690fi
19691
19692case "$sPRId64" in
5b813a60
MB
19693'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19694 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
b4eb6b3d 19695 ;;
5b813a60
MB
19696*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19697 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
b4eb6b3d
JH
19698 ;;
19699esac
19700
34f1896b 19701: Check format strings for internal types
b4eb6b3d
JH
19702echo " "
19703$echo "Checking the format strings to be used for Perl's internal types..." >&4
19704
19705if $test X"$ivsize" = X8; then
19706 ivdformat="$sPRId64"
19707 uvuformat="$sPRIu64"
19708 uvoformat="$sPRIo64"
19709 uvxformat="$sPRIx64"
19710 uvXUformat="$sPRIXU64"
19711else
19712 if $test X"$ivsize" = X"$longsize"; then
19713 ivdformat='"ld"'
19714 uvuformat='"lu"'
19715 uvoformat='"lo"'
19716 uvxformat='"lx"'
19717 uvXUformat='"lX"'
19718 else
19719 if $test X"$ivsize" = X"$intsize"; then
19720 ivdformat='"d"'
19721 uvuformat='"u"'
19722 uvoformat='"o"'
19723 uvxformat='"x"'
19724 uvXUformat='"X"'
19725 else
19726 : far out
19727 if $test X"$ivsize" = X"$shortsize"; then
19728 ivdformat='"hd"'
19729 uvuformat='"hu"'
19730 uvoformat='"ho"'
19731 uvxformat='"hx"'
19732 uvXUformat='"hX"'
19733 fi
19734 fi
19735 fi
19736fi
19737
19738if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19739 nveformat="$sPRIeldbl"
19740 nvfformat="$sPRIfldbl"
19741 nvgformat="$sPRIgldbl"
19742 nvEUformat="$sPRIEUldbl"
19743 nvFUformat="$sPRIFUldbl"
19744 nvGUformat="$sPRIGUldbl"
19745else
19746 nveformat='"e"'
19747 nvfformat='"f"'
19748 nvgformat='"g"'
19749 nvEUformat='"E"'
19750 nvFUformat='"F"'
19751 nvGUformat='"G"'
19752fi
19753
19754case "$ivdformat" in
3c728e00 19755'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
19756 exit 1
19757 ;;
19758esac
19759
34f1896b 19760: Check format string for GID
b4eb6b3d
JH
19761
19762echo " "
19763$echo "Checking the format string to be used for gids..." >&4
19764
19765case "$gidsign" in
19766-1) if $test X"$gidsize" = X"$ivsize"; then
19767 gidformat="$ivdformat"
19768 else
19769 if $test X"$gidsize" = X"$longsize"; then
19770 gidformat='"ld"'
19771 else
19772 if $test X"$gidsize" = X"$intsize"; then
19773 gidformat='"d"'
19774 else
19775 if $test X"$gidsize" = X"$shortsize"; then
19776 gidformat='"hd"'
19777 fi
19778 fi
19779 fi
19780 fi
19781 ;;
19782*) if $test X"$gidsize" = X"$uvsize"; then
19783 gidformat="$uvuformat"
19784 else
19785 if $test X"$gidsize" = X"$longsize"; then
19786 gidformat='"lu"'
19787 else
19788 if $test X"$gidsize" = X"$intsize"; then
19789 gidformat='"u"'
19790 else
19791 if $test X"$gidsize" = X"$shortsize"; then
19792 gidformat='"hu"'
19793 fi
19794 fi
19795 fi
19796 fi
19797 ;;
19798esac
19799
19800: see if getgroups exists
19801set getgroups d_getgrps
19802eval $inlibc
19803
19804: see if setgroups exists
19805set setgroups d_setgrps
19806eval $inlibc
19807
b4eb6b3d
JH
19808: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19809echo " "
19810case "$d_getgrps$d_setgrps" in
19811*define*)
19812 case "$groupstype" in
19813 '') dflt="$gidtype" ;;
19814 *) dflt="$groupstype" ;;
19815 esac
19816 $cat <<EOM
19817What type of pointer is the second argument to getgroups() and setgroups()?
19818Usually this is the same as group ids, $gidtype, but not always.
19819
19820EOM
19821 rp='What type pointer is the second argument to getgroups() and setgroups()?'
19822 . ./myread
19823 groupstype="$ans"
19824 ;;
19825*) groupstype="$gidtype";;
19826esac
19827
613d6c3e 19828: MAD = Misc Attribute Definition
d620c7b3 19829
fd655d33
NC
19830if $test $patchlevel -lt 9; then
19831: MAD is not available in 5.8.x or earlier.
19832 ans=n;
19833else
19834 case "$mad" in
19835 $define|true|[yY]*) dflt='y' ;;
19836 *) dflt='n' ;;
19837 esac
19838 cat <<EOM
d620c7b3
MB
19839
19840Would you like to build with Misc Attribute Decoration? This is development
19841work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19842overhead on the interpreter.
19843
19844If this doesn't make any sense to you, just accept the default '$dflt'.
19845EOM
fd655d33
NC
19846 rp='Build Perl with MAD?'
19847 . ./myread
19848fi
d620c7b3 19849case "$ans" in
00e74f14
NC
19850y|Y) val="$define"
19851 madlyh='madly.h madly.act madly.tab'
19852 madlysrc='madly.c'
19853 madlyobj="madly$_o" ;;
19854*) val="$undef"
19855 madlyh=''
19856 madlysrc=''
19857 madlyobj='' ;;
d620c7b3
MB
19858esac
19859set mad
19860eval $setvar
19861
216dac04 19862: check whether make sets MAKE
b4eb6b3d
JH
19863echo " "
19864echo "Checking if your $make program sets \$(MAKE)..." >&4
19865case "$make_set_make" in
19866'')
19867 $sed 's/^X //' > testmake.mak << 'EOF'
19868Xall:
19869X @echo 'maketemp="$(MAKE)"'
19870EOF
19871 case "`$make -f testmake.mak 2>/dev/null`" in
19872 *maketemp=*) make_set_make='#' ;;
19873 *) make_set_make="MAKE=$make" ;;
19874 esac
19875 $rm -f testmake.mak
19876 ;;
19877esac
19878case "$make_set_make" in
19879'#') echo "Yup, it does.";;
19880*) echo "Nope, it doesn't.";;
19881esac
19882
19883: see what type is used for mode_t
19884rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19885set mode_t modetype int stdio.h sys/types.h
19886eval $typedef_ask
19887
2cc61e15
DD
19888: see if we need va_copy
19889echo " "
19890case "$i_stdarg" in
19891"$define")
19892 $cat >try.c <<EOCP
19893#include <stdarg.h>
19894#include <stdio.h>
85c8a686
DD
19895#$i_stdlib I_STDLIB
19896#ifdef I_STDLIB
19897#include <stdlib.h>
19898#endif
19899#include <signal.h>
2cc61e15
DD
19900
19901int
19902ivfprintf(FILE *f, const char *fmt, va_list *valp)
19903{
19904 return vfprintf(f, fmt, *valp);
19905}
5b813a60
MB
19906
19907int
2cc61e15
DD
19908myvfprintf(FILE *f, const char *fmt, va_list val)
19909{
19910 return ivfprintf(f, fmt, &val);
19911}
5b813a60 19912
2cc61e15 19913int
5b813a60 19914myprintf(char *fmt, ...)
2cc61e15
DD
19915{
19916 va_list val;
19917 va_start(val, fmt);
5b813a60
MB
19918 return myvfprintf(stdout, fmt, val);
19919}
2cc61e15
DD
19920
19921int
19922main(int ac, char **av)
19923{
85c8a686
DD
19924 signal(SIGSEGV, exit);
19925
5b813a60
MB
19926 myprintf("%s%cs all right, then\n", "that", '\'');
19927 exit(0);
2cc61e15
DD
19928}
19929EOCP
19930 set try
5440bc8e
JH
19931 if eval $compile && $run ./try 2>&1 >/dev/null; then
19932 case "`$run ./try`" in
2cc61e15
DD
19933 "that's all right, then")
19934 okay=yes
19935 ;;
19936 esac
19937 fi
19938 case "$okay" in
19939 yes) echo "It seems that you don't need va_copy()." >&4
19940 need_va_copy="$undef"
19941 ;;
19942 *) echo "It seems that va_copy() or similar will be needed." >&4
19943 need_va_copy="$define"
19944 ;;
19945 esac
5b813a60 19946 $rm_try
2cc61e15
DD
19947 ;;
19948*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19949 ;;
19950esac
19951
b4eb6b3d
JH
19952: see what type is used for size_t
19953rp="What is the type used for the length parameter for string functions?"
19954set size_t sizetype 'unsigned int' stdio.h sys/types.h
19955eval $typedef_ask
19956
19957: check for type of arguments to gethostbyaddr.
19958if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19959 case "$d_gethbyaddr" in
19960 $define)
19961 $cat <<EOM
19962
19963Checking to see what type of arguments are accepted by gethostbyaddr().
19964EOM
19965 hdrs="$define sys/types.h
19966 $d_socket sys/socket.h
19967 $i_niin netinet/in.h
19968 $i_netdb netdb.h
19969 $i_unistd unistd.h"
19970 : The first arg can 'char *' or 'void *'
19971 : The second arg is some of integral type
19972 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19973 for yyy in size_t long int; do
19974 case "$netdb_host_type" in
61c26d18 19975 '') try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
b4eb6b3d
JH
19976 if ./protochk "$try" $hdrs; then
19977 echo "Your system accepts $xxx for the first arg."
19978 echo "...and $yyy for the second arg."
19979 netdb_host_type="$xxx"
19980 netdb_hlen_type="$yyy"
19981 fi
19982 ;;
19983 esac
19984 done
19985 done
19986 : In case none of those worked, prompt the user.
19987 case "$netdb_host_type" in
19988 '') rp='What is the type for the 1st argument to gethostbyaddr?'
19989 dflt='char *'
19990 . ./myread
19991 netdb_host_type=$ans
19992 rp='What is the type for the 2nd argument to gethostbyaddr?'
19993 dflt="$sizetype"
19994 . ./myread
19995 netdb_hlen_type=$ans
19996 ;;
19997 esac
19998 ;;
19999 *) : no gethostbyaddr, so pick harmless defaults
20000 netdb_host_type='char *'
20001 netdb_hlen_type="$sizetype"
20002 ;;
20003 esac
20004 # Remove the "const" if needed. -- but then we'll have a
20005 # prototype clash!
20006 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20007fi
20008
20009: check for type of argument to gethostbyname.
20010if test "X$netdb_name_type" = X ; then
20011 case "$d_gethbyname" in
20012 $define)
20013 $cat <<EOM
20014
20015Checking to see what type of argument is accepted by gethostbyname().
20016EOM
20017 hdrs="$define sys/types.h
20018 $d_socket sys/socket.h
20019 $i_niin netinet/in.h
20020 $i_netdb netdb.h
20021 $i_unistd unistd.h"
20022 for xxx in "const char *" "char *"; do
20023 case "$netdb_name_type" in
61c26d18 20024 '') try="$extern_C struct hostent *gethostbyname($xxx);"
b4eb6b3d
JH
20025 if ./protochk "$try" $hdrs; then
20026 echo "Your system accepts $xxx."
20027 netdb_name_type="$xxx"
20028 fi
20029 ;;
20030 esac
20031 done
20032 : In case none of those worked, prompt the user.
20033 case "$netdb_name_type" in
20034 '') rp='What is the type for the 1st argument to gethostbyname?'
20035 dflt='char *'
20036 . ./myread
20037 netdb_name_type=$ans
20038 ;;
20039 esac
20040 ;;
20041 *) : no gethostbyname, so pick harmless default
20042 netdb_name_type='char *'
20043 ;;
20044 esac
20045fi
20046
20047: check for type of 1st argument to getnetbyaddr.
20048if test "X$netdb_net_type" = X ; then
20049 case "$d_getnbyaddr" in
20050 $define)
20051 $cat <<EOM
20052
20053Checking to see what type of 1st argument is accepted by getnetbyaddr().
20054EOM
20055 hdrs="$define sys/types.h
20056 $d_socket sys/socket.h
20057 $i_niin netinet/in.h
20058 $i_netdb netdb.h
20059 $i_unistd unistd.h"
20060 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20061 case "$netdb_net_type" in
61c26d18 20062 '') try="$extern_C struct netent *getnetbyaddr($xxx, int);"
b4eb6b3d
JH
20063 if ./protochk "$try" $hdrs; then
20064 echo "Your system accepts $xxx."
20065 netdb_net_type="$xxx"
20066 fi
20067 ;;
20068 esac
20069 done
20070 : In case none of those worked, prompt the user.
20071 case "$netdb_net_type" in
20072 '') rp='What is the type for the 1st argument to getnetbyaddr?'
20073 dflt='long'
20074 . ./myread
20075 netdb_net_type=$ans
20076 ;;
20077 esac
20078 ;;
20079 *) : no getnetbyaddr, so pick harmless default
20080 netdb_net_type='long'
20081 ;;
20082 esac
20083fi
20084: locate the preferred pager for this system
d604bb53 20085fn=f/
b4eb6b3d
JH
20086case "$pager" in
20087'')
20088 dflt=''
20089 case "$pg" in
20090 /*) dflt=$pg;;
20091 [a-zA-Z]:/*) dflt=$pg;;
20092 esac
20093 case "$more" in
20094 /*) dflt=$more;;
20095 [a-zA-Z]:/*) dflt=$more;;
20096 esac
20097 case "$less" in
20098 /*) dflt=$less;;
20099 [a-zA-Z]:/*) dflt=$less;;
20100 esac
20101 case "$dflt" in
20102 '') dflt=/usr/ucb/more;;
20103 esac
20104 ;;
d604bb53 20105*) dflt="$pager"
d604bb53
JH
20106 fn="f/($pager)"
20107 ;;
b4eb6b3d
JH
20108esac
20109echo " "
b4eb6b3d
JH
20110rp='What pager is used on your system?'
20111. ./getfile
20112pager="$ans"
20113
20114: see what type pids are declared as in the kernel
20115rp="What is the type of process ids on this system?"
20116set pid_t pidtype int stdio.h sys/types.h
20117eval $typedef_ask
20118
b4eb6b3d
JH
20119: see if ar generates random libraries by itself
20120echo " "
20121echo "Checking how to generate random libraries on your machine..." >&4
20122echo 'int bar1() { return bar2(); }' > bar1.c
20123echo 'int bar2() { return 2; }' > bar2.c
55954f19
JH
20124$cat > foo.c <<EOP
20125#$i_stdlib I_STDLIB
20126#ifdef I_STDLIB
20127#include <stdlib.h>
20128#endif
b4eb6b3d
JH
20129int main() { printf("%d\n", bar1()); exit(0); }
20130EOP
20131$cc $ccflags -c bar1.c >/dev/null 2>&1
20132$cc $ccflags -c bar2.c >/dev/null 2>&1
20133$cc $ccflags -c foo.c >/dev/null 2>&1
20134$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 20135if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 20136 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
20137 echo "$ar appears to generate random libraries itself."
20138 orderlib=false
e39a9d84
LC
20139 if [ "X$ranlib" = "X" ]; then
20140 ranlib=":"
20141 fi
88d4d47b
PC
20142elif $ar s bar$_a >/dev/null 2>&1 &&
20143 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20144 $run ./foobar >/dev/null 2>&1; then
20145 echo "a table of contents needs to be added with '$ar s'."
20146 orderlib=false
20147 ranlib="$ar s"
b4eb6b3d 20148elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 20149 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 20150 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
20151 echo "a table of contents needs to be added with '$ar ts'."
20152 orderlib=false
20153 ranlib="$ar ts"
20154else
20155 case "$ranlib" in
20156 :) ranlib='';;
20157 '')
20158 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20159 $test -f $ranlib || ranlib=''
20160 ;;
20161 esac
20162 if $test -n "$ranlib"; then
20163 echo "your system has '$ranlib'; we'll use that."
20164 orderlib=false
20165 else
20166 echo "your system doesn't seem to support random libraries"
20167 echo "so we'll use lorder and tsort to order the libraries."
20168 orderlib=true
20169 ranlib=":"
20170 fi
20171fi
88d4d47b 20172$rm -f foo* bar*
b4eb6b3d 20173
92a3ac59
MB
20174: see if this is a values.h system
20175set values.h i_values
20176eval $inhdr
20177
73e6e416 20178: Check the max offset that gmtime and localtime accept
92a3ac59 20179echo "Checking max offsets that gmtime () accepts"
81c4fd9e 20180
92a3ac59
MB
20181case $i_values in
20182 define) yyy="#include <values.h>" ;;
20183 *) yyy="" ;;
20184 esac
20185
690aedd1
MB
20186case "$sGMTIME_min/$sGMTIME_max" in
20187 0/0|/)
20188 $cat >try.c <<EOCP
81c4fd9e
MB
20189#include <sys/types.h>
20190#include <stdio.h>
20191#include <time.h>
92a3ac59 20192$yyy
81c4fd9e 20193
92a3ac59
MB
20194int i;
20195struct tm *tmp;
20196time_t pt;
20197
1b289682 20198void gm_check (time_t t, int min_year, int max_year)
92a3ac59 20199{
81c4fd9e 20200 tmp = gmtime (&t);
1b289682
MB
20201 if ( tmp == NULL ||
20202 /* Check tm_year overflow */
20203 tmp->tm_year < min_year || tmp->tm_year > max_year)
92a3ac59
MB
20204 tmp = NULL;
20205 else
20206 pt = t;
20207 } /* gm_check */
81c4fd9e 20208
92a3ac59
MB
20209int check_max ()
20210{
73e6e416
MB
20211 tmp = NULL;
20212 pt = 0;
92a3ac59 20213#ifdef MAXLONG
1b289682 20214 gm_check (MAXLONG, 69, 0x7fffffff);
92a3ac59 20215#endif
73e6e416
MB
20216 if (tmp == NULL || tmp->tm_year < 0) {
20217 for (i = 63; i >= 0; i--) {
20218 time_t x = pt | ((time_t)1 << i);
1b289682
MB
20219 if (x < 0 || x < pt) continue;
20220 gm_check (x, 69, 0x7fffffff);
73e6e416
MB
20221 }
20222 }
20223 printf ("sGMTIME_max=%ld\n", pt);
20224 return (0);
1b289682 20225 } /* check_max */
81c4fd9e 20226
92a3ac59
MB
20227int check_min ()
20228{
73e6e416
MB
20229 tmp = NULL;
20230 pt = 0;
92a3ac59 20231#ifdef MINLONG
1b289682 20232 gm_check (MINLONG, -1900, 70);
92a3ac59 20233#endif
73e6e416
MB
20234 if (tmp == NULL) {
20235 for (i = 36; i >= 0; i--) {
20236 time_t x = pt - ((time_t)1 << i);
20237 if (x > 0) continue;
1b289682 20238 gm_check (x, -1900, 70);
73e6e416
MB
20239 }
20240 }
20241 printf ("sGMTIME_min=%ld\n", pt);
20242 return (0);
20243 } /* check_min */
92a3ac59
MB
20244
20245int main (int argc, char *argv[])
20246{
73e6e416
MB
20247 fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20248 check_max ();
20249 check_min ();
20250 return (0);
20251 } /* main */
81c4fd9e 20252EOCP
690aedd1
MB
20253 set try
20254 if eval $compile; then
20255 eval `$run ./try`
20256 else
20257 echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20258 fi
20259 $rm_try
20260 ;;
20261 esac
81c4fd9e 20262
73e6e416
MB
20263echo "Checking max offsets that localtime () accepts"
20264
690aedd1
MB
20265case "$sLOCALTIME_min/$sLOCALTIME_max" in
20266 0/0|/)
20267 $cat >try.c <<EOCP
73e6e416
MB
20268#include <sys/types.h>
20269#include <stdio.h>
20270#include <time.h>
20271$yyy
20272
20273int i;
20274struct tm *tmp;
20275time_t pt;
20276
1b289682 20277void local_check (time_t t, int min_year, int max_year)
73e6e416 20278{
5bca5c48
MB
20279 if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20280 tmp = NULL;
20281 else
20282 tmp = localtime (&t);
1b289682
MB
20283 if ( tmp == NULL ||
20284 /* Check tm_year overflow */
20285 tmp->tm_year < min_year || tmp->tm_year > max_year)
73e6e416
MB
20286 tmp = NULL;
20287 else
20288 pt = t;
20289 } /* local_check */
20290
20291int check_max ()
20292{
20293 tmp = NULL;
20294 pt = 0;
20295#ifdef MAXLONG
1b289682 20296 local_check (MAXLONG, 69, 0x7fffffff);
73e6e416
MB
20297#endif
20298 if (tmp == NULL || tmp->tm_year < 0) {
20299 for (i = 63; i >= 0; i--) {
20300 time_t x = pt | ((time_t)1 << i);
1b289682
MB
20301 if (x < 0 || x < pt) continue;
20302 local_check (x, 69, 0x7fffffff);
73e6e416
MB
20303 }
20304 }
20305 printf ("sLOCALTIME_max=%ld\n", pt);
20306 return (0);
1b289682 20307 } /* check_max */
73e6e416
MB
20308
20309int check_min ()
20310{
20311 tmp = NULL;
20312 pt = 0;
20313#ifdef MINLONG
1b289682 20314 local_check (MINLONG, -1900, 70);
73e6e416
MB
20315#endif
20316 if (tmp == NULL) {
20317 for (i = 36; i >= 0; i--) {
20318 time_t x = pt - ((time_t)1 << i);
20319 if (x > 0) continue;
1b289682 20320 local_check (x, -1900, 70);
73e6e416
MB
20321 }
20322 }
20323 printf ("sLOCALTIME_min=%ld\n", pt);
20324 return (0);
20325 } /* check_min */
20326
20327int main (int argc, char *argv[])
20328{
20329 check_max ();
20330 check_min ();
20331 return (0);
20332 } /* main */
20333EOCP
690aedd1
MB
20334 set try
20335 if eval $compile; then
20336 eval `$run ./try`
20337 else
20338 echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20339 fi
20340 $rm_try
20341 ;;
20342 esac
73e6e416 20343
c0bacbef 20344: check for type of arguments to select.
b4eb6b3d
JH
20345case "$selecttype" in
20346'') case "$d_select" in
20347 $define)
20348 echo " "
20349 $cat <<EOM
20350Checking to see what type of arguments are accepted by select().
20351EOM
20352 hdrs="$define sys/types.h
c0bacbef 20353 $i_systime sys/time.h
b4eb6b3d
JH
20354 $i_sysselct sys/select.h
20355 $d_socket sys/socket.h"
20356 : The first arg can be int, unsigned, or size_t
20357 : The last arg may or may not be 'const'
20358 val=''
20359 : void pointer has been seen but using that
20360 : breaks the selectminbits test
20361 for xxx in 'fd_set *' 'int *'; do
20362 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20363 for tmo in 'struct timeval *' 'const struct timeval *'; do
20364 case "$val" in
61c26d18 20365 '') try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
b4eb6b3d
JH
20366 if ./protochk "$try" $hdrs; then
20367 echo "Your system accepts $xxx."
20368 val="$xxx"
20369 fi
20370 ;;
20371 esac
20372 done
20373 done
20374 done
20375 case "$val" in
20376 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20377 case "$d_fd_set" in
20378 $define) dflt="fd_set *" ;;
20379 *) dflt="int *" ;;
20380 esac
20381 . ./myread
20382 val=$ans
20383 ;;
20384 esac
20385 selecttype="$val"
20386 ;;
20387 *) : no select, so pick a harmless default
20388 selecttype='int *'
20389 ;;
20390 esac
20391 ;;
20392esac
20393
20394: check for the select 'width'
20395case "$selectminbits" in
e6e7e605
JH
20396'') safebits=`expr $ptrsize \* 8`
20397 case "$d_select" in
b4eb6b3d
JH
20398 $define)
20399 $cat <<EOM
20400
20401Checking to see on how many bits at a time your select() operates...
20402EOM
20403 $cat >try.c <<EOCP
20404#include <sys/types.h>
20405#$i_time I_TIME
20406#$i_systime I_SYS_TIME
20407#$i_systimek I_SYS_TIME_KERNEL
20408#ifdef I_TIME
20409# include <time.h>
20410#endif
20411#ifdef I_SYS_TIME
20412# ifdef I_SYS_TIME_KERNEL
20413# define KERNEL
20414# endif
20415# include <sys/time.h>
20416# ifdef I_SYS_TIME_KERNEL
20417# undef KERNEL
20418# endif
20419#endif
20420#$i_sysselct I_SYS_SELECT
20421#ifdef I_SYS_SELECT
20422#include <sys/select.h>
20423#endif
20424#$d_socket HAS_SOCKET
20425#ifdef HAS_SOCKET
20426# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20427#endif
20428#include <stdio.h>
d1daaddf
JH
20429#$i_stdlib I_STDLIB
20430#ifdef I_STDLIB
20431#include <stdlib.h>
20432#endif
b4eb6b3d
JH
20433$selecttype b;
20434#define S sizeof(*(b))
20435#define MINBITS 64
20436#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20437#define NBITS (NBYTES * 8)
20438int main() {
7090f861 20439 char *s = (char *)malloc(NBYTES);
b4eb6b3d
JH
20440 struct timeval t;
20441 int i;
20442 FILE* fp;
20443 int fd;
20444
e6e7e605
JH
20445 if (!s)
20446 exit(1);
b4eb6b3d
JH
20447 fclose(stdin);
20448 fp = fopen("try.c", "r");
20449 if (fp == 0)
e6e7e605 20450 exit(2);
b4eb6b3d
JH
20451 fd = fileno(fp);
20452 if (fd < 0)
e6e7e605 20453 exit(3);
b4eb6b3d
JH
20454 b = ($selecttype)s;
20455 for (i = 0; i < NBITS; i++)
20456 FD_SET(i, b);
20457 t.tv_sec = 0;
20458 t.tv_usec = 0;
20459 select(fd + 1, b, 0, 0, &t);
20460 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
e6e7e605 20461 free(s);
b4eb6b3d
JH
20462 printf("%d\n", i + 1);
20463 return 0;
20464}
20465EOCP
20466 set try
20467 if eval $compile_ok; then
5440bc8e 20468 selectminbits=`$run ./try`
b4eb6b3d
JH
20469 case "$selectminbits" in
20470 '') cat >&4 <<EOM
20471Cannot figure out on how many bits at a time your select() operates.
e6e7e605 20472I'll play safe and guess it is $safebits bits.
b4eb6b3d 20473EOM
e6e7e605
JH
20474 selectminbits=$safebits
20475 bits="$safebits bits"
b4eb6b3d
JH
20476 ;;
20477 1) bits="1 bit" ;;
20478 *) bits="$selectminbits bits" ;;
20479 esac
20480 echo "Your select() operates on $bits at a time." >&4
20481 else
20482 rp='What is the minimum number of bits your select() operates on?'
20483 case "$byteorder" in
e6e7e605
JH
20484 12345678) dflt=64 ;;
20485 1234) dflt=32 ;;
b4eb6b3d
JH
20486 *) dflt=1 ;;
20487 esac
20488 . ./myread
20489 val=$ans
20490 selectminbits="$val"
20491 fi
5b813a60 20492 $rm_try
b4eb6b3d
JH
20493 ;;
20494 *) : no select, so pick a harmless default
e6e7e605 20495 selectminbits=$safebits
b4eb6b3d
JH
20496 ;;
20497 esac
20498 ;;
20499esac
20500
20501: Trace out the files included by signal.h, then look for SIGxxx names.
b4eb6b3d
JH
20502if [ "X$fieldn" = X ]; then
20503 : Just make some guesses. We check them later.
20504 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20505else
20506 xxx=`echo '#include <signal.h>' |
20507 $cppstdin $cppminus $cppflags 2>/dev/null |
613d6c3e 20508 $grep '^[ ]*#.*include' |
776a38e3
MB
20509 $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20510 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d 20511fi
b4eb6b3d
JH
20512xxxfiles=''
20513for xx in $xxx /dev/null ; do
20514 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20515done
b4eb6b3d
JH
20516case "$xxxfiles" in
20517'') xxxfiles=`./findhdr signal.h` ;;
20518esac
20519xxx=`awk '
20520$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20521 print substr($2, 4, 20)
20522}
20523$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20524 print substr($3, 4, 20)
20525}' $xxxfiles`
20526: Append some common names just in case the awk scan failed.
20527xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20528xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20529xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20530xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20531xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20532
20533: generate a few handy files for later
55954f19 20534$cat > signal.c <<EOCP
b4eb6b3d
JH
20535#include <sys/types.h>
20536#include <signal.h>
55954f19
JH
20537#$i_stdlib I_STDLIB
20538#ifdef I_STDLIB
20539#include <stdlib.h>
20540#endif
b4eb6b3d
JH
20541#include <stdio.h>
20542int main() {
20543
20544/* Strange style to avoid deeply-nested #if/#else/#endif */
20545#ifndef NSIG
20546# ifdef _NSIG
20547# define NSIG (_NSIG)
20548# endif
20549#endif
20550
20551#ifndef NSIG
20552# ifdef SIGMAX
20553# define NSIG (SIGMAX+1)
20554# endif
20555#endif
20556
20557#ifndef NSIG
20558# ifdef SIG_MAX
20559# define NSIG (SIG_MAX+1)
20560# endif
20561#endif
20562
20563#ifndef NSIG
3609ea0d
JH
20564# ifdef _SIG_MAX
20565# define NSIG (_SIG_MAX+1)
20566# endif
20567#endif
20568
20569#ifndef NSIG
b4eb6b3d
JH
20570# ifdef MAXSIG
20571# define NSIG (MAXSIG+1)
20572# endif
20573#endif
20574
20575#ifndef NSIG
20576# ifdef MAX_SIG
20577# define NSIG (MAX_SIG+1)
20578# endif
20579#endif
20580
20581#ifndef NSIG
20582# ifdef SIGARRAYSIZE
3609ea0d 20583# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
b4eb6b3d
JH
20584# endif
20585#endif
20586
20587#ifndef NSIG
20588# ifdef _sys_nsig
20589# define NSIG (_sys_nsig) /* Solaris 2.5 */
20590# endif
20591#endif
20592
20593/* Default to some arbitrary number that's big enough to get most
20594 of the common signals.
20595*/
20596#ifndef NSIG
20597# define NSIG 50
20598#endif
20599
20600printf("NSIG %d\n", NSIG);
20601
20602#ifndef JUST_NSIG
20603
20604EOCP
20605
20606echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20607{
20608 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 20609 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
20610 printf $1; printf ");\n"
20611 printf "#endif\n"
20612}
20613END {
20614 printf "#endif /* JUST_NSIG */\n";
20615 printf "exit(0);\n}\n";
20616}
20617' >>signal.c
20618$cat >signal.awk <<'EOP'
20619BEGIN { ndups = 0 }
65197d93 20620$1 ~ /^NSIG$/ { nsig = $2 }
1ebe1ffb 20621($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
20622 if ($2 > maxsig) { maxsig = $2 }
20623 if (sig_name[$2]) {
20624 dup_name[ndups] = $1
20625 dup_num[ndups] = $2
613d6c3e 20626 ndups++
b4eb6b3d 20627 }
1ebe1ffb 20628 else {
65197d93
JH
20629 sig_name[$2] = $1
20630 sig_num[$2] = $2
b4eb6b3d
JH
20631 }
20632}
613d6c3e 20633END {
b4eb6b3d
JH
20634 if (nsig == 0) {
20635 nsig = maxsig + 1
20636 }
20637 printf("NSIG %d\n", nsig);
20638 for (n = 1; n < nsig; n++) {
20639 if (sig_name[n]) {
20640 printf("%s %d\n", sig_name[n], sig_num[n])
20641 }
20642 else {
613d6c3e 20643 printf("NUM%d %d\n", n, n)
b4eb6b3d
JH
20644 }
20645 }
20646 for (n = 0; n < ndups; n++) {
20647 printf("%s %d\n", dup_name[n], dup_num[n])
20648 }
20649}
20650EOP
20651$cat >signal_cmd <<EOS
20652$startsh
20653if $test -s signal.lst; then
20654 echo "Using your existing signal.lst file"
20655 exit 0
20656fi
20657xxx="$xxx"
20658EOS
20659$cat >>signal_cmd <<'EOS'
20660
20661set signal
20662if eval $compile_ok; then
776a38e3
MB
20663 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20664 $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20665else
20666 echo "(I can't seem be able to compile the whole test program)" >&4
20667 echo "(I'll try it in little pieces.)" >&4
20668 set signal -DJUST_NSIG
20669 if eval $compile_ok; then
5440bc8e 20670 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
20671 $cat signal.nsg
20672 else
20673 echo "I can't seem to figure out how many signals you have." >&4
20674 echo "Guessing 50." >&4
20675 echo 'NSIG 50' > signal.nsg
20676 fi
20677 : Now look at all the signal names, one at a time.
20678 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20679 $cat > signal.c <<EOCP
20680#include <sys/types.h>
20681#include <signal.h>
20682#include <stdio.h>
20683int main() {
20684printf("$xx %d\n", SIG${xx});
20685return 0;
20686}
20687EOCP
20688 set signal
20689 if eval $compile; then
20690 echo "SIG${xx} found."
5440bc8e 20691 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
20692 else
20693 echo "SIG${xx} NOT found."
20694 fi
20695 done
20696 if $test -s signal.ls1; then
20697 $cat signal.nsg signal.ls1 |
65197d93 20698 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20699 fi
20700
20701fi
20702if $test -s signal.lst; then
20703 :
20704else
20705 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20706 echo 'kill -l' >signal
20707 set X `csh -f <signal`
20708 $rm -f signal
20709 shift
20710 case $# in
20711 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20712 esac
20713 echo $@ | $tr ' ' $trnl | \
20714 $awk '{ printf "%s %d\n", $1, ++s; }
20715 END { printf "NSIG %d\n", ++s }' >signal.lst
20716fi
20717$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20718EOS
20719chmod a+x signal_cmd
20720$eunicefix signal_cmd
20721
20722: generate list of signal names
20723echo " "
20724case "$sig_name_init" in
20725'') doinit=yes ;;
20726*) case "$sig_num_init" in
20727 ''|*,*) doinit=yes ;;
20728 esac ;;
20729esac
20730case "$doinit" in
20731yes)
20732 echo "Generating a list of signal names and numbers..." >&4
20733 . ./signal_cmd
20734 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20735 sig_name=`$awk 'BEGIN { printf "ZERO " }
20736 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20737 sig_num=`$awk 'BEGIN { printf "0 " }
20738 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20739 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
20740 !/^NSIG/ { printf "\"%s\", ", $1 }
20741 END { printf "0\n" }' signal.lst`
20742 sig_num_init=`$awk 'BEGIN { printf "0, " }
20743 !/^NSIG/ { printf "%d, ", $2}
20744 END { printf "0\n"}' signal.lst`
20745 ;;
20746esac
20747echo "The following $sig_count signals are available:"
20748echo " "
20749echo $sig_name | $awk \
20750'BEGIN { linelen = 0 }
20751{
20752 for (i = 1; i <= NF; i++) {
20753 name = "SIG" $i " "
20754 linelen = linelen + length(name)
20755 if (linelen > 70) {
20756 printf "\n"
20757 linelen = length(name)
20758 }
20759 printf "%s", name
20760 }
20761 printf "\n"
20762}'
76d3c696 20763sig_size=`echo $sig_name | awk '{print NF}'`
c0bacbef 20764$rm -f signal signal.c signal.awk signal.lst signal_cmd
b4eb6b3d 20765
613d6c3e 20766: Check size of size
b4eb6b3d
JH
20767echo " "
20768case "$sizetype" in
20769*_t) zzz="$sizetype" ;;
20770*) zzz="filesize" ;;
20771esac
613d6c3e 20772echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
20773cat > try.c <<EOCP
20774#include <sys/types.h>
20775#include <stdio.h>
d1daaddf
JH
20776#$i_stdlib I_STDLIB
20777#ifdef I_STDLIB
20778#include <stdlib.h>
20779#endif
b4eb6b3d
JH
20780int main() {
20781 printf("%d\n", (int)sizeof($sizetype));
20782 exit(0);
20783}
20784EOCP
20785set try
20786if eval $compile_ok; then
5440bc8e 20787 yyy=`$run ./try`
b4eb6b3d
JH
20788 case "$yyy" in
20789 '') sizesize=4
20790 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20791 ;;
20792 *) sizesize=$yyy
20793 echo "Your $zzz size is $sizesize bytes."
20794 ;;
20795 esac
20796else
20797 sizesize=4
20798 echo "(I can't compile the test program--guessing $sizesize.)" >&4
20799fi
20800
20801
20802: check for socklen_t
20803echo " "
20804echo "Checking to see if you have socklen_t..." >&4
20805$cat >try.c <<EOCP
20806#include <sys/types.h>
20807#$d_socket HAS_SOCKET
20808#ifdef HAS_SOCKET
20809#include <sys/socket.h>
20810#endif
20811int main() { socklen_t x = 16; }
20812EOCP
20813set try
20814if eval $compile; then
20815 val="$define"
20816 echo "You have socklen_t."
20817else
20818 val="$undef"
20819 echo "You do not have socklen_t."
20820 case "$sizetype" in
20821 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20822 esac
20823fi
5b813a60 20824$rm_try
b4eb6b3d
JH
20825set d_socklen_t
20826eval $setvar
20827
a7710f8d
JH
20828: see if this is a socks.h system
20829set socks.h i_socks
20830eval $inhdr
20831
b4eb6b3d
JH
20832: check for type of the size argument to socket calls
20833case "$d_socket" in
20834"$define")
20835 $cat <<EOM
20836
20837Checking to see what type is the last argument of accept().
20838EOM
b4eb6b3d
JH
20839 yyy=''
20840 case "$d_socklen_t" in
20841 "$define") yyy="$yyy socklen_t"
20842 esac
20843 yyy="$yyy $sizetype int long unsigned"
20844 for xxx in $yyy; do
20845 case "$socksizetype" in
61c26d18 20846 '') try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
20847 case "$usesocks" in
20848 "$define")
20849 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20850 echo "Your system accepts '$xxx *' for the last argument of accept()."
20851 socksizetype="$xxx"
20852 fi
20853 ;;
20854 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
20855 echo "Your system accepts '$xxx *' for the last argument of accept()."
20856 socksizetype="$xxx"
20857 fi
20858 ;;
20859 esac
b4eb6b3d
JH
20860 ;;
20861 esac
20862 done
20863: In case none of those worked, prompt the user.
20864 case "$socksizetype" in
20865 '') rp='What is the type for socket address structure sizes?'
20866 dflt='int'
20867 . ./myread
20868 socksizetype=$ans
20869 ;;
20870 esac
20871 ;;
20872*) : no sockets, so pick relatively harmless default
20873 socksizetype='int'
20874 ;;
20875esac
20876
20877: see what type is used for signed size_t
20878set ssize_t ssizetype int stdio.h sys/types.h
20879eval $typedef
20880dflt="$ssizetype"
5440bc8e 20881$cat > try.c <<EOM
b4eb6b3d 20882#include <stdio.h>
d1daaddf
JH
20883#$i_stdlib I_STDLIB
20884#ifdef I_STDLIB
20885#include <stdlib.h>
20886#endif
b4eb6b3d
JH
20887#include <sys/types.h>
20888#define Size_t $sizetype
20889#define SSize_t $dflt
20890int main()
20891{
20892 if (sizeof(Size_t) == sizeof(SSize_t))
20893 printf("$dflt\n");
20894 else if (sizeof(Size_t) == sizeof(int))
20895 printf("int\n");
5b813a60 20896 else
b4eb6b3d
JH
20897 printf("long\n");
20898 exit(0);
20899}
20900EOM
20901echo " "
5440bc8e
JH
20902set try
20903if eval $compile_ok && $run ./try > /dev/null; then
20904 ssizetype=`$run ./try`
b4eb6b3d
JH
20905 echo "I'll be using $ssizetype for functions returning a byte count." >&4
20906else
20907 $cat >&4 <<EOM
20908Help! I can't compile and run the ssize_t test program: please enlighten me!
20909(This is probably a misconfiguration in your system or libraries, and
20910you really ought to fix it. Still, I'll try anyway.)
20911
20912I need a type that is the same size as $sizetype, but is guaranteed to
20913be signed. Common values are ssize_t, int and long.
20914
20915EOM
20916 rp="What signed type is the same size as $sizetype?"
20917 . ./myread
20918 ssizetype="$ans"
20919fi
5b813a60 20920$rm_try
b4eb6b3d
JH
20921
20922: see what type of char stdio uses.
20923echo " "
1d8eaf8c 20924echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
aa517f50 20925if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
20926 echo "Your stdio uses unsigned chars." >&4
20927 stdchar="unsigned char"
20928else
aa517f50
JH
20929 echo "Your stdio uses signed chars." >&4
20930 stdchar="char"
b4eb6b3d 20931fi
1d8eaf8c 20932$rm -f stdioh
b4eb6b3d 20933
b4eb6b3d
JH
20934: see what type uids are declared as in the kernel
20935echo " "
20936echo "Looking for the type for user ids returned by getuid()."
20937set uid_t uidtype xxx stdio.h sys/types.h
20938eval $typedef
20939case "$uidtype" in
20940xxx)
20941 xxx=`./findhdr sys/user.h`
20942 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20943 case $1 in
20944 unsigned) dflt="$1 $2" ;;
20945 *) dflt="$1" ;;
20946 esac
20947 ;;
20948*) dflt="$uidtype";;
20949esac
20950case "$uidtype" in
20951uid_t) echo "uid_t found." ;;
20952*) rp="What is the type for user ids returned by getuid()?"
20953 . ./myread
20954 uidtype="$ans"
20955 ;;
20956esac
20957
613d6c3e 20958: Check size of UID
b4eb6b3d
JH
20959echo " "
20960case "$uidtype" in
20961*_t) zzz="$uidtype" ;;
20962*) zzz="uid" ;;
20963esac
613d6c3e 20964echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
20965cat > try.c <<EOCP
20966#include <sys/types.h>
20967#include <stdio.h>
d1daaddf
JH
20968#$i_stdlib I_STDLIB
20969#ifdef I_STDLIB
20970#include <stdlib.h>
20971#endif
b4eb6b3d
JH
20972int main() {
20973 printf("%d\n", (int)sizeof($uidtype));
20974 exit(0);
20975}
20976EOCP
20977set try
20978if eval $compile_ok; then
5440bc8e 20979 yyy=`$run ./try`
b4eb6b3d
JH
20980 case "$yyy" in
20981 '') uidsize=4
20982 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20983 ;;
20984 *) uidsize=$yyy
20985 echo "Your $zzz is $uidsize bytes long."
20986 ;;
20987 esac
20988else
20989 uidsize=4
20990 echo "(I can't compile the test program--guessing $uidsize.)" >&4
20991fi
20992
613d6c3e 20993: Check if UID is signed
b4eb6b3d
JH
20994echo " "
20995case "$uidtype" in
20996*_t) zzz="$uidtype" ;;
20997*) zzz="uid" ;;
20998esac
20999echo "Checking the sign of $zzz..." >&4
21000cat > try.c <<EOCP
21001#include <sys/types.h>
21002#include <stdio.h>
21003int main() {
21004 $uidtype foo = -1;
21005 if (foo < 0)
21006 printf("-1\n");
21007 else
21008 printf("1\n");
21009}
21010EOCP
21011set try
21012if eval $compile; then
5440bc8e 21013 yyy=`$run ./try`
b4eb6b3d
JH
21014 case "$yyy" in
21015 '') uidsign=1
21016 echo "(I can't execute the test program--guessing unsigned.)" >&4
21017 ;;
21018 *) uidsign=$yyy
21019 case "$uidsign" in
21020 1) echo "Your $zzz is unsigned." ;;
21021 -1) echo "Your $zzz is signed." ;;
21022 esac
21023 ;;
21024 esac
21025else
21026 uidsign=1
21027 echo "(I can't compile the test program--guessing unsigned.)" >&4
21028fi
21029
21030
34f1896b 21031: Check format string for UID
b4eb6b3d
JH
21032echo " "
21033$echo "Checking the format string to be used for uids..." >&4
21034
21035case "$uidsign" in
21036-1) if $test X"$uidsize" = X"$ivsize"; then
21037 uidformat="$ivdformat"
21038 else
21039 if $test X"$uidsize" = X"$longsize"; then
21040 uidformat='"ld"'
21041 else
21042 if $test X"$uidsize" = X"$intsize"; then
21043 uidformat='"d"'
21044 else
21045 if $test X"$uidsize" = X"$shortsize"; then
21046 uidformat='"hd"'
21047 fi
21048 fi
21049 fi
21050 fi
21051 ;;
21052*) if $test X"$uidsize" = X"$uvsize"; then
21053 uidformat="$uvuformat"
21054 else
21055 if $test X"$uidsize" = X"$longsize"; then
21056 uidformat='"lu"'
21057 else
21058 if $test X"$uidsize" = X"$intsize"; then
21059 uidformat='"u"'
21060 else
21061 if $test X"$uidsize" = X"$shortsize"; then
21062 uidformat='"hu"'
21063 fi
21064 fi
21065 fi
21066 fi
21067 ;;
21068esac
21069
34f1896b 21070: Check if site customization support was requested
4afd418c
MB
21071case "$usesitecustomize" in
21072 $define|true|[Yy]*)
21073 usesitecustomize="$define"
21074 ;;
21075 *)
21076 usesitecustomize="$undef"
21077 ;;
21078 esac
21079
3659ebf1
JH
21080: determine compiler compiler
21081case "$yacc" in
21082'')
21083 dflt=yacc;;
21084*)
21085 dflt="$yacc";;
21086esac
21087echo " "
21088comp='yacc'
3c728e00 21089if $test -f "$byacc$_exe"; then
3659ebf1
JH
21090 dflt="$byacc"
21091 comp="byacc or $comp"
21092fi
3c728e00 21093if $test -f "$bison$_exe"; then
3659ebf1
JH
21094 comp="$comp or bison -y"
21095fi
21096rp="Which compiler compiler ($comp) shall I use?"
21097. ./myread
21098yacc="$ans"
21099case "$yacc" in
21100*bis*)
21101 case "$yacc" in
21102 *-y*) ;;
21103 *)
21104 yacc="$yacc -y"
21105 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21106 ;;
21107 esac
21108 ;;
21109esac
21110
c0bacbef
MB
21111: see if this is a assert.h system
21112set assert.h i_assert
21113eval $inhdr
21114
758a5d79
JH
21115: see if this is a fp.h system
21116set fp.h i_fp
21117eval $inhdr
21118
21119: see if this is a fp_class.h system
21120set fp_class.h i_fp_class
21121eval $inhdr
21122
13cfc98d
MB
21123: see if gdbm.h is available
21124set gdbm.h t_gdbm
21125eval $inhdr
21126case "$t_gdbm" in
21127$define)
21128 : see if gdbm_open exists
21129 set gdbm_open d_gdbm_open
21130 eval $inlibc
21131 case "$d_gdbm_open" in
21132 $undef)
21133 t_gdbm="$undef"
21134 echo "We won't be including <gdbm.h>"
21135 ;;
21136 esac
21137 ;;
21138esac
21139val="$t_gdbm"
21140set i_gdbm
21141eval $setvar
21142
b2f871ed
AD
21143: see if this is a ieeefp.h system
21144case "$i_ieeefp" in
21145'' ) set ieeefp.h i_ieeefp
21146 eval $inhdr
21147 ;;
21148esac
21149
21150: see if this is a libutil.h system
21151set libutil.h i_libutil
21152eval $inhdr
21153
21154: see if mach cthreads are available
21155if test "X$usethreads" = "X$define"; then
21156 set mach/cthreads.h i_machcthr
21157 eval $inhdr
21158else
21159 i_machcthr="$undef"
21160fi
21161
21162: see if this is a mntent.h system
21163set mntent.h i_mntent
21164eval $inhdr
21165
b4eb6b3d
JH
21166: see if net/errno.h is available
21167val=''
21168set net/errno.h val
21169eval $inhdr
21170
21171: Unfortunately, it causes problems on some systems. Arrgh.
21172case "$val" in
21173$define)
21174 cat > try.c <<'EOM'
21175#include <stdio.h>
21176#include <errno.h>
21177#include <net/errno.h>
21178int func()
21179{
21180 return ENOTSOCK;
21181}
21182EOM
21183 if $cc $ccflags -c try.c >/dev/null 2>&1; then
21184 echo "We'll be including <net/errno.h>." >&4
21185 else
21186 echo "We won't be including <net/errno.h>." >&4
21187 val="$undef"
21188 fi
5b813a60 21189 $rm_try
b4eb6b3d
JH
21190 ;;
21191esac
21192set i_neterrno
21193eval $setvar
21194
21195: see if netinet/tcp.h is available
21196set netinet/tcp.h i_netinettcp
21197eval $inhdr
21198
21199: see if this is a poll.h system
21200set poll.h i_poll
21201eval $inhdr
21202
21203: see if this is a prot.h system
21204set prot.h i_prot
21205eval $inhdr
21206
613d6c3e 21207: Preprocessor symbols
b4eb6b3d 21208echo " "
ddfca5da 21209$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
b4eb6b3d
JH
21210$cat <<'EOSH' > Cppsym.know
21211a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21212AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
44c87379 21213alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
d46c9a2d
JH
21214ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21215BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
21216BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21217bull c cadmus clipper CMU COFF COMPILER_VERSION
21218concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
8b7d8421 21219CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
21220Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21221FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21222GLIBC GLIBC_MINOR
21223GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
21224H3050R H3050RX hbullx20 hcx host_mips
21225hp200 hp300 hp700 HP700 hp800 hp9000
21226hp9000s200 hp9000s300 hp9000s400 hp9000s500
21227hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21228i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 21229IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
21230INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21231LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21232LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
9c12f1e5 21233LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
b4eb6b3d
JH
21234LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21235M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21236M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21237M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21238MATH_HAS_NO_SIDE_EFFECTS
21239mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21240mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21241mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21242MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21243mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21244NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 21245news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
21246ns32016 ns32332 ns32k nsc32000
21247OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21248pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21249pc532 pdp11 PGC PIC plexus PORTAR posix
21250POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21251POSIX_C_SOURCE POSIX_SOURCE POWER
9c12f1e5 21252PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 21253riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
21254SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21255sony sony_news sonyrisc sparc sparclite spectrum
21256stardent stdc STDC_EXT stratos sun sun3 sun386
21257Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21258SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21259SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21260sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 21261TM3200 TM5400 TM5600
b4eb6b3d
JH
21262tower tower32 tower32_200 tower32_600 tower32_700
21263tower32_800 tower32_850 tss
21264u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21265ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
21266unix UNIX95 UNIX99 unixpc unos
21267USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21268USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21269USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21270USGr4 USGr4_2
44c87379 21271Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
b4eb6b3d
JH
21272XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21273XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21274z8000
21275EOSH
21276# Maybe put other stuff here too.
21277cat <<EOSH >>Cppsym.know
21278$osname
21279EOSH
21280./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21281./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21282$cat Cppsym.know > Cppsym.c
381aa1ff 21283$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
21284$rm -f Cppsym.a Cppsym.b Cppsym.c
21285cat <<EOSH > Cppsym
21286$startsh
21287if $test \$# -gt 0; then
21288 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21289 if $test -s Cppsym.got; then
21290 $rm -f Cppsym.got
21291 exit 0
21292 fi
21293 $rm -f Cppsym.got
21294 exit 1
21295else
21296 $tr " " "$trnl" | ./Cppsym.try
21297 exit 0
21298fi
21299EOSH
21300chmod +x Cppsym
21301$eunicefix Cppsym
21302cat <<EOSH > Cppsym.try
21303$startsh
21304cat <<'EOCP' > try.c
21305#include <stdio.h>
360321b3
YST
21306#if cpp_stuff == 1
21307#define STRINGIFY(a) "a"
21308#endif
21309#if cpp_stuff == 42
21310#define StGiFy(a) #a
21311#define STRINGIFY(a) StGiFy(a)
21312#endif
21313#if $cpp_stuff != 1 && $cpp_stuff != 42
21314# include "Bletch: How does this C preprocessor stringify macros?"
21315#endif
b4eb6b3d
JH
21316int main() {
21317EOCP
21318$awk \\
21319EOSH
21320cat <<'EOSH' >> Cppsym.try
21321'length($1) > 0 {
360321b3
YST
21322 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21323 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21324 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21325 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
b4eb6b3d 21326}' >> try.c
2ef53570 21327echo 'return 0;}' >> try.c
b4eb6b3d
JH
21328EOSH
21329cat <<EOSH >> Cppsym.try
21330ccflags="$ccflags"
21331case "$osname-$gccversion" in
21332irix-) ccflags="\$ccflags -woff 1178" ;;
21333os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21334esac
360321b3 21335$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
b4eb6b3d
JH
21336EOSH
21337chmod +x Cppsym.try
21338$eunicefix Cppsym.try
21339./Cppsym < Cppsym.know > Cppsym.true
ddfca5da 21340: Add in any linux cpp "predefined macros":
b6a7163e
MB
21341case "$osname::$gccversion" in
21342 *linux*::*.*)
21343 tHdrH=_tmpHdr
21344 rm -f $tHdrH'.h' $tHdrH
21345 touch $tHdrH'.h'
21346 if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21347 sed 's/#define[\ \ ]*//;s/[\ \ ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21348 if [ -s $tHdrH'_cppsym.real' ]; then
21349 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21350 fi
21351 fi
21352 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21353 ;;
21354esac
b4eb6b3d
JH
21355: now check the C compiler for additional symbols
21356postprocess_cc_v=''
21357case "$osname" in
21358aix) postprocess_cc_v="|$tr , ' '" ;;
21359esac
21360$cat >ccsym <<EOS
21361$startsh
21362$cat >tmp.c <<EOF
21363extern int foo;
21364EOF
21365for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21366do
21367 case "\$i" in
21368 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 21369 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
21370 esac
21371done
5b813a60 21372$rm_try
b4eb6b3d
JH
21373EOS
21374postprocess_cc_v=''
21375chmod +x ccsym
21376$eunicefix ccsym
21377./ccsym > ccsym1.raw
21378if $test -s ccsym1.raw; then
21379 $sort ccsym1.raw | $uniq >ccsym.raw
21380else
21381 mv ccsym1.raw ccsym.raw
21382fi
21383
21384$awk '/\=/ { print $0; next }
21385 { print $0"=1" }' ccsym.raw >ccsym.list
360321b3
YST
21386$comm -13 Cppsym.true ccsym.list >ccsym.own
21387$comm -12 Cppsym.true ccsym.list >ccsym.com
21388$comm -23 Cppsym.true ccsym.list >ccsym.cpp
b4eb6b3d
JH
21389also=''
21390if $test -z ccsym.raw; then
21391 echo "Your C compiler doesn't seem to define any symbols!" >&4
21392 echo " "
21393 echo "However, your C preprocessor defines the following symbols:"
21394 $cat Cppsym.true
21395 ccsymbols=''
21396 cppsymbols=`$cat Cppsym.true`
21397 cppsymbols=`echo $cppsymbols`
21398 cppccsymbols="$cppsymbols"
21399else
21400 if $test -s ccsym.com; then
21401 echo "Your C compiler and pre-processor define these symbols:"
21402 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21403 also='also '
21404 symbols='ones'
21405 cppccsymbols=`$cat ccsym.com`
21406 cppccsymbols=`echo $cppccsymbols`
21407 $test "$silent" || sleep 1
21408 fi
21409 if $test -s ccsym.cpp; then
21410 $test "$also" && echo " "
21411 echo "Your C pre-processor ${also}defines the following symbols:"
21412 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21413 also='further '
21414 cppsymbols=`$cat ccsym.cpp`
21415 cppsymbols=`echo $cppsymbols`
21416 $test "$silent" || sleep 1
21417 fi
21418 if $test -s ccsym.own; then
21419 $test "$also" && echo " "
21420 echo "Your C compiler ${also}defines the following cpp symbols:"
21421 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21422 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21423 ccsymbols=`$cat ccsym.own`
21424 ccsymbols=`echo $ccsymbols`
21425 $test "$silent" || sleep 1
21426 fi
21427fi
b4eb6b3d
JH
21428
21429: see if this is a termio system
21430val="$undef"
21431val2="$undef"
21432val3="$undef"
21433if $test `./findhdr termios.h`; then
21434 set tcsetattr i_termios
21435 eval $inlibc
21436 val3="$i_termios"
21437fi
21438echo " "
21439case "$val3" in
21440"$define") echo "You have POSIX termios.h... good!" >&4;;
21441*) if ./Cppsym pyr; then
21442 case "`/bin/universe`" in
21443 ucb) if $test `./findhdr sgtty.h`; then
21444 val2="$define"
21445 echo "<sgtty.h> found." >&4
21446 else
21447 echo "System is pyramid with BSD universe."
216dac04 21448 ./warn "<sgtty.h> not found--you could have problems."
b4eb6b3d
JH
21449 fi;;
21450 *) if $test `./findhdr termio.h`; then
21451 val="$define"
21452 echo "<termio.h> found." >&4
21453 else
21454 echo "System is pyramid with USG universe."
216dac04 21455 ./warn "<termio.h> not found--you could have problems."
b4eb6b3d
JH
21456 fi;;
21457 esac
21458 elif ./usg; then
21459 if $test `./findhdr termio.h`; then
21460 echo "<termio.h> found." >&4
21461 val="$define"
21462 elif $test `./findhdr sgtty.h`; then
21463 echo "<sgtty.h> found." >&4
21464 val2="$define"
21465 else
216dac04 21466 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
b4eb6b3d
JH
21467 fi
21468 else
21469 if $test `./findhdr sgtty.h`; then
21470 echo "<sgtty.h> found." >&4
21471 val2="$define"
21472 elif $test `./findhdr termio.h`; then
21473 echo "<termio.h> found." >&4
21474 val="$define"
21475 else
216dac04 21476 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
b4eb6b3d
JH
21477 fi
21478 fi;;
21479esac
21480set i_termio; eval $setvar
21481val=$val2; set i_sgtty; eval $setvar
21482val=$val3; set i_termios; eval $setvar
21483
b4eb6b3d
JH
21484: see if stddef is available
21485set stddef.h i_stddef
21486eval $inhdr
923fc586 21487
b4eb6b3d
JH
21488: see if sys/access.h is available
21489set sys/access.h i_sysaccess
21490eval $inhdr
21491
21492: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21493set sys/filio.h i_sysfilio
21494eval $inhdr
21495echo " "
21496if $test `./findhdr sys/ioctl.h`; then
21497 val="$define"
21498 echo '<sys/ioctl.h> found.' >&4
21499else
21500 val="$undef"
21501 if $test $i_sysfilio = "$define"; then
21502 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 21503 else
b4eb6b3d
JH
21504 $test $i_sgtty = "$define" && xxx="sgtty.h"
21505 $test $i_termio = "$define" && xxx="termio.h"
21506 $test $i_termios = "$define" && xxx="termios.h"
21507echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21508 fi
21509fi
21510set i_sysioctl
21511eval $setvar
21512
49a78c82
JH
21513: see if socket ioctl defs are in sys/sockio.h
21514echo " "
21515xxx=`./findhdr sys/sockio.h`
21516if $test "$xxx"; then
21517 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21518 val="$define"
21519 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21520 else
21521 val="$undef"
21522 echo "No socket ioctls found in <sys/sockio.h>." >&4
21523 fi
21524else
21525 val="$undef"
21526 $cat <<EOM
21527<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21528EOM
21529fi
21530set i_syssockio
21531eval $setvar
21532
b4eb6b3d
JH
21533: see if this is a syslog.h system
21534set syslog.h i_syslog
21535eval $inhdr
21536
b4eb6b3d
JH
21537: see if this is a sys/mode.h system
21538set sys/mode.h i_sysmode
21539eval $inhdr
21540
216dac04
MB
21541: see if there is a sys/poll.h file
21542set sys/poll.h i_syspoll
21543eval $inhdr
21544
b4eb6b3d
JH
21545: see if sys/resource.h has to be included
21546set sys/resource.h i_sysresrc
21547eval $inhdr
21548
21549: see if sys/security.h is available
21550set sys/security.h i_syssecrt
21551eval $inhdr
21552
21553: see if this is a sys/statvfs.h system
21554set sys/statvfs.h i_sysstatvfs
21555eval $inhdr
21556
b4eb6b3d
JH
21557: see if this is a sys/un.h system
21558set sys/un.h i_sysun
21559eval $inhdr
21560
b4eb6b3d
JH
21561: see if this is a sys/utsname.h system
21562set sys/utsname.h i_sysutsname
21563eval $inhdr
21564
21565: see if this is a syswait system
21566set sys/wait.h i_syswait
21567eval $inhdr
21568
21569: see if this is a ustat.h system
21570set ustat.h i_ustat
21571eval $inhdr
21572
21573: see if this is an utime system
21574set utime.h i_utime
21575eval $inhdr
21576
b4eb6b3d
JH
21577: see if this is a vfork system
21578case "$d_vfork" in
21579"$define")
21580 set vfork.h i_vfork
21581 eval $inhdr
21582 ;;
21583*)
21584 i_vfork="$undef"
21585 ;;
21586esac
21587
613d6c3e 21588: Check extensions
b4eb6b3d
JH
21589echo " "
21590echo "Looking for extensions..." >&4
21591: If we are using the old config.sh, known_extensions may contain
21592: old or inaccurate or duplicate values.
21593known_extensions=''
21594nonxs_extensions=''
21595: We do not use find because it might not be available.
21596: We do not just use MANIFEST because the user may have dropped
21597: some additional extensions into the source tree and expect them
21598: to be built.
21599
21600: Function to recursively find available extensions, ignoring DynaLoader
21601: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21602find_extensions='
21603 for xxx in *; do
822a6ee0
MB
21604 case "$xxx" in
21605 DynaLoader|dynaload) ;;
21606 *)
78ff2d7b 21607 if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
822a6ee0
MB
21608 known_extensions="$known_extensions $1$xxx";
21609 elif $test -f $xxx/Makefile.PL; then
21610 nonxs_extensions="$nonxs_extensions $1$xxx";
21611 else
21612 if $test -d $xxx -a $# -lt 10; then
21613 set $1$xxx/ $*;
21614 cd "$xxx";
21615 eval $find_extensions;
21616 cd ..;
21617 shift;
21618 fi;
21619 fi
21620 ;;
21621 esac;
b4eb6b3d
JH
21622 done'
21623tdir=`pwd`
6904989c 21624cd "$rsrc/ext"
b4eb6b3d
JH
21625set X
21626shift
21627eval $find_extensions
2685328b
AG
21628# Special case: Add in modules that nest beyond the first level.
21629# Currently threads/shared and Hash/Util/FieldHash, since they are
21630# not picked up by the recursive find above (and adding in general
21631# recursive finding breaks SDBM_File/sdbm).
21632# A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21633known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
faae14e6
MB
21634set X $known_extensions
21635shift
21636known_extensions="$*"
b4eb6b3d
JH
21637set X $nonxs_extensions
21638shift
21639nonxs_extensions="$*"
6904989c 21640cd "$tdir"
b4eb6b3d
JH
21641
21642: Now see which are supported on this system.
21643avail_ext=''
21644for xxx in $known_extensions ; do
21645 case "$xxx" in
21646 DB_File|db_file)
21647 case "$i_db" in
21648 $define) avail_ext="$avail_ext $xxx" ;;
21649 esac
21650 ;;
21651 GDBM_File|gdbm_fil)
7c345082 21652 case "$i_gdbm" in
b4eb6b3d
JH
21653 $define) avail_ext="$avail_ext $xxx" ;;
21654 esac
21655 ;;
1d59c593 21656 I18N/Langinfo|i18n_lan)
7c345082 21657 case "$i_langinfo$d_nl_langinfo" in
4bbcc6e8
JH
21658 $define$define) avail_ext="$avail_ext $xxx" ;;
21659 esac
21660 ;;
7978b0db
JH
21661 IPC/SysV|ipc/sysv)
21662 : XXX Do we need a useipcsysv variable here
21663 case "${d_msg}${d_sem}${d_shm}" in
21664 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21665 esac
21666 ;;
b4eb6b3d
JH
21667 NDBM_File|ndbm_fil)
21668 case "$i_ndbm" in
21669 $define)
21670 case "$osname-$use64bitint" in
0be9fa5d 21671 hpux-define)
b4eb6b3d
JH
21672 case "$libs" in
21673 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21674 esac
21675 ;;
21676 *) avail_ext="$avail_ext $xxx" ;;
21677 esac
21678 ;;
21679 esac
21680 ;;
7c345082 21681 ODBM_File|odbm_fil)
b4eb6b3d
JH
21682 case "${i_dbm}${i_rpcsvcdbm}" in
21683 *"${define}"*)
7978b0db
JH
21684 case "$d_cplusplus" in
21685 define) ;; # delete as a function name will not work
21686 *) case "$osname-$use64bitint" in
21687 hpux-define)
21688 case "$libs" in
21689 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21690 esac
21691 ;;
21692 *) avail_ext="$avail_ext $xxx" ;;
b4eb6b3d
JH
21693 esac
21694 ;;
b4eb6b3d
JH
21695 esac
21696 ;;
21697 esac
21698 ;;
7978b0db
JH
21699 Opcode|opcode)
21700 case "$useopcode" in
b4eb6b3d
JH
21701 true|define|y) avail_ext="$avail_ext $xxx" ;;
21702 esac
21703 ;;
7978b0db
JH
21704 POSIX|posix)
21705 case "$useposix" in
b4eb6b3d
JH
21706 true|define|y) avail_ext="$avail_ext $xxx" ;;
21707 esac
21708 ;;
21709 Socket|socket)
7c345082 21710 case "$d_socket" in
4a9f028c
JH
21711 true|$define|y)
21712 case "$osname" in
21713 beos) ;; # not unless BONE
21714 *) avail_ext="$avail_ext $xxx" ;;
21715 esac
21716 ;;
b4eb6b3d
JH
21717 esac
21718 ;;
21719 Sys/Syslog|sys/syslog)
21720 : XXX syslog requires socket
7c345082 21721 case "$d_socket" in
b4eb6b3d
JH
21722 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21723 esac
21724 ;;
21725 Thread|thread)
b00ec89b
AB
21726 case "$usethreads" in
21727 true|$define|y)
47f9f84c 21728 case "$use5005threads" in
3f30fabf 21729 $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
b00ec89b 21730 esac
b4eb6b3d
JH
21731 esac
21732 ;;
7978b0db
JH
21733 threads|threads/shared)
21734 # threads and threads::shared are special cases.
21735 # To stop people from asking "Perl 5.8.0 was supposed
21736 # to have this new fancy threads implementation but my
21737 # perl doesn't have it" and from people trying to
21738 # (re)install the threads module using CPAN.pm and
21739 # CPAN.pm then offering to reinstall Perl 5.8.0,
21740 # the threads.pm and threads/shared.pm will always be
21741 # there, croaking informatively ("you need to rebuild
21742 # all of Perl with threads, sorry") when threads haven't
21743 # been compiled in.
21744 # --jhi
21745 avail_ext="$avail_ext $xxx"
21746 ;;
78ff2d7b 21747 Win32*)
b149d92d
JD
21748 case "$osname" in
21749 cygwin) avail_ext="$avail_ext $xxx" ;;
21750 esac
21751 ;;
f9b6ed1c
AD
21752 XS/APItest|xs/apitest)
21753 # This is just for testing. Skip it unless we have dynamic loading.
21754
21755 case "$usedl" in
21756 $define) avail_ext="$avail_ext $xxx" ;;
21757 esac
21758 ;;
21759 XS/Typemap|xs/typemap)
21760 # This is just for testing. Skip it unless we have dynamic loading.
21761 case "$usedl" in
21762 $define) avail_ext="$avail_ext $xxx" ;;
21763 esac
21764 ;;
b4eb6b3d 21765 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
21766 ;;
21767 esac
b4eb6b3d 21768done
5f80c64f 21769
b4eb6b3d
JH
21770set X $avail_ext
21771shift
21772avail_ext="$*"
5f80c64f 21773
ef0c5be8
JH
21774case "$onlyextensions" in
21775'') ;;
21776*) keepextensions=''
21777 echo "You have requested that only certains extensions be included..." >&4
21778 for i in $onlyextensions; do
21779 case " $avail_ext " in
21780 *" $i "*)
21781 echo "Keeping extension $i."
21782 keepextensions="$keepextensions $i"
21783 ;;
21784 *) echo "Ignoring extension $i." ;;
21785 esac
21786 done
21787 avail_ext="$keepextensions"
21788 ;;
21789esac
21790
21791case "$noextensions" in
21792'') ;;
21793*) keepextensions=''
21794 echo "You have requested that certain extensions be ignored..." >&4
21795 for i in $avail_ext; do
c3dadc13
AD
21796 case " $noextensions " in
21797 *" $i "*) echo "Ignoring extension $i." ;;
ef0c5be8
JH
21798 *) echo "Keeping extension $i.";
21799 keepextensions="$keepextensions $i"
21800 ;;
21801 esac
21802 done
21803 avail_ext="$keepextensions"
21804 ;;
21805esac
21806
b4eb6b3d
JH
21807: Now see which nonxs extensions are supported on this system.
21808: For now assume all are.
21809nonxs_ext=''
21810for xxx in $nonxs_extensions ; do
21811 case "$xxx" in
21812 *) nonxs_ext="$nonxs_ext $xxx"
21813 ;;
21814 esac
21815done
5f80c64f 21816
b4eb6b3d
JH
21817set X $nonxs_ext
21818shift
21819nonxs_ext="$*"
21820
21821case $usedl in
21822$define)
21823 $cat <<EOM
21824A number of extensions are supplied with $package. You may choose to
21825compile these extensions for dynamic loading (the default), compile
21826them into the $package executable (static loading), or not include
21827them at all. Answer "none" to include no extensions.
21828Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
21829
21830EOM
b4eb6b3d 21831 case "$dynamic_ext" in
736accd3
YST
21832 '')
21833 : Exclude those listed in static_ext
21834 dflt=''
21835 for xxx in $avail_ext; do
21836 case " $static_ext " in
21837 *" $xxx "*) ;;
21838 *) dflt="$dflt $xxx" ;;
21839 esac
21840 done
21841 set X $dflt
21842 shift
21843 dflt="$*"
21844 ;;
b4eb6b3d
JH
21845 *) dflt="$dynamic_ext"
21846 # Perhaps we are reusing an old out-of-date config.sh.
21847 case "$hint" in
21848 previous)
21849 if test X"$dynamic_ext" != X"$avail_ext"; then
21850 $cat <<EOM
7c345082
RGS
21851NOTICE: Your previous config.sh list may be incorrect.
21852The extensions now available to you are
b4eb6b3d
JH
21853 ${avail_ext}
21854but the default list from your previous config.sh is
7c345082 21855 ${dynamic_ext}
9c839522 21856
b4eb6b3d
JH
21857EOM
21858 fi
9c839522
PM
21859 ;;
21860 esac
b4eb6b3d
JH
21861 ;;
21862 esac
5f80c64f 21863 case "$dflt" in
b4eb6b3d
JH
21864 '') dflt=none;;
21865 esac
21866 rp="What extensions do you wish to load dynamically?"
21867 . ./myread
21868 case "$ans" in
21869 none) dynamic_ext=' ' ;;
21870 *) dynamic_ext="$ans" ;;
5f80c64f 21871 esac
5f80c64f 21872
b4eb6b3d
JH
21873 case "$static_ext" in
21874 '')
21875 : Exclude those already listed in dynamic linking
21876 dflt=''
21877 for xxx in $avail_ext; do
21878 case " $dynamic_ext " in
21879 *" $xxx "*) ;;
21880 *) dflt="$dflt $xxx" ;;
21881 esac
21882 done
21883 set X $dflt
21884 shift
21885 dflt="$*"
21886 ;;
7c345082 21887 *) dflt="$static_ext"
b4eb6b3d
JH
21888 ;;
21889 esac
9c839522 21890
b4eb6b3d
JH
21891 case "$dflt" in
21892 '') dflt=none;;
21893 esac
21894 rp="What extensions do you wish to load statically?"
21895 . ./myread
21896 case "$ans" in
21897 none) static_ext=' ' ;;
21898 *) static_ext="$ans" ;;
21899 esac
21900 ;;
21901*)
21902 $cat <<EOM
7c345082
RGS
21903A number of extensions are supplied with $package. Answer "none"
21904to include no extensions.
b4eb6b3d 21905Note that DynaLoader is always built and need not be mentioned here.
9c839522 21906
b4eb6b3d
JH
21907EOM
21908 case "$static_ext" in
21909 '') dflt="$avail_ext" ;;
21910 *) dflt="$static_ext"
21911 # Perhaps we are reusing an old out-of-date config.sh.
21912 case "$hint" in
21913 previous)
21914 if test X"$static_ext" != X"$avail_ext"; then
21915 $cat <<EOM
7c345082
RGS
21916NOTICE: Your previous config.sh list may be incorrect.
21917The extensions now available to you are
b4eb6b3d
JH
21918 ${avail_ext}
21919but the default list from your previous config.sh is
7c345082 21920 ${static_ext}
5f80c64f
JH
21921
21922EOM
b4eb6b3d
JH
21923 fi
21924 ;;
21925 esac
21926 ;;
21927 esac
21928 : Exclude those that are not xs extensions
21929 case "$dflt" in
21930 '') dflt=none;;
21931 esac
21932 rp="What extensions do you wish to include?"
21933 . ./myread
21934 case "$ans" in
21935 none) static_ext=' ' ;;
21936 *) static_ext="$ans" ;;
21937 esac
21938 ;;
5f80c64f 21939esac
7c345082 21940#
f1f6834f
AD
21941# Encode is a special case. If we are building Encode as a static
21942# extension, we need to explicitly list its subextensions as well.
21943# For other nested extensions, this is handled automatically by
21944# the appropriate Makefile.PL.
21945case " $static_ext " in
21946 *" Encode "*) # Add the subextensions of Encode
21947 cd "$rsrc/ext"
21948 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21949 static_ext="$static_ext Encode/$xxx"
21950 done
21951 cd "$tdir"
21952 ;;
21953esac
5f80c64f 21954
b4eb6b3d
JH
21955set X $dynamic_ext $static_ext $nonxs_ext
21956shift
21957extensions="$*"
21958
93a2cd18
AD
21959# Sanity check: We require an extension suitable for use with
21960# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
21961# should show up as failures in the test suite, but it's helpful to
21962# catch them now.) The 'extensions' list is normally sorted
21963# alphabetically, so we need to accept either
21964# DB_File ... Fcntl ... IO ....
21965# or something like
21966# Fcntl ... NDBM_File ... IO ....
42fde7b2
JH
21967case " $extensions" in
21968*"_File "*" Fcntl "*" IO "*) ;; # DB_File
21969*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21970*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
7a8675bc
JH
21971*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21972 echo "WARNING: The Perl you are building will be quite crippled." >& 4
21973 ;;
21974esac
21975
9c839522
PM
21976: Remove libraries needed only for extensions
21977: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
21978: The exception is SunOS 4.x, which needs them.
21979case "${osname}X${osvers}" in
21980sunos*X4*)
21981 perllibs="$libs"
21982 ;;
21983*) case "$usedl" in
21984 $define|true|[yY]*)
a33f2d9f 21985 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
eedaba54
PM
21986 shift
21987 perllibs="$*"
21988 ;;
21989 *) perllibs="$libs"
21990 ;;
21991 esac
21992 ;;
9c839522 21993esac
5f80c64f
JH
21994
21995: Remove build directory name from cppstdin so it can be used from
21996: either the present location or the final installed location.
21997echo " "
21998: Get out of the UU directory to get correct path name.
21999cd ..
22000case "$cppstdin" in
22001`pwd`/cppstdin)
22002 echo "Stripping down cppstdin path name"
22003 cppstdin=cppstdin
22004 ;;
22005esac
22006cd UU
22007
22008: end of configuration questions
22009echo " "
22010echo "End of configuration questions."
22011echo " "
22012
22013: back to where it started
22014if test -d ../UU; then
22015 cd ..
22016fi
22017
776a38e3 22018: configuration may be unconditionally patched via a 'config.arch' file
48370efc 22019if $test -f config.arch; then
776a38e3 22020 echo "I see a config.arch file, loading it." >&4
48370efc
JH
22021 . ./config.arch
22022fi
22023
5f80c64f
JH
22024: configuration may be patched via a 'config.over' file
22025if $test -f config.over; then
22026 echo " "
22027 dflt=y
22028 rp='I see a config.over file. Do you wish to load it?'
22029 . UU/myread
22030 case "$ans" in
22031 n*) echo "OK, I'll ignore it.";;
22032 *) . ./config.over
22033 echo "Configuration override changes have been loaded."
22034 ;;
22035 esac
22036fi
22037
22038: in case they want portability, strip down executable paths
22039case "$d_portable" in
22040"$define")
22041 echo " "
22042 echo "Stripping down executable paths..." >&4
22043 for file in $loclist $trylist; do
534ac15a
JH
22044 eval temp=\$$file
22045 eval $file=`basename $temp`
5f80c64f
JH
22046 done
22047 ;;
22048esac
22049
22050: create config.sh file
22051echo " "
22052echo "Creating config.sh..." >&4
22053$spitshell <<EOT >config.sh
22054$startsh
22055#
22056# This file was produced by running the Configure script. It holds all the
22057# definitions figured out by Configure. Should you modify one of these values,
22058# do not forget to propagate your changes by running "Configure -der". You may
22059# instead choose to run each of the .SH files by yourself, or "Configure -S".
22060#
22061
22062# Package name : $package
22063# Source directory : $src
22064# Configuration time: $cf_time
22065# Configured by : $cf_by
22066# Target system : $myuname
22067
776a38e3
MB
22068EOT
22069$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22070$spitshell <<EOT >>config.sh
22071
5f80c64f
JH
22072Author='$Author'
22073Date='$Date'
22074Header='$Header'
22075Id='$Id'
22076Locker='$Locker'
22077Log='$Log'
5f80c64f
JH
22078RCSfile='$RCSfile'
22079Revision='$Revision'
22080Source='$Source'
22081State='$State'
22082_a='$_a'
22083_exe='$_exe'
22084_o='$_o'
b4eb6b3d 22085afs='$afs'
a6d26a0d 22086afsroot='$afsroot'
b4eb6b3d
JH
22087alignbytes='$alignbytes'
22088ansi2knr='$ansi2knr'
22089aphostname='$aphostname'
22090api_revision='$api_revision'
22091api_subversion='$api_subversion'
22092api_version='$api_version'
22093api_versionstring='$api_versionstring'
5f80c64f 22094ar='$ar'
b4eb6b3d
JH
22095archlib='$archlib'
22096archlibexp='$archlibexp'
22097archname64='$archname64'
22098archname='$archname'
5f80c64f 22099archobjs='$archobjs'
10bc17b6 22100asctime_r_proto='$asctime_r_proto'
5f80c64f 22101awk='$awk'
b4eb6b3d 22102baserev='$baserev'
5f80c64f 22103bash='$bash'
b4eb6b3d 22104bin='$bin'
b4eb6b3d 22105binexp='$binexp'
5f80c64f
JH
22106bison='$bison'
22107byacc='$byacc'
b4eb6b3d 22108byteorder='$byteorder'
5f80c64f 22109c='$c'
b4eb6b3d 22110castflags='$castflags'
5f80c64f
JH
22111cat='$cat'
22112cc='$cc'
22113cccdlflags='$cccdlflags'
22114ccdlflags='$ccdlflags'
22115ccflags='$ccflags'
b4eb6b3d 22116ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 22117ccname='$ccname'
b4eb6b3d 22118ccsymbols='$ccsymbols'
6b356c8e 22119ccversion='$ccversion'
5f80c64f 22120cf_by='$cf_by'
b4eb6b3d 22121cf_email='$cf_email'
5f80c64f
JH
22122cf_time='$cf_time'
22123chgrp='$chgrp'
22124chmod='$chmod'
22125chown='$chown'
b4eb6b3d 22126clocktype='$clocktype'
5f80c64f
JH
22127comm='$comm'
22128compress='$compress'
22129contains='$contains'
22130cp='$cp'
22131cpio='$cpio'
22132cpp='$cpp'
b4eb6b3d
JH
22133cpp_stuff='$cpp_stuff'
22134cppccsymbols='$cppccsymbols'
5f80c64f
JH
22135cppflags='$cppflags'
22136cpplast='$cpplast'
22137cppminus='$cppminus'
22138cpprun='$cpprun'
22139cppstdin='$cppstdin'
b4eb6b3d 22140cppsymbols='$cppsymbols'
10bc17b6 22141crypt_r_proto='$crypt_r_proto'
b4eb6b3d 22142cryptlib='$cryptlib'
5f80c64f 22143csh='$csh'
10bc17b6
JH
22144ctermid_r_proto='$ctermid_r_proto'
22145ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
22146d_Gconvert='$d_Gconvert'
22147d_PRIEUldbl='$d_PRIEUldbl'
22148d_PRIFUldbl='$d_PRIFUldbl'
22149d_PRIGUldbl='$d_PRIGUldbl'
22150d_PRIXU64='$d_PRIXU64'
22151d_PRId64='$d_PRId64'
22152d_PRIeldbl='$d_PRIeldbl'
22153d_PRIfldbl='$d_PRIfldbl'
22154d_PRIgldbl='$d_PRIgldbl'
22155d_PRIi64='$d_PRIi64'
22156d_PRIo64='$d_PRIo64'
22157d_PRIu64='$d_PRIu64'
22158d_PRIx64='$d_PRIx64'
22159d_SCNfldbl='$d_SCNfldbl'
74cac757 22160d__fwalk='$d__fwalk'
b4eb6b3d
JH
22161d_access='$d_access'
22162d_accessx='$d_accessx'
55954f19 22163d_aintl='$d_aintl'
b4eb6b3d
JH
22164d_alarm='$d_alarm'
22165d_archlib='$d_archlib'
96938616 22166d_asctime64='$d_asctime64'
10bc17b6 22167d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
22168d_atolf='$d_atolf'
22169d_atoll='$d_atoll'
fcdf39cf 22170d_attribute_deprecated='$d_attribute_deprecated'
0dbb1585
AL
22171d_attribute_format='$d_attribute_format'
22172d_attribute_malloc='$d_attribute_malloc'
22173d_attribute_nonnull='$d_attribute_nonnull'
22174d_attribute_noreturn='$d_attribute_noreturn'
22175d_attribute_pure='$d_attribute_pure'
22176d_attribute_unused='$d_attribute_unused'
22177d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
b4eb6b3d
JH
22178d_bcmp='$d_bcmp'
22179d_bcopy='$d_bcopy'
5f80c64f 22180d_bsd='$d_bsd'
b4eb6b3d
JH
22181d_bsdgetpgrp='$d_bsdgetpgrp'
22182d_bsdsetpgrp='$d_bsdsetpgrp'
635aebb7
AL
22183d_builtin_choose_expr='$d_builtin_choose_expr'
22184d_builtin_expect='$d_builtin_expect'
b4eb6b3d 22185d_bzero='$d_bzero'
a2d23ec2 22186d_c99_variadic_macros='$d_c99_variadic_macros'
b4eb6b3d
JH
22187d_casti32='$d_casti32'
22188d_castneg='$d_castneg'
22189d_charvspr='$d_charvspr'
22190d_chown='$d_chown'
22191d_chroot='$d_chroot'
22192d_chsize='$d_chsize'
758a5d79 22193d_class='$d_class'
b0a2e8e6 22194d_clearenv='$d_clearenv'
b4eb6b3d 22195d_closedir='$d_closedir'
4e0554ec 22196d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 22197d_const='$d_const'
55954f19 22198d_copysignl='$d_copysignl'
666ea192 22199d_cplusplus='$d_cplusplus'
b4eb6b3d 22200d_crypt='$d_crypt'
10bc17b6 22201d_crypt_r='$d_crypt_r'
b4eb6b3d 22202d_csh='$d_csh'
13cfc98d 22203d_ctermid='$d_ctermid'
10bc17b6 22204d_ctermid_r='$d_ctermid_r'
96938616 22205d_ctime64='$d_ctime64'
10bc17b6 22206d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
22207d_cuserid='$d_cuserid'
22208d_dbl_dig='$d_dbl_dig'
2ef53570 22209d_dbminitproto='$d_dbminitproto'
96938616 22210d_difftime64='$d_difftime64'
b4eb6b3d 22211d_difftime='$d_difftime'
de52168c 22212d_dir_dd_fd='$d_dir_dd_fd'
ae0e3d3b 22213d_dirfd='$d_dirfd'
b4eb6b3d
JH
22214d_dirnamlen='$d_dirnamlen'
22215d_dlerror='$d_dlerror'
5f80c64f 22216d_dlopen='$d_dlopen'
b4eb6b3d
JH
22217d_dlsymun='$d_dlsymun'
22218d_dosuid='$d_dosuid'
10bc17b6 22219d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
22220d_drand48proto='$d_drand48proto'
22221d_dup2='$d_dup2'
22222d_eaccess='$d_eaccess'
22223d_endgrent='$d_endgrent'
10bc17b6 22224d_endgrent_r='$d_endgrent_r'
b4eb6b3d 22225d_endhent='$d_endhent'
10bc17b6 22226d_endhostent_r='$d_endhostent_r'
b4eb6b3d 22227d_endnent='$d_endnent'
10bc17b6 22228d_endnetent_r='$d_endnetent_r'
b4eb6b3d 22229d_endpent='$d_endpent'
10bc17b6 22230d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 22231d_endpwent='$d_endpwent'
10bc17b6 22232d_endpwent_r='$d_endpwent_r'
b4eb6b3d 22233d_endsent='$d_endsent'
10bc17b6 22234d_endservent_r='$d_endservent_r'
b4eb6b3d 22235d_eofnblk='$d_eofnblk'
5f80c64f 22236d_eunice='$d_eunice'
15b61c98 22237d_faststdio='$d_faststdio'
b363b713 22238d_fchdir='$d_fchdir'
b4eb6b3d
JH
22239d_fchmod='$d_fchmod'
22240d_fchown='$d_fchown'
22241d_fcntl='$d_fcntl'
9d9004a9 22242d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
22243d_fd_macros='$d_fd_macros'
22244d_fd_set='$d_fd_set'
22245d_fds_bits='$d_fds_bits'
22246d_fgetpos='$d_fgetpos'
758a5d79
JH
22247d_finite='$d_finite'
22248d_finitel='$d_finitel'
b4eb6b3d
JH
22249d_flexfnam='$d_flexfnam'
22250d_flock='$d_flock'
2ef53570 22251d_flockproto='$d_flockproto'
b4eb6b3d 22252d_fork='$d_fork'
758a5d79 22253d_fp_class='$d_fp_class'
b4eb6b3d 22254d_fpathconf='$d_fpathconf'
758a5d79
JH
22255d_fpclass='$d_fpclass'
22256d_fpclassify='$d_fpclassify'
22257d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
22258d_fpos64_t='$d_fpos64_t'
22259d_frexpl='$d_frexpl'
22260d_fs_data_s='$d_fs_data_s'
22261d_fseeko='$d_fseeko'
22262d_fsetpos='$d_fsetpos'
22263d_fstatfs='$d_fstatfs'
22264d_fstatvfs='$d_fstatvfs'
411ab01c 22265d_fsync='$d_fsync'
b4eb6b3d
JH
22266d_ftello='$d_ftello'
22267d_ftime='$d_ftime'
dc814df1 22268d_futimes='$d_futimes'
e74475c7
MHM
22269d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22270d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
b4eb6b3d
JH
22271d_getcwd='$d_getcwd'
22272d_getespwnam='$d_getespwnam'
22273d_getfsstat='$d_getfsstat'
22274d_getgrent='$d_getgrent'
10bc17b6
JH
22275d_getgrent_r='$d_getgrent_r'
22276d_getgrgid_r='$d_getgrgid_r'
22277d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
22278d_getgrps='$d_getgrps'
22279d_gethbyaddr='$d_gethbyaddr'
22280d_gethbyname='$d_gethbyname'
22281d_gethent='$d_gethent'
22282d_gethname='$d_gethname'
10bc17b6
JH
22283d_gethostbyaddr_r='$d_gethostbyaddr_r'
22284d_gethostbyname_r='$d_gethostbyname_r'
22285d_gethostent_r='$d_gethostent_r'
b4eb6b3d 22286d_gethostprotos='$d_gethostprotos'
4e0554ec 22287d_getitimer='$d_getitimer'
b4eb6b3d 22288d_getlogin='$d_getlogin'
10bc17b6 22289d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
22290d_getmnt='$d_getmnt'
22291d_getmntent='$d_getmntent'
22292d_getnbyaddr='$d_getnbyaddr'
22293d_getnbyname='$d_getnbyname'
22294d_getnent='$d_getnent'
10bc17b6
JH
22295d_getnetbyaddr_r='$d_getnetbyaddr_r'
22296d_getnetbyname_r='$d_getnetbyname_r'
22297d_getnetent_r='$d_getnetent_r'
b4eb6b3d 22298d_getnetprotos='$d_getnetprotos'
0c0643d0 22299d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
22300d_getpbyname='$d_getpbyname'
22301d_getpbynumber='$d_getpbynumber'
22302d_getpent='$d_getpent'
22303d_getpgid='$d_getpgid'
22304d_getpgrp2='$d_getpgrp2'
22305d_getpgrp='$d_getpgrp'
22306d_getppid='$d_getppid'
22307d_getprior='$d_getprior'
10bc17b6
JH
22308d_getprotobyname_r='$d_getprotobyname_r'
22309d_getprotobynumber_r='$d_getprotobynumber_r'
22310d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
22311d_getprotoprotos='$d_getprotoprotos'
22312d_getprpwnam='$d_getprpwnam'
22313d_getpwent='$d_getpwent'
10bc17b6
JH
22314d_getpwent_r='$d_getpwent_r'
22315d_getpwnam_r='$d_getpwnam_r'
22316d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
22317d_getsbyname='$d_getsbyname'
22318d_getsbyport='$d_getsbyport'
22319d_getsent='$d_getsent'
10bc17b6
JH
22320d_getservbyname_r='$d_getservbyname_r'
22321d_getservbyport_r='$d_getservbyport_r'
22322d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
22323d_getservprotos='$d_getservprotos'
22324d_getspnam='$d_getspnam'
10bc17b6 22325d_getspnam_r='$d_getspnam_r'
b4eb6b3d 22326d_gettimeod='$d_gettimeod'
96938616 22327d_gmtime64='$d_gmtime64'
10bc17b6 22328d_gmtime_r='$d_gmtime_r'
5f80c64f 22329d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
22330d_grpasswd='$d_grpasswd'
22331d_hasmntopt='$d_hasmntopt'
22332d_htonl='$d_htonl'
55954f19 22333d_ilogbl='$d_ilogbl'
f3f1a2d8 22334d_inc_version_list='$d_inc_version_list'
b4eb6b3d
JH
22335d_index='$d_index'
22336d_inetaton='$d_inetaton'
22337d_int64_t='$d_int64_t'
22338d_isascii='$d_isascii'
758a5d79
JH
22339d_isfinite='$d_isfinite'
22340d_isinf='$d_isinf'
b4eb6b3d
JH
22341d_isnan='$d_isnan'
22342d_isnanl='$d_isnanl'
22343d_killpg='$d_killpg'
22344d_lchown='$d_lchown'
22345d_ldbl_dig='$d_ldbl_dig'
0a0abfba 22346d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 22347d_link='$d_link'
96938616 22348d_localtime64='$d_localtime64'
10bc17b6 22349d_localtime_r='$d_localtime_r'
8572b25d 22350d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
b4eb6b3d
JH
22351d_locconv='$d_locconv'
22352d_lockf='$d_lockf'
22353d_longdbl='$d_longdbl'
22354d_longlong='$d_longlong'
22355d_lseekproto='$d_lseekproto'
22356d_lstat='$d_lstat'
22357d_madvise='$d_madvise'
7dd121ae
MB
22358d_malloc_good_size='$d_malloc_good_size'
22359d_malloc_size='$d_malloc_size'
b4eb6b3d
JH
22360d_mblen='$d_mblen'
22361d_mbstowcs='$d_mbstowcs'
22362d_mbtowc='$d_mbtowc'
22363d_memchr='$d_memchr'
22364d_memcmp='$d_memcmp'
22365d_memcpy='$d_memcpy'
22366d_memmove='$d_memmove'
22367d_memset='$d_memset'
22368d_mkdir='$d_mkdir'
22369d_mkdtemp='$d_mkdtemp'
22370d_mkfifo='$d_mkfifo'
22371d_mkstemp='$d_mkstemp'
22372d_mkstemps='$d_mkstemps'
96938616 22373d_mktime64='$d_mktime64'
b4eb6b3d
JH
22374d_mktime='$d_mktime'
22375d_mmap='$d_mmap'
22376d_modfl='$d_modfl'
e67aeab1 22377d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 22378d_modflproto='$d_modflproto'
b4eb6b3d
JH
22379d_mprotect='$d_mprotect'
22380d_msg='$d_msg'
22381d_msg_ctrunc='$d_msg_ctrunc'
22382d_msg_dontroute='$d_msg_dontroute'
22383d_msg_oob='$d_msg_oob'
22384d_msg_peek='$d_msg_peek'
22385d_msg_proxy='$d_msg_proxy'
22386d_msgctl='$d_msgctl'
22387d_msgget='$d_msgget'
4e0554ec 22388d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
22389d_msgrcv='$d_msgrcv'
22390d_msgsnd='$d_msgsnd'
22391d_msync='$d_msync'
22392d_munmap='$d_munmap'
22393d_mymalloc='$d_mymalloc'
a33f2d9f 22394d_ndbm='$d_ndbm'
e74475c7 22395d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
b4eb6b3d 22396d_nice='$d_nice'
2765b840 22397d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 22398d_nv_preserves_uv='$d_nv_preserves_uv'
f607920a 22399d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
b4eb6b3d
JH
22400d_off64_t='$d_off64_t'
22401d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22402d_oldpthreads='$d_oldpthreads'
22403d_oldsock='$d_oldsock'
22404d_open3='$d_open3'
22405d_pathconf='$d_pathconf'
22406d_pause='$d_pause'
22407d_perl_otherlibdirs='$d_perl_otherlibdirs'
22408d_phostname='$d_phostname'
22409d_pipe='$d_pipe'
22410d_poll='$d_poll'
5f80c64f 22411d_portable='$d_portable'
dcb594bc 22412d_printf_format_null='$d_printf_format_null'
c7aff470 22413d_procselfexe='$d_procselfexe'
233e16ce 22414d_pseudofork='$d_pseudofork'
d6483fcc 22415d_pthread_atfork='$d_pthread_atfork'
58d975c3 22416d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
22417d_pthread_yield='$d_pthread_yield'
22418d_pwage='$d_pwage'
22419d_pwchange='$d_pwchange'
22420d_pwclass='$d_pwclass'
22421d_pwcomment='$d_pwcomment'
22422d_pwexpire='$d_pwexpire'
22423d_pwgecos='$d_pwgecos'
22424d_pwpasswd='$d_pwpasswd'
22425d_pwquota='$d_pwquota'
22426d_qgcvt='$d_qgcvt'
22427d_quad='$d_quad'
10bc17b6
JH
22428d_random_r='$d_random_r'
22429d_readdir64_r='$d_readdir64_r'
b4eb6b3d 22430d_readdir='$d_readdir'
10bc17b6 22431d_readdir_r='$d_readdir_r'
b4eb6b3d 22432d_readlink='$d_readlink'
4e0554ec
JH
22433d_readv='$d_readv'
22434d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
22435d_rename='$d_rename'
22436d_rewinddir='$d_rewinddir'
22437d_rmdir='$d_rmdir'
22438d_safebcpy='$d_safebcpy'
22439d_safemcpy='$d_safemcpy'
22440d_sanemcmp='$d_sanemcmp'
ef9f17be 22441d_sbrkproto='$d_sbrkproto'
55954f19 22442d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
22443d_sched_yield='$d_sched_yield'
22444d_scm_rights='$d_scm_rights'
22445d_seekdir='$d_seekdir'
22446d_select='$d_select'
22447d_sem='$d_sem'
22448d_semctl='$d_semctl'
22449d_semctl_semid_ds='$d_semctl_semid_ds'
22450d_semctl_semun='$d_semctl_semun'
22451d_semget='$d_semget'
22452d_semop='$d_semop'
4e0554ec 22453d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
22454d_setegid='$d_setegid'
22455d_seteuid='$d_seteuid'
22456d_setgrent='$d_setgrent'
10bc17b6 22457d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
22458d_setgrps='$d_setgrps'
22459d_sethent='$d_sethent'
10bc17b6 22460d_sethostent_r='$d_sethostent_r'
4e0554ec 22461d_setitimer='$d_setitimer'
b4eb6b3d
JH
22462d_setlinebuf='$d_setlinebuf'
22463d_setlocale='$d_setlocale'
10bc17b6 22464d_setlocale_r='$d_setlocale_r'
b4eb6b3d 22465d_setnent='$d_setnent'
10bc17b6 22466d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
22467d_setpent='$d_setpent'
22468d_setpgid='$d_setpgid'
22469d_setpgrp2='$d_setpgrp2'
22470d_setpgrp='$d_setpgrp'
22471d_setprior='$d_setprior'
22472d_setproctitle='$d_setproctitle'
10bc17b6 22473d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 22474d_setpwent='$d_setpwent'
10bc17b6 22475d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
22476d_setregid='$d_setregid'
22477d_setresgid='$d_setresgid'
22478d_setresuid='$d_setresuid'
22479d_setreuid='$d_setreuid'
22480d_setrgid='$d_setrgid'
22481d_setruid='$d_setruid'
22482d_setsent='$d_setsent'
10bc17b6 22483d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
22484d_setsid='$d_setsid'
22485d_setvbuf='$d_setvbuf'
22486d_sfio='$d_sfio'
22487d_shm='$d_shm'
22488d_shmat='$d_shmat'
22489d_shmatprototype='$d_shmatprototype'
22490d_shmctl='$d_shmctl'
22491d_shmdt='$d_shmdt'
22492d_shmget='$d_shmget'
22493d_sigaction='$d_sigaction'
ed140128 22494d_signbit='$d_signbit'
983dbef6 22495d_sigprocmask='$d_sigprocmask'
b4eb6b3d 22496d_sigsetjmp='$d_sigsetjmp'
c95d0e17 22497d_sitearch='$d_sitearch'
4f5da3e9 22498d_snprintf='$d_snprintf'
49a78c82 22499d_sockatmark='$d_sockatmark'
2ef53570 22500d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
22501d_socket='$d_socket'
22502d_socklen_t='$d_socklen_t'
22503d_sockpair='$d_sockpair'
22504d_socks5_init='$d_socks5_init'
360321b3 22505d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
b4eb6b3d 22506d_sqrtl='$d_sqrtl'
10bc17b6
JH
22507d_srand48_r='$d_srand48_r'
22508d_srandom_r='$d_srandom_r'
eef837ea 22509d_sresgproto='$d_sresgproto'
640374d0 22510d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
22511d_statblks='$d_statblks'
22512d_statfs_f_flags='$d_statfs_f_flags'
22513d_statfs_s='$d_statfs_s'
22514d_statvfs='$d_statvfs'
22515d_stdio_cnt_lval='$d_stdio_cnt_lval'
22516d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
22517d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22518d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
22519d_stdio_stream_array='$d_stdio_stream_array'
22520d_stdiobase='$d_stdiobase'
22521d_stdstdio='$d_stdstdio'
22522d_strchr='$d_strchr'
22523d_strcoll='$d_strcoll'
22524d_strctcpy='$d_strctcpy'
22525d_strerrm='$d_strerrm'
22526d_strerror='$d_strerror'
10bc17b6 22527d_strerror_r='$d_strerror_r'
b3c85772 22528d_strftime='$d_strftime'
08c92000
MB
22529d_strlcat='$d_strlcat'
22530d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
22531d_strtod='$d_strtod'
22532d_strtol='$d_strtol'
22533d_strtold='$d_strtold'
22534d_strtoll='$d_strtoll'
28e5dec8 22535d_strtoq='$d_strtoq'
b4eb6b3d
JH
22536d_strtoul='$d_strtoul'
22537d_strtoull='$d_strtoull'
22538d_strtouq='$d_strtouq'
22539d_strxfrm='$d_strxfrm'
22540d_suidsafe='$d_suidsafe'
22541d_symlink='$d_symlink'
22542d_syscall='$d_syscall'
2ef53570 22543d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
22544d_sysconf='$d_sysconf'
22545d_sysernlst='$d_sysernlst'
22546d_syserrlst='$d_syserrlst'
22547d_system='$d_system'
22548d_tcgetpgrp='$d_tcgetpgrp'
22549d_tcsetpgrp='$d_tcsetpgrp'
22550d_telldir='$d_telldir'
22551d_telldirproto='$d_telldirproto'
22552d_time='$d_time'
cbb9e8a7 22553d_timegm='$d_timegm'
b4eb6b3d 22554d_times='$d_times'
14b90194
JH
22555d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22556d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 22557d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 22558d_truncate='$d_truncate'
10bc17b6 22559d_ttyname_r='$d_ttyname_r'
b4eb6b3d 22560d_tzname='$d_tzname'
4e0554ec
JH
22561d_u32align='$d_u32align'
22562d_ualarm='$d_ualarm'
b4eb6b3d
JH
22563d_umask='$d_umask'
22564d_uname='$d_uname'
22565d_union_semun='$d_union_semun'
758a5d79 22566d_unordered='$d_unordered'
bdf33aa7 22567d_unsetenv='$d_unsetenv'
4e0554ec 22568d_usleep='$d_usleep'
2ef53570 22569d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
22570d_ustat='$d_ustat'
22571d_vendorarch='$d_vendorarch'
22572d_vendorbin='$d_vendorbin'
22573d_vendorlib='$d_vendorlib'
6e1038e0 22574d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
22575d_vfork='$d_vfork'
22576d_void_closedir='$d_void_closedir'
22577d_voidsig='$d_voidsig'
22578d_voidtty='$d_voidtty'
22579d_volatile='$d_volatile'
22580d_vprintf='$d_vprintf'
4f5da3e9 22581d_vsnprintf='$d_vsnprintf'
b4eb6b3d
JH
22582d_wait4='$d_wait4'
22583d_waitpid='$d_waitpid'
22584d_wcstombs='$d_wcstombs'
22585d_wctomb='$d_wctomb'
4e0554ec 22586d_writev='$d_writev'
5f80c64f
JH
22587d_xenix='$d_xenix'
22588date='$date'
b4eb6b3d
JH
22589db_hashtype='$db_hashtype'
22590db_prefixtype='$db_prefixtype'
640374d0
JH
22591db_version_major='$db_version_major'
22592db_version_minor='$db_version_minor'
22593db_version_patch='$db_version_patch'
b4eb6b3d
JH
22594defvoidused='$defvoidused'
22595direntrytype='$direntrytype'
22596dlext='$dlext'
5f80c64f 22597dlsrc='$dlsrc'
b4eb6b3d
JH
22598doublesize='$doublesize'
22599drand01='$drand01'
10bc17b6 22600drand48_r_proto='$drand48_r_proto'
5ac1e9b2 22601dtrace='$dtrace'
b4eb6b3d
JH
22602dynamic_ext='$dynamic_ext'
22603eagain='$eagain'
22604ebcdic='$ebcdic'
5f80c64f
JH
22605echo='$echo'
22606egrep='$egrep'
22607emacs='$emacs'
10bc17b6
JH
22608endgrent_r_proto='$endgrent_r_proto'
22609endhostent_r_proto='$endhostent_r_proto'
22610endnetent_r_proto='$endnetent_r_proto'
22611endprotoent_r_proto='$endprotoent_r_proto'
22612endpwent_r_proto='$endpwent_r_proto'
22613endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
22614eunicefix='$eunicefix'
22615exe_ext='$exe_ext'
22616expr='$expr'
b4eb6b3d 22617extensions='$extensions'
61c26d18 22618extern_C='$extern_C'
6fcddf3b 22619extras='$extras'
b4eb6b3d
JH
22620fflushNULL='$fflushNULL'
22621fflushall='$fflushall'
5f80c64f
JH
22622find='$find'
22623firstmakefile='$firstmakefile'
22624flex='$flex'
b4eb6b3d
JH
22625fpossize='$fpossize'
22626fpostype='$fpostype'
22627freetype='$freetype'
5440bc8e 22628from='$from'
b4eb6b3d
JH
22629full_ar='$full_ar'
22630full_csh='$full_csh'
22631full_sed='$full_sed'
2d736872 22632gccansipedantic='$gccansipedantic'
5b463ca7 22633gccosandvers='$gccosandvers'
5f80c64f 22634gccversion='$gccversion'
10bc17b6
JH
22635getgrent_r_proto='$getgrent_r_proto'
22636getgrgid_r_proto='$getgrgid_r_proto'
22637getgrnam_r_proto='$getgrnam_r_proto'
22638gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22639gethostbyname_r_proto='$gethostbyname_r_proto'
22640gethostent_r_proto='$gethostent_r_proto'
22641getlogin_r_proto='$getlogin_r_proto'
22642getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22643getnetbyname_r_proto='$getnetbyname_r_proto'
22644getnetent_r_proto='$getnetent_r_proto'
22645getprotobyname_r_proto='$getprotobyname_r_proto'
22646getprotobynumber_r_proto='$getprotobynumber_r_proto'
22647getprotoent_r_proto='$getprotoent_r_proto'
22648getpwent_r_proto='$getpwent_r_proto'
22649getpwnam_r_proto='$getpwnam_r_proto'
22650getpwuid_r_proto='$getpwuid_r_proto'
22651getservbyname_r_proto='$getservbyname_r_proto'
22652getservbyport_r_proto='$getservbyport_r_proto'
22653getservent_r_proto='$getservent_r_proto'
22654getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
22655gidformat='$gidformat'
22656gidsign='$gidsign'
22657gidsize='$gidsize'
22658gidtype='$gidtype'
5f80c64f 22659glibpth='$glibpth'
3c728e00 22660gmake='$gmake'
10bc17b6 22661gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 22662gnulibc_version='$gnulibc_version'
5f80c64f 22663grep='$grep'
b4eb6b3d
JH
22664groupcat='$groupcat'
22665groupstype='$groupstype'
5f80c64f 22666gzip='$gzip'
b4eb6b3d
JH
22667h_fcntl='$h_fcntl'
22668h_sysfile='$h_sysfile'
5f80c64f 22669hint='$hint'
b4eb6b3d 22670hostcat='$hostcat'
6e1038e0
MB
22671html1dir='$html1dir'
22672html1direxp='$html1direxp'
22673html3dir='$html3dir'
22674html3direxp='$html3direxp'
b4eb6b3d
JH
22675i16size='$i16size'
22676i16type='$i16type'
22677i32size='$i32size'
22678i32type='$i32type'
22679i64size='$i64size'
22680i64type='$i64type'
22681i8size='$i8size'
22682i8type='$i8type'
22683i_arpainet='$i_arpainet'
2a0de2c5 22684i_assert='$i_assert'
b4eb6b3d 22685i_bsdioctl='$i_bsdioctl'
10bc17b6 22686i_crypt='$i_crypt'
b4eb6b3d
JH
22687i_db='$i_db'
22688i_dbm='$i_dbm'
22689i_dirent='$i_dirent'
5f80c64f 22690i_dld='$i_dld'
b4eb6b3d
JH
22691i_dlfcn='$i_dlfcn'
22692i_fcntl='$i_fcntl'
22693i_float='$i_float'
758a5d79
JH
22694i_fp='$i_fp'
22695i_fp_class='$i_fp_class'
b4eb6b3d 22696i_gdbm='$i_gdbm'
a33f2d9f
AD
22697i_gdbm_ndbm='$i_gdbm_ndbm'
22698i_gdbmndbm='$i_gdbmndbm'
b4eb6b3d 22699i_grp='$i_grp'
b4eb6b3d
JH
22700i_ieeefp='$i_ieeefp'
22701i_inttypes='$i_inttypes'
2765b840 22702i_langinfo='$i_langinfo'
b4eb6b3d
JH
22703i_libutil='$i_libutil'
22704i_limits='$i_limits'
22705i_locale='$i_locale'
22706i_machcthr='$i_machcthr'
22707i_malloc='$i_malloc'
1cd66f7c 22708i_mallocmalloc='$i_mallocmalloc'
b4eb6b3d
JH
22709i_math='$i_math'
22710i_memory='$i_memory'
22711i_mntent='$i_mntent'
22712i_ndbm='$i_ndbm'
22713i_netdb='$i_netdb'
22714i_neterrno='$i_neterrno'
22715i_netinettcp='$i_netinettcp'
22716i_niin='$i_niin'
22717i_poll='$i_poll'
22718i_prot='$i_prot'
22719i_pthread='$i_pthread'
22720i_pwd='$i_pwd'
22721i_rpcsvcdbm='$i_rpcsvcdbm'
22722i_sfio='$i_sfio'
22723i_sgtty='$i_sgtty'
22724i_shadow='$i_shadow'
22725i_socks='$i_socks'
22726i_stdarg='$i_stdarg'
22727i_stddef='$i_stddef'
22728i_stdlib='$i_stdlib'
22729i_string='$i_string'
22730i_sunmath='$i_sunmath'
22731i_sysaccess='$i_sysaccess'
22732i_sysdir='$i_sysdir'
22733i_sysfile='$i_sysfile'
22734i_sysfilio='$i_sysfilio'
22735i_sysin='$i_sysin'
22736i_sysioctl='$i_sysioctl'
22737i_syslog='$i_syslog'
22738i_sysmman='$i_sysmman'
22739i_sysmode='$i_sysmode'
22740i_sysmount='$i_sysmount'
22741i_sysndir='$i_sysndir'
22742i_sysparam='$i_sysparam'
216dac04 22743i_syspoll='$i_syspoll'
b4eb6b3d
JH
22744i_sysresrc='$i_sysresrc'
22745i_syssecrt='$i_syssecrt'
22746i_sysselct='$i_sysselct'
22747i_syssockio='$i_syssockio'
22748i_sysstat='$i_sysstat'
22749i_sysstatfs='$i_sysstatfs'
22750i_sysstatvfs='$i_sysstatvfs'
22751i_systime='$i_systime'
22752i_systimek='$i_systimek'
22753i_systimes='$i_systimes'
22754i_systypes='$i_systypes'
22755i_sysuio='$i_sysuio'
22756i_sysun='$i_sysun'
22757i_sysutsname='$i_sysutsname'
22758i_sysvfs='$i_sysvfs'
22759i_syswait='$i_syswait'
22760i_termio='$i_termio'
22761i_termios='$i_termios'
22762i_time='$i_time'
22763i_unistd='$i_unistd'
22764i_ustat='$i_ustat'
22765i_utime='$i_utime'
22766i_values='$i_values'
22767i_varargs='$i_varargs'
22768i_varhdr='$i_varhdr'
22769i_vfork='$i_vfork'
5f80c64f 22770ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
22771inc_version_list='$inc_version_list'
22772inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
22773incpath='$incpath'
22774inews='$inews'
f3f1a2d8 22775initialinstalllocation='$initialinstalllocation'
b4eb6b3d
JH
22776installarchlib='$installarchlib'
22777installbin='$installbin'
6e1038e0
MB
22778installhtml1dir='$installhtml1dir'
22779installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
22780installman1dir='$installman1dir'
22781installman3dir='$installman3dir'
22782installprefix='$installprefix'
22783installprefixexp='$installprefixexp'
22784installprivlib='$installprivlib'
22785installscript='$installscript'
22786installsitearch='$installsitearch'
22787installsitebin='$installsitebin'
8d2cbf27
JH
22788installsitehtml1dir='$installsitehtml1dir'
22789installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 22790installsitelib='$installsitelib'
91e123a8
JH
22791installsiteman1dir='$installsiteman1dir'
22792installsiteman3dir='$installsiteman3dir'
6e1038e0 22793installsitescript='$installsitescript'
b4eb6b3d
JH
22794installstyle='$installstyle'
22795installusrbinperl='$installusrbinperl'
22796installvendorarch='$installvendorarch'
22797installvendorbin='$installvendorbin'
8d2cbf27
JH
22798installvendorhtml1dir='$installvendorhtml1dir'
22799installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 22800installvendorlib='$installvendorlib'
91e123a8
JH
22801installvendorman1dir='$installvendorman1dir'
22802installvendorman3dir='$installvendorman3dir'
6e1038e0 22803installvendorscript='$installvendorscript'
b4eb6b3d 22804intsize='$intsize'
4b661809 22805issymlink='$issymlink'
b4eb6b3d
JH
22806ivdformat='$ivdformat'
22807ivsize='$ivsize'
22808ivtype='$ivtype'
22809known_extensions='$known_extensions'
5f80c64f 22810ksh='$ksh'
5f80c64f
JH
22811ld='$ld'
22812lddlflags='$lddlflags'
22813ldflags='$ldflags'
b4eb6b3d
JH
22814ldflags_uselargefiles='$ldflags_uselargefiles'
22815ldlibpthname='$ldlibpthname'
5f80c64f
JH
22816less='$less'
22817lib_ext='$lib_ext'
22818libc='$libc'
b4eb6b3d 22819libperl='$libperl'
5f80c64f
JH
22820libpth='$libpth'
22821libs='$libs'
43999f95
JH
22822libsdirs='$libsdirs'
22823libsfiles='$libsfiles'
22824libsfound='$libsfound'
13b3f787 22825libspath='$libspath'
5f80c64f 22826libswanted='$libswanted'
b4eb6b3d 22827libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
22828line='$line'
22829lint='$lint'
22830lkflags='$lkflags'
22831ln='$ln'
22832lns='$lns'
10bc17b6 22833localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
22834locincpth='$locincpth'
22835loclibpth='$loclibpth'
b4eb6b3d
JH
22836longdblsize='$longdblsize'
22837longlongsize='$longlongsize'
22838longsize='$longsize'
5f80c64f
JH
22839lp='$lp'
22840lpr='$lpr'
22841ls='$ls'
b4eb6b3d
JH
22842lseeksize='$lseeksize'
22843lseektype='$lseektype'
a724edfe 22844mad='$mad'
f3f1a2d8
MB
22845madlyh='$madlyh'
22846madlyobj='$madlyobj'
22847madlysrc='$madlysrc'
5f80c64f
JH
22848mail='$mail'
22849mailx='$mailx'
22850make='$make'
22851make_set_make='$make_set_make'
b4eb6b3d
JH
22852mallocobj='$mallocobj'
22853mallocsrc='$mallocsrc'
22854malloctype='$malloctype'
22855man1dir='$man1dir'
22856man1direxp='$man1direxp'
22857man1ext='$man1ext'
22858man3dir='$man3dir'
22859man3direxp='$man3direxp'
22860man3ext='$man3ext'
5f80c64f 22861mips_type='$mips_type'
5129fff4 22862mistrustnm='$mistrustnm'
5f80c64f 22863mkdir='$mkdir'
b4eb6b3d
JH
22864mmaptype='$mmaptype'
22865modetype='$modetype'
5f80c64f 22866more='$more'
b4eb6b3d 22867multiarch='$multiarch'
5f80c64f 22868mv='$mv'
b4eb6b3d
JH
22869myarchname='$myarchname'
22870mydomain='$mydomain'
22871myhostname='$myhostname'
5f80c64f
JH
22872myuname='$myuname'
22873n='$n'
2cc61e15 22874need_va_copy='$need_va_copy'
b4eb6b3d
JH
22875netdb_hlen_type='$netdb_hlen_type'
22876netdb_host_type='$netdb_host_type'
22877netdb_name_type='$netdb_name_type'
22878netdb_net_type='$netdb_net_type'
5f80c64f
JH
22879nm='$nm'
22880nm_opt='$nm_opt'
22881nm_so_opt='$nm_so_opt'
b4eb6b3d 22882nonxs_ext='$nonxs_ext'
5f80c64f 22883nroff='$nroff'
b4eb6b3d
JH
22884nvEUformat='$nvEUformat'
22885nvFUformat='$nvFUformat'
22886nvGUformat='$nvGUformat'
b68c599a 22887nv_overflows_integers_at='$nv_overflows_integers_at'
53133ed1 22888nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
22889nveformat='$nveformat'
22890nvfformat='$nvfformat'
22891nvgformat='$nvgformat'
22892nvsize='$nvsize'
22893nvtype='$nvtype'
22894o_nonblock='$o_nonblock'
5f80c64f 22895obj_ext='$obj_ext'
b4eb6b3d 22896old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 22897optimize='$optimize'
b4eb6b3d 22898orderlib='$orderlib'
5f80c64f
JH
22899osname='$osname'
22900osvers='$osvers'
b4eb6b3d 22901otherlibdirs='$otherlibdirs'
5f80c64f 22902package='$package'
b4eb6b3d
JH
22903pager='$pager'
22904passcat='$passcat'
22905patchlevel='$patchlevel'
5f80c64f 22906path_sep='$path_sep'
b4eb6b3d 22907perl5='$perl5'
5f80c64f 22908perl='$perl'
151e6568 22909perl_patchlevel='$perl_patchlevel'
b4eb6b3d 22910perladmin='$perladmin'
9c839522 22911perllibs='$perllibs'
b4eb6b3d 22912perlpath='$perlpath'
5f80c64f 22913pg='$pg'
b4eb6b3d
JH
22914phostname='$phostname'
22915pidtype='$pidtype'
5f80c64f
JH
22916plibpth='$plibpth'
22917pmake='$pmake'
22918pr='$pr'
b4eb6b3d
JH
22919prefix='$prefix'
22920prefixexp='$prefixexp'
22921privlib='$privlib'
22922privlibexp='$privlibexp'
f24dbf84 22923procselfexe='$procselfexe'
b4eb6b3d
JH
22924prototype='$prototype'
22925ptrsize='$ptrsize'
22926quadkind='$quadkind'
22927quadtype='$quadtype'
22928randbits='$randbits'
22929randfunc='$randfunc'
10bc17b6 22930random_r_proto='$random_r_proto'
b4eb6b3d
JH
22931randseedtype='$randseedtype'
22932ranlib='$ranlib'
22933rd_nodata='$rd_nodata'
10bc17b6
JH
22934readdir64_r_proto='$readdir64_r_proto'
22935readdir_r_proto='$readdir_r_proto'
b4eb6b3d 22936revision='$revision'
5f80c64f 22937rm='$rm'
5b813a60 22938rm_try='$rm_try'
5f80c64f 22939rmail='$rmail'
5440bc8e 22940run='$run'
5f80c64f 22941runnm='$runnm'
81c4fd9e
MB
22942sGMTIME_max='$sGMTIME_max'
22943sGMTIME_min='$sGMTIME_min'
73e6e416
MB
22944sLOCALTIME_max='$sLOCALTIME_max'
22945sLOCALTIME_min='$sLOCALTIME_min'
b4eb6b3d
JH
22946sPRIEUldbl='$sPRIEUldbl'
22947sPRIFUldbl='$sPRIFUldbl'
22948sPRIGUldbl='$sPRIGUldbl'
22949sPRIXU64='$sPRIXU64'
22950sPRId64='$sPRId64'
22951sPRIeldbl='$sPRIeldbl'
22952sPRIfldbl='$sPRIfldbl'
22953sPRIgldbl='$sPRIgldbl'
22954sPRIi64='$sPRIi64'
22955sPRIo64='$sPRIo64'
22956sPRIu64='$sPRIu64'
22957sPRIx64='$sPRIx64'
22958sSCNfldbl='$sSCNfldbl'
22959sched_yield='$sched_yield'
22960scriptdir='$scriptdir'
22961scriptdirexp='$scriptdirexp'
5f80c64f 22962sed='$sed'
b4eb6b3d
JH
22963seedfunc='$seedfunc'
22964selectminbits='$selectminbits'
22965selecttype='$selecttype'
5f80c64f 22966sendmail='$sendmail'
10bc17b6
JH
22967setgrent_r_proto='$setgrent_r_proto'
22968sethostent_r_proto='$sethostent_r_proto'
22969setlocale_r_proto='$setlocale_r_proto'
22970setnetent_r_proto='$setnetent_r_proto'
22971setprotoent_r_proto='$setprotoent_r_proto'
22972setpwent_r_proto='$setpwent_r_proto'
22973setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
22974sh='$sh'
22975shar='$shar'
22976sharpbang='$sharpbang'
b4eb6b3d
JH
22977shmattype='$shmattype'
22978shortsize='$shortsize'
22979shrpenv='$shrpenv'
5f80c64f 22980shsharp='$shsharp'
b4eb6b3d
JH
22981sig_count='$sig_count'
22982sig_name='$sig_name'
22983sig_name_init='$sig_name_init'
22984sig_num='$sig_num'
22985sig_num_init='$sig_num_init'
76d3c696 22986sig_size='$sig_size'
b4eb6b3d
JH
22987signal_t='$signal_t'
22988sitearch='$sitearch'
22989sitearchexp='$sitearchexp'
22990sitebin='$sitebin'
22991sitebinexp='$sitebinexp'
8d2cbf27
JH
22992sitehtml1dir='$sitehtml1dir'
22993sitehtml1direxp='$sitehtml1direxp'
22994sitehtml3dir='$sitehtml3dir'
22995sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
22996sitelib='$sitelib'
22997sitelib_stem='$sitelib_stem'
22998sitelibexp='$sitelibexp'
91e123a8
JH
22999siteman1dir='$siteman1dir'
23000siteman1direxp='$siteman1direxp'
23001siteman3dir='$siteman3dir'
23002siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
23003siteprefix='$siteprefix'
23004siteprefixexp='$siteprefixexp'
6e1038e0
MB
23005sitescript='$sitescript'
23006sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
23007sizesize='$sizesize'
23008sizetype='$sizetype'
5f80c64f
JH
23009sleep='$sleep'
23010smail='$smail'
5f80c64f 23011so='$so'
b4eb6b3d
JH
23012sockethdr='$sockethdr'
23013socketlib='$socketlib'
23014socksizetype='$socksizetype'
5f80c64f
JH
23015sort='$sort'
23016spackage='$spackage'
23017spitshell='$spitshell'
10bc17b6
JH
23018srand48_r_proto='$srand48_r_proto'
23019srandom_r_proto='$srandom_r_proto'
5f80c64f 23020src='$src'
b4eb6b3d
JH
23021ssizetype='$ssizetype'
23022startperl='$startperl'
5f80c64f 23023startsh='$startsh'
b4eb6b3d
JH
23024static_ext='$static_ext'
23025stdchar='$stdchar'
23026stdio_base='$stdio_base'
23027stdio_bufsiz='$stdio_bufsiz'
23028stdio_cnt='$stdio_cnt'
23029stdio_filbuf='$stdio_filbuf'
23030stdio_ptr='$stdio_ptr'
23031stdio_stream_array='$stdio_stream_array'
10bc17b6 23032strerror_r_proto='$strerror_r_proto'
b4eb6b3d 23033strings='$strings'
5f80c64f 23034submit='$submit'
b4eb6b3d
JH
23035subversion='$subversion'
23036sysman='$sysman'
5f80c64f
JH
23037tail='$tail'
23038tar='$tar'
5440bc8e 23039targetarch='$targetarch'
5f80c64f
JH
23040tbl='$tbl'
23041tee='$tee'
23042test='$test'
b4eb6b3d
JH
23043timeincl='$timeincl'
23044timetype='$timetype'
10bc17b6 23045tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 23046to='$to'
5f80c64f
JH
23047touch='$touch'
23048tr='$tr'
23049trnl='$trnl'
23050troff='$troff'
10bc17b6 23051ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
23052u16size='$u16size'
23053u16type='$u16type'
23054u32size='$u32size'
23055u32type='$u32type'
23056u64size='$u64size'
23057u64type='$u64type'
23058u8size='$u8size'
23059u8type='$u8type'
23060uidformat='$uidformat'
23061uidsign='$uidsign'
23062uidsize='$uidsize'
23063uidtype='$uidtype'
5f80c64f
JH
23064uname='$uname'
23065uniq='$uniq'
b4eb6b3d
JH
23066uquadtype='$uquadtype'
23067use5005threads='$use5005threads'
23068use64bitall='$use64bitall'
23069use64bitint='$use64bitint'
5440bc8e 23070usecrosscompile='$usecrosscompile'
1be1b388 23071usedevel='$usedevel'
5f80c64f 23072usedl='$usedl'
5ac1e9b2 23073usedtrace='$usedtrace'
15b61c98 23074usefaststdio='$usefaststdio'
b4eb6b3d
JH
23075useithreads='$useithreads'
23076uselargefiles='$uselargefiles'
23077uselongdouble='$uselongdouble'
19a100ff 23078usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
23079usemorebits='$usemorebits'
23080usemultiplicity='$usemultiplicity'
23081usemymalloc='$usemymalloc'
5f80c64f 23082usenm='$usenm'
b4eb6b3d
JH
23083useopcode='$useopcode'
23084useperlio='$useperlio'
23085useposix='$useposix'
9514c62b 23086usereentrant='$usereentrant'
d51aaa9d 23087userelocatableinc='$userelocatableinc'
b4eb6b3d
JH
23088usesfio='$usesfio'
23089useshrplib='$useshrplib'
5f106f9c 23090usesitecustomize='$usesitecustomize'
29209bc5 23091usesocks='$usesocks'
b4eb6b3d
JH
23092usethreads='$usethreads'
23093usevendorprefix='$usevendorprefix'
23094usevfork='$usevfork'
5f80c64f
JH
23095usrinc='$usrinc'
23096uuname='$uuname'
b4eb6b3d
JH
23097uvXUformat='$uvXUformat'
23098uvoformat='$uvoformat'
23099uvsize='$uvsize'
23100uvtype='$uvtype'
23101uvuformat='$uvuformat'
23102uvxformat='$uvxformat'
23103vendorarch='$vendorarch'
23104vendorarchexp='$vendorarchexp'
23105vendorbin='$vendorbin'
23106vendorbinexp='$vendorbinexp'
8d2cbf27
JH
23107vendorhtml1dir='$vendorhtml1dir'
23108vendorhtml1direxp='$vendorhtml1direxp'
23109vendorhtml3dir='$vendorhtml3dir'
23110vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
23111vendorlib='$vendorlib'
23112vendorlib_stem='$vendorlib_stem'
23113vendorlibexp='$vendorlibexp'
91e123a8
JH
23114vendorman1dir='$vendorman1dir'
23115vendorman1direxp='$vendorman1direxp'
23116vendorman3dir='$vendorman3dir'
23117vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
23118vendorprefix='$vendorprefix'
23119vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
23120vendorscript='$vendorscript'
23121vendorscriptexp='$vendorscriptexp'
b4eb6b3d 23122version='$version'
861eb78d 23123version_patchlevel_string='$version_patchlevel_string'
d56c5707 23124versiononly='$versiononly'
5f80c64f 23125vi='$vi'
b4eb6b3d 23126voidflags='$voidflags'
5f80c64f 23127xlibpth='$xlibpth'
3659ebf1
JH
23128yacc='$yacc'
23129yaccflags='$yaccflags'
5f80c64f
JH
23130zcat='$zcat'
23131zip='$zip'
23132EOT
23133
23134: Add in command line options if available
23135$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23136
23137: add special variables
23138$test -f $src/patchlevel.h && \
d00b958f 23139awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
0f04e85f 23140echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
a02608de 23141echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
23142
23143: propagate old symbols
23144if $test -f UU/config.sh; then
381aa1ff 23145 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
776a38e3
MB
23146 $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23147 config.sh config.sh UU/oldconfig.sh |\
23148 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
23149 set X `cat UU/oldsyms`
23150 shift
23151 case $# in
23152 0) ;;
23153 *)
23154 cat <<EOM
23155Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23156EOM
776a38e3 23157 echo ": Variables propagated from previous config.sh file." >>config.sh
5f80c64f
JH
23158 for sym in `cat UU/oldsyms`; do
23159 echo " Propagating $hint variable "'$'"$sym..."
23160 eval 'tmp="$'"${sym}"'"'
23161 echo "$tmp" | \
23162 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23163 done
23164 ;;
23165 esac
23166fi
23167
23168: Finish up by extracting the .SH files
23169case "$alldone" in
23170exit)
23171 $rm -rf UU
24ccb310 23172 echo "Extraction done."
5f80c64f
JH
23173 exit 0
23174 ;;
23175cont)
23176 ;;
23177'')
23178 dflt=''
23179 nostick=true
23180 $cat <<EOM
23181
23182If you'd like to make any changes to the config.sh file before I begin
23183to configure things, do it as a shell escape now (e.g. !vi config.sh).
23184
23185EOM
23186 rp="Press return or use a shell escape to edit config.sh:"
23187 . UU/myread
23188 nostick=''
23189 case "$ans" in
23190 '') ;;
23191 *) : in case they cannot read
23192 sh 1>&4 -c "$ans";;
23193 esac
23194 ;;
23195esac
23196
23197: if this fails, just run all the .SH files by hand
23198. ./config.sh
23199
23200echo " "
23201exec 1>&4
a43e8593 23202pwd=`pwd`
5f80c64f 23203. ./UU/extract
6904989c 23204cd "$pwd"
5f80c64f
JH
23205
23206if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23207 dflt=y
23208 case "$silent" in
23209 true) ;;
23210 *)
23211 $cat <<EOM
23212
23213Now you need to generate make dependencies by running "$make depend".
23214You might prefer to run it in background: "$make depend > makedepend.out &"
23215It can take a while, so you might not want to run it right now.
23216
23217EOM
23218 ;;
23219 esac
23220 rp="Run $make depend now?"
23221 . UU/myread
23222 case "$ans" in
23223 y*)
3d5d58b1 23224 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
23225 ;;
23226 *)
23227 echo "You must run '$make depend' then '$make'."
23228 ;;
23229 esac
23230elif test -f [Mm]akefile; then
23231 echo " "
23232 echo "Now you must run a $make."
23233else
24ccb310 23234 echo "Configure done."
5f80c64f
JH
23235fi
23236
23237if $test -f Policy.sh; then
23238 $cat <<EOM
23239
23240If you compile $package on a different machine or from a different object
23241directory, copy the Policy.sh file from this object directory to the
23242new one before you run Configure -- this will help you with most of
23243the policy defaults.
23244
23245EOM
23246fi
23247if $test -f config.msg; then
23248 echo "Hmm. I also noted the following information while running:"
23249 echo " "
23250 $cat config.msg >&4
23251 $rm -f config.msg
23252fi
23253$rm -f kit*isdone ark*isdone
23254$rm -rf UU
23255
23256: End of Configure
23257