This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove no longer used magic vtable
[perl5.git] / Configure
CommitLineData
2304df62
AD
1#! /bin/sh
2#
3# If these # comments don't work, trim them. Don't worry about any other
4# shell scripts, Configure will trim # comments from them for you.
5#
6# (If you are trying to port this package to a machine without sh,
7# I would suggest you have a look at the prototypical config_h.SH file
8# and edit it to reflect your system. Some packages may include samples
9# of config.h for certain machines, so you might look for one of those.)
10#
11# Yes, you may rip this off to use in other distribution packages. This
12# script belongs to the public domain and cannot be copyrighted.
13#
14# (Note: this Configure script was generated automatically. Rather than
15# working with this copy of Configure, you may wish to get metaconfig.
16# The dist-3.0 package (which contains metaconfig) was posted in
dfe9444c
AD
17# comp.sources.misc and is available on CPAN under authors/id/RAM so
18# you may fetch it yourself from your nearest archive site.)
2304df62 19#
5cadb3f3
MB
20#
21# Though this script was generated by metaconfig, it is OK to send
22# patches against it. It's up to the Configure pumpkin to backport
23# the patch to the metaunits if it is accepted.
24# See Porting/pumpkin.pod for more information on metaconfig.
25#
2304df62 26
dfe9444c 27# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
2304df62 28#
22676560 29# Generated on Tue Jan 2 08:13:58 CET 2007 [metaconfig 3.0 PL70]
7f2de2d2 30# (with additional metaconfig patches by perlbug@perl.org)
2304df62 31
283fdd21 32cat >c1$$ <<EOF
2304df62
AD
33ARGGGHHHH!!!!!
34
35SCO csh still thinks true is false. Write to SCO today and tell them that next
36year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
39we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41[End of diatribe. We now return you to your regularly scheduled programming...]
42EOF
283fdd21 43cat >c2$$ <<EOF
2304df62
AD
44
45OOPS! You naughty creature! You didn't run Configure with sh!
46I will attempt to remedy the situation by running sh for you...
47EOF
48
283fdd21 49true || cat c1$$ c2$$
2304df62
AD
50true || exec sh $0 $argv:q
51
283fdd21 52(exit $?0) || cat c2$$
2304df62 53(exit $?0) || exec sh $0 $argv:q
283fdd21 54rm -f c1$$ c2$$
2304df62 55
f6538904 56if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
cbee2ce6
JH
57 cat >&4 <<EOF
58***
59*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60*** Configure that well. (Plan 9 is close to UNIX but not close enough.)
61*** Please read the README.plan9 for further instructions.
62*** Cannot continue, aborting.
63***
64EOF
65 exit 1
66fi
67
f8e2af1d
MC
68if test ! -c /dev/null ; then
69 cat >&4 <<EOF
70***
71*** I'm sorry, but /dev/null appears to be a file rather than a device.
72*** Please consult your operating sytem's notes for making a device
73*** in /dev.
74*** Cannot continue, aborting.
75***
76EOF
77 exit 1
78fi
79
a0d0e21e
LW
80: compute my invocation name
81me=$0
82case "$0" in
83*/*)
84 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
85 test "$me" || me=$0
86 ;;
87esac
88
dfe9444c 89: Proper separator for the PATH environment variable
8e07c86e
AD
90p_=:
91: On OS/2 this directory should exist if this is not floppy only system :-]
5c728af0 92if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
dfe9444c
AD
93 if test -n "$OS2_SHELL"; then
94 p_=\;
95 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
96 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
5c728af0 97 is_os2=yes
c4f23d77 98 elif test -n "$DJGPP"; then
495e2cbe
MB
99 case "X${MACHTYPE:-nonesuchmach}" in
100 *cygwin) ;;
101 *) p_=\; ;;
102 esac
dfe9444c 103 fi
39e571d4 104fi
a0d0e21e
LW
105
106: Proper PATH setting
107paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 108paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 109paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 110paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e 111paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
87bdd940 112paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
232e078e
AD
113paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
114paths="$paths /sbin /usr/sbin /usr/libexec"
3c728e00 115paths="$paths /system/gnu_library/bin"
a0d0e21e
LW
116
117for p in $paths
118do
8e07c86e
AD
119 case "$p_$PATH$p_" in
120 *$p_$p$p_*) ;;
121 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
122 esac
123done
124
8e07c86e 125PATH=.$p_$PATH
2304df62
AD
126export PATH
127
dfe9444c
AD
128: shall we be using ksh?
129inksh=''
130needksh=''
131avoidksh=''
132newsh=/bin/ksh
133changesh=''
ff0cee69 134if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
135 inksh=true
136fi
137if test -f /hp-ux -a -f /bin/ksh; then
138 needksh='to avoid sh bug in "here document" expansion'
139fi
140if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
141 if test X`/usr/bin/uname -v` = X4; then
142 avoidksh="to avoid AIX 4's /bin/sh"
143 newsh=/usr/bin/bsh
2304df62 144 fi
dfe9444c 145fi
cf04f91f
JH
146if test -f /osf_boot -a -f /usr/sbin/setld; then
147 if test X`/usr/bin/uname -s` = XOSF1; then
148 avoidksh="to avoid Digital UNIX' ksh"
149 newsh=/bin/sh
150 unset BIN_SH # if this is 'xpg4' sh will start up ksh
151 fi
152fi
dfe9444c
AD
153case "$inksh/$needksh" in
154/[a-z]*)
c4f23d77 155 ENV=''
dfe9444c
AD
156 changesh=true
157 reason="$needksh"
158 ;;
159esac
160case "$inksh/$avoidksh" in
161true/[a-z]*)
162 changesh=true
163 reason="$avoidksh"
164 ;;
165esac
166case "$inksh/$needksh-$avoidksh-" in
167true/--)
a0d0e21e
LW
168 cat <<EOM
169(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 170mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 171EOM
dfe9444c
AD
172 ;;
173esac
174case "$changesh" in
175true)
2e2a97a6 176 export newsh
dfe9444c
AD
177 echo "(Feeding myself to $newsh $reason.)"
178 case "$0" in
179 Configure|*/Configure) exec $newsh $0 "$@";;
180 *) exec $newsh Configure "$@";;
181 esac
182 ;;
183esac
2304df62 184
bfb7748a
AD
185: if needed set CDPATH to a harmless value that is not chatty
186: avoid bash 2.02 problems with empty CDPATH.
187case "$CDPATH" in
188'') ;;
189*) case "$SHELL" in
190 *bash*) CDPATH='.' ;;
191 *) CDPATH='' ;;
192 esac
193 ;;
194esac
2304df62
AD
195: Configure runs within the UU subdirectory
196test -d UU || mkdir UU
8e07c86e 197cd UU && rm -f ./*
2304df62 198
6b356c8e
JH
199ccname=''
200ccversion=''
b4eb6b3d
JH
201ccsymbols=''
202cppccsymbols=''
203cppsymbols=''
5440bc8e
JH
204from=''
205run=''
206targetarch=''
207to=''
208usecrosscompile=''
6b34ded5 209mistrustnm=''
9c839522 210perllibs=''
b4eb6b3d
JH
211dynamic_ext=''
212extensions=''
213known_extensions=''
214nonxs_ext=''
215static_ext=''
216useopcode=''
217useposix=''
6fcddf3b 218extras=''
ecfc5424 219d_bsd=''
40a7a20a 220d_eunice=''
2304df62
AD
221d_xenix=''
222eunicefix=''
223Mcc=''
dfe9444c 224ar=''
2304df62
AD
225awk=''
226bash=''
227bison=''
228byacc=''
229cat=''
230chgrp=''
231chmod=''
232chown=''
ecfc5424 233comm=''
2304df62
AD
234compress=''
235cp=''
236cpio=''
237cpp=''
238csh=''
239date=''
240echo=''
241egrep=''
242emacs=''
243expr=''
244find=''
245flex=''
3c728e00 246gmake=''
2304df62 247grep=''
8ff267be 248gzip=''
2304df62
AD
249inews=''
250ksh=''
251less=''
252line=''
253lint=''
254ln=''
255lp=''
256lpr=''
257ls=''
258mail=''
259mailx=''
dfe9444c 260make=''
2304df62
AD
261mkdir=''
262more=''
263mv=''
693762b4 264nm=''
2304df62
AD
265nroff=''
266perl=''
267pg=''
268pmake=''
269pr=''
270rm=''
271rmail=''
272sed=''
273sendmail=''
2304df62
AD
274shar=''
275sleep=''
276smail=''
277sort=''
278submit=''
279tail=''
280tar=''
281tbl=''
693762b4 282tee=''
2304df62
AD
283test=''
284touch=''
285tr=''
286troff=''
287uname=''
288uniq=''
289uuname=''
290vi=''
291zcat=''
8ff267be 292zip=''
b4eb6b3d
JH
293full_ar=''
294full_sed=''
a0d0e21e 295libswanted=''
2304df62
AD
296hint=''
297myuname=''
85e6fe83
LW
298osname=''
299osvers=''
2304df62
AD
300Author=''
301Date=''
302Header=''
303Id=''
304Locker=''
305Log=''
306RCSfile=''
307Revision=''
308Source=''
309State=''
dfe9444c
AD
310_a=''
311_exe=''
312_o=''
4633a7c4
LW
313archobjs=''
314exe_ext=''
315firstmakefile=''
316lib_ext=''
317obj_ext=''
318path_sep=''
b4eb6b3d 319afs=''
a6d26a0d 320afsroot=''
b4eb6b3d
JH
321alignbytes=''
322ansi2knr=''
323archlib=''
324archlibexp=''
325d_archlib=''
326installarchlib=''
327archname=''
328myarchname=''
329d_atolf=''
330d_atoll=''
331baserev=''
332bin=''
333binexp=''
f3f1a2d8 334initialinstalllocation=''
b4eb6b3d 335installbin=''
f3f1a2d8 336userelocatableinc=''
b4eb6b3d 337byteorder=''
2304df62 338cc=''
2304df62
AD
339ccflags=''
340cppflags=''
341ldflags=''
342lkflags=''
8e07c86e 343locincpth=''
2304df62 344optimize=''
b4eb6b3d 345cf_email=''
2304df62
AD
346cf_by=''
347cf_time=''
b4eb6b3d 348charsize=''
2304df62 349contains=''
b4eb6b3d 350cpp_stuff=''
2304df62
AD
351cpplast=''
352cppminus=''
353cpprun=''
354cppstdin=''
74cac757 355d__fwalk=''
b4eb6b3d
JH
356d_access=''
357d_accessx=''
55954f19 358d_aintl=''
b4eb6b3d 359d_alarm=''
10bc17b6
JH
360asctime_r_proto=''
361d_asctime_r=''
0dbb1585
AL
362d_attribute_format=''
363d_attribute_malloc=''
364d_attribute_nonnull=''
365d_attribute_noreturn=''
366d_attribute_pure=''
367d_attribute_unused=''
368d_attribute_warn_unused_result=''
dcb594bc 369d_printf_format_null=''
b4eb6b3d
JH
370d_bcmp=''
371d_bcopy=''
635aebb7
AL
372d_builtin_choose_expr=''
373d_builtin_expect=''
b4eb6b3d 374d_bzero=''
a2d23ec2 375d_c99_variadic_macros=''
b4eb6b3d
JH
376d_casti32=''
377castflags=''
378d_castneg=''
379d_chown=''
380d_chroot=''
381d_chsize=''
758a5d79 382d_class=''
b0a2e8e6 383d_clearenv=''
b4eb6b3d
JH
384d_closedir=''
385d_void_closedir=''
4e0554ec 386d_cmsghdr_s=''
b4eb6b3d 387d_const=''
36adc09b 388d_copysignl=''
666ea192 389d_cplusplus=''
b4eb6b3d
JH
390cryptlib=''
391d_crypt=''
10bc17b6
JH
392crypt_r_proto=''
393d_crypt_r=''
b4eb6b3d
JH
394d_csh=''
395full_csh=''
13cfc98d 396d_ctermid=''
10bc17b6
JH
397ctermid_r_proto=''
398d_ctermid_r=''
399ctime_r_proto=''
400d_ctime_r=''
b4eb6b3d
JH
401d_cuserid=''
402d_dbl_dig=''
2ef53570 403d_dbminitproto=''
b4eb6b3d 404d_difftime=''
de52168c 405d_dir_dd_fd=''
ae0e3d3b 406d_dirfd=''
b4eb6b3d 407d_dlerror=''
a0d0e21e 408d_dlopen=''
b4eb6b3d
JH
409d_dlsymun=''
410d_dosuid=''
411d_suidsafe=''
10bc17b6
JH
412d_drand48_r=''
413drand48_r_proto=''
b4eb6b3d
JH
414d_drand48proto=''
415d_dup2=''
416d_eaccess=''
417d_endgrent=''
10bc17b6
JH
418d_endgrent_r=''
419endgrent_r_proto=''
b4eb6b3d 420d_endhent=''
10bc17b6
JH
421d_endhostent_r=''
422endhostent_r_proto=''
b4eb6b3d 423d_endnent=''
10bc17b6
JH
424d_endnetent_r=''
425endnetent_r_proto=''
b4eb6b3d 426d_endpent=''
10bc17b6
JH
427d_endprotoent_r=''
428endprotoent_r_proto=''
b4eb6b3d 429d_endpwent=''
10bc17b6
JH
430d_endpwent_r=''
431endpwent_r_proto=''
b4eb6b3d 432d_endsent=''
10bc17b6
JH
433d_endservent_r=''
434endservent_r_proto=''
15b61c98 435d_faststdio=''
b363b713 436d_fchdir=''
b4eb6b3d
JH
437d_fchmod=''
438d_fchown=''
439d_fcntl=''
9d9004a9 440d_fcntl_can_lock=''
b4eb6b3d
JH
441d_fd_macros=''
442d_fd_set=''
443d_fds_bits=''
444d_fgetpos=''
758a5d79
JH
445d_finite=''
446d_finitel=''
b4eb6b3d
JH
447d_flexfnam=''
448d_flock=''
2ef53570 449d_flockproto=''
b4eb6b3d 450d_fork=''
758a5d79
JH
451d_fp_class=''
452d_fpclass=''
453d_fpclassify=''
454d_fpclassl=''
b4eb6b3d
JH
455d_fpos64_t=''
456d_frexpl=''
457d_fs_data_s=''
458d_fseeko=''
459d_fsetpos=''
460d_fstatfs=''
411ab01c 461d_fsync=''
b4eb6b3d
JH
462d_ftello=''
463d_ftime=''
464d_gettimeod=''
dc814df1 465d_futimes=''
b4eb6b3d
JH
466d_Gconvert=''
467d_getcwd=''
468d_getespwnam=''
469d_getfsstat=''
470d_getgrent=''
10bc17b6
JH
471d_getgrent_r=''
472getgrent_r_proto=''
473d_getgrgid_r=''
474getgrgid_r_proto=''
475d_getgrnam_r=''
476getgrnam_r_proto=''
b4eb6b3d
JH
477d_getgrps=''
478d_gethbyaddr=''
479d_gethbyname=''
480d_gethent=''
481aphostname=''
482d_gethname=''
483d_phostname=''
484d_uname=''
10bc17b6
JH
485d_gethostbyaddr_r=''
486gethostbyaddr_r_proto=''
487d_gethostbyname_r=''
488gethostbyname_r_proto=''
489d_gethostent_r=''
490gethostent_r_proto=''
b4eb6b3d 491d_gethostprotos=''
4e0554ec 492d_getitimer=''
b4eb6b3d 493d_getlogin=''
10bc17b6
JH
494d_getlogin_r=''
495getlogin_r_proto=''
b4eb6b3d
JH
496d_getmnt=''
497d_getmntent=''
498d_getnbyaddr=''
499d_getnbyname=''
500d_getnent=''
10bc17b6
JH
501d_getnetbyaddr_r=''
502getnetbyaddr_r_proto=''
503d_getnetbyname_r=''
504getnetbyname_r_proto=''
505d_getnetent_r=''
506getnetent_r_proto=''
b4eb6b3d 507d_getnetprotos=''
0c0643d0 508d_getpagsz=''
b4eb6b3d
JH
509d_getpent=''
510d_getpgid=''
511d_getpgrp2=''
512d_bsdgetpgrp=''
513d_getpgrp=''
514d_getppid=''
515d_getprior=''
516d_getpbyname=''
517d_getpbynumber=''
10bc17b6
JH
518d_getprotobyname_r=''
519getprotobyname_r_proto=''
520d_getprotobynumber_r=''
521getprotobynumber_r_proto=''
522d_getprotoent_r=''
523getprotoent_r_proto=''
b4eb6b3d
JH
524d_getprotoprotos=''
525d_getprpwnam=''
526d_getpwent=''
10bc17b6
JH
527d_getpwent_r=''
528getpwent_r_proto=''
529d_getpwnam_r=''
530getpwnam_r_proto=''
531d_getpwuid_r=''
532getpwuid_r_proto=''
b4eb6b3d 533d_getsent=''
10bc17b6
JH
534d_getservbyname_r=''
535getservbyname_r_proto=''
536d_getservbyport_r=''
537getservbyport_r_proto=''
538d_getservent_r=''
539getservent_r_proto=''
b4eb6b3d
JH
540d_getservprotos=''
541d_getspnam=''
10bc17b6
JH
542d_getspnam_r=''
543getspnam_r_proto=''
b4eb6b3d
JH
544d_getsbyname=''
545d_getsbyport=''
10bc17b6
JH
546d_gmtime_r=''
547gmtime_r_proto=''
a4f3eea9 548d_gnulibc=''
5f6e0ee4 549gnulibc_version=''
b4eb6b3d
JH
550d_hasmntopt=''
551d_htonl=''
55954f19 552d_ilogbl=''
b4eb6b3d
JH
553d_inetaton=''
554d_int64_t=''
555d_isascii=''
758a5d79
JH
556d_isfinite=''
557d_isinf=''
b4eb6b3d
JH
558d_isnan=''
559d_isnanl=''
560d_killpg=''
561d_lchown=''
562d_ldbl_dig=''
0a0abfba 563d_libm_lib_version=''
b4eb6b3d 564d_link=''
10bc17b6 565d_localtime_r=''
8572b25d 566d_localtime_r_needs_tzset=''
10bc17b6 567localtime_r_proto=''
b4eb6b3d
JH
568d_locconv=''
569d_lockf=''
570d_longdbl=''
571longdblsize=''
572d_longlong=''
573longlongsize=''
574d_lseekproto=''
575d_lstat=''
576d_madvise=''
7dd121ae
MB
577d_malloc_good_size=''
578d_malloc_size=''
b4eb6b3d
JH
579d_mblen=''
580d_mbstowcs=''
581d_mbtowc=''
582d_memchr=''
583d_memcmp=''
584d_memcpy=''
585d_memmove=''
586d_memset=''
587d_mkdir=''
588d_mkdtemp=''
589d_mkfifo=''
590d_mkstemp=''
591d_mkstemps=''
592d_mktime=''
593d_mmap=''
594mmaptype=''
595d_modfl=''
e67aeab1 596d_modfl_pow32_bug=''
bc9a1b2c 597d_modflproto=''
b4eb6b3d
JH
598d_mprotect=''
599d_msg=''
600d_msgctl=''
601d_msgget=''
4e0554ec 602d_msghdr_s=''
b4eb6b3d
JH
603d_msgrcv=''
604d_msgsnd=''
605d_msync=''
606d_munmap=''
607d_nice=''
2765b840 608d_nl_langinfo=''
b4eb6b3d
JH
609d_off64_t=''
610d_open3=''
611d_fpathconf=''
612d_pathconf=''
613d_pause=''
614d_pipe=''
615d_poll=''
2304df62 616d_portable=''
a33c94aa 617d_procselfexe=''
f24dbf84 618procselfexe=''
b4eb6b3d
JH
619d_old_pthread_create_joinable=''
620old_pthread_create_joinable=''
d6483fcc 621d_pthread_atfork=''
58d975c3 622d_pthread_attr_setscope=''
b4eb6b3d
JH
623d_pthread_yield=''
624d_sched_yield=''
625sched_yield=''
626d_qgcvt=''
10bc17b6
JH
627d_random_r=''
628random_r_proto=''
629d_readdir64_r=''
630readdir64_r_proto=''
b4eb6b3d
JH
631d_readdir=''
632d_rewinddir=''
633d_seekdir=''
634d_telldir=''
10bc17b6
JH
635d_readdir_r=''
636readdir_r_proto=''
b4eb6b3d 637d_readlink=''
4e0554ec
JH
638d_readv=''
639d_recvmsg=''
b4eb6b3d
JH
640d_rename=''
641d_rmdir=''
642d_safebcpy=''
643d_safemcpy=''
644d_sanemcmp=''
ef9f17be 645d_sbrkproto=''
55954f19 646d_scalbnl=''
b4eb6b3d
JH
647d_select=''
648d_sem=''
649d_semctl=''
650d_semget=''
651d_semop=''
4e0554ec 652d_sendmsg=''
b4eb6b3d
JH
653d_setegid=''
654d_seteuid=''
655d_setgrent=''
10bc17b6
JH
656d_setgrent_r=''
657setgrent_r_proto=''
b4eb6b3d
JH
658d_setgrps=''
659d_sethent=''
10bc17b6
JH
660d_sethostent_r=''
661sethostent_r_proto=''
4e0554ec 662d_setitimer=''
b4eb6b3d
JH
663d_setlinebuf=''
664d_setlocale=''
10bc17b6
JH
665d_setlocale_r=''
666setlocale_r_proto=''
b4eb6b3d 667d_setnent=''
10bc17b6
JH
668d_setnetent_r=''
669setnetent_r_proto=''
b4eb6b3d
JH
670d_setpent=''
671d_setpgid=''
672d_setpgrp2=''
673d_bsdsetpgrp=''
674d_setpgrp=''
675d_setprior=''
676d_setproctitle=''
10bc17b6
JH
677d_setprotoent_r=''
678setprotoent_r_proto=''
b4eb6b3d 679d_setpwent=''
10bc17b6
JH
680d_setpwent_r=''
681setpwent_r_proto=''
b4eb6b3d
JH
682d_setregid=''
683d_setresgid=''
684d_setresuid=''
685d_setreuid=''
686d_setrgid=''
687d_setruid=''
688d_setsent=''
10bc17b6
JH
689d_setservent_r=''
690setservent_r_proto=''
b4eb6b3d
JH
691d_setsid=''
692d_setvbuf=''
693d_sfio=''
694usesfio=''
695d_shm=''
696d_shmat=''
697d_shmatprototype=''
698shmattype=''
699d_shmctl=''
700d_shmdt=''
701d_shmget=''
702d_sigaction=''
983dbef6 703d_sigprocmask=''
b4eb6b3d 704d_sigsetjmp=''
5f106f9c 705usesitecustomize=''
4f5da3e9
SP
706d_snprintf=''
707d_vsnprintf=''
49a78c82 708d_sockatmark=''
2ef53570 709d_sockatmarkproto=''
b4eb6b3d
JH
710d_msg_ctrunc=''
711d_msg_dontroute=''
712d_msg_oob=''
713d_msg_peek=''
714d_msg_proxy=''
715d_oldsock=''
716d_scm_rights=''
717d_socket=''
718d_sockpair=''
719sockethdr=''
720socketlib=''
721d_socklen_t=''
722d_socks5_init=''
360321b3 723d_sprintf_returns_strlen=''
b4eb6b3d 724d_sqrtl=''
10bc17b6
JH
725d_srand48_r=''
726srand48_r_proto=''
727d_srandom_r=''
728srandom_r_proto=''
eef837ea 729d_sresgproto=''
640374d0 730d_sresuproto=''
b4eb6b3d
JH
731d_statblks=''
732d_statfs_f_flags=''
733d_statfs_s=''
734d_fstatvfs=''
735d_statvfs=''
736d_stdio_cnt_lval=''
737d_stdio_ptr_lval=''
a7ffa9b9
NC
738d_stdio_ptr_lval_nochange_cnt=''
739d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
740d_stdiobase=''
741d_stdstdio=''
742stdio_base=''
743stdio_bufsiz=''
744stdio_cnt=''
745stdio_filbuf=''
746stdio_ptr=''
747d_index=''
748d_strchr=''
749d_strcoll=''
750d_strctcpy=''
751d_strerrm=''
752d_strerror=''
753d_sysernlst=''
754d_syserrlst=''
10bc17b6
JH
755d_strerror_r=''
756strerror_r_proto=''
b3c85772 757d_strftime=''
08c92000
MB
758d_strlcat=''
759d_strlcpy=''
b4eb6b3d
JH
760d_strtod=''
761d_strtol=''
762d_strtold=''
763d_strtoll=''
28e5dec8 764d_strtoq=''
b4eb6b3d
JH
765d_strtoul=''
766d_strtoull=''
767d_strtouq=''
768d_strxfrm=''
769d_symlink=''
770d_syscall=''
2ef53570 771d_syscallproto=''
b4eb6b3d
JH
772d_sysconf=''
773d_system=''
774d_tcgetpgrp=''
775d_tcsetpgrp=''
776d_telldirproto=''
777d_time=''
778timetype=''
779clocktype=''
780d_times=''
10bc17b6
JH
781d_tmpnam_r=''
782tmpnam_r_proto=''
b4eb6b3d 783d_truncate=''
10bc17b6
JH
784d_ttyname_r=''
785ttyname_r_proto=''
b4eb6b3d 786d_tzname=''
4e0554ec
JH
787d_u32align=''
788d_ualarm=''
b4eb6b3d
JH
789d_umask=''
790d_semctl_semid_ds=''
791d_semctl_semun=''
792d_union_semun=''
758a5d79 793d_unordered=''
bdf33aa7 794d_unsetenv=''
4e0554ec 795d_usleep=''
2ef53570 796d_usleepproto=''
b4eb6b3d 797d_ustat=''
233e16ce 798d_pseudofork=''
b4eb6b3d
JH
799d_vfork=''
800usevfork=''
801d_voidsig=''
802signal_t=''
803d_volatile=''
804d_charvspr=''
805d_vprintf=''
806d_wait4=''
807d_waitpid=''
808d_wcstombs=''
809d_wctomb=''
4e0554ec 810d_writev=''
b4eb6b3d 811dlext=''
85e6fe83
LW
812cccdlflags=''
813ccdlflags=''
2304df62 814dlsrc=''
232e078e 815ld=''
85e6fe83 816lddlflags=''
2304df62 817usedl=''
b4eb6b3d
JH
818doublesize=''
819ebcdic=''
820fflushNULL=''
821fflushall=''
822fpossize=''
823fpostype=''
2d736872 824gccansipedantic=''
5b463ca7 825gccosandvers=''
8a27cf78 826gccversion=''
b4eb6b3d
JH
827gidformat=''
828gidsign=''
829gidsize=''
830gidtype=''
831groupstype=''
832h_fcntl=''
833h_sysfile=''
6e1038e0
MB
834html1dir=''
835html1direxp=''
836installhtml1dir=''
837html3dir=''
838html3direxp=''
839installhtml3dir=''
b4eb6b3d 840i_arpainet=''
10bc17b6 841i_crypt=''
b4eb6b3d
JH
842db_hashtype=''
843db_prefixtype=''
640374d0
JH
844db_version_major=''
845db_version_minor=''
846db_version_patch=''
b4eb6b3d
JH
847i_db=''
848i_dbm=''
849i_rpcsvcdbm=''
850d_dirnamlen=''
851direntrytype=''
852i_dirent=''
a0d0e21e 853i_dld=''
b4eb6b3d
JH
854i_dlfcn=''
855i_fcntl=''
856i_float=''
758a5d79
JH
857i_fp=''
858i_fp_class=''
b4eb6b3d
JH
859i_gdbm=''
860d_grpasswd=''
861i_grp=''
b4eb6b3d
JH
862i_ieeefp=''
863i_inttypes=''
2765b840 864i_langinfo=''
b4eb6b3d
JH
865i_libutil=''
866i_limits=''
867i_locale=''
868i_machcthr=''
869i_malloc=''
870i_math=''
871i_memory=''
872i_mntent=''
873i_ndbm=''
874i_netdb=''
875i_neterrno=''
876i_netinettcp=''
877i_niin=''
878i_sysin=''
879i_poll=''
880i_prot=''
881i_pthread=''
882d_pwage=''
883d_pwchange=''
884d_pwclass=''
885d_pwcomment=''
886d_pwexpire=''
887d_pwgecos=''
888d_pwpasswd=''
889d_pwquota=''
890i_pwd=''
891i_sfio=''
892i_shadow=''
893i_socks=''
894i_stddef=''
895i_stdlib=''
896i_string=''
897strings=''
898i_sunmath=''
899i_sysaccess=''
900i_sysdir=''
901i_sysfile=''
902d_voidtty=''
903i_bsdioctl=''
904i_sysfilio=''
905i_sysioctl=''
906i_syssockio=''
907i_syslog=''
908i_sysmman=''
909i_sysmode=''
910i_sysmount=''
911i_sysndir=''
912i_sysparam=''
913i_sysresrc=''
914i_syssecrt=''
915i_sysselct=''
916i_sysstat=''
917i_sysstatfs=''
918i_sysstatvfs=''
919i_systimes=''
920i_systypes=''
921i_sysuio=''
922i_sysun=''
923i_sysutsname=''
924i_sysvfs=''
925i_syswait=''
926i_sgtty=''
927i_termio=''
928i_termios=''
14b90194
JH
929d_tm_tm_gmtoff=''
930d_tm_tm_zone=''
b4eb6b3d
JH
931i_systime=''
932i_systimek=''
933i_time=''
934timeincl=''
935i_unistd=''
936i_ustat=''
937i_utime=''
938i_values=''
939i_stdarg=''
940i_varargs=''
941i_varhdr=''
942i_vfork=''
f3f1a2d8 943d_inc_version_list=''
b4eb6b3d
JH
944inc_version_list=''
945inc_version_list_init=''
946installprefix=''
947installprefixexp=''
948installstyle=''
949installusrbinperl=''
950intsize=''
951longsize=''
952shortsize=''
4b661809 953issymlink=''
2304df62 954libc=''
b4eb6b3d
JH
955ldlibpthname=''
956libperl=''
957shrpenv=''
958useshrplib=''
a0d0e21e 959glibpth=''
2304df62 960libpth=''
8e07c86e 961loclibpth=''
2304df62
AD
962plibpth=''
963xlibpth=''
1cfa4ec7 964ignore_versioned_solibs=''
2304df62 965libs=''
43999f95
JH
966libsdirs=''
967libsfiles=''
968libsfound=''
13b3f787 969libspath=''
85e6fe83 970lns=''
b4eb6b3d
JH
971d_PRIEUldbl=''
972d_PRIFUldbl=''
973d_PRIGUldbl=''
974d_PRIeldbl=''
975d_PRIfldbl=''
976d_PRIgldbl=''
977d_SCNfldbl=''
978sPRIEUldbl=''
979sPRIFUldbl=''
980sPRIGUldbl=''
981sPRIeldbl=''
982sPRIfldbl=''
983sPRIgldbl=''
984sSCNfldbl=''
985lseeksize=''
986lseektype=''
d620c7b3 987mad=''
00e74f14
NC
988madlyh=''
989madlyobj=''
990madlysrc=''
f3f1a2d8
MB
991make_set_make=''
992d_mymalloc=''
993freetype=''
b4eb6b3d
JH
994mallocobj=''
995mallocsrc=''
996malloctype=''
9df442c2 997usemallocwrap=''
b4eb6b3d
JH
998usemymalloc=''
999installman1dir=''
1000man1dir=''
1001man1direxp=''
1002man1ext=''
1003installman3dir=''
1004man3dir=''
1005man3direxp=''
1006man3ext=''
1007modetype=''
1008multiarch=''
1009mydomain=''
1010myhostname=''
1011phostname=''
2304df62
AD
1012c=''
1013n=''
b4eb6b3d
JH
1014d_eofnblk=''
1015eagain=''
1016o_nonblock=''
1017rd_nodata=''
2cc61e15 1018need_va_copy=''
b4eb6b3d
JH
1019netdb_hlen_type=''
1020netdb_host_type=''
1021netdb_name_type=''
1022netdb_net_type=''
1023groupcat=''
1024hostcat=''
1025passcat=''
1026orderlib=''
1027ranlib=''
1028d_perl_otherlibdirs=''
1029otherlibdirs=''
2304df62
AD
1030package=''
1031spackage=''
b4eb6b3d
JH
1032pager=''
1033api_revision=''
1034api_subversion=''
1035api_version=''
1036api_versionstring=''
1037patchlevel=''
151e6568 1038perl_patchlevel=''
b4eb6b3d
JH
1039revision=''
1040subversion=''
1041version=''
861eb78d 1042version_patchlevel_string=''
b4eb6b3d
JH
1043perl5=''
1044perladmin=''
1045perlpath=''
1046d_nv_preserves_uv=''
f607920a 1047d_nv_zero_is_allbits_zero=''
b4eb6b3d
JH
1048i16size=''
1049i16type=''
1050i32size=''
1051i32type=''
1052i64size=''
1053i64type=''
1054i8size=''
1055i8type=''
1056ivsize=''
1057ivtype=''
53133ed1 1058nv_preserves_uv_bits=''
b4eb6b3d
JH
1059nvsize=''
1060nvtype=''
1061u16size=''
1062u16type=''
1063u32size=''
1064u32type=''
1065u64size=''
1066u64type=''
1067u8size=''
1068u8type=''
1069uvsize=''
1070uvtype=''
1071ivdformat=''
1072nvEUformat=''
1073nvFUformat=''
1074nvGUformat=''
1075nveformat=''
1076nvfformat=''
1077nvgformat=''
1078uvXUformat=''
1079uvoformat=''
1080uvuformat=''
1081uvxformat=''
1082pidtype=''
1083prefix=''
1084prefixexp=''
1085installprivlib=''
1086privlib=''
1087privlibexp=''
1088prototype=''
1089ptrsize=''
1090d_PRIXU64=''
1091d_PRId64=''
1092d_PRIi64=''
1093d_PRIo64=''
1094d_PRIu64=''
1095d_PRIx64=''
1096sPRIXU64=''
1097sPRId64=''
1098sPRIi64=''
1099sPRIo64=''
1100sPRIu64=''
1101sPRIx64=''
1102d_quad=''
1103quadkind=''
1104quadtype=''
1105uquadtype=''
1106drand01=''
1107randbits=''
1108randfunc=''
1109randseedtype=''
1110seedfunc=''
1111installscript=''
1112scriptdir=''
1113scriptdirexp=''
1114selectminbits=''
1115selecttype=''
8ff267be 1116sh=''
b4eb6b3d
JH
1117sig_count=''
1118sig_name=''
1119sig_name_init=''
1120sig_num=''
1121sig_num_init=''
76d3c696 1122sig_size=''
f3f1a2d8 1123d_sitearch=''
b4eb6b3d
JH
1124installsitearch=''
1125sitearch=''
1126sitearchexp=''
1127installsitebin=''
1128sitebin=''
1129sitebinexp=''
8d2cbf27
JH
1130installsitehtml1dir=''
1131sitehtml1dir=''
1132sitehtml1direxp=''
1133installsitehtml3dir=''
1134sitehtml3dir=''
1135sitehtml3direxp=''
b4eb6b3d
JH
1136installsitelib=''
1137sitelib=''
1138sitelib_stem=''
1139sitelibexp=''
91e123a8
JH
1140installsiteman1dir=''
1141siteman1dir=''
1142siteman1direxp=''
1143installsiteman3dir=''
1144siteman3dir=''
1145siteman3direxp=''
b4eb6b3d
JH
1146siteprefix=''
1147siteprefixexp=''
6e1038e0
MB
1148installsitescript=''
1149sitescript=''
1150sitescriptexp=''
b4eb6b3d
JH
1151sizesize=''
1152sizetype=''
a0d0e21e 1153so=''
b4eb6b3d 1154socksizetype=''
2304df62
AD
1155sharpbang=''
1156shsharp=''
1157spitshell=''
dfe9444c 1158src=''
b4eb6b3d
JH
1159ssizetype=''
1160startperl=''
2304df62 1161startsh=''
b4eb6b3d
JH
1162stdchar=''
1163d_stdio_stream_array=''
1164stdio_stream_array=''
1165sysman=''
5ff3f7a4 1166trnl=''
b4eb6b3d
JH
1167uidformat=''
1168uidsign=''
1169uidsize=''
1170uidtype=''
1171archname64=''
1172use64bitall=''
1173use64bitint=''
15b61c98 1174usefaststdio=''
b4eb6b3d
JH
1175ccflags_uselargefiles=''
1176ldflags_uselargefiles=''
1177libswanted_uselargefiles=''
1178uselargefiles=''
1179uselongdouble=''
1180usemorebits=''
1181usemultiplicity=''
2304df62 1182nm_opt=''
40a7a20a 1183nm_so_opt=''
2304df62
AD
1184runnm=''
1185usenm=''
b4eb6b3d 1186useperlio=''
29209bc5 1187usesocks=''
b4eb6b3d
JH
1188d_oldpthreads=''
1189use5005threads=''
1190useithreads=''
9514c62b 1191usereentrant=''
b4eb6b3d 1192usethreads=''
2304df62 1193incpath=''
2304df62
AD
1194mips_type=''
1195usrinc=''
b4eb6b3d
JH
1196d_vendorarch=''
1197installvendorarch=''
1198vendorarch=''
1199vendorarchexp=''
1200d_vendorbin=''
1201installvendorbin=''
1202vendorbin=''
1203vendorbinexp=''
8d2cbf27
JH
1204installvendorhtml1dir=''
1205vendorhtml1dir=''
1206vendorhtml1direxp=''
1207installvendorhtml3dir=''
1208vendorhtml3dir=''
1209vendorhtml3direxp=''
b4eb6b3d
JH
1210d_vendorlib=''
1211installvendorlib=''
1212vendorlib=''
1213vendorlib_stem=''
1214vendorlibexp=''
91e123a8
JH
1215installvendorman1dir=''
1216vendorman1dir=''
1217vendorman1direxp=''
1218installvendorman3dir=''
1219vendorman3dir=''
1220vendorman3direxp=''
b4eb6b3d
JH
1221usevendorprefix=''
1222vendorprefix=''
1223vendorprefixexp=''
6e1038e0
MB
1224d_vendorscript=''
1225installvendorscript=''
1226vendorscript=''
1227vendorscriptexp=''
d56c5707 1228versiononly=''
b4eb6b3d
JH
1229defvoidused=''
1230voidflags=''
3659ebf1
JH
1231yacc=''
1232yaccflags=''
2304df62
AD
1233CONFIG=''
1234
ecfc5424
AD
1235define='define'
1236undef='undef'
1237smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1238rmlist=''
1239
1240: We must find out about Eunice early
1241eunicefix=':'
1242if test -f /etc/unixtovms; then
1243 eunicefix=/etc/unixtovms
1244fi
1245if test -f /etc/unixtovms.exe; then
1246 eunicefix=/etc/unixtovms.exe
1247fi
1248
cfb04860 1249: Set executable suffix now -- needed before hints available
6153ba32
PG
1250if test -f "/libs/version.library"; then
1251: Amiga OS
1252 _exe=""
1253elif test -f "/system/gnu_library/bin/ar.pm"; then
1254: Stratus VOS
cfb04860 1255 _exe=".pm"
6153ba32
PG
1256elif test -n "$DJGPP"; then
1257: DOS DJGPP
cfb04860 1258 _exe=".exe"
5c728af0 1259elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1260: OS/2 or cygwin
ba863942
JH
1261 _exe=".exe"
1262fi
868439a2 1263
b4eb6b3d 1264i_whoami=''
9da7673b
MB
1265ccname=''
1266ccversion=''
1267perllibs=''
1268: set useposix=false in your hint file to disable the POSIX extension.
1269useposix=true
1270: set useopcode=false in your hint file to disable the Opcode extension.
1271useopcode=true
1272: Trailing extension. Override this in a hint file, if needed.
1273: Extra object files, if any, needed on this platform.
1274archobjs=''
1275archname=''
ff935051
JH
1276: Possible local include directories to search.
1277: Set locincpth to "" in a hint file to defeat local include searches.
1278locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1279locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1280:
1281: no include file wanted by default
1282inclwanted=''
1283
eaf812ae
MB
1284: Enable -DEBUGGING and -DDEBUGGING from the command line
1285EBUGGING=''
1286DEBUGGING=old
1287
b4eb6b3d 1288groupstype=''
64615a5e 1289libnames=''
732c9516
JH
1290: change the next line if compiling for Xenix/286 on Xenix/386
1291xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1292: Possible local library directories to search.
1293loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1294loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1295
1296: general looking path for locating libraries
5869b1f1 1297glibpth="/lib /usr/lib $xlibpth"
732c9516 1298glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1299test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1300test -f /shlib/libc.so && glibpth="/shlib $glibpth"
faae14e6 1301test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
732c9516
JH
1302
1303: Private path used by Configure to find libraries. Its value
1304: is prepended to libpth. This variable takes care of special
1305: machines, like the mips. Usually, it should be empty.
1306plibpth=''
1307
1cfa4ec7
GS
1308: default library list
1309libswanted=''
921b2963 1310: some systems want to use only the non-versioned libso:s
1cfa4ec7 1311ignore_versioned_solibs=''
9da7673b
MB
1312siteman1dir=''
1313siteman3dir=''
1314sitescript=''
b4eb6b3d
JH
1315archname64=''
1316ccflags_uselargefiles=''
1317ldflags_uselargefiles=''
1318libswanted_uselargefiles=''
1319: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1320: set usesocks on the Configure command line to enable socks.
b4eb6b3d 1321: set usethreads on the Configure command line to enable threads.
cd040c5e 1322usereentrant='undef'
9da7673b
MB
1323: full support for void wanted by default
1324defvoidused=15
1325
ecfc5424 1326: List of libraries we want.
15431986 1327: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef
AB
1328libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1329libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1330: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1331: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1332glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1333glibpth="/usr/shlib $glibpth"
1334: Do not use vfork unless overridden by a hint file.
1335usevfork=false
1336
8ff267be 1337: Find the basic shell for Bourne shell scripts
1338case "$sh" in
1339'')
8ff267be 1340 case "$SYSTYPE" in
1341 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1342 *) xxx='/bin/sh';;
1343 esac
1344 if test -f "$xxx"; then
1345 sh="$xxx"
1346 else
1347 : Build up a list and do a single loop so we can 'break' out.
1348 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1349 for xxx in sh bash ksh pdksh ash; do
1350 for p in $pth; do
1351 try="$try ${p}/${xxx}"
1352 done
1353 done
1354 for xxx in $try; do
1355 if test -f "$xxx"; then
1356 sh="$xxx";
8ff267be 1357 break
a5a94ea5
JH
1358 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1359 sh="$xxx";
1360 break
8ff267be 1361 elif test -f "$xxx.exe"; then
1362 sh="$xxx";
8ff267be 1363 break
1364 fi
1365 done
1366 fi
1367 ;;
1368esac
1369
1370case "$sh" in
a33c94aa 1371'') cat >&2 <<EOM
8ff267be 1372$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1373
8ff267be 1374Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1375Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1376we'll try to straighten this all out.
8ff267be 1377EOM
1378 exit 1
1379 ;;
1380esac
1381
760ac839 1382: see if sh knows # comments
73614538 1383if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1384 shsharp=true
1385 spitshell=cat
760ac839 1386 xcat=/bin/cat
a931254c
JH
1387 test -f $xcat$_exe || xcat=/usr/bin/cat
1388 if test ! -f $xcat$_exe; then
4bdb8fb5 1389 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1390 if test -f $p/cat$_exe; then
1deb0a86 1391 xcat=$p/cat
3c728e00
JH
1392 break
1393 fi
1394 done
1deb0a86
JH
1395 if test ! -f $xcat$_exe; then
1396 echo "Can't find cat anywhere!"
3c728e00
JH
1397 exit 1
1398 fi
1399 fi
5440bc8e
JH
1400 echo "#!$xcat" >sharp
1401 $eunicefix sharp
1402 chmod +x sharp
1403 ./sharp > today
760ac839 1404 if test -s today; then
760ac839
LW
1405 sharpbang='#!'
1406 else
5440bc8e
JH
1407 echo "#! $xcat" > sharp
1408 $eunicefix sharp
1409 chmod +x sharp
1410 ./sharp > today
760ac839 1411 if test -s today; then
760ac839
LW
1412 sharpbang='#! '
1413 else
760ac839
LW
1414 sharpbang=': use '
1415 fi
1416 fi
1417else
dfe9444c 1418 echo " "
8ff267be 1419 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1420 shsharp=false
1421 cd ..
1422 echo "exec grep -v '^[ ]*#'" >spitshell
1423 chmod +x spitshell
1424 $eunicefix spitshell
1425 spitshell=`pwd`/spitshell
1426 cd UU
1427 echo "I presume that if # doesn't work, #! won't work either!"
1428 sharpbang=': use '
1429fi
5440bc8e 1430rm -f sharp today
760ac839
LW
1431
1432: figure out how to guarantee sh startup
8ff267be 1433case "$startsh" in
1434'') startsh=${sharpbang}${sh} ;;
1435*)
760ac839 1436esac
5440bc8e 1437cat >sharp <<EOSS
760ac839
LW
1438$startsh
1439set abc
1440test "$?abc" != 1
1441EOSS
1442
5440bc8e
JH
1443chmod +x sharp
1444$eunicefix sharp
1445if ./sharp; then
8ff267be 1446 : echo "Yup, it does."
760ac839 1447else
dfe9444c
AD
1448 echo "Hmm... '$startsh' does not guarantee sh startup..."
1449 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1450fi
5440bc8e 1451rm -f sharp
760ac839 1452
aebf16e7
AD
1453
1454: Save command line options in file UU/cmdline.opt for later use in
1455: generating config.sh.
1456cat > cmdline.opt <<EOSH
1457# Configure command line arguments.
1458config_arg0='$0'
1459config_args='$*'
1460config_argc=$#
1461EOSH
1462argn=1
ee45ea83
IZ
1463args_exp=''
1464args_sep=''
aebf16e7
AD
1465for arg in "$@"; do
1466 cat >>cmdline.opt <<EOSH
1467config_arg$argn='$arg'
1468EOSH
ee45ea83
IZ
1469 # Extreme backslashitis: replace each ' by '"'"'
1470 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1471$arg
1472EOC
1473 arg_exp=`cat cmdl.opt`
1474 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1475 argn=`expr $argn + 1`
ee45ea83 1476 args_sep=' '
aebf16e7 1477done
ee45ea83
IZ
1478# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1479# used by ./hints/os2.sh
1480rm -f cmdl.opt
aebf16e7 1481
2304df62
AD
1482: produce awk script to parse command line options
1483cat >options.awk <<'EOF'
1484BEGIN {
02e93a22 1485 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1486
1487 len = length(optstr);
1488 for (i = 1; i <= len; i++) {
1489 c = substr(optstr, i, 1);
1490 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1491 if (a == ":") {
1492 arg[c] = 1;
1493 i++;
1494 }
1495 opt[c] = 1;
1496 }
1497}
1498{
1499 expect = 0;
1500 str = $0;
1501 if (substr(str, 1, 1) != "-") {
1502 printf("'%s'\n", str);
1503 next;
1504 }
1505 len = length($0);
1506 for (i = 2; i <= len; i++) {
1507 c = substr(str, i, 1);
1508 if (!opt[c]) {
1509 printf("-%s\n", substr(str, i));
1510 next;
1511 }
1512 printf("-%s\n", c);
1513 if (arg[c]) {
1514 if (i < len)
1515 printf("'%s'\n", substr(str, i + 1));
1516 else
1517 expect = 1;
1518 next;
1519 }
1520 }
1521}
1522END {
1523 if (expect)
1524 print "?";
1525}
1526EOF
1527
1528: process the command line options
4633a7c4
LW
1529set X `for arg in "$@"; do echo "X$arg"; done |
1530 sed -e s/X// | awk -f options.awk`
2304df62
AD
1531eval "set $*"
1532shift
1533rm -f options.awk
1534
1535: set up default values
1536fastread=''
1537reuseval=false
1538config_sh=''
1539alldone=''
1540error=''
1541silent=''
1542extractsh=''
ecfc5424 1543override=''
16d20bd9 1544knowitall=''
02e93a22 1545rm -f optdef.sh posthint.sh
28757baa 1546cat >optdef.sh <<EOS
1547$startsh
1548EOS
2304df62 1549
dfe9444c 1550
2304df62
AD
1551: option parsing
1552while test $# -gt 0; do
1553 case "$1" in
1554 -d) shift; fastread=yes;;
1555 -e) shift; alldone=cont;;
1556 -f)
1557 shift
1558 cd ..
1559 if test -r "$1"; then
1560 config_sh="$1"
1561 else
a0d0e21e 1562 echo "$me: cannot read config file $1." >&2
2304df62
AD
1563 error=true
1564 fi
1565 cd UU
1566 shift;;
1567 -h) shift; error=true;;
1568 -r) shift; reuseval=true;;
dfe9444c 1569 -s) shift; silent=true; realsilent=true;;
2304df62 1570 -E) shift; alldone=exit;;
16d20bd9 1571 -K) shift; knowitall=true;;
ecfc5424 1572 -O) shift; override=true;;
dfe9444c 1573 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1574 -D)
1575 shift
1576 case "$1" in
1577 *=)
1578 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1579 echo "$me: ignoring -D $1" >&2
1580 ;;
ecfc5424 1581 *=*) echo "$1" | \
1aef975c
AD
1582 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1583 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1584 esac
1585 shift
1586 ;;
1587 -U)
1588 shift
1589 case "$1" in
1aef975c 1590 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1591 *=*)
1592 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1593 echo "$me: ignoring -U $1" >&2
1594 ;;
1aef975c 1595 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1596 esac
1597 shift
1598 ;;
02e93a22
JH
1599 -A)
1600 shift
1601 xxx=''
1602 yyy="$1"
02e93a22 1603 zzz=''
5f83a3e9 1604 uuu=undef
02e93a22 1605 case "$yyy" in
f7c31117 1606 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1607 case "$zzz" in
1608 *:*) zzz='' ;;
1609 *) xxx=append
f7c31117
JH
1610 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1611 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1612 esac
1613 ;;
1614 esac
1615 case "$xxx" in
1616 '') case "$yyy" in
f7c31117
JH
1617 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1618 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1619 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1620 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1621 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1622 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9
JH
1623 esac
1624 ;;
1625 esac
02e93a22
JH
1626 case "$xxx" in
1627 append)
5f83a3e9 1628 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1629 clear)
5f83a3e9 1630 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1631 define)
1632 case "$zzz" in
1633 '') zzz=define ;;
1634 esac
5f83a3e9 1635 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1636 eval)
5f83a3e9 1637 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1638 prepend)
5f83a3e9 1639 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1640 undef)
1641 case "$zzz" in
1642 '') zzz="$uuu" ;;
1643 esac
5f83a3e9
JH
1644 echo "$yyy=$zzz" >> posthint.sh ;;
1645 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1646 esac
bde6b06b 1647 shift
02e93a22 1648 ;;
dfe9444c 1649 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1650 exit 0;;
2304df62 1651 --) break;;
a0d0e21e 1652 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1653 *) break;;
1654 esac
1655done
1656
1657case "$error" in
1658true)
1659 cat >&2 <<EOM
2afac517 1660Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1661 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1662 -d : use defaults for all answers.
1663 -e : go on without questioning past the production of config.sh.
1664 -f : specify an alternate default configuration file.
1665 -h : print this help message and exit (with an error status).
1666 -r : reuse C symbols value if possible (skips costly nm extraction).
1667 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1668 -D : define symbol to have some value:
1669 -D symbol symbol gets the value 'define'
1670 -D symbol=value symbol gets the value 'value'
2304df62 1671 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1672 -K : do not use unless you know what you are doing.
ecfc5424 1673 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1674 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1675 -U : undefine symbol:
1676 -U symbol symbol gets the value 'undef'
1677 -U symbol= symbol gets completely empty
02e93a22 1678 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1679 -A symbol=value append " "value to symbol
02e93a22
JH
1680 -A append:symbol=value append value to symbol
1681 -A define:symbol=value define symbol to have value
02e93a22
JH
1682 -A clear:symbol define symbol to be ''
1683 -A define:symbol define symbol to be 'define'
1684 -A eval:symbol=value define symbol to be eval of value
1685 -A prepend:symbol=value prepend value to symbol
1686 -A undef:symbol define symbol to be 'undef'
1687 -A undef:symbol= define symbol to be ''
2304df62
AD
1688 -V : print version number and exit (with a zero status).
1689EOM
1690 exit 1
1691 ;;
1692esac
1693
dfe9444c
AD
1694: Sanity checks
1695case "$fastread$alldone" in
1696yescont|yesexit) ;;
1697*)
aaeb8e51
GS
1698 case "$extractsh" in
1699 true) ;;
1700 *)
1701 if test ! -t 0; then
1702 echo "Say 'sh Configure', not 'sh <Configure'"
1703 exit 1
1704 fi
1705 ;;
1706 esac
dfe9444c
AD
1707 ;;
1708esac
1709
2304df62
AD
1710exec 4>&1
1711case "$silent" in
1712true) exec 1>/dev/null;;
1713esac
1714
ecfc5424 1715: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1716touch optdef.sh
1717. ./optdef.sh
02e93a22
JH
1718: create the posthint manipulation script and leave the file out there...
1719touch posthint.sh
a0d0e21e 1720
2304df62 1721: set package name
85e6fe83 1722package=perl5
b4eb6b3d
JH
1723first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1724last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1725case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1726ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1727*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1728esac
2304df62 1729
2304df62
AD
1730: Some greps do not return status, grrr.
1731echo "grimblepritz" >grimble
1732if grep blurfldyick grimble >/dev/null 2>&1 ; then
1733 contains=contains
1734elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1735 contains=grep
1736else
1737 contains=contains
1738fi
1739rm -f grimble
1740: the following should work in any shell
1741case "$contains" in
1742contains*)
1743 echo " "
1744 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1745 cat >contains <<'EOSS'
1746grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1747EOSS
1748chmod +x contains
1749esac
1750
dfe9444c
AD
1751: Find the path to the source tree
1752case "$src" in
1753'') case "$0" in
b233458b
JH
1754 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1755 case "$src" in
1756 /*) ;;
8504afb7 1757 .) ;;
b233458b
JH
1758 *) src=`cd ../$src && pwd` ;;
1759 esac
1760 ;;
dfe9444c
AD
1761 *) src='.';;
1762 esac;;
1763esac
1764case "$src" in
1765'') src=/
1766 rsrc=/
1767 ;;
1768/*) rsrc="$src";;
1769*) rsrc="../$src";;
1770esac
1771if test -f $rsrc/Configure && \
1772 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1773then
1774 : found it, so we are ok.
1775else
1776 rsrc=''
1777 for src in . .. ../.. ../../.. ../../../..; do
1778 if test -f ../$src/Configure && \
1779 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1780 then
1781 rsrc=../$src
1782 break
1783 fi
1784 done
1785fi
1786case "$rsrc" in
1787'')
1788 cat <<EOM >&4
1789
1790Sorry, I can't seem to locate the source dir for $package. Please start
1791Configure with an explicit path -- i.e. /some/path/Configure.
1792
1793EOM
1794 exit 1
1795 ;;
1796../.) rsrc='..';;
1797*)
1798 echo " "
1799 echo "Sources for $package found in \"$src\"." >&4
1800 ;;
1801esac
1802
1803: script used to extract .SH files with variable substitutions
1804cat >extract <<'EOS'
a02608de 1805PERL_CONFIG_SH=true
dfe9444c 1806echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1807if test -f MANIFEST; then
1808 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1809else
1810 echo "(Looking for .SH files under the source directory.)"
6904989c 1811 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1812fi
1813shift
1814case $# in
6904989c 18150) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1816esac
6904989c 1817if test ! -f "$src/$1"; then
dfe9444c
AD
1818 shift
1819fi
1820mkdir_p='
1821name=$1;
1822create="";
1823while test $name; do
1824 if test ! -d "$name"; then
1825 create="$name $create";
1826 name=`echo $name | sed -e "s|^[^/]*$||"`;
1827 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1828 else
1829 name="";
1830 fi;
1831done;
1832for file in $create; do
1833 mkdir $file;
1834done
1835'
1836for file in $*; do
1837 case "$src" in
1838 ".")
1839 case "$file" in
1840 */*)
1841 dir=`expr X$file : 'X\(.*\)/'`
1842 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1843 (cd "$dir" && . ./$file)
dfe9444c
AD
1844 ;;
1845 *)
1846 . ./$file
1847 ;;
1848 esac
1849 ;;
1850 *)
1851 case "$file" in
1852 */*)
1853 dir=`expr X$file : 'X\(.*\)/'`
1854 file=`expr X$file : 'X.*/\(.*\)'`
1855 (set x $dir; shift; eval $mkdir_p)
6904989c 1856 sh <"$src/$dir/$file"
dfe9444c
AD
1857 ;;
1858 *)
6904989c 1859 sh <"$src/$file"
dfe9444c
AD
1860 ;;
1861 esac
1862 ;;
1863 esac
1864done
6904989c 1865if test -f "$src/config_h.SH"; then
dfe9444c
AD
1866 if test ! -f config.h; then
1867 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1868 . "$src/config_h.SH"
dfe9444c
AD
1869 fi
1870fi
1871EOS
1872
1873: extract files and exit if asked to do so
1874case "$extractsh" in
1875true)
1876 case "$realsilent" in
1877 true) ;;
1878 *) exec 1>&4;;
1879 esac
1880 case "$config_sh" in
1881 '') config_sh='config.sh';;
1882 esac
1883 echo " "
1884 echo "Fetching answers from $config_sh..."
1885 cd ..
1886 . $config_sh
1887 test "$override" && . ./optdef.sh
1888 echo " "
1889 . UU/extract
1890 rm -rf UU
24ccb310 1891 echo "Extraction done."
dfe9444c
AD
1892 exit 0
1893 ;;
1894esac
1895
1896: Eunice requires " " instead of "", can you believe it
1897echo " "
1898: Here we go...
1899echo "Beginning of configuration questions for $package."
1900
1901trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1902
2304df62
AD
1903: first determine how to suppress newline on echo command
1904echo " "
1905echo "Checking echo to see how to suppress newlines..."
1906(echo "hi there\c" ; echo " ") >.echotmp
1907if $contains c .echotmp >/dev/null 2>&1 ; then
1908 echo "...using -n."
1909 n='-n'
1910 c=''
1911else
1912 cat <<'EOM'
1913...using \c
1914EOM
1915 n=''
1916 c='\c'
1917fi
1918echo $n "The star should be here-->$c"
1919echo '*'
1920rm -f .echotmp
1921
1922: Now test for existence of everything in MANIFEST
1923echo " "
6904989c 1924if test -f "$rsrc/MANIFEST"; then
2304df62 1925 echo "First let's make sure your kit is complete. Checking..." >&4
4242830c 1926 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
2304df62 1927 rm -f missing
dfe9444c 1928 tmppwd=`pwd`
2304df62 1929 for filelist in x??; do
6904989c 1930 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1931 done
1932 if test -s missing; then
1933 cat missing >&4
1934 cat >&4 <<'EOM'
1935
1936THIS PACKAGE SEEMS TO BE INCOMPLETE.
1937
1938You have the option of continuing the configuration process, despite the
1939distinct possibility that your kit is damaged, by typing 'y'es. If you
1940do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1941and contact the author (perlbug@perl.org).
2304df62
AD
1942
1943EOM
1944 echo $n "Continue? [n] $c" >&4
1945 read ans
1946 case "$ans" in
1947 y*)
1948 echo "Continuing..." >&4
1949 rm -f missing
1950 ;;
1951 *)
1952 echo "ABORTING..." >&4
1953 kill $$
1954 ;;
1955 esac
1956 else
dfe9444c 1957 echo "Looks good..."
2304df62
AD
1958 fi
1959else
1960 echo "There is no MANIFEST file. I hope your kit is complete !"
1961fi
1962rm -f missing x??
1963
5ff3f7a4
GS
1964echo " "
1965: Find the appropriate value for a newline for tr
1966if test -n "$DJGPP"; then
1967 trnl='\012'
1968fi
1969if test X"$trnl" = X; then
1970 case "`echo foo|tr '\n' x 2>/dev/null`" in
1971 foox) trnl='\n' ;;
1972 esac
1973fi
1974if test X"$trnl" = X; then
1975 case "`echo foo|tr '\012' x 2>/dev/null`" in
1976 foox) trnl='\012' ;;
1977 esac
1978fi
1979if test X"$trnl" = X; then
8be2c24c
JH
1980 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1981 fooxy) trnl='\n\r' ;;
1982 esac
1983fi
1984if test X"$trnl" = X; then
5ff3f7a4
GS
1985 cat <<EOM >&2
1986
1987$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1988
1989EOM
1990 exit 1
1991fi
1992
2304df62
AD
1993: compute the number of columns on the terminal for proper question formatting
1994case "$COLUMNS" in
1995'') COLUMNS='80';;
1996esac
1997
1998: set up the echo used in my read
1999myecho="case \"\$xxxm\" in
2000'') echo $n \"\$rp $c\" >&4;;
2001*) case \"\$rp\" in
2002 '') echo $n \"[\$xxxm] $c\";;
2003 *)
2004 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
2005 echo \"\$rp\" >&4
2006 echo $n \"[\$xxxm] $c\" >&4
2007 else
2008 echo $n \"\$rp [\$xxxm] $c\" >&4
2009 fi
2010 ;;
2011 esac;;
2012esac"
2013
2014: now set up to do reads with possible shell escape and default assignment
2015cat <<EOSC >myread
28757baa 2016$startsh
2304df62
AD
2017xxxm=\$dflt
2018$myecho
2019ans='!'
2020case "\$fastread" in
2021yes) case "\$dflt" in
2022 '') ;;
2023 *) ans='';
2024 case "\$silent-\$rp" in
2025 true-) ;;
2026 *) echo " " >&4;;
2027 esac;;
2028 esac;;
2029*) case "\$silent" in
2030 true) case "\$rp" in
2031 '') ans='';;
2032 esac;;
2033 esac;;
2034esac
2035while expr "X\$ans" : "X!" >/dev/null; do
2036 read answ
2037 set x \$xxxm
2038 shift
dfe9444c 2039 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 2040 case "\$answ" in
dfe9444c
AD
2041 "!")
2042 sh 1>&4
2043 echo " "
2044 $myecho
2045 ;;
2046 !*)
2047 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2048 shift
2049 sh 1>&4 -c "\$*"
2050 echo " "
2051 $myecho
2052 ;;
2304df62
AD
2053 "\$ans")
2054 case "\$ans" in
ecfc5424
AD
2055 \\&*)
2056 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2057 shift
2058 case "\$1" in
2059 -d)
2060 fastread=yes
40a7a20a 2061 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2062 ;;
2063 -*)
40a7a20a 2064 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2065 ;;
2066 esac
2067 $myecho
2068 ans=!
2069 ;;
2304df62
AD
2070 esac;;
2071 *)
2072 case "\$aok" in
2073 y)
2074 echo "*** Substitution done -- please confirm."
2075 xxxm="\$ans"
c9795ab7 2076 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2077 xxxm="\$ans"
2078 ans=!
2079 ;;
2080 *)
2081 echo "*** Error -- try again."
2082 ans=!
2083 ;;
2084 esac
2085 $myecho
2086 ;;
2087 esac
2088 case "\$ans\$xxxm\$nostick" in
2089 '')
2090 ans=!
2091 $myecho
2092 ;;
2093 esac
2094done
2095case "\$ans" in
2096'') ans="\$xxxm";;
2097esac
2098EOSC
2099
2100: create .config dir to save info across Configure sessions
2101test -d ../.config || mkdir ../.config
2102cat >../.config/README <<EOF
2103This directory created by Configure to save information that should
dfe9444c 2104persist across sessions for $package.
2304df62
AD
2105
2106You may safely delete it if you wish.
2107EOF
2108
9507cadf 2109xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2110case "$usedevel" in
0107c034 2111$define|true|[yY]*) ;;
9507cadf 2112*) case "$xversion" in
0107c034
JH
2113 *[13579])
2114 cat >&4 <<EOH
2115*** WHOA THERE!!! ***
2116
2117 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2118 The version of this $package distribution is $xversion, that is, odd,
2119 (as opposed to even) and that signifies a development release.
3d5d58b1 2120 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2121
2122 Do ***NOT*** install this into production use.
2123 Data corruption and crashes are possible.
2124
2125 It is most seriously suggested that you do not continue any further
2126 unless you want to help in developing and debugging Perl.
2127
6adc6a45
JH
2128 If you *still* want to build perl, you can answer 'y' now,
2129 or pass -Dusedevel to Configure.
2130
0107c034
JH
2131EOH
2132 rp='Do you really want to continue?'
2133 dflt='n'
2134 . ./myread
2135 case "$ans" in
8feeef0e
JH
2136 [yY]) echo >&4 "Okay, continuing."
2137 usedevel="$define" ;;
0107c034
JH
2138 *) echo >&4 "Okay, bye."
2139 exit 1
2140 ;;
2141 esac
2142 ;;
2143 esac
2144 ;;
2145esac
8feeef0e
JH
2146case "$usedevel" in
2147$define|true|[yY]*)
2148 case "$versiononly" in
2149 '') versiononly="$define" ;;
2150 esac
2151 case "$installusrbinperl" in
2152 '') installusrbinperl="$undef" ;;
2153 esac
2154 ;;
2155esac
0107c034 2156
2304df62
AD
2157: general instructions
2158needman=true
2159firsttime=true
760ac839 2160user=`(logname) 2>/dev/null`
dfe9444c
AD
2161case "$user" in
2162'') user=`whoami 2>&1`;;
760ac839 2163esac
2304df62
AD
2164if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2165 firsttime=false
2166 echo " "
2167 rp='Would you like to see the instructions?'
2168 dflt=n
2169 . ./myread
2170 case "$ans" in
2171 [yY]*) ;;
2172 *) needman=false;;
2173 esac
2174fi
2175if $needman; then
2176 cat <<EOH
4e2a5f63 2177
2304df62 2178This installation shell script will examine your system and ask you questions
a0d0e21e 2179to determine how the perl5 package should be installed. If you get
2304df62
AD
2180stuck on a question, you may use a ! shell escape to start a subshell or
2181execute a command. Many of the questions will have default answers in square
2182brackets; typing carriage return will give you the default.
2183
2184On some of the questions which ask for file or directory names you are allowed
2185to use the ~name construct to specify the login directory belonging to "name",
2186even if you don't have a shell which knows about that. Questions where this is
2187allowed will be marked "(~name ok)".
2188
2189EOH
2190 rp=''
2191 dflt='Type carriage return to continue'
2192 . ./myread
2193 cat <<'EOH'
2194
2195The prompter used in this script allows you to use shell variables and
2196backticks in your answers. You may use $1, $2, etc... to refer to the words
2197in the default answer, as if the default line was a set of arguments given to a
2198script shell. This means you may also use $* to repeat the whole default line,
2199so you do not have to re-type everything to add something to the default.
2200
2201Everytime there is a substitution, you will have to confirm. If there is an
2202error (e.g. an unmatched backtick), the default answer will remain unchanged
2203and you will be prompted again.
2204
2205If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2206the questions and use the computed defaults (or the previous answers if there
2207was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2208You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2209on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2210
2211EOH
2212 . ./myread
2213 cat <<EOH
2214
2215Much effort has been expended to ensure that this shell script will run on any
2216Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2217Configure and run it again. If you can't run Configure for some reason,
2218you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2219have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2220
2221This installation script affects things in two ways:
2222
22231) it may do direct variable substitutions on some of the files included
2224 in this kit.
22252) it builds a config.h file for inclusion in C programs. You may edit
2226 any of these files as the need arises after running this script.
2227
2228If you make a mistake on a question, there is no easy way to back up to it
2229currently. The easiest thing to do is to edit config.sh and rerun all the SH
2230files. Configure will offer to let you do this before it runs the SH files.
2231
2232EOH
2233 dflt='Type carriage return to continue'
2234 . ./myread
2235 case "$firsttime" in
2236 true) echo $user >>../.config/instruct;;
2237 esac
2238fi
2239
2304df62
AD
2240: find out where common programs are
2241echo " "
2242echo "Locating common programs..." >&4
2243cat <<EOSC >loc
2244$startsh
2245case \$# in
22460) exit 1;;
2247esac
2248thing=\$1
2249shift
2250dflt=\$1
2251shift
2252for dir in \$*; do
2253 case "\$thing" in
2254 .)
2255 if test -d \$dir/\$thing; then
2256 echo \$dir
2257 exit 0
2258 fi
2259 ;;
2260 *)
a0d0e21e 2261 for thisthing in \$dir/\$thing; do
ecfc5424 2262 : just loop through to pick last item
a0d0e21e 2263 done
25f94b33 2264 if test -f \$thisthing; then
a0d0e21e 2265 echo \$thisthing
2304df62 2266 exit 0
a5a94ea5
JH
2267 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2268 echo \$thisthing
2269 exit 0
2304df62 2270 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2271 if test -n "$DJGPP"; then
2272 echo \$dir/\$thing.exe
b921d661 2273 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2274 : on Eunice apparently
2275 echo \$dir/\$thing
b921d661 2276 exit 0
c4f23d77 2277 fi
2d736872 2278 exit 0
2304df62
AD
2279 fi
2280 ;;
2281 esac
2282done
2283echo \$dflt
2284exit 1
2285EOSC
2286chmod +x loc
2287$eunicefix loc
2288loclist="
2289awk
2290cat
f8006fac 2291chmod
b4eb6b3d
JH
2292comm
2293cp
2304df62
AD
2294echo
2295expr
2296grep
a0d0e21e 2297ls
b4eb6b3d 2298mkdir
2304df62
AD
2299rm
2300sed
b4eb6b3d 2301sort
85e6fe83 2302touch
2304df62 2303tr
b4eb6b3d 2304uniq
2304df62
AD
2305"
2306trylist="
2307Mcc
dfe9444c 2308ar
3659ebf1 2309bison
b4eb6b3d 2310byacc
2304df62 2311cpp
b4eb6b3d 2312csh
2304df62
AD
2313date
2314egrep
1fef16b3 2315gmake
8ff267be 2316gzip
b4eb6b3d 2317less
8ff267be 2318ln
3c728e00 2319make
b4eb6b3d 2320more
693762b4 2321nm
b4eb6b3d
JH
2322nroff
2323pg
2304df62
AD
2324test
2325uname
8ff267be 2326zip
2304df62 2327"
8e07c86e 2328pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2329pth="$pth /lib /usr/lib"
2330for file in $loclist; do
dfe9444c
AD
2331 eval xxx=\$$file
2332 case "$xxx" in
2333 /*|?:[\\/]*)
2334 if test -f "$xxx"; then
2335 : ok
2336 else
2337 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2338 xxx=`./loc $file $file $pth`
2339 fi
2340 ;;
2341 '') xxx=`./loc $file $file $pth`;;
2342 *) xxx=`./loc $xxx $xxx $pth`;;
2343 esac
a5a94ea5 2344 eval $file=$xxx$_exe
2304df62
AD
2345 eval _$file=$xxx
2346 case "$xxx" in
2347 /*)
2348 echo $file is in $xxx.
2349 ;;
8e07c86e
AD
2350 ?:[\\/]*)
2351 echo $file is in $xxx.
2352 ;;
2304df62 2353 *)
25f94b33
AD
2354 echo "I don't know where '$file' is, and my life depends on it." >&4
2355 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2356 exit 1
2304df62
AD
2357 ;;
2358 esac
2359done
2360echo " "
2361echo "Don't worry if any of the following aren't found..."
2362say=offhand
2363for file in $trylist; do
dfe9444c
AD
2364 eval xxx=\$$file
2365 case "$xxx" in
2366 /*|?:[\\/]*)
2367 if test -f "$xxx"; then
2368 : ok
2369 else
2370 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2371 xxx=`./loc $file $file $pth`
2372 fi
2373 ;;
2374 '') xxx=`./loc $file $file $pth`;;
2375 *) xxx=`./loc $xxx $xxx $pth`;;
2376 esac
306a8474 2377 eval $file=$xxx$_exe
2304df62
AD
2378 eval _$file=$xxx
2379 case "$xxx" in
2380 /*)
2381 echo $file is in $xxx.
2382 ;;
8e07c86e
AD
2383 ?:[\\/]*)
2384 echo $file is in $xxx.
2385 ;;
2304df62
AD
2386 *)
2387 echo "I don't see $file out there, $say."
2388 say=either
2389 ;;
2390 esac
2391done
2392case "$egrep" in
1fef16b3 2393egrep)
2304df62
AD
2394 echo "Substituting grep for egrep."
2395 egrep=$grep
868439a2 2396 _egrep=$grep
2304df62
AD
2397 ;;
2398esac
8ff267be 2399case "$ln" in
1fef16b3 2400ln)
8ff267be 2401 echo "Substituting cp for ln."
2402 ln=$cp
868439a2 2403 _ln=$cp
8ff267be 2404 ;;
2405esac
2e26f1d5
JH
2406case "$make" in
2407make)
2408 case "$gmake" in
2409 gmake)
2410 echo "I can't find make or gmake, and my life depends on it." >&4
2411 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2412 exit 1
2413 ;;
2414 esac
2415 ;;
2416esac
2417case "$gmake" in
2418gmake) ;;
2419*) # We can't have osname yet.
1fef16b3
JH
2420 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2421 # Assume that gmake, if found, is definitely GNU make
2422 # and prefer it over the system make.
2423 echo "Substituting gmake for make."
2424 make=$gmake
868439a2 2425 _make=$gmake
1fef16b3
JH
2426 fi
2427 ;;
a5a94ea5 2428esac
2304df62
AD
2429case "$test" in
2430test)
2431 echo "Hopefully test is built into your sh."
2432 ;;
2433*)
73614538 2434 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2435 echo "Using the test built into your sh."
2304df62
AD
2436 test=test
2437 _test=test
2438 fi
2439 ;;
2440esac
2441case "$echo" in
2442echo)
2443 echo "Hopefully echo is built into your sh."
2444 ;;
2445'') ;;
2446*)
2447 echo " "
2448echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2449 $echo $n "hi there$c" >foo1
2450 echo $n "hi there$c" >foo2
2451 if cmp foo1 foo2 >/dev/null 2>&1; then
2452 echo "They are compatible. In fact, they may be identical."
2453 else
2454 case "$n" in
2455 '-n') n='' c='\c';;
2456 *) n='-n' c='';;
2457 esac
2458 cat <<FOO
2459They are not compatible! You are probably running ksh on a non-USG system.
2460I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2461have echo built in and we may have to run some Bourne shell scripts. That
2462means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2463
2464FOO
2465 $echo $n "The star should be here-->$c"
2466 $echo "*"
2467 fi
2468 $rm -f foo1 foo2
2469 ;;
2470esac
2471
6b769f8f 2472cat <<EOS >trygcc
2573c5f9
JH
2473$startsh
2474EOS
6b769f8f 2475cat <<'EOSC' >>trygcc
2573c5f9
JH
2476case "$cc" in
2477'') ;;
2478*) $rm -f try try.*
2479 $cat >try.c <<EOM
2480int main(int argc, char *argv[]) {
2481 return 0;
2482}
2483EOM
e4778687 2484 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2485 :
2486 else
2487 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2488 despair=yes
2489 trygcc=yes
2490 case "$cc" in
2491 *gcc*) trygcc=no ;;
2492 esac
2493 case "`$cc -v -c try.c 2>&1`" in
2494 *gcc*) trygcc=no ;;
2495 esac
2496 if $test X"$trygcc" = Xyes; then
2497 if gcc -o try -c try.c; then
2498 echo " "
2499 echo "You seem to have a working gcc, though." >&4
2500 rp="Would you like to use it?"
2501 dflt=y
2502 if $test -f myread; then
2503 . ./myread
2504 else
2505 if $test -f UU/myread; then
2506 . ./UU/myread
2507 else
2508 echo "Cannot find myread, sorry. Aborting." >&2
2509 exit 1
2510 fi
2511 fi
2512 case "$ans" in
6371411c
RB
2513 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2514 if $test -f usethreads.cbu; then
2515 $cat >&4 <<EOM
2516
2517*** However, any setting of the C compiler flags (e.g. for thread support)
2518*** has been lost. It may be necessary to pass -Dcc=gcc to Configure
2519*** (together with e.g. -Dusethreads).
2520
2521EOM
2522 fi;;
2573c5f9
JH
2523 esac
2524 fi
2525 fi
6b769f8f
RB
2526 fi
2527 $rm -f try try.*
2528 ;;
2529esac
2530EOSC
2531
2532cat <<EOS >checkcc
2533$startsh
2534EOS
2535cat <<'EOSC' >>checkcc
2536case "$cc" in
2537'') ;;
2538*) $rm -f try try.*
2539 $cat >try.c <<EOM
2540int main(int argc, char *argv[]) {
2541 return 0;
2542}
2543EOM
2544 if $cc -o try $ccflags $ldflags try.c; then
2545 :
2546 else
2573c5f9 2547 if $test X"$despair" = Xyes; then
6b769f8f
RB
2548 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2549 fi
2550 $cat >&4 <<EOM
5dd4fbdf
MB
2551You need to find a working C compiler.
2552Either (purchase and) install the C compiler supplied by your OS vendor,
2553or for a free C compiler try http://gcc.gnu.org/
2554I cannot continue any further, aborting.
2555EOM
6b769f8f 2556 exit 1
2573c5f9
JH
2557 fi
2558 $rm -f try try.*
2559 ;;
2560esac
2561EOSC
2562
a0d0e21e
LW
2563: determine whether symbolic links are supported
2564echo " "
2565$touch blurfl
2566if $ln -s blurfl sym > /dev/null 2>&1 ; then
2567 echo "Symbolic links are supported." >&4
818f00be 2568 lns="$ln -s"
a0d0e21e
LW
2569else
2570 echo "Symbolic links are NOT supported." >&4
2571 lns="$ln"
2572fi
2573$rm -f blurfl sym
2574
dafca956
JH
2575: determine whether symbolic links are supported
2576echo " "
2577case "$lns" in
18ea2752 2578*"ln"*" -s")
dafca956
JH
2579 echo "Checking how to test for symbolic links..." >&4
2580 $lns blurfl sym
4b661809 2581 if $test "X$issymlink" = X; then
2e2a97a6
JH
2582 case "$newsh" in
2583 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2584 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2585 esac
5d644a95
MB
2586 if test $? = 0; then
2587 issymlink="test -h"
2e2a97a6
JH
2588 else
2589 echo "Your builtin 'test -h' may be broken." >&4
2590 case "$test" in
2591 /*) ;;
2592 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2593 for p in $pth
2594 do
2595 if test -f "$p/$test"; then
2596 test="$p/$test"
2597 break
2598 fi
2599 done
2600 ;;
2601 esac
2602 case "$test" in
2603 /*)
2604 echo "Trying external '$test -h'." >&4
2605 issymlink="$test -h"
2606 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2607 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2608 issymlink=''
2609 fi
2610 ;;
2611 *) issymlink='' ;;
2612 esac
5d644a95
MB
2613 fi
2614 fi
4b661809 2615 if $test "X$issymlink" = X; then
dafca956 2616 if $test -L sym 2>/dev/null; then
5d644a95 2617 issymlink="$test -L"
2e2a97a6 2618 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2619 fi
2620 fi
4b661809 2621 if $test "X$issymlink" != X; then
5d644a95 2622 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2623 else
2624 echo "I do not know how you can test for symbolic links." >&4
2625 fi
2626 $rm -f blurfl sym
2627 ;;
2628*) echo "No symbolic links, so not testing for their testing..." >&4
2629 ;;
2630esac
2631echo " "
2632
2633
2634case "$mksymlinks" in
2635$define|true|[yY]*)
2636 case "$src" in
2637 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2638 exit 1
2639 ;;
4b661809 2640 *) case "$lns:$issymlink" in
f314eb9f 2641 *"ln"*" -s:"*"test -"?)
dafca956
JH
2642 echo "Creating the symbolic links..." >&4
2643 echo "(First creating the subdirectories...)" >&4
2644 cd ..
2645 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2646 read directory
2647 test -z "$directory" && break
2648 mkdir -p $directory
2649 done
2650 # Sanity check 1.
2651 if test ! -d t/base; then
2652 echo "Failed to create the subdirectories. Aborting." >&4
2653 exit 1
2654 fi
2655 echo "(Then creating the symlinks...)" >&4
2656 awk '{print $1}' $src/MANIFEST | while true; do
2657 read filename
2658 test -z "$filename" && break
2659 if test -f $filename; then
5d644a95 2660 if $issymlink $filename; then
dafca956
JH
2661 rm -f $filename
2662 fi
2663 fi
2664 if test -f $filename; then
2665 echo "$filename already exists, not symlinking."
2666 else
2667 ln -s $src/$filename $filename
2668 fi
2669 done
2670 # Sanity check 2.
a0d24b8a
JH
2671 if test ! -f t/base/lex.t; then
2672 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2673 exit 1
2674 fi
2675 cd UU
2676 ;;
2677 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2678 ;;
2679 esac
2680 ;;
2681 esac
2682 ;;
2683esac
2684
5440bc8e
JH
2685
2686case "$usecrosscompile" in
2687$define|true|[yY]*)
93bc48fa 2688 $echo "Cross-compiling..."
5440bc8e
JH
2689 croak=''
2690 case "$cc" in
2691 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2692 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2693 ar=$targetarch-ar
2694 # leave out ld, choosing it is more complex
2695 nm=$targetarch-nm
2696 ranlib=$targetarch-ranlib
93bc48fa 2697 $echo 'extern int foo;' > try.c
f8006fac 2698 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2699 shift
2700 if $test $# -gt 0; then
2701 incpth="$incpth $*"
f8006fac
JH
2702 incpth="`$echo $incpth|$sed 's/^ //'`"
2703 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2704 for i in $*; do
f8006fac 2705 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2706 if $test -d $j; then
2707 libpth="$libpth $j"
2708 fi
2709 done
f8006fac
JH
2710 libpth="`$echo $libpth|$sed 's/^ //'`"
2711 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2712 fi
2713 $rm -f try.c
5440bc8e
JH
2714 ;;
2715 esac
2716 case "$targetarch" in
93bc48fa
JH
2717 '') echo "Targetarch not defined." >&4; croak=y ;;
2718 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2719 esac
2720 case "$incpth" in
93bc48fa 2721 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2722 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2723 esac
2724 case "$libpth" in
93bc48fa 2725 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2726 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2727 esac
93bc48fa
JH
2728 case "$usrinc" in
2729 '') for i in $incpth; do
2730 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2731 usrinc=$i
2732 echo "Guessing usrinc $usrinc." >&4
2733 break
2734 fi
2735 done
2736 case "$usrinc" in
2737 '') echo "Usrinc not defined." >&4; croak=y ;;
2738 esac
2739 ;;
2740 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2741 esac
93bc48fa
JH
2742 case "$targethost" in
2743 '') echo "Targethost not defined." >&4; croak=y ;;
2744 *) echo "Using targethost $targethost." >&4
5440bc8e 2745 esac
93bc48fa
JH
2746 locincpth=' '
2747 loclibpth=' '
5440bc8e 2748 case "$croak" in
93bc48fa 2749 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2750 esac
2751 case "$src" in
2752 /*) run=$src/Cross/run
93c0359c 2753 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2754 to=$src/Cross/to
2755 from=$src/Cross/from
2756 ;;
93bc48fa 2757 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2758 run=$pwd/Cross/run
f8006fac 2759 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2760 to=$pwd/Cross/to
2761 from=$pwd/Cross/from
2762 ;;
2763 esac
2764 case "$targetrun" in
2765 '') targetrun=ssh ;;
2766 esac
2767 case "$targetto" in
2768 '') targetto=scp ;;
2769 esac
2770 case "$targetfrom" in
2771 '') targetfrom=scp ;;
2772 esac
2773 run=$run-$targetrun
2774 to=$to-$targetto
2775 from=$from-$targetfrom
93bc48fa
JH
2776 case "$targetdir" in
2777 '') targetdir=/tmp
2778 echo "Guessing targetdir $targetdir." >&4
2779 ;;
2780 esac
5440bc8e 2781 case "$targetuser" in
93bc48fa
JH
2782 '') targetuser=root
2783 echo "Guessing targetuser $targetuser." >&4
2784 ;;
5440bc8e
JH
2785 esac
2786 case "$targetfrom" in
2787 scp) q=-q ;;
2788 *) q='' ;;
2789 esac
2790 case "$targetrun" in
2791 ssh|rsh)
2792 cat >$run <<EOF
2793#!/bin/sh
93c0359c
JH
2794case "\$1" in
2795-cwd)
2796 shift
2797 cwd=\$1
2798 shift
2799 ;;
2800esac
2801case "\$cwd" in
2802'') cwd=$targetdir ;;
2803esac
5440bc8e
JH
2804exe=\$1
2805shift
93c0359c
JH
2806if $test ! -f \$exe.xok; then
2807 $to \$exe
2808 $touch \$exe.xok
2809fi
2810$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2811EOF
2812 ;;
93bc48fa 2813 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2814 exit 1
2815 ;;
2816 esac
93c0359c
JH
2817 case "$targetmkdir" in
2818 */Cross/mkdir)
2819 cat >$targetmkdir <<EOF
2820#!/bin/sh
2821$targetrun -l $targetuser $targethost "mkdir -p \$@"
2822EOF
f8006fac 2823 $chmod a+rx $targetmkdir
93c0359c
JH
2824 ;;
2825 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2826 exit 1
2827 ;;
2828 esac
5440bc8e
JH
2829 case "$targetto" in
2830 scp|rcp)
2831 cat >$to <<EOF
2832#!/bin/sh
2833for f in \$@
2834do
93c0359c
JH
2835 case "\$f" in
2836 /*)
2837 $targetmkdir \`dirname \$f\`
2838 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2839 ;;
2840 *)
2841 $targetmkdir $targetdir/\`dirname \$f\`
2842 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2843 ;;
2844 esac
5440bc8e
JH
2845done
2846exit 0
2847EOF
2848 ;;
2849 cp) cat >$to <<EOF
2850#!/bin/sh
93c0359c
JH
2851for f in \$@
2852do
2853 case "\$f" in
2854 /*)
2855 $mkdir -p $targetdir/\`dirname \$f\`
2856 $cp \$f $targetdir/\$f || exit 1
2857 ;;
2858 *)
2859 $targetmkdir $targetdir/\`dirname \$f\`
2860 $cp \$f $targetdir/\$f || exit 1
2861 ;;
2862 esac
2863done
2864exit 0
5440bc8e
JH
2865EOF
2866 ;;
93bc48fa 2867 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2868 exit 1
2869 ;;
2870 esac
2871 case "$targetfrom" in
2872 scp|rcp)
2873 cat >$from <<EOF
2874#!/bin/sh
2875for f in \$@
2876do
93c0359c 2877 $rm -f \$f
5440bc8e
JH
2878 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2879done
2880exit 0
2881EOF
2882 ;;
2883 cp) cat >$from <<EOF
2884#!/bin/sh
2885for f in \$@
2886do
93c0359c 2887 $rm -f \$f
5440bc8e
JH
2888 cp $targetdir/\$f . || exit 1
2889done
2890exit 0
2891EOF
2892 ;;
93bc48fa 2893 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2894 exit 1
2895 ;;
2896 esac
93bc48fa
JH
2897 if $test ! -f $run; then
2898 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2899 else
f8006fac 2900 $chmod a+rx $run
5440bc8e 2901 fi
93bc48fa
JH
2902 if $test ! -f $to; then
2903 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2904 else
f8006fac 2905 $chmod a+rx $to
5440bc8e 2906 fi
93bc48fa
JH
2907 if $test ! -f $from; then
2908 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2909 else
f8006fac 2910 $chmod a+rx $from
5440bc8e 2911 fi
93bc48fa 2912 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2913 exit 1
2914 fi
2915 cat >&4 <<EOF
f8006fac
JH
2916Using '$run' for remote execution,
2917and '$from' and '$to'
93bc48fa 2918for remote file transfer.
5440bc8e
JH
2919EOF
2920 ;;
2921*) run=''
2922 to=:
2923 from=:
2924 usecrosscompile='undef'
2925 targetarch=''
2926 ;;
2927esac
2928
ecfc5424
AD
2929: see whether [:lower:] and [:upper:] are supported character classes
2930echo " "
ecfc5424
AD
2931case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2932ABYZ)
2933 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2934 up='[:upper:]'
2935 low='[:lower:]'
2936 ;;
416d0bea
MB
2937*) # There is a discontinuity in EBCDIC between 'R' and 'S'
2938 # (0xd9 and 0xe2), therefore that is a nice testing point.
2939 if test "X$up" = X -o "X$low" = X; then
2940 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2941 rs) up='[A-Z]'
2942 low='[a-z]'
28e8609d
JH
2943 ;;
2944 esac
416d0bea 2945 fi
28e8609d 2946 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2947 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2948 rs) up='A-Z'
28e8609d
JH
2949 low='a-z'
2950 ;;
2951 esac
416d0bea 2952 fi
28e8609d 2953 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2954 case "`echo RS | od -x 2>/dev/null`" in
2955 *D9E2*|*d9e2*)
28e8609d
JH
2956 echo "Hey, this might be EBCDIC." >&4
2957 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2958 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2959 rs) up='[A-IJ-RS-Z]'
2960 low='[a-ij-rs-z]'
28e8609d
JH
2961 ;;
2962 esac
2963 fi
2964 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2965 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2966 rs) up='A-IJ-RS-Z'
2967 low='a-ij-rs-z'
28e8609d
JH
2968 ;;
2969 esac
2970 fi
2971 ;;
2972 esac
2973 fi
2974esac
416d0bea
MB
2975case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2976rs)
28e8609d
JH
2977 echo "Using $up and $low to convert case." >&4
2978 ;;
ecfc5424 2979*)
28e8609d
JH
2980 echo "I don't know how to translate letters from upper to lower case." >&4
2981 echo "Your tr is not acting any way I know of." >&4
2982 exit 1
2983 ;;
ecfc5424
AD
2984esac
2985: set up the translation script tr, must be called with ./tr of course
2986cat >tr <<EOSC
2987$startsh
2988case "\$1\$2" in
2989'[A-Z][a-z]') exec $tr '$up' '$low';;
2990'[a-z][A-Z]') exec $tr '$low' '$up';;
2991esac
2992exec $tr "\$@"
2993EOSC
2994chmod +x tr
2995$eunicefix tr
2996
2304df62
AD
2997: Try to determine whether config.sh was made on this system
2998case "$config_sh" in
2999'')
43999f95
JH
3000myuname=`$uname -a 2>/dev/null`
3001$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
3002# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3003# because the A-Z/a-z are not consecutive.
a0d0e21e 3004myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 3005 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 3006newmyuname="$myuname"
2304df62 3007dflt=n
16d20bd9
AD
3008case "$knowitall" in
3009'')
3010 if test -f ../config.sh; then
3011 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3012 eval "`grep myuname= ../config.sh`"
3013 fi
3014 if test "X$myuname" = "X$newmyuname"; then
3015 dflt=y
3016 fi
2304df62 3017 fi
16d20bd9
AD
3018 ;;
3019*) dflt=y;;
3020esac
2304df62
AD
3021
3022: Get old answers from old config file if Configure was run on the
3023: same system, otherwise use the hints.
3024hint=default
3025cd ..
3026if test -f config.sh; then
16d20bd9
AD
3027 echo " "
3028 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
3029 . UU/myread
3030 case "$ans" in
f83701cd
AD
3031 n*|N*) echo "OK, I'll ignore it."
3032 mv config.sh config.sh.old
3033 myuname="$newmyuname"
3034 ;;
2304df62 3035 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
3036 tmp_n="$n"
3037 tmp_c="$c"
85cad39c 3038 tmp_sh="$sh"
2304df62
AD
3039 . ./config.sh
3040 cp config.sh UU
ecfc5424
AD
3041 n="$tmp_n"
3042 c="$tmp_c"
85cad39c 3043 : Older versions did not always set $sh. Catch re-use of such
3044 : an old config.sh.
3045 case "$sh" in
3046 '') sh="$tmp_sh" ;;
3047 esac
2304df62
AD
3048 hint=previous
3049 ;;
3050 esac
3051fi
2573c5f9 3052. ./UU/checkcc
2304df62
AD
3053if test ! -f config.sh; then
3054 $cat <<EOM
3055
4e2a5f63
AD
3056First time through, eh? I have some defaults handy for some systems
3057that need some extra help getting the Configure answers right:
2304df62
AD
3058
3059EOM
dfe9444c 3060 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3061 dflt=''
3062 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3063 : tests or hints, please send them to perlbug@perl.org
2304df62 3064 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3065 $test -f /irix && osname=irix
85e6fe83
LW
3066 $test -f /xenix && osname=sco_xenix
3067 $test -f /dynix && osname=dynix
3068 $test -f /dnix && osname=dnix
5f05dabc 3069 $test -f /lynx.os && osname=lynxos
3070 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3071 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3072 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3073 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3074 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3075 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3076 $test -d /usr/apollo/bin && osname=apollo
3077 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3078 $test -d /usr/include/minix && osname=minix
d54344fc 3079 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3080 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3081 osname=machten
4633a7c4 3082 if $test -x /sbin/version; then
dfe9444c 3083 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3084 $sed -e 's/[A-Za-z]$//'`
3085 elif $test -x /usr/etc/version; then
dfe9444c 3086 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3087 $sed -e 's/[A-Za-z]$//'`
3088 else
3089 osvers="$2.$3"
3090 fi
3091 fi
aaacdc8b
GS
3092
3093 $test -f /sys/posix.dll &&
3094 $test -f /usr/bin/what &&
3095 set X `/usr/bin/what /sys/posix.dll` &&
3096 $test "$3" = UWIN &&
3097 osname=uwin &&
3098 osvers="$5"
3099
2304df62
AD
3100 if $test -f $uname; then
3101 set X $myuname
3102 shift
3103
2304df62 3104 case "$5" in
85e6fe83 3105 fps*) osname=fps ;;
2304df62
AD
3106 mips*)
3107 case "$4" in
85e6fe83
LW
3108 umips) osname=umips ;;
3109 *) osname=mips ;;
2304df62 3110 esac;;
85e6fe83
LW
3111 [23]100) osname=mips ;;
3112 next*) osname=next ;;
ecfc5424 3113 i386*)
c6912327
JH
3114 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3115 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3116 osname='sco'
3117 osvers=$tmp
3118 elif $test -f /etc/kconfig; then
ecfc5424 3119 osname=isc
bd628c73 3120 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3121 osvers=4
3122 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3123 osvers=3
2304df62 3124 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3125 osvers=2
ecfc5424
AD
3126 fi
3127 fi
2000072c 3128 tmp=''
ecfc5424 3129 ;;
c4f23d77
AD
3130 pc*)
3131 if test -n "$DJGPP"; then
3132 osname=dos
3133 osvers=djgpp
3134 fi
3135 ;;
2304df62
AD
3136 esac
3137
3138 case "$1" in
a0d0e21e
LW
3139 aix) osname=aix
3140 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3141 case "$tmp" in
e81c5c2a
NC
3142 # oslevel can fail with:
3143 # oslevel: Unable to acquire lock.
3144 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3145 '<3240'|'<>3240') osvers=3.2.0 ;;
3146 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3147 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3148 *) osvers=$tmp;;
a0d0e21e
LW
3149 esac
3150 ;;
aaacdc8b
GS
3151 bsd386) osname=bsd386
3152 osvers=`$uname -r`
3153 ;;
3154 cygwin*) osname=cygwin
3155 osvers="$3"
3156 ;;
23f87696
SZ
3157 *dc.osx) osname=dcosx
3158 osvers="$3"
3159 ;;
a0d0e21e
LW
3160 dnix) osname=dnix
3161 osvers="$3"
3162 ;;
3163 domainos) osname=apollo
3164 osvers="$3"
3165 ;;
a774dfe6
RSG
3166 dgux) osname=dgux
3167 osvers="$3"
3168 ;;
3169 dragonfly) osname=dragonfly
a0d0e21e
LW
3170 osvers="$3"
3171 ;;
760ac839 3172 dynixptx*) osname=dynixptx
e58e581d 3173 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3174 ;;
a774dfe6 3175 freebsd) osname=freebsd
a0d0e21e 3176 osvers="$3" ;;
761ee4e8
BD
3177 genix) osname=genix ;;
3178 gnu) osname=gnu
3179 osvers="$3" ;;
a774dfe6 3180 hp*) osname=hpux
bfb7748a 3181 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3182 ;;
761ee4e8 3183 irix*) osname=irix
a0d0e21e
LW
3184 case "$3" in
3185 4*) osvers=4 ;;
3186 5*) osvers=5 ;;
ecfc5424 3187 *) osvers="$3" ;;
a0d0e21e
LW
3188 esac
3189 ;;
761ee4e8 3190 linux) osname=linux
a0d0e21e 3191 case "$3" in
a0d0e21e
LW
3192 *) osvers="$3" ;;
3193 esac
3194 ;;
761ee4e8 3195 MiNT) osname=mint
28e8609d
JH
3196 ;;
3197 netbsd*) osname=netbsd
ecfc5424
AD
3198 osvers="$3"
3199 ;;
4e81affe
MM
3200 news-os) osvers="$3"
3201 case "$3" in
3202 4*) osname=newsos4 ;;
3203 *) osname=newsos ;;
3204 esac
3205 ;;
aaacdc8b 3206 next*) osname=next ;;
28bb1e2c 3207 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3208 openbsd) osname=openbsd
3209 osvers="$3"
3210 ;;
5c728af0
IZ
3211 os2) osname=os2
3212 osvers="$4"
3213 ;;
aaacdc8b
GS
3214 POSIX-BC | posix-bc ) osname=posix-bc
3215 osvers="$3"
a0d0e21e 3216 ;;
ae3afa4e
TH
3217 powerux | power_ux | powermax_os | powermaxos | \
3218 powerunix | power_unix) osname=powerux
3219 osvers="$3"
3220 ;;
aaacdc8b
GS
3221 qnx) osname=qnx
3222 osvers="$4"
3223 ;;
a0d0e21e
LW
3224 solaris) osname=solaris
3225 case "$3" in
3226 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3227 *) osvers="$3" ;;
a0d0e21e
LW
3228 esac
3229 ;;
85e6fe83
LW
3230 sunos) osname=sunos
3231 case "$3" in
85e6fe83
LW
3232 5*) osname=solaris
3233 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3234 *) osvers="$3" ;;
2304df62
AD
3235 esac
3236 ;;
a0d0e21e 3237 titanos) osname=titanos
85e6fe83 3238 case "$3" in
a0d0e21e
LW
3239 1*) osvers=1 ;;
3240 2*) osvers=2 ;;
3241 3*) osvers=3 ;;
3242 4*) osvers=4 ;;
ecfc5424 3243 *) osvers="$3" ;;
2304df62
AD
3244 esac
3245 ;;
85e6fe83 3246 ultrix) osname=ultrix
ecfc5424 3247 osvers="$3"
2304df62 3248 ;;
28757baa 3249 osf1|mls+) case "$5" in
fed7345c
AD
3250 alpha)
3251 osname=dec_osf
fdd85a03 3252 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3253 case "$osvers" in
3254 [1-9].[0-9]*) ;;
3255 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3256 esac
ecfc5424
AD
3257 ;;
3258 hp*) osname=hp_osf1 ;;
3259 mips) osname=mips_osf1 ;;
85e6fe83
LW
3260 esac
3261 ;;
af1ff193 3262 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3263 openunix|unixware) osname=svr5
0337d152
BG
3264 osvers="$4"
3265 ;;
3c728e00 3266 uts) osname=uts
a0d0e21e
LW
3267 osvers="$3"
3268 ;;
3c728e00
JH
3269 vos) osvers="$3"
3270 ;;
85e6fe83 3271 $2) case "$osname" in
2304df62 3272 *isc*) ;;
a0d0e21e 3273 *freebsd*) ;;
5f05dabc 3274 svr*)
a0d0e21e 3275 : svr4.x or possibly later
a774dfe6 3276 case "svr$3" in
a0d0e21e
LW
3277 ${osname}*)
3278 osname=svr$3
3279 osvers=$4
3280 ;;
3281 esac
3282 case "$osname" in
3283 svr4.0)
3284 : Check for ESIX
3285 if test -f /stand/boot ; then
3286 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3287 if test -n "$INITPROG" -a -f "$INITPROG"; then
3288 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3289 if test -n "$isesix"; then
a0d0e21e
LW
3290 osname=esix4
3291 fi
3292 fi
3293 fi
3294 ;;
3295 esac
3296 ;;
2304df62 3297 *) if test -f /etc/systemid; then
a0d0e21e
LW
3298 osname=sco
3299 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3300 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3301 osvers=$1.$2.$3
c4f23d77 3302 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3303 osvers=$1.$2
c4f23d77 3304 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3305 osvers=$1
2304df62 3306 fi
a0d0e21e
LW
3307 else
3308 case "$osname" in
3309 '') : Still unknown. Probably a generic Sys V.
3310 osname="sysv"
3311 osvers="$3"
3312 ;;
3313 esac
2304df62
AD
3314 fi
3315 ;;
3316 esac
3317 ;;
a0d0e21e
LW
3318 *) case "$osname" in
3319 '') : Still unknown. Probably a generic BSD.
3320 osname="$1"
3321 osvers="$3"
3322 ;;
3323 esac
3324 ;;
2304df62
AD
3325 esac
3326 else
dfe9444c
AD
3327 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3328 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3329 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3330 osname=news_os
2304df62 3331 fi
dfe9444c 3332 $rm -f UU/kernel.what
5c728af0 3333 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3334 set X $myuname
3335 osname=os2
3336 osvers="$5"
2304df62
AD
3337 fi
3338 fi
a774dfe6 3339
5440bc8e
JH
3340 case "$targetarch" in
3341 '') ;;
3342 *) hostarch=$osname
3343 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3344 osvers=''
3345 ;;
3346 esac
3347
a0d0e21e
LW
3348 : Now look for a hint file osname_osvers, unless one has been
3349 : specified already.
3350 case "$hintfile" in
3351 ''|' ')
1e127011 3352 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3353 : Also try without trailing minor version numbers.
1e127011
DD
3354 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3355 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3356 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3357 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3358 case "$file" in
3359 '') dflt=none ;;
3360 *) case "$osvers" in
3361 '') dflt=$file
3362 ;;
dfe9444c 3363 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3364 dflt=$file
dfe9444c 3365 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3366 dflt=$xfile
dfe9444c 3367 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3368 dflt=$xxfile
dfe9444c 3369 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3370 dflt=$xxxfile
dfe9444c 3371 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3372 dflt=$xxxxfile
dfe9444c 3373 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3374 dflt="${osname}"
3375 else
3376 dflt=none
3377 fi
3378 ;;
3379 esac
85e6fe83
LW
3380 ;;
3381 esac
4e2a5f63
AD
3382 if $test -f Policy.sh ; then
3383 case "$dflt" in
3384 *Policy*) ;;
3385 none) dflt="Policy" ;;
3386 *) dflt="Policy $dflt" ;;
3387 esac
3388 fi
85e6fe83 3389 ;;
a0d0e21e 3390 *)
ecfc5424 3391 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3392 ;;
2304df62 3393 esac
1aef975c 3394
4e2a5f63
AD
3395 if $test -f Policy.sh ; then
3396 $cat <<EOM
3397
3398There's also a Policy hint file available, which should make the
3399site-specific (policy) questions easier to answer.
3400EOM
3401
3402 fi
3403
2304df62
AD
3404 $cat <<EOM
3405
3406You may give one or more space-separated answers, or "none" if appropriate.
a2d23ec2
MB
3407If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3408previous run of Configure, you may specify it as well as or instead of
3409OS-specific hints. If hints are provided for your OS, you should use them:
3410although Perl can probably be built without hints on many platforms, using
3411hints often improve performance and may enable features that Configure can't
3412set up on its own. If there are no hints that match your OS, specify "none";
3413DO NOT give a wrong version or a wrong OS.
2304df62
AD
3414
3415EOM
4e2a5f63 3416
2304df62 3417 rp="Which of these apply, if any?"
dfe9444c 3418 . UU/myread
85e6fe83
LW
3419 tans=$ans
3420 for file in $tans; do
4e2a5f63
AD
3421 if $test X$file = XPolicy -a -f Policy.sh; then
3422 . Policy.sh
3423 $cat Policy.sh >> UU/config.sh
3424 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3425 . $src/hints/$file.sh
3426 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3427 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3428 : nothing
3429 else
85e6fe83
LW
3430 : Give one chance to correct a possible typo.
3431 echo "$file.sh does not exist"
3432 dflt=$file
3433 rp="hint to use instead?"
dfe9444c 3434 . UU/myread
85e6fe83 3435 for file in $ans; do
dfe9444c
AD
3436 if $test -f "$src/hints/$file.sh"; then
3437 . $src/hints/$file.sh
3438 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3439 elif $test X$ans = X -o X$ans = Xnone ; then
3440 : nothing
3441 else
3442 echo "$file.sh does not exist -- ignored."
3443 fi
3444 done
2304df62
AD
3445 fi
3446 done
85e6fe83 3447
2304df62 3448 hint=recommended
85e6fe83 3449 : Remember our hint file for later.
dfe9444c 3450 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3451 hintfile="$file"
85e6fe83 3452 else
a0d0e21e 3453 hintfile=''
85e6fe83 3454 fi
2304df62
AD
3455fi
3456cd UU
3457;;
3458*)
3459 echo " "
3460 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3461 tmp_n="$n"
3462 tmp_c="$c"
2304df62
AD
3463 cd ..
3464 cp $config_sh config.sh 2>/dev/null
a78b0d02 3465 chmod +w config.sh
2304df62
AD
3466 . ./config.sh
3467 cd UU
3468 cp ../config.sh .
ecfc5424
AD
3469 n="$tmp_n"
3470 c="$tmp_c"
2304df62
AD
3471 hint=previous
3472 ;;
3473esac
1aef975c 3474test "$override" && . ./optdef.sh
2304df62
AD
3475
3476: Restore computed paths
3477for file in $loclist $trylist; do
3478 eval $file="\$_$file"
3479done
3480
85e6fe83 3481cat << EOM
a0d0e21e 3482
85e6fe83 3483Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3484The default value is probably right if the name rings a bell. Otherwise,
3485since spelling matters for me, either accept the default or answer "none"
3486to leave it blank.
a0d0e21e 3487
85e6fe83 3488EOM
85e6fe83 3489case "$osname" in
a0d0e21e 3490 ''|' ')
85e6fe83 3491 case "$hintfile" in
a0d0e21e 3492 ''|' '|none) dflt=none ;;
ecfc5424 3493 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3494 esac
3495 ;;
3496 *) dflt="$osname" ;;
3497esac
3498rp="Operating system name?"
3499. ./myread
3500case "$ans" in
ecfc5424
AD
3501none) osname='' ;;
3502*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3503esac
8ff267be 3504echo " "
3505case "$osvers" in
3506 ''|' ')
3507 case "$hintfile" in
3508 ''|' '|none) dflt=none ;;
3509 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3510 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3511 case "$dflt" in
3512 ''|' ') dflt=none ;;
3513 esac
3514 ;;
3515 esac
3516 ;;
3517 *) dflt="$osvers" ;;
3518esac
3519rp="Operating system version?"
3520. ./myread
3521case "$ans" in
3522none) osvers='' ;;
3523*) osvers="$ans" ;;
3524esac
3525
02e93a22
JH
3526
3527. ./posthint.sh
3528
2304df62 3529: who configured the system
59b83a6f 3530cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3531case "$cf_by" in
3532"")
7c04078e 3533 cf_by=`(logname) 2>/dev/null`
dfe9444c 3534 case "$cf_by" in
7c04078e
GA
3535 "")
3536 cf_by=`(whoami) 2>/dev/null`
3537 case "$cf_by" in
3538 "") cf_by=unknown ;;
3539 esac ;;
8ff267be 3540 esac ;;
3541esac
2304df62 3542
f3f1a2d8
MB
3543: decide how portable to be. Allow command line overrides.
3544case "$d_portable" in
3545"$undef") ;;
3546*) d_portable="$define" ;;
b4eb6b3d 3547esac
b4eb6b3d 3548
f3f1a2d8
MB
3549: set up shell script to do ~ expansion
3550cat >filexp <<EOSS
3551$startsh
3552: expand filename
3553case "\$1" in
3554 ~/*|~)
3555 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3556 ;;
3557 ~*)
3558 if $test -f /bin/csh; then
3559 /bin/csh -f -c "glob \$1"
3560 failed=\$?
3561 echo ""
3562 exit \$failed
3563 else
3564 name=\`$expr x\$1 : '..\([^/]*\)'\`
3565 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3566 if $test ! -d "\$dir"; then
3567 me=\`basename \$0\`
3568 echo "\$me: can't locate home directory for: \$name" >&2
3569 exit 1
3570 fi
3571 case "\$1" in
3572 */*)
3573 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3574 ;;
3575 *)
3576 echo \$dir
3577 ;;
3578 esac
3579 fi
3580 ;;
3581*)
3582 echo \$1
3583 ;;
b29b105d 3584esac
f3f1a2d8
MB
3585EOSS
3586chmod +x filexp
3587$eunicefix filexp
b29b105d 3588
f3f1a2d8
MB
3589: now set up to get a file name
3590cat <<EOS >getfile
3591$startsh
3592EOS
3593cat <<'EOSC' >>getfile
3594tilde=''
3595fullpath=''
3596already=''
3597skip=''
3598none_ok=''
3599exp_file=''
3600nopath_ok=''
3601orig_rp="$rp"
3602orig_dflt="$dflt"
3603case "$gfpth" in
3604'') gfpth='.' ;;
b29b105d 3605esac
b29b105d 3606
f3f1a2d8
MB
3607case "$fn" in
3608*\(*)
3609 : getfile will accept an answer from the comma-separated list
3610 : enclosed in parentheses even if it does not meet other criteria.
3611 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3612 fn=`echo $fn | sed 's/(.*)//'`
3613 ;;
b29b105d
JH
3614esac
3615
f3f1a2d8
MB
3616case "$fn" in
3617*:*)
3618 loc_file=`expr $fn : '.*:\(.*\)'`
3619 fn=`expr $fn : '\(.*\):.*'`
3620 ;;
b29b105d 3621esac
b29b105d 3622
f3f1a2d8
MB
3623case "$fn" in
3624*~*) tilde=true;;
3625esac
3626case "$fn" in
3627*/*) fullpath=true;;
3628esac
3629case "$fn" in
3630*+*) skip=true;;
3631esac
3632case "$fn" in
3633*n*) none_ok=true;;
3634esac
3635case "$fn" in
3636*e*) exp_file=true;;
3637esac
3638case "$fn" in
3639*p*) nopath_ok=true;;
b29b105d 3640esac
b29b105d 3641
f3f1a2d8
MB
3642case "$fn" in
3643*f*) type='File';;
3644*d*) type='Directory';;
3645*l*) type='Locate';;
3646esac
b29b105d 3647
f3f1a2d8
MB
3648what="$type"
3649case "$what" in
3650Locate) what='File';;
3651esac
b29b105d 3652
f3f1a2d8
MB
3653case "$exp_file" in
3654'')
3655 case "$d_portable" in
3656 "$define") ;;
3657 *) exp_file=true;;
b29b105d
JH
3658 esac
3659 ;;
3660esac
3661
f3f1a2d8
MB
3662cd ..
3663while test "$type"; do
3664 redo=''
3665 rp="$orig_rp"
3666 dflt="$orig_dflt"
3667 case "$tilde" in
3668 true) rp="$rp (~name ok)";;
3669 esac
3670 . UU/myread
3671 if test -f UU/getfile.ok && \
3672 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3673 then
3674 value="$ans"
3675 ansexp="$ans"
3676 break
3677 fi
3678 case "$ans" in
3679 none)
3680 value=''
3681 ansexp=''
3682 case "$none_ok" in
3683 true) type='';;
b29b105d
JH
3684 esac
3685 ;;
f3f1a2d8
MB
3686 *)
3687 case "$tilde" in
3688 '') value="$ans"
3689 ansexp="$ans";;
3690 *)
3691 value=`UU/filexp $ans`
3692 case $? in
3693 0)
3694 if test "$ans" != "$value"; then
3695 echo "(That expands to $value on this system.)"
3696 fi
3697 ;;
3698 *) value="$ans";;
3699 esac
3700 ansexp="$value"
3701 case "$exp_file" in
3702 '') value="$ans";;
3703 esac
3704 ;;
3705 esac
3706 case "$fullpath" in
3707 true)
3708 case "$ansexp" in
3709 /*) value="$ansexp" ;;
3710 [a-zA-Z]:/*) value="$ansexp" ;;
3711 *)
3712 redo=true
3713 case "$already" in
3714 true)
3715 echo "I shall only accept a full path name, as in /bin/ls." >&4
3716 echo "Use a ! shell escape if you wish to check pathnames." >&4
3717 ;;
3718 *)
3719 echo "Please give a full path name, starting with slash." >&4
3720 case "$tilde" in
3721 true)
3722 echo "Note that using ~name is ok provided it expands well." >&4
3723 already=true
3724 ;;
3725 esac
3726 esac
3727 ;;
3728 esac
3729 ;;
3730 esac
3731 case "$redo" in
3732 '')
3733 case "$type" in
3734 File)
3735 for fp in $gfpth; do
3736 if test "X$fp" = X.; then
3737 pf="$ansexp"
3738 else
3739 pf="$fp/$ansexp"
3740 fi
3741 if test -f "$pf"; then
3742 type=''
3743 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3744 then
3745 echo "($value is not a plain file, but that's ok.)"
3746 type=''
3747 fi
3748 if test X"$type" = X; then
3749 value="$pf"
3750 break
3751 fi
3752 done
3753 ;;
3754 Directory)
3755 for fp in $gfpth; do
3756 if test "X$fp" = X.; then
3757 dir="$ans"
3758 direxp="$ansexp"
3759 else
3760 dir="$fp/$ansexp"
3761 direxp="$fp/$ansexp"
3762 fi
3763 if test -d "$direxp"; then
3764 type=''
3765 value="$dir"
3766 break
3767 fi
3768 done
3769 ;;
3770 Locate)
3771 if test -d "$ansexp"; then
3772 echo "(Looking for $loc_file in directory $value.)"
3773 value="$value/$loc_file"
3774 ansexp="$ansexp/$loc_file"
3775 fi
3776 if test -f "$ansexp"; then
3777 type=''
3778 fi
3779 case "$nopath_ok" in
3780 true) case "$value" in
3781 */*) ;;
3782 *) echo "Assuming $value will be in people's path."
3783 type=''
3784 ;;
3785 esac
3786 ;;
3787 esac
3788 ;;
3789 esac
b4eb6b3d 3790
f3f1a2d8
MB
3791 case "$skip" in
3792 true) type='';
3793 esac
3794
3795 case "$type" in
3796 '') ;;
3797 *)
3798 if test "$fastread" = yes; then
3799 dflt=y
3800 else
3801 dflt=n
3802 fi
3803 rp="$what $value doesn't exist. Use that name anyway?"
3804 . UU/myread
3805 dflt=''
3806 case "$ans" in
3807 y*) type='';;
3808 *) echo " ";;
3809 esac
3810 ;;
3811 esac
3812 ;;
3813 esac
3814 ;;
b4eb6b3d 3815 esac
f3f1a2d8
MB
3816done
3817cd UU
3818ans="$value"
3819rp="$orig_rp"
3820dflt="$orig_dflt"
3821rm -f getfile.ok
3822test "X$gfpthkeep" != Xy && gfpth=""
3823EOSC
3824
3825: determine root of directory hierarchy where package will be installed.
3826case "$prefix" in
3827'')
3828 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3829 ;;
3830*?/)
3831 dflt=`echo "$prefix" | sed 's/.$//'`
b4eb6b3d
JH
3832 ;;
3833*)
f3f1a2d8 3834 dflt="$prefix"
b4eb6b3d
JH
3835 ;;
3836esac
f3f1a2d8 3837$cat <<EOM
b4eb6b3d 3838
f3f1a2d8
MB
3839By default, $package will be installed in $dflt/bin, manual pages
3840under $dflt/man, etc..., i.e. with $dflt as prefix for all
3841installation directories. Typically this is something like /usr/local.
3842If you wish to have binaries under /usr/bin but other parts of the
3843installation under /usr/local, that's ok: you will be prompted
3844separately for each of the installation directories, the prefix being
3845only used to set the defaults.
c915ce7f
JH
3846
3847EOM
f3f1a2d8
MB
3848fn=d~
3849rp='Installation prefix to use?'
3850. ./getfile
3851oldprefix=''
3852case "$prefix" in
3853'') ;;
3854*)
3855 case "$ans" in
3856 "$prefix") ;;
3857 *) oldprefix="$prefix";;
3858 esac
c915ce7f
JH
3859 ;;
3860esac
f3f1a2d8
MB
3861prefix="$ans"
3862prefixexp="$ansexp"
c915ce7f 3863
f3f1a2d8
MB
3864case "$afsroot" in
3865'') afsroot=/afs ;;
3866*) afsroot=$afsroot ;;
b4eb6b3d 3867esac
b4eb6b3d 3868
f3f1a2d8
MB
3869: is AFS running?
3870echo " "
3871case "$afs" in
3872$define|true) afs=true ;;
3873$undef|false) afs=false ;;
3874*) if test -d $afsroot; then
3875 afs=true
3876 else
3877 afs=false
3878 fi
b4eb6b3d 3879 ;;
f3f1a2d8
MB
3880esac
3881if $afs; then
3882 echo "AFS may be running... I'll be extra cautious then..." >&4
3883else
3884 echo "AFS does not seem to be running..." >&4
9da7673b 3885fi
b4eb6b3d 3886
f3f1a2d8
MB
3887: determine installation prefix for where package is to be installed.
3888if $afs; then
3889$cat <<EOM
3890
3891Since you are running AFS, I need to distinguish the directory in which
3892files will reside from the directory in which they are installed (and from
3893which they are presumably copied to the former directory by occult means).
b4eb6b3d 3894
b4eb6b3d 3895EOM
f3f1a2d8
MB
3896 case "$installprefix" in
3897 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3898 *) dflt="$installprefix";;
3899 esac
3900else
3901$cat <<EOM
b4eb6b3d 3902
f3f1a2d8
MB
3903In some special cases, particularly when building $package for distribution,
3904it is convenient to distinguish the directory in which files should be
3905installed from the directory ($prefix) in which they will
3906eventually reside. For most users, these two directories are the same.
3907
3908EOM
3909 case "$installprefix" in
3910 '') dflt=$prefix ;;
3911 *) dflt=$installprefix;;
3912 esac
3913fi
3914fn=d~
3915rp='What installation prefix should I use for installing files?'
3916. ./getfile
3917installprefix="$ans"
3918installprefixexp="$ansexp"
3919
3920: Perform the prefixexp/installprefixexp correction if necessary
3921cat <<EOS >installprefix
3922$startsh
3923EOS
3924cat <<'EOSC' >>installprefix
3925: Change installation prefix, if necessary.
3926if $test X"$prefix" != X"$installprefix"; then
3927 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3928else
3929 eval "install${prefixvar}=\"\$${prefixvar}exp\""
3930fi
3931EOSC
3932chmod +x installprefix
3933$eunicefix installprefix
3934
3935: Set variables such as privlib and privlibexp from the output of ./getfile
3936: performing the prefixexp/installprefixexp correction if necessary.
3937cat <<EOS >setprefixvar
3938$startsh
3939EOS
3940cat <<'EOSC' >>setprefixvar
3941eval "${prefixvar}=\"\$ans\""
3942eval "${prefixvar}exp=\"\$ansexp\""
3943. ./installprefix
3944EOSC
3945chmod +x setprefixvar
3946$eunicefix setprefixvar
3947
3948: set up the script used to warn in case of inconsistency
3949cat <<EOS >whoa
3950$startsh
3951EOS
3952cat <<'EOSC' >>whoa
3953dflt=y
dcb594bc
MB
3954case "$hint" in
3955 recommended)
3956 case "$hintfile" in
3957 '') echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3958 ;;
3959 *) echo "Hmm. Based on the hints in hints/$hintfile.sh, " >&4
3960 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
3961 ;;
3962 esac
3963 ;;
3964 *) echo " "
3965 echo "*** WHOA THERE!!! ***" >&4
3966 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3967 ;;
3968esac
f3f1a2d8
MB
3969rp=" Keep the $hint value?"
3970. ./myread
3971case "$ans" in
3972y) td=$was; tu=$was;;
3973esac
3974EOSC
3975
3976: function used to set $1 to $val
3977setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3978case "$val$was" in
3979$define$undef) . ./whoa; eval "$var=\$td";;
3980$undef$define) . ./whoa; eval "$var=\$tu";;
3981*) eval "$var=$val";;
3982esac'
3983
3984case "$usesocks" in
3985$define|true|[yY]*) dflt='y';;
3986*) dflt='n';;
3987esac
3988cat <<EOM
3989
3990Perl can be built to use the SOCKS proxy protocol library. To do so,
3991Configure must be run with -Dusesocks. If you use SOCKS you also need
3992to use the PerlIO abstraction layer, this will be implicitly selected.
3993
3994If this doesn't make any sense to you, just accept the default '$dflt'.
3995EOM
3996rp='Build Perl for SOCKS?'
3997. ./myread
3998case "$ans" in
3999y|Y) val="$define" ;;
4000*) val="$undef" ;;
4001esac
4002set usesocks
4003eval $setvar
4004
4005case "$usesocks" in
4006$define|true|[yY]*) useperlio="$define";;
4007esac
4008
4009case "$useperlio" in
4010$define|true|[yY]*|'') dflt='y';;
4011*) dflt='n';;
4012esac
4013cat <<EOM
4014
4015Previous version of $package used the standard IO mechanisms as
4016defined in <stdio.h>. Versions 5.003_02 and later of $package allow
4017alternate IO mechanisms via the PerlIO abstraction layer, but the
4018stdio mechanism is still available if needed. The abstraction layer
4019can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4020Using PerlIO with sfio may cause problems with some extension modules.
4021
4022If this doesn't make any sense to you, just accept the default '$dflt'.
b4eb6b3d 4023EOM
f3f1a2d8
MB
4024rp='Use the PerlIO abstraction layer?'
4025. ./myread
4026case "$ans" in
4027y|Y)
b4eb6b3d
JH
4028 val="$define"
4029 ;;
f3f1a2d8
MB
4030*)
4031 echo "Ok, doing things the stdio way."
4032 val="$undef"
4033 ;;
4034esac
4035set useperlio
4036eval $setvar
4037
4038case "$usesocks" in
4039$define|true|[yY]*)
4040 case "$useperlio" in
4041 $define|true|[yY]*) ;;
4042 *) cat >&4 <<EOM
4043
4044You are using the SOCKS proxy protocol library which means that you
4045should also use the PerlIO layer. You may be headed for trouble.
4046
4047EOM
4048 ;;
b4eb6b3d 4049 esac
f3f1a2d8
MB
4050 ;;
4051esac
4052
4053
5c40187f
MB
4054: get the patchlevel
4055echo " "
4056echo "Getting the current patchlevel..." >&4
4057if $test -r $rsrc/patchlevel.h;then
4058 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4059 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4060 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4061 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4062 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4063 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4064 perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
4065else
4066 revision=0
4067 patchlevel=0
4068 subversion=0
4069 api_revision=0
4070 api_version=0
4071 api_subversion=0
4072 perl_patchlevel=0
4073 $echo "(You do not have patchlevel.h. Eek.)"
4074fi
4075if $test -r $rsrc/.patch ; then
4076 if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4077 perl_patchlevel=`cat $rsrc/.patch`
4078 fi
4079fi
4080: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4081version_patchlevel_string="version $patchlevel subversion $subversion"
4082case "$perl_patchlevel" in
40830|'') ;;
4084*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4085esac
4086
4087$echo "(You have $package $version_patchlevel_string.)"
4088
4089case "$osname" in
4090dos|vms)
4091 : XXX Should be a Configure test for double-dots in filenames.
4092 version=`echo $revision $patchlevel $subversion | \
4093 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4094 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4095 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4096 ;;
4097*)
4098 version=`echo $revision $patchlevel $subversion | \
4099 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4100 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4101 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4102 ;;
4103esac
4104: Special case the 5.005_xx maintenance series, which used 5.005
4105: without any subversion label as a subdirectory in $sitelib
4106if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4107 api_versionstring='5.005'
4108fi
4109
f3f1a2d8
MB
4110case "$usethreads" in
4111$define|true|[yY]*) dflt='y';;
4112*) # Catch case where user specified ithreads or 5005threads but
4113 # forgot -Dusethreads (A.D. 4/2002)
4114 case "$useithreads$use5005threads" in
4115 *$define*)
4116 case "$useperlio" in
4117 "$define") dflt='y' ;;
4118 *) dflt='n' ;;
4119 esac
4120 ;;
4121 *) dflt='n';;
4122 esac
4123 ;;
4124esac
4125cat <<EOM
4126
4127Perl can be built to take advantage of threads on some systems.
4128To do so, Configure can be run with -Dusethreads.
4129
4130Note that Perl built with threading support runs slightly slower
4131and uses more memory than plain Perl. The current implementation
4132is believed to be stable, but it is fairly new, and so should be
4133treated with caution.
4134
4135If this doesn't make any sense to you, just accept the default '$dflt'.
4136EOM
4137rp='Build a threading Perl?'
4138. ./myread
4139case "$ans" in
4140y|Y) val="$define" ;;
4141*) val="$undef" ;;
4142esac
4143set usethreads
4144eval $setvar
4145
5c40187f
MB
4146if $test $patchlevel -lt 9; then
4147 case "$usethreads" in
4148 $define)
f3f1a2d8
MB
4149 $cat <<EOM
4150
4151Since release 5.6, Perl has had two different threading implementations,
4152the newer interpreter-based version (ithreads) with one interpreter per
4153thread, and the older 5.005 version (5005threads).
4154The 5005threads version is effectively unmaintained and will probably be
4155removed in Perl 5.10, so there should be no need to build a Perl using it
4156unless needed for backwards compatibility with some existing 5.005threads
4157code.
4158
4159EOM
4160 : Default to ithreads unless overridden on command line or with
4161 : old config.sh
4162 dflt='y'
4163 case "$use5005threads" in
4164 $define|true|[yY]*) dflt='n';;
4165 esac
4166 case "$useithreads" in
4167 $undef|false|[nN]*) dflt='n';;
4168 esac
4169 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
4170 . ./myread
4171 case "$ans" in
f3f1a2d8 4172 y|Y) val="$define" ;;
b4eb6b3d
JH
4173 *) val="$undef" ;;
4174 esac
f3f1a2d8
MB
4175 set useithreads
4176 eval $setvar
4177 : Now set use5005threads to the opposite value.
4178 case "$useithreads" in
4179 $define) val="$undef" ;;
4180 *) val="$define" ;;
4181 esac
4182 set use5005threads
4183 eval $setvar
4184 ;;
5c40187f 4185 *)
f3f1a2d8
MB
4186 useithreads="$undef"
4187 use5005threads="$undef"
b4eb6b3d 4188 ;;
5c40187f 4189 esac
b4eb6b3d 4190
5c40187f
MB
4191 case "$useithreads$use5005threads" in
4192 "$define$define")
f3f1a2d8 4193 $cat >&4 <<EOM
96056487 4194
f3f1a2d8
MB
4195You cannot have both the ithreads and the 5.005 threads enabled
4196at the same time. Disabling the 5.005 threads since they are
4197much less stable than the ithreads.
4198
4199EOM
4200 use5005threads="$undef"
96056487 4201 ;;
5c40187f
MB
4202 esac
4203
4204else
4205: perl-5.9.x and later
4206
4207 use5005threads="$undef"
4208 case "$usethreads" in
4209 $define)
4210 : Default to ithreads unless overridden on command line or with
4211 : old config.sh
4212 dflt='y'
4213 case "$useithreads" in
4214 $undef|false|[nN]*) dflt='n';;
4215 esac
4216 rp='Use the newer interpreter-based ithreads?'
4217 . ./myread
4218 case "$ans" in
4219 y|Y) val="$define" ;;
4220 *) val="$undef" ;;
4221 esac
4222 set useithreads
4223 eval $setvar
4224 ;;
4225 *)
4226 useithreads="$undef"
4227 ;;
4228 esac
4229
4230fi
96056487 4231
f3f1a2d8
MB
4232if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4233 cat >&4 <<EOF
4234***
4235*** To build with ithreads you must also use the PerlIO layer.
4236*** Cannot continue, aborting.
4237***
4238EOF
4239 exit 1
4240fi
4241
4242case "$d_oldpthreads" in
4243'') : Configure tests would be welcome here. For now, assume undef.
4244 val="$undef" ;;
4245*) val="$d_oldpthreads" ;;
4246esac
4247set d_oldpthreads
4248eval $setvar
4249
4250
4251: Look for a hint-file generated 'call-back-unit'. If the
4252: user has specified that a threading perl is to be built,
4253: we may need to set or change some other defaults.
4254if $test -f usethreads.cbu; then
4255 echo "Your platform has some specific hints regarding threaded builds, using them..."
4256 . ./usethreads.cbu
4257else
4258 case "$usethreads" in
4259 "$define"|true|[yY]*)
4260 $cat <<EOM
4261(Your platform does not have any specific hints for threaded builds.
4262 Assuming POSIX threads, then.)
4263EOM
4264 ;;
4265 esac
4266fi
4267
4268cat <<EOM
4269
4270Perl can be built so that multiple Perl interpreters can coexist
4271within the same Perl executable.
4272EOM
4273
4274case "$useithreads" in
4275$define)
4276 cat <<EOM
4277This multiple interpreter support is required for interpreter-based threads.
4278EOM
4279 val="$define"
4280 ;;
4281*) case "$usemultiplicity" in
4282 $define|true|[yY]*) dflt='y';;
4283 *) dflt='n';;
4284 esac
4285 echo " "
4286 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4287 rp='Build Perl for multiplicity?'
4288 . ./myread
4289 case "$ans" in
4290 y|Y) val="$define" ;;
4291 *) val="$undef" ;;
4292 esac
4293 ;;
4294esac
4295set usemultiplicity
4296eval $setvar
4297
4298
4299case "$usemorebits" in
4300"$define"|true|[yY]*)
4301 use64bitint="$define"
4302 uselongdouble="$define"
4303 usemorebits="$define"
4304 ;;
4305*) usemorebits="$undef"
4306 ;;
4307esac
4308
4309: make some quick guesses about what we are up against
4310echo " "
4311$echo $n "Hmm... $c"
4312echo exit 1 >bsd
4313echo exit 1 >usg
4314echo exit 1 >v7
4315echo exit 1 >osf1
4316echo exit 1 >eunice
4317echo exit 1 >xenix
4318echo exit 1 >venix
4319echo exit 1 >os2
4320d_bsd="$undef"
4321$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4322if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
e5e20432
JH
4323then
4324 echo "Looks kind of like an OSF/1 system, but we'll see..."
4325 echo exit 0 >osf1
381aa1ff 4326elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
4327 xxx=`./loc addbib blurfl $pth`
4328 if $test -f $xxx; then
4329 echo "Looks kind of like a USG system with BSD features, but we'll see..."
4330 echo exit 0 >bsd
4331 echo exit 0 >usg
4332 else
4333 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4334 echo "Looks kind of like an extended USG system, but we'll see..."
4335 else
4336 echo "Looks kind of like a USG system, but we'll see..."
4337 fi
4338 echo exit 0 >usg
4339 fi
4340elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4341 echo "Looks kind of like a BSD system, but we'll see..."
4342 d_bsd="$define"
4343 echo exit 0 >bsd
4344else
4345 echo "Looks kind of like a Version 7 system, but we'll see..."
4346 echo exit 0 >v7
4347fi
4348case "$eunicefix" in
4349*unixtovms*)
4350 $cat <<'EOI'
4351There is, however, a strange, musty smell in the air that reminds me of
4352something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4353EOI
4354 echo exit 0 >eunice
4355 d_eunice="$define"
4356: it so happens the Eunice I know will not run shell scripts in Unix format
4357 ;;
4358*)
4359 echo " "
4360 echo "Congratulations. You aren't running Eunice."
4361 d_eunice="$undef"
4362 ;;
4363esac
4364: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
4365: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4366: semicolon as a patch separator
e5e20432
JH
4367case "$p_" in
4368:) ;;
4369*)
4370 $cat <<'EOI'
4371I have the feeling something is not exactly right, however...don't tell me...
4372lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 4373(Or you may be running DOS with DJGPP.)
e5e20432
JH
4374EOI
4375 echo exit 0 >os2
4376 ;;
4377esac
4378if test -f /xenix; then
4379 echo "Actually, this looks more like a XENIX system..."
4380 echo exit 0 >xenix
4381 d_xenix="$define"
4382else
4383 echo " "
4384 echo "It's not Xenix..."
4385 d_xenix="$undef"
4386fi
4387chmod +x xenix
4388$eunicefix xenix
4389if test -f /venix; then
4390 echo "Actually, this looks more like a VENIX system..."
4391 echo exit 0 >venix
4392else
4393 echo " "
4394 if ./xenix; then
4395 : null
4396 else
4397 echo "Nor is it Venix..."
4398 fi
4399fi
4400chmod +x bsd usg v7 osf1 eunice xenix venix os2
4401$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4402$rm -f foo
4403
5869b1f1
JH
4404case "$cc" in
4405'') dflt=cc;;
4406*) dflt="$cc";;
4407esac
4408rp="Use which C compiler?"
4409. ./myread
4410cc="$ans"
6b769f8f
RB
4411
4412: See if they have not cc but they do have gcc
4413. ./trygcc
e5e20432
JH
4414: Look for a hint-file generated 'call-back-unit'. Now that the
4415: user has specified the compiler, we may need to set or change some
4416: other defaults.
4417if $test -f cc.cbu; then
4418 . ./cc.cbu
4419fi
2573c5f9 4420. ./checkcc
8a27cf78 4421
e5e20432
JH
4422echo " "
4423echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 4424$cat >try.c <<EOM
e5e20432
JH
4425#include <stdio.h>
4426int main() {
7686528e 4427#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
e5e20432
JH
4428#ifdef __VERSION__
4429 printf("%s\n", __VERSION__);
4430#else
4431 printf("%s\n", "1");
4432#endif
4433#endif
073b6de5 4434 return(0);
e5e20432
JH
4435}
4436EOM
5440bc8e
JH
4437if $cc -o try $ccflags $ldflags try.c; then
4438 gccversion=`$run ./try`
f3f1a2d8
MB
4439 case "$gccversion" in
4440 '') echo "You are not using GNU cc." ;;
4441 *) echo "You are using GNU cc $gccversion."
4442 ccname=gcc
4443 ;;
4444 esac
4445else
4446 echo " "
4447 echo "*** WHOA THERE!!! ***" >&4
4448 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
4449 case "$knowitall" in
4450 '')
4451 echo " You'd better start hunting for one and let me know about it." >&4
4452 exit 1
2304df62
AD
4453 ;;
4454 esac
f3f1a2d8
MB
4455fi
4456$rm -f try try.*
4457case "$gccversion" in
44581*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4459esac
4460case "$gccversion" in
4461'') gccosandvers='' ;;
4462*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4463 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4464 gccshortvers=''
4465 case "$gccosandvers" in
4466 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4467 $osname$osvers) ;; # looking good
4468 $osname*) cat <<EOM >&4
4469
4470*** WHOA THERE!!! ***
4471
4472 Your gcc has not been compiled for the exact release of
4473 your operating system ($gccosandvers versus $osname$osvers).
4474
4475 In general it is a good idea to keep gcc synchronized with
4476 the operating system because otherwise serious problems
4477 may ensue when trying to compile software, like Perl.
4478
4479 I'm trying to be optimistic here, though, and will continue.
4480 If later during the configuration and build icky compilation
4481 problems appear (headerfile conflicts being the most common
4482 manifestation), I suggest reinstalling the gcc to match
4483 your operating system release.
4484
4485EOM
4486 ;;
4487 *) gccosandvers='' ;; # failed to parse, better be silent
4488 esac
4489 ;;
4490esac
4491case "$ccname" in
4492'') ccname="$cc" ;;
4493esac
4494
4495# gcc 3.* complain about adding -Idirectories that they already know about,
4496# so we will take those off from locincpth.
4497case "$gccversion" in
44983*)
4499 echo "main(){}">try.c
4500 for incdir in $locincpth; do
4501 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4502 grep '^c[cp]p*[01]: warning: changing search order '`
4503 if test "X$warn" != X; then
4504 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4505 fi
4506 done
4507 $rm -f try try.*
4508esac
2304df62 4509
bd9b35c9
JH
4510: What should the include directory be ?
4511echo " "
4512$echo $n "Hmm... $c"
4513dflt='/usr/include'
4514incpath=''
4515mips_type=''
4516if $test -f /bin/mips && /bin/mips; then
4517 echo "Looks like a MIPS system..."
4518 $cat >usr.c <<'EOCP'
4519#ifdef SYSTYPE_BSD43
4520/bsd43
4521#endif
4522EOCP
8a27cf78 4523 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4524 dflt='/bsd43/usr/include'
4525 incpath='/bsd43'
4526 mips_type='BSD 4.3'
4527 else
4528 mips_type='System V'
4529 fi
4530 $rm -f usr.c usr.out
4531 echo "and you're compiling with the $mips_type compiler and libraries."
4532 xxx_prompt=y
4533 echo "exit 0" >mips
4534else
4535 echo "Doesn't look like a MIPS system."
4536 xxx_prompt=n
4537 echo "exit 1" >mips
4538fi
4539chmod +x mips
4540$eunicefix mips
4541case "$usrinc" in
4542'') ;;
4543*) dflt="$usrinc";;
4544esac
4545case "$xxx_prompt" in
4546y) fn=d/
4547 echo " "
4548 rp='Where are the include files you want to use?'
4549 . ./getfile
4550 usrinc="$ans"
8e07c86e 4551 ;;
bd9b35c9 4552*) usrinc="$dflt"
8e07c86e
AD
4553 ;;
4554esac
2304df62 4555
96056487
JH
4556: see how we invoke the C preprocessor
4557echo " "
4558echo "Now, how can we feed standard input to your C preprocessor..." >&4
4559cat <<'EOT' >testcpp.c
4560#define ABC abc
4561#define XYZ xyz
4562ABC.XYZ
4563EOT
4564cd ..
4565if test ! -f cppstdin; then
4566 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4567 # AIX cc -E doesn't show the absolute headerfile
4568 # locations but we'll cheat by using the -M flag.
4569 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
4570 else
4571 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4572 fi
4573else
4574 echo "Keeping your $hint cppstdin wrapper."
4575fi
4576chmod 755 cppstdin
4577wrapper=`pwd`/cppstdin
4578ok='false'
4579cd UU
4580
4581if $test "X$cppstdin" != "X" && \
4582 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4583 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4584then
4585 echo "You used to use $cppstdin $cppminus so we'll use that again."
4586 case "$cpprun" in
4587 '') echo "But let's see if we can live without a wrapper..." ;;
4588 *)
4589 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4590 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4591 then
4592 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4593 ok='true'
4594 else
4595 echo "(However, $cpprun $cpplast does not work, let's see...)"
4596 fi
4597 ;;
4598 esac
4599else
4600 case "$cppstdin" in
4601 '') ;;
4602 *)
4603 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4604 ;;
4605 esac
4606fi
4607
4608if $ok; then
4609 : nothing
4610elif echo 'Maybe "'"$cc"' -E" will work...'; \
4611 $cc -E <testcpp.c >testcpp.out 2>&1; \
4612 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4613 echo "Yup, it does."
4614 x_cpp="$cc -E"
4615 x_minus='';
4616elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4617 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4618 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4619 echo "Yup, it does."
4620 x_cpp="$cc -E"
4621 x_minus='-';
4622elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4623 $cc -P <testcpp.c >testcpp.out 2>&1; \
4624 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4625 echo "Yipee, that works!"
4626 x_cpp="$cc -P"
4627 x_minus='';
4628elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4629 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4630 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4631 echo "At long last!"
4632 x_cpp="$cc -P"
4633 x_minus='-';
4634elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4635 $cpp <testcpp.c >testcpp.out 2>&1; \
4636 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4637 echo "It works!"
4638 x_cpp="$cpp"
4639 x_minus='';
4640elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4641 $cpp - <testcpp.c >testcpp.out 2>&1; \
4642 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4643 echo "Hooray, it works! I was beginning to wonder."
4644 x_cpp="$cpp"
4645 x_minus='-';
4646elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4647 $wrapper <testcpp.c >testcpp.out 2>&1; \
4648 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4649 x_cpp="$wrapper"
4650 x_minus=''
4651 echo "Eureka!"
4652else
4653 dflt=''
4654 rp="No dice. I can't find a C preprocessor. Name one:"
4655 . ./myread
4656 x_cpp="$ans"
4657 x_minus=''
4658 $x_cpp <testcpp.c >testcpp.out 2>&1
4659 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4660 echo "OK, that will do." >&4
4661 else
4662echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4663 exit 1
4664 fi
4665fi
4666
4667case "$ok" in
4668false)
4669 cppstdin="$x_cpp"
4670 cppminus="$x_minus"
4671 cpprun="$x_cpp"
4672 cpplast="$x_minus"
4673 set X $x_cpp
4674 shift
4675 case "$1" in
4676 "$cpp")
4677 echo "Perhaps can we force $cc -E using a wrapper..."
4678 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4679 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4680 then
4681 echo "Yup, we can."
4682 cppstdin="$wrapper"
4683 cppminus='';
4684 else
4685 echo "Nope, we'll have to live without it..."
4686 fi
4687 ;;
4688 esac
4689 case "$cpprun" in
4690 "$wrapper")
4691 cpprun=''
4692 cpplast=''
4693 ;;
4694 esac
4695 ;;
4696esac
4697
4698case "$cppstdin" in
4699"$wrapper"|'cppstdin') ;;
4700*) $rm -f $wrapper;;
4701esac
4702$rm -f testcpp.c testcpp.out
4703
bd9b35c9
JH
4704: Set private lib path
4705case "$plibpth" in
4706'') if ./mips; then
4707 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4708 fi;;
4709esac
4710case "$libpth" in
4711' ') dlist='';;
4712'') dlist="$loclibpth $plibpth $glibpth";;
4713*) dlist="$libpth";;
4714esac
4715
4716: Now check and see which directories actually exist, avoiding duplicates
4717libpth=''
4718for xxx in $dlist
4719do
4720 if $test -d $xxx; then
4721 case " $libpth " in
4722 *" $xxx "*) ;;
4723 *) libpth="$libpth $xxx";;
4724 esac
4725 fi
4726done
4727$cat <<'EOM'
4728
4729Some systems have incompatible or broken versions of libraries. Among
4730the directories listed in the question below, please remove any you
4731know not to be holding relevant libraries, and add any that are needed.
4732Say "none" for none.
8e07c86e
AD
4733
4734EOM
bd9b35c9
JH
4735case "$libpth" in
4736'') dflt='none';;
8e07c86e 4737*)
bd9b35c9
JH
4738 set X $libpth
4739 shift
4740 dflt=${1+"$@"}
8e07c86e 4741 ;;
a0d0e21e 4742esac
bd9b35c9
JH
4743rp="Directories to use for library searches?"
4744. ./myread
4745case "$ans" in
4746none) libpth=' ';;
4747*) libpth="$ans";;
4748esac
a0d0e21e 4749
bd9b35c9
JH
4750: compute shared library extension
4751case "$so" in
4752'')
4753 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4754 dflt='sl'
dd4e71fd 4755 else
bd9b35c9 4756 dflt='so'
dd4e71fd
JH
4757 fi
4758 ;;
bd9b35c9 4759*) dflt="$so";;
dd4e71fd 4760esac
dd4e71fd
JH
4761$cat <<EOM
4762
bd9b35c9 4763On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4764you want to suppress searching of shared libraries for the remainder
bd9b35c9 4765of this configuration.
dd4e71fd
JH
4766
4767EOM
bd9b35c9
JH
4768rp='What is the file extension used for shared libraries?'
4769. ./myread
4770so="$ans"
dd4e71fd 4771
bd9b35c9
JH
4772: Define several unixisms.
4773: Hints files or command line option can be used to override them.
4774: The convoluted testing is in case hints files set either the old
4775: or the new name.
4776case "$_exe" in
4777'') case "$exe_ext" in
1fef16b3 4778 '') ;;
bd9b35c9 4779 *) _exe="$exe_ext" ;;
dd4e71fd 4780 esac
bd9b35c9 4781 ;;
bfb7748a 4782esac
bd9b35c9
JH
4783case "$_a" in
4784'') case "$lib_ext" in
4785 '') _a='.a';;
4786 *) _a="$lib_ext" ;;
dd4e71fd
JH
4787 esac
4788 ;;
dd4e71fd 4789esac
bd9b35c9
JH
4790case "$_o" in
4791'') case "$obj_ext" in
4792 '') _o='.o';;
4793 *) _o="$obj_ext";;
4794 esac
4795 ;;
4796esac
4797case "$p_" in
4798'') case "$path_sep" in
4799 '') p_=':';;
4800 *) p_="$path_sep";;
4801 esac
4802 ;;
4803esac
4804exe_ext=$_exe
4805lib_ext=$_a
4806obj_ext=$_o
4807path_sep=$p_
dd4e71fd 4808
b4eb6b3d
JH
4809: Which makefile gets called first. This is used by make depend.
4810case "$firstmakefile" in
4811'') firstmakefile='makefile';;
4633a7c4 4812esac
4633a7c4 4813
1f603089
JH
4814case "$ccflags" in
4815*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4816esac
4817
4818case "$uselongdouble" in
4819$define|true|[yY]*) dflt='y';;
4820*) dflt='n';;
4821esac
4822cat <<EOM
4823
4824Perl can be built to take advantage of long doubles which
4825(if available) may give more accuracy and range for floating point numbers.
4826
4827If this doesn't make any sense to you, just accept the default '$dflt'.
4828EOM
4829rp='Try to use long doubles if available?'
4830. ./myread
4831case "$ans" in
4832y|Y) val="$define" ;;
4833*) val="$undef" ;;
4834esac
4835set uselongdouble
4836eval $setvar
4837
4838case "$uselongdouble" in
4839true|[yY]*) uselongdouble="$define" ;;
4840esac
4841
1f603089
JH
4842: Look for a hint-file generated 'call-back-unit'. If the
4843: user has specified that long doubles should be used,
4844: we may need to set or change some other defaults.
9da7673b
MB
4845if $test -f uselongdouble.cbu; then
4846 echo "Your platform has some specific hints regarding long doubles, using them..."
4847 . ./uselongdouble.cbu
4848else
4849 case "$uselongdouble" in
4850 $define)
1f603089 4851 $cat <<EOM
9da7673b 4852(Your platform does not have any specific hints for long doubles.)
1f603089 4853EOM
1f603089 4854 ;;
9da7673b
MB
4855 esac
4856fi
1f603089 4857
bd9b35c9
JH
4858: Looking for optional libraries
4859echo " "
4860echo "Checking for optional libraries..." >&4
4861case "$libs" in
4862' '|'') dflt='';;
4863*) dflt="$libs";;
4864esac
4865case "$libswanted" in
4866'') libswanted='c_s';;
4867esac
4868case "$usesocks" in
923fc586 4869"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4870esac
68435ea7
JH
4871libsfound=''
4872libsfiles=''
4873libsdirs=''
13b3f787
JH
4874libspath=''
4875for thisdir in $libpth $xlibpth; do
4876 test -d $thisdir && libspath="$libspath $thisdir"
4877done
bd9b35c9 4878for thislib in $libswanted; do
13b3f787 4879 for thisdir in $libspath; do
f7dd4e7f
JH
4880 xxx=''
4881 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4882 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4883 $test -f "$xxx" && eval $libscheck
4884 $test -f "$xxx" && libstyle=shared
4885 fi
4886 if test ! -f "$xxx"; then
4887 xxx=$thisdir/lib$thislib.$so
4888 $test -f "$xxx" && eval $libscheck
4889 $test -f "$xxx" && libstyle=shared
4890 fi
4891 if test ! -f "$xxx"; then
4892 xxx=$thisdir/lib$thislib$_a
4893 $test -f "$xxx" && eval $libscheck
4894 $test -f "$xxx" && libstyle=static
4895 fi
4896 if test ! -f "$xxx"; then
4897 xxx=$thisdir/$thislib$_a
4898 $test -f "$xxx" && eval $libscheck
4899 $test -f "$xxx" && libstyle=static
4900 fi
4901 if test ! -f "$xxx"; then
4902 xxx=$thisdir/lib${thislib}_s$_a
4903 $test -f "$xxx" && eval $libscheck
4904 $test -f "$xxx" && libstyle=static
09ea5ba9 4905 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4906 fi
4907 if test ! -f "$xxx"; then
4908 xxx=$thisdir/Slib$thislib$_a
4909 $test -f "$xxx" && eval $libscheck
4910 $test -f "$xxx" && libstyle=static
4911 fi
4912 if $test -f "$xxx"; then
43999f95 4913 case "$libstyle" in
f7dd4e7f
JH
4914 shared) echo "Found -l$thislib (shared)." ;;
4915 static) echo "Found -l$thislib." ;;
4916 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4917 esac
bd9b35c9
JH
4918 case " $dflt " in
4919 *"-l$thislib "*);;
f7dd4e7f 4920 *) dflt="$dflt -l$thislib"
43999f95
JH
4921 libsfound="$libsfound $xxx"
4922 yyy=`basename $xxx`
4923 libsfiles="$libsfiles $yyy"
1e127011 4924 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4925 case " $libsdirs " in
4926 *" $yyy "*) ;;
4927 *) libsdirs="$libsdirs $yyy" ;;
4928 esac
4929 ;;
bd9b35c9 4930 esac
f7dd4e7f
JH
4931 break
4932 fi
4933 done
4934 if $test ! -f "$xxx"; then
4935 echo "No -l$thislib."
bd9b35c9
JH
4936 fi
4937done
4938set X $dflt
4939shift
4940dflt="$*"
4941case "$libs" in
4942'') dflt="$dflt";;
4943*) dflt="$libs";;
4944esac
4945case "$dflt" in
4946' '|'') dflt='none';;
4947esac
4633a7c4 4948
bd9b35c9 4949$cat <<EOM
4633a7c4 4950
bd9b35c9
JH
4951In order to compile $package on your machine, a number of libraries
4952are usually needed. Include any other special libraries here as well.
4953Say "none" for none. The default list is almost always right.
8e07c86e 4954EOM
8e07c86e 4955
bd9b35c9
JH
4956echo " "
4957rp="What libraries to use?"
4958. ./myread
4959case "$ans" in
4960none) libs=' ';;
4961*) libs="$ans";;
4962esac
d71b2b6b 4963
bd9b35c9
JH
4964: determine optimization, if desired, or use for debug flag also
4965case "$optimize" in
4966' '|$undef) dflt='none';;
4967'') dflt='-O';;
4968*) dflt="$optimize";;
4969esac
4970$cat <<EOH
d71b2b6b 4971
bd9b35c9
JH
4972By default, $package compiles with the -O flag to use the optimizer.
4973Alternately, you might want to use the symbolic debugger, which uses
4974the -g flag (on traditional Unix systems). Either flag can be
4975specified here. To use neither flag, specify the word "none".
d71b2b6b 4976
bd9b35c9
JH
4977EOH
4978rp="What optimizer/debugger flag should be used?"
4979. ./myread
4980optimize="$ans"
4981case "$optimize" in
4982'none') optimize=" ";;
4983esac
4984
eaf812ae
MB
4985: Check what DEBUGGING is required from the command line
4986: -DEBUGGING or -DDEBUGGING or
4987: -DEBUGGING=both = -g + -DDEBUGGING
4988: -DEBUGGING=-g or -Doptimize=-g = -g
4989: -DEBUGGING=none or -UDEBUGGING =
4990: -DEBUGGING=old or -DEBUGGING=default = ? $optimize
4991case "$EBUGGING" in
4992'') ;;
4993*) DEBUGGING=$EBUGGING ;;
4994esac
4995
4996case "$DEBUGGING" in
5a7c70d6 4997-g|both|$define)
eaf812ae
MB
4998 case "$optimize" in
4999 *-g*) ;;
5000 *) optimize="$optimize -g" ;;
5001 esac ;;
5002none|$undef)
5003 case "$optimize" in
5004 *-g*) set `echo "X $optimize " | sed 's/ -g / /'`
5005 shift
5006 optimize="$*"
5007 ;;
5008 esac ;;
5009esac
5010
bd9b35c9 5011dflt=''
eaf812ae
MB
5012case "$DEBUGGING" in
5013both|$define) dflt='-DDEBUGGING'
5014esac
5015
bd9b35c9
JH
5016: We will not override a previous value, but we might want to
5017: augment a hint file
5018case "$hint" in
5019default|recommended)
5020 case "$gccversion" in
eaf812ae 5021 1*) dflt="$dflt -fpcc-struct-return" ;;
d71b2b6b 5022 esac
eaf812ae
MB
5023 case "$optimize:$DEBUGGING" in
5024 *-g*:old) dflt="$dflt -DDEBUGGING";;
d71b2b6b 5025 esac
bd9b35c9
JH
5026 case "$gccversion" in
5027 2*) if test -d /etc/conf/kconfig.d &&
5028 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5029 then
00e89ad4 5030 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
5031 dflt="$dflt -posix"
5032 fi
f0d04425 5033 ;;
bd9b35c9
JH
5034 esac
5035 case "$gccversion" in
5036 1*) ;;
5037 2.[0-8]*) ;;
5038 ?*) echo " "
5039 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
5040 echo 'int main(void) { return 0; }' > gcctest.c
5041 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
5042 echo "Yes, it does." 2>&1
5043 case "$ccflags" in
00e89ad4 5044 *strict-aliasing*)
bd9b35c9
JH
5045 echo "Leaving current flags $ccflags alone." 2>&1
5046 ;;
5047 *) dflt="$dflt -fno-strict-aliasing" ;;
5048 esac
5049 else
5050 echo "Nope, it doesn't, but that's ok." 2>&1
5051 fi
f0d04425 5052 ;;
e5e20432 5053 esac
00e89ad4
AD
5054 # For gcc, adding -pipe speeds up compilations for some, but apparently
5055 # some assemblers can't read from stdin. (It also slows down compilations
5056 # in other cases, but those are apparently rarer these days.) AD 5/2004.
5057 case "$gccversion" in
5058 ?*) echo " "
5059 echo "Checking if your compiler accepts -pipe" 2>&1
5060 echo 'int main(void) { return 0; }' > gcctest.c
6347b5be 5061 if $cc -pipe -o gcctest gcctest.c; then
00e89ad4
AD
5062 echo "Yes, it does." 2>&1
5063 case "$ccflags" in
5064 *-pipe*)
5065 echo "Leaving current flags $ccflags alone." 2>&1
5066 ;;
5067 *) dflt="$dflt -pipe" ;;
5068 esac
5069 else
5070 echo "Nope, it doesn't, but that's ok." 2>&1
5071 fi
5072 ;;
5073 esac
e5e20432
JH
5074 ;;
5075esac
5076
bd9b35c9
JH
5077case "$mips_type" in
5078*BSD*|'') inclwanted="$locincpth $usrinc";;
5079*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5080esac
5081for thisincl in $inclwanted; do
5082 if $test -d $thisincl; then
5083 if $test x$thisincl != x$usrinc; then
5084 case "$dflt" in
00e89ad4
AD
5085 *" -I$thisincl "*);;
5086 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
5087 esac
5088 fi
5089 fi
5090done
40a7a20a 5091
bd9b35c9
JH
5092inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5093 xxx=true;
5094elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5095 xxx=true;
5096else
5097 xxx=false;
5098fi;
5099if $xxx; then
5100 case "$dflt" in
5101 *$2*);;
5102 *) dflt="$dflt -D$2";;
5103 esac;
5104fi'
40a7a20a 5105
bd9b35c9 5106set signal.h LANGUAGE_C; eval $inctest
40a7a20a 5107
bd9b35c9
JH
5108case "$usesocks" in
5109$define)
5110 ccflags="$ccflags -DSOCKS"
5111 ;;
5112esac
40a7a20a 5113
bd9b35c9
JH
5114case "$hint" in
5115default|recommended) dflt="$ccflags $dflt" ;;
5116*) dflt="$ccflags";;
5117esac
40a7a20a 5118
bd9b35c9
JH
5119case "$dflt" in
5120''|' ') dflt=none;;
5121esac
422af00a 5122
bd9b35c9 5123$cat <<EOH
40a7a20a 5124
bd9b35c9
JH
5125Your C compiler may want other flags. For this question you should include
5126-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5127but you should NOT include libraries or ld flags like -lwhatever. If you
5128want $package to honor its debug switch, you should include -DDEBUGGING here.
5129Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 5130
bd9b35c9 5131To use no flags, specify the word "none".
40a7a20a 5132
bd9b35c9
JH
5133EOH
5134set X $dflt
5135shift
5136dflt=${1+"$@"}
5137rp="Any additional cc flags?"
5138. ./myread
5139case "$ans" in
5140none) ccflags='';;
5141*) ccflags="$ans";;
5142esac
8e07c86e 5143
bd9b35c9 5144: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
5145case "$cppflags" in
5146'') cppflags="$ccflags" ;;
5147*) cppflags="$cppflags $ccflags" ;;
5148esac
bd9b35c9
JH
5149case "$gccversion" in
51501*) cppflags="$cppflags -D__GNUC__"
4633a7c4 5151esac
bd9b35c9
JH
5152case "$mips_type" in
5153'');;
5154*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5155esac
5156case "$cppflags" in
5157'');;
5158*)
5159 echo " "
5160 echo "Let me guess what the preprocessor flags are..." >&4
5161 set X $cppflags
5162 shift
5163 cppflags=''
5164 $cat >cpp.c <<'EOM'
5165#define BLURFL foo
8e07c86e 5166
bd9b35c9
JH
5167BLURFL xx LFRULB
5168EOM
5169 previous=''
5170 for flag in $*
5171 do
5172 case "$flag" in
5173 -*) ftry="$flag";;
5174 *) ftry="$previous $flag";;
5175 esac
5176 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5177 >cpp1.out 2>/dev/null && \
5178 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5179 >cpp2.out 2>/dev/null && \
5180 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5181 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5182 then
5183 cppflags="$cppflags $ftry"
5184 previous=''
5185 else
5186 previous="$flag"
5187 fi
5188 done
5189 set X $cppflags
5190 shift
5191 cppflags=${1+"$@"}
5192 case "$cppflags" in
5193 *-*) echo "They appear to be: $cppflags";;
5194 esac
5195 $rm -f cpp.c cpp?.out
2afac517 5196 ;;
5197esac
8e07c86e 5198
bd9b35c9
JH
5199: flags used in final linking phase
5200case "$ldflags" in
5201'') if ./venix; then
5202 dflt='-i -z'
10a23457 5203 else
bd9b35c9 5204 dflt=''
10a23457 5205 fi
bd9b35c9
JH
5206 case "$ccflags" in
5207 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 5208 esac
bd9b35c9
JH
5209 ;;
5210*) dflt="$ldflags";;
5211esac
5212
5213: Try to guess additional flags to pick up local libraries.
5214for thislibdir in $libpth; do
5215 case " $loclibpth " in
5216 *" $thislibdir "*)
00e89ad4 5217 case "$dflt " in
bd9b35c9
JH
5218 *"-L$thislibdir "*) ;;
5219 *) dflt="$dflt -L$thislibdir" ;;
5220 esac
c4f23d77
AD
5221 ;;
5222 esac
bd9b35c9 5223done
c4f23d77 5224
bd9b35c9
JH
5225case "$dflt" in
5226'') dflt='none' ;;
5227esac
c4f23d77 5228
bd9b35c9
JH
5229$cat <<EOH
5230
5231Your C linker may need flags. For this question you should
5232include -L/whatever and any other flags used by the C linker, but you
5233should NOT include libraries like -lwhatever.
5234
5235Make sure you include the appropriate -L/path flags if your C linker
5236does not normally search all of the directories you specified above,
5237namely
5238 $libpth
5239To use no flags, specify the word "none".
5240
5241EOH
5242
5243rp="Any additional ld flags (NOT including libraries)?"
5244. ./myread
5245case "$ans" in
5246none) ldflags='';;
5247*) ldflags="$ans";;
5248esac
5249rmlist="$rmlist pdp11"
5250
5251: coherency check
5252echo " "
5253echo "Checking your choice of C compiler and flags for coherency..." >&4
5254$cat > try.c <<'EOF'
5255#include <stdio.h>
55954f19 5256int main() { printf("Ok\n"); return(0); }
bd9b35c9 5257EOF
7a282f6d 5258set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
5259shift
5260$cat >try.msg <<'EOM'
5261I've tried to compile and run the following simple program:
5262
5263EOM
5264$cat try.c >> try.msg
5265
5266$cat >> try.msg <<EOM
5267
5268I used the command:
5269
5270 $*
5440bc8e 5271 $run ./try
bd9b35c9
JH
5272
5273and I got the following output:
5274
5275EOM
5276dflt=y
73614538 5277if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5440bc8e
JH
5278 if $sh -c "$run ./try" >>try.msg 2>&1; then
5279 xxx=`$run ./try`
bd9b35c9
JH
5280 case "$xxx" in
5281 "Ok") dflt=n ;;
5282 *) echo 'The program compiled OK, but produced no output.' >> try.msg
5283 case " $libs " in
5284 *" -lsfio "*)
5285 cat >> try.msg <<'EOQS'
5286If $libs contains -lsfio, and sfio is mis-configured, then it
5287sometimes (apparently) runs and exits with a 0 status, but with no
5288output! It may have to do with sfio's use of _exit vs. exit.
5289
5290EOQS
5291 rp="You have a big problem. Shall I abort Configure"
5292 dflt=y
5293 ;;
5294 esac
5295 ;;
5296 esac
5297 else
5298 echo "The program compiled OK, but exited with status $?." >>try.msg
5299 rp="You have a problem. Shall I abort Configure"
5300 dflt=y
5301 fi
5302else
5303 echo "I can't compile the test program." >>try.msg
5304 rp="You have a BIG problem. Shall I abort Configure"
5305 dflt=y
5306fi
5307case "$dflt" in
5308y)
5309 $cat try.msg >&4
5310 case "$knowitall" in
5311 '')
5312 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5313 ;;
bd9b35c9 5314 *) dflt=n;;
c4f23d77 5315 esac
bd9b35c9
JH
5316 echo " "
5317 . ./myread
5318 case "$ans" in
5319 n*|N*) ;;
5320 *) echo "Ok. Stopping Configure." >&4
5321 exit 1
c4f23d77
AD
5322 ;;
5323 esac
5324 ;;
bd9b35c9 5325n) echo "OK, that should do.";;
c4f23d77 5326esac
bd9b35c9 5327$rm -f try try.* core
c4f23d77 5328
bd9b35c9
JH
5329: define a shorthand compile call
5330compile='
5331mc_file=$1;
5332shift;
08413ebc 5333$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5334: define a shorthand compile call for compilations that should be ok.
5335compile_ok='
5336mc_file=$1;
5337shift;
7a282f6d 5338$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5339
8dfa8df9
JH
5340: determine filename position in cpp output
5341echo " "
5342echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5343case "$osname" in
5344vos) testaccess=-e ;;
5345*) testaccess=-r ;;
5346esac
8dfa8df9
JH
5347echo '#include <stdio.h>' > foo.c
5348$cat >fieldn <<EOF
5349$startsh
5350$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5351$grep '^[ ]*#.*stdio\.h' | \
5352while read cline; do
5353 pos=1
5354 set \$cline
5355 while $test \$# -gt 0; do
a5a94ea5 5356 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5357 echo "\$pos"
5358 exit 0
5359 fi
5360 shift
5361 pos=\`expr \$pos + 1\`
5362 done
5363done
5364EOF
5365chmod +x fieldn
5366fieldn=`./fieldn`
5367$rm -f foo.c fieldn
5368case $fieldn in
5369'') pos='???';;
53701) pos=first;;
53712) pos=second;;
53723) pos=third;;
5373*) pos="${fieldn}th";;
5374esac
5375echo "Your cpp writes the filename in the $pos field of the line."
5376
3c728e00
JH
5377case "$osname" in
5378vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5c728af0 5379os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5380*) cppfilter='' ;;
5381esac
8dfa8df9
JH
5382: locate header file
5383$cat >findhdr <<EOF
5384$startsh
5385wanted=\$1
5386name=''
5387for usrincdir in $usrinc
5388do
5389 if test -f \$usrincdir/\$wanted; then
5390 echo "\$usrincdir/\$wanted"
5391 exit 0
5392 fi
5393done
5394awkprg='{ print \$$fieldn }'
5395echo "#include <\$wanted>" > foo\$\$.c
5396$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5397$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5398while read cline; do
5399 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5400 case "\$name" in
5401 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5402 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5403 *) exit 2;;
5404 esac;
5405done;
5406#
5407# status = 0: grep returned 0 lines, case statement not executed
5408# status = 1: headerfile found
5409# status = 2: while loop executed, no headerfile found
5410#
5411status=\$?
5412$rm -f foo\$\$.c;
5413if test \$status -eq 1; then
5414 exit 0;
5415fi
5416exit 1
5417EOF
5418chmod +x findhdr
5419
5420: define an alternate in-header-list? function
5421inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5422cont=true; xxf="echo \"<\$1> found.\" >&4";
5423case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5424*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5425esac;
5426case $# in 4) instead=instead;; *) instead="at last";; esac;
5427while $test "$cont"; do
5428 xxx=`./findhdr $1`
5429 var=$2; eval "was=\$$2";
5430 if $test "$xxx" && $test -r "$xxx";
5431 then eval $xxf;
5432 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5433 cont="";
5434 else eval $xxnf;
5435 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5436 set $yyy; shift; shift; yyy=$@;
5437 case $# in 0) cont="";;
5438 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5439 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5440 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5441 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5442 esac;
5443done;
5444while $test "$yyy";
5445do set $yyy; var=$2; eval "was=\$$2";
5446 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5447 set $yyy; shift; shift; yyy=$@;
5448done'
5449
d1daaddf
JH
5450: see if stdlib is available
5451set stdlib.h i_stdlib
5452eval $inhdr
5453
5454: check for lengths of integral types
5455echo " "
5456case "$intsize" in
5457'')
5458 echo "Checking to see how big your integers are..." >&4
c63dfae1 5459 $cat >try.c <<EOCP
d1daaddf
JH
5460#include <stdio.h>
5461#$i_stdlib I_STDLIB
5462#ifdef I_STDLIB
5463#include <stdlib.h>
5464#endif
5465int main()
5466{
5467 printf("intsize=%d;\n", (int)sizeof(int));
5468 printf("longsize=%d;\n", (int)sizeof(long));
5469 printf("shortsize=%d;\n", (int)sizeof(short));
5470 exit(0);
5471}
5472EOCP
5473 set try
5474 if eval $compile_ok && $run ./try > /dev/null; then
5475 eval `$run ./try`
5476 echo "Your integers are $intsize bytes long."
5477 echo "Your long integers are $longsize bytes long."
5478 echo "Your short integers are $shortsize bytes long."
5479 else
5480 $cat >&4 <<EOM
5481!
5482Help! I can't compile and run the intsize test program: please enlighten me!
5483(This is probably a misconfiguration in your system or libraries, and
5484you really ought to fix it. Still, I'll try anyway.)
5485!
5486EOM
5487 dflt=4
5488 rp="What is the size of an integer (in bytes)?"
5489 . ./myread
5490 intsize="$ans"
5491 dflt=$intsize
5492 rp="What is the size of a long integer (in bytes)?"
5493 . ./myread
5494 longsize="$ans"
5495 dflt=2
5496 rp="What is the size of a short integer (in bytes)?"
5497 . ./myread
5498 shortsize="$ans"
5499 fi
5500 ;;
5501esac
5502$rm -f try try.*
5503
5504: check for long long
5505echo " "
5506echo "Checking to see if you have long long..." >&4
5507echo 'int main() { long long x = 7; return 0; }' > try.c
5508set try
5509if eval $compile; then
5510 val="$define"
5511 echo "You have long long."
5512else
5513 val="$undef"
5514 echo "You do not have long long."
5515fi
5516$rm try.*
5517set d_longlong
5518eval $setvar
5519
5520: check for length of long long
5521case "${d_longlong}${longlongsize}" in
5522$define)
5523 echo " "
5524 echo "Checking to see how big your long longs are..." >&4
5525 $cat >try.c <<'EOCP'
5526#include <stdio.h>
5527int main()
5528{
5529 printf("%d\n", (int)sizeof(long long));
5530 return(0);
5531}
5532EOCP
5533 set try
5534 if eval $compile_ok; then
5535 longlongsize=`$run ./try`
5536 echo "Your long longs are $longlongsize bytes long."
5537 else
5538 dflt='8'
5539 echo " "
5540 echo "(I can't seem to compile the test program. Guessing...)"
5541 rp="What is the size of a long long (in bytes)?"
5542 . ./myread
5543 longlongsize="$ans"
5544 fi
5545 if $test "X$longsize" = "X$longlongsize"; then
5546 echo "(That isn't any different from an ordinary long.)"
5547 fi
5548 ;;
5549esac
5550$rm -f try.* try
5551
8dfa8df9
JH
5552: see if inttypes.h is available
5553: we want a real compile instead of Inhdr because some systems
5554: have an inttypes.h which includes non-existent headers
5555echo " "
5556$cat >try.c <<EOCP
5557#include <inttypes.h>
5558int main() {
5559 static int32_t foo32 = 0x12345678;
5560}
5561EOCP
5562set try
5563if eval $compile; then
5564 echo "<inttypes.h> found." >&4
5565 val="$define"
5566else
5567 echo "<inttypes.h> NOT found." >&4
5568 val="$undef"
5569fi
5570$rm -f try.c try
5571set i_inttypes
5572eval $setvar
5573
5574: check for int64_t
5575echo " "
5576echo "Checking to see if you have int64_t..." >&4
5577$cat >try.c <<EOCP
5578#include <sys/types.h>
5579#$i_inttypes I_INTTYPES
5580#ifdef I_INTTYPES
5581#include <inttypes.h>
5582#endif
5583int main() { int64_t x = 7; }
5584EOCP
5585set try
5586if eval $compile; then
5587 val="$define"
5588 echo "You have int64_t."
5589else
5590 val="$undef"
5591 echo "You do not have int64_t."
5592fi
5593$rm -f try try.*
5594set d_int64_t
5595eval $setvar
5596
5597
5598echo " "
5599echo "Checking which 64-bit integer type we could use..." >&4
5600
5601case "$intsize" in
56028) val=int
5603 set quadtype
5604 eval $setvar
5605 val='"unsigned int"'
5606 set uquadtype
5607 eval $setvar
5608 quadkind=1
5609 ;;
5610*) case "$longsize" in
5611 8) val=long
5612 set quadtype
5613 eval $setvar
5614 val='"unsigned long"'
5615 set uquadtype
5616 eval $setvar
5617 quadkind=2
5618 ;;
5619 *) case "$d_longlong:$longlongsize" in
5620 define:8)
5621 val='"long long"'
5622 set quadtype
5623 eval $setvar
5624 val='"unsigned long long"'
5625 set uquadtype
5626 eval $setvar
5627 quadkind=3
5628 ;;
5629 *) case "$d_int64_t" in
5630 define)
5631 val=int64_t
5632 set quadtype
5633 eval $setvar
5634 val=uint64_t
5635 set uquadtype
5636 eval $setvar
5637 quadkind=4
5638 ;;
5639 esac
5640 ;;
5641 esac
5642 ;;
5643 esac
5644 ;;
5645esac
5646
5647case "$quadtype" in
5648'') echo "Alas, no 64-bit integer types in sight." >&4
5649 d_quad="$undef"
5650 ;;
5651*) echo "We could use '$quadtype' for 64-bit integers." >&4
5652 d_quad="$define"
5653 ;;
5654esac
5655
b4eb6b3d
JH
5656
5657case "$uselonglong" in
5658"$define"|true|[yY]*)
5659 cat <<EOM >&4
5660
5661*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5662EOM
5663 use64bitint="$define"
5664 ;;
5665esac
5666case "$use64bits" in
5667"$define"|true|[yY]*)
5668 cat <<EOM >&4
5669
5670*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5671EOM
5672 use64bitint="$define"
5673 ;;
5674esac
5675case "$use64bitints" in
5676"$define"|true|[yY]*)
5677 cat <<EOM >&4
5678
5679*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5680EOM
5681 use64bitint="$define"
5682 ;;
5683esac
5684case "$use64bitsint" in
5685"$define"|true|[yY]*)
5686 cat <<EOM >&4
5687
5688*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5689EOM
5690 use64bitint="$define"
5691 ;;
5692esac
5693case "$uselonglongs" in
5694"$define"|true|[yY]*)
5695 cat <<EOM >&4
5696
5697*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5698EOM
5699 use64bitint="$define"
5700 ;;
5701esac
5702case "$use64bitsall" in
5703"$define"|true|[yY]*)
5704 cat <<EOM >&4
5705
5706*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5707EOM
5708 use64bitall="$define"
5709 ;;
5710esac
5711
5712case "$ccflags" in
5713*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5714esac
5715case "$use64bitall" in
5716"$define"|true|[yY]*) use64bitint="$define" ;;
5717esac
5718
5719case "$longsize" in
57208) cat <<EOM
5721
5722You have natively 64-bit long integers.
5723EOM
5724 val="$define"
5725 ;;
5726*) case "$use64bitint" in
5727 "$define"|true|[yY]*) dflt='y';;
5728 *) dflt='n';;
5729 esac
8dfa8df9
JH
5730 case "$d_quad" in
5731 "$define") ;;
5732 *) dflt='n' ;;
5733 esac
b4eb6b3d
JH
5734 cat <<EOM
5735
5736Perl can be built to take advantage of 64-bit integer types
5737on some systems. To do so, Configure can be run with -Duse64bitint.
5738Choosing this option will most probably introduce binary incompatibilities.
5739
5740If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5741(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5742EOM
5743 rp='Try to use 64-bit integers, if available?'
5744 . ./myread
5745 case "$ans" in
5746 [yY]*) val="$define" ;;
5747 *) val="$undef" ;;
5748 esac
5749 ;;
5750esac
5751set use64bitint
5752eval $setvar
5753
5754case "$use64bitall" in
5755"$define"|true|[yY]*) dflt='y' ;;
5756*) case "$longsize" in
5757 8) dflt='y' ;;
5758 *) dflt='n' ;;
5759 esac
5760 ;;
5761esac
5762cat <<EOM
5763
5764You may also choose to try maximal 64-bitness. It means using as much
576564-bitness as possible on the platform. This in turn means even more
5766binary incompatibilities. On the other hand, your platform may not
5767have any more 64-bitness available than what you already have chosen.
5768
5769If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5770(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5771EOM
5772rp='Try to use maximal 64-bit support, if available?'
5773. ./myread
5774case "$ans" in
5775[yY]*) val="$define" ;;
5776*) val="$undef" ;;
5777esac
5778set use64bitall
5779eval $setvar
5780case "$use64bitall" in
5781"$define")
5782 case "$use64bitint" in
5783 "$undef")
5784 cat <<EOM
5785
5786Since you have chosen a maximally 64-bit build, I'm also turning on
5787the use of 64-bit integers.
5788EOM
5789 use64bitint="$define" ;;
5790 esac
5791 ;;
5792esac
5793
b4eb6b3d
JH
5794: Look for a hint-file generated 'call-back-unit'. If the
5795: user has specified that a 64-bit perl is to be built,
5796: we may need to set or change some other defaults.
19a100ff 5797if $test -f use64bitint.cbu; then
9da7673b 5798 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
19a100ff
MB
5799 . ./use64bitint.cbu
5800fi
9da7673b
MB
5801case "$use64bitint" in
5802"$define"|true|[yY]*)
b4eb6b3d
JH
5803 case "$longsize" in
5804 4) case "$archname64" in
5805 '') archname64=64int ;;
5806 esac
5807 ;;
5808 esac
5809 ;;
5810esac
5811
b4eb6b3d
JH
5812: Look for a hint-file generated 'call-back-unit'. If the
5813: user has specified that a maximally 64-bit perl is to be built,
5814: we may need to set or change some other defaults.
19a100ff 5815if $test -f use64bitall.cbu; then
9da7673b 5816 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
19a100ff
MB
5817 . ./use64bitall.cbu
5818fi
9da7673b
MB
5819case "$use64bitall" in
5820"$define"|true|[yY]*)
b4eb6b3d
JH
5821 case "$longsize" in
5822 4) case "$archname64" in
5823 ''|64int) archname64=64all ;;
5824 esac
5825 ;;
5826 esac
5827 ;;
5828esac
5829
1911a026
JH
5830case "$d_quad:$use64bitint" in
5831$undef:$define)
5832 cat >&4 <<EOF
5833
5834*** You have chosen to use 64-bit integers,
19a100ff 5835*** but none can be found.
09b58c7b 5836*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
1911a026
JH
5837*** Cannot continue, aborting.
5838
5839EOF
5840 exit 1
5841 ;;
5842esac
5843
36adc09b
JH
5844: check for length of double
5845echo " "
5846case "$doublesize" in
5847'')
5848 echo "Checking to see how big your double precision numbers are..." >&4
5849 $cat >try.c <<EOCP
5850#include <stdio.h>
1911a026
JH
5851#$i_stdlib I_STDLIB
5852#ifdef I_STDLIB
5853#include <stdlib.h>
5854#endif
36adc09b
JH
5855int main()
5856{
5857 printf("%d\n", (int)sizeof(double));
1911a026 5858 exit(0);
36adc09b
JH
5859}
5860EOCP
5861 set try
5862 if eval $compile_ok; then
5863 doublesize=`$run ./try`
5864 echo "Your double is $doublesize bytes long."
5865 else
5866 dflt='8'
5867 echo "(I can't seem to compile the test program. Guessing...)"
5868 rp="What is the size of a double precision number (in bytes)?"
5869 . ./myread
5870 doublesize="$ans"
5871 fi
5872 ;;
5873esac
5874$rm -f try.c try
5875
5876: check for long doubles
5877echo " "
5878echo "Checking to see if you have long double..." >&4
5879echo 'int main() { long double x = 7.0; }' > try.c
5880set try
5881if eval $compile; then
5882 val="$define"
5883 echo "You have long double."
5884else
5885 val="$undef"
5886 echo "You do not have long double."
5887fi
5888$rm try.*
5889set d_longdbl
5890eval $setvar
5891
5892: check for length of long double
5893case "${d_longdbl}${longdblsize}" in
5894$define)
5895 echo " "
5896 echo "Checking to see how big your long doubles are..." >&4
5897 $cat >try.c <<'EOCP'
5898#include <stdio.h>
5899int main()
5900{
5901 printf("%d\n", sizeof(long double));
5902}
5903EOCP
5904 set try
5905 set try
5906 if eval $compile; then
5907 longdblsize=`$run ./try`
5908 echo "Your long doubles are $longdblsize bytes long."
5909 else
5910 dflt='8'
5911 echo " "
5912 echo "(I can't seem to compile the test program. Guessing...)" >&4
5913 rp="What is the size of a long double (in bytes)?"
5914 . ./myread
5915 longdblsize="$ans"
5916 fi
5917 if $test "X$doublesize" = "X$longdblsize"; then
7ad90562
AD
5918 echo "That isn't any different from an ordinary double."
5919 echo "I'll keep your setting anyway, but you may see some"
5920 echo "harmless compilation warnings."
36adc09b
JH
5921 fi
5922 ;;
5923esac
5924$rm -f try.* try
5925
89ce900e 5926: determine the architecture name
b4eb6b3d 5927echo " "
89ce900e
JH
5928if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5929 tarch=`arch`"-$osname"
5930elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5931 if uname -m > tmparch 2>&1 ; then
5932 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5933 -e 's/$/'"-$osname/" tmparch`
5934 else
5935 tarch="$osname"
5936 fi
5937 $rm -f tmparch
b4eb6b3d 5938else
89ce900e 5939 tarch="$osname"
b4eb6b3d 5940fi
89ce900e
JH
5941case "$myarchname" in
5942''|"$tarch") ;;
5943*)
5944 echo "(Your architecture name used to be $myarchname.)"
5945 archname=''
5946 ;;
5947esac
5948case "$targetarch" in
5949'') ;;
5950*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5951esac
5952myarchname="$tarch"
5953case "$archname" in
5954'') dflt="$tarch";;
5955*) dflt="$archname";;
5956esac
5957rp='What is your architecture name'
5958. ./myread
5959archname="$ans"
5960case "$usethreads" in
5961$define)
5962 echo "Threads selected." >&4
5963 case "$archname" in
5964 *-thread*) echo "...and architecture name already has -thread." >&4
5965 ;;
5966 *) archname="$archname-thread"
5967 echo "...setting architecture name to $archname." >&4
5968 ;;
5969 esac
5970 ;;
5971esac
5972case "$usemultiplicity" in
5973$define)
5974 echo "Multiplicity selected." >&4
5975 case "$archname" in
5976 *-multi*) echo "...and architecture name already has -multi." >&4
5977 ;;
5978 *) archname="$archname-multi"
5979 echo "...setting architecture name to $archname." >&4
5980 ;;
5981 esac
5982 ;;
5983esac
5984case "$use64bitint$use64bitall" in
5985*"$define"*)
5986 case "$archname64" in
5987 '')
5988 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
bd9b35c9 5989 ;;
89ce900e
JH
5990 *)
5991 case "$use64bitint" in
5992 "$define") echo "64 bit integers selected." >&4 ;;
5993 esac
5994 case "$use64bitall" in
5995 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5996 esac
5997 case "$archname" in
5998 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5999 ;;
6000 *) archname="$archname-$archname64"
6001 echo "...setting architecture name to $archname." >&4
6002 ;;
6003 esac
c1a7f87b
JH
6004 ;;
6005 esac
89ce900e
JH
6006esac
6007case "$uselongdouble" in
6008$define)
6009 echo "Long doubles selected." >&4
6010 case "$longdblsize" in
6011 $doublesize)
6012 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6013 ;;
6014 *)
6015 case "$archname" in
6016 *-ld*) echo "...and architecture name already has -ld." >&4
6017 ;;
6018 *) archname="$archname-ld"
6019 echo "...setting architecture name to $archname." >&4
6020 ;;
6021 esac
bd9b35c9
JH
6022 ;;
6023 esac
bd9b35c9 6024 ;;
89ce900e
JH
6025esac
6026case "$useperlio" in
6027$define)
6028 echo "Perlio selected." >&4
6029 ;;
bd9b35c9 6030*)
89ce900e
JH
6031 echo "Perlio not selected, using stdio." >&4
6032 case "$archname" in
6033 *-stdio*) echo "...and architecture name already has -stdio." >&4
6034 ;;
6035 *) archname="$archname-stdio"
6036 echo "...setting architecture name to $archname." >&4
6037 ;;
6038 esac
bd9b35c9
JH
6039 ;;
6040esac
d2e0c6f7
JH
6041if $test -f archname.cbu; then
6042 echo "Your platform has some specific hints for architecture name, using them..."
6043 . ./archname.cbu
6044fi
bd9b35c9 6045
b4eb6b3d
JH
6046: set the prefixit variable, to compute a suitable default value
6047prefixit='case "$3" in
6048""|none)
6049 case "$oldprefix" in
6050 "") eval "$1=\"\$$2\"";;
6051 *)
6052 case "$3" in
6053 "") eval "$1=";;
6054 none)
6055 eval "tp=\"\$$2\"";
6056 case "$tp" in
6057 ""|" ") eval "$1=\"\$$2\"";;
6058 *) eval "$1=";;
6059 esac;;
6060 esac;;
6061 esac;;
6062*)
6063 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6064 case "$tp" in
6065 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6066 /*-$oldprefix/*|\~*-$oldprefix/*)
6067 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6068 *) eval "$1=\"\$$2\"";;
6069 esac;;
6070esac'
6071
f3f1a2d8
MB
6072: determine installation style
6073: For now, try to deduce it from prefix unless it is already set.
6074: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6075case "$installstyle" in
6076'') case "$prefix" in
6077 *perl*) dflt='lib';;
6078 *) dflt='lib/perl5' ;;
6079 esac
6080 ;;
6081*) dflt="$installstyle" ;;
4d20abad 6082esac
f3f1a2d8
MB
6083: Probably not worth prompting for this since we prompt for all
6084: the directories individually, and the prompt would be too long and
6085: confusing anyway.
6086installstyle=$dflt
4d20abad 6087
eaf812ae
MB
6088: determine where public executables go
6089echo " "
6090set dflt bin bin
6091eval $prefixit
6092fn=d~
6093rp='Pathname where the public executables will reside?'
6094. ./getfile
6095if $test "X$ansexp" != "X$binexp"; then
6096 installbin=''
6097fi
6098prefixvar=bin
6099: XXX Bug? -- ignores Configure -Dinstallprefix setting.
d0e36aa9 6100: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
a2d23ec2 6101: this via initialinstalllocation
eaf812ae
MB
6102. ./setprefixvar
6103
6104case "$userelocatableinc" in
6105$define|true|[yY]*) dflt='y' ;;
6106*) dflt='n' ;;
6107esac
6108cat <<EOM
6109
6110Would you like to build Perl so that the installation is relocatable, so that
6111library paths in @INC are determined relative to the path of the perl binary?
6112This is not advised for system Perl installs, or if you need to run setid
6113scripts or scripts under taint mode.
6114
6115If this doesn't make any sense to you, just accept the default '$dflt'.
6116EOM
6117rp='Use relocatable @INC?'
6118. ./myread
6119case "$ans" in
6120y|Y) val="$define" ;;
6121*) val="$undef" ;;
6122esac
6123set userelocatableinc
6124eval $setvar
6125
ea7d701d 6126initialinstalllocation="$binexp"
eaf812ae
MB
6127: Default prefix is now "up one level from where the binaries are"
6128case "$userelocatableinc" in
6129$define|true|[yY]*)
eaf812ae
MB
6130 bin=".../"
6131 binexp=".../"
6132 prefix=".../.."
6133 prefixexp=".../.."
6134 installprefixexp=".../.."
6135 ;;
6136esac
6137
b4eb6b3d
JH
6138: determine where private library files go
6139: Usual default is /usr/local/lib/perl5/$version.
f3f1a2d8 6140: Also allow things like /opt/perl/lib/$version, since
b4eb6b3d
JH
6141: /opt/perl/lib/perl5... would be redundant.
6142: The default "style" setting is made in installstyle.U
6143case "$installstyle" in
6144*lib/perl5*) set dflt privlib lib/$package/$version ;;
6145*) set dflt privlib lib/$version ;;
6146esac
6147eval $prefixit
6148$cat <<EOM
6149
6150There are some auxiliary files for $package that need to be put into a
6151private library directory that is accessible by everyone.
6152
6153EOM
eaf812ae 6154fn=$binexp
b4eb6b3d
JH
6155fn=d~+
6156rp='Pathname where the private library files will reside?'
6157. ./getfile
79522dd2
NC
6158prefixvar=privlib
6159. ./setprefixvar
b4eb6b3d
JH
6160
6161: set the prefixup variable, to restore leading tilda escape
6162prefixup='case "$prefixexp" in
6163"$prefix") ;;
6164*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6165esac'
6166
6167: determine where public architecture dependent libraries go
6168set archlib archlib
6169eval $prefixit
6170: privlib default is /usr/local/lib/$package/$version
6171: archlib default is /usr/local/lib/$package/$version/$archname
6172: privlib may have an optional trailing /share.
6173tdflt=`echo $privlib | $sed 's,/share$,,'`
6174tdflt=$tdflt/$archname
6175case "$archlib" in
6176'') dflt=$tdflt
6177 ;;
6178*) dflt="$archlib"
6179 ;;
6180esac
6181$cat <<EOM
6182
6183$spackage contains architecture-dependent library files. If you are
6184sharing libraries in a heterogeneous environment, you might store
6185these files in a separate location. Otherwise, you can just include
6186them with the rest of the public library files.
6187
6188EOM
eaf812ae 6189fn=$binexp
b4eb6b3d
JH
6190fn=d+~
6191rp='Where do you want to put the public architecture-dependent libraries?'
6192. ./getfile
79522dd2
NC
6193prefixvar=archlib
6194. ./setprefixvar
b4eb6b3d
JH
6195if $test X"$archlib" = X"$privlib"; then
6196 d_archlib="$undef"
6197else
6198 d_archlib="$define"
6199fi
b4eb6b3d 6200
b4eb6b3d
JH
6201: see if setuid scripts can be secure
6202$cat <<EOM
6203
6204Some kernels have a bug that prevents setuid #! scripts from being
6205secure. Some sites have disabled setuid #! scripts because of this.
6206
6207First let's decide if your kernel supports secure setuid #! scripts.
6208(If setuid #! scripts would be secure but have been disabled anyway,
6209don't say that they are secure if asked.)
6210
6211EOM
6212
6213val="$undef"
6214if $test -d /dev/fd; then
6215 echo "#!$ls" >reflect
6216 chmod +x,u+s reflect
6217 ./reflect >flect 2>&1
6218 if $contains "/dev/fd" flect >/dev/null; then
6219 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6220 val="$define"
6221 else
6222 $cat <<EOM
6223If you are not sure if they are secure, I can check but I'll need a
6224username and password different from the one you are using right now.
6225If you don't have such a username or don't want me to test, simply
6226enter 'none'.
6227
6228EOM
6229 rp='Other username to test security of setuid scripts with?'
6230 dflt='none'
6231 . ./myread
6232 case "$ans" in
6233 n|none)
6234 case "$d_suidsafe" in
6235 '') echo "I'll assume setuid scripts are *not* secure." >&4
6236 dflt=n;;
6237 "$undef")
6238 echo "Well, the $hint value is *not* secure." >&4
6239 dflt=n;;
6240 *) echo "Well, the $hint value *is* secure." >&4
6241 dflt=y;;
6242 esac
c1a7f87b 6243 ;;
b4eb6b3d
JH
6244 *)
6245 $rm -f reflect flect
6246 echo "#!$ls" >reflect
6247 chmod +x,u+s reflect
6248 echo >flect
6249 chmod a+w flect
6250 echo '"su" will (probably) prompt you for '"$ans's password."
6251 su $ans -c './reflect >flect'
6252 if $contains "/dev/fd" flect >/dev/null; then
6253 echo "Okay, it looks like setuid scripts are secure." >&4
6254 dflt=y
6255 else
6256 echo "I don't think setuid scripts are secure." >&4
6257 dflt=n
6258 fi
6259 ;;
6260 esac
6261 rp='Does your kernel have *secure* setuid scripts?'
6262 . ./myread
6263 case "$ans" in
6264 [yY]*) val="$define";;
6265 *) val="$undef";;
6266 esac
6267 fi
6268else
6269 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6270 echo "(That's for file descriptors, not floppy disks.)"
6271 val="$undef"
6272fi
6273set d_suidsafe
6274eval $setvar
6275
6276$rm -f reflect flect
6277
6278: now see if they want to do setuid emulation
6279echo " "
6280val="$undef"
6281case "$d_suidsafe" in
6282"$define")
6283 val="$undef"
3c728e00 6284 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d 6285 ;;
f3f1a2d8
MB
6286*)
6287 $cat <<EOM
6288Some systems have disabled setuid scripts, especially systems where
6289setuid scripts cannot be secure. On systems where setuid scripts have
6290been disabled, the setuid/setgid bits on scripts are currently
6291useless. It is possible for $package to detect those bits and emulate
6292setuid/setgid in a secure fashion. This emulation will only work if
6293setuid scripts have been disabled in your kernel.
6294
6295EOM
6296 case "$d_dosuid" in
6297 "$define") dflt=y ;;
6298 *) dflt=n ;;
6299 esac
6300 rp="Do you want to do setuid/setgid emulation?"
6301 . ./myread
6302 case "$ans" in
6303 [yY]*) val="$define";;
6304 *) val="$undef";;
6305 esac
6306 ;;
6307esac
6308set d_dosuid
6309eval $setvar
6310
f3f1a2d8
MB
6311: Find perl5.005 or later.
6312echo "Looking for a previously installed perl5.005 or later... "
6313case "$perl5" in
6314'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6315 : Check if this perl is recent and can load a simple module
6316 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6317 perl5=$tdir/perl
6318 break;
6319 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6320 perl5=$tdir/perl5
6321 break;
6322 fi
6323 done
6324 ;;
6325*) perl5="$perl5"
6326 ;;
6327esac
6328case "$perl5" in
6329'') echo "None found. That's ok.";;
6330*) echo "Using $perl5." ;;
6331esac
6332
6333$cat <<EOM
6334
6335After $package is installed, you may wish to install various
6336add-on modules and utilities. Typically, these add-ons will
6337be installed under $prefix with the rest
6338of this package. However, you may wish to install such add-ons
6339elsewhere under a different prefix.
6340
6341If you do not wish to put everything under a single prefix, that's
6342ok. You will be prompted for the individual locations; this siteprefix
6343is only used to suggest the defaults.
6344
6345The default should be fine for most people.
6346
6347EOM
6348fn=d~+
6349rp='Installation prefix to use for add-on modules and utilities?'
6350: XXX Here might be another good place for an installstyle setting.
6351case "$siteprefix" in
6352'') dflt=$prefix ;;
6353*) dflt=$siteprefix ;;
6354esac
6355. ./getfile
6356: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6357oldsiteprefix=''
6358case "$siteprefix" in
6359'') ;;
6360*) case "$ans" in
6361 "$prefix") ;;
6362 *) oldsiteprefix="$prefix";;
6363 esac
6364 ;;
6365esac
6366siteprefix="$ans"
6367siteprefixexp="$ansexp"
6368
6369: determine where site specific libraries go.
6370: Usual default is /usr/local/lib/perl5/site_perl/$version
6371: The default "style" setting is made in installstyle.U
6372: XXX No longer works with Prefixit stuff.
6373prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6374case "$sitelib" in
6375'') case "$installstyle" in
6376 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6377 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6378 esac
6379 ;;
6380*) dflt="$sitelib"
6381 ;;
6382esac
6383$cat <<EOM
6384
6385The installation process will create a directory for
6386site-specific extensions and modules. Most users find it convenient
6387to place all site-specific files in this directory rather than in the
6388main distribution directory.
6389
6390EOM
6391fn=d~+
6392rp='Pathname for the site-specific library files?'
6393. ./getfile
6394prefixvar=sitelib
6395. ./setprefixvar
6396sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6397
6398: Determine list of previous versions to include in @INC
6399$cat > getverlist <<EOPL
6400#!$perl5 -w
6401use File::Basename;
6402\$api_versionstring = "$api_versionstring";
6403\$version = "$version";
6404\$stem = "$sitelib_stem";
6405\$archname = "$archname";
6406EOPL
6407 $cat >> getverlist <<'EOPL'
13cfc98d
MB
6408# The list found is store twice for each entry: the original name, and
6409# the binary broken down version as pack "sss", so sorting is easy and
6410# unambiguous. This will work for all versions that have a maximum of
6411# three digit groups, separate by '.'s or '_'s. Names are extended with
6412# ".0.0" to ensure at least three elements for the pack.
6413# -- H.Merijn Brand (m)'06 23-10-2006
6414
f3f1a2d8
MB
6415# Can't have leading @ because metaconfig interprets it as a command!
6416;@inc_version_list=();
6417# XXX Redo to do opendir/readdir?
6418if (-d $stem) {
6419 chdir($stem);
13cfc98d
MB
6420 ;@candidates = map {
6421 [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
f3f1a2d8
MB
6422}
6423else {
6424 ;@candidates = ();
6425}
6426
13cfc98d
MB
6427($pversion, $aversion, $vsn5005) = map {
6428 pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
f3f1a2d8 6429foreach $d (@candidates) {
13cfc98d
MB
6430 if ($d->[1] lt $pversion) {
6431 if ($d->[1] ge $aversion) {
6432 unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
f3f1a2d8 6433 }
13cfc98d
MB
6434 elsif ($d->[1] ge $vsn5005) {
6435 unshift(@inc_version_list, grep { -d } $d->[0]);
f3f1a2d8
MB
6436 }
6437 }
6438 else {
6439 # Skip newer version. I.e. don't look in
6440 # 5.7.0 if we're installing 5.6.1.
6441 }
6442}
6443
6444if (@inc_version_list) {
6445 print join(' ', @inc_version_list);
6446}
6447else {
6448 # Blank space to preserve value for next Configure run.
6449 print " ";
6450}
6451EOPL
6452chmod +x getverlist
6453case "$inc_version_list" in
6454'') if test -x "$perl5$exe_ext"; then
6455 dflt=`$perl5 getverlist`
6456 else
6457 dflt='none'
6458 fi
6459 ;;
6460$undef) dflt='none' ;;
6461*) eval dflt=\"$inc_version_list\" ;;
6462esac
6463case "$dflt" in
6464''|' ') dflt=none ;;
6465esac
6466case "$dflt" in
64675.005) dflt=none ;;
6468esac
6469$cat <<EOM
6470
6471In order to ease the process of upgrading, this version of perl
6472can be configured to use modules built and installed with earlier
6473versions of perl that were installed under $prefix. Specify here
6474the list of earlier versions that this version of perl should check.
6475If Configure detected no earlier versions of perl installed under
6476$prefix, then the list will be empty. Answer 'none' to tell perl
6477to not search earlier versions.
b4eb6b3d 6478
f3f1a2d8
MB
6479The default should almost always be sensible, so if you're not sure,
6480just accept the default.
b4eb6b3d 6481EOM
f3f1a2d8
MB
6482
6483rp='List of earlier versions to include in @INC?'
6484. ./myread
6485case "$ans" in
6486[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6487*) inc_version_list="$ans" ;;
6488esac
6489case "$inc_version_list" in
6490''|' ')
6491 inc_version_list_init='0'
6492 d_inc_version_list="$undef"
6493 ;;
6494*) inc_version_list_init=`echo $inc_version_list |
6495 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6496 d_inc_version_list="$define"
b4eb6b3d
JH
6497 ;;
6498esac
f3f1a2d8 6499$rm -f getverlist
b4eb6b3d 6500
b4eb6b3d 6501: see if this is a malloc.h system
01d07975
YST
6502: we want a real compile instead of Inhdr because some systems have a
6503: malloc.h that just gives a compile error saying to use stdlib.h instead
6504echo " "
6505$cat >try.c <<EOCP
6506#include <stdlib.h>
6507#include <malloc.h>
6508int main () { return 0; }
6509EOCP
6510set try
6511if eval $compile; then
6512 echo "<malloc.h> found." >&4
6513 val="$define"
6514else
6515 echo "<malloc.h> NOT found." >&4
6516 val="$undef"
6517fi
6518$rm -f try.c try
6519set i_malloc
6520eval $setvar
b4eb6b3d 6521
c8b93cf9
JH
6522: check for void type
6523echo " "
6524echo "Checking to see how well your C compiler groks the void type..." >&4
6525case "$voidflags" in
6526'')
c727eafa 6527 $cat >try.c <<EOCP
d1daaddf
JH
6528#$i_stdlib I_STDLIB
6529#ifdef I_STDLIB
6530#include <stdlib.h>
6531#endif
c8b93cf9
JH
6532#if TRY & 1
6533void sub() {
6534#else
6535sub() {
6536#endif
6537 extern void moo(); /* function returning void */
6538 void (*goo)(); /* ptr to func returning void */
6539#if TRY & 8
6540 void *hue; /* generic ptr */
6541#endif
6542#if TRY & 2
6543 void (*foo[10])();
6544#endif
6545
6546#if TRY & 4
6547 if(goo == moo) {
6548 exit(0);
6549 }
6550#endif
6551 exit(0);
6552}
6553int main() { sub(); }
6554EOCP
6555 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6556 voidflags=$defvoidused
6557 echo "Good. It appears to support void to the level $package wants.">&4
6558 if $contains warning .out >/dev/null 2>&1; then
6559 echo "However, you might get some warnings that look like this:"
6560 $cat .out
6561 fi
6562 else
6563echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6564 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6565 echo "It supports 1..."
6566 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6567 echo "It also supports 2..."
6568 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6569 voidflags=7
6570 echo "And it supports 4 but not 8 definitely."
6571 else
6572 echo "It doesn't support 4..."
6573 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6574 voidflags=11
6575 echo "But it supports 8."
6576 else
6577 voidflags=3
6578 echo "Neither does it support 8."
6579 fi
6580 fi
6581 else
6582 echo "It does not support 2..."
6583 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6584 voidflags=13
6585 echo "But it supports 4 and 8."
6586 else
6587 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6588 voidflags=5
6589 echo "And it supports 4 but has not heard about 8."
6590 else
6591 echo "However it supports 8 but not 4."
6592 fi
6593 fi
6594 fi
6595 else
6596 echo "There is no support at all for void."
6597 voidflags=0
6598 fi
6599 fi
6600esac
6601case "$voidflags" in
6602"$defvoidused") ;;
6603*) $cat >&4 <<'EOM'
6604 Support flag bits are:
6605 1: basic void declarations.
6606 2: arrays of pointers to functions returning void.
6607 4: operations between pointers to and addresses of void functions.
6608 8: generic void pointers.
6609EOM
6610 dflt="$voidflags";
6611 rp="Your void support flags add up to what?"
6612 . ./myread
6613 voidflags="$ans"
6614 ;;
6615esac
6616$rm -f try.* .out
6617
6618: check for length of pointer
6619echo " "
6620case "$ptrsize" in
6621'')
6622 echo "Checking to see how big your pointers are..." >&4
6623 if test "$voidflags" -gt 7; then
6624 echo '#define VOID_PTR char *' > try.c
6625 else
6626 echo '#define VOID_PTR void *' > try.c
6627 fi
74d00865 6628 $cat >>try.c <<EOCP
c8b93cf9 6629#include <stdio.h>
d1daaddf
JH
6630#$i_stdlib I_STDLIB
6631#ifdef I_STDLIB
6632#include <stdlib.h>
6633#endif
c8b93cf9
JH
6634int main()
6635{
6636 printf("%d\n", (int)sizeof(VOID_PTR));
6637 exit(0);
6638}
6639EOCP
6640 set try
6641 if eval $compile_ok; then
6642 ptrsize=`$run ./try`
6643 echo "Your pointers are $ptrsize bytes long."
6644 else
6645 dflt='4'
6646 echo "(I can't seem to compile the test program. Guessing...)" >&4
6647 rp="What is the size of a pointer (in bytes)?"
6648 . ./myread
6649 ptrsize="$ans"
6650 fi
6651 ;;
6652esac
6653$rm -f try.c try
6654case "$use64bitall" in
6655"$define"|true|[yY]*)
6656 case "$ptrsize" in
6657 4) cat <<EOM >&4
6658
1911a026
JH
6659*** You have chosen a maximally 64-bit build,
6660*** but your pointers are only 4 bytes wide.
09b58c7b
JH
6661*** Please rerun Configure without -Duse64bitall.
6662EOM
6663 case "$d_quad" in
6664 define)
6665 cat <<EOM >&4
6666*** Since you have quads, you could possibly try with -Duse64bitint.
6667EOM
6668 ;;
6669 esac
6670 cat <<EOM >&4
1911a026 6671*** Cannot continue, aborting.
c8b93cf9
JH
6672
6673EOM
09b58c7b 6674
1911a026 6675 exit 1
c8b93cf9
JH
6676 ;;
6677 esac
6678 ;;
6679esac
6680
19a100ff 6681
9df442c2
NC
6682: determine whether to use malloc wrapping
6683echo " "
6684case "$usemallocwrap" in
6685[yY]*|true|$define) dflt='y' ;;
6686[nN]*|false|$undef) dflt='n' ;;
6687*) case "$usedevel" in
6688 [yY]*|true|$define) dflt='y' ;;
6689 *) dflt='n' ;;
6690 esac
6691 ;;
6692esac
6693rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6694. ./myread
6695usemallocwrap="$ans"
6696case "$ans" in
6697y*|true)
6698 usemallocwrap="$define" ;;
6699*)
6700 usemallocwrap="$undef" ;;
6701esac
c8b93cf9 6702
b4eb6b3d
JH
6703: determine which malloc to compile in
6704echo " "
6705case "$usemymalloc" in
c4163172
JH
6706[yY]*|true|$define) dflt='y' ;;
6707[nN]*|false|$undef) dflt='n' ;;
6708*) case "$ptrsize" in
6709 4) dflt='y' ;;
6710 *) dflt='n' ;;
6711 esac
6712 ;;
8dfa8df9 6713esac
b4eb6b3d
JH
6714rp="Do you wish to attempt to use the malloc that comes with $package?"
6715. ./myread
6716usemymalloc="$ans"
6717case "$ans" in
6718y*|true)
6719 usemymalloc='y'
6720 mallocsrc='malloc.c'
6721 mallocobj="malloc$_o"
6722 d_mymalloc="$define"
6723 case "$libs" in
6724 *-lmalloc*)
6725 : Remove malloc from list of libraries to use
6726 echo "Removing unneeded -lmalloc from library list" >&4
6727 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6728 shift
6729 libs="$*"
6730 echo "libs = $libs" >&4
6731 ;;
6732 esac
6733 ;;
6734*)
6735 usemymalloc='n'
6736 mallocsrc=''
6737 mallocobj=''
6738 d_mymalloc="$undef"
6739 ;;
6740esac
6741
6742: compute the return types of malloc and free
6743echo " "
6744$cat >malloc.c <<END
6745#$i_malloc I_MALLOC
6746#$i_stdlib I_STDLIB
6747#include <stdio.h>
6748#include <sys/types.h>
6749#ifdef I_MALLOC
6750#include <malloc.h>
6751#endif
6752#ifdef I_STDLIB
6753#include <stdlib.h>
6754#endif
6755#ifdef TRY_MALLOC
6756void *malloc();
6757#endif
6758#ifdef TRY_FREE
6759void free();
6760#endif
6761END
6762case "$malloctype" in
6763'')
6764 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6765 malloctype='void *'
6766 else
6767 malloctype='char *'
6768 fi
6769 ;;
6770esac
6771echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6772
6773case "$freetype" in
6774'')
6775 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6776 freetype='void'
6777 else
6778 freetype='int'
6779 fi
6780 ;;
6781esac
6782echo "Your system uses $freetype free(), it would seem." >&4
6783$rm -f malloc.[co]
b4eb6b3d
JH
6784: determine where site specific architecture-dependent libraries go.
6785: sitelib default is /usr/local/lib/perl5/site_perl/$version
6786: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6787: sitelib may have an optional trailing /share.
6788case "$sitearch" in
6789'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6790 dflt="$dflt/$archname"
6791 ;;
6792*) dflt="$sitearch"
6793 ;;
6794esac
6795set sitearch sitearch none
6796eval $prefixit
6797$cat <<EOM
6798
6799The installation process will also create a directory for
6800architecture-dependent site-specific extensions and modules.
6801
6802EOM
6803fn=d~+
6804rp='Pathname for the site-specific architecture-dependent library files?'
6805. ./getfile
79522dd2
NC
6806prefixvar=sitearch
6807. ./setprefixvar
c95d0e17
GA
6808if $test X"$sitearch" = X"$sitelib"; then
6809 d_sitearch="$undef"
6810else
6811 d_sitearch="$define"
6812fi
b4eb6b3d
JH
6813
6814$cat <<EOM
6815
6816The installation process will also create a directory for
6817vendor-supplied add-ons. Vendors who supply perl with their system
6818may find it convenient to place all vendor-supplied files in this
6819directory rather than in the main distribution directory. This will
6820ease upgrades between binary-compatible maintenance versions of perl.
6821
6822Of course you may also use these directories in whatever way you see
6823fit. For example, you might use them to access modules shared over a
6824company-wide network.
6825
6826The default answer should be fine for most people.
6827This causes further questions about vendor add-ons to be skipped
6828and no vendor-specific directories will be configured for perl.
6829
6830EOM
6831rp='Do you want to configure vendor-specific add-on directories?'
6832case "$usevendorprefix" in
6833define|true|[yY]*) dflt=y ;;
6834*) : User may have set vendorprefix directly on Configure command line.
6835 case "$vendorprefix" in
6836 ''|' ') dflt=n ;;
6837 *) dflt=y ;;
6838 esac
6839 ;;
6840esac
6841. ./myread
6842case "$ans" in
6843[yY]*) fn=d~+
6844 rp='Installation prefix to use for vendor-supplied add-ons?'
6845 case "$vendorprefix" in
6846 '') dflt='' ;;
6847 *) dflt=$vendorprefix ;;
6848 esac
6849 . ./getfile
6850 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6851 oldvendorprefix=''
6852 case "$vendorprefix" in
6853 '') ;;
6854 *) case "$ans" in
6855 "$prefix") ;;
6856 *) oldvendorprefix="$prefix";;
6857 esac
6858 ;;
6859 esac
6860 usevendorprefix="$define"
6861 vendorprefix="$ans"
6862 vendorprefixexp="$ansexp"
6863 ;;
6864*) usevendorprefix="$undef"
6865 vendorprefix=''
6866 vendorprefixexp=''
6867 ;;
6868esac
6869
6870case "$vendorprefix" in
6871'') d_vendorlib="$undef"
6872 vendorlib=''
6873 vendorlibexp=''
6874 ;;
6875*) d_vendorlib="$define"
6876 : determine where vendor-supplied modules go.
6877 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6878 case "$vendorlib" in
6879 '')
6880 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6881 case "$installstyle" in
6882 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6883 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6884 esac
6885 ;;
6886 *) dflt="$vendorlib"
6887 ;;
6888 esac
6889 fn=d~+
6890 rp='Pathname for the vendor-supplied library files?'
6891 . ./getfile
6892 vendorlib="$ans"
6893 vendorlibexp="$ansexp"
6894 ;;
6895esac
6896vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
a092d240
NC
6897prefixvar=vendorlib
6898. ./installprefix
b4eb6b3d
JH
6899
6900case "$vendorprefix" in
6901'') d_vendorarch="$undef"
6902 vendorarch=''
6903 vendorarchexp=''
6904 ;;
6905*) d_vendorarch="$define"
6906 : determine where vendor-supplied architecture-dependent libraries go.
6907 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6908 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6909 : vendorlib may have an optional trailing /share.
6910 case "$vendorarch" in
6911 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6912 dflt="$dflt/$archname"
6913 ;;
6914 *) dflt="$vendorarch" ;;
6915 esac
6916 fn=d~+
6917 rp='Pathname for vendor-supplied architecture-dependent files?'
6918 . ./getfile
6919 vendorarch="$ans"
6920 vendorarchexp="$ansexp"
6921 ;;
6922esac
a092d240
NC
6923prefixvar=vendorarch
6924. ./installprefix
b4eb6b3d
JH
6925
6926: Final catch-all directories to search
6927$cat <<EOM
6928
6929Lastly, you can have perl look in other directories for extensions and
6930modules in addition to those already specified.
6931These directories will be searched after
6932 $sitearch
6933 $sitelib
6934EOM
6935test X"$vendorlib" != "X" && echo ' ' $vendorlib
6936test X"$vendorarch" != "X" && echo ' ' $vendorarch
6937echo ' '
6938case "$otherlibdirs" in
6939''|' ') dflt='none' ;;
6940*) dflt="$otherlibdirs" ;;
6941esac
6942$cat <<EOM
6943Enter a colon-separated set of extra paths to include in perl's @INC
6944search path, or enter 'none' for no extra paths.
6945
6946EOM
6947
6948rp='Colon-separated list of additional directories for perl to search?'
6949. ./myread
6950case "$ans" in
6951' '|''|none) otherlibdirs=' ' ;;
6952*) otherlibdirs="$ans" ;;
6953esac
6954case "$otherlibdirs" in
6955' ') val=$undef ;;
6956*) val=$define ;;
6957esac
6958set d_perl_otherlibdirs
6959eval $setvar
6960
6961: Cruising for prototypes
6962echo " "
6963echo "Checking out function prototypes..." >&4
55954f19
JH
6964$cat >prototype.c <<EOCP
6965#$i_stdlib I_STDLIB
6966#ifdef I_STDLIB
6967#include <stdlib.h>
6968#endif
b4eb6b3d
JH
6969int main(int argc, char *argv[]) {
6970 exit(0);}
6971EOCP
6972if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6973 echo "Your C compiler appears to support function prototypes."
6974 val="$define"
6975else
6976 echo "Your C compiler doesn't seem to understand function prototypes."
6977 val="$undef"
6978fi
6979set prototype
6980eval $setvar
6981$rm -f prototype*
6982
6983case "$prototype" in
6984"$define") ;;
6985*) ansi2knr='ansi2knr'
6986 echo " "
6987 cat <<EOM >&4
6988
6989$me: FATAL ERROR:
6990This version of $package can only be compiled by a compiler that
6991understands function prototypes. Unfortunately, your C compiler
6992 $cc $ccflags
6993doesn't seem to understand them. Sorry about that.
6994
6995If GNU cc is available for your system, perhaps you could try that instead.
6996
6997Eventually, we hope to support building Perl with pre-ANSI compilers.
6998If you would like to help in that effort, please contact <perlbug@perl.org>.
6999
7000Aborting Configure now.
7001EOM
7002 exit 2
7003 ;;
7004esac
7005
6fcddf3b 7006echo " "
6fcddf3b 7007case "$extras" in
bf35c3f6
JH
7008'') dflt='n';;
7009*) dflt='y';;
6fcddf3b
JH
7010esac
7011cat <<EOM
7012Perl can be built with extra modules or bundles of modules which
7013will be fetched from the CPAN and installed alongside Perl.
7014
7015Notice that you will need access to the CPAN; either via the Internet,
7016or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
7017be asked later to configure the CPAN.pm module which will in turn do
7018the installation of the rest of the extra modules or bundles.)
7019
7020Notice also that if the modules require any external software such as
dd2de242
JH
7021libraries and headers (the libz library and the zlib.h header for the
7022Compress::Zlib module, for example) you MUST have any such software
7023already installed, this configuration process will NOT install such
7024things for you.
6fcddf3b
JH
7025
7026If this doesn't make any sense to you, just accept the default '$dflt'.
7027EOM
dd2de242 7028rp='Install any extra modules (y or n)?'
6fcddf3b
JH
7029. ./myread
7030case "$ans" in
7031y|Y)
7032 cat <<EOM
7033
7034Please list any extra modules or bundles to be installed from CPAN,
7035with spaces between the names. The names can be in any format the
dd2de242
JH
7036'install' command of CPAN.pm will understand. (Answer 'none',
7037without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
7038EOM
7039 rp='Extras?'
7040 dflt="$extras"
7041 . ./myread
7042 extras="$ans"
7043esac
7044case "$extras" in
7045''|'none')
7046 val=''
7047 $rm -f ../extras.lst
7048 ;;
7049*) echo "(Saving the list of extras for later...)"
dd2de242
JH
7050 echo "$extras" > ../extras.lst
7051 val="'$extras'"
6fcddf3b
JH
7052 ;;
7053esac
7054set extras
7055eval $setvar
7056echo " "
7057
6e1038e0
MB
7058: determine where html pages for programs go
7059set html1dir html1dir none
7060eval $prefixit
7061$cat <<EOM
7062
f3f1a2d8 7063If you wish to install html files for programs in $spackage, indicate
6e1038e0
MB
7064the appropriate directory here. To skip installing html files,
7065answer "none".
7066EOM
7067case "$html1dir" in
7068''|none|$undef|' ') dflt=none ;;
7069*) dflt=$html1dir ;;
7070esac
7071fn=dn+~
7072rp="Directory for the main $spackage html pages?"
7073. ./getfile
79522dd2
NC
7074prefixvar=html1dir
7075. ./setprefixvar
6e1038e0
MB
7076: Use ' ' for none so value is preserved next time through Configure
7077$test X"$html1dir" = "X" && html1dir=' '
6e1038e0
MB
7078
7079: determine where html pages for libraries and modules go
7080set html3dir html3dir none
7081eval $prefixit
7082$cat <<EOM
7083
7084If you wish to install html files for modules associated with $spackage,
7085indicate the appropriate directory here. To skip installing html files,
7086answer "none".
7087EOM
7088: There is no obvious default. If they have specified html1dir, then
7089: try to key off that, possibly changing .../html1 into .../html3.
7090case "$html3dir" in
7091'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7092*) dflt=$html3dir ;;
7093esac
7094fn=dn+~
7095rp="Directory for the $spackage module html pages?"
7096. ./getfile
79522dd2
NC
7097prefixvar=html3dir
7098. ./setprefixvar
6e1038e0
MB
7099: Use ' ' for none so value is preserved next time through Configure
7100$test X"$html3dir" = "X" && html3dir=' '
6e1038e0 7101
89ce900e
JH
7102: determine whether to install perl also as /usr/bin/perl
7103
7104echo " "
7105if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7106 $cat <<EOM
7107Many scripts expect perl to be installed as /usr/bin/perl.
7108
7109If you want to, I can install the perl you are about to compile
7110as /usr/bin/perl (in addition to $bin/perl).
7111EOM
7112 if test -f /usr/bin/perl; then
7113 $cat <<EOM
7114
7115However, please note that because you already have a /usr/bin/perl,
7116overwriting that with a new Perl would very probably cause problems.
7117Therefore I'm assuming you don't want to do that (unless you insist).
7118
7119EOM
7120 case "$installusrbinperl" in
7121 "$define"|[yY]*) dflt='y';;
7122 *) dflt='n';;
7123 esac
7124 else
7125 $cat <<EOM
7126
7127Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7128
7129EOM
7130 case "$installusrbinperl" in
7131 "$undef"|[nN]*) dflt='n';;
7132 *) dflt='y';;
7133 esac
7134 fi
7135 rp="Do you want to install perl as /usr/bin/perl?"
7136 . ./myread
7137 case "$ans" in
7138 [yY]*) val="$define";;
7139 *) val="$undef" ;;
7140 esac
7141else
7142 val="$undef"
7143fi
7144set installusrbinperl
7145eval $setvar
7146
7147echo " "
7148echo "Checking for GNU C Library..." >&4
7149cat >try.c <<'EOCP'
7150/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7151 alone are insufficient to distinguish different versions, such as
7152 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7153 libc version 2.1.0. A. Dougherty, June 3, 2002.
7154*/
7155#include <stdio.h>
7156int main(void)
7157{
7158#ifdef __GLIBC__
7159# ifdef __GLIBC_MINOR__
4fb7dc7d 7160# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
89ce900e
JH
7161# include <gnu/libc-version.h>
7162 printf("%s\n", gnu_get_libc_version());
7163# else
7164 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7165# endif
7166# else
7167 printf("%d\n", __GLIBC__);
7168# endif
7169 return 0;
7170#else
7171 return 1;
7172#endif
7173}
7174EOCP
7175set try
7176if eval $compile_ok && $run ./try > glibc.ver; then
7177 val="$define"
7178 gnulibc_version=`$cat glibc.ver`
7179 echo "You are using the GNU C Library version $gnulibc_version"
7180else
7181 val="$undef"
7182 gnulibc_version=''
7183 echo "You are not using the GNU C Library"
7184fi
7185$rm -f try try.* glibc.ver
7186set d_gnulibc
7187eval $setvar
7188
7189: see if nm is to be used to determine whether a symbol is defined or not
7190case "$usenm" in
7191'')
7192 dflt=''
7193 case "$d_gnulibc" in
7194 "$define")
7195 echo " "
7196 echo "nm probably won't work on the GNU C Library." >&4
7197 dflt=n
7198 ;;
7199 esac
7200 case "$dflt" in
7201 '')
7202 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7203 echo " "
7204 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7205 echo "'nm' won't be sufficient on this sytem." >&4
7206 dflt=n
7207 fi
7208 ;;
7209 esac
7210 case "$dflt" in
7211 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7212 if $test $dflt -gt 20; then
7213 dflt=y
7214 else
7215 dflt=n
7216 fi
7217 ;;
7218 esac
b4eb6b3d 7219 ;;
89ce900e
JH
7220*)
7221 case "$usenm" in
7222 true|$define) dflt=y;;
7223 *) dflt=n;;
7224 esac
b4eb6b3d
JH
7225 ;;
7226esac
89ce900e 7227$cat <<EOM
b4eb6b3d 7228
89ce900e
JH
7229I can use $nm to extract the symbols from your C libraries. This
7230is a time consuming task which may generate huge output on the disk (up
7231to 3 megabytes) but that should make the symbols extraction faster. The
7232alternative is to skip the 'nm' extraction part and to compile a small
7233test program instead to determine whether each symbol is present. If
7234you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7235this may be the best solution.
b4eb6b3d 7236
89ce900e 7237You probably shouldn't let me use 'nm' if you are using the GNU C Library.
b4eb6b3d 7238
89ce900e
JH
7239EOM
7240rp="Shall I use $nm to extract C symbols from the libraries?"
7241. ./myread
7242case "$ans" in
7243[Nn]*) usenm=false;;
7244*) usenm=true;;
b4eb6b3d 7245esac
89ce900e
JH
7246
7247runnm=$usenm
7248case "$reuseval" in
7249true) runnm=false;;
b4eb6b3d 7250esac
b4eb6b3d 7251
89ce900e
JH
7252: nm options which may be necessary
7253case "$nm_opt" in
7254'') if $test -f /mach_boot; then
7255 nm_opt='' # Mach
7256 elif $test -d /usr/ccs/lib; then
7257 nm_opt='-p' # Solaris (and SunOS?)
7258 elif $test -f /dgux; then
7259 nm_opt='-p' # DG-UX
7260 elif $test -f /lib64/rld; then
7261 nm_opt='-p' # 64-bit Irix
7262 else
7263 nm_opt=''
7264 fi;;
7265esac
b4eb6b3d 7266
89ce900e
JH
7267: nm options which may be necessary for shared libraries but illegal
7268: for archive libraries. Thank you, Linux.
7269case "$nm_so_opt" in
7270'') case "$myuname" in
fb2e1bc0 7271 *linux*|gnu*)
89ce900e
JH
7272 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7273 nm_so_opt='--dynamic'
7274 fi
7275 ;;
7276 esac
7277 ;;
7278esac
b4eb6b3d 7279
89ce900e
JH
7280case "$runnm" in
7281true)
7282: get list of predefined functions in a handy place
7283echo " "
7284case "$libc" in
7285'') libc=unknown
7286 case "$libs" in
7287 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7288 esac
7289 ;;
b4eb6b3d 7290esac
89ce900e
JH
7291case "$libs" in
7292'') ;;
7293*) for thislib in $libs; do
7294 case "$thislib" in
7295 -lc|-lc_s)
7296 : Handle C library specially below.
7297 ;;
7298 -l*)
7299 thislib=`echo $thislib | $sed -e 's/^-l//'`
7300 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7301 :
7302 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7303 :
7304 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7305 :
7306 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7307 :
7308 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7309 :
7310 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7311 :
7312 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7313 :
7314 else
7315 try=''
7316 fi
7317 libnames="$libnames $try"
7318 ;;
7319 *) libnames="$libnames $thislib" ;;
7320 esac
7321 done
b4eb6b3d
JH
7322 ;;
7323esac
89ce900e
JH
7324xxx=normal
7325case "$libc" in
7326unknown)
7327 set /lib/libc.$so
7328 for xxx in $libpth; do
7329 $test -r $1 || set $xxx/libc.$so
7330 : The messy sed command sorts on library version numbers.
7331 $test -r $1 || \
7332 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7333 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7334 h
7335 s/[0-9][0-9]*/0000&/g
7336 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7337 G
7338 s/\n/ /' | \
7339 $sort | $sed -e 's/^.* //'`
7340 eval set \$$#
7341 done
7342 $test -r $1 || set /usr/ccs/lib/libc.$so
7343 $test -r $1 || set /lib/libsys_s$_a
7344 ;;
7345*)
7346 set blurfl
7347 ;;
7348esac
7349if $test -r "$1"; then
7350 echo "Your (shared) C library seems to be in $1."
7351 libc="$1"
7352elif $test -r /lib/libc && $test -r /lib/clib; then
7353 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7354 xxx=apollo
7355 libc='/lib/clib /lib/libc'
7356 if $test -r /lib/syslib; then
7357 echo "(Your math library is in /lib/syslib.)"
7358 libc="$libc /lib/syslib"
7359 fi
7360elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7361 echo "Your C library seems to be in $libc, as you said before."
7362elif $test -r $incpath/usr/lib/libc$_a; then
7363 libc=$incpath/usr/lib/libc$_a;
7364 echo "Your C library seems to be in $libc. That's fine."
7365elif $test -r /lib/libc$_a; then
7366 libc=/lib/libc$_a;
7367 echo "Your C library seems to be in $libc. You're normal."
7368else
7369 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7370 :
7371 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7372 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7373 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7374 :
7375 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7376 :
7377 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7378 :
7379 else
7380 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7381 fi
7382 if $test -r "$tans"; then
7383 echo "Your C library seems to be in $tans, of all places."
7384 libc=$tans
7385 else
7386 libc='blurfl'
7387 fi
7388fi
7389if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7390 dflt="$libc"
7391 cat <<EOM
b4eb6b3d 7392
89ce900e
JH
7393If the guess above is wrong (which it might be if you're using a strange
7394compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7395
89ce900e
JH
7396EOM
7397else
7398 dflt=''
7399 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7400 cat >&4 <<EOM
7401I can't seem to find your C library. I've looked in the following places:
5e366f65 7402
b4eb6b3d 7403EOM
89ce900e
JH
7404 $sed 's/^/ /' libpath
7405 cat <<EOM
5e366f65 7406
89ce900e 7407None of these seems to contain your C library. I need to get its name...
5e366f65
JH
7408
7409EOM
89ce900e
JH
7410fi
7411fn=f
7412rp='Where is your C library?'
7413. ./getfile
7414libc="$ans"
5e366f65 7415
89ce900e
JH
7416echo " "
7417echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7418set X `cat libnames`
7419shift
7420xxx=files
7421case $# in 1) xxx=file; esac
7422echo "Extracting names from the following $xxx for later perusal:" >&4
7423echo " "
7424$sed 's/^/ /' libnames >&4
7425echo " "
7426$echo $n "This may take a while...$c" >&4
5e366f65 7427
89ce900e
JH
7428for file in $*; do
7429 case $file in
7430 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7431 *) $nm $nm_opt $file 2>/dev/null;;
b4eb6b3d 7432 esac
89ce900e
JH
7433done >libc.tmp
7434
7435$echo $n ".$c"
7436$grep fprintf libc.tmp > libc.ptf
7437xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7438xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7439xxx='[ADTSIW]'
ab900c53 7440if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
89ce900e
JH
7441 eval $xscan;\
7442 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7443 eval $xrun
7444elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7445 eval $xscan;\
7446 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7447 eval $xrun
7448elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7449 eval $xscan;\
7450 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7451 eval $xrun
7452elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7453 eval $xscan;\
7454 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7455 eval $xrun
7456elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7457 eval $xscan;\
7458 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7459 eval $xrun
7460elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7461 eval $xscan;\
7462 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7463 eval $xrun
7464elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7465 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7466 eval $xscan;\
7467 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7468 eval $xrun
7469elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7470 eval $xscan;\
7471 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7472 eval $xrun
7473elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7474 eval $xscan;\
7475 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7476 eval $xrun
7477elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7478 eval $xscan;\
7479 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7480 eval $xrun
7481elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7482 eval $xscan;\
7483 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7484 eval $xrun
7485elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7486 eval $xscan;\
7487 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7488 eval $xrun
7489elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7490 eval $xscan;\
7491 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7492 eval $xrun
7493elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7494 eval $xscan;\
7495 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7496 eval $xrun
b4eb6b3d 7497else
89ce900e
JH
7498 $nm -p $* 2>/dev/null >libc.tmp
7499 $grep fprintf libc.tmp > libc.ptf
7500 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7501 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7502 then
7503 nm_opt='-p'
7504 eval $xrun
7505 else
7506 echo " "
7507 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7508 com=''
7509 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7510 for thisname in $libnames $libc; do
7511 $ar t $thisname >>libc.tmp
7512 done
7513 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7514 echo "Ok." >&4
7515 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7516 # Repeat libc to extract forwarders to DLL entries too
7517 for thisname in $libnames $libc; do
7518 $ar tv $thisname >>libc.tmp
7519 # Revision 50 of EMX has bug in $ar.
7520 # it will not extract forwarders to DLL entries
7521 # Use emximp which will extract exactly them.
7522 emximp -o tmp.imp $thisname \
7523 2>/dev/null && \
7524 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7525 < tmp.imp >>libc.tmp
7526 $rm tmp.imp
7527 done
7528 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7529 echo "Ok." >&4
7530 else
7531 echo "$ar didn't seem to work right." >&4
7532 echo "Maybe this is a Cray...trying bld instead..." >&4
7533 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7534 then
7535 for thisname in $libnames; do
7536 bld t $libnames | \
7537 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7538 $ar t $thisname >>libc.tmp
7539 done
7540 echo "Ok." >&4
7541 else
7542 echo "That didn't work either. Giving up." >&4
7543 exit 1
7544 fi
7545 fi
7546 fi
b4eb6b3d 7547fi
89ce900e
JH
7548nm_extract="$com"
7549case "$PASE" in
7550define)
7551 echo " "
7552 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7553 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7554 ;;
7555*) if $test -f /lib/syscalls.exp; then
7556 echo " "
7557 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7558 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' /lib/syscalls.exp >>libc.list
7559 fi
7560 ;;
7561esac
7562;;
7563esac
7564$rm -f libnames libpath
b4eb6b3d
JH
7565
7566: see if dld is available
7567set dld.h i_dld
7568eval $inhdr
7569
89ce900e
JH
7570: is a C symbol defined?
7571csym='tlook=$1;
7572case "$3" in
373dfab3
JH
7573-v) tf=libc.tmp; tdc="";;
7574-a) tf=libc.tmp; tdc="[]";;
7575*) tlook="^$1\$"; tf=libc.list; tdc="()";;
89ce900e
JH
7576esac;
7577tx=yes;
7578case "$reuseval-$4" in
7579true-) ;;
7580true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7581esac;
7582case "$tx" in
7583yes)
ab900c53 7584 tval=false;
5129fff4
JH
7585 if $test "$runnm" = true; then
7586 if $contains $tlook $tf >/dev/null 2>&1; then
ab900c53 7587 tval=true;
5129fff4 7588 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
373dfab3 7589 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7590 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
373dfab3
JH
7591 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7592 $rm -f try$_exe try.c core core.* try.core;
89ce900e 7593 fi;
5129fff4 7594 else
373dfab3 7595 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7596 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
373dfab3 7597 $rm -f try$_exe try.c;
ab900c53
AB
7598 fi;
7599 ;;
89ce900e
JH
7600*)
7601 case "$tval" in
7602 $define) tval=true;;
7603 *) tval=false;;
ab900c53
AB
7604 esac;
7605 ;;
89ce900e
JH
7606esac;
7607eval "$2=$tval"'
7608
7609: define an is-in-libc? function
7610inlibc='echo " "; td=$define; tu=$undef;
7611sym=$1; var=$2; eval "was=\$$2";
7612tx=yes;
7613case "$reuseval$was" in
7614true) ;;
7615true*) tx=no;;
7616esac;
7617case "$tx" in
7618yes)
7619 set $sym tres -f;
7620 eval $csym;
7621 case "$tres" in
7622 true)
7623 echo "$sym() found." >&4;
7624 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7625 *)
7626 echo "$sym() NOT found." >&4;
7627 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7628 esac;;
7629*)
7630 case "$was" in
7631 $define) echo "$sym() found." >&4;;
7632 *) echo "$sym() NOT found." >&4;;
7633 esac;;
7634esac'
7635
f244a502
JH
7636
7637echo " "
7638echo "Checking for C++..." >&4
7639cat >try.c <<'EOCP'
7640#include <stdio.h>
7641int main(void)
7642{
7643#ifdef __cplusplus
7644 printf("define\n");
7645#else
7646 printf("undef\n");
7647#endif
7648 return 0;
7649}
7650EOCP
7651set try
7652if eval $compile_ok && $run ./try >cplusplus$$; then
7653 val=`$cat cplusplus$$`
7654 echo "You are using a C++ compiler."
7655else
7656 val="$undef"
7657 echo "You are not using a C++ compiler."
7658fi
7659$rm -f try try.* cplusplus$$
7660set d_cplusplus
7661eval $setvar
7662
b4eb6b3d
JH
7663: see if dlopen exists
7664xxx_runnm="$runnm"
666ea192 7665xxx_ccflags="$ccflags"
b4eb6b3d 7666runnm=false
666ea192
JH
7667: with g++ one needs -shared to get is-in-libc to work for dlopen
7668case "$gccversion" in
7669'') ;;
7670*) case "$d_cplusplus" in
7671 "$define") ccflags="$ccflags -shared" ;;
7672 esac
7673 ;;
7674esac
b4eb6b3d
JH
7675set dlopen d_dlopen
7676eval $inlibc
7677runnm="$xxx_runnm"
666ea192 7678ccflags="$xxx_ccflags"
b4eb6b3d 7679
4fb7dc7d
JH
7680: see if this is a unistd.h system
7681set unistd.h i_unistd
7682eval $inhdr
7683
b4eb6b3d
JH
7684: determine which dynamic loading, if any, to compile in
7685echo " "
7686dldir="ext/DynaLoader"
7687case "$usedl" in
7688$define|y|true)
7689 dflt='y'
7690 usedl="$define"
7691 ;;
7692$undef|n|false)
7693 dflt='n'
7694 usedl="$undef"
7695 ;;
7696*)
7697 dflt='n'
7698 case "$d_dlopen" in
7699 $define) dflt='y' ;;
7700 esac
7701 case "$i_dld" in
7702 $define) dflt='y' ;;
7703 esac
7704 : Does a dl_xxx.xs file exist for this operating system
7705 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7706 ;;
7707esac
7708rp="Do you wish to use dynamic loading?"
7709. ./myread
7710usedl="$ans"
7711case "$ans" in
7712y*) usedl="$define"
7713 case "$dlsrc" in
7714 '')
7715 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7716 dflt="$dldir/dl_${osname}.xs"
7717 elif $test "$d_dlopen" = "$define" ; then
7718 dflt="$dldir/dl_dlopen.xs"
7719 elif $test "$i_dld" = "$define" ; then
7720 dflt="$dldir/dl_dld.xs"
7721 else
7722 dflt=''
7723 fi
7724 ;;
7725 *) dflt="$dldir/$dlsrc"
7726 ;;
7727 esac
7728 echo "The following dynamic loading files are available:"
7729 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7730 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7731 rp="Source file to use for dynamic loading"
7732 fn="fne"
7733 gfpth="$src"
7734 . ./getfile
7735 usedl="$define"
7736 : emulate basename
7737 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7738
7739 $cat << EOM
7740
7741Some systems may require passing special flags to $cc -c to
7742compile modules that will be used to create a shared library.
7743To use no flags, say "none".
7744
7745EOM
7746 case "$cccdlflags" in
7747 '') case "$gccversion" in
7748 '') case "$osname" in
7749 hpux) dflt='+z' ;;
7750 next) dflt='none' ;;
7751 irix*) dflt='-KPIC' ;;
48bcfe03 7752 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7753 sunos) dflt='-pic' ;;
7754 *) dflt='none' ;;
7755 esac
7756 ;;
7757 *) case "$osname" in
b6cc0f4c 7758 darwin) dflt='none' ;;
48bcfe03 7759 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7760 *) dflt='-fpic' ;;
7761 esac ;;
7762 esac ;;
7763 ' ') dflt='none' ;;
7764 *) dflt="$cccdlflags" ;;
7765 esac
7766 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7767 . ./myread
7768 case "$ans" in
7769 none) cccdlflags=' ' ;;
7770 *) cccdlflags="$ans" ;;
7771 esac
7772
7773 cat << EOM
7774
7775Some systems use ld to create libraries that can be dynamically loaded,
7776while other systems (such as those using ELF) use $cc.
7777
7778EOM
7779 case "$ld" in
55954f19 7780 '') $cat >try.c <<EOM
b4eb6b3d
JH
7781/* Test for whether ELF binaries are produced */
7782#include <fcntl.h>
55954f19
JH
7783#$i_stdlib I_STDLIB
7784#ifdef I_STDLIB
b4eb6b3d 7785#include <stdlib.h>
55954f19 7786#endif
4fb7dc7d
JH
7787#$i_unistd I_UNISTD
7788#ifdef I_UNISTD
7789#include <unistd.h>
7790#endif
b4eb6b3d
JH
7791int main() {
7792 char b[4];
7793 int i = open("a.out",O_RDONLY);
7794 if(i == -1)
7795 exit(1); /* fail */
7796 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7797 exit(0); /* succeed (yes, it's ELF) */
7798 else
7799 exit(1); /* fail */
7800}
7801EOM
5440bc8e 7802 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7803 cat <<EOM
7804You appear to have ELF support. I'll use $cc to build dynamic libraries.
7805EOM
7806 dflt="$cc"
7807 else
7808 echo "I'll use ld to build dynamic libraries."
7809 dflt='ld'
7810 fi
7811 rm -f try.c a.out
7812 ;;
7813 *) dflt="$ld"
7814 ;;
7815 esac
7816
7817 rp="What command should be used to create dynamic libraries?"
7818 . ./myread
7819 ld="$ans"
7820
7821 cat << EOM
7822
7823Some systems may require passing special flags to $ld to create a
7824library that can be dynamically loaded. If your ld flags include
7825-L/other/path options to locate libraries outside your loader's normal
7826search path, you may need to specify those -L options here as well. To
7827use no flags, say "none".
7828
7829EOM
7830 case "$lddlflags" in
7831 '') case "$osname" in
7832 beos) dflt='-nostart' ;;
7833 hpux) dflt='-b';
7834 case "$gccversion" in
7835 '') dflt="$dflt +vnocompatwarnings" ;;
7836 esac
7837 ;;
fb2e1bc0 7838 linux|irix*|gnu*) dflt='-shared' ;;
b4eb6b3d
JH
7839 next) dflt='none' ;;
7840 solaris) dflt='-G' ;;
7841 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 7842 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
7843 *) dflt='none' ;;
7844 esac
7845 ;;
7846 *) dflt="$lddlflags" ;;
7847 esac
7848
7849 : Try to guess additional flags to pick up local libraries.
7850 : Be careful not to append to a plain 'none'
7851 case "$dflt" in
7852 none) dflt='' ;;
7853 esac
7854 for thisflag in $ldflags; do
7855 case "$thisflag" in
b5b9f165 7856 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
7857 case " $dflt " in
7858 *" $thisflag "*) ;;
7859 *) dflt="$dflt $thisflag" ;;
7860 esac
7861 ;;
7862 esac
7863 done
7864
7865 case "$dflt" in
7866 ''|' ') dflt='none' ;;
7867 esac
7868
7869 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7870 . ./myread
7871 case "$ans" in
7872 none) lddlflags=' ' ;;
7873 *) lddlflags="$ans" ;;
7874 esac
7875
7876 cat <<EOM
7877
7878Some systems may require passing special flags to $cc to indicate that
7879the resulting executable will use dynamic linking. To use no flags,
7880say "none".
7881
7882EOM
7883 case "$ccdlflags" in
7884 '') case "$osname" in
fb2e1bc0 7885 linux|hpux|gnu*) dflt='-Wl,-E' ;;
91fc0aa5
AH
7886 next|sunos) dflt='none' ;;
7887 *) dflt='none' ;;
b4eb6b3d
JH
7888 esac ;;
7889 ' ') dflt='none' ;;
7890 *) dflt="$ccdlflags" ;;
7891 esac
7892 rp="Any special flags to pass to $cc to use dynamic linking?"
7893 . ./myread
7894 case "$ans" in
7895 none) ccdlflags=' ' ;;
7896 *) ccdlflags="$ans" ;;
7897 esac
7898 ;;
7899*) usedl="$undef"
7900 ld='ld'
7901 dlsrc='dl_none.xs'
7902 lddlflags=''
7903 ccdlflags=''
7904 ;;
7905esac
7906
7907also=''
7908case "$usedl" in
7909$undef)
7910 # No dynamic loading being used, so don't bother even to prompt.
7911 useshrplib='false'
7912 ;;
7913*) case "$useshrplib" in
7914 '') case "$osname" in
48bcfe03 7915 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7916 dflt=y
7917 also='Building a shared libperl is required for dynamic loading to work on your system.'
7918 ;;
7919 next*)
7920 case "$osvers" in
7921 4*) dflt=y
7922 also='Building a shared libperl is needed for MAB support.'
7923 ;;
7924 *) dflt=n
7925 ;;
7926 esac
7927 ;;
7928 *) dflt=n
7929 ;;
7930 esac
7931 ;;
7932 $define|true|[Yy]*)
7933 dflt=y
7934 ;;
7935 *) dflt=n
7936 ;;
7937 esac
7938 $cat << EOM
7939
7940The perl executable is normally obtained by linking perlmain.c with
7941libperl${_a}, any static extensions (usually just DynaLoader), and
7942any other libraries needed on this system (such as -lm, etc.). Since
7943your system supports dynamic loading, it is probably possible to build
7944a shared libperl.$so. If you will have more than one executable linked
7945to libperl.$so, this will significantly reduce the size of each
5cadb3f3 7946executable, but it may have a noticeable effect on performance. The
b4eb6b3d
JH
7947default is probably sensible for your system.
7948$also
7949
7950EOM
7951 rp="Build a shared libperl.$so (y/n)"
7952 . ./myread
7953 case "$ans" in
7954 true|$define|[Yy]*)
7955 useshrplib='true' ;;
7956 *) useshrplib='false' ;;
7957 esac
7958 ;;
7959esac
7960
7961case "$useshrplib" in
7962true)
7963 case "$libperl" in
7964 '')
7965 # Figure out a good name for libperl.so. Since it gets stored in
7966 # a version-specific architecture-dependent library, the version
7967 # number isn't really that important, except for making cc/ld happy.
7968 #
7969 # A name such as libperl.so.3.1
7970 majmin="libperl.$so.$patchlevel.$subversion"
7971 # A name such as libperl.so.301
7972 majonly=`echo $patchlevel $subversion |
7973 $awk '{printf "%d%02d", $1, $2}'`
7974 majonly=libperl.$so.$majonly
7975 # I'd prefer to keep the os-specific stuff here to a minimum, and
7976 # rely on figuring it out from the naming of libc.
7977 case "${osname}${osvers}" in
7978 next4*)
7979 dflt=libperl.5.$so
7980 # XXX How handle the --version stuff for MAB?
7981 ;;
fb2e1bc0 7982 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
7983 dflt=libperl.$so
7984 ;;
b53432e4
GH
7985 cygwin*) # ld links against an importlib
7986 dflt=libperl$lib_ext
b4eb6b3d
JH
7987 ;;
7988 *) # Try to guess based on whether libc has major.minor.
7989 case "$libc" in
7990 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7991 *libc.$so.[0-9]*) dflt=$majonly ;;
7992 *) dflt=libperl.$so ;;
7993 esac
7994 ;;
7995 esac
7996 ;;
7997 *) dflt=$libperl
7998 ;;
7999 esac
8000 cat << EOM
8001
8002I need to select a good name for the shared libperl. If your system uses
8003library names with major and minor numbers, then you might want something
8004like $majmin. Alternatively, if your system uses a single version
8005number for shared libraries, then you might want to use $majonly.
8006Or, your system might be quite happy with a simple libperl.$so.
8007
8008Since the shared libperl will get installed into a version-specific
8009architecture-dependent directory, the version number of the shared perl
8010library probably isn't important, so the default should be o.k.
8011
8012EOM
8013 rp='What name do you want to give to the shared libperl?'
8014 . ./myread
8015 libperl=$ans
8016 echo "Ok, I'll use $libperl"
8017 ;;
8018*)
8019 libperl="libperl${_a}"
8020 ;;
8021esac
8022
8023# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8024case "$shrpdir" in
8025'') ;;
8026*) $cat >&4 <<EOM
8027WARNING: Use of the shrpdir variable for the installation location of
8028the shared $libperl is not supported. It was never documented and
8029will not work in this version. Let me (perlbug@perl.org)
8030know of any problems this may cause.
8031
8032EOM
8033 case "$shrpdir" in
8034 "$archlibexp/CORE")
8035 $cat >&4 <<EOM
8036But your current setting of $shrpdir is
8037the default anyway, so it's harmless.
8038EOM
8039 ;;
8040 *)
8041 $cat >&4 <<EOM
8042Further, your current attempted setting of $shrpdir
8043conflicts with the value of $archlibexp/CORE
8044that installperl will use.
8045EOM
8046 ;;
8047 esac
8048 ;;
8049esac
8050
8051# How will the perl executable find the installed shared $libperl?
8052# Add $xxx to ccdlflags.
8053# If we can't figure out a command-line option, use $shrpenv to
8054# set env LD_RUN_PATH. The main perl makefile uses this.
8055shrpdir=$archlibexp/CORE
8056xxx=''
8057tmp_shrpenv=''
8058if "$useshrplib"; then
8059 case "$osname" in
8060 aix)
8061 # We'll set it in Makefile.SH...
8062 ;;
b5b9f165 8063 solaris)
b4eb6b3d
JH
8064 xxx="-R $shrpdir"
8065 ;;
a774dfe6 8066 freebsd|netbsd|openbsd|interix|dragonfly)
b4eb6b3d
JH
8067 xxx="-Wl,-R$shrpdir"
8068 ;;
fb2e1bc0 8069 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
8070 xxx="-Wl,-rpath,$shrpdir"
8071 ;;
8072 next)
8073 # next doesn't like the default...
8074 ;;
8075 beos)
8076 # beos doesn't like the default, either.
8077 ;;
8078 hpux*)
8079 # hpux doesn't like the default, either.
8080 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8081 ;;
8082 *)
8083 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8084 ;;
8085 esac
8086 case "$xxx" in
8087 '') ;;
8088 *)
8089 # Only add $xxx if it isn't already in ccdlflags.
8090 case " $ccdlflags " in
8091 *" $xxx "*) ;;
8092 *) ccdlflags="$ccdlflags $xxx"
8093 cat <<EOM >&4
8094
8095Adding $xxx to the flags
8096passed to $ld so that the perl executable will find the
8097installed shared $libperl.
8098
8099EOM
8100 ;;
8101 esac
8102 ;;
8103 esac
8104fi
8105# Fix ccdlflags in AIX for building external extensions.
8106# (For building Perl itself bare -bE:perl.exp is needed,
8107# Makefile.SH takes care of this.)
8108case "$osname" in
8109aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8110esac
8111# Respect a hint or command-line value.
8112case "$shrpenv" in
8113'') shrpenv="$tmp_shrpenv" ;;
8114esac
8115case "$ldlibpthname" in
8116'') ldlibpthname=LD_LIBRARY_PATH ;;
8117none) ldlibpthname='' ;;
8118esac
8119
8120: determine where manual pages are on this system
8121echo " "
8122case "$sysman" in
8123'')
4a0a3829
SD
8124 syspath='/usr/share/man/man1 /usr/man/man1'
8125 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8126 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
8127 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8128 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8129 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8130 sysman=`./loc . /usr/man/man1 $syspath`
8131 ;;
8132esac
8133if $test -d "$sysman"; then
8134 echo "System manual is in $sysman." >&4
8135else
8136 echo "Could not find manual pages in source form." >&4
8137fi
8138
8139: determine where manual pages go
8140set man1dir man1dir none
8141eval $prefixit
8142$cat <<EOM
8143
8144$spackage has manual pages available in source form.
8145EOM
8146case "$nroff" in
8147nroff)
8148 echo "However, you don't have nroff, so they're probably useless to you."
8149 case "$man1dir" in
8150 '') man1dir="none";;
8151 esac;;
8152esac
8153echo "If you don't want the manual sources installed, answer 'none'."
8154case "$man1dir" in
8155' ') dflt=none
8156 ;;
8157'')
4a0a3829
SD
8158 lookpath="$prefixexp/share/man/man1"
8159 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
8160 lookpath="$lookpath $prefixexp/man/p_man/man1"
8161 lookpath="$lookpath $prefixexp/man/u_man/man1"
8162 lookpath="$lookpath $prefixexp/man/man.1"
8163 case "$sysman" in
8164 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8165 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8166 esac
8167 set dflt
8168 eval $prefixup
8169 ;;
8170*) dflt="$man1dir"
8171 ;;
8172esac
8173echo " "
8174fn=dn+~
8175rp="Where do the main $spackage manual pages (source) go?"
8176. ./getfile
8177if $test "X$man1direxp" != "X$ansexp"; then
8178 installman1dir=''
8179fi
79522dd2
NC
8180prefixvar=man1dir
8181. ./setprefixvar
8182
477140ee
NC
8183case "$man1dir" in
8184'') man1dir=' '
8185 installman1dir='';;
8186esac
b4eb6b3d
JH
8187
8188: What suffix to use on installed man pages
8189
8190case "$man1dir" in
8191' ')
8192 man1ext='0'
8193 ;;
8194*)
8195 rp="What suffix should be used for the main $spackage man pages?"
8196 case "$man1ext" in
8197 '') case "$man1dir" in
8198 *1) dflt=1 ;;
8199 *1p) dflt=1p ;;
8200 *1pm) dflt=1pm ;;
8201 *l) dflt=l;;
8202 *n) dflt=n;;
8203 *o) dflt=o;;
8204 *p) dflt=p;;
8205 *C) dflt=C;;
8206 *L) dflt=L;;
8207 *L1) dflt=L1;;
8208 *) dflt=1;;
8209 esac
8210 ;;
8211 *) dflt="$man1ext";;
8212 esac
8213 . ./myread
8214 man1ext="$ans"
8215 ;;
8216esac
8217
8218: see if we can have long filenames
8219echo " "
8220first=123456789abcdef
8221$rm -f $first
8222if (echo hi >$first) 2>/dev/null; then
8223 if $test -f 123456789abcde; then
8224 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8225 val="$undef"
8226 else
8227 echo 'You can have filenames longer than 14 characters.'>&4
8228 val="$define"
8229 fi
8230else
8231 $cat <<'EOM'
8232You can't have filenames longer than 14 chars.
8233You can't even think about them!
8234EOM
8235 val="$undef"
8236fi
8237set d_flexfnam
8238eval $setvar
8239$rm -rf 123456789abcde*
8240
8241: determine where library module manual pages go
8242set man3dir man3dir none
8243eval $prefixit
8244$cat <<EOM
8245
8246$spackage has manual pages for many of the library modules.
8247EOM
8248
8249case "$nroff" in
8250nroff)
8251 $cat <<'EOM'
8252However, you don't have nroff, so they're probably useless to you.
8253EOM
8254 case "$man3dir" in
8255 '') man3dir="none";;
8256 esac;;
8257esac
8258
8259case "$d_flexfnam" in
8260undef)
8261 $cat <<'EOM'
f3f1a2d8 8262However, your system can't handle the long file names like File::Basename.3.
b4eb6b3d
JH
8263EOM
8264 case "$man3dir" in
8265 '') man3dir="none";;
8266 esac;;
8267esac
8268
8269echo "If you don't want the manual sources installed, answer 'none'."
8270prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8271case "$man3dir" in
8272'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8273 if $test -d "$privlib/man/man3"; then
8274 cat <<EOM >&4
8275
8276WARNING: Previous versions of perl installed man3 pages into
f3f1a2d8
MB
8277$privlib/man/man3. This version will suggest a
8278new default of $dflt.
b4eb6b3d
JH
8279EOM
8280 tdflt=$dflt
8281 dflt='n'
8282 rp='Do you wish to preserve the old behavior?(y/n)'
8283 . ./myread
8284 case "$ans" in
8285 y*) dflt="$privlib/man/man3" ;;
8286 *) dflt=$tdflt ;;
8287 esac
8288 fi
8289 ;;
8290*) dflt="$man3dir" ;;
8291esac
8292case "$dflt" in
8293' ') dflt=none ;;
8294esac
8295echo " "
8296fn=dn+~
8297rp="Where do the $package library man pages (source) go?"
8298. ./getfile
79522dd2
NC
8299prefixvar=man3dir
8300. ./setprefixvar
8301
477140ee
NC
8302case "$man3dir" in
8303'') man3dir=' '
8304 installman3dir='';;
8305esac
b4eb6b3d
JH
8306
8307: What suffix to use on installed man pages
8308case "$man3dir" in
8309' ')
8310 man3ext='0'
8311 ;;
8312*)
8313 rp="What suffix should be used for the $package library man pages?"
8314 case "$man3ext" in
8315 '') case "$man3dir" in
8316 *3) dflt=3 ;;
8317 *3p) dflt=3p ;;
8318 *3pm) dflt=3pm ;;
8319 *l) dflt=l;;
8320 *n) dflt=n;;
8321 *o) dflt=o;;
8322 *p) dflt=p;;
8323 *C) dflt=C;;
8324 *L) dflt=L;;
8325 *L3) dflt=L3;;
8326 *) dflt=3;;
8327 esac
8328 ;;
8329 *) dflt="$man3ext";;
8330 esac
8331 . ./myread
8332 man3ext="$ans"
8333 ;;
8334esac
8335
8336: see if we have to deal with yellow pages, now NIS.
0384a54a 8337if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8338 if $test -f /usr/etc/nibindd; then
8339 echo " "
8340 echo "I'm fairly confident you're on a NeXT."
8341 echo " "
8342 rp='Do you get the hosts file via NetInfo?'
8343 dflt=y
8344 case "$hostcat" in
8345 nidump*) ;;
8346 '') ;;
8347 *) dflt=n;;
8348 esac
8349 . ./myread
8350 case "$ans" in
8351 y*) hostcat='nidump hosts .';;
8352 *) case "$hostcat" in
8353 nidump*) hostcat='';;
8354 esac
8355 ;;
8356 esac
8357 fi
8358 case "$hostcat" in
8359 nidump*) ;;
8360 *)
8361 case "$hostcat" in
8362 *ypcat*) dflt=y;;
8363 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8364 dflt=y
8365 else
8366 dflt=n
8367 fi;;
8368 *) dflt=n;;
8369 esac
8370 echo " "
8371 rp='Are you getting the hosts file via yellow pages?'
8372 . ./myread
8373 case "$ans" in
8374 y*) hostcat='ypcat hosts';;
8375 *) hostcat='cat /etc/hosts';;
8376 esac
8377 ;;
8378 esac
8379fi
8380case "$hostcat" in
8381'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8382esac
8383case "$groupcat" in
8384'') test -f /etc/group && groupcat='cat /etc/group';;
8385esac
8386case "$passcat" in
8387'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8388esac
8389
8390: now get the host name
8391echo " "
8392echo "Figuring out host name..." >&4
8393case "$myhostname" in
8394'') cont=true
8395 echo 'Maybe "hostname" will work...'
73614538 8396 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8397 myhostname=$tans
8398 phostname=hostname
8399 cont=''
8400 fi
8401 ;;
8402*) cont='';;
8403esac
8404if $test "$cont"; then
8405 if ./xenix; then
8406 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8407 if tans=`cat /etc/systemid 2>&1` ; then
8408 myhostname=$tans
8409 phostname='cat /etc/systemid'
8410 echo "Whadyaknow. Xenix always was a bit strange..."
8411 cont=''
8412 fi
8413 elif $test -r /etc/systemid; then
8414 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8415 fi
8416fi
8417if $test "$cont"; then
8418 echo 'No, maybe "uuname -l" will work...'
73614538 8419 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8420 myhostname=$tans
8421 phostname='uuname -l'
8422 else
8423 echo 'Strange. Maybe "uname -n" will work...'
73614538 8424 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8425 myhostname=$tans
8426 phostname='uname -n'
8427 else
8428 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8429 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8430 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8431 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8432 else
8433 case "$myhostname" in
8434 '') echo "Does this machine have an identity crisis or something?"
8435 phostname='';;
8436 *)
8437 echo "Well, you said $myhostname before..."
8438 phostname='echo $myhostname';;
8439 esac
8440 fi
8441 fi
8442 fi
8443fi
52a549d0
JH
8444case "$myhostname" in
8445'') myhostname=noname ;;
8446esac
b4eb6b3d
JH
8447: you do not want to know about this
8448set $myhostname
8449myhostname=$1
8450
8451: verify guess
8452if $test "$myhostname" ; then
8453 dflt=y
8454 rp='Your host name appears to be "'$myhostname'".'" Right?"
8455 . ./myread
8456 case "$ans" in
8457 y*) ;;
8458 *) myhostname='';;
8459 esac
8460fi
8461
8462: bad guess or no guess
8463while $test "X$myhostname" = X ; do
8464 dflt=''
8465 rp="Please type the (one word) name of your host:"
8466 . ./myread
8467 myhostname="$ans"
8468done
8469
8470: translate upper to lower if necessary
8471case "$myhostname" in
8472*[A-Z]*)
8473 echo "(Normalizing case in your host name)"
8474 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8475 ;;
8476esac
8477
8478case "$myhostname" in
8479*.*)
8480 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8481 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8482 echo "(Trimming domain name from host name--host name is now $myhostname)"
8483 ;;
8484*) case "$mydomain" in
8485 '')
8486 {
8487 test "X$hostcat" = "Xypcat hosts" &&
8488 ypmatch "$myhostname" hosts 2>/dev/null |\
8489 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8490 $test -s hosts
8491 } || {
8492 test "X$hostcat" != "X" &&
8493 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8494 /[ ]$myhostname[ . ]/p" > hosts
8495 }
8496 tmp_re="[ . ]"
f08cbdd1
PP
8497 if $test -f hosts; then
8498 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8499 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8500 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8501 hosts | $sort | $uniq | \
8502 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8503 case `$echo X$dflt` in
8504 X*\ *) echo "(Several hosts in the database matched hostname)"
8505 dflt=.
8506 ;;
8507 X.) echo "(You do not have fully-qualified names in the hosts database)"
8508 ;;
8509 esac
8510 else
8511 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8512 dflt=.
f08cbdd1 8513 fi
b4eb6b3d
JH
8514 case "$dflt" in
8515 .)
8516 tans=`./loc resolv.conf X /etc /usr/etc`
8517 if $test -f "$tans"; then
8518 echo "(Attempting domain name extraction from $tans)"
8519 dflt=.`$sed -n -e 's/ / /g' \
8520 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
8521 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8522 case "$dflt" in
8523 .) dflt=.`$sed -n -e 's/ / /g' \
8524 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
8525 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8526 ;;
8527 esac
8528 fi
8529 ;;
8530 esac
8531 case "$dflt" in
8532 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8533 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8534 case "$dflt" in
8535 '') dflt='.';;
8536 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8537 esac
8538 ;;
8539 esac
59c9e5d6
PP
8540 case "$dflt$osname" in
8541 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8542 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8543 ;;
8544 esac
b4eb6b3d
JH
8545 case "$dflt" in
8546 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8547 dflt='.nonet'
b4eb6b3d
JH
8548 ;;
8549 esac
8550 $rm -f hosts
8551 ;;
8552 *) dflt="$mydomain";;
8553 esac;;
8554esac
8555echo " "
8556rp="What is your domain name?"
8557. ./myread
8558tans="$ans"
8559case "$ans" in
8560'') ;;
8561.*) ;;
8562*) tans=".$tans";;
8563esac
8564mydomain="$tans"
8565
8566: translate upper to lower if necessary
8567case "$mydomain" in
8568*[A-Z]*)
8569 echo "(Normalizing case in your domain name)"
8570 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8571 ;;
8572esac
8573
8574: a little sanity check here
8575case "$phostname" in
8576'') ;;
8577*)
8578 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8579 $myhostname$mydomain|$myhostname) ;;
8580 *)
8581 case "$phostname" in
8582 sed*)
8583 echo "(That doesn't agree with your whoami.h file, by the way.)"
8584 ;;
8585 *)
8586 echo "(That doesn't agree with your $phostname command, by the way.)"
8587 ;;
8588 esac
8589 ;;
8590 esac
8591 ;;
8592esac
8593
8594$cat <<EOM
8595
8596I need to get your e-mail address in Internet format if possible, i.e.
8597something like user@host.domain. Please answer accurately since I have
8598no easy means to double check it. The default value provided below
8599is most probably close to reality but may not be valid from outside
8600your organization...
8601
8602EOM
8603cont=x
8604while test "$cont"; do
8605 case "$cf_email" in
8606 '') dflt="$cf_by@$myhostname$mydomain";;
8607 *) dflt="$cf_email";;
8608 esac
8609 rp='What is your e-mail address?'
8610 . ./myread
8611 cf_email="$ans"
8612 case "$cf_email" in
8613 *@*.*) cont='' ;;
8614 *)
8615 rp='Address does not look like an Internet one. Use it anyway?'
8616 case "$fastread" in
8617 yes) dflt=y ;;
8618 *) dflt=n ;;
8619 esac
8620 . ./myread
8621 case "$ans" in
8622 y*) cont='' ;;
8623 *) echo " " ;;
8624 esac
8625 ;;
8626 esac
8627done
8628
8629$cat <<EOM
8630
8631If you or somebody else will be maintaining perl at your site, please
8632fill in the correct e-mail address here so that they may be contacted
8633if necessary. Currently, the "perlbug" program included with perl
8634will send mail to this address in addition to perlbug@perl.org. You may
8635enter "none" for no administrator.
8636
8637EOM
8638case "$perladmin" in
8639'') dflt="$cf_email";;
8640*) dflt="$perladmin";;
8641esac
8642rp='Perl administrator e-mail address'
8643. ./myread
8644perladmin="$ans"
8645
674912d7
RB
8646: determine whether to only install version-specific parts.
8647echo " "
8648$cat <<EOM
8649Do you want to install only the version-specific parts of the perl
8650distribution? Usually you do *not* want to do this.
8651EOM
8652case "$versiononly" in
8653"$define"|[Yy]*|true) dflt='y' ;;
8654*) dflt='n';
8655esac
8656rp="Do you want to install only the version-specific parts of perl?"
8657. ./myread
8658case "$ans" in
8659[yY]*) val="$define";;
8660*) val="$undef" ;;
8661esac
8662set versiononly
8663eval $setvar
8664
ad493445
MB
8665case "$versiononly" in
8666"$define") inc_version_list=''
8667 inc_version_list_init=0
8668 ;;
8669esac
8670
b4eb6b3d 8671: figure out how to guarantee perl startup
d0e36aa9 8672: XXX Note that this currently takes advantage of the bug that binexp ignores
a2d23ec2
MB
8673: the Configure -Dinstallprefix setting, which in turn means that under
8674: relocatable @INC, initialinstalllocation is what binexp started as.
b4eb6b3d
JH
8675case "$startperl" in
8676'')
8677 case "$sharpbang" in
8678 *!)
8679 $cat <<EOH
8680
8681I can use the #! construct to start perl on your system. This will
8682make startup of perl scripts faster, but may cause problems if you
8683want to share those scripts and perl is not in a standard place
a2d23ec2
MB
8684($initialinstalllocation/perl) on all your platforms. The alternative
8685is to force a shell by starting the script with a single ':' character.
b4eb6b3d
JH
8686
8687EOH
674912d7 8688 case "$versiononly" in
a2d23ec2 8689 "$define") dflt="$initialinstalllocation/perl$version";;
d0e36aa9 8690 *) dflt="$initialinstalllocation/perl";;
674912d7 8691 esac
b4eb6b3d
JH
8692 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8693 . ./myread
8694 case "$ans" in
8695 none) startperl=": # use perl";;
8696 *) startperl="#!$ans"
8697 if $test 30 -lt `echo "$ans" | wc -c`; then
8698 $cat >&4 <<EOM
8699
8700WARNING: Some systems limit the #! command to 32 characters.
8701If you experience difficulty running Perl scripts with #!, try
8702installing Perl in a directory with a shorter pathname.
8703
8704EOM
8705 fi ;;
8706 esac
8707 ;;
8708 *) startperl=": # use perl"
8709 ;;
8710 esac
8711 ;;
8712esac
8713echo "I'll use $startperl to start perl scripts."
8714
8715: figure best path for perl in scripts
8716case "$perlpath" in
8717'')
5e20a8ca 8718 case "$versiononly" in
d0e36aa9
NC
8719 "$define") perlpath="$initialinstalllocation/perl$version";;
8720 *) perlpath="$initialinstalllocation/perl";;
5e20a8ca 8721 esac
b4eb6b3d
JH
8722 case "$startperl" in
8723 *!*) ;;
8724 *)
8725 $cat <<EOH
8726
8727I will use the "eval 'exec'" idiom to start Perl on your system.
8728I can use the full path of your Perl binary for this purpose, but
8729doing so may cause problems if you want to share those scripts and
d0e36aa9 8730Perl is not always in a standard place ($initialinstalllocation/perl).
b4eb6b3d
JH
8731
8732EOH
d0e36aa9 8733 dflt="$initialinstalllocation/perl"
b4eb6b3d
JH
8734 rp="What path shall I use in \"eval 'exec'\"?"
8735 . ./myread
8736 perlpath="$ans"
8737 ;;
8738 esac
8739 ;;
8740esac
8741case "$startperl" in
8742*!*) ;;
8743*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8744esac
8745
8746: determine where public executable scripts go
8747set scriptdir scriptdir
8748eval $prefixit
8749case "$scriptdir" in
8750'')
8751 dflt="$bin"
8752 : guess some guesses
8753 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8754 $test -d /usr/share/bin && dflt=/usr/share/bin
8755 $test -d /usr/local/script && dflt=/usr/local/script
8756 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8757 $test -d $prefixexp/script && dflt=$prefixexp/script
8758 set dflt
8759 eval $prefixup
8760 ;;
8761*) dflt="$scriptdir"
8762 ;;
8763esac
8764$cat <<EOM
f3f1a2d8 8765
b4eb6b3d
JH
8766Some installations have a separate directory just for executable scripts so
8767that they can mount it across multiple architectures but keep the scripts in
8768one spot. You might, for example, have a subdirectory of /usr/share for this.
8769Or you might just lump your scripts in with all your other executables.
f3f1a2d8 8770
b4eb6b3d
JH
8771EOM
8772fn=d~
8773rp='Where do you keep publicly executable scripts?'
8774. ./getfile
8775if $test "X$ansexp" != "X$scriptdirexp"; then
8776 installscript=''
8777fi
f3f1a2d8 8778installscriptdir=''
79522dd2
NC
8779prefixvar=scriptdir
8780. ./setprefixvar
8781: A little fix up for an irregularly named variable.
8782installscript="$installscriptdir"
8783
b4eb6b3d
JH
8784: determine where add-on public executables go
8785case "$sitebin" in
8786'') dflt=$siteprefix/bin ;;
8787*) dflt=$sitebin ;;
8788esac
8789fn=d~
8790rp='Pathname where the add-on public executables should be installed?'
8791. ./getfile
79522dd2
NC
8792prefixvar=sitebin
8793. ./setprefixvar
b4eb6b3d 8794
6e1038e0 8795: determine where add-on html pages go
8d2cbf27 8796: There is no standard location, so try to copy the previously-selected
6e1038e0 8797: directory structure for the core html pages.
8d2cbf27
JH
8798case "$sitehtml1dir" in
8799'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8800*) dflt=$sitehtml1dir ;;
6e1038e0
MB
8801esac
8802case "$dflt" in
8803''|' ') dflt=none ;;
8804esac
8805fn=dn+~
8806rp='Pathname where the site-specific html pages should be installed?'
8807. ./getfile
79522dd2
NC
8808prefixvar=sitehtml1dir
8809. ./setprefixvar
6e1038e0
MB
8810
8811: determine where add-on library html pages go
8812: There is no standard location, so try to copy the previously-selected
8813: directory structure for the core html pages.
8d2cbf27
JH
8814case "$sitehtml3dir" in
8815'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8816*) dflt=$sitehtml3dir ;;
6e1038e0
MB
8817esac
8818case "$dflt" in
8819''|' ') dflt=none ;;
8820esac
8821fn=dn+~
8822rp='Pathname where the site-specific library html pages should be installed?'
8823. ./getfile
79522dd2
NC
8824prefixvar=sitehtml3dir
8825. ./setprefixvar
6e1038e0
MB
8826
8827: determine where add-on manual pages go
91e123a8
JH
8828case "$siteman1dir" in
8829'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 8830*) dflt=$siteman1dir ;;
6e1038e0 8831esac
257059b5
JH
8832case "$dflt" in
8833''|' ') dflt=none ;;
8834esac
6e1038e0
MB
8835fn=dn+~
8836rp='Pathname where the site-specific manual pages should be installed?'
8837. ./getfile
79522dd2
NC
8838prefixvar=siteman1dir
8839. ./setprefixvar
6e1038e0
MB
8840
8841: determine where add-on library man pages go
91e123a8
JH
8842case "$siteman3dir" in
8843'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 8844*) dflt=$siteman3dir ;;
6e1038e0 8845esac
257059b5
JH
8846case "$dflt" in
8847''|' ') dflt=none ;;
8848esac
6e1038e0
MB
8849fn=dn+~
8850rp='Pathname where the site-specific library manual pages should be installed?'
8851. ./getfile
79522dd2
NC
8852prefixvar=siteman3dir
8853. ./setprefixvar
6e1038e0
MB
8854
8855: determine where add-on public executable scripts go
8856case "$sitescript" in
8857'') dflt=$siteprefix/script
8858 $test -d $dflt || dflt=$sitebin ;;
8859*) dflt="$sitescript" ;;
8860esac
8861fn=d~+
8862rp='Pathname where add-on public executable scripts should be installed?'
8863. ./getfile
79522dd2
NC
8864prefixvar=sitescript
8865. ./setprefixvar
6e1038e0 8866
15b61c98
JH
8867case "$usefaststdio" in
8868$define|true|[yY]*|'')
8869 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8870 case "$xversion" in
8871 [68]) dflt='y' ;;
8872 *) dflt='n' ;;
8873 esac
8874 ;;
8875*) dflt='n';;
8876esac
8877cat <<EOM
8878
8879Perl can be built to use 'fast stdio', which means using the stdio
8880library but also directly manipulating the stdio buffers to enable
8881faster I/O. Using stdio is better for backward compatibility (especially
8882for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8883interface has been preferred instead of stdio.
8884
8885If this doesn't make any sense to you, just accept the default '$dflt'.
8886EOM
8887rp='Use the "fast stdio" if available?'
8888. ./myread
8889case "$ans" in
8890y|Y) val="$define" ;;
8891*) val="$undef" ;;
8892esac
8893set usefaststdio
8894eval $setvar
8895
8896
96056487
JH
8897: define an is-a-typedef? function
8898typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8899case "$inclist" in
8900"") inclist="sys/types.h";;
8901esac;
8902eval "varval=\$$var";
8903case "$varval" in
8904"")
8905 $rm -f temp.c;
8906 for inc in $inclist; do
8907 echo "#include <$inc>" >>temp.c;
8908 done;
8909 echo "#ifdef $type" >> temp.c;
8910 echo "printf(\"We have $type\");" >> temp.c;
8911 echo "#endif" >> temp.c;
8912 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8913 if $contains $type temp.E >/dev/null 2>&1; then
8914 eval "$var=\$type";
8915 else
8916 eval "$var=\$def";
8917 fi;
8918 $rm -f temp.?;;
8919*) eval "$var=\$varval";;
8920esac'
8921
8922: define an is-a-typedef? function that prompts if the type is not available.
8923typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8924case "$inclist" in
8925"") inclist="sys/types.h";;
8926esac;
8927eval "varval=\$$var";
8928case "$varval" in
8929"")
8930 $rm -f temp.c;
8931 for inc in $inclist; do
8932 echo "#include <$inc>" >>temp.c;
8933 done;
8934 echo "#ifdef $type" >> temp.c;
8935 echo "printf(\"We have $type\");" >> temp.c;
8936 echo "#endif" >> temp.c;
8937 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8938 echo " " ;
8939 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8940 if $contains $type temp.E >/dev/null 2>&1; then
8941 echo "$type found." >&4;
8942 eval "$var=\$type";
8943 else
8944 echo "$type NOT found." >&4;
8945 dflt="$def";
8946 . ./myread ;
8947 eval "$var=\$ans";
8948 fi;
8949 $rm -f temp.?;;
8950*) eval "$var=\$varval";;
8951esac'
8952
8953: see what type lseek is declared as in the kernel
8954rp="What is the type used for lseek's offset on this system?"
8955set off_t lseektype long stdio.h sys/types.h
8956eval $typedef_ask
8957
8958echo " "
8959echo "Checking to see how big your file offsets are..." >&4
8960$cat >try.c <<EOCP
8961#include <sys/types.h>
8962#include <stdio.h>
8963int main()
8964{
8965 printf("%d\n", (int)sizeof($lseektype));
8966 return(0);
8967}
8968EOCP
8969set try
8970if eval $compile_ok; then
8971 lseeksize=`$run ./try`
8972 echo "Your file offsets are $lseeksize bytes long."
8973else
8974 dflt=$longsize
8975 echo " "
8976 echo "(I can't seem to compile the test program. Guessing...)"
8977 rp="What is the size of your file offsets (in bytes)?"
8978 . ./myread
8979 lseeksize="$ans"
8980fi
8981$rm -f try.c try
8982
8983: see what type file positions are declared as in the library
8984rp="What is the type for file position used by fsetpos()?"
8985set fpos_t fpostype long stdio.h sys/types.h
8986eval $typedef_ask
8987
8988echo " "
8989case "$fpostype" in
8990*_t) zzz="$fpostype" ;;
8991*) zzz="fpos_t" ;;
8992esac
8993echo "Checking the size of $zzz..." >&4
8994cat > try.c <<EOCP
8995#include <sys/types.h>
8996#include <stdio.h>
d1daaddf
JH
8997#$i_stdlib I_STDLIB
8998#ifdef I_STDLIB
8999#include <stdlib.h>
9000#endif
96056487
JH
9001int main() {
9002 printf("%d\n", (int)sizeof($fpostype));
9003 exit(0);
9004}
9005EOCP
9006set try
9007if eval $compile_ok; then
9008 yyy=`$run ./try`
9009 case "$yyy" in
9010 '') fpossize=4
9011 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9012 ;;
9013 *) fpossize=$yyy
9014 echo "Your $zzz is $fpossize bytes long."
9015 ;;
9016 esac
9017else
9018 dflt="$longsize"
9019 echo " " >&4
9020 echo "(I can't compile the test program. Guessing...)" >&4
9021 rp="What is the size of your file positions (in bytes)?"
9022 . ./myread
9023 fpossize="$ans"
9024fi
9025
96056487
JH
9026# Backward compatibility (uselfs is deprecated).
9027case "$uselfs" in
9028"$define"|true|[yY]*)
9029 cat <<EOM >&4
9030
9031*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9032EOM
9033 uselargefiles="$define"
9034 ;;
9035esac
9036
9037case "$lseeksize:$fpossize" in
90388:8) cat <<EOM
9039
9040You can have files larger than 2 gigabytes.
9041EOM
9042 val="$define" ;;
9043*) case "$uselargefiles" in
9044 "$undef"|false|[nN]*) dflt='n' ;;
9045 *) dflt='y' ;;
9046 esac
9047 cat <<EOM
9048
9049Perl can be built to understand large files (files larger than 2 gigabytes)
9050on some systems. To do so, Configure can be run with -Duselargefiles.
9051
9052If this doesn't make any sense to you, just accept the default '$dflt'.
9053EOM
9054 rp='Try to understand large files, if available?'
9055 . ./myread
9056 case "$ans" in
9057 y|Y) val="$define" ;;
9058 *) val="$undef" ;;
9059 esac
9060 ;;
9061esac
9062set uselargefiles
9063eval $setvar
96056487
JH
9064: Look for a hint-file generated 'call-back-unit'. If the
9065: user has specified that a large files perl is to be built,
9066: we may need to set or change some other defaults.
9da7673b
MB
9067if $test -f uselargefiles.cbu; then
9068 echo "Your platform has some specific hints regarding large file builds, using them..."
9069 . ./uselargefiles.cbu
9070fi
9071case "$uselargefiles" in
9072"$define")
96056487 9073 if $test -f uselargefiles.cbu; then
96056487
JH
9074 echo " "
9075 echo "Rechecking to see how big your file offsets are..." >&4
9076 $cat >try.c <<EOCP
9077#include <sys/types.h>
9078#include <stdio.h>
9079int main()
9080{
9081 printf("%d\n", (int)sizeof($lseektype));
9082 return(0);
9083}
9084EOCP
9085 set try
9086 if eval $compile_ok; then
9087 lseeksize=`$run ./try`
9088 $echo "Your file offsets are now $lseeksize bytes long."
9089 else
9090 dflt="$lseeksize"
9091 echo " "
9092 echo "(I can't seem to compile the test program. Guessing...)"
9093 rp="What is the size of your file offsets (in bytes)?"
9094 . ./myread
9095 lseeksize="$ans"
9096 fi
9097 case "$fpostype" in
9098 *_t) zzz="$fpostype" ;;
9099 *) zzz="fpos_t" ;;
9100 esac
9101 $echo $n "Rechecking the size of $zzz...$c" >&4
9102 $cat > try.c <<EOCP
9103#include <sys/types.h>
9104#include <stdio.h>
55954f19
JH
9105#$i_stdlib I_STDLIB
9106#ifdef I_STDLIB
9107#include <stdlib.h>
9108#endif
96056487
JH
9109int main() {
9110 printf("%d\n", (int)sizeof($fpostype));
073b6de5 9111 return(0);
96056487
JH
9112}
9113EOCP
9114 set try
9115 if eval $compile_ok; then
9116 yyy=`$run ./try`
9117 dflt="$lseeksize"
9118 case "$yyy" in
9119 '') echo " "
9120 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9121 ;;
9122 *) fpossize=$yyy
9123 echo " $fpossize bytes." >&4
9124 ;;
9125 esac
9126 else
9127 dflt="$fpossize"
9128 echo " "
9129 echo "(I can't compile the test program. Guessing...)" >&4
9130 rp="What is the size of your file positions (in bytes)?"
9131 . ./myread
9132 fpossize="$ans"
9133 fi
9134 $rm -f try.c try
9135 fi
9136 ;;
9137esac
9138
b4eb6b3d
JH
9139case "$vendorprefix" in
9140'') d_vendorbin="$undef"
9141 vendorbin=''
9142 vendorbinexp=''
9143 ;;
9144*) d_vendorbin="$define"
9145 : determine where vendor-supplied executables go.
9146 case "$vendorbin" in
9147 '') dflt=$vendorprefix/bin ;;
9148 *) dflt="$vendorbin" ;;
9149 esac
9150 fn=d~+
9151 rp='Pathname for the vendor-supplied executables directory?'
9152 . ./getfile
9153 vendorbin="$ans"
9154 vendorbinexp="$ansexp"
9155 ;;
9156esac
a092d240
NC
9157prefixvar=vendorbin
9158. ./installprefix
b4eb6b3d 9159
6e1038e0 9160case "$vendorprefix" in
8d2cbf27
JH
9161'') vendorhtml1dir=''
9162 vendorhtml1direxp=''
6e1038e0
MB
9163 ;;
9164*) : determine where vendor-supplied html pages go.
9165 : There is no standard location, so try to copy the previously-selected
9166 : directory structure for the core html pages.
9167 : XXX Better default suggestions would be welcome.
8d2cbf27 9168 case "$vendorhtml1dir" in
6e1038e0 9169 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9170 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9171 esac
9172 case "$dflt" in
9173 ''|' ') dflt=none ;;
9174 esac
9175 fn=dn+~
9176 rp='Pathname for the vendor-supplied html pages?'
9177 . ./getfile
8d2cbf27
JH
9178 vendorhtml1dir="$ans"
9179 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9180 ;;
9181esac
9182: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9183$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
a092d240
NC
9184prefixvar=vendorhtml1dir
9185. ./installprefix
6e1038e0
MB
9186
9187case "$vendorprefix" in
8d2cbf27
JH
9188'') vendorhtml3dir=''
9189 vendorhtml3direxp=''
6e1038e0
MB
9190 ;;
9191*) : determine where vendor-supplied module html pages go.
9192 : There is no standard location, so try to copy the previously-selected
9193 : directory structure for the core html pages.
9194 : XXX Better default suggestions would be welcome.
8d2cbf27 9195 case "$vendorhtml3dir" in
6e1038e0 9196 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9197 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9198 esac
9199 case "$dflt" in
9200 ''|' ') dflt=none ;;
9201 esac
9202 fn=dn+~
9203 rp='Pathname for the vendor-supplied html pages?'
9204 . ./getfile
8d2cbf27
JH
9205 vendorhtml3dir="$ans"
9206 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9207 ;;
9208esac
9209: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9210$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
a092d240
NC
9211prefixvar=vendorhtml3dir
9212. ./installprefix
6e1038e0
MB
9213
9214case "$vendorprefix" in
91e123a8
JH
9215'') vendorman1dir=''
9216 vendorman1direxp=''
6e1038e0
MB
9217 ;;
9218*) : determine where vendor-supplied manual pages go.
91e123a8 9219 case "$vendorman1dir" in
6e1038e0 9220 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9221 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9222 esac
9223 case "$dflt" in
9224 ''|' ') dflt=none ;;
9225 esac
9226 fn=nd~+
9227 rp='Pathname for the vendor-supplied manual section 1 pages?'
9228 . ./getfile
91e123a8
JH
9229 vendorman1dir="$ans"
9230 vendorman1direxp="$ansexp"
6e1038e0
MB
9231 ;;
9232esac
9233: Use ' ' for none so value is preserved next time through Configure
91e123a8 9234$test X"$vendorman1dir" = "X" && vendorman1dir=' '
a092d240
NC
9235prefixvar=vendorman1dir
9236. ./installprefix
6e1038e0
MB
9237
9238case "$vendorprefix" in
91e123a8
JH
9239'') vendorman3dir=''
9240 vendorman3direxp=''
6e1038e0
MB
9241 ;;
9242*) : determine where vendor-supplied module manual pages go.
91e123a8 9243 case "$vendorman3dir" in
6e1038e0 9244 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9245 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9246 esac
9247 case "$dflt" in
9248 ''|' ') dflt=none ;;
9249 esac
9250 fn=nd~+
9251 rp='Pathname for the vendor-supplied manual section 3 pages?'
9252 . ./getfile
91e123a8
JH
9253 vendorman3dir="$ans"
9254 vendorman3direxp="$ansexp"
6e1038e0
MB
9255 ;;
9256esac
9257: Use ' ' for none so value is preserved next time through Configure
91e123a8 9258$test X"$vendorman3dir" = "X" && vendorman3dir=' '
a092d240
NC
9259prefixvar=vendorman3dir
9260. ./installprefix
6e1038e0
MB
9261
9262case "$vendorprefix" in
9263'') d_vendorscript="$undef"
9264 vendorscript=''
9265 vendorscriptexp=''
9266 ;;
9267*) d_vendorscript="$define"
9268 : determine where vendor-supplied scripts go.
9269 case "$vendorscript" in
9270 '') dflt=$vendorprefix/script
9271 $test -d $dflt || dflt=$vendorbin ;;
9272 *) dflt="$vendorscript" ;;
9273 esac
9274 $cat <<EOM
9275
f3f1a2d8 9276The installation process will create a directory for
6e1038e0
MB
9277vendor-supplied scripts.
9278
9279EOM
9280 fn=d~+
9281 rp='Pathname for the vendor-supplied scripts directory?'
9282 . ./getfile
9283 vendorscript="$ans"
9284 vendorscriptexp="$ansexp"
9285 ;;
9286esac
a092d240
NC
9287prefixvar=vendorscript
9288. ./installprefix
6e1038e0 9289
b4eb6b3d
JH
9290: see if qgcvt exists
9291set qgcvt d_qgcvt
9292eval $inlibc
9293
89ce900e
JH
9294echo " "
9295
9296if $test X"$d_longdbl" = X"$define"; then
9297
9298echo "Checking how to print long doubles..." >&4
9299
9300if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9301 $cat >try.c <<'EOCP'
9302#include <sys/types.h>
9303#include <stdio.h>
9304int main() {
9305 double d = 123.456;
9306 printf("%.3f\n", d);
9307}
9308EOCP
9309 set try
9310 if eval $compile; then
9311 yyy=`$run ./try`
9312 case "$yyy" in
9313 123.456)
9314 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9315 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9316 echo "We will use %f."
9317 ;;
9318 esac
9319 fi
9320fi
9321
9322if $test X"$sPRIfldbl" = X; then
9323 $cat >try.c <<'EOCP'
9324#include <sys/types.h>
9325#include <stdio.h>
9326int main() {
9327 long double d = 123.456;
9328 printf("%.3Lf\n", d);
9329}
9330EOCP
9331 set try
9332 if eval $compile; then
9333 yyy=`$run ./try`
9334 case "$yyy" in
9335 123.456)
9336 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9337 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9338 echo "We will use %Lf."
9339 ;;
9340 esac
9341 fi
9342fi
9343
9344if $test X"$sPRIfldbl" = X; then
9345 $cat >try.c <<'EOCP'
9346#include <sys/types.h>
9347#include <stdio.h>
9348int main() {
9349 long double d = 123.456;
9350 printf("%.3llf\n", d);
9351}
9352EOCP
9353 set try
9354 if eval $compile; then
9355 yyy=`$run ./try`
9356 case "$yyy" in
9357 123.456)
9358 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9359 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9360 echo "We will use %llf."
9361 ;;
9362 esac
9363 fi
9364fi
9365
9366if $test X"$sPRIfldbl" = X; then
9367 $cat >try.c <<'EOCP'
9368#include <sys/types.h>
9369#include <stdio.h>
9370int main() {
9371 long double d = 123.456;
9372 printf("%.3lf\n", d);
9373}
9374EOCP
9375 set try
9376 if eval $compile; then
9377 yyy=`$run ./try`
9378 case "$yyy" in
9379 123.456)
9380 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9381 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9382 echo "We will use %lf."
9383 ;;
9384 esac
9385 fi
9386fi
9387
9388if $test X"$sPRIfldbl" = X; then
9389 echo "Cannot figure out how to print long doubles." >&4
9390else
9391 sSCNfldbl=$sPRIfldbl # expect consistency
9392fi
9393
9394$rm -f try try.*
9395
9396fi # d_longdbl
9397
9398case "$sPRIfldbl" in
9399'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9400 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9401 d_SCNfldbl="$undef";
9402 ;;
9403*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9404 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9405 d_SCNfldbl="$define";
9406 ;;
9407esac
9408
b4eb6b3d 9409: Check how to convert floats to strings.
a5b10d80
YST
9410
9411if test "X$d_Gconvert" = X; then
9412
b4eb6b3d
JH
9413echo " "
9414echo "Checking for an efficient way to convert floats to strings."
9415echo " " > try.c
9416case "$uselongdouble" in
9417"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9418esac
9419case "$d_longdbl" in
9420"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9421esac
9422case "$d_PRIgldbl" in
9423"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9424esac
9425$cat >>try.c <<EOP
9426#ifdef TRY_gconvert
9427#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9428char *myname = "gconvert";
9429#endif
9430#ifdef TRY_gcvt
9431#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9432char *myname = "gcvt";
9433#endif
9434#ifdef TRY_qgcvt
9435#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9436char *myname = "qgcvt";
9437#define DOUBLETYPE long double
9438#endif
9439#ifdef TRY_sprintf
a5b10d80
YST
9440#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9441#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9442#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9443#else
a5b10d80
YST
9444#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9445#endif
9446#else
b4eb6b3d
JH
9447#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9448#endif
9449char *myname = "sprintf";
9450#endif
9451
9452#ifndef DOUBLETYPE
9453#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9454#define DOUBLETYPE long double
9455#else
9456#define DOUBLETYPE double
9457#endif
9458#endif
9459
9460#include <stdio.h>
9461
9462#define I_STDLIB $i_stdlib
9463#ifdef I_STDLIB
9464#include <stdlib.h>
9465#endif
9466
9467int
9468checkit(expect, got)
9469char *expect;
9470char *got;
9471{
9472 if (strcmp(expect, got)) {
9473 printf("%s oddity: Expected %s, got %s\n",
9474 myname, expect, got);
9475 exit(1);
9476 }
9477}
9478
9479int main()
9480{
9481 char buf[64];
9482 buf[63] = '\0';
9483
9484 /* This must be 1st test on (which?) platform */
9485 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9486 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9487 checkit("0.1", buf);
9488
a5b10d80
YST
9489 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9490 checkit("0.01", buf);
9491
9492 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9493 checkit("0.001", buf);
9494
9495 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9496 checkit("0.0001", buf);
9497
9498 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9499 if (strlen(buf) > 5)
9500 checkit("9e-005", buf); /* for Microsoft ?? */
9501 else
9502 checkit("9e-05", buf);
9503
b4eb6b3d
JH
9504 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9505 checkit("1", buf);
9506
9507 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9508 checkit("1.1", buf);
9509
9510 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9511 checkit("1.01", buf);
9512
9513 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9514 checkit("1.001", buf);
9515
9516 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9517 checkit("1.0001", buf);
9518
9519 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9520 checkit("1.00001", buf);
9521
9522 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9523 checkit("1.000001", buf);
9524
9525 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9526 checkit("0", buf);
9527
9528 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9529 checkit("-1", buf);
9530
9531 /* Some Linux gcvt's give 1.e+5 here. */
9532 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9533 checkit("100000", buf);
9534
9535 /* Some Linux gcvt's give -1.e+5 here. */
9536 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9537 checkit("-100000", buf);
9538
9539 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9540 checkit("123.456", buf);
9541
ab6ca9f4 9542 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9543 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9544 /* 34 should be enough to scare even long double
9545 * places into using the e notation. */
ab6ca9f4 9546 if (strlen(buf) > 5)
94b339ad 9547 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9548 else
94b339ad 9549 checkit("1e+34", buf);
8e2a5ede 9550
d1eb8299
YST
9551 /* For Perl, if you add additional tests here, also add them to
9552 * t/base/num.t for benefit of platforms not using Configure or
9553 * overriding d_Gconvert */
9554
b4eb6b3d
JH
9555 exit(0);
9556}
9557EOP
ab6ca9f4 9558: first add preferred functions to our list
a5b10d80 9559xxx_list=""
ab6ca9f4 9560for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9561 case $xxx_convert in
9562 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9563 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
a5b10d80
YST
9564 esac
9565done
9566: then add any others
9567for xxx_convert in gconvert gcvt sprintf; do
9568 case "$xxx_list" in
9569 *$xxx_convert*) ;;
9570 *) xxx_list="$xxx_list $xxx_convert" ;;
9571 esac
9572done
9573
9574case "$d_longdbl$uselongdouble" in
9575"$define$define")
9576 : again, add prefered functions to our list first
9577 xxx_ld_list=""
ab6ca9f4 9578 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9579 case $xxx_convert in
9580 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9581 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9582 esac
9583 done
9584 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9585 for xxx_convert in qgcvt sprintf $xxx_list; do
9586 case "$xxx_ld_list" in
9587 $xxx_convert*|*" $xxx_convert"*) ;;
9588 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9589 esac
9590 done
9591 : if sprintf cannot do long doubles, move it to the end
9592 if test "$d_PRIgldbl" != "$define"; then
9593 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9594 fi
9595 : if no qgcvt, remove it
9596 if test "$d_qgcvt" != "$define"; then
9597 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9598 fi
9599 : use the ld_list
9600 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9601 ;;
9602esac
9603
9604for xxx_convert in $xxx_list; do
9605 echo "Trying $xxx_convert..."
9606 $rm -f try try$_o
9607 set try -DTRY_$xxx_convert
9608 if eval $compile; then
9609 echo "$xxx_convert() found." >&4
5440bc8e 9610 if $run ./try; then
b4eb6b3d
JH
9611 echo "I'll use $xxx_convert to convert floats into a string." >&4
9612 break;
9613 else
9614 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9615 xxx_convert=''
b4eb6b3d
JH
9616 fi
9617 else
9618 echo "$xxx_convert NOT found." >&4
9619 fi
9620done
ab6ca9f4 9621
a5b10d80
YST
9622if test X$xxx_convert = X; then
9623 echo "*** WHOA THERE!!! ***" >&4
9624 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9625 xxx_convert=sprintf
9626fi
9627
b4eb6b3d
JH
9628case "$xxx_convert" in
9629gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9630gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9631qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9632*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9633 "$define$define$define")
9634 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9635 "$define$define$undef")
9636 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9637 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9638 esac
9639 ;;
9640esac
9641
a5b10d80
YST
9642fi
9643
74cac757
JH
9644: see if _fwalk exists
9645set fwalk d__fwalk
9646eval $inlibc
9647
b4eb6b3d
JH
9648: Initialize h_fcntl
9649h_fcntl=false
9650
9651: Initialize h_sysfile
9652h_sysfile=false
9653
9654: access call always available on UNIX
9655set access d_access
9656eval $inlibc
9657
9658: locate the flags for 'access()'
9659case "$d_access" in
9660"$define")
9661 echo " "
55954f19 9662 $cat >access.c <<EOCP
b4eb6b3d
JH
9663#include <sys/types.h>
9664#ifdef I_FCNTL
9665#include <fcntl.h>
9666#endif
9667#ifdef I_SYS_FILE
9668#include <sys/file.h>
9669#endif
9670#ifdef I_UNISTD
9671#include <unistd.h>
9672#endif
55954f19
JH
9673#$i_stdlib I_STDLIB
9674#ifdef I_STDLIB
9675#include <stdlib.h>
9676#endif
b4eb6b3d
JH
9677int main() {
9678 exit(R_OK);
9679}
9680EOCP
9681 : check sys/file.h first, no particular reason here
9682 if $test `./findhdr sys/file.h` && \
7a282f6d 9683 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9684 h_sysfile=true;
9685 echo "<sys/file.h> defines the *_OK access constants." >&4
9686 elif $test `./findhdr fcntl.h` && \
7a282f6d 9687 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9688 h_fcntl=true;
9689 echo "<fcntl.h> defines the *_OK access constants." >&4
9690 elif $test `./findhdr unistd.h` && \
7a282f6d 9691 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9692 echo "<unistd.h> defines the *_OK access constants." >&4
9693 else
9694 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9695 fi
9696 ;;
9697esac
9698$rm -f access*
9699
9700: see if accessx exists
9701set accessx d_accessx
9702eval $inlibc
9703
89ce900e
JH
9704: see if aintl exists
9705set aintl d_aintl
9706eval $inlibc
9707
b4eb6b3d
JH
9708: see if alarm exists
9709set alarm d_alarm
9710eval $inlibc
9711
a9dade78
JH
9712: see if POSIX threads are available
9713set pthread.h i_pthread
9714eval $inhdr
9715
10bc17b6
JH
9716: define a fucntion to check prototypes
9717$cat > protochk <<EOSH
9718$startsh
9719cc="$cc"
9720optimize="$optimize"
9721ccflags="$ccflags"
9722prototype="$prototype"
9723define="$define"
9724rm=$rm
a9dade78
JH
9725usethreads=$usethreads
9726i_pthread=$i_pthread
9727pthread_h_first=$pthread_h_first
10bc17b6
JH
9728EOSH
9729
9730$cat >> protochk <<'EOSH'
9731
9732$rm -f try.c
9733foo="$1"
9734shift
9735while test $# -ge 2; do
9736 case "$1" in
9737 $define) echo "#include <$2>" >> try.c ;;
9738 literal) echo "$2" >> try.c ;;
9739 esac
cce6a207
MB
9740 # Extra magic for the benefit of systems that need pthread.h
9741 # to be included early to correctly detect threadsafe functions.
9742 # Such functions must guarantee themselves, though, that the usethreads
9743 # and i_pthread have been defined, before calling protochk.
9744 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9745 echo "#include <pthread.h>" >> try.c
9746 pthread_h_done=yes
9747 fi
10bc17b6
JH
9748 shift 2
9749done
9750test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
9751cat >> try.c <<'EOCP'
9752#ifdef CAN_PROTOTYPE
9753#define _(args) args
9754#else
9755#define _(args) ()
9756#endif
9757EOCP
9758echo "$foo" >> try.c
9759echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9760$cc $optimize $ccflags -c try.c > /dev/null 2>&1
9761status=$?
9762$rm -f try.[co]
9763exit $status
9764EOSH
9765chmod +x protochk
9766$eunicefix protochk
9767
89ce900e
JH
9768hasproto='varname=$1; func=$2; shift; shift;
9769while $test $# -ge 2; do
9770 case "$1" in
9771 $define) echo "#include <$2>";;
9772 esac ;
9773 shift 2;
9774done > try.c;
9775$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9776if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9777 echo "$func() prototype found.";
9778 val="$define";
9779else
9780 echo "$func() prototype NOT found.";
9781 val="$undef";
9782fi;
9783set $varname;
9784eval $setvar;
9785$rm -f try.c tryout.c'
9786
10bc17b6
JH
9787: see if sys/types.h has to be included
9788set sys/types.h i_systypes
9789eval $inhdr
9790
9791: see if sys/select.h has to be included
9792set sys/select.h i_sysselct
9793eval $inhdr
9794
9795hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9796while $test $# -ge 2; do
9797 case "$1" in
9798 $define) echo "#include <$2>";;
9799 esac ;
9800 shift 2;
9801done > try.c;
9802echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9803set try;
9804if eval $compile; then
9805 val="$define";
9806else
9807 val="$undef";
9808fi;
9809set $varname;
9810eval $setvar;
9811$rm -f try.c try.o'
9812
9813: see if we should include time.h, sys/time.h, or both
9814echo " "
9815if test "X$timeincl" = X; then
9816 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9817 $echo $n "I'm now running the test program...$c"
55954f19 9818 $cat >try.c <<EOCP
10bc17b6
JH
9819#include <sys/types.h>
9820#ifdef I_TIME
9821#include <time.h>
9822#endif
9823#ifdef I_SYSTIME
9824#ifdef SYSTIMEKERNEL
9825#define KERNEL
9826#endif
9827#include <sys/time.h>
9828#endif
9829#ifdef I_SYSSELECT
9830#include <sys/select.h>
9831#endif
55954f19
JH
9832#$i_stdlib I_STDLIB
9833#ifdef I_STDLIB
9834#include <stdlib.h>
9835#endif
10bc17b6
JH
9836int main()
9837{
9838 struct tm foo;
9839#ifdef S_TIMEVAL
9840 struct timeval bar;
9841#endif
9842#ifdef S_TIMEZONE
9843 struct timezone tzp;
9844#endif
9845 if (foo.tm_sec == foo.tm_sec)
9846 exit(0);
9847#ifdef S_TIMEVAL
9848 if (bar.tv_sec == bar.tv_sec)
9849 exit(0);
9850#endif
9851 exit(1);
9852}
9853EOCP
9854 flags=''
9855 for s_timezone in '-DS_TIMEZONE' ''; do
9856 sysselect=''
9857 for s_timeval in '-DS_TIMEVAL' ''; do
9858 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9859 for i_time in '' '-DI_TIME'; do
9860 for i_systime in '-DI_SYSTIME' ''; do
9861 case "$flags" in
9862 '') $echo $n ".$c"
9863 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9864 if eval $compile; then
9865 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9866 shift
9867 flags="$*"
9868 echo " "
9869 $echo $n "Succeeded with $flags$c"
9870 fi
9871 ;;
9872 esac
9873 done
9874 done
9875 done
9876 done
9877 done
9878 timeincl=''
9879 echo " "
9880 case "$flags" in
9881 *SYSTIMEKERNEL*) i_systimek="$define"
9882 timeincl=`./findhdr sys/time.h`
9883 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9884 *) i_systimek="$undef";;
9885 esac
9886 case "$flags" in
9887 *I_TIME*) i_time="$define"
9888 timeincl=`./findhdr time.h`" $timeincl"
9889 echo "We'll include <time.h>." >&4;;
9890 *) i_time="$undef";;
9891 esac
9892 case "$flags" in
9893 *I_SYSTIME*) i_systime="$define"
9894 timeincl=`./findhdr sys/time.h`" $timeincl"
9895 echo "We'll include <sys/time.h>." >&4;;
9896 *) i_systime="$undef";;
9897 esac
9898 $rm -f try.c try
9899fi
9900: see if struct tm knows about tm_zone
9901case "$i_systime$i_time" in
9902*$define*)
9903 echo " "
9904 echo "Checking to see if your struct tm has tm_zone field..." >&4
9905 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9906 eval $hasfield
9907 ;;
9908*) val="$undef"
9909 set d_tm_tm_zone
9910 eval $setvar
9911 ;;
9912esac
9913case "$d_tm_tm_zone" in
9914"$define") echo "Yes, it does." ;;
9915*) echo "No, it doesn't." ;;
9916esac
9917: see if struct tm knows about tm_gmtoff
9918case "$i_systime$i_time" in
9919*$define*)
9920 echo " "
9921 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9922 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9923 eval $hasfield
9924 ;;
9925*) val="$undef"
9926 set d_tm_tm_gmtoff
9927 eval $setvar
9928 ;;
9929esac
9930case "$d_tm_tm_gmtoff" in
9931"$define") echo "Yes, it does." ;;
9932*) echo "No, it doesn't." ;;
9933esac
9934
9935: see if asctime_r exists
9936set asctime_r d_asctime_r
9937eval $inlibc
9938case "$d_asctime_r" in
9939"$define")
d63eadf0 9940 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
9941 case "$d_asctime_r_proto:$usethreads" in
9942 ":define") d_asctime_r_proto=define
a48ec845
JH
9943 set d_asctime_r_proto asctime_r $hdrs
9944 eval $hasproto ;;
9945 *) ;;
9946 esac
9947 case "$d_asctime_r_proto" in
9948 define)
10bc17b6
JH
9949 case "$asctime_r_proto" in
9950 ''|0) try='char* asctime_r(const struct tm*, char*);'
9951 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9952 esac
9953 case "$asctime_r_proto" in
9954 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9955 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9956 esac
9957 case "$asctime_r_proto" in
9958 ''|0) try='int asctime_r(const struct tm*, char*);'
9959 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9960 esac
9961 case "$asctime_r_proto" in
9962 ''|0) try='int asctime_r(const struct tm*, char*, int);'
9963 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9964 esac
9965 case "$asctime_r_proto" in
90e831dc 9966 ''|0) d_asctime_r=undef
10bc17b6 9967 asctime_r_proto=0
a48ec845 9968 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
9969 * ) case "$asctime_r_proto" in
9970 REENTRANT_PROTO*) ;;
9971 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9972 esac
9973 echo "Prototype: $try" ;;
9974 esac
9975 ;;
c18e646a
JH
9976 *) case "$usethreads" in
9977 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9978 esac
90e831dc
SB
9979 d_asctime_r=undef
9980 asctime_r_proto=0
c18e646a 9981 ;;
a48ec845
JH
9982 esac
9983 ;;
10bc17b6
JH
9984*) asctime_r_proto=0
9985 ;;
9986esac
9987
b4eb6b3d
JH
9988: see if atolf exists
9989set atolf d_atolf
9990eval $inlibc
9991
9992: see if atoll exists
9993set atoll d_atoll
9994eval $inlibc
9995
0dbb1585
AL
9996: Look for GCC-style attribute format
9997case "$d_attribute_format" in
bde30f85 9998'')
b4eb6b3d 9999echo " "
0dbb1585 10000echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
b4eb6b3d
JH
10001$cat >attrib.c <<'EOCP'
10002#include <stdio.h>
0dbb1585 10003void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
b4eb6b3d
JH
10004EOCP
10005if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10006 if $contains 'warning' attrib.out >/dev/null 2>&1; then
0dbb1585 10007 echo "Your C compiler doesn't support __attribute__((format))."
b4eb6b3d
JH
10008 val="$undef"
10009 else
0dbb1585 10010 echo "Your C compiler supports __attribute__((format))."
b4eb6b3d
JH
10011 val="$define"
10012 fi
10013else
10014 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10015 val="$undef"
10016fi
bde30f85 10017;;
0dbb1585 10018*) val="$d_attribute_format" ;;
bde30f85 10019esac
0dbb1585
AL
10020set d_attribute_format
10021eval $setvar
10022$rm -f attrib*
10023
dcb594bc
MB
10024: Look for GCC-style attribute format with null format allowed
10025case "$d_printf_format_null" in
10026'') case "$d_attribute_format" in
10027 $define)
10028 echo " "
10029 echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10030$cat >attrib.c <<EOCP
10031#include <stdio.h>
10032#$i_stdlib I_STDLIB
10033#ifdef I_STDLIB
10034#include <stdlib.h>
10035#endif
10036int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10037int null_printf (char* pat,...) { return (int)pat; }
10038int main () { exit(null_printf(NULL)); }
10039EOCP
10040 if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10041 : run the executable in case it produces a run-time warning
10042 if $run ./attrib >>attrib.out 2>&1; then
10043 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10044 echo "Your C compiler doesn't allow __printf__ format to be null."
10045 val="$undef"
10046 else
10047 echo "Your C compiler allows __printf__ format to be null."
10048 val="$define"
10049 fi
10050 else
10051 echo "Your C compiler executable failed with __printf__ format null."
10052 val="$undef"
10053 fi
10054 else
10055 echo "Your C compiler fails with __printf__ format null."
10056 val="$undef"
10057 fi
10058 ;;
10059 *) val="$undef" ;;
10060 esac
10061;;
10062*) val="$d_printf_format_null" ;;
10063esac
10064set d_printf_format_null
10065eval $setvar
10066$rm -f attrib*
10067
0dbb1585
AL
10068: Look for GCC-style attribute malloc
10069case "$d_attribute_malloc" in
10070'')
10071echo " "
10072echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10073$cat >attrib.c <<'EOCP'
10074#include <stdio.h>
10075char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10076EOCP
10077if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10078 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10079 echo "Your C compiler doesn't support __attribute__((malloc))."
10080 val="$undef"
10081 else
10082 echo "Your C compiler supports __attribute__((malloc))."
10083 val="$define"
10084 fi
10085else
10086 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10087 val="$undef"
10088fi
10089;;
10090*) val="$d_attribute_malloc" ;;
10091esac
10092set d_attribute_malloc
10093eval $setvar
10094$rm -f attrib*
10095
10096: Look for GCC-style attribute nonnull
10097case "$d_attribute_nonnull" in
10098'')
10099echo " "
10100echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10101$cat >attrib.c <<'EOCP'
10102#include <stdio.h>
10103void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10104EOCP
10105if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10106 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10107 echo "Your C compiler doesn't support __attribute__((nonnull))."
10108 val="$undef"
10109 else
10110 echo "Your C compiler supports __attribute__((nonnull))."
10111 val="$define"
10112 fi
10113else
10114 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10115 val="$undef"
10116fi
10117;;
10118*) val="$d_attribute_nonnull" ;;
10119esac
10120set d_attribute_nonnull
10121eval $setvar
10122$rm -f attrib*
10123
10124: Look for GCC-style attribute noreturn
10125case "$d_attribute_noreturn" in
10126'')
10127echo " "
10128echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10129$cat >attrib.c <<'EOCP'
10130#include <stdio.h>
10131void fall_over_dead( void ) __attribute__((noreturn));
10132EOCP
10133if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10134 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10135 echo "Your C compiler doesn't support __attribute__((noreturn))."
10136 val="$undef"
10137 else
10138 echo "Your C compiler supports __attribute__((noreturn))."
10139 val="$define"
10140 fi
10141else
10142 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10143 val="$undef"
10144fi
10145;;
10146*) val="$d_attribute_noreturn" ;;
10147esac
10148set d_attribute_noreturn
10149eval $setvar
10150$rm -f attrib*
10151
10152: Look for GCC-style attribute pure
10153case "$d_attribute_pure" in
10154'')
10155echo " "
10156echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10157$cat >attrib.c <<'EOCP'
10158#include <stdio.h>
10159int square( int n ) __attribute__((pure));
10160EOCP
10161if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10162 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10163 echo "Your C compiler doesn't support __attribute__((pure))."
10164 val="$undef"
10165 else
10166 echo "Your C compiler supports __attribute__((pure))."
10167 val="$define"
10168 fi
10169else
10170 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10171 val="$undef"
10172fi
10173;;
10174*) val="$d_attribute_pure" ;;
10175esac
10176set d_attribute_pure
10177eval $setvar
10178$rm -f attrib*
10179
10180: Look for GCC-style attribute unused
10181case "$d_attribute_unused" in
10182'')
10183echo " "
10184echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10185$cat >attrib.c <<'EOCP'
10186#include <stdio.h>
10187int do_something( int dummy __attribute__((unused)), int n );
10188EOCP
10189if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10190 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10191 echo "Your C compiler doesn't support __attribute__((unused))."
10192 val="$undef"
10193 else
10194 echo "Your C compiler supports __attribute__((unused))."
10195 val="$define"
10196 fi
10197else
10198 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10199 val="$undef"
10200fi
10201;;
10202*) val="$d_attribute_unused" ;;
10203esac
10204set d_attribute_unused
10205eval $setvar
10206$rm -f attrib*
10207
10208: Look for GCC-style attribute warn_unused_result
10209case "$d_attribute_warn_unused_result" in
10210'')
10211echo " "
10212echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10213$cat >attrib.c <<'EOCP'
10214#include <stdio.h>
10215int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10216EOCP
10217if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10218 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10219 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10220 val="$undef"
10221 else
10222 echo "Your C compiler supports __attribute__((warn_unused_result))."
10223 val="$define"
10224 fi
10225else
10226 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10227 val="$undef"
10228fi
10229;;
10230*) val="$d_attribute_warn_unused_result" ;;
10231esac
10232set d_attribute_warn_unused_result
b4eb6b3d
JH
10233eval $setvar
10234$rm -f attrib*
10235
10236: see if bcmp exists
10237set bcmp d_bcmp
10238eval $inlibc
10239
10240: see if bcopy exists
10241set bcopy d_bcopy
10242eval $inlibc
10243
b4eb6b3d
JH
10244: see if getpgrp exists
10245set getpgrp d_getpgrp
10246eval $inlibc
10247
10248case "$d_getpgrp" in
10249"$define")
10250 echo " "
10251 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 10252 $cat >try.c <<EOP
b4eb6b3d
JH
10253#$i_unistd I_UNISTD
10254#include <sys/types.h>
10255#ifdef I_UNISTD
10256# include <unistd.h>
10257#endif
55954f19
JH
10258#$i_stdlib I_STDLIB
10259#ifdef I_STDLIB
10260#include <stdlib.h>
10261#endif
b4eb6b3d
JH
10262int main()
10263{
10264 if (getuid() == 0) {
10265 printf("(I see you are running Configure as super-user...)\n");
10266 setuid(1);
10267 }
10268#ifdef TRY_BSD_PGRP
10269 if (getpgrp(1) == 0)
10270 exit(0);
10271#else
10272 if (getpgrp() > 0)
10273 exit(0);
10274#endif
10275 exit(1);
10276}
10277EOP
5440bc8e 10278 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10279 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10280 val="$define"
5440bc8e 10281 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10282 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10283 val="$undef"
10284 else
10285 echo "I can't seem to compile and run the test program."
10286 if ./usg; then
10287 xxx="a USG one, i.e. you use getpgrp()."
10288 else
10289 # SVR4 systems can appear rather BSD-ish.
10290 case "$i_unistd" in
10291 $undef)
10292 xxx="a BSD one, i.e. you use getpgrp(pid)."
10293 val="$define"
10294 ;;
10295 $define)
10296 xxx="probably a USG one, i.e. you use getpgrp()."
10297 val="$undef"
10298 ;;
10299 esac
10300 fi
10301 echo "Assuming your getpgrp is $xxx" >&4
10302 fi
10303 ;;
10304*) val="$undef";;
10305esac
10306set d_bsdgetpgrp
10307eval $setvar
5440bc8e 10308$rm -f try try.*
b4eb6b3d
JH
10309
10310: see if setpgrp exists
10311set setpgrp d_setpgrp
10312eval $inlibc
10313
10314case "$d_setpgrp" in
10315"$define")
10316 echo " "
10317 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 10318 $cat >try.c <<EOP
b4eb6b3d
JH
10319#$i_unistd I_UNISTD
10320#include <sys/types.h>
10321#ifdef I_UNISTD
10322# include <unistd.h>
10323#endif
55954f19
JH
10324#$i_stdlib I_STDLIB
10325#ifdef I_STDLIB
10326#include <stdlib.h>
10327#endif
b4eb6b3d
JH
10328int main()
10329{
10330 if (getuid() == 0) {
10331 printf("(I see you are running Configure as super-user...)\n");
10332 setuid(1);
10333 }
10334#ifdef TRY_BSD_PGRP
10335 if (-1 == setpgrp(1, 1))
10336 exit(0);
10337#else
10338 if (setpgrp() != -1)
10339 exit(0);
10340#endif
10341 exit(1);
10342}
10343EOP
5440bc8e 10344 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10345 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10346 val="$define"
5440bc8e 10347 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10348 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10349 val="$undef"
10350 else
10351 echo "(I can't seem to compile and run the test program.)"
10352 if ./usg; then
10353 xxx="a USG one, i.e. you use setpgrp()."
10354 else
10355 # SVR4 systems can appear rather BSD-ish.
10356 case "$i_unistd" in
10357 $undef)
10358 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10359 val="$define"
10360 ;;
10361 $define)
10362 xxx="probably a USG one, i.e. you use setpgrp()."
10363 val="$undef"
10364 ;;
10365 esac
10366 fi
10367 echo "Assuming your setpgrp is $xxx" >&4
10368 fi
10369 ;;
10370*) val="$undef";;
10371esac
10372set d_bsdsetpgrp
10373eval $setvar
5440bc8e 10374$rm -f try try.*
635aebb7
AL
10375: Look for GCC-style __builtin_choose_expr
10376case "$d_builtin_choose_expr" in
10377'')
10378 echo " "
10379 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10380 $cat >try.c <<'EOCP'
10381#include <assert.h>
10382#include <stdlib.h>
10383#include <stdio.h>
10384
10385#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10386
10387int main(void) {
10388 assert( SYRINX(1) == 2112 );
10389 assert( SYRINX(1) != 5150 );
10390 assert( SYRINX(0) == 5150 );
10391 assert( SYRINX(0) != 2112 );
10392 puts( "All good!" );
10393 exit(0);
10394}
10395
10396EOCP
10397 set try
10398 if eval $compile; then
10399 echo "Your C compiler supports __builtin_choose_expr."
10400 val="$define"
10401 else
10402 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10403 val="$undef"
10404 fi
10405;;
10406*) val="$d_builtin_choose_expr" ;;
10407esac
10408
10409set d_builtin_choose_expr
10410eval $setvar
10411$rm -f try.* try core core.try.*
10412
10413: Look for GCC-style __builtin_expect
10414case "$d_builtin_expect" in
10415'')
10416 echo " "
10417 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10418 $cat >builtin.c <<'EOCP'
10419int main(void) {
10420 int n = 50;
10421 if ( __builtin_expect(n, 0) ) n = 1;
10422}
10423EOCP
10424 set try
10425 if eval $compile; then
10426 echo "Your C compiler supports __builtin_choose_expr."
10427 val="$define"
10428 else
10429 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10430 val="$undef"
10431 fi
10432 ;;
10433*) val="$d_builtin_expect" ;;
10434esac
10435
10436set d_builtin_expect
10437eval $setvar
10438$rm -f try.* try core core.try.*
10439
b4eb6b3d
JH
10440: see if bzero exists
10441set bzero d_bzero
10442eval $inlibc
10443
a2d23ec2
MB
10444: see if stdarg is available
10445echo " "
10446if $test `./findhdr stdarg.h`; then
10447 echo "<stdarg.h> found." >&4
10448 valstd="$define"
10449else
10450 echo "<stdarg.h> NOT found." >&4
10451 valstd="$undef"
10452fi
10453
10454: see if varags is available
10455echo " "
10456if $test `./findhdr varargs.h`; then
10457 echo "<varargs.h> found." >&4
10458else
10459 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10460fi
10461
10462: set up the varargs testing programs
10463$cat > varargs.c <<EOP
10464#ifdef I_STDARG
10465#include <stdarg.h>
10466#endif
10467#ifdef I_VARARGS
10468#include <varargs.h>
10469#endif
10470
10471#ifdef I_STDARG
10472int f(char *p, ...)
10473#else
10474int f(va_alist)
10475va_dcl
10476#endif
10477{
10478 va_list ap;
10479#ifndef I_STDARG
10480 char *p;
10481#endif
10482#ifdef I_STDARG
10483 va_start(ap,p);
10484#else
10485 va_start(ap);
10486 p = va_arg(ap, char *);
10487#endif
10488 va_end(ap);
4fb7dc7d 10489 return 0;
a2d23ec2
MB
10490}
10491EOP
10492$cat > varargs <<EOP
10493$startsh
10494if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10495 echo "true"
10496else
10497 echo "false"
10498fi
10499$rm -f varargs$_o
10500EOP
10501chmod +x varargs
10502
10503: now check which varargs header should be included
10504echo " "
10505i_varhdr=''
10506case "$valstd" in
10507"$define")
10508 if `./varargs I_STDARG`; then
10509 val='stdarg.h'
10510 elif `./varargs I_VARARGS`; then
10511 val='varargs.h'
10512 fi
10513 ;;
10514*)
10515 if `./varargs I_VARARGS`; then
10516 val='varargs.h'
10517 fi
10518 ;;
10519esac
10520case "$val" in
10521'')
10522echo "I could not find the definition for va_dcl... You have problems..." >&4
10523 val="$undef"; set i_stdarg; eval $setvar
10524 val="$undef"; set i_varargs; eval $setvar
10525 ;;
10526*)
10527 set i_varhdr
10528 eval $setvar
10529 case "$i_varhdr" in
10530 stdarg.h)
10531 val="$define"; set i_stdarg; eval $setvar
10532 val="$undef"; set i_varargs; eval $setvar
10533 ;;
10534 varargs.h)
10535 val="$undef"; set i_stdarg; eval $setvar
10536 val="$define"; set i_varargs; eval $setvar
10537 ;;
10538 esac
10539 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10540esac
10541$rm -f varargs*
10542
10543: see if the Compiler supports C99 variadic macros
10544case "$i_stdarg$i_stdlib" in
10545 "$define$define")
10546 echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10547 $cat >try.c <<EOCP
10548#include <stdio.h>
10549#include <stdarg.h>
10550
10551#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10552
10553int main() {
10554 char buf[20];
10555 foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10556 puts(buf);
10557 return 0;
10558}
10559EOCP
10560 set try
10561 if eval $compile && $run ./try 2>&1 >/dev/null; then
10562 case "`$run ./try`" in
10563 "123 456 789")
10564 echo "You have C99 variadic macros." >&4
10565 d_c99_variadic_macros="$define"
10566 ;;
10567 *)
10568 echo "You don't have functional C99 variadic macros." >&4
10569 d_c99_variadic_macros="$undef"
10570 ;;
10571 esac
10572 else
10573 echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10574 d_c99_variadic_macros="$undef"
10575 fi
10576 $rm -f try.* try core core.try.*
10577 ;;
10578 *)
10579 echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10580 d_c99_variadic_macros="$undef"
10581 ;;
10582esac
10583
b4eb6b3d
JH
10584: see if signal is declared as pointer to function returning int or void
10585echo " "
10586xxx=`./findhdr signal.h`
10587$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10588if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10589 echo "You have int (*signal())() instead of void." >&4
10590 val="$undef"
10591elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10592 echo "You have void (*signal())()." >&4
10593 val="$define"
10594elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10595 echo "You have int (*signal())() instead of void." >&4
10596 val="$undef"
10597elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10598 echo "You have void (*signal())()." >&4
10599 val="$define"
10600else
10601 case "$d_voidsig" in
10602 '')
10603 echo "I can't determine whether signal handler returns void or int..." >&4
10604 dflt=void
10605 rp="What type does your signal handler return?"
10606 . ./myread
10607 case "$ans" in
10608 v*) val="$define";;
10609 *) val="$undef";;
10610 esac;;
10611 "$define")
10612 echo "As you already told me, signal handler returns void." >&4
10613 val="$define"
10614 ;;
10615 *) echo "As you already told me, signal handler returns int." >&4
10616 val="$undef"
10617 ;;
10618 esac
10619fi
10620set d_voidsig
10621eval $setvar
10622case "$d_voidsig" in
10623"$define") signal_t="void";;
10624*) signal_t="int";;
10625esac
10626$rm -f $$.tmp
10627
10628: check for ability to cast large floats to 32-bit ints.
10629echo " "
10630echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10631if $test "$intsize" -ge 4; then
10632 xxx=int
10633else
10634 xxx=long
10635fi
10636$cat >try.c <<EOCP
10637#include <stdio.h>
d1daaddf
JH
10638#$i_stdlib I_STDLIB
10639#ifdef I_STDLIB
10640#include <stdlib.h>
10641#endif
b4eb6b3d
JH
10642#include <sys/types.h>
10643#include <signal.h>
7090f861 10644$signal_t blech(int s) { exit(3); }
b4eb6b3d
JH
10645int main()
10646{
10647 $xxx i32;
10648 double f, g;
10649 int result = 0;
10650 char str[16];
10651 signal(SIGFPE, blech);
10652
10653 /* Don't let compiler optimize the test away. Store the number
10654 in a writable string for gcc to pass to sscanf under HP/UX.
10655 */
10656 sprintf(str, "2147483647");
10657 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10658 g = 10 * f;
10659 i32 = ($xxx) g;
10660
10661 /* x86 processors will probably give 0x8000 0000, which is a
4a39fcde 10662 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
10663 behavior here, which is to preserve the sign and give
10664 back 0x7fff ffff.
10665 */
10666 if (i32 != ($xxx) f)
10667 result |= 1;
10668 exit(result);
10669}
10670EOCP
10671set try
10672if eval $compile_ok; then
5440bc8e 10673 $run ./try
b4eb6b3d
JH
10674 yyy=$?
10675else
10676 echo "(I can't seem to compile the test program--assuming it can't)"
10677 yyy=1
10678fi
10679case "$yyy" in
106800) val="$define"
10681 echo "Yup, it can."
10682 ;;
10683*) val="$undef"
10684 echo "Nope, it can't."
10685 ;;
10686esac
10687set d_casti32
10688eval $setvar
10689$rm -f try try.*
10690
10691: check for ability to cast negative floats to unsigned
10692echo " "
10693echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10694$cat >try.c <<EOCP
10695#include <stdio.h>
d1daaddf
JH
10696#$i_stdlib I_STDLIB
10697#ifdef I_STDLIB
10698#include <stdlib.h>
10699#endif
b4eb6b3d
JH
10700#include <sys/types.h>
10701#include <signal.h>
7090f861
JH
10702$signal_t blech(int s) { exit(7); }
10703$signal_t blech_in_list(int s) { exit(4); }
10704unsigned long dummy_long(unsigned long p) { return p; }
10705unsigned int dummy_int(unsigned int p) { return p; }
10706unsigned short dummy_short(unsigned short p) { return p; }
b4eb6b3d
JH
10707int main()
10708{
10709 double f;
10710 unsigned long along;
10711 unsigned int aint;
10712 unsigned short ashort;
10713 int result = 0;
10714 char str[16];
10715
10716 /* Frustrate gcc-2.7.2's optimizer which failed this test with
10717 a direct f = -123. assignment. gcc-2.8.0 reportedly
10718 optimized the whole file away
10719 */
10720 /* Store the number in a writable string for gcc to pass to
10721 sscanf under HP/UX.
10722 */
10723 sprintf(str, "-123");
10724 sscanf(str, "%lf", &f); /* f = -123.; */
10725
10726 signal(SIGFPE, blech);
10727 along = (unsigned long)f;
10728 aint = (unsigned int)f;
10729 ashort = (unsigned short)f;
10730 if (along != (unsigned long)-123)
10731 result |= 1;
10732 if (aint != (unsigned int)-123)
10733 result |= 1;
10734 if (ashort != (unsigned short)-123)
10735 result |= 1;
10736 sprintf(str, "1073741824.");
10737 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10738 f = f + f;
10739 along = 0;
10740 along = (unsigned long)f;
10741 if (along != 0x80000000)
10742 result |= 2;
10743 f -= 1.;
10744 along = 0;
10745 along = (unsigned long)f;
10746 if (along != 0x7fffffff)
10747 result |= 1;
10748 f += 2.;
10749 along = 0;
10750 along = (unsigned long)f;
10751 if (along != 0x80000001)
10752 result |= 2;
10753 if (result)
10754 exit(result);
10755 signal(SIGFPE, blech_in_list);
10756 sprintf(str, "123.");
10757 sscanf(str, "%lf", &f); /* f = 123.; */
10758 along = dummy_long((unsigned long)f);
10759 aint = dummy_int((unsigned int)f);
10760 ashort = dummy_short((unsigned short)f);
10761 if (along != (unsigned long)123)
10762 result |= 4;
10763 if (aint != (unsigned int)123)
10764 result |= 4;
10765 if (ashort != (unsigned short)123)
10766 result |= 4;
10767 exit(result);
10768
10769}
10770EOCP
10771set try
10772if eval $compile_ok; then
5440bc8e 10773 $run ./try
b4eb6b3d
JH
10774 castflags=$?
10775else
10776 echo "(I can't seem to compile the test program--assuming it can't)"
10777 castflags=7
10778fi
10779case "$castflags" in
107800) val="$define"
10781 echo "Yup, it can."
10782 ;;
10783*) val="$undef"
10784 echo "Nope, it can't."
10785 ;;
10786esac
10787set d_castneg
10788eval $setvar
10789$rm -f try.*
10790
10791: see if vprintf exists
10792echo " "
10793if set vprintf val -f d_vprintf; eval $csym; $val; then
10794 echo 'vprintf() found.' >&4
10795 val="$define"
55954f19 10796 $cat >try.c <<EOF
b4eb6b3d 10797#include <varargs.h>
55954f19
JH
10798#$i_stdlib I_STDLIB
10799#ifdef I_STDLIB
10800#include <stdlib.h>
10801#endif
b4eb6b3d
JH
10802
10803int main() { xxx("foo"); }
10804
10805xxx(va_alist)
10806va_dcl
10807{
10808 va_list args;
10809 char buf[10];
10810
10811 va_start(args);
10812 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10813}
10814EOF
5440bc8e
JH
10815 set try
10816 if eval $compile && $run ./try; then
b4eb6b3d
JH
10817 echo "Your vsprintf() returns (int)." >&4
10818 val2="$undef"
10819 else
10820 echo "Your vsprintf() returns (char*)." >&4
10821 val2="$define"
10822 fi
10823else
10824 echo 'vprintf() NOT found.' >&4
10825 val="$undef"
10826 val2="$undef"
10827fi
5440bc8e 10828$rm -f try try.*
b4eb6b3d
JH
10829set d_vprintf
10830eval $setvar
10831val=$val2
10832set d_charvspr
10833eval $setvar
10834
10835: see if chown exists
10836set chown d_chown
10837eval $inlibc
10838
10839: see if chroot exists
10840set chroot d_chroot
10841eval $inlibc
10842
10843: see if chsize exists
10844set chsize d_chsize
10845eval $inlibc
10846
758a5d79
JH
10847: see if class exists
10848set class d_class
10849eval $inlibc
10850
b0a2e8e6
MB
10851: see if clearenv exists
10852set clearenv d_clearenv
10853eval $inlibc
10854
4e0554ec
JH
10855hasstruct='varname=$1; struct=$2; shift; shift;
10856while $test $# -ge 2; do
10857 case "$1" in
10858 $define) echo "#include <$2>";;
10859 esac ;
10860 shift 2;
10861done > try.c;
10862echo "int main () { struct $struct foo; }" >> try.c;
10863set try;
10864if eval $compile; then
10865 val="$define";
10866else
10867 val="$undef";
10868fi;
10869set $varname;
10870eval $setvar;
10871$rm -f try.c try.o'
10872
4e0554ec
JH
10873socketlib=''
10874sockethdr=''
10875: see whether socket exists
10876echo " "
10877$echo $n "Hmm... $c" >&4
10878if set socket val -f d_socket; eval $csym; $val; then
10879 echo "Looks like you have Berkeley networking support." >&4
10880 d_socket="$define"
10881 if set setsockopt val -f; eval $csym; $val; then
10882 d_oldsock="$undef"
10883 else
10884 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10885 d_oldsock="$define"
10886 fi
10887else
10888 if $contains socklib libc.list >/dev/null 2>&1; then
10889 echo "Looks like you have Berkeley networking support." >&4
10890 d_socket="$define"
10891 : we will have to assume that it supports the 4.2 BSD interface
10892 d_oldsock="$undef"
10893 else
10894 echo "You don't have Berkeley networking in libc$_a..." >&4
10895 if test "X$d_socket" = "X$define"; then
10896 echo "...but you seem to believe that you have sockets." >&4
10897 else
10898 for net in net socket
10899 do
10900 if test -f /usr/lib/lib$net$_a; then
10901 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
10902 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10903 if $contains socket libc.list >/dev/null 2>&1; then
10904 d_socket="$define"
10905 socketlib="-l$net"
10906 case "$net" in
10907 net)
10908 echo "...but the Wollongong group seems to have hacked it in." >&4
10909 sockethdr="-I/usr/netinclude"
10910 ;;
10911 esac
3c728e00 10912 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
10913 if $contains setsockopt libc.list >/dev/null 2>&1; then
10914 d_oldsock="$undef"
10915 else
10916 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10917 d_oldsock="$define"
10918 fi
10919 break
10920 fi
10921 fi
10922 done
10923 if test "X$d_socket" != "X$define"; then
10924 echo "or anywhere else I see." >&4
10925 d_socket="$undef"
10926 d_oldsock="$undef"
10927 fi
10928 fi
10929 fi
10930fi
10931
10932: see if socketpair exists
10933set socketpair d_sockpair
10934eval $inlibc
10935
10936
10937echo " "
3c728e00 10938echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
10939for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10940 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10941 $cat >try.c <<EOF
10942#include <sys/types.h>
10943#include <sys/socket.h>
10944int main() {
10945 int i = $ENUM;
10946}
10947EOF
10948 val="$undef"
10949 set try; if eval $compile; then
10950 val="$define"
10951 fi
10952 set d_${enum}; eval $setvar
10953 $rm -f try.c try
10954done
10955
10956: see if this is a sys/uio.h system
10957set sys/uio.h i_sysuio
10958eval $inhdr
10959
10960
10961echo " "
10962echo "Checking to see if your system supports struct cmsghdr..." >&4
10963set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10964eval $hasstruct
10965case "$d_cmsghdr_s" in
10966"$define") echo "Yes, it does." ;;
10967*) echo "No, it doesn't." ;;
10968esac
10969
10970
b4eb6b3d
JH
10971: check for const keyword
10972echo " "
10973echo 'Checking to see if your C compiler knows about "const"...' >&4
10974$cat >const.c <<'EOCP'
10975typedef struct spug { int drokk; } spug;
76f47787 10976int main()
b4eb6b3d
JH
10977{
10978 const char *foo;
666ea192 10979 const spug y = { 0 };
b4eb6b3d
JH
10980}
10981EOCP
10982if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10983 val="$define"
10984 echo "Yup, it does."
10985else
10986 val="$undef"
10987 echo "Nope, it doesn't."
10988fi
10989set d_const
10990eval $setvar
10991
89ce900e
JH
10992: see if copysignl exists
10993set copysignl d_copysignl
10994eval $inlibc
10995
b4eb6b3d
JH
10996: see if crypt exists
10997echo " "
a5a94ea5
JH
10998set crypt d_crypt
10999eval $inlibc
11000case "$d_crypt" in
11001$define) cryptlib='' ;;
11002*) if set crypt val -f d_crypt; eval $csym; $val; then
11003 echo 'crypt() found.' >&4
b4eb6b3d 11004 val="$define"
a5a94ea5
JH
11005 cryptlib=''
11006 else
11007 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11008 if $test -z "$cryptlib"; then
11009 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11010 else
11011 cryptlib=-lcrypt
11012 fi
11013 if $test -z "$cryptlib"; then
11014 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11015 else
11016 cryptlib=-lcrypt
11017 fi
11018 if $test -z "$cryptlib"; then
11019 cryptlib=`./loc libcrypt$_a "" $libpth`
11020 else
11021 cryptlib=-lcrypt
11022 fi
11023 if $test -z "$cryptlib"; then
11024 echo 'crypt() NOT found.' >&4
11025 val="$undef"
11026 else
11027 val="$define"
11028 fi
b4eb6b3d 11029 fi
a5a94ea5
JH
11030 set d_crypt
11031 eval $setvar
11032 ;;
11033esac
b4eb6b3d 11034
10bc17b6
JH
11035: see if this is a crypt.h system
11036set crypt.h i_crypt
11037eval $inhdr
11038
11039: see if crypt_r exists
11040set crypt_r d_crypt_r
11041eval $inlibc
11042case "$d_crypt_r" in
11043"$define")
11044 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
11045 case "$d_crypt_r_proto:$usethreads" in
11046 ":define") d_crypt_r_proto=define
a48ec845
JH
11047 set d_crypt_r_proto crypt_r $hdrs
11048 eval $hasproto ;;
11049 *) ;;
11050 esac
11051 case "$d_crypt_r_proto" in
11052 define)
10bc17b6
JH
11053 case "$crypt_r_proto" in
11054 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11055 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11056 esac
11057 case "$crypt_r_proto" in
b430fd04
JH
11058 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11059 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11060 esac
11061 case "$crypt_r_proto" in
90e831dc 11062 ''|0) d_crypt_r=undef
10bc17b6 11063 crypt_r_proto=0
a48ec845 11064 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11065 * ) case "$crypt_r_proto" in
11066 REENTRANT_PROTO*) ;;
11067 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11068 esac
11069 echo "Prototype: $try" ;;
11070 esac
11071 ;;
c18e646a
JH
11072 *) case "$usethreads" in
11073 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11074 esac
90e831dc
SB
11075 d_crypt_r=undef
11076 crypt_r_proto=0
c18e646a 11077 ;;
a48ec845
JH
11078 esac
11079 ;;
10bc17b6
JH
11080*) crypt_r_proto=0
11081 ;;
11082esac
11083
b4eb6b3d
JH
11084: get csh whereabouts
11085case "$csh" in
11086'csh') val="$undef" ;;
11087*) val="$define" ;;
11088esac
11089set d_csh
11090eval $setvar
11091: Respect a hint or command line value for full_csh.
11092case "$full_csh" in
11093'') full_csh=$csh ;;
11094esac
11095
13cfc98d
MB
11096: see if ctermid exists
11097set ctermid d_ctermid
11098eval $inlibc
11099
10bc17b6
JH
11100: see if ctermid_r exists
11101set ctermid_r d_ctermid_r
11102eval $inlibc
11103case "$d_ctermid_r" in
11104"$define")
31ee0cb7 11105 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
11106 case "$d_ctermid_r_proto:$usethreads" in
11107 ":define") d_ctermid_r_proto=define
a48ec845
JH
11108 set d_ctermid_r_proto ctermid_r $hdrs
11109 eval $hasproto ;;
11110 *) ;;
11111 esac
11112 case "$d_ctermid_r_proto" in
11113 define)
10bc17b6
JH
11114 case "$ctermid_r_proto" in
11115 ''|0) try='char* ctermid_r(char*);'
11116 ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11117 esac
11118 case "$ctermid_r_proto" in
90e831dc 11119 ''|0) d_ctermid_r=undef
10bc17b6 11120 ctermid_r_proto=0
a48ec845 11121 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11122 * ) case "$ctermid_r_proto" in
11123 REENTRANT_PROTO*) ;;
11124 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11125 esac
11126 echo "Prototype: $try" ;;
11127 esac
11128 ;;
c18e646a
JH
11129 *) case "$usethreads" in
11130 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11131 esac
90e831dc
SB
11132 d_ctermid_r=undef
11133 ctermid_r_proto=0
c18e646a 11134 ;;
a48ec845
JH
11135 esac
11136 ;;
10bc17b6
JH
11137*) ctermid_r_proto=0
11138 ;;
11139esac
11140
11141: see if ctime_r exists
11142set ctime_r d_ctime_r
11143eval $inlibc
11144case "$d_ctime_r" in
11145"$define")
d63eadf0 11146 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
11147 case "$d_ctime_r_proto:$usethreads" in
11148 ":define") d_ctime_r_proto=define
a48ec845
JH
11149 set d_ctime_r_proto ctime_r $hdrs
11150 eval $hasproto ;;
11151 *) ;;
11152 esac
11153 case "$d_ctime_r_proto" in
11154 define)
10bc17b6
JH
11155 case "$ctime_r_proto" in
11156 ''|0) try='char* ctime_r(const time_t*, char*);'
11157 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11158 esac
11159 case "$ctime_r_proto" in
11160 ''|0) try='char* ctime_r(const time_t*, char*, int);'
11161 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11162 esac
11163 case "$ctime_r_proto" in
11164 ''|0) try='int ctime_r(const time_t*, char*);'
11165 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11166 esac
11167 case "$ctime_r_proto" in
11168 ''|0) try='int ctime_r(const time_t*, char*, int);'
11169 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11170 esac
11171 case "$ctime_r_proto" in
90e831dc 11172 ''|0) d_ctime_r=undef
10bc17b6 11173 ctime_r_proto=0
a48ec845 11174 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11175 * ) case "$ctime_r_proto" in
11176 REENTRANT_PROTO*) ;;
11177 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11178 esac
11179 echo "Prototype: $try" ;;
11180 esac
11181 ;;
c18e646a
JH
11182 *) case "$usethreads" in
11183 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11184 esac
90e831dc
SB
11185 d_ctime_r=undef
11186 ctime_r_proto=0
c18e646a 11187 ;;
a48ec845
JH
11188 esac
11189 ;;
10bc17b6
JH
11190*) ctime_r_proto=0
11191 ;;
11192esac
11193
b4eb6b3d
JH
11194: see if cuserid exists
11195set cuserid d_cuserid
11196eval $inlibc
11197
11198: see if this is a limits.h system
11199set limits.h i_limits
11200eval $inhdr
11201
11202: see if this is a float.h system
11203set float.h i_float
11204eval $inhdr
11205
11206: See if number of significant digits in a double precision number is known
11207echo " "
11208$cat >dbl_dig.c <<EOM
11209#$i_limits I_LIMITS
11210#$i_float I_FLOAT
11211#ifdef I_LIMITS
11212#include <limits.h>
11213#endif
11214#ifdef I_FLOAT
11215#include <float.h>
11216#endif
11217#ifdef DBL_DIG
11218printf("Contains DBL_DIG");
11219#endif
11220EOM
11221$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11222if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11223 echo "DBL_DIG found." >&4
11224 val="$define"
11225else
11226 echo "DBL_DIG NOT found." >&4
11227 val="$undef"
11228fi
11229$rm -f dbl_dig.?
11230set d_dbl_dig
11231eval $setvar
11232
2ef53570
JH
11233: see if dbm.h is available
11234: see if dbmclose exists
11235set dbmclose d_dbmclose
11236eval $inlibc
11237
11238case "$d_dbmclose" in
11239$define)
11240 set dbm.h i_dbm
11241 eval $inhdr
11242 case "$i_dbm" in
11243 $define)
11244 val="$undef"
11245 set i_rpcsvcdbm
11246 eval $setvar
11247 ;;
11248 *) set rpcsvc/dbm.h i_rpcsvcdbm
11249 eval $inhdr
11250 ;;
11251 esac
11252 ;;
11253*) echo "We won't be including <dbm.h>"
11254 val="$undef"
11255 set i_dbm
11256 eval $setvar
11257 val="$undef"
11258 set i_rpcsvcdbm
11259 eval $setvar
11260 ;;
11261esac
11262
11263: see if prototype for dbminit is available
11264echo " "
11265set d_dbminitproto dbminit $i_dbm dbm.h
11266eval $hasproto
11267
b4eb6b3d
JH
11268: see if difftime exists
11269set difftime d_difftime
11270eval $inlibc
11271
11272: see if this is a dirent system
11273echo " "
11274if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11275 val="$define"
11276 echo "<dirent.h> found." >&4
11277else
11278 val="$undef"
11279 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11280 echo "<sys/dir.h> found." >&4
11281 echo " "
11282 else
11283 xinc=`./findhdr sys/ndir.h`
11284 fi
11285 echo "<dirent.h> NOT found." >&4
11286fi
11287set i_dirent
11288eval $setvar
11289
11290: Look for type of directory structure.
11291echo " "
11292$cppstdin $cppflags $cppminus < "$xinc" > try.c
11293
11294case "$direntrytype" in
11295''|' ')
11296 case "$i_dirent" in
11297 $define) guess1='struct dirent' ;;
11298 *) guess1='struct direct' ;;
11299 esac
11300 ;;
11301*) guess1="$direntrytype"
11302 ;;
11303esac
11304
11305case "$guess1" in
11306'struct dirent') guess2='struct direct' ;;
11307*) guess2='struct dirent' ;;
11308esac
11309
11310if $contains "$guess1" try.c >/dev/null 2>&1; then
11311 direntrytype="$guess1"
11312 echo "Your directory entries are $direntrytype." >&4
11313elif $contains "$guess2" try.c >/dev/null 2>&1; then
11314 direntrytype="$guess2"
11315 echo "Your directory entries seem to be $direntrytype." >&4
11316else
11317 echo "I don't recognize your system's directory entries." >&4
11318 rp="What type is used for directory entries on this system?"
11319 dflt="$guess1"
11320 . ./myread
11321 direntrytype="$ans"
11322fi
11323$rm -f try.c
11324
11325
11326: see if the directory entry stores field length
11327echo " "
11328$cppstdin $cppflags $cppminus < "$xinc" > try.c
11329if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11330 echo "Good, your directory entry keeps length information in d_namlen." >&4
11331 val="$define"
11332else
11333 echo "Your directory entry does not know about the d_namlen field." >&4
11334 val="$undef"
11335fi
11336set d_dirnamlen
11337eval $setvar
11338$rm -f try.c
11339
de52168c
SP
11340: Look for DIR.dd_fd
11341case "$i_dirent" in
11342"$define")
11343 echo "Checking to see if DIR has a dd_fd member variable" >&4
11344 $cat >try.c <<EOCP
11345#$i_stdlib I_STDLIB
11346#ifdef I_STDLIB
11347#include <stdlib.h>
11348#endif
11349#include <dirent.h>
11350
11351int main() {
11352 DIR dir;
11353 dir.dd_fd = 1;
11354 return 0;
11355}
11356EOCP
11357 val=$undef
11358 set try
11359 if eval $compile; then
11360 echo "Yes, it does."
11361 val="$define"
11362 else
11363 echo "No, it does not."
11364 val="$undef"
11365 fi
11366 ;;
11367*)
11368 echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11369 val="$undef"
11370 ;;
11371esac
11372set d_dir_dd_fd
11373eval $setvar
11374$rm -f try try.*
11375
ae0e3d3b
JH
11376: see if this is an sysdir system
11377set sys/dir.h i_sysdir
11378eval $inhdr
11379
11380: see if this is an sysndir system
11381set sys/ndir.h i_sysndir
11382eval $inhdr
11383
11384: Look for dirfd
11385echo " "
11386$cat >dirfd.c <<EOM
11387#include <stdio.h>
55954f19
JH
11388#$i_stdlib I_STDLIB
11389#ifdef I_STDLIB
11390#include <stdlib.h>
11391#endif
ae0e3d3b
JH
11392#$i_dirent I_DIRENT /**/
11393#$i_sysdir I_SYS_DIR /**/
11394#$i_sysndir I_SYS_NDIR /**/
11395#$i_systypes I_SYS_TYPES /**/
11396#if defined(I_SYS_TYPES)
11397#include <sys/types.h>
11398#endif
11399#if defined(I_DIRENT)
11400#include <dirent.h>
11401#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11402#include <sys/dir.h>
11403#endif
11404#else
11405#ifdef I_SYS_NDIR
11406#include <sys/ndir.h>
11407#else
11408#ifdef I_SYS_DIR
11409#ifdef hp9000s500
11410#include <ndir.h> /* may be wrong in the future */
11411#else
11412#include <sys/dir.h>
11413#endif
11414#endif
11415#endif
11416#endif
11417int main() {
11418 DIR *dirp = opendir(".");
11419 if (dirfd(dirp) >= 0)
11420 exit(0);
11421 else
11422 exit(1);
11423}
11424EOM
5cadb3f3 11425val=$undef
ae0e3d3b
JH
11426set dirfd
11427if eval $compile; then
11428 val="$define"
11429fi
11430case "$val" in
11431$define) echo "dirfd() found." >&4 ;;
11432*) echo "dirfd() NOT found." >&4 ;;
11433esac
11434set d_dirfd
11435eval $setvar
11436$rm -f dirfd*
11437
b4eb6b3d
JH
11438: see if dlerror exists
11439xxx_runnm="$runnm"
11440runnm=false
11441set dlerror d_dlerror
11442eval $inlibc
11443runnm="$xxx_runnm"
11444
11445: see if dlfcn is available
11446set dlfcn.h i_dlfcn
11447eval $inhdr
11448
11449case "$usedl" in
11450$define|y|true)
11451 $cat << EOM
11452
11453On a few systems, the dynamically loaded modules that perl generates and uses
11454will need a different extension than shared libs. The default will probably
11455be appropriate.
11456
11457EOM
11458 case "$dlext" in
11459 '') dflt="$so" ;;
11460 *) dflt="$dlext" ;;
11461 esac
11462 rp='What is the extension of dynamically loaded modules'
11463 . ./myread
11464 dlext="$ans"
11465 ;;
11466*)
11467 dlext="none"
11468 ;;
11469esac
11470
11471: Check if dlsym need a leading underscore
11472echo " "
11473val="$undef"
11474
11475case "$dlsrc" in
11476dl_dlopen.xs)
11477 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11478 $cat >dyna.c <<'EOM'
11479fred () { }
11480EOM
11481
11482$cat >fred.c<<EOM
11483
11484#include <stdio.h>
55954f19
JH
11485#$i_stdlib I_STDLIB
11486#ifdef I_STDLIB
11487#include <stdlib.h>
11488#endif
b4eb6b3d
JH
11489#$i_dlfcn I_DLFCN
11490#ifdef I_DLFCN
5440bc8e 11491#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
11492#else
11493#include <sys/types.h>
11494#include <nlist.h>
11495#include <link.h>
11496#endif
11497
11498extern int fred() ;
11499
11500int main()
11501{
11502 void * handle ;
11503 void * symbol ;
11504#ifndef RTLD_LAZY
11505 int mode = 1 ;
11506#else
11507 int mode = RTLD_LAZY ;
11508#endif
11509 handle = dlopen("./dyna.$dlext", mode) ;
11510 if (handle == NULL) {
11511 printf ("1\n") ;
11512 fflush (stdout) ;
11513 exit(0);
11514 }
11515 symbol = dlsym(handle, "fred") ;
11516 if (symbol == NULL) {
11517 /* try putting a leading underscore */
11518 symbol = dlsym(handle, "_fred") ;
11519 if (symbol == NULL) {
11520 printf ("2\n") ;
11521 fflush (stdout) ;
11522 exit(0);
11523 }
11524 printf ("3\n") ;
11525 }
11526 else
11527 printf ("4\n") ;
11528 fflush (stdout) ;
11529 exit(0);
11530}
11531EOM
11532 : Call the object file tmp-dyna.o in case dlext=o.
11533 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11534 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 11535 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
11536 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11537 xxx=`$run ./fred`
b4eb6b3d
JH
11538 case $xxx in
11539 1) echo "Test program failed using dlopen." >&4
11540 echo "Perhaps you should not use dynamic loading." >&4;;
11541 2) echo "Test program failed using dlsym." >&4
11542 echo "Perhaps you should not use dynamic loading." >&4;;
11543 3) echo "dlsym needs a leading underscore" >&4
11544 val="$define" ;;
11545 4) echo "dlsym doesn't need a leading underscore." >&4;;
11546 esac
11547 else
11548 echo "I can't compile and run the test program." >&4
11549 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11550 fi
11551 ;;
11552esac
11553
3c728e00 11554$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
11555
11556set d_dlsymun
11557eval $setvar
11558
10bc17b6
JH
11559: see if drand48_r exists
11560set drand48_r d_drand48_r
11561eval $inlibc
11562case "$d_drand48_r" in
11563"$define")
11564 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
11565 case "$d_drand48_r_proto:$usethreads" in
11566 ":define") d_drand48_r_proto=define
a48ec845
JH
11567 set d_drand48_r_proto drand48_r $hdrs
11568 eval $hasproto ;;
11569 *) ;;
11570 esac
11571 case "$d_drand48_r_proto" in
11572 define)
10bc17b6
JH
11573 case "$drand48_r_proto" in
11574 ''|0) try='int drand48_r(struct drand48_data*, double*);'
11575 ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11576 esac
11577 case "$drand48_r_proto" in
90e831dc 11578 ''|0) d_drand48_r=undef
10bc17b6 11579 drand48_r_proto=0
a48ec845 11580 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11581 * ) case "$drand48_r_proto" in
11582 REENTRANT_PROTO*) ;;
11583 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11584 esac
11585 echo "Prototype: $try" ;;
11586 esac
11587 ;;
c18e646a
JH
11588 *) case "$usethreads" in
11589 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11590 esac
90e831dc
SB
11591 d_drand48_r=undef
11592 drand48_r_proto=0
c18e646a 11593 ;;
a48ec845
JH
11594 esac
11595 ;;
10bc17b6
JH
11596*) drand48_r_proto=0
11597 ;;
11598esac
11599
11600: see if prototype for drand48 is available
11601echo " "
11602set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11603eval $hasproto
11604
b4eb6b3d
JH
11605: see if dup2 exists
11606set dup2 d_dup2
11607eval $inlibc
11608
11609: see if eaccess exists
11610set eaccess d_eaccess
11611eval $inlibc
11612
11613: see if endgrent exists
11614set endgrent d_endgrent
11615eval $inlibc
11616
10bc17b6
JH
11617: see if this is an grp system
11618set grp.h i_grp
11619eval $inhdr
11620
11621case "$i_grp" in
11622$define)
11623 xxx=`./findhdr grp.h`
11624 $cppstdin $cppflags $cppminus < $xxx >$$.h
11625
11626 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11627 val="$define"
11628 else
11629 val="$undef"
11630 fi
11631 set d_grpasswd
11632 eval $setvar
11633
11634 $rm -f $$.h
11635 ;;
11636*)
11637 val="$undef";
11638 set d_grpasswd; eval $setvar
11639 ;;
11640esac
11641
11642: see if endgrent_r exists
11643set endgrent_r d_endgrent_r
11644eval $inlibc
11645case "$d_endgrent_r" in
11646"$define")
11647 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11648 case "$d_endgrent_r_proto:$usethreads" in
11649 ":define") d_endgrent_r_proto=define
a48ec845
JH
11650 set d_endgrent_r_proto endgrent_r $hdrs
11651 eval $hasproto ;;
11652 *) ;;
11653 esac
11654 case "$d_endgrent_r_proto" in
11655 define)
10bc17b6
JH
11656 case "$endgrent_r_proto" in
11657 ''|0) try='int endgrent_r(FILE**);'
11658 ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11659 esac
11660 case "$endgrent_r_proto" in
11661 ''|0) try='void endgrent_r(FILE**);'
11662 ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11663 esac
11664 case "$endgrent_r_proto" in
90e831dc 11665 ''|0) d_endgrent_r=undef
10bc17b6 11666 endgrent_r_proto=0
a48ec845 11667 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11668 * ) case "$endgrent_r_proto" in
11669 REENTRANT_PROTO*) ;;
11670 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11671 esac
11672 echo "Prototype: $try" ;;
11673 esac
11674 ;;
c18e646a
JH
11675 *) case "$usethreads" in
11676 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11677 esac
90e831dc
SB
11678 d_endgrent_r=undef
11679 endgrent_r_proto=0
c18e646a 11680 ;;
a48ec845
JH
11681 esac
11682 ;;
10bc17b6
JH
11683*) endgrent_r_proto=0
11684 ;;
11685esac
11686
b4eb6b3d
JH
11687: see if endhostent exists
11688set endhostent d_endhent
11689eval $inlibc
11690
10bc17b6
JH
11691: see if this is a netdb.h system
11692set netdb.h i_netdb
11693eval $inhdr
11694
11695: see if endhostent_r exists
11696set endhostent_r d_endhostent_r
11697eval $inlibc
11698case "$d_endhostent_r" in
11699"$define")
11700 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11701 case "$d_endhostent_r_proto:$usethreads" in
11702 ":define") d_endhostent_r_proto=define
a48ec845
JH
11703 set d_endhostent_r_proto endhostent_r $hdrs
11704 eval $hasproto ;;
11705 *) ;;
11706 esac
11707 case "$d_endhostent_r_proto" in
11708 define)
10bc17b6
JH
11709 case "$endhostent_r_proto" in
11710 ''|0) try='int endhostent_r(struct hostent_data*);'
31ee0cb7 11711 ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
11712 esac
11713 case "$endhostent_r_proto" in
11714 ''|0) try='void endhostent_r(struct hostent_data*);'
31ee0cb7 11715 ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
11716 esac
11717 case "$endhostent_r_proto" in
90e831dc 11718 ''|0) d_endhostent_r=undef
10bc17b6 11719 endhostent_r_proto=0
a48ec845 11720 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11721 * ) case "$endhostent_r_proto" in
11722 REENTRANT_PROTO*) ;;
11723 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11724 esac
11725 echo "Prototype: $try" ;;
11726 esac
11727 ;;
c18e646a
JH
11728 *) case "$usethreads" in
11729 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11730 esac
90e831dc
SB
11731 d_endhostent_r=undef
11732 endhostent_r_proto=0
c18e646a 11733 ;;
a48ec845
JH
11734 esac
11735 ;;
10bc17b6
JH
11736*) endhostent_r_proto=0
11737 ;;
11738esac
11739
b4eb6b3d
JH
11740: see if endnetent exists
11741set endnetent d_endnent
11742eval $inlibc
11743
10bc17b6
JH
11744: see if endnetent_r exists
11745set endnetent_r d_endnetent_r
11746eval $inlibc
11747case "$d_endnetent_r" in
11748"$define")
11749 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11750 case "$d_endnetent_r_proto:$usethreads" in
11751 ":define") d_endnetent_r_proto=define
a48ec845
JH
11752 set d_endnetent_r_proto endnetent_r $hdrs
11753 eval $hasproto ;;
11754 *) ;;
11755 esac
11756 case "$d_endnetent_r_proto" in
11757 define)
10bc17b6
JH
11758 case "$endnetent_r_proto" in
11759 ''|0) try='int endnetent_r(struct netent_data*);'
31ee0cb7 11760 ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
11761 esac
11762 case "$endnetent_r_proto" in
11763 ''|0) try='void endnetent_r(struct netent_data*);'
31ee0cb7 11764 ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
11765 esac
11766 case "$endnetent_r_proto" in
90e831dc 11767 ''|0) d_endnetent_r=undef
10bc17b6 11768 endnetent_r_proto=0
a48ec845 11769 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11770 * ) case "$endnetent_r_proto" in
11771 REENTRANT_PROTO*) ;;
11772 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11773 esac
11774 echo "Prototype: $try" ;;
11775 esac
11776 ;;
c18e646a
JH
11777 *) case "$usethreads" in
11778 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11779 esac
90e831dc
SB
11780 d_endnetent_r=undef
11781 endnetent_r_proto=0
c18e646a 11782 ;;
a48ec845
JH
11783 esac
11784 ;;
10bc17b6
JH
11785*) endnetent_r_proto=0
11786 ;;
11787esac
11788
b4eb6b3d
JH
11789: see if endprotoent exists
11790set endprotoent d_endpent
11791eval $inlibc
11792
10bc17b6
JH
11793: see if endprotoent_r exists
11794set endprotoent_r d_endprotoent_r
11795eval $inlibc
11796case "$d_endprotoent_r" in
11797"$define")
11798 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11799 case "$d_endprotoent_r_proto:$usethreads" in
11800 ":define") d_endprotoent_r_proto=define
a48ec845
JH
11801 set d_endprotoent_r_proto endprotoent_r $hdrs
11802 eval $hasproto ;;
11803 *) ;;
11804 esac
11805 case "$d_endprotoent_r_proto" in
11806 define)
10bc17b6
JH
11807 case "$endprotoent_r_proto" in
11808 ''|0) try='int endprotoent_r(struct protoent_data*);'
31ee0cb7 11809 ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
11810 esac
11811 case "$endprotoent_r_proto" in
11812 ''|0) try='void endprotoent_r(struct protoent_data*);'
31ee0cb7 11813 ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
11814 esac
11815 case "$endprotoent_r_proto" in
90e831dc 11816 ''|0) d_endprotoent_r=undef
10bc17b6 11817 endprotoent_r_proto=0
a48ec845 11818 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11819 * ) case "$endprotoent_r_proto" in
11820 REENTRANT_PROTO*) ;;
11821 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11822 esac
11823 echo "Prototype: $try" ;;
11824 esac
11825 ;;
c18e646a
JH
11826 *) case "$usethreads" in
11827 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11828 esac
90e831dc
SB
11829 d_endprotoent_r=undef
11830 endprotoent_r_proto=0
c18e646a 11831 ;;
a48ec845
JH
11832 esac
11833 ;;
10bc17b6
JH
11834*) endprotoent_r_proto=0
11835 ;;
11836esac
11837
b4eb6b3d
JH
11838: see if endpwent exists
11839set endpwent d_endpwent
11840eval $inlibc
11841
10bc17b6
JH
11842: see if this is a pwd.h system
11843set pwd.h i_pwd
11844eval $inhdr
11845
11846case "$i_pwd" in
11847$define)
11848 xxx=`./findhdr pwd.h`
11849 $cppstdin $cppflags $cppminus < $xxx >$$.h
11850
11851 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11852 val="$define"
11853 else
11854 val="$undef"
11855 fi
11856 set d_pwquota
11857 eval $setvar
11858
11859 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11860 val="$define"
11861 else
11862 val="$undef"
11863 fi
11864 set d_pwage
11865 eval $setvar
11866
11867 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11868 val="$define"
11869 else
11870 val="$undef"
11871 fi
11872 set d_pwchange
11873 eval $setvar
11874
11875 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11876 val="$define"
11877 else
11878 val="$undef"
11879 fi
11880 set d_pwclass
11881 eval $setvar
11882
11883 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11884 val="$define"
11885 else
11886 val="$undef"
11887 fi
11888 set d_pwexpire
11889 eval $setvar
11890
11891 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11892 val="$define"
11893 else
11894 val="$undef"
11895 fi
11896 set d_pwcomment
11897 eval $setvar
11898
11899 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11900 val="$define"
11901 else
11902 val="$undef"
11903 fi
11904 set d_pwgecos
11905 eval $setvar
11906
11907 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11908 val="$define"
11909 else
11910 val="$undef"
11911 fi
11912 set d_pwpasswd
11913 eval $setvar
11914
11915 $rm -f $$.h
11916 ;;
11917*)
11918 val="$undef";
11919 set d_pwquota; eval $setvar
11920 set d_pwage; eval $setvar
11921 set d_pwchange; eval $setvar
11922 set d_pwclass; eval $setvar
11923 set d_pwexpire; eval $setvar
11924 set d_pwcomment; eval $setvar
11925 set d_pwgecos; eval $setvar
11926 set d_pwpasswd; eval $setvar
11927 ;;
11928esac
11929
11930: see if endpwent_r exists
11931set endpwent_r d_endpwent_r
11932eval $inlibc
11933case "$d_endpwent_r" in
11934"$define")
11935 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
11936 case "$d_endpwent_r_proto:$usethreads" in
11937 ":define") d_endpwent_r_proto=define
a48ec845
JH
11938 set d_endpwent_r_proto endpwent_r $hdrs
11939 eval $hasproto ;;
11940 *) ;;
11941 esac
11942 case "$d_endpwent_r_proto" in
11943 define)
10bc17b6
JH
11944 case "$endpwent_r_proto" in
11945 ''|0) try='int endpwent_r(FILE**);'
11946 ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11947 esac
11948 case "$endpwent_r_proto" in
11949 ''|0) try='void endpwent_r(FILE**);'
11950 ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11951 esac
11952 case "$endpwent_r_proto" in
90e831dc 11953 ''|0) d_endpwent_r=undef
10bc17b6 11954 endpwent_r_proto=0
a48ec845 11955 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11956 * ) case "$endpwent_r_proto" in
11957 REENTRANT_PROTO*) ;;
11958 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11959 esac
11960 echo "Prototype: $try" ;;
11961 esac
11962 ;;
c18e646a
JH
11963 *) case "$usethreads" in
11964 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11965 esac
90e831dc
SB
11966 d_endpwent_r=undef
11967 endpwent_r_proto=0
c18e646a 11968 ;;
a48ec845
JH
11969 esac
11970 ;;
10bc17b6
JH
11971*) endpwent_r_proto=0
11972 ;;
11973esac
11974
b4eb6b3d
JH
11975: see if endservent exists
11976set endservent d_endsent
11977eval $inlibc
11978
10bc17b6
JH
11979: see if endservent_r exists
11980set endservent_r d_endservent_r
11981eval $inlibc
11982case "$d_endservent_r" in
11983"$define")
11984 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11985 case "$d_endservent_r_proto:$usethreads" in
11986 ":define") d_endservent_r_proto=define
a48ec845
JH
11987 set d_endservent_r_proto endservent_r $hdrs
11988 eval $hasproto ;;
11989 *) ;;
11990 esac
11991 case "$d_endservent_r_proto" in
11992 define)
10bc17b6
JH
11993 case "$endservent_r_proto" in
11994 ''|0) try='int endservent_r(struct servent_data*);'
31ee0cb7 11995 ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
11996 esac
11997 case "$endservent_r_proto" in
11998 ''|0) try='void endservent_r(struct servent_data*);'
31ee0cb7 11999 ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
12000 esac
12001 case "$endservent_r_proto" in
90e831dc 12002 ''|0) d_endservent_r=undef
10bc17b6 12003 endservent_r_proto=0
a48ec845 12004 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12005 * ) case "$endservent_r_proto" in
12006 REENTRANT_PROTO*) ;;
12007 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12008 esac
12009 echo "Prototype: $try" ;;
12010 esac
12011 ;;
c18e646a
JH
12012 *) case "$usethreads" in
12013 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12014 esac
90e831dc
SB
12015 d_endservent_r=undef
12016 endservent_r_proto=0
c18e646a 12017 ;;
a48ec845
JH
12018 esac
12019 ;;
10bc17b6
JH
12020*) endservent_r_proto=0
12021 ;;
12022esac
12023
b4eb6b3d
JH
12024: Locate the flags for 'open()'
12025echo " "
55954f19 12026$cat >try.c <<EOCP
b4eb6b3d
JH
12027#include <sys/types.h>
12028#ifdef I_FCNTL
12029#include <fcntl.h>
12030#endif
12031#ifdef I_SYS_FILE
12032#include <sys/file.h>
12033#endif
55954f19
JH
12034#$i_stdlib I_STDLIB
12035#ifdef I_STDLIB
12036#include <stdlib.h>
12037#endif
b4eb6b3d
JH
12038int main() {
12039 if(O_RDONLY);
12040#ifdef O_TRUNC
12041 exit(0);
12042#else
12043 exit(1);
12044#endif
12045}
12046EOCP
12047: check sys/file.h first to get FREAD on Sun
12048if $test `./findhdr sys/file.h` && \
5440bc8e 12049 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
12050 h_sysfile=true;
12051 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 12052 if $run ./try; then
b4eb6b3d
JH
12053 echo "and you have the 3 argument form of open()." >&4
12054 val="$define"
12055 else
12056 echo "but not the 3 argument form of open(). Oh, well." >&4
12057 val="$undef"
12058 fi
12059elif $test `./findhdr fcntl.h` && \
5440bc8e 12060 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
12061 h_fcntl=true;
12062 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 12063 if $run ./try; then
b4eb6b3d
JH
12064 echo "and you have the 3 argument form of open()." >&4
12065 val="$define"
12066 else
12067 echo "but not the 3 argument form of open(). Oh, well." >&4
12068 val="$undef"
12069 fi
12070else
12071 val="$undef"
12072 echo "I can't find the O_* constant definitions! You got problems." >&4
12073fi
12074set d_open3
12075eval $setvar
5440bc8e 12076$rm -f try try.*
b4eb6b3d
JH
12077
12078: see which of string.h or strings.h is needed
12079echo " "
12080strings=`./findhdr string.h`
12081if $test "$strings" && $test -r "$strings"; then
12082 echo "Using <string.h> instead of <strings.h>." >&4
12083 val="$define"
12084else
12085 val="$undef"
12086 strings=`./findhdr strings.h`
12087 if $test "$strings" && $test -r "$strings"; then
12088 echo "Using <strings.h> instead of <string.h>." >&4
12089 else
12090 echo "No string header found -- You'll surely have problems." >&4
12091 fi
12092fi
12093set i_string
12094eval $setvar
12095case "$i_string" in
12096"$undef") strings=`./findhdr strings.h`;;
12097*) strings=`./findhdr string.h`;;
12098esac
12099
3c728e00
JH
12100: see if this is a sys/file.h system
12101val=''
12102set sys/file.h val
12103eval $inhdr
12104
12105: do we need to include sys/file.h ?
12106case "$val" in
12107"$define")
12108 echo " "
12109 if $h_sysfile; then
12110 val="$define"
12111 echo "We'll be including <sys/file.h>." >&4
12112 else
12113 val="$undef"
12114 echo "We won't be including <sys/file.h>." >&4
12115 fi
12116 ;;
12117*)
12118 h_sysfile=false
12119 ;;
12120esac
12121set i_sysfile
12122eval $setvar
12123
12124: see if fcntl.h is there
12125val=''
12126set fcntl.h val
12127eval $inhdr
12128
12129: see if we can include fcntl.h
12130case "$val" in
12131"$define")
12132 echo " "
12133 if $h_fcntl; then
12134 val="$define"
12135 echo "We'll be including <fcntl.h>." >&4
12136 else
12137 val="$undef"
12138 if $h_sysfile; then
12139 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12140 else
12141 echo "We won't be including <fcntl.h>." >&4
12142 fi
12143 fi
12144 ;;
12145*)
12146 h_fcntl=false
12147 val="$undef"
12148 ;;
12149esac
12150set i_fcntl
12151eval $setvar
12152
b4eb6b3d
JH
12153: check for non-blocking I/O stuff
12154case "$h_sysfile" in
a0acbdc3
JH
12155true) echo "#include <sys/file.h>" > head.c;;
12156*)
12157 case "$h_fcntl" in
12158 true) echo "#include <fcntl.h>" > head.c;;
12159 *) echo "#include <sys/fcntl.h>" > head.c;;
12160 esac
12161 ;;
b4eb6b3d
JH
12162esac
12163echo " "
12164echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12165case "$o_nonblock" in
12166'')
12167 $cat head.c > try.c
3c728e00 12168 $cat >>try.c <<EOCP
b4eb6b3d 12169#include <stdio.h>
55954f19
JH
12170#$i_stdlib I_STDLIB
12171#ifdef I_STDLIB
80b3ef99 12172#include <stdlib.h>
55954f19 12173#endif
3c728e00
JH
12174#$i_fcntl I_FCNTL
12175#ifdef I_FCNTL
12176#include <fcntl.h>
12177#endif
b4eb6b3d
JH
12178int main() {
12179#ifdef O_NONBLOCK
12180 printf("O_NONBLOCK\n");
12181 exit(0);
12182#endif
12183#ifdef O_NDELAY
12184 printf("O_NDELAY\n");
12185 exit(0);
12186#endif
12187#ifdef FNDELAY
12188 printf("FNDELAY\n");
12189 exit(0);
12190#endif
12191 exit(0);
12192}
12193EOCP
12194 set try
12195 if eval $compile_ok; then
5440bc8e 12196 o_nonblock=`$run ./try`
b4eb6b3d
JH
12197 case "$o_nonblock" in
12198 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12199 *) echo "Seems like we can use $o_nonblock.";;
12200 esac
12201 else
12202 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12203 fi
12204 ;;
12205*) echo "Using $hint value $o_nonblock.";;
12206esac
12207$rm -f try try.* .out core
12208
12209echo " "
12210echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12211case "$eagain" in
12212'')
12213 $cat head.c > try.c
12214 $cat >>try.c <<EOCP
12215#include <errno.h>
12216#include <sys/types.h>
12217#include <signal.h>
12218#include <stdio.h>
55954f19
JH
12219#$i_stdlib I_STDLIB
12220#ifdef I_STDLIB
12221#include <stdlib.h>
12222#endif
1deb0a86
JH
12223#$i_fcntl I_FCNTL
12224#ifdef I_FCNTL
12225#include <fcntl.h>
12226#endif
b4eb6b3d
JH
12227#define MY_O_NONBLOCK $o_nonblock
12228#ifndef errno /* XXX need better Configure test */
12229extern int errno;
12230#endif
12231#$i_unistd I_UNISTD
12232#ifdef I_UNISTD
12233#include <unistd.h>
12234#endif
12235#$i_string I_STRING
12236#ifdef I_STRING
12237#include <string.h>
12238#else
12239#include <strings.h>
12240#endif
7090f861 12241$signal_t blech(int x) { exit(3); }
b4eb6b3d
JH
12242EOCP
12243 $cat >> try.c <<'EOCP'
12244int main()
12245{
12246 int pd[2];
12247 int pu[2];
12248 char buf[1];
12249 char string[100];
12250
12251 pipe(pd); /* Down: child -> parent */
12252 pipe(pu); /* Up: parent -> child */
12253 if (0 != fork()) {
12254 int ret;
12255 close(pd[1]); /* Parent reads from pd[0] */
12256 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 12257#ifdef F_SETFL
b4eb6b3d
JH
12258 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12259 exit(1);
a0acbdc3
JH
12260#else
12261 exit(4);
12262#endif
b4eb6b3d
JH
12263 signal(SIGALRM, blech);
12264 alarm(5);
12265 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
12266 exit(2);
12267 sprintf(string, "%d\n", ret);
12268 write(2, string, strlen(string));
12269 alarm(0);
12270#ifdef EAGAIN
12271 if (errno == EAGAIN) {
12272 printf("EAGAIN\n");
12273 goto ok;
12274 }
12275#endif
12276#ifdef EWOULDBLOCK
12277 if (errno == EWOULDBLOCK)
12278 printf("EWOULDBLOCK\n");
12279#endif
12280 ok:
12281 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
12282 sleep(2); /* Give it time to close our pipe */
12283 alarm(5);
12284 ret = read(pd[0], buf, 1); /* Should read EOF */
12285 alarm(0);
12286 sprintf(string, "%d\n", ret);
868439a2 12287 write(4, string, strlen(string));
b4eb6b3d
JH
12288 exit(0);
12289 }
12290
12291 close(pd[0]); /* We write to pd[1] */
12292 close(pu[1]); /* We read from pu[0] */
12293 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
12294 close(pd[1]); /* Pipe pd is now fully closed! */
12295 exit(0); /* Bye bye, thank you for playing! */
12296}
12297EOCP
12298 set try
12299 if eval $compile_ok; then
12300 echo "$startsh" >mtry
868439a2 12301 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
12302 chmod +x mtry
12303 ./mtry >/dev/null 2>&1
12304 case $? in
12305 0) eagain=`$cat try.out`;;
12306 1) echo "Could not perform non-blocking setting!";;
12307 2) echo "I did a successful read() for something that was not there!";;
12308 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 12309 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
12310 *) echo "Something terribly wrong happened during testing.";;
12311 esac
12312 rd_nodata=`$cat try.ret`
12313 echo "A read() system call with no data present returns $rd_nodata."
12314 case "$rd_nodata" in
12315 0|-1) ;;
12316 *)
12317 echo "(That's peculiar, fixing that to be -1.)"
12318 rd_nodata=-1
12319 ;;
12320 esac
12321 case "$eagain" in
12322 '')
12323 echo "Forcing errno EAGAIN on read() with no data available."
12324 eagain=EAGAIN
12325 ;;
12326 *)
12327 echo "Your read() sets errno to $eagain when no data is available."
12328 ;;
12329 esac
12330 status=`$cat try.err`
12331 case "$status" in
12332 0) echo "And it correctly returns 0 to signal EOF.";;
12333 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12334 *) echo "However, your read() returns '$status' on EOF??";;
12335 esac
12336 val="$define"
12337 if test "$status" = "$rd_nodata"; then
12338 echo "WARNING: you can't distinguish between EOF and no data!"
12339 val="$undef"
12340 fi
12341 else
12342 echo "I can't compile the test program--assuming errno EAGAIN will do."
12343 eagain=EAGAIN
12344 fi
12345 set d_eofnblk
12346 eval $setvar
12347 ;;
12348*)
12349 echo "Using $hint value $eagain."
12350 echo "Your read() returns $rd_nodata when no data is present."
12351 case "$d_eofnblk" in
12352 "$define") echo "And you can see EOF because read() returns 0.";;
12353 "$undef") echo "But you can't see EOF status from read() returned value.";;
12354 *)
12355 echo "(Assuming you can't see EOF status from read anyway.)"
12356 d_eofnblk=$undef
12357 ;;
12358 esac
12359 ;;
12360esac
12361$rm -f try try.* .out core head.c mtry
12362
15b61c98
JH
12363: see if _ptr and _cnt from stdio act std
12364echo " "
b4eb6b3d 12365
15b61c98
JH
12366if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12367 echo "(Looks like you have stdio.h from BSD.)"
12368 case "$stdio_ptr" in
12369 '') stdio_ptr='((fp)->_p)'
12370 ptr_lval=$define
12371 ;;
12372 *) ptr_lval=$d_stdio_ptr_lval;;
12373 esac
12374 case "$stdio_cnt" in
12375 '') stdio_cnt='((fp)->_r)'
12376 cnt_lval=$define
12377 ;;
12378 *) cnt_lval=$d_stdio_cnt_lval;;
12379 esac
12380 case "$stdio_base" in
12381 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12382 esac
12383 case "$stdio_bufsiz" in
12384 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12385 esac
12386elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12387 echo "(Looks like you have stdio.h from Linux.)"
12388 case "$stdio_ptr" in
12389 '') stdio_ptr='((fp)->_IO_read_ptr)'
12390 ptr_lval=$define
12391 ;;
12392 *) ptr_lval=$d_stdio_ptr_lval;;
12393 esac
12394 case "$stdio_cnt" in
12395 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12396 cnt_lval=$undef
12397 ;;
12398 *) cnt_lval=$d_stdio_cnt_lval;;
12399 esac
12400 case "$stdio_base" in
12401 '') stdio_base='((fp)->_IO_read_base)';;
12402 esac
12403 case "$stdio_bufsiz" in
12404 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12405 esac
12406else
12407 case "$stdio_ptr" in
12408 '') stdio_ptr='((fp)->_ptr)'
12409 ptr_lval=$define
12410 ;;
12411 *) ptr_lval=$d_stdio_ptr_lval;;
12412 esac
12413 case "$stdio_cnt" in
12414 '') stdio_cnt='((fp)->_cnt)'
12415 cnt_lval=$define
12416 ;;
12417 *) cnt_lval=$d_stdio_cnt_lval;;
12418 esac
12419 case "$stdio_base" in
12420 '') stdio_base='((fp)->_base)';;
12421 esac
12422 case "$stdio_bufsiz" in
12423 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12424 esac
12425fi
b4eb6b3d 12426
15b61c98
JH
12427: test whether _ptr and _cnt really work
12428echo "Checking how std your stdio is..." >&4
12429$cat >try.c <<EOP
12430#include <stdio.h>
55954f19
JH
12431#$i_stdlib I_STDLIB
12432#ifdef I_STDLIB
9d9004a9 12433#include <stdlib.h>
55954f19 12434#endif
15b61c98
JH
12435#define FILE_ptr(fp) $stdio_ptr
12436#define FILE_cnt(fp) $stdio_cnt
9d9004a9 12437int main() {
15b61c98
JH
12438 FILE *fp = fopen("try.c", "r");
12439 char c = getc(fp);
12440 if (
12441 18 <= FILE_cnt(fp) &&
12442 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12443 )
12444 exit(0);
12445 exit(1);
9d9004a9 12446}
15b61c98
JH
12447EOP
12448val="$undef"
12449set try
12450if eval $compile && $to try.c; then
12451 if $run ./try; then
12452 echo "Your stdio acts pretty std."
12453 val="$define"
9d9004a9 12454 else
15b61c98 12455 echo "Your stdio isn't very std."
9d9004a9 12456 fi
15b61c98
JH
12457else
12458 echo "Your stdio doesn't appear very std."
12459fi
12460$rm -f try.c try
12461
12462# glibc 2.2.90 and above apparently change stdio streams so Perl's
12463# direct buffer manipulation no longer works. The Configure tests
12464# should be changed to correctly detect this, but until then,
12465# the following check should at least let perl compile and run.
12466# (This quick fix should be updated before 5.8.1.)
12467# To be defensive, reject all unknown versions, and all versions > 2.2.9.
12468# A. Dougherty, June 3, 2002.
12469case "$d_gnulibc" in
12470$define)
12471 case "$gnulibc_version" in
12472 2.[01]*) ;;
12473 2.2) ;;
12474 2.2.[0-9]) ;;
12475 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12476 val="$undef"
12477 ;;
12478 esac
9d9004a9
AD
12479 ;;
12480esac
15b61c98 12481set d_stdstdio
9d9004a9 12482eval $setvar
9d9004a9 12483
15b61c98
JH
12484: Can _ptr be used as an lvalue?
12485case "$d_stdstdio$ptr_lval" in
12486$define$define) val=$define ;;
12487*) val=$undef ;;
12488esac
12489set d_stdio_ptr_lval
12490eval $setvar
9d9004a9 12491
15b61c98
JH
12492: Can _cnt be used as an lvalue?
12493case "$d_stdstdio$cnt_lval" in
12494$define$define) val=$define ;;
12495*) val=$undef ;;
12496esac
12497set d_stdio_cnt_lval
12498eval $setvar
b4eb6b3d 12499
15b61c98
JH
12500
12501: test whether setting _ptr sets _cnt as a side effect
12502d_stdio_ptr_lval_sets_cnt="$undef"
12503d_stdio_ptr_lval_nochange_cnt="$undef"
12504case "$d_stdio_ptr_lval$d_stdstdio" in
12505$define$define)
12506 echo "Checking to see what happens if we set the stdio ptr..." >&4
12507$cat >try.c <<EOP
12508#include <stdio.h>
12509/* Can we scream? */
12510/* Eat dust sed :-) */
12511/* In the buffer space, no one can hear you scream. */
55954f19
JH
12512#$i_stdlib I_STDLIB
12513#ifdef I_STDLIB
12514#include <stdlib.h>
12515#endif
15b61c98
JH
12516#define FILE_ptr(fp) $stdio_ptr
12517#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 12518#include <sys/types.h>
b4eb6b3d 12519int main() {
15b61c98
JH
12520 FILE *fp = fopen("try.c", "r");
12521 int c;
12522 char *ptr;
12523 size_t cnt;
12524 if (!fp) {
12525 puts("Fail even to read");
12526 exit(1);
12527 }
12528 c = getc(fp); /* Read away the first # */
12529 if (c == EOF) {
12530 puts("Fail even to read");
12531 exit(1);
12532 }
12533 if (!(
12534 18 <= FILE_cnt(fp) &&
12535 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12536 )) {
12537 puts("Fail even to read");
12538 exit (1);
12539 }
12540 ptr = (char*) FILE_ptr(fp);
12541 cnt = (size_t)FILE_cnt(fp);
12542
12543 FILE_ptr(fp) += 42;
12544
12545 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12546 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12547 exit (1);
12548 }
12549 if (FILE_cnt(fp) <= 20) {
12550 printf ("Fail (<20 chars to test)");
12551 exit (1);
12552 }
12553 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12554 puts("Fail compare");
12555 exit (1);
12556 }
12557 if (cnt == FILE_cnt(fp)) {
12558 puts("Pass_unchanged");
12559 exit (0);
12560 }
12561 if (FILE_cnt(fp) == (cnt - 42)) {
12562 puts("Pass_changed");
12563 exit (0);
12564 }
12565 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12566 return 1;
12567
12568}
12569EOP
12570 set try
12571 if eval $compile && $to try.c; then
12572 case `$run ./try` in
12573 Pass_changed)
12574 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
12575 d_stdio_ptr_lval_sets_cnt="$define" ;;
12576 Pass_unchanged)
12577 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12578 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12579 Fail*)
12580 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12581 *)
12582 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12583 esac
12584 else
12585 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12586 fi
12587 $rm -f try.c try
12588 ;;
12589esac
12590
12591: see if _base is also standard
12592val="$undef"
12593case "$d_stdstdio" in
12594$define)
12595 $cat >try.c <<EOP
12596#include <stdio.h>
12597#$i_stdlib I_STDLIB
12598#ifdef I_STDLIB
12599#include <stdlib.h>
12600#endif
12601#define FILE_base(fp) $stdio_base
12602#define FILE_bufsiz(fp) $stdio_bufsiz
12603int main() {
12604 FILE *fp = fopen("try.c", "r");
12605 char c = getc(fp);
12606 if (
12607 19 <= FILE_bufsiz(fp) &&
12608 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12609 )
12610 exit(0);
12611 exit(1);
12612}
12613EOP
12614 set try
12615 if eval $compile && $to try.c; then
12616 if $run ./try; then
12617 echo "And its _base field acts std."
12618 val="$define"
12619 else
12620 echo "But its _base field isn't std."
12621 fi
12622 else
12623 echo "However, it seems to be lacking the _base field."
12624 fi
12625 $rm -f try.c try
12626 ;;
12627esac
12628set d_stdiobase
12629eval $setvar
12630
12631: see if fast_stdio exists
12632val="$undef"
12633case "$d_stdstdio:$d_stdio_ptr_lval" in
12634"$define:$define")
12635 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12636 *$define*)
12637 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12638 val="$define"
12639 ;;
12640 esac
12641 ;;
12642esac
12643set d_faststdio
12644eval $setvar
12645
12646
12647
12648: see if fchdir exists
12649set fchdir d_fchdir
12650eval $inlibc
12651
12652: see if fchmod exists
12653set fchmod d_fchmod
12654eval $inlibc
12655
12656: see if fchown exists
12657set fchown d_fchown
12658eval $inlibc
12659
12660: see if this is an fcntl system
12661set fcntl d_fcntl
12662eval $inlibc
12663
12664echo " "
12665: See if fcntl-based locking works.
12666$cat >try.c <<EOCP
12667#$i_stdlib I_STDLIB
12668#ifdef I_STDLIB
12669#include <stdlib.h>
12670#endif
12671#include <unistd.h>
12672#include <fcntl.h>
12673#include <signal.h>
7090f861 12674$signal_t blech(int x) { exit(3); }
15b61c98
JH
12675int main() {
12676#if defined(F_SETLK) && defined(F_SETLKW)
12677 struct flock flock;
12678 int retval, fd;
12679 fd = open("try.c", O_RDONLY);
12680 flock.l_type = F_RDLCK;
12681 flock.l_whence = SEEK_SET;
12682 flock.l_start = flock.l_len = 0;
12683 signal(SIGALRM, blech);
12684 alarm(10);
12685 retval = fcntl(fd, F_SETLK, &flock);
12686 close(fd);
12687 (retval < 0 ? exit(2) : exit(0));
12688#else
12689 exit(2);
12690#endif
12691}
12692EOCP
12693echo "Checking if fcntl-based file locking works... "
12694case "$d_fcntl" in
12695"$define")
12696 set try
12697 if eval $compile_ok; then
12698 if $run ./try; then
12699 echo "Yes, it seems to work."
12700 val="$define"
12701 else
12702 echo "Nope, it didn't work."
12703 val="$undef"
12704 case "$?" in
12705 3) $cat >&4 <<EOM
12706***
12707*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12708*** This is (almost) impossible.
12709*** If your NFS lock daemons are not feeling well, something like
12710*** this may happen, please investigate. Cannot continue, aborting.
12711***
12712EOM
12713 exit 1
12714 ;;
12715 esac
12716 fi
12717 else
12718 echo "I'm unable to compile the test program, so I'll assume not."
12719 val="$undef"
12720 fi
12721 ;;
12722*) val="$undef";
12723 echo "Nope, since you don't even have fcntl()."
12724 ;;
12725esac
12726set d_fcntl_can_lock
12727eval $setvar
12728$rm -f try*
12729
12730
12731: check for fd_set items
12732$cat <<EOM
12733
12734Checking to see how well your C compiler handles fd_set and friends ...
12735EOM
12736$cat >try.c <<EOCP
12737#$i_stdlib I_STDLIB
12738#ifdef I_STDLIB
12739#include <stdlib.h>
12740#endif
12741#$i_systime I_SYS_TIME
12742#$i_sysselct I_SYS_SELECT
12743#$d_socket HAS_SOCKET
12744#include <sys/types.h>
12745#ifdef HAS_SOCKET
12746#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12747#endif
12748#ifdef I_SYS_TIME
12749#include <sys/time.h>
12750#endif
12751#ifdef I_SYS_SELECT
12752#include <sys/select.h>
12753#endif
12754int main() {
12755 fd_set fds;
12756
12757#ifdef TRYBITS
12758 if(fds.fds_bits);
12759#endif
12760
12761#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12762 exit(0);
12763#else
12764 exit(1);
12765#endif
12766}
12767EOCP
12768set try -DTRYBITS
12769if eval $compile; then
12770 d_fds_bits="$define"
12771 d_fd_set="$define"
12772 echo "Well, your system knows about the normal fd_set typedef..." >&4
12773 if $run ./try; then
b4eb6b3d
JH
12774 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12775 d_fd_macros="$define"
12776 else
12777 $cat >&4 <<'EOM'
12778but not the normal fd_set macros! Gaaack! I'll have to cover for you.
12779EOM
12780 d_fd_macros="$undef"
12781 fi
12782else
12783 $cat <<'EOM'
12784Hmm, your compiler has some difficulty with fd_set. Checking further...
12785EOM
5440bc8e 12786 set try
b4eb6b3d
JH
12787 if eval $compile; then
12788 d_fds_bits="$undef"
12789 d_fd_set="$define"
12790 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 12791 if $run ./try; then
b4eb6b3d
JH
12792 echo "and you have the normal fd_set macros." >&4
12793 d_fd_macros="$define"
12794 else
12795 $cat <<'EOM'
12796but not the normal fd_set macros! Gross! More work for me...
12797EOM
12798 d_fd_macros="$undef"
12799 fi
12800 else
12801 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
12802 d_fd_set="$undef"
12803 d_fds_bits="$undef"
12804 d_fd_macros="$undef"
12805 fi
12806fi
5440bc8e 12807$rm -f try try.*
b4eb6b3d
JH
12808
12809: see if fgetpos exists
12810set fgetpos d_fgetpos
12811eval $inlibc
12812
758a5d79
JH
12813: see if finite exists
12814set finite d_finite
12815eval $inlibc
12816
12817: see if finitel exists
12818set finitel d_finitel
12819eval $inlibc
12820
b4eb6b3d
JH
12821: see if flock exists
12822set flock d_flock
12823eval $inlibc
12824
2ef53570
JH
12825: see if prototype for flock is available
12826echo " "
12827set d_flockproto flock $i_sysfile sys/file.h
12828eval $hasproto
12829
b4eb6b3d
JH
12830: see if fork exists
12831set fork d_fork
12832eval $inlibc
12833
758a5d79
JH
12834: see if fp_class exists
12835set fp_class d_fp_class
12836eval $inlibc
12837
b4eb6b3d
JH
12838: see if pathconf exists
12839set pathconf d_pathconf
12840eval $inlibc
12841
12842: see if fpathconf exists
12843set fpathconf d_fpathconf
12844eval $inlibc
12845
758a5d79
JH
12846: see if fpclass exists
12847set fpclass d_fpclass
12848eval $inlibc
12849
12850: see if fpclassify exists
12851set fpclassify d_fpclassify
12852eval $inlibc
12853
12854: see if fpclassl exists
12855set fpclassl d_fpclassl
12856eval $inlibc
12857
b4eb6b3d
JH
12858
12859: check for fpos64_t
12860echo " "
12861echo "Checking to see if you have fpos64_t..." >&4
12862$cat >try.c <<EOCP
12863#include <stdio.h>
12864int main() { fpos64_t x = 7; }
12865EOCP
12866set try
12867if eval $compile; then
12868 val="$define"
12869 echo "You have fpos64_t."
12870else
12871 val="$undef"
12872 echo "You do not have fpos64_t."
12873 case "$fpossize" in
12874 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12875 esac
12876fi
12877$rm -f try.* try
12878set d_fpos64_t
12879eval $setvar
12880
12881: see if frexpl exists
12882set frexpl d_frexpl
12883eval $inlibc
12884
b4eb6b3d
JH
12885: see if this is a sys/param system
12886set sys/param.h i_sysparam
12887eval $inhdr
12888
12889: see if this is a sys/mount.h system
12890set sys/mount.h i_sysmount
12891eval $inhdr
12892
b4eb6b3d
JH
12893
12894echo " "
12895echo "Checking to see if your system supports struct fs_data..." >&4
12896set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12897eval $hasstruct
12898case "$d_fs_data_s" in
12899"$define") echo "Yes, it does." ;;
12900*) echo "No, it doesn't." ;;
12901esac
12902
12903: see if fseeko exists
12904set fseeko d_fseeko
12905eval $inlibc
12906case "$longsize" in
129078) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12908esac
12909
12910: see if fsetpos exists
12911set fsetpos d_fsetpos
12912eval $inlibc
12913
12914
12915: see if fstatfs exists
12916set fstatfs d_fstatfs
12917eval $inlibc
12918
12919
12920: see if statvfs exists
12921set statvfs d_statvfs
12922eval $inlibc
12923
12924: see if fstatvfs exists
12925set fstatvfs d_fstatvfs
12926eval $inlibc
12927
12928
411ab01c
JH
12929: see if fsync exists
12930set fsync d_fsync
12931eval $inlibc
12932
b4eb6b3d
JH
12933: see if ftello exists
12934set ftello d_ftello
12935eval $inlibc
12936case "$longsize" in
129378) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12938esac
12939
bff98e24
SP
12940d_futimes="$undef"
12941: check for a working futimes
12942echo " "
12943echo "Checking for a working futimes()" >&4
12944$cat >try.c <<EOCP
12945#include <stdio.h>
12946#include <sys/time.h>
12947#include <errno.h>
12948#include <fcntl.h>
12949
12950int main ()
12951{
12952 int fd, rv;
12953 fd = open ("try.c", O_RDWR);
12954 if (-1 == fd) exit (1);
12955 rv = futimes (fd, NULL);
12956 exit (rv == -1 ? errno : 0);
12957}
12958EOCP
12959set try
12960if eval $compile; then
12961 `$run ./try`
12962 rc=$?
12963 case "$rc" in
12964 0) echo "Yes, it does" >&4
12965 d_futimes="$define"
12966 ;;
12967 *) echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12968 ;;
12969 esac
12970else
12971 echo "No, it does not (probably harmless)\n" >&4
12972fi
12973$rm -f try.* try core core.try.*
dc814df1 12974
b4eb6b3d
JH
12975: see if getcwd exists
12976set getcwd d_getcwd
12977eval $inlibc
12978
12979: see if getespwnam exists
12980set getespwnam d_getespwnam
12981eval $inlibc
12982
12983
12984: see if getfsstat exists
12985set getfsstat d_getfsstat
12986eval $inlibc
12987
12988: see if getgrent exists
12989set getgrent d_getgrent
12990eval $inlibc
12991
10bc17b6
JH
12992: see if getgrent_r exists
12993set getgrent_r d_getgrent_r
12994eval $inlibc
12995case "$d_getgrent_r" in
12996"$define")
12997 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12998 case "$d_getgrent_r_proto:$usethreads" in
12999 ":define") d_getgrent_r_proto=define
a48ec845
JH
13000 set d_getgrent_r_proto getgrent_r $hdrs
13001 eval $hasproto ;;
13002 *) ;;
13003 esac
13004 case "$d_getgrent_r_proto" in
13005 define)
10bc17b6
JH
13006 case "$getgrent_r_proto" in
13007 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13008 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13009 esac
13010 case "$getgrent_r_proto" in
13011 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13012 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13013 esac
13014 case "$getgrent_r_proto" in
13015 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13016 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13017 esac
13018 case "$getgrent_r_proto" in
13019 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13020 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13021 esac
13022 case "$getgrent_r_proto" in
13023 ''|0) try='int getgrent_r(struct group*, char*, int);'
13024 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13025 esac
13026 case "$getgrent_r_proto" in
13027 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13028 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13029 esac
13030 case "$getgrent_r_proto" in
90e831dc 13031 ''|0) d_getgrent_r=undef
10bc17b6 13032 getgrent_r_proto=0
a48ec845 13033 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13034 * ) case "$getgrent_r_proto" in
13035 REENTRANT_PROTO*) ;;
13036 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13037 esac
13038 echo "Prototype: $try" ;;
13039 esac
13040 ;;
c18e646a
JH
13041 *) case "$usethreads" in
13042 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13043 esac
90e831dc
SB
13044 d_getgrent_r=undef
13045 getgrent_r_proto=0
c18e646a 13046 ;;
a48ec845
JH
13047 esac
13048 ;;
10bc17b6
JH
13049*) getgrent_r_proto=0
13050 ;;
13051esac
13052
13053: see if getgrgid_r exists
13054set getgrgid_r d_getgrgid_r
13055eval $inlibc
13056case "$d_getgrgid_r" in
13057"$define")
13058 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13059 case "$d_getgrgid_r_proto:$usethreads" in
13060 ":define") d_getgrgid_r_proto=define
a48ec845
JH
13061 set d_getgrgid_r_proto getgrgid_r $hdrs
13062 eval $hasproto ;;
13063 *) ;;
13064 esac
13065 case "$d_getgrgid_r_proto" in
13066 define)
10bc17b6
JH
13067 case "$getgrgid_r_proto" in
13068 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13069 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13070 esac
13071 case "$getgrgid_r_proto" in
13072 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13073 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13074 esac
13075 case "$getgrgid_r_proto" in
13076 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13077 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13078 esac
13079 case "$getgrgid_r_proto" in
13080 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13081 ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13082 esac
13083 case "$getgrgid_r_proto" in
90e831dc 13084 ''|0) d_getgrgid_r=undef
10bc17b6 13085 getgrgid_r_proto=0
a48ec845 13086 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13087 * ) case "$getgrgid_r_proto" in
13088 REENTRANT_PROTO*) ;;
13089 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13090 esac
13091 echo "Prototype: $try" ;;
13092 esac
13093 ;;
c18e646a
JH
13094 *) case "$usethreads" in
13095 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13096 esac
90e831dc
SB
13097 d_getgrgid_r=undef
13098 getgrgid_r_proto=0
c18e646a 13099 ;;
a48ec845
JH
13100 esac
13101 ;;
10bc17b6
JH
13102*) getgrgid_r_proto=0
13103 ;;
13104esac
13105
13106: see if getgrnam_r exists
13107set getgrnam_r d_getgrnam_r
13108eval $inlibc
13109case "$d_getgrnam_r" in
13110"$define")
13111 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13112 case "$d_getgrnam_r_proto:$usethreads" in
13113 ":define") d_getgrnam_r_proto=define
a48ec845
JH
13114 set d_getgrnam_r_proto getgrnam_r $hdrs
13115 eval $hasproto ;;
13116 *) ;;
13117 esac
13118 case "$d_getgrnam_r_proto" in
13119 define)
10bc17b6
JH
13120 case "$getgrnam_r_proto" in
13121 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13122 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13123 esac
13124 case "$getgrnam_r_proto" in
13125 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13126 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13127 esac
13128 case "$getgrnam_r_proto" in
13129 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13130 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13131 esac
13132 case "$getgrnam_r_proto" in
13133 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13134 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13135 esac
13136 case "$getgrnam_r_proto" in
13137 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13138 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13139 esac
13140 case "$getgrnam_r_proto" in
90e831dc 13141 ''|0) d_getgrnam_r=undef
10bc17b6 13142 getgrnam_r_proto=0
a48ec845 13143 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13144 * ) case "$getgrnam_r_proto" in
13145 REENTRANT_PROTO*) ;;
13146 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13147 esac
13148 echo "Prototype: $try" ;;
13149 esac
13150 ;;
c18e646a
JH
13151 *) case "$usethreads" in
13152 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13153 esac
90e831dc
SB
13154 d_getgrnam_r=undef
13155 getgrnam_r_proto=0
c18e646a 13156 ;;
a48ec845
JH
13157 esac
13158 ;;
10bc17b6
JH
13159*) getgrnam_r_proto=0
13160 ;;
13161esac
13162
b4eb6b3d
JH
13163: see if gethostbyaddr exists
13164set gethostbyaddr d_gethbyaddr
13165eval $inlibc
13166
13167: see if gethostbyname exists
13168set gethostbyname d_gethbyname
13169eval $inlibc
13170
13171: see if gethostent exists
13172set gethostent d_gethent
13173eval $inlibc
13174
13175: see how we will look up host name
13176echo " "
13177call=''
13178if set gethostname val -f d_gethname; eval $csym; $val; then
13179 echo 'gethostname() found.' >&4
13180 d_gethname="$define"
13181 call=gethostname
13182fi
13183if set uname val -f d_uname; eval $csym; $val; then
13184 if ./xenix; then
13185 $cat <<'EOM'
13186uname() was found, but you're running xenix, and older versions of xenix
13187have a broken uname(). If you don't really know whether your xenix is old
13188enough to have a broken system call, use the default answer.
13189
13190EOM
13191 dflt=y
13192 case "$d_uname" in
13193 "$define") dflt=n;;
13194 esac
13195 rp='Is your uname() broken?'
13196 . ./myread
13197 case "$ans" in
13198 n*) d_uname="$define"; call=uname;;
13199 esac
13200 else
13201 echo 'uname() found.' >&4
13202 d_uname="$define"
13203 case "$call" in
13204 '') call=uname ;;
13205 esac
13206 fi
13207fi
13208case "$d_gethname" in
13209'') d_gethname="$undef";;
13210esac
13211case "$d_uname" in
13212'') d_uname="$undef";;
13213esac
13214case "$d_uname$d_gethname" in
13215*define*)
13216 dflt=n
13217 cat <<EOM
13218
13219Every now and then someone has a $call() that lies about the hostname
13220but can't be fixed for political or economic reasons. If you wish, I can
13221pretend $call() isn't there and maybe compute hostname at run-time
13222thanks to the '$phostname' command.
13223
13224EOM
13225 rp="Shall I ignore $call() from now on?"
13226 . ./myread
13227 case "$ans" in
13228 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13229 esac;;
13230esac
13231case "$phostname" in
13232'') aphostname='';;
13233*) case "$aphostname" in
13234 /*) ;;
13235 *) set X $phostname
13236 shift
13237 file=$1
13238 shift
13239 file=`./loc $file $file $pth`
13240 aphostname=`echo $file $*`
13241 ;;
13242 esac
13243 ;;
13244esac
13245case "$d_uname$d_gethname" in
13246*define*) ;;
13247*)
13248 case "$phostname" in
13249 '')
13250 echo "There will be no way for $package to get your hostname." >&4;;
13251 *)
13252 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13253 ;;
13254 esac;;
13255esac
13256case "$d_phostname" in
13257'') d_phostname="$undef";;
13258esac
13259
10bc17b6
JH
13260: see if gethostbyaddr_r exists
13261set gethostbyaddr_r d_gethostbyaddr_r
13262eval $inlibc
13263case "$d_gethostbyaddr_r" in
13264"$define")
13265 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13266 case "$d_gethostbyaddr_r_proto:$usethreads" in
13267 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
13268 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13269 eval $hasproto ;;
13270 *) ;;
13271 esac
13272 case "$d_gethostbyaddr_r_proto" in
13273 define)
10bc17b6
JH
13274 case "$gethostbyaddr_r_proto" in
13275 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13276 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13277 esac
13278 case "$gethostbyaddr_r_proto" in
13279 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13280 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13281 esac
13282 case "$gethostbyaddr_r_proto" in
13283 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13284 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13285 esac
13286 case "$gethostbyaddr_r_proto" in
13287 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13288 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13289 esac
13290 case "$gethostbyaddr_r_proto" in
13291 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13292 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13293 esac
13294 case "$gethostbyaddr_r_proto" in
13295 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13296 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13297 esac
13298 case "$gethostbyaddr_r_proto" in
13299 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13300 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13301 esac
13302 case "$gethostbyaddr_r_proto" in
13303 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13304 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13305 esac
13306 case "$gethostbyaddr_r_proto" in
13307 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13308 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13309 esac
13310 case "$gethostbyaddr_r_proto" in
13311 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13312 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13313 esac
13314 case "$gethostbyaddr_r_proto" in
a845a0d4
JH
13315 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13316 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13317 esac
13318 case "$gethostbyaddr_r_proto" in
90e831dc 13319 ''|0) d_gethostbyaddr_r=undef
10bc17b6 13320 gethostbyaddr_r_proto=0
a48ec845 13321 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13322 * ) case "$gethostbyaddr_r_proto" in
13323 REENTRANT_PROTO*) ;;
13324 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13325 esac
13326 echo "Prototype: $try" ;;
13327 esac
13328 ;;
c18e646a
JH
13329 *) case "$usethreads" in
13330 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13331 esac
90e831dc
SB
13332 d_gethostbyaddr_r=undef
13333 gethostbyaddr_r_proto=0
c18e646a 13334 ;;
a48ec845
JH
13335 esac
13336 ;;
10bc17b6
JH
13337*) gethostbyaddr_r_proto=0
13338 ;;
13339esac
13340
13341: see if gethostbyname_r exists
13342set gethostbyname_r d_gethostbyname_r
13343eval $inlibc
13344case "$d_gethostbyname_r" in
13345"$define")
13346 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13347 case "$d_gethostbyname_r_proto:$usethreads" in
13348 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
13349 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13350 eval $hasproto ;;
13351 *) ;;
13352 esac
13353 case "$d_gethostbyname_r_proto" in
13354 define)
10bc17b6
JH
13355 case "$gethostbyname_r_proto" in
13356 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13357 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13358 esac
13359 case "$gethostbyname_r_proto" in
13360 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13361 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13362 esac
13363 case "$gethostbyname_r_proto" in
13364 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13365 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13366 esac
13367 case "$gethostbyname_r_proto" in
90e831dc 13368 ''|0) d_gethostbyname_r=undef
10bc17b6 13369 gethostbyname_r_proto=0
a48ec845 13370 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13371 * ) case "$gethostbyname_r_proto" in
13372 REENTRANT_PROTO*) ;;
13373 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13374 esac
13375 echo "Prototype: $try" ;;
13376 esac
13377 ;;
c18e646a
JH
13378 *) case "$usethreads" in
13379 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13380 esac
90e831dc
SB
13381 d_gethostbyname_r=undef
13382 gethostbyname_r_proto=0
c18e646a 13383 ;;
a48ec845
JH
13384 esac
13385 ;;
10bc17b6
JH
13386*) gethostbyname_r_proto=0
13387 ;;
13388esac
13389
13390: see if gethostent_r exists
13391set gethostent_r d_gethostent_r
13392eval $inlibc
13393case "$d_gethostent_r" in
13394"$define")
13395 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13396 case "$d_gethostent_r_proto:$usethreads" in
13397 ":define") d_gethostent_r_proto=define
a48ec845
JH
13398 set d_gethostent_r_proto gethostent_r $hdrs
13399 eval $hasproto ;;
13400 *) ;;
13401 esac
13402 case "$d_gethostent_r_proto" in
13403 define)
10bc17b6
JH
13404 case "$gethostent_r_proto" in
13405 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13406 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13407 esac
13408 case "$gethostent_r_proto" in
13409 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13410 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13411 esac
13412 case "$gethostent_r_proto" in
13413 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13414 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13415 esac
13416 case "$gethostent_r_proto" in
13417 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13418 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13419 esac
13420 case "$gethostent_r_proto" in
13421 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13422 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13423 esac
13424 case "$gethostent_r_proto" in
13425 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13426 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13427 esac
13428 case "$gethostent_r_proto" in
90e831dc 13429 ''|0) d_gethostent_r=undef
10bc17b6 13430 gethostent_r_proto=0
a48ec845 13431 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13432 * ) case "$gethostent_r_proto" in
13433 REENTRANT_PROTO*) ;;
13434 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13435 esac
13436 echo "Prototype: $try" ;;
13437 esac
13438 ;;
c18e646a
JH
13439 *) case "$usethreads" in
13440 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13441 esac
90e831dc
SB
13442 d_gethostent_r=undef
13443 gethostent_r_proto=0
c18e646a 13444 ;;
a48ec845
JH
13445 esac
13446 ;;
10bc17b6
JH
13447*) gethostent_r_proto=0
13448 ;;
13449esac
b4eb6b3d
JH
13450
13451: see if prototypes for various gethostxxx netdb.h functions are available
13452echo " "
13453set d_gethostprotos gethostent $i_netdb netdb.h
13454eval $hasproto
13455
4e0554ec
JH
13456: see if getitimer exists
13457set getitimer d_getitimer
13458eval $inlibc
13459
b4eb6b3d
JH
13460: see if getlogin exists
13461set getlogin d_getlogin
13462eval $inlibc
13463
10bc17b6
JH
13464: see if getlogin_r exists
13465set getlogin_r d_getlogin_r
13466eval $inlibc
13467case "$d_getlogin_r" in
13468"$define")
13469 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
13470 case "$d_getlogin_r_proto:$usethreads" in
13471 ":define") d_getlogin_r_proto=define
a48ec845
JH
13472 set d_getlogin_r_proto getlogin_r $hdrs
13473 eval $hasproto ;;
13474 *) ;;
13475 esac
13476 case "$d_getlogin_r_proto" in
13477 define)
10bc17b6
JH
13478 case "$getlogin_r_proto" in
13479 ''|0) try='int getlogin_r(char*, size_t);'
13480 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13481 esac
13482 case "$getlogin_r_proto" in
13483 ''|0) try='int getlogin_r(char*, int);'
13484 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13485 esac
13486 case "$getlogin_r_proto" in
13487 ''|0) try='char* getlogin_r(char*, size_t);'
13488 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13489 esac
13490 case "$getlogin_r_proto" in
13491 ''|0) try='char* getlogin_r(char*, int);'
13492 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13493 esac
13494 case "$getlogin_r_proto" in
90e831dc 13495 ''|0) d_getlogin_r=undef
10bc17b6 13496 getlogin_r_proto=0
a48ec845 13497 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13498 * ) case "$getlogin_r_proto" in
13499 REENTRANT_PROTO*) ;;
13500 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13501 esac
13502 echo "Prototype: $try" ;;
13503 esac
13504 ;;
c18e646a
JH
13505 *) case "$usethreads" in
13506 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13507 esac
90e831dc
SB
13508 d_getlogin_r=undef
13509 getlogin_r_proto=0
c18e646a 13510 ;;
a48ec845
JH
13511 esac
13512 ;;
10bc17b6
JH
13513*) getlogin_r_proto=0
13514 ;;
13515esac
13516
b4eb6b3d
JH
13517: see if getmnt exists
13518set getmnt d_getmnt
13519eval $inlibc
13520
13521: see if getmntent exists
13522set getmntent d_getmntent
13523eval $inlibc
13524
13525: see if getnetbyaddr exists
13526set getnetbyaddr d_getnbyaddr
13527eval $inlibc
13528
13529: see if getnetbyname exists
13530set getnetbyname d_getnbyname
13531eval $inlibc
13532
13533: see if getnetent exists
13534set getnetent d_getnent
13535eval $inlibc
13536
10bc17b6
JH
13537: see if getnetbyaddr_r exists
13538set getnetbyaddr_r d_getnetbyaddr_r
13539eval $inlibc
13540case "$d_getnetbyaddr_r" in
13541"$define")
13542 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13543 case "$d_getnetbyaddr_r_proto:$usethreads" in
13544 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
13545 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13546 eval $hasproto ;;
13547 *) ;;
13548 esac
13549 case "$d_getnetbyaddr_r_proto" in
13550 define)
10bc17b6
JH
13551 case "$getnetbyaddr_r_proto" in
13552 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13553 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13554 esac
13555 case "$getnetbyaddr_r_proto" in
13556 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13557 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13558 esac
13559 case "$getnetbyaddr_r_proto" in
13560 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13561 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13562 esac
13563 case "$getnetbyaddr_r_proto" in
13564 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13565 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13566 esac
13567 case "$getnetbyaddr_r_proto" in
13568 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13569 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13570 esac
13571 case "$getnetbyaddr_r_proto" in
13572 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13573 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13574 esac
13575 case "$getnetbyaddr_r_proto" in
13576 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13577 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13578 esac
13579 case "$getnetbyaddr_r_proto" in
a845a0d4
JH
13580 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13581 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13582 esac
13583 case "$getnetbyaddr_r_proto" in
90e831dc 13584 ''|0) d_getnetbyaddr_r=undef
10bc17b6 13585 getnetbyaddr_r_proto=0
a48ec845 13586 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13587 * ) case "$getnetbyaddr_r_proto" in
13588 REENTRANT_PROTO*) ;;
13589 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13590 esac
13591 echo "Prototype: $try" ;;
13592 esac
13593 ;;
c18e646a
JH
13594 *) case "$usethreads" in
13595 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13596 esac
90e831dc
SB
13597 d_getnetbyaddr_r=undef
13598 getnetbyaddr_r_proto=0
c18e646a 13599 ;;
a48ec845
JH
13600 esac
13601 ;;
10bc17b6
JH
13602*) getnetbyaddr_r_proto=0
13603 ;;
13604esac
13605
13606: see if getnetbyname_r exists
13607set getnetbyname_r d_getnetbyname_r
13608eval $inlibc
13609case "$d_getnetbyname_r" in
13610"$define")
13611 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13612 case "$d_getnetbyname_r_proto:$usethreads" in
13613 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
13614 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13615 eval $hasproto ;;
13616 *) ;;
13617 esac
13618 case "$d_getnetbyname_r_proto" in
13619 define)
10bc17b6
JH
13620 case "$getnetbyname_r_proto" in
13621 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13622 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13623 esac
13624 case "$getnetbyname_r_proto" in
13625 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13626 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13627 esac
13628 case "$getnetbyname_r_proto" in
13629 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13630 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13631 esac
13632 case "$getnetbyname_r_proto" in
13633 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13634 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13635 esac
13636 case "$getnetbyname_r_proto" in
90e831dc 13637 ''|0) d_getnetbyname_r=undef
10bc17b6 13638 getnetbyname_r_proto=0
a48ec845 13639 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13640 * ) case "$getnetbyname_r_proto" in
13641 REENTRANT_PROTO*) ;;
13642 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13643 esac
13644 echo "Prototype: $try" ;;
13645 esac
13646 ;;
c18e646a
JH
13647 *) case "$usethreads" in
13648 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13649 esac
90e831dc
SB
13650 d_getnetbyname_r=undef
13651 getnetbyname_r_proto=0
c18e646a 13652 ;;
a48ec845
JH
13653 esac
13654 ;;
10bc17b6
JH
13655*) getnetbyname_r_proto=0
13656 ;;
13657esac
13658
13659: see if getnetent_r exists
13660set getnetent_r d_getnetent_r
13661eval $inlibc
13662case "$d_getnetent_r" in
13663"$define")
13664 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13665 case "$d_getnetent_r_proto:$usethreads" in
13666 ":define") d_getnetent_r_proto=define
a48ec845
JH
13667 set d_getnetent_r_proto getnetent_r $hdrs
13668 eval $hasproto ;;
13669 *) ;;
13670 esac
13671 case "$d_getnetent_r_proto" in
13672 define)
10bc17b6
JH
13673 case "$getnetent_r_proto" in
13674 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13675 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13676 esac
13677 case "$getnetent_r_proto" in
13678 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13679 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13680 esac
13681 case "$getnetent_r_proto" in
13682 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13683 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13684 esac
13685 case "$getnetent_r_proto" in
13686 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13687 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13688 esac
13689 case "$getnetent_r_proto" in
13690 ''|0) try='int getnetent_r(struct netent*, char*, int);'
13691 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13692 esac
13693 case "$getnetent_r_proto" in
13694 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13695 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13696 esac
13697 case "$getnetent_r_proto" in
90e831dc 13698 ''|0) d_getnetent_r=undef
10bc17b6 13699 getnetent_r_proto=0
a48ec845 13700 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13701 * ) case "$getnetent_r_proto" in
13702 REENTRANT_PROTO*) ;;
13703 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13704 esac
13705 echo "Prototype: $try" ;;
13706 esac
13707 ;;
c18e646a
JH
13708 *) case "$usethreads" in
13709 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13710 esac
90e831dc
SB
13711 d_getnetent_r=undef
13712 getnetent_r_proto=0
c18e646a 13713 ;;
a48ec845
JH
13714 esac
13715 ;;
10bc17b6
JH
13716*) getnetent_r_proto=0
13717 ;;
13718esac
13719
b4eb6b3d
JH
13720: see if prototypes for various getnetxxx netdb.h functions are available
13721echo " "
13722set d_getnetprotos getnetent $i_netdb netdb.h
13723eval $hasproto
13724
0c0643d0
JH
13725: see if getpagesize exists
13726set getpagesize d_getpagsz
13727eval $inlibc
13728
b4eb6b3d
JH
13729
13730: see if getprotobyname exists
13731set getprotobyname d_getpbyname
13732eval $inlibc
13733
13734: see if getprotobynumber exists
13735set getprotobynumber d_getpbynumber
13736eval $inlibc
13737
13738: see if getprotoent exists
13739set getprotoent d_getpent
13740eval $inlibc
13741
13742: see if getpgid exists
13743set getpgid d_getpgid
13744eval $inlibc
13745
13746: see if getpgrp2 exists
13747set getpgrp2 d_getpgrp2
13748eval $inlibc
13749
13750: see if getppid exists
13751set getppid d_getppid
13752eval $inlibc
13753
13754: see if getpriority exists
13755set getpriority d_getprior
13756eval $inlibc
13757
10bc17b6
JH
13758: see if getprotobyname_r exists
13759set getprotobyname_r d_getprotobyname_r
13760eval $inlibc
13761case "$d_getprotobyname_r" in
13762"$define")
13763 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13764 case "$d_getprotobyname_r_proto:$usethreads" in
13765 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
13766 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13767 eval $hasproto ;;
13768 *) ;;
13769 esac
13770 case "$d_getprotobyname_r_proto" in
13771 define)
10bc17b6
JH
13772 case "$getprotobyname_r_proto" in
13773 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13774 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13775 esac
13776 case "$getprotobyname_r_proto" in
13777 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13778 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13779 esac
13780 case "$getprotobyname_r_proto" in
13781 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13782 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13783 esac
13784 case "$getprotobyname_r_proto" in
90e831dc 13785 ''|0) d_getprotobyname_r=undef
10bc17b6 13786 getprotobyname_r_proto=0
a48ec845 13787 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13788 * ) case "$getprotobyname_r_proto" in
13789 REENTRANT_PROTO*) ;;
13790 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13791 esac
13792 echo "Prototype: $try" ;;
13793 esac
13794 ;;
c18e646a
JH
13795 *) case "$usethreads" in
13796 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13797 esac
90e831dc
SB
13798 d_getprotobyname_r=undef
13799 getprotobyname_r_proto=0
c18e646a 13800 ;;
a48ec845
JH
13801 esac
13802 ;;
10bc17b6
JH
13803*) getprotobyname_r_proto=0
13804 ;;
13805esac
13806
13807: see if getprotobynumber_r exists
13808set getprotobynumber_r d_getprotobynumber_r
13809eval $inlibc
13810case "$d_getprotobynumber_r" in
13811"$define")
13812 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13813 case "$d_getprotobynumber_r_proto:$usethreads" in
13814 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
13815 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13816 eval $hasproto ;;
13817 *) ;;
13818 esac
13819 case "$d_getprotobynumber_r_proto" in
13820 define)
10bc17b6
JH
13821 case "$getprotobynumber_r_proto" in
13822 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13823 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13824 esac
13825 case "$getprotobynumber_r_proto" in
13826 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13827 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13828 esac
13829 case "$getprotobynumber_r_proto" in
13830 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13831 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13832 esac
13833 case "$getprotobynumber_r_proto" in
90e831dc 13834 ''|0) d_getprotobynumber_r=undef
10bc17b6 13835 getprotobynumber_r_proto=0
a48ec845 13836 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13837 * ) case "$getprotobynumber_r_proto" in
13838 REENTRANT_PROTO*) ;;
13839 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13840 esac
13841 echo "Prototype: $try" ;;
13842 esac
13843 ;;
c18e646a
JH
13844 *) case "$usethreads" in
13845 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13846 esac
90e831dc
SB
13847 d_getprotobynumber_r=undef
13848 getprotobynumber_r_proto=0
c18e646a 13849 ;;
a48ec845
JH
13850 esac
13851 ;;
10bc17b6
JH
13852*) getprotobynumber_r_proto=0
13853 ;;
13854esac
13855
13856: see if getprotoent_r exists
13857set getprotoent_r d_getprotoent_r
13858eval $inlibc
13859case "$d_getprotoent_r" in
13860"$define")
13861 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13862 case "$d_getprotoent_r_proto:$usethreads" in
13863 ":define") d_getprotoent_r_proto=define
a48ec845
JH
13864 set d_getprotoent_r_proto getprotoent_r $hdrs
13865 eval $hasproto ;;
13866 *) ;;
13867 esac
13868 case "$d_getprotoent_r_proto" in
13869 define)
10bc17b6
JH
13870 case "$getprotoent_r_proto" in
13871 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13872 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13873 esac
13874 case "$getprotoent_r_proto" in
13875 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13876 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13877 esac
13878 case "$getprotoent_r_proto" in
13879 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13880 ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13881 esac
13882 case "$getprotoent_r_proto" in
13883 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13884 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13885 esac
13886 case "$getprotoent_r_proto" in
90e831dc 13887 ''|0) d_getprotoent_r=undef
10bc17b6 13888 getprotoent_r_proto=0
a48ec845 13889 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13890 * ) case "$getprotoent_r_proto" in
13891 REENTRANT_PROTO*) ;;
13892 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13893 esac
13894 echo "Prototype: $try" ;;
13895 esac
13896 ;;
c18e646a
JH
13897 *) case "$usethreads" in
13898 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13899 esac
90e831dc
SB
13900 d_getprotoent_r=undef
13901 getprotoent_r_proto=0
c18e646a 13902 ;;
a48ec845
JH
13903 esac
13904 ;;
10bc17b6
JH
13905*) getprotoent_r_proto=0
13906 ;;
13907esac
13908
b4eb6b3d
JH
13909: see if prototypes for various getprotoxxx netdb.h functions are available
13910echo " "
13911set d_getprotoprotos getprotoent $i_netdb netdb.h
13912eval $hasproto
13913
13914: see if getprpwnam exists
13915set getprpwnam d_getprpwnam
13916eval $inlibc
13917
13918: see if getpwent exists
13919set getpwent d_getpwent
13920eval $inlibc
13921
10bc17b6
JH
13922: see if getpwent_r exists
13923set getpwent_r d_getpwent_r
13924eval $inlibc
13925case "$d_getpwent_r" in
13926"$define")
13927 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13928 case "$d_getpwent_r_proto:$usethreads" in
13929 ":define") d_getpwent_r_proto=define
a48ec845
JH
13930 set d_getpwent_r_proto getpwent_r $hdrs
13931 eval $hasproto ;;
13932 *) ;;
13933 esac
13934 case "$d_getpwent_r_proto" in
13935 define)
10bc17b6
JH
13936 case "$getpwent_r_proto" in
13937 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13938 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13939 esac
13940 case "$getpwent_r_proto" in
13941 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13942 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13943 esac
13944 case "$getpwent_r_proto" in
13945 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13946 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13947 esac
13948 case "$getpwent_r_proto" in
13949 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13950 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13951 esac
13952 case "$getpwent_r_proto" in
13953 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13954 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13955 esac
13956 case "$getpwent_r_proto" in
13957 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13958 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13959 esac
13960 case "$getpwent_r_proto" in
90e831dc 13961 ''|0) d_getpwent_r=undef
10bc17b6 13962 getpwent_r_proto=0
a48ec845 13963 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13964 * ) case "$getpwent_r_proto" in
13965 REENTRANT_PROTO*) ;;
13966 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13967 esac
13968 echo "Prototype: $try" ;;
13969 esac
13970 ;;
c18e646a
JH
13971 *) case "$usethreads" in
13972 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13973 esac
90e831dc
SB
13974 d_getpwent_r=undef
13975 getpwent_r_proto=0
c18e646a 13976 ;;
a48ec845
JH
13977 esac
13978 ;;
10bc17b6
JH
13979*) getpwent_r_proto=0
13980 ;;
13981esac
13982
13983: see if getpwnam_r exists
13984set getpwnam_r d_getpwnam_r
13985eval $inlibc
13986case "$d_getpwnam_r" in
13987"$define")
13988 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13989 case "$d_getpwnam_r_proto:$usethreads" in
13990 ":define") d_getpwnam_r_proto=define
a48ec845
JH
13991 set d_getpwnam_r_proto getpwnam_r $hdrs
13992 eval $hasproto ;;
13993 *) ;;
13994 esac
13995 case "$d_getpwnam_r_proto" in
13996 define)
10bc17b6
JH
13997 case "$getpwnam_r_proto" in
13998 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13999 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14000 esac
14001 case "$getpwnam_r_proto" in
14002 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14003 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14004 esac
14005 case "$getpwnam_r_proto" in
14006 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14007 ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14008 esac
14009 case "$getpwnam_r_proto" in
14010 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14011 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14012 esac
14013 case "$getpwnam_r_proto" in
90e831dc 14014 ''|0) d_getpwnam_r=undef
10bc17b6 14015 getpwnam_r_proto=0
a48ec845 14016 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14017 * ) case "$getpwnam_r_proto" in
14018 REENTRANT_PROTO*) ;;
14019 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14020 esac
14021 echo "Prototype: $try" ;;
14022 esac
14023 ;;
c18e646a
JH
14024 *) case "$usethreads" in
14025 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14026 esac
90e831dc
SB
14027 d_getpwnam_r=undef
14028 getpwnam_r_proto=0
c18e646a 14029 ;;
a48ec845
JH
14030 esac
14031 ;;
10bc17b6
JH
14032*) getpwnam_r_proto=0
14033 ;;
14034esac
14035
14036: see if getpwuid_r exists
14037set getpwuid_r d_getpwuid_r
14038eval $inlibc
14039case "$d_getpwuid_r" in
14040"$define")
14041 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14042 case "$d_getpwuid_r_proto:$usethreads" in
14043 ":define") d_getpwuid_r_proto=define
a48ec845
JH
14044 set d_getpwuid_r_proto getpwuid_r $hdrs
14045 eval $hasproto ;;
14046 *) ;;
14047 esac
14048 case "$d_getpwuid_r_proto" in
14049 define)
10bc17b6
JH
14050 case "$getpwuid_r_proto" in
14051 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14052 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14053 esac
14054 case "$getpwuid_r_proto" in
14055 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14056 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14057 esac
14058 case "$getpwuid_r_proto" in
14059 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14060 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14061 esac
14062 case "$getpwuid_r_proto" in
14063 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14064 ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14065 esac
14066 case "$getpwuid_r_proto" in
90e831dc 14067 ''|0) d_getpwuid_r=undef
10bc17b6 14068 getpwuid_r_proto=0
a48ec845 14069 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14070 * ) case "$getpwuid_r_proto" in
14071 REENTRANT_PROTO*) ;;
14072 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14073 esac
14074 echo "Prototype: $try" ;;
14075 esac
14076 ;;
c18e646a
JH
14077 *) case "$usethreads" in
14078 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14079 esac
90e831dc
SB
14080 d_getpwuid_r=undef
14081 getpwuid_r_proto=0
c18e646a 14082 ;;
a48ec845
JH
14083 esac
14084 ;;
10bc17b6
JH
14085*) getpwuid_r_proto=0
14086 ;;
14087esac
14088
b4eb6b3d
JH
14089
14090: see if getservbyname exists
14091set getservbyname d_getsbyname
14092eval $inlibc
14093
14094: see if getservbyport exists
14095set getservbyport d_getsbyport
14096eval $inlibc
14097
14098: see if getservent exists
14099set getservent d_getsent
14100eval $inlibc
14101
10bc17b6
JH
14102: see if getservbyname_r exists
14103set getservbyname_r d_getservbyname_r
14104eval $inlibc
14105case "$d_getservbyname_r" in
14106"$define")
14107 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14108 case "$d_getservbyname_r_proto:$usethreads" in
14109 ":define") d_getservbyname_r_proto=define
a48ec845
JH
14110 set d_getservbyname_r_proto getservbyname_r $hdrs
14111 eval $hasproto ;;
14112 *) ;;
14113 esac
14114 case "$d_getservbyname_r_proto" in
14115 define)
10bc17b6
JH
14116 case "$getservbyname_r_proto" in
14117 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14118 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14119 esac
14120 case "$getservbyname_r_proto" in
14121 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14122 ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14123 esac
14124 case "$getservbyname_r_proto" in
14125 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14126 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14127 esac
14128 case "$getservbyname_r_proto" in
90e831dc 14129 ''|0) d_getservbyname_r=undef
10bc17b6 14130 getservbyname_r_proto=0
a48ec845 14131 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14132 * ) case "$getservbyname_r_proto" in
14133 REENTRANT_PROTO*) ;;
14134 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14135 esac
14136 echo "Prototype: $try" ;;
14137 esac
14138 ;;
c18e646a
JH
14139 *) case "$usethreads" in
14140 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14141 esac
90e831dc
SB
14142 d_getservbyname_r=undef
14143 getservbyname_r_proto=0
c18e646a 14144 ;;
a48ec845
JH
14145 esac
14146 ;;
10bc17b6
JH
14147*) getservbyname_r_proto=0
14148 ;;
14149esac
14150
14151: see if getservbyport_r exists
14152set getservbyport_r d_getservbyport_r
14153eval $inlibc
14154case "$d_getservbyport_r" in
14155"$define")
14156 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14157 case "$d_getservbyport_r_proto:$usethreads" in
14158 ":define") d_getservbyport_r_proto=define
a48ec845
JH
14159 set d_getservbyport_r_proto getservbyport_r $hdrs
14160 eval $hasproto ;;
14161 *) ;;
14162 esac
14163 case "$d_getservbyport_r_proto" in
14164 define)
10bc17b6
JH
14165 case "$getservbyport_r_proto" in
14166 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14167 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14168 esac
14169 case "$getservbyport_r_proto" in
14170 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14171 ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14172 esac
14173 case "$getservbyport_r_proto" in
14174 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14175 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14176 esac
14177 case "$getservbyport_r_proto" in
90e831dc 14178 ''|0) d_getservbyport_r=undef
10bc17b6 14179 getservbyport_r_proto=0
a48ec845 14180 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14181 * ) case "$getservbyport_r_proto" in
14182 REENTRANT_PROTO*) ;;
14183 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14184 esac
14185 echo "Prototype: $try" ;;
14186 esac
14187 ;;
c18e646a
JH
14188 *) case "$usethreads" in
14189 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14190 esac
90e831dc
SB
14191 d_getservbyport_r=undef
14192 getservbyport_r_proto=0
c18e646a 14193 ;;
a48ec845
JH
14194 esac
14195 ;;
10bc17b6
JH
14196*) getservbyport_r_proto=0
14197 ;;
14198esac
14199
14200: see if getservent_r exists
14201set getservent_r d_getservent_r
14202eval $inlibc
14203case "$d_getservent_r" in
14204"$define")
14205 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14206 case "$d_getservent_r_proto:$usethreads" in
14207 ":define") d_getservent_r_proto=define
a48ec845
JH
14208 set d_getservent_r_proto getservent_r $hdrs
14209 eval $hasproto ;;
14210 *) ;;
14211 esac
14212 case "$d_getservent_r_proto" in
14213 define)
10bc17b6
JH
14214 case "$getservent_r_proto" in
14215 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14216 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14217 esac
14218 case "$getservent_r_proto" in
14219 ''|0) try='int getservent_r(struct servent*, char*, int);'
14220 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14221 esac
14222 case "$getservent_r_proto" in
14223 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14224 ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14225 esac
14226 case "$getservent_r_proto" in
14227 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14228 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14229 esac
14230 case "$getservent_r_proto" in
90e831dc 14231 ''|0) d_getservent_r=undef
10bc17b6 14232 getservent_r_proto=0
a48ec845 14233 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14234 * ) case "$getservent_r_proto" in
14235 REENTRANT_PROTO*) ;;
14236 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14237 esac
14238 echo "Prototype: $try" ;;
14239 esac
14240 ;;
c18e646a
JH
14241 *) case "$usethreads" in
14242 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14243 esac
90e831dc
SB
14244 d_getservent_r=undef
14245 getservent_r_proto=0
c18e646a 14246 ;;
a48ec845
JH
14247 esac
14248 ;;
10bc17b6
JH
14249*) getservent_r_proto=0
14250 ;;
14251esac
14252
b4eb6b3d
JH
14253: see if prototypes for various getservxxx netdb.h functions are available
14254echo " "
14255set d_getservprotos getservent $i_netdb netdb.h
14256eval $hasproto
14257
14258: see if getspnam exists
14259set getspnam d_getspnam
14260eval $inlibc
14261
10bc17b6
JH
14262: see if this is a shadow.h system
14263set shadow.h i_shadow
14264eval $inhdr
14265
14266: see if getspnam_r exists
14267set getspnam_r d_getspnam_r
14268eval $inlibc
14269case "$d_getspnam_r" in
14270"$define")
14271 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
14272 case "$d_getspnam_r_proto:$usethreads" in
14273 ":define") d_getspnam_r_proto=define
a48ec845
JH
14274 set d_getspnam_r_proto getspnam_r $hdrs
14275 eval $hasproto ;;
14276 *) ;;
14277 esac
14278 case "$d_getspnam_r_proto" in
14279 define)
10bc17b6
JH
14280 case "$getspnam_r_proto" in
14281 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14282 ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14283 esac
14284 case "$getspnam_r_proto" in
14285 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14286 ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14287 esac
14288 case "$getspnam_r_proto" in
90e831dc 14289 ''|0) d_getspnam_r=undef
10bc17b6 14290 getspnam_r_proto=0
a48ec845 14291 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14292 * ) case "$getspnam_r_proto" in
14293 REENTRANT_PROTO*) ;;
14294 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14295 esac
14296 echo "Prototype: $try" ;;
14297 esac
14298 ;;
c18e646a
JH
14299 *) case "$usethreads" in
14300 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14301 esac
90e831dc
SB
14302 d_getspnam_r=undef
14303 getspnam_r_proto=0
c18e646a 14304 ;;
a48ec845
JH
14305 esac
14306 ;;
10bc17b6
JH
14307*) getspnam_r_proto=0
14308 ;;
14309esac
14310
b4eb6b3d
JH
14311: see if gettimeofday or ftime exists
14312set gettimeofday d_gettimeod
14313eval $inlibc
14314case "$d_gettimeod" in
14315"$undef")
14316 set ftime d_ftime
14317 eval $inlibc
14318 ;;
14319*)
14320 val="$undef"; set d_ftime; eval $setvar
14321 ;;
14322esac
14323case "$d_gettimeod$d_ftime" in
14324"$undef$undef")
14325 echo " "
14326 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14327 ;;
14328esac
14329
10bc17b6
JH
14330: see if gmtime_r exists
14331set gmtime_r d_gmtime_r
14332eval $inlibc
14333case "$d_gmtime_r" in
14334"$define")
d63eadf0 14335 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14336 case "$d_gmtime_r_proto:$usethreads" in
14337 ":define") d_gmtime_r_proto=define
a48ec845
JH
14338 set d_gmtime_r_proto gmtime_r $hdrs
14339 eval $hasproto ;;
14340 *) ;;
14341 esac
14342 case "$d_gmtime_r_proto" in
14343 define)
10bc17b6
JH
14344 case "$gmtime_r_proto" in
14345 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14346 ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14347 esac
14348 case "$gmtime_r_proto" in
14349 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14350 ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14351 esac
14352 case "$gmtime_r_proto" in
90e831dc 14353 ''|0) d_gmtime_r=undef
10bc17b6 14354 gmtime_r_proto=0
a48ec845 14355 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14356 * ) case "$gmtime_r_proto" in
14357 REENTRANT_PROTO*) ;;
14358 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14359 esac
14360 echo "Prototype: $try" ;;
14361 esac
b4eb6b3d 14362 ;;
c18e646a
JH
14363 *) case "$usethreads" in
14364 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14365 esac
90e831dc
SB
14366 d_gmtime_r=undef
14367 gmtime_r_proto=0
c18e646a 14368 ;;
a48ec845
JH
14369 esac
14370 ;;
10bc17b6 14371*) gmtime_r_proto=0
b4eb6b3d
JH
14372 ;;
14373esac
14374
14375: see if hasmntopt exists
14376set hasmntopt d_hasmntopt
14377eval $inlibc
14378
14379: see if this is a netinet/in.h or sys/in.h system
14380set netinet/in.h i_niin sys/in.h i_sysin
14381eval $inhdr
14382
14383: see if arpa/inet.h has to be included
14384set arpa/inet.h i_arpainet
14385eval $inhdr
14386
14387: see if htonl --and friends-- exists
14388val=''
14389set htonl val
14390eval $inlibc
14391
14392: Maybe they are macros.
14393case "$val" in
14394$undef)
14395 $cat >htonl.c <<EOM
14396#include <stdio.h>
14397#include <sys/types.h>
14398#$i_niin I_NETINET_IN
14399#$i_sysin I_SYS_IN
14400#$i_arpainet I_ARPA_INET
14401#ifdef I_NETINET_IN
14402#include <netinet/in.h>
14403#endif
14404#ifdef I_SYS_IN
14405#include <sys/in.h>
14406#endif
14407#ifdef I_ARPA_INET
14408#include <arpa/inet.h>
14409#endif
14410#ifdef htonl
14411printf("Defined as a macro.");
14412#endif
14413EOM
14414 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14415 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14416 val="$define"
14417 echo "But it seems to be defined as a macro." >&4
14418 fi
14419 $rm -f htonl.?
14420 ;;
14421esac
14422set d_htonl
14423eval $setvar
14424
36adc09b
JH
14425: see if ilogbl exists
14426set ilogbl d_ilogbl
14427eval $inlibc
14428
b4eb6b3d
JH
14429: index or strchr
14430echo " "
14431if set index val -f; eval $csym; $val; then
14432 if set strchr val -f d_strchr; eval $csym; $val; then
14433 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14434 val="$define"
14435 vali="$undef"
14436 echo "strchr() found." >&4
14437 else
14438 val="$undef"
14439 vali="$define"
14440 echo "index() found." >&4
14441 fi
14442 else
14443 val="$undef"
14444 vali="$define"
8dfa8df9
JH
14445 echo "index() found." >&4
14446 fi
b4eb6b3d 14447else
8dfa8df9
JH
14448 if set strchr val -f d_strchr; eval $csym; $val; then
14449 val="$define"
14450 vali="$undef"
14451 echo "strchr() found." >&4
14452 else
14453 echo "No index() or strchr() found!" >&4
14454 val="$undef"
14455 vali="$undef"
14456 fi
b4eb6b3d 14457fi
8dfa8df9
JH
14458set d_strchr; eval $setvar
14459val="$vali"
14460set d_index; eval $setvar
14461
14462: check whether inet_aton exists
14463set inet_aton d_inetaton
14464eval $inlibc
b4eb6b3d
JH
14465
14466: Look for isascii
14467echo " "
36adc09b 14468$cat >isascii.c <<EOCP
b4eb6b3d
JH
14469#include <stdio.h>
14470#include <ctype.h>
55954f19
JH
14471#$i_stdlib I_STDLIB
14472#ifdef I_STDLIB
14473#include <stdlib.h>
14474#endif
b4eb6b3d
JH
14475int main() {
14476 int c = 'A';
14477 if (isascii(c))
14478 exit(0);
14479 else
14480 exit(1);
14481}
14482EOCP
14483set isascii
14484if eval $compile; then
14485 echo "isascii() found." >&4
14486 val="$define"
14487else
14488 echo "isascii() NOT found." >&4
14489 val="$undef"
14490fi
14491set d_isascii
14492eval $setvar
14493$rm -f isascii*
14494
758a5d79
JH
14495: see if isfinite exists
14496set isfinite d_isfinite
14497eval $inlibc
14498
14499: see if isinf exists
14500set isinf d_isinf
14501eval $inlibc
14502
b4eb6b3d
JH
14503: see if isnan exists
14504set isnan d_isnan
14505eval $inlibc
14506
14507: see if isnanl exists
14508set isnanl d_isnanl
14509eval $inlibc
14510
14511: see if killpg exists
14512set killpg d_killpg
14513eval $inlibc
14514
14515: see if lchown exists
14516echo " "
14517$cat > try.c <<'EOCP'
14518/* System header to define __stub macros and hopefully few prototypes,
14519 which can conflict with char lchown(); below. */
14520#include <assert.h>
14521/* Override any gcc2 internal prototype to avoid an error. */
14522/* We use char because int might match the return type of a gcc2
14523 builtin and then its argument prototype would still apply. */
14524char lchown();
14525int main() {
14526 /* The GNU C library defines this for functions which it implements
14527 to always fail with ENOSYS. Some functions are actually named
14528 something starting with __ and the normal name is an alias. */
14529#if defined (__stub_lchown) || defined (__stub___lchown)
14530choke me
14531#else
14532lchown();
14533#endif
14534; return 0; }
14535EOCP
14536set try
14537if eval $compile; then
14538 $echo "lchown() found." >&4
14539 val="$define"
14540else
14541 $echo "lchown() NOT found." >&4
14542 val="$undef"
14543fi
14544set d_lchown
14545eval $setvar
14546
14547: See if number of significant digits in a double precision number is known
14548echo " "
14549$cat >ldbl_dig.c <<EOM
14550#$i_limits I_LIMITS
14551#$i_float I_FLOAT
14552#ifdef I_LIMITS
14553#include <limits.h>
14554#endif
14555#ifdef I_FLOAT
14556#include <float.h>
14557#endif
14558#ifdef LDBL_DIG
14559printf("Contains LDBL_DIG");
14560#endif
14561EOM
14562$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14563if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14564 echo "LDBL_DIG found." >&4
14565 val="$define"
14566else
14567 echo "LDBL_DIG NOT found." >&4
14568 val="$undef"
14569fi
14570$rm -f ldbl_dig.?
14571set d_ldbl_dig
14572eval $setvar
14573
0a0abfba
MB
14574: see if this is a math.h system
14575set math.h i_math
14576eval $inhdr
14577
14578d_libm_lib_version="$undef"
14579case $i_math in
14580 $define)
14581 : check to see if math.h defines _LIB_VERSION
14582 echo " "
14583 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14584 $cat >try.c <<EOCP
14585#include <unistd.h>
14586#include <math.h>
14587int main (int argc, char *argv[])
14588{
14589 printf ("%d\n", _LIB_VERSION);
14590 return (0);
14591 } /* main */
14592EOCP
14593 set try
14594 if eval $compile; then
14595 foo=`$run ./try`
14596 echo "Yes, it does ($foo)" >&4
14597 d_libm_lib_version="$define"
14598 else
14599 echo "No, it does not (probably harmless)\n" >&4
14600 fi
14601 $rm -f try.* try core core.try.*
14602 ;;
14603
14604 esac
14605
b4eb6b3d
JH
14606: see if link exists
14607set link d_link
14608eval $inlibc
14609
10bc17b6
JH
14610: see if localtime_r exists
14611set localtime_r d_localtime_r
14612eval $inlibc
14613case "$d_localtime_r" in
14614"$define")
d63eadf0 14615 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14616 case "$d_localtime_r_proto:$usethreads" in
14617 ":define") d_localtime_r_proto=define
a48ec845
JH
14618 set d_localtime_r_proto localtime_r $hdrs
14619 eval $hasproto ;;
14620 *) ;;
14621 esac
14622 case "$d_localtime_r_proto" in
14623 define)
10bc17b6
JH
14624 case "$localtime_r_proto" in
14625 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14626 ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14627 esac
14628 case "$localtime_r_proto" in
14629 ''|0) try='int localtime_r(const time_t*, struct tm*);'
14630 ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14631 esac
14632 case "$localtime_r_proto" in
90e831dc 14633 ''|0) d_localtime_r=undef
10bc17b6 14634 localtime_r_proto=0
a48ec845 14635 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14636 * ) case "$localtime_r_proto" in
14637 REENTRANT_PROTO*) ;;
14638 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14639 esac
14640 echo "Prototype: $try" ;;
14641 esac
14642 ;;
c18e646a
JH
14643 *) case "$usethreads" in
14644 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14645 esac
90e831dc
SB
14646 d_localtime_r=undef
14647 localtime_r_proto=0
c18e646a 14648 ;;
a48ec845
JH
14649 esac
14650 ;;
10bc17b6
JH
14651*) localtime_r_proto=0
14652 ;;
14653esac
14654
8572b25d
BH
14655: see if localtime_r calls tzset
14656case "$localtime_r_proto" in
14657REENTRANT_PROTO*)
14658 $cat >try.c <<EOCP
14659/* Does our libc's localtime_r call tzset ?
14660 * return 0 if so, 1 otherwise.
14661 */
14662#include <sys/types.h>
14663#include <unistd.h>
14664#include <time.h>
14665#include <string.h>
14666#include <malloc.h>
14667int main()
14668{
14669 time_t t = time(0L);
14670 char w_tz[]="TZ" "=GMT+5",
14671 e_tz[]="TZ" "=GMT-5",
14672 *tz_e = (char*)malloc(16),
14673 *tz_w = (char*)malloc(16);
14674 struct tm tm_e, tm_w;
14675 memset(&tm_e,'\0',sizeof(struct tm));
14676 memset(&tm_w,'\0',sizeof(struct tm));
14677 strcpy(tz_e,e_tz);
14678 strcpy(tz_w,w_tz);
14679
14680 putenv(tz_e);
14681 localtime_r(&t, &tm_e);
14682
14683 putenv(tz_w);
14684 localtime_r(&t, &tm_w);
14685
14686 if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14687 return 1;
14688 return 0;
14689}
14690EOCP
14691 set try
14692 if eval $compile; then
14693 if ./try; then
14694 d_localtime_r_needs_tzset=undef;
14695 else
14696 d_localtime_r_needs_tzset=define;
14697 fi;
14698 else
14699 d_localtime_r_needs_tzset=undef;
14700 fi;
14701 ;;
14702 *)
14703 d_localtime_r_needs_tzset=undef;
14704 ;;
14705esac
14706$rm -f try try.* core
14707
b4eb6b3d
JH
14708: see if localeconv exists
14709set localeconv d_locconv
14710eval $inlibc
14711
14712: see if lockf exists
14713set lockf d_lockf
14714eval $inlibc
14715
b4eb6b3d
JH
14716: see if prototype for lseek is available
14717echo " "
4786929f 14718set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
14719eval $hasproto
14720
14721: see if lstat exists
14722set lstat d_lstat
14723eval $inlibc
14724
14725: see if madvise exists
14726set madvise d_madvise
14727eval $inlibc
14728
7dd121ae
MB
14729: see if malloc_size exists
14730set malloc_size d_malloc_size
14731eval $inlibc
14732
14733: see if malloc_size_good exists
14734set malloc_good_size d_malloc_good_size
14735eval $inlibc
14736
b4eb6b3d
JH
14737: see if mblen exists
14738set mblen d_mblen
14739eval $inlibc
14740
14741: see if mbstowcs exists
14742set mbstowcs d_mbstowcs
14743eval $inlibc
14744
14745: see if mbtowc exists
14746set mbtowc d_mbtowc
14747eval $inlibc
14748
14749: see if memchr exists
14750set memchr d_memchr
14751eval $inlibc
14752
14753: see if memcmp exists
14754set memcmp d_memcmp
14755eval $inlibc
14756
14757: see if memcpy exists
14758set memcpy d_memcpy
14759eval $inlibc
14760
14761: see if memmove exists
14762set memmove d_memmove
14763eval $inlibc
14764
14765: see if memset exists
14766set memset d_memset
14767eval $inlibc
14768
14769: see if mkdir exists
14770set mkdir d_mkdir
14771eval $inlibc
14772
14773: see if mkdtemp exists
14774set mkdtemp d_mkdtemp
14775eval $inlibc
14776
14777: see if mkfifo exists
14778set mkfifo d_mkfifo
14779eval $inlibc
14780
14781: see if mkstemp exists
14782set mkstemp d_mkstemp
14783eval $inlibc
14784
14785: see if mkstemps exists
14786set mkstemps d_mkstemps
14787eval $inlibc
14788
14789: see if mktime exists
14790set mktime d_mktime
14791eval $inlibc
14792
14793: see if this is a sys/mman.h system
14794set sys/mman.h i_sysmman
14795eval $inhdr
14796
14797: see if mmap exists
14798set mmap d_mmap
14799eval $inlibc
14800: see what shmat returns
14801: default to something harmless
14802mmaptype='void *'
14803case "$i_sysmman$d_mmap" in
14804"$define$define")
14805 $cat >mmap.c <<'END'
14806#include <sys/mman.h>
14807void *mmap();
14808END
14809 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14810 mmaptype='void *'
14811 else
14812 mmaptype='caddr_t'
14813 fi
14814 echo "and it returns ($mmaptype)." >&4
14815 ;;
14816esac
14817
14818
14819
89ce900e
JH
14820: see if sqrtl exists
14821set sqrtl d_sqrtl
14822eval $inlibc
14823
af1ff193
JH
14824: see if scalbnl exists
14825set scalbnl d_scalbnl
14826eval $inlibc
14827
89ce900e
JH
14828: see if modfl exists
14829set modfl d_modfl
14830eval $inlibc
14831
14832: see if prototype for modfl is available
14833echo " "
3a794506 14834set d_modflproto modfl $i_math math.h
89ce900e
JH
14835eval $hasproto
14836
14837d_modfl_pow32_bug="$undef"
14838
14839case "$d_longdbl$d_modfl" in
14840$define$define)
14841 $cat <<EOM
14842Checking to see whether your modfl() is okay for large values...
14843EOM
14844$cat >try.c <<EOCP
14845#include <math.h>
14846#include <stdio.h>
14847EOCP
14848if $test "X$d_modflproto" != "X$define"; then
14849 $cat >>try.c <<EOCP
14850/* Sigh. many current glibcs provide the function, but do not prototype it. */
14851long double modfl (long double, long double *);
14852EOCP
14853fi
14854$cat >>try.c <<EOCP
14855int main() {
14856 long double nv = 4294967303.15;
14857 long double v, w;
14858 v = modfl(nv, &w);
14859#ifdef __GLIBC__
14860 printf("glibc");
14861#endif
14862 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14863 return 0;
14864}
14865EOCP
14866 case "$osname:$gccversion" in
14867 aix:) saveccflags="$ccflags"
14868 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14869 esac
14870 set try
14871 if eval $compile; then
14872 foo=`$run ./try`
14873 case "$foo" in
14874 *" 4294967303.150000 1.150000 4294967302.000000")
14875 echo >&4 "Your modfl() is broken for large values."
14876 d_modfl_pow32_bug="$define"
14877 case "$foo" in
14878 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14879 ;;
14880 esac
14881 ;;
14882 *" 4294967303.150000 0.150000 4294967303.000000")
14883 echo >&4 "Your modfl() seems okay for large values."
14884 ;;
14885 *) echo >&4 "I don't understand your modfl() at all."
14886 d_modfl="$undef"
14887 ;;
14888 esac
14889 $rm -f try.* try core core.try.*
14890 else
14891 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14892 d_modfl="$undef"
14893 fi
14894 case "$osname:$gccversion" in
14895 aix:) ccflags="$saveccflags" ;; # restore
14896 esac
14897 ;;
14898esac
14899
14900if $test "$uselongdouble" = "$define"; then
af1ff193
JH
14901 message=""
14902 if $test "$d_sqrtl" != "$define"; then
14903 message="$message sqrtl"
14904 fi
14905 if $test "$d_modfl" != "$define"; then
89ce900e
JH
14906 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14907 echo "You have both aintl and copysignl, so I can emulate modfl."
14908 else
af1ff193 14909 message="$message modfl"
89ce900e 14910 fi
af1ff193
JH
14911 fi
14912 if $test "$d_frexpl" != "$define"; then
14913 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14914 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14915 else
14916 message="$message frexpl"
14917 fi
14918 fi
89ce900e 14919
af1ff193 14920 if $test "$message" != ""; then
89ce900e
JH
14921 $cat <<EOM >&4
14922
14923*** You requested the use of long doubles but you do not seem to have
af1ff193
JH
14924*** the following mathematical functions needed for long double support:
14925*** $message
fe63a0b4
JH
14926*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14927*** Cannot continue, aborting.
89ce900e
JH
14928
14929EOM
14930
fe63a0b4 14931 exit 1
89ce900e
JH
14932 fi
14933fi
14934
b4eb6b3d
JH
14935: see if mprotect exists
14936set mprotect d_mprotect
14937eval $inlibc
14938
14939: see if msgctl exists
14940set msgctl d_msgctl
14941eval $inlibc
14942
14943: see if msgget exists
14944set msgget d_msgget
14945eval $inlibc
14946
14947: see if msgsnd exists
14948set msgsnd d_msgsnd
14949eval $inlibc
14950
14951: see if msgrcv exists
14952set msgrcv d_msgrcv
14953eval $inlibc
14954
14955: see how much of the 'msg*(2)' library is present.
14956h_msg=true
14957echo " "
14958case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14959*"$undef"*) h_msg=false;;
14960esac
14961case "$osname" in
14962freebsd)
14963 case "`ipcs 2>&1`" in
14964 "SVID messages"*"not configured"*)
14965 echo "Your $osname does not have the msg*(2) configured." >&4
14966 h_msg=false
14967 val="$undef"
14968 set msgctl d_msgctl
14969 eval $setvar
14970 set msgget d_msgget
14971 eval $setvar
14972 set msgsnd d_msgsnd
14973 eval $setvar
14974 set msgrcv d_msgrcv
14975 eval $setvar
14976 ;;
14977 esac
14978 ;;
14979esac
14980: we could also check for sys/ipc.h ...
14981if $h_msg && $test `./findhdr sys/msg.h`; then
14982 echo "You have the full msg*(2) library." >&4
14983 val="$define"
14984else
14985 echo "You don't have the full msg*(2) library." >&4
14986 val="$undef"
14987fi
14988set d_msg
14989eval $setvar
14990
4e0554ec
JH
14991
14992echo " "
14993echo "Checking to see if your system supports struct msghdr..." >&4
14994set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14995eval $hasstruct
14996case "$d_msghdr_s" in
14997"$define") echo "Yes, it does." ;;
14998*) echo "No, it doesn't." ;;
14999esac
15000
15001
b4eb6b3d
JH
15002: see if msync exists
15003set msync d_msync
15004eval $inlibc
15005
15006: see if munmap exists
15007set munmap d_munmap
15008eval $inlibc
15009
15010: see if nice exists
15011set nice d_nice
15012eval $inlibc
15013
2765b840
JH
15014: see if this is a langinfo.h system
15015set langinfo.h i_langinfo
15016eval $inhdr
15017
15018: see if nl_langinfo exists
15019set nl_langinfo d_nl_langinfo
15020eval $inlibc
15021
b4eb6b3d
JH
15022: check for length of character
15023echo " "
15024case "$charsize" in
15025'')
15026 echo "Checking to see how big your characters are (hey, you never know)..." >&4
74d00865 15027 $cat >try.c <<EOCP
b4eb6b3d 15028#include <stdio.h>
d1daaddf
JH
15029#$i_stdlib I_STDLIB
15030#ifdef I_STDLIB
15031#include <stdlib.h>
15032#endif
b4eb6b3d
JH
15033int main()
15034{
15035 printf("%d\n", (int)sizeof(char));
15036 exit(0);
15037}
15038EOCP
15039 set try
15040 if eval $compile_ok; then
5440bc8e 15041 dflt=`$run ./try`
b4eb6b3d
JH
15042 else
15043 dflt='1'
15044 echo "(I can't seem to compile the test program. Guessing...)"
15045 fi
15046 ;;
15047*)
15048 dflt="$charsize"
15049 ;;
15050esac
15051rp="What is the size of a character (in bytes)?"
15052. ./myread
15053charsize="$ans"
15054$rm -f try.c try
15055
1d1be0dc
NC
15056: check for volatile keyword
15057echo " "
15058echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15059$cat >try.c <<'EOCP'
76f47787 15060int main()
1d1be0dc
NC
15061{
15062 typedef struct _goo_struct goo_struct;
15063 goo_struct * volatile goo = ((goo_struct *)0);
15064 struct _goo_struct {
15065 long long_int;
15066 int reg_int;
15067 char char_var;
15068 };
15069 typedef unsigned short foo_t;
15070 char *volatile foo;
15071 volatile int bar;
15072 volatile foo_t blech;
15073 foo = foo;
15074}
15075EOCP
15076if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15077 val="$define"
15078 echo "Yup, it does."
15079else
15080 val="$undef"
15081 echo "Nope, it doesn't."
15082fi
15083set d_volatile
15084eval $setvar
15085$rm -f try.*
15086
b4eb6b3d
JH
15087
15088echo " "
15089$echo "Choosing the C types to be used for Perl's internal types..." >&4
15090
15091case "$use64bitint:$d_quad:$quadtype" in
15092define:define:?*)
15093 ivtype="$quadtype"
15094 uvtype="$uquadtype"
15095 ivsize=8
15096 uvsize=8
15097 ;;
15098*) ivtype="long"
15099 uvtype="unsigned long"
15100 ivsize=$longsize
15101 uvsize=$longsize
15102 ;;
15103esac
15104
15105case "$uselongdouble:$d_longdbl" in
15106define:define)
15107 nvtype="long double"
15108 nvsize=$longdblsize
15109 ;;
15110*) nvtype=double
15111 nvsize=$doublesize
15112 ;;
15113esac
15114
15115$echo "(IV will be "$ivtype", $ivsize bytes)"
15116$echo "(UV will be "$uvtype", $uvsize bytes)"
15117$echo "(NV will be "$nvtype", $nvsize bytes)"
15118
15119$cat >try.c <<EOCP
15120#$i_inttypes I_INTTYPES
15121#ifdef I_INTTYPES
15122#include <inttypes.h>
15123#endif
15124#include <stdio.h>
15125int main() {
15126#ifdef INT8
15127 int8_t i = INT8_MAX;
15128 uint8_t u = UINT8_MAX;
15129 printf("int8_t\n");
15130#endif
15131#ifdef INT16
15132 int16_t i = INT16_MAX;
15133 uint16_t i = UINT16_MAX;
15134 printf("int16_t\n");
15135#endif
15136#ifdef INT32
15137 int32_t i = INT32_MAX;
15138 uint32_t u = UINT32_MAX;
15139 printf("int32_t\n");
15140#endif
15141}
15142EOCP
15143
15144case "$i8type" in
15145'') case "$charsize" in
15146 1) i8type=char
15147 u8type="unsigned char"
15148 i8size=$charsize
15149 u8size=$charsize
15150 ;;
15151 esac
15152 ;;
15153esac
15154case "$i8type" in
15155'') set try -DINT8
15156 if eval $compile; then
5440bc8e 15157 case "`$run ./try`" in
b4eb6b3d
JH
15158 int8_t) i8type=int8_t
15159 u8type=uint8_t
15160 i8size=1
15161 u8size=1
15162 ;;
15163 esac
15164 fi
15165 ;;
15166esac
15167case "$i8type" in
15168'') if $test $charsize -ge 1; then
15169 i8type=char
15170 u8type="unsigned char"
15171 i8size=$charsize
15172 u8size=$charsize
15173 fi
15174 ;;
15175esac
15176
15177case "$i16type" in
15178'') case "$shortsize" in
15179 2) i16type=short
15180 u16type="unsigned short"
15181 i16size=$shortsize
15182 u16size=$shortsize
15183 ;;
15184 esac
15185 ;;
15186esac
15187case "$i16type" in
15188'') set try -DINT16
15189 if eval $compile; then
5440bc8e 15190 case "`$run ./try`" in
b4eb6b3d
JH
15191 int16_t)
15192 i16type=int16_t
15193 u16type=uint16_t
15194 i16size=2
15195 u16size=2
15196 ;;
15197 esac
15198 fi
15199 ;;
15200esac
15201case "$i16type" in
15202'') if $test $shortsize -ge 2; then
15203 i16type=short
15204 u16type="unsigned short"
15205 i16size=$shortsize
15206 u16size=$shortsize
15207 fi
15208 ;;
15209esac
15210
15211case "$i32type" in
15212'') case "$longsize" in
15213 4) i32type=long
15214 u32type="unsigned long"
15215 i32size=$longsize
15216 u32size=$longsize
15217 ;;
15218 *) case "$intsize" in
15219 4) i32type=int
15220 u32type="unsigned int"
15221 i32size=$intsize
15222 u32size=$intsize
15223 ;;
15224 esac
15225 ;;
15226 esac
15227 ;;
15228esac
15229case "$i32type" in
15230'') set try -DINT32
15231 if eval $compile; then
5440bc8e 15232 case "`$run ./try`" in
b4eb6b3d
JH
15233 int32_t)
15234 i32type=int32_t
15235 u32type=uint32_t
15236 i32size=4
15237 u32size=4
15238 ;;
15239 esac
15240 fi
15241 ;;
15242esac
15243case "$i32type" in
15244'') if $test $intsize -ge 4; then
15245 i32type=int
15246 u32type="unsigned int"
15247 i32size=$intsize
15248 u32size=$intsize
15249 fi
15250 ;;
15251esac
15252
15253case "$i64type" in
15254'') case "$d_quad:$quadtype" in
15255 define:?*)
15256 i64type="$quadtype"
15257 u64type="$uquadtype"
15258 i64size=8
15259 u64size=8
15260 ;;
15261 esac
15262 ;;
15263esac
15264
1d1be0dc
NC
15265$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15266: volatile so that the compiler has to store it out to memory.
15267if test X"$d_volatile" = X"$define"; then
15268 volatile=volatile
15269fi
b4eb6b3d
JH
15270$cat <<EOP >try.c
15271#include <stdio.h>
55954f19
JH
15272#$i_stdlib I_STDLIB
15273#ifdef I_STDLIB
15274#include <stdlib.h>
15275#endif
1d1be0dc
NC
15276#include <sys/types.h>
15277#include <signal.h>
15278#ifdef SIGFPE
15279$volatile int bletched = 0;
7090f861 15280$signal_t blech(int s) { bletched = 1; }
1d1be0dc 15281#endif
b4eb6b3d
JH
15282int main() {
15283 $uvtype u = 0;
1d1be0dc 15284 $nvtype d;
b4eb6b3d
JH
15285 int n = 8 * $uvsize;
15286 int i;
1d1be0dc
NC
15287#ifdef SIGFPE
15288 signal(SIGFPE, blech);
15289#endif
15290
b4eb6b3d
JH
15291 for (i = 0; i < n; i++) {
15292 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
15293 d = ($nvtype)u;
15294 if (($uvtype)d != u)
b4eb6b3d 15295 break;
1d1be0dc
NC
15296 if (d <= 0)
15297 break;
15298 d = ($nvtype)(u - 1);
15299 if (($uvtype)d != (u - 1))
15300 break;
15301#ifdef SIGFPE
22676560 15302 if (bletched)
1d1be0dc
NC
15303 break;
15304#endif
b4eb6b3d 15305 }
efd1522b 15306 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
15307 exit(0);
15308}
15309EOP
1d1be0dc
NC
15310set try
15311
15312d_nv_preserves_uv="$undef"
15313if eval $compile; then
53133ed1 15314 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 15315fi
53133ed1 15316case "$nv_preserves_uv_bits" in
1d1be0dc 15317\-[1-9]*)
53133ed1
NC
15318 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15319 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 15320 d_nv_preserves_uv="$define"
b4eb6b3d 15321 ;;
53133ed1 15322[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
15323 d_nv_preserves_uv="$undef" ;;
15324*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
53133ed1 15325 nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
15326esac
15327
1d1be0dc
NC
15328$rm -f try.* try
15329
f607920a
CB
15330$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15331: volatile so that the compiler has to store it out to memory.
15332if test X"$d_volatile" = X"$define"; then
15333 volatile=volatile
15334fi
15335$cat <<EOP >try.c
15336#include <stdio.h>
15337#$i_stdlib I_STDLIB
15338#ifdef I_STDLIB
15339#include <stdlib.h>
15340#endif
15341#$i_string I_STRING
15342#ifdef I_STRING
15343# include <string.h>
15344#else
15345# include <strings.h>
15346#endif
15347#include <sys/types.h>
15348#include <signal.h>
15349#ifdef SIGFPE
15350$volatile int bletched = 0;
7090f861 15351$signal_t blech(int s) { bletched = 1; }
f607920a
CB
15352#endif
15353
15354int checkit($nvtype d, char *where) {
15355 unsigned char *p = (char *)&d;
15356 unsigned char *end = p + sizeof(d);
15357 int fail = 0;
15358
15359 while (p < end)
15360 fail += *p++;
15361
15362 if (!fail)
17f6277d 15363 return 0;
f607920a
CB
15364
15365 p = (char *)&d;
15366 printf("No - %s: 0x", where);
15367 while (p < end)
15368 printf ("%02X", *p++);
15369 printf("\n");
15370 return 1;
15371}
15372
15373int main(int argc, char **argv) {
15374 $nvtype d = 0.0;
15375 int fail = 0;
15376 fail += checkit(d, "0.0");
15377
15378 /* The compiler shouldn't be assuming that bletched is 0 */
15379 d = bletched;
15380
15381 fail += checkit(d, "bleched");
15382
15383#ifdef SIGFPE
15384 signal(SIGFPE, blech);
15385#endif
15386
15387 /* Paranoia - the compiler should have no way of knowing that ANSI says
15388 that argv[argc] will always be NULL. Actually, if it did assume this it
15389 would be buggy, as this is C and main() can be called from elsewhere in
15390 the program. */
15391 d = argv[argc] ? 1 : 0;
15392
15393 if (d) {
15394 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15395 }
15396
15397 fail += checkit(d, "ternary");
15398
15399 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15400
15401 if (d != 0.0) {
15402 printf("No - memset doesn't give 0.0\n");
15403 /* This might just blow up: */
15404 printf("(gives %g)\n", d);
15405 return 1;
15406 }
15407
15408#ifdef SIGFPE
15409 if (bletched) {
15410 printf("No - something bleched\n");
15411 return 1;
15412 }
15413#endif
15414 if (fail) {
15415 printf("No - %d fail(s)\n", fail);
15416 return 1;
15417 }
15418 printf("Yes\n");
15419 return 0;
15420}
15421EOP
15422set try
15423
15424d_nv_zero_is_allbits_zero="$undef"
15425if eval $compile; then
15426 xxx="`$run ./try`"
15427 case "$?" in
15428 0)
15429 case "$xxx" in
15430 Yes) cat >&4 <<EOM
154310.0 is represented as all bits zero in memory
15432EOM
15433 d_nv_zero_is_allbits_zero="$define"
15434 ;;
15435 *) cat >&4 <<EOM
154360.0 is not represented as all bits zero in memory
15437EOM
15438 d_nv_zero_is_allbits_zero="$undef"
15439 ;;
15440 esac
15441 ;;
15442 *) cat >&4 <<EOM
154430.0 is not represented as all bits zero in memory
15444EOM
15445 d_nv_zero_is_allbits_zero="$undef"
15446 ;;
15447 esac
15448fi
15449
15450$rm -f try.* try
15451
b4eb6b3d
JH
15452
15453: check for off64_t
15454echo " "
15455echo "Checking to see if you have off64_t..." >&4
15456$cat >try.c <<EOCP
15457#include <sys/types.h>
15458#include <unistd.h>
15459int main() { off64_t x = 7; }
15460EOCP
15461set try
15462if eval $compile; then
15463 val="$define"
15464 echo "You have off64_t."
15465else
15466 val="$undef"
15467 echo "You do not have off64_t."
15468 case "$lseeksize" in
15469 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15470 esac
15471fi
15472$rm -f try.* try
15473set d_off64_t
15474eval $setvar
15475
b4eb6b3d
JH
15476: how to create joinable pthreads
15477if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15478 echo " "
15479 echo "Checking what constant to use for creating joinable pthreads..." >&4
15480 $cat >try.c <<'EOCP'
15481#include <pthread.h>
15482int main() {
15483 int detachstate = JOINABLE;
15484}
15485EOCP
15486 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15487 if eval $compile; then
15488 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15489 val="$undef" # Yes, undef.
15490 set d_old_pthread_create_joinable
15491 eval $setvar
15492 val=""
15493 set old_pthread_create_joinable
15494 eval $setvar
15495 else
15496 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15497 if eval $compile; then
15498 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15499 val="$define"
15500 set d_old_pthread_create_joinable
15501 eval $setvar
15502 val=PTHREAD_CREATE_UNDETACHED
15503 set old_pthread_create_joinable
15504 eval $setvar
15505 else
15506 set try -DJOINABLE=__UNDETACHED
15507 if eval $compile; then
15508 echo "You seem to use __UNDETACHED." >&4
15509 val="$define"
15510 set d_old_pthread_create_joinable
15511 eval $setvar
15512 val=__UNDETACHED
15513 set old_pthread_create_joinable
15514 eval $setvar
15515 else
15516 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
15517 val="$define"
15518 set d_old_pthread_create_joinable
15519 eval $setvar
15520 val=0
15521 set old_pthread_create_joinable
15522 eval $setvar
15523 fi
15524 fi
15525 fi
15526 $rm -f try try.*
15527else
15528 d_old_pthread_create_joinable="$undef"
15529 old_pthread_create_joinable=""
15530fi
15531
15532: see if pause exists
15533set pause d_pause
15534eval $inlibc
15535
15536: see if pipe exists
15537set pipe d_pipe
15538eval $inlibc
15539
15540: see if poll exists
15541set poll d_poll
15542eval $inlibc
15543
c7aff470
NIS
15544: see if readlink exists
15545set readlink d_readlink
15546eval $inlibc
15547
15548echo " "
f24dbf84 15549procselfexe=''
c7aff470 15550val="$undef"
a33c94aa
JH
15551case "$d_readlink" in
15552"$define")
c7aff470
NIS
15553 if $issymlink /proc/self/exe ; then
15554 $ls -l /proc/self/exe > reflect
51660ed5 15555 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 15556 echo "You have Linux-like /proc/self/exe."
92236451 15557 procselfexe='"/proc/self/exe"'
f24dbf84 15558 val="$define"
f24dbf84
JH
15559 fi
15560 fi
15561 if $issymlink /proc/curproc/file ; then
15562 $ls -l /proc/curproc/file > reflect
15563 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15564 echo "You have BSD-like /proc/curproc/file."
92236451 15565 procselfexe='"/proc/curproc/file"'
f24dbf84 15566 val="$define"
c7aff470 15567 fi
c7aff470 15568 fi
a33c94aa
JH
15569 ;;
15570esac
428dc699 15571$rm -f reflect
c7aff470
NIS
15572set d_procselfexe
15573eval $setvar
15574
233e16ce
MB
15575: backward compatibility for d_hvfork
15576if test X$d_hvfork != X; then
15577 d_vfork="$d_hvfork"
15578 d_hvfork=''
15579fi
15580: see if there is a vfork
15581val=''
15582set vfork val
15583eval $inlibc
15584
15585d_pseudofork=$undef
15586
15587: Ok, but do we want to use it. vfork is reportedly unreliable in
15588: perl on Solaris 2.x, and probably elsewhere.
15589case "$val" in
15590$define)
15591 echo " "
15592 case "$usevfork" in
15593 false) dflt='n';;
15594 *) dflt='y';;
15595 esac
15596 cat <<'EOM'
15597
15598Perl can only use a vfork() that doesn't suffer from strict
15599restrictions on calling functions or modifying global data in
15600the child. For example, glibc-2.1 contains such a vfork()
15601that is unsuitable. If your system provides a proper fork()
15602call, chances are that you do NOT want perl to use vfork().
15603
15604EOM
15605 rp="Do you still want to use vfork()?"
15606 . ./myread
15607 case "$ans" in
15608 y|Y) ;;
15609 *)
15610 echo "Ok, we won't use vfork()."
15611 val="$undef"
15612 ;;
15613 esac
15614 ;;
15615esac
15616set d_vfork
15617eval $setvar
15618case "$d_vfork" in
15619$define) usevfork='true';;
15620*) usevfork='false';;
15621esac
15622
263fee3f
JH
15623: see whether the pthread_atfork exists
15624$cat >try.c <<EOP
15625#include <pthread.h>
15626#include <stdio.h>
15627int main() {
15628#ifdef PTHREAD_ATFORK
15629 pthread_atfork(NULL,NULL,NULL);
15630#endif
15631}
15632EOP
15633
d6483fcc 15634: see if pthread_atfork exists
263fee3f
JH
15635set try -DPTHREAD_ATFORK
15636if eval $compile; then
15637 val="$define"
15638else
15639 val="$undef"
15640fi
15641case "$usethreads" in
15642$define)
15643 case "$val" in
15644 $define) echo 'pthread_atfork found.' >&4 ;;
15645 *) echo 'pthread_atfork NOT found.' >&4 ;;
15646 esac
15647esac
15648set d_pthread_atfork
15649eval $setvar
d6483fcc 15650
58d975c3
JH
15651: see if pthread_attr_setscope exists
15652set pthread_attr_setscope d_pthread_attr_setscope
15653eval $inlibc
15654
b4eb6b3d
JH
15655
15656: see whether the various POSIXish _yields exist
15657$cat >try.c <<EOP
15658#include <pthread.h>
15659#include <stdio.h>
15660int main() {
15661#ifdef SCHED_YIELD
15662 sched_yield();
15663#else
15664#ifdef PTHREAD_YIELD
15665 pthread_yield();
15666#else
15667#ifdef PTHREAD_YIELD_NULL
15668 pthread_yield(NULL);
15669#endif
15670#endif
15671#endif
15672}
15673EOP
15674: see if sched_yield exists
15675set try -DSCHED_YIELD
15676if eval $compile; then
15677 val="$define"
15678 sched_yield='sched_yield()'
15679else
15680 val="$undef"
15681fi
15682case "$usethreads" in
15683$define)
15684 case "$val" in
15685 $define) echo 'sched_yield() found.' >&4 ;;
15686 *) echo 'sched_yield() NOT found.' >&4 ;;
15687 esac
15688esac
10bc17b6
JH
15689set d_sched_yield
15690eval $setvar
b4eb6b3d 15691
10bc17b6
JH
15692: see if pthread_yield exists
15693set try -DPTHREAD_YIELD
15694if eval $compile; then
15695 val="$define"
15696 case "$sched_yield" in
15697 '') sched_yield='pthread_yield()' ;;
15698 esac
15699else
15700 set try -DPTHREAD_YIELD_NULL
15701 if eval $compile; then
15702 val="$define"
15703 case "$sched_yield" in
15704 '') sched_yield='pthread_yield(NULL)' ;;
15705 esac
15706 else
15707 val="$undef"
15708 fi
15709fi
15710case "$usethreads" in
15711$define)
15712 case "$val" in
15713 $define) echo 'pthread_yield() found.' >&4 ;;
15714 *) echo 'pthread_yield() NOT found.' >&4 ;;
15715 esac
15716 ;;
15717esac
15718set d_pthread_yield
15719eval $setvar
b4eb6b3d 15720
10bc17b6
JH
15721case "$sched_yield" in
15722'') sched_yield=undef ;;
15723esac
b4eb6b3d 15724
10bc17b6
JH
15725$rm -f try try.*
15726
15727: see if random_r exists
15728set random_r d_random_r
15729eval $inlibc
15730case "$d_random_r" in
15731"$define")
15732 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
15733 case "$d_random_r_proto:$usethreads" in
15734 ":define") d_random_r_proto=define
a48ec845
JH
15735 set d_random_r_proto random_r $hdrs
15736 eval $hasproto ;;
15737 *) ;;
15738 esac
15739 case "$d_random_r_proto" in
15740 define)
10bc17b6
JH
15741 case "$random_r_proto" in
15742 ''|0) try='int random_r(int*, struct random_data*);'
a845a0d4
JH
15743 ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15744 esac
15745 case "$random_r_proto" in
15746 ''|0) try='int random_r(long*, struct random_data*);'
15747 ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15748 esac
15749 case "$random_r_proto" in
15750 ''|0) try='int random_r(struct random_data*, int32_t*);'
15751 ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
15752 esac
15753 case "$random_r_proto" in
90e831dc 15754 ''|0) d_random_r=undef
10bc17b6 15755 random_r_proto=0
a48ec845 15756 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15757 * ) case "$random_r_proto" in
15758 REENTRANT_PROTO*) ;;
15759 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15760 esac
15761 echo "Prototype: $try" ;;
15762 esac
b4eb6b3d 15763 ;;
c18e646a
JH
15764 *) case "$usethreads" in
15765 define) echo "random_r has no prototype, not using it." >&4 ;;
15766 esac
90e831dc
SB
15767 d_random_r=undef
15768 random_r_proto=0
c18e646a 15769 ;;
a48ec845
JH
15770 esac
15771 ;;
10bc17b6 15772*) random_r_proto=0
b4eb6b3d
JH
15773 ;;
15774esac
15775
15776: see if readdir and friends exist
15777set readdir d_readdir
15778eval $inlibc
15779set seekdir d_seekdir
15780eval $inlibc
15781set telldir d_telldir
15782eval $inlibc
15783set rewinddir d_rewinddir
15784eval $inlibc
15785
10bc17b6
JH
15786: see if readdir64_r exists
15787set readdir64_r d_readdir64_r
15788eval $inlibc
15789case "$d_readdir64_r" in
15790"$define")
15791 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15792 case "$d_readdir64_r_proto:$usethreads" in
15793 ":define") d_readdir64_r_proto=define
a48ec845
JH
15794 set d_readdir64_r_proto readdir64_r $hdrs
15795 eval $hasproto ;;
15796 *) ;;
15797 esac
15798 case "$d_readdir64_r_proto" in
15799 define)
10bc17b6
JH
15800 case "$readdir64_r_proto" in
15801 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15802 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15803 esac
15804 case "$readdir64_r_proto" in
15805 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15806 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15807 esac
15808 case "$readdir64_r_proto" in
90e831dc 15809 ''|0) d_readdir64_r=undef
10bc17b6 15810 readdir64_r_proto=0
a48ec845 15811 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15812 * ) case "$readdir64_r_proto" in
15813 REENTRANT_PROTO*) ;;
15814 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15815 esac
15816 echo "Prototype: $try" ;;
15817 esac
15818 ;;
c18e646a
JH
15819 *) case "$usethreads" in
15820 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15821 esac
90e831dc
SB
15822 d_readdir64_r=undef
15823 readdir64_r_proto=0
c18e646a 15824 ;;
a48ec845
JH
15825 esac
15826 ;;
10bc17b6
JH
15827*) readdir64_r_proto=0
15828 ;;
15829esac
15830
15831: see if readdir_r exists
15832set readdir_r d_readdir_r
15833eval $inlibc
15834case "$d_readdir_r" in
15835"$define")
15836 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15837 case "$d_readdir_r_proto:$usethreads" in
15838 ":define") d_readdir_r_proto=define
a48ec845
JH
15839 set d_readdir_r_proto readdir_r $hdrs
15840 eval $hasproto ;;
15841 *) ;;
15842 esac
15843 case "$d_readdir_r_proto" in
15844 define)
10bc17b6
JH
15845 case "$readdir_r_proto" in
15846 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15847 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15848 esac
15849 case "$readdir_r_proto" in
15850 ''|0) try='int readdir_r(DIR*, struct dirent*);'
15851 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15852 esac
15853 case "$readdir_r_proto" in
90e831dc 15854 ''|0) d_readdir_r=undef
10bc17b6 15855 readdir_r_proto=0
a48ec845 15856 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15857 * ) case "$readdir_r_proto" in
15858 REENTRANT_PROTO*) ;;
15859 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15860 esac
15861 echo "Prototype: $try" ;;
15862 esac
15863 ;;
c18e646a
JH
15864 *) case "$usethreads" in
15865 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15866 esac
90e831dc
SB
15867 d_readdir_r=undef
15868 readdir_r_proto=0
c18e646a 15869 ;;
a48ec845
JH
15870 esac
15871 ;;
10bc17b6
JH
15872*) readdir_r_proto=0
15873 ;;
15874esac
15875
4e0554ec
JH
15876: see if readv exists
15877set readv d_readv
15878eval $inlibc
15879
15880: see if recvmsg exists
15881set recvmsg d_recvmsg
15882eval $inlibc
15883
b4eb6b3d
JH
15884: see if rename exists
15885set rename d_rename
15886eval $inlibc
15887
15888: see if rmdir exists
15889set rmdir d_rmdir
15890eval $inlibc
15891
15892: see if memory.h is available.
15893val=''
15894set memory.h val
15895eval $inhdr
15896
15897: See if it conflicts with string.h
15898case "$val" in
15899$define)
15900 case "$strings" in
15901 '') ;;
15902 *)
15903 $cppstdin $cppflags $cppminus < $strings > mem.h
15904 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15905 echo " "
15906 echo "We won't be including <memory.h>."
15907 val="$undef"
15908 fi
15909 $rm -f mem.h
15910 ;;
15911 esac
15912esac
15913set i_memory
15914eval $setvar
15915
15916: can bcopy handle overlapping blocks?
b6cc3bc4 15917echo " "
b4eb6b3d 15918val="$undef"
b6cc3bc4
AD
15919case "$d_memmove" in
15920"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15921*) case "$d_bcopy" in
15922 "$define")
15923 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15924 $cat >try.c <<EOCP
b4eb6b3d
JH
15925#$i_memory I_MEMORY
15926#$i_stdlib I_STDLIB
15927#$i_string I_STRING
15928#$i_unistd I_UNISTD
15929EOCP
15930 $cat >>try.c <<'EOCP'
15931#include <stdio.h>
15932#ifdef I_MEMORY
15933# include <memory.h>
15934#endif
15935#ifdef I_STDLIB
15936# include <stdlib.h>
15937#endif
15938#ifdef I_STRING
15939# include <string.h>
15940#else
15941# include <strings.h>
15942#endif
15943#ifdef I_UNISTD
15944# include <unistd.h> /* Needed for NetBSD */
15945#endif
15946int main()
15947{
15948char buf[128], abc[128];
15949char *b;
15950int len;
15951int off;
15952int align;
15953
b6cc3bc4
AD
15954/* Copy "abcde..." string to char abc[] so that gcc doesn't
15955 try to store the string in read-only memory. */
b4eb6b3d
JH
15956bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15957
15958for (align = 7; align >= 0; align--) {
15959 for (len = 36; len; len--) {
15960 b = buf+align;
15961 bcopy(abc, b, len);
15962 for (off = 1; off <= len; off++) {
15963 bcopy(b, b+off, len);
15964 bcopy(b+off, b, len);
15965 if (bcmp(b, abc, len))
15966 exit(1);
15967 }
15968 }
15969}
15970exit(0);
15971}
15972EOCP
b6cc3bc4
AD
15973 set try
15974 if eval $compile_ok; then
15975 if ./try 2>/dev/null; then
15976 echo "Yes, it can."
15977 val="$define"
15978 else
15979 echo "It can't, sorry."
15980 fi
b4eb6b3d 15981 else
b6cc3bc4 15982 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15983 fi
b6cc3bc4
AD
15984 ;;
15985 esac
15986 $rm -f try.* try core
b4eb6b3d
JH
15987 ;;
15988esac
b4eb6b3d
JH
15989set d_safebcpy
15990eval $setvar
15991
15992: can memcpy handle overlapping blocks?
b6cc3bc4 15993echo " "
b4eb6b3d 15994val="$undef"
b6cc3bc4
AD
15995case "$d_memmove" in
15996"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15997*) case "$d_memcpy" in
15998 "$define")
15999 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16000 $cat >try.c <<EOCP
b4eb6b3d
JH
16001#$i_memory I_MEMORY
16002#$i_stdlib I_STDLIB
16003#$i_string I_STRING
16004#$i_unistd I_UNISTD
16005EOCP
16006 $cat >>try.c <<'EOCP'
16007#include <stdio.h>
16008#ifdef I_MEMORY
16009# include <memory.h>
16010#endif
16011#ifdef I_STDLIB
16012# include <stdlib.h>
16013#endif
16014#ifdef I_STRING
16015# include <string.h>
16016#else
16017# include <strings.h>
16018#endif
16019#ifdef I_UNISTD
16020# include <unistd.h> /* Needed for NetBSD */
16021#endif
16022int main()
16023{
16024char buf[128], abc[128];
16025char *b;
16026int len;
16027int off;
16028int align;
16029
16030/* Copy "abcde..." string to char abc[] so that gcc doesn't
16031 try to store the string in read-only memory. */
16032memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16033
16034for (align = 7; align >= 0; align--) {
16035 for (len = 36; len; len--) {
16036 b = buf+align;
16037 memcpy(b, abc, len);
16038 for (off = 1; off <= len; off++) {
16039 memcpy(b+off, b, len);
16040 memcpy(b, b+off, len);
16041 if (memcmp(b, abc, len))
16042 exit(1);
16043 }
16044 }
16045}
16046exit(0);
16047}
16048EOCP
b6cc3bc4
AD
16049 set try
16050 if eval $compile_ok; then
16051 if ./try 2>/dev/null; then
16052 echo "Yes, it can."
16053 val="$define"
16054 else
16055 echo "It can't, sorry."
16056 fi
b4eb6b3d 16057 else
b6cc3bc4 16058 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16059 fi
b6cc3bc4
AD
16060 ;;
16061 esac
16062 $rm -f try.* try core
b4eb6b3d
JH
16063 ;;
16064esac
b4eb6b3d
JH
16065set d_safemcpy
16066eval $setvar
16067
16068: can memcmp be trusted to compare relative magnitude?
16069val="$undef"
16070case "$d_memcmp" in
16071"$define")
16072 echo " "
16073 echo "Checking if your memcmp() can compare relative magnitude..." >&4
16074 $cat >try.c <<EOCP
16075#$i_memory I_MEMORY
16076#$i_stdlib I_STDLIB
16077#$i_string I_STRING
16078#$i_unistd I_UNISTD
16079EOCP
16080 $cat >>try.c <<'EOCP'
16081#include <stdio.h>
16082#ifdef I_MEMORY
16083# include <memory.h>
16084#endif
16085#ifdef I_STDLIB
36adc09b 16086# include <stdlib.h>
b4eb6b3d
JH
16087#endif
16088#ifdef I_STRING
16089# include <string.h>
16090#else
16091# include <strings.h>
16092#endif
16093#ifdef I_UNISTD
16094# include <unistd.h> /* Needed for NetBSD */
16095#endif
16096int main()
16097{
16098char a = -1;
16099char b = 0;
16100if ((a < b) && memcmp(&a, &b, 1) < 0)
16101 exit(1);
16102exit(0);
16103}
16104EOCP
16105 set try
16106 if eval $compile_ok; then
5440bc8e 16107 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
16108 echo "Yes, it can."
16109 val="$define"
16110 else
16111 echo "No, it can't (it uses signed chars)."
16112 fi
16113 else
16114 echo "(I can't compile the test program, so we'll assume not...)"
16115 fi
16116 ;;
16117esac
16118$rm -f try.* try core
16119set d_sanemcmp
16120eval $setvar
16121
ef9f17be
JH
16122: see if prototype for sbrk is available
16123echo " "
16124set d_sbrkproto sbrk $i_unistd unistd.h
16125eval $hasproto
16126
b4eb6b3d
JH
16127: see if select exists
16128set select d_select
16129eval $inlibc
16130
16131: see if semctl exists
16132set semctl d_semctl
16133eval $inlibc
16134
16135: see if semget exists
16136set semget d_semget
16137eval $inlibc
16138
16139: see if semop exists
16140set semop d_semop
16141eval $inlibc
16142
16143: see how much of the 'sem*(2)' library is present.
16144h_sem=true
16145echo " "
16146case "$d_semctl$d_semget$d_semop" in
16147*"$undef"*) h_sem=false;;
16148esac
16149case "$osname" in
16150freebsd)
16151 case "`ipcs 2>&1`" in
16152 "SVID messages"*"not configured"*)
16153 echo "Your $osname does not have the sem*(2) configured." >&4
16154 h_sem=false
16155 val="$undef"
16156 set semctl d_semctl
16157 eval $setvar
16158 set semget d_semget
16159 eval $setvar
16160 set semop d_semop
16161 eval $setvar
16162 ;;
16163 esac
16164 ;;
16165esac
16166: we could also check for sys/ipc.h ...
16167if $h_sem && $test `./findhdr sys/sem.h`; then
16168 echo "You have the full sem*(2) library." >&4
16169 val="$define"
16170else
16171 echo "You don't have the full sem*(2) library." >&4
16172 val="$undef"
16173fi
16174set d_sem
16175eval $setvar
16176
16177: see whether sys/sem.h defines union semun
16178echo " "
16179$cat > try.c <<'END'
16180#include <sys/types.h>
16181#include <sys/ipc.h>
16182#include <sys/sem.h>
16183int main () { union semun semun; semun.buf = 0; }
16184END
16185set try
16186if eval $compile; then
16187 echo "You have union semun in <sys/sem.h>." >&4
16188 val="$define"
16189else
16190 echo "You do not have union semun in <sys/sem.h>." >&4
16191 val="$undef"
16192fi
2fad75a1 16193$rm -f try try.c
b4eb6b3d
JH
16194set d_union_semun
16195eval $setvar
16196
16197: see how to do semctl IPC_STAT
16198case "$d_sem" in
16199$define)
b4eb6b3d
JH
16200 echo " "
16201 $cat > try.h <<END
16202#ifndef S_IRUSR
16203# ifdef S_IREAD
16204# define S_IRUSR S_IREAD
16205# define S_IWUSR S_IWRITE
16206# define S_IXUSR S_IEXEC
16207# else
16208# define S_IRUSR 0400
16209# define S_IWUSR 0200
16210# define S_IXUSR 0100
16211# endif
16212# define S_IRGRP (S_IRUSR>>3)
16213# define S_IWGRP (S_IWUSR>>3)
16214# define S_IXGRP (S_IXUSR>>3)
16215# define S_IROTH (S_IRUSR>>6)
16216# define S_IWOTH (S_IWUSR>>6)
16217# define S_IXOTH (S_IXUSR>>6)
16218#endif
16219#ifndef S_IRWXU
16220# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16221# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16222# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16223#endif
16224END
2fad75a1 16225 : see whether semctl IPC_STAT can use union semun
2fad75a1
JH
16226 case "$d_semctl_semun" in
16227 '')
35918792 16228 val="$undef"
2fad75a1 16229 $cat > try.c <<END
b4eb6b3d
JH
16230#include <sys/types.h>
16231#include <sys/ipc.h>
16232#include <sys/sem.h>
16233#include <sys/stat.h>
16234#include <stdio.h>
16235#include <errno.h>
16236#include "try.h"
16237#ifndef errno
16238extern int errno;
16239#endif
16240#$d_union_semun HAS_UNION_SEMUN
16241int main() {
16242 union semun
16243#ifndef HAS_UNION_SEMUN
16244 {
16245 int val;
16246 struct semid_ds *buf;
16247 unsigned short *array;
16248 }
16249#endif
16250 arg;
16251 int sem, st;
16252
16253#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16254 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16255 if (sem > -1) {
16256 struct semid_ds argbuf;
16257 arg.buf = &argbuf;
16258# ifdef IPC_STAT
16259 st = semctl(sem, 0, IPC_STAT, arg);
16260 if (st == 0)
16261 printf("semun\n");
16262 else
16263# endif /* IPC_STAT */
16264 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16265# ifdef IPC_RMID
16266 if (semctl(sem, 0, IPC_RMID, arg) != 0)
35918792 16267# endif /* IPC_RMID */
b4eb6b3d
JH
16268 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16269 } else
16270#endif /* IPC_PRIVATE && ... */
16271 printf("semget failed: errno = %d\n", errno);
16272 return 0;
16273}
16274END
2fad75a1
JH
16275 set try
16276 if eval $compile; then
16277 xxx=`$run ./try`
16278 case "$xxx" in
16279 semun) val="$define" ;;
16280 esac
16281 fi
16282 $rm -f try try.c
35918792
YST
16283 set d_semctl_semun
16284 eval $setvar
2fad75a1
JH
16285 ;;
16286 esac
b4eb6b3d
JH
16287 case "$d_semctl_semun" in
16288 $define)
16289 echo "You can use union semun for semctl IPC_STAT." >&4
16290 also='also'
16291 ;;
16292 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
16293 also=''
16294 ;;
16295 esac
16296
16297 : see whether semctl IPC_STAT can use struct semid_ds pointer
2fad75a1
JH
16298 case "$d_semctl_semid_ds" in
16299 '')
35918792 16300 val="$undef"
2fad75a1 16301 $cat > try.c <<'END'
b4eb6b3d
JH
16302#include <sys/types.h>
16303#include <sys/ipc.h>
16304#include <sys/sem.h>
16305#include <sys/stat.h>
16306#include "try.h"
16307#include <stdio.h>
16308#include <errno.h>
16309#ifndef errno
16310extern int errno;
16311#endif
16312int main() {
16313 struct semid_ds arg;
16314 int sem, st;
16315
16316#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16317 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16318 if (sem > -1) {
16319# ifdef IPC_STAT
16320 st = semctl(sem, 0, IPC_STAT, &arg);
16321 if (st == 0)
16322 printf("semid_ds\n");
16323 else
16324# endif /* IPC_STAT */
16325 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16326# ifdef IPC_RMID
16327 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16328# endif /* IPC_RMID */
16329 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16330 } else
16331#endif /* IPC_PRIVATE && ... */
16332 printf("semget failed: errno = %d\n", errno);
16333
16334 return 0;
16335}
16336END
2fad75a1
JH
16337 set try
16338 if eval $compile; then
16339 xxx=`$run ./try`
16340 case "$xxx" in
16341 semid_ds) val="$define" ;;
16342 esac
16343 fi
16344 $rm -f try try.c
35918792
YST
16345 set d_semctl_semid_ds
16346 eval $setvar
2fad75a1
JH
16347 ;;
16348 esac
b4eb6b3d
JH
16349 case "$d_semctl_semid_ds" in
16350 $define)
16351 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16352 ;;
16353 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16354 ;;
16355 esac
16356 $rm -f try.h
16357 ;;
16358*) val="$undef"
16359
16360 # We do not have the full sem*(2) library, so assume we can not
16361 # use either.
16362
16363 set d_semctl_semun
16364 eval $setvar
16365
16366 set d_semctl_semid_ds
16367 eval $setvar
16368 ;;
16369esac
16370
4e0554ec
JH
16371: see if sendmsg exists
16372set sendmsg d_sendmsg
16373eval $inlibc
16374
b4eb6b3d
JH
16375: see if setegid exists
16376set setegid d_setegid
16377eval $inlibc
16378
16379: see if seteuid exists
16380set seteuid d_seteuid
16381eval $inlibc
16382
16383: see if setgrent exists
16384set setgrent d_setgrent
16385eval $inlibc
16386
10bc17b6
JH
16387: see if setgrent_r exists
16388set setgrent_r d_setgrent_r
16389eval $inlibc
16390case "$d_setgrent_r" in
16391"$define")
16392 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
16393 case "$d_setgrent_r_proto:$usethreads" in
16394 ":define") d_setgrent_r_proto=define
a48ec845
JH
16395 set d_setgrent_r_proto setgrent_r $hdrs
16396 eval $hasproto ;;
16397 *) ;;
16398 esac
16399 case "$d_setgrent_r_proto" in
16400 define)
10bc17b6
JH
16401 case "$setgrent_r_proto" in
16402 ''|0) try='int setgrent_r(FILE**);'
16403 ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16404 esac
16405 case "$setgrent_r_proto" in
16406 ''|0) try='void setgrent_r(FILE**);'
16407 ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16408 esac
16409 case "$setgrent_r_proto" in
90e831dc 16410 ''|0) d_setgrent_r=undef
10bc17b6 16411 setgrent_r_proto=0
a48ec845 16412 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16413 * ) case "$setgrent_r_proto" in
16414 REENTRANT_PROTO*) ;;
16415 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16416 esac
16417 echo "Prototype: $try" ;;
16418 esac
16419 ;;
c18e646a
JH
16420 *) case "$usethreads" in
16421 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16422 esac
90e831dc
SB
16423 d_setgrent_r=undef
16424 setgrent_r_proto=0
c18e646a 16425 ;;
a48ec845
JH
16426 esac
16427 ;;
10bc17b6
JH
16428*) setgrent_r_proto=0
16429 ;;
16430esac
16431
b4eb6b3d
JH
16432: see if sethostent exists
16433set sethostent d_sethent
16434eval $inlibc
16435
10bc17b6
JH
16436: see if sethostent_r exists
16437set sethostent_r d_sethostent_r
16438eval $inlibc
16439case "$d_sethostent_r" in
16440"$define")
16441 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16442 case "$d_sethostent_r_proto:$usethreads" in
16443 ":define") d_sethostent_r_proto=define
a48ec845
JH
16444 set d_sethostent_r_proto sethostent_r $hdrs
16445 eval $hasproto ;;
16446 *) ;;
16447 esac
16448 case "$d_sethostent_r_proto" in
16449 define)
10bc17b6
JH
16450 case "$sethostent_r_proto" in
16451 ''|0) try='int sethostent_r(int, struct hostent_data*);'
16452 ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16453 esac
16454 case "$sethostent_r_proto" in
16455 ''|0) try='void sethostent_r(int, struct hostent_data*);'
16456 ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16457 esac
16458 case "$sethostent_r_proto" in
90e831dc 16459 ''|0) d_sethostent_r=undef
10bc17b6 16460 sethostent_r_proto=0
a48ec845 16461 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16462 * ) case "$sethostent_r_proto" in
16463 REENTRANT_PROTO*) ;;
16464 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16465 esac
16466 echo "Prototype: $try" ;;
16467 esac
16468 ;;
c18e646a
JH
16469 *) case "$usethreads" in
16470 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16471 esac
90e831dc
SB
16472 d_sethostent_r=undef
16473 sethostent_r_proto=0
c18e646a 16474 ;;
a48ec845
JH
16475 esac
16476 ;;
10bc17b6
JH
16477*) sethostent_r_proto=0
16478 ;;
16479esac
16480
4e0554ec
JH
16481: see if setitimer exists
16482set setitimer d_setitimer
16483eval $inlibc
16484
b4eb6b3d
JH
16485: see if setlinebuf exists
16486set setlinebuf d_setlinebuf
16487eval $inlibc
16488
16489: see if setlocale exists
16490set setlocale d_setlocale
16491eval $inlibc
16492
10bc17b6
JH
16493: see if locale.h is available
16494set locale.h i_locale
16495eval $inhdr
16496
16497: see if setlocale_r exists
16498set setlocale_r d_setlocale_r
16499eval $inlibc
16500case "$d_setlocale_r" in
16501"$define")
16502 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
16503 case "$d_setlocale_r_proto:$usethreads" in
16504 ":define") d_setlocale_r_proto=define
a48ec845
JH
16505 set d_setlocale_r_proto setlocale_r $hdrs
16506 eval $hasproto ;;
16507 *) ;;
16508 esac
16509 case "$d_setlocale_r_proto" in
16510 define)
10bc17b6
JH
16511 case "$setlocale_r_proto" in
16512 ''|0) try='int setlocale_r(int, const char*, char*, int);'
16513 ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16514 esac
16515 case "$setlocale_r_proto" in
90e831dc 16516 ''|0) d_setlocale_r=undef
10bc17b6 16517 setlocale_r_proto=0
a48ec845 16518 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16519 * ) case "$setlocale_r_proto" in
16520 REENTRANT_PROTO*) ;;
16521 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16522 esac
16523 echo "Prototype: $try" ;;
16524 esac
16525 ;;
c18e646a
JH
16526 *) case "$usethreads" in
16527 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16528 esac
90e831dc
SB
16529 d_setlocale_r=undef
16530 setlocale_r_proto=0
c18e646a 16531 ;;
a48ec845
JH
16532 esac
16533 ;;
10bc17b6
JH
16534*) setlocale_r_proto=0
16535 ;;
16536esac
16537
b4eb6b3d
JH
16538: see if setnetent exists
16539set setnetent d_setnent
16540eval $inlibc
16541
10bc17b6
JH
16542: see if setnetent_r exists
16543set setnetent_r d_setnetent_r
16544eval $inlibc
16545case "$d_setnetent_r" in
16546"$define")
16547 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16548 case "$d_setnetent_r_proto:$usethreads" in
16549 ":define") d_setnetent_r_proto=define
a48ec845
JH
16550 set d_setnetent_r_proto setnetent_r $hdrs
16551 eval $hasproto ;;
16552 *) ;;
16553 esac
16554 case "$d_setnetent_r_proto" in
16555 define)
10bc17b6
JH
16556 case "$setnetent_r_proto" in
16557 ''|0) try='int setnetent_r(int, struct netent_data*);'
16558 ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16559 esac
16560 case "$setnetent_r_proto" in
16561 ''|0) try='void setnetent_r(int, struct netent_data*);'
16562 ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16563 esac
16564 case "$setnetent_r_proto" in
90e831dc 16565 ''|0) d_setnetent_r=undef
10bc17b6 16566 setnetent_r_proto=0
a48ec845 16567 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16568 * ) case "$setnetent_r_proto" in
16569 REENTRANT_PROTO*) ;;
16570 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16571 esac
16572 echo "Prototype: $try" ;;
16573 esac
16574 ;;
c18e646a
JH
16575 *) case "$usethreads" in
16576 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16577 esac
90e831dc
SB
16578 d_setnetent_r=undef
16579 setnetent_r_proto=0
c18e646a 16580 ;;
a48ec845
JH
16581 esac
16582 ;;
10bc17b6
JH
16583*) setnetent_r_proto=0
16584 ;;
16585esac
16586
b4eb6b3d
JH
16587: see if setprotoent exists
16588set setprotoent d_setpent
16589eval $inlibc
16590
16591: see if setpgid exists
16592set setpgid d_setpgid
16593eval $inlibc
16594
16595: see if setpgrp2 exists
16596set setpgrp2 d_setpgrp2
16597eval $inlibc
16598
16599: see if setpriority exists
16600set setpriority d_setprior
16601eval $inlibc
16602
16603: see if setproctitle exists
16604set setproctitle d_setproctitle
16605eval $inlibc
16606
10bc17b6
JH
16607: see if setprotoent_r exists
16608set setprotoent_r d_setprotoent_r
16609eval $inlibc
16610case "$d_setprotoent_r" in
16611"$define")
16612 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16613 case "$d_setprotoent_r_proto:$usethreads" in
16614 ":define") d_setprotoent_r_proto=define
a48ec845
JH
16615 set d_setprotoent_r_proto setprotoent_r $hdrs
16616 eval $hasproto ;;
16617 *) ;;
16618 esac
16619 case "$d_setprotoent_r_proto" in
16620 define)
10bc17b6
JH
16621 case "$setprotoent_r_proto" in
16622 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16623 ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16624 esac
16625 case "$setprotoent_r_proto" in
16626 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16627 ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16628 esac
16629 case "$setprotoent_r_proto" in
90e831dc 16630 ''|0) d_setprotoent_r=undef
10bc17b6 16631 setprotoent_r_proto=0
a48ec845 16632 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16633 * ) case "$setprotoent_r_proto" in
16634 REENTRANT_PROTO*) ;;
16635 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16636 esac
16637 echo "Prototype: $try" ;;
16638 esac
16639 ;;
c18e646a
JH
16640 *) case "$usethreads" in
16641 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16642 esac
90e831dc
SB
16643 d_setprotoent_r=undef
16644 setprotoent_r_proto=0
c18e646a 16645 ;;
a48ec845
JH
16646 esac
16647 ;;
10bc17b6
JH
16648*) setprotoent_r_proto=0
16649 ;;
16650esac
16651
b4eb6b3d
JH
16652: see if setpwent exists
16653set setpwent d_setpwent
16654eval $inlibc
16655
10bc17b6
JH
16656: see if setpwent_r exists
16657set setpwent_r d_setpwent_r
16658eval $inlibc
16659case "$d_setpwent_r" in
16660"$define")
16661 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
16662 case "$d_setpwent_r_proto:$usethreads" in
16663 ":define") d_setpwent_r_proto=define
a48ec845
JH
16664 set d_setpwent_r_proto setpwent_r $hdrs
16665 eval $hasproto ;;
16666 *) ;;
16667 esac
16668 case "$d_setpwent_r_proto" in
16669 define)
10bc17b6
JH
16670 case "$setpwent_r_proto" in
16671 ''|0) try='int setpwent_r(FILE**);'
16672 ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16673 esac
16674 case "$setpwent_r_proto" in
16675 ''|0) try='void setpwent_r(FILE**);'
16676 ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16677 esac
16678 case "$setpwent_r_proto" in
90e831dc 16679 ''|0) d_setpwent_r=undef
10bc17b6 16680 setpwent_r_proto=0
a48ec845 16681 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16682 * ) case "$setpwent_r_proto" in
16683 REENTRANT_PROTO*) ;;
16684 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16685 esac
16686 echo "Prototype: $try" ;;
16687 esac
16688 ;;
c18e646a
JH
16689 *) case "$usethreads" in
16690 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16691 esac
90e831dc
SB
16692 d_setpwent_r=undef
16693 setpwent_r_proto=0
c18e646a 16694 ;;
a48ec845
JH
16695 esac
16696 ;;
10bc17b6
JH
16697*) setpwent_r_proto=0
16698 ;;
16699esac
16700
b4eb6b3d
JH
16701: see if setregid exists
16702set setregid d_setregid
16703eval $inlibc
16704set setresgid d_setresgid
16705eval $inlibc
16706
16707: see if setreuid exists
16708set setreuid d_setreuid
16709eval $inlibc
16710set setresuid d_setresuid
16711eval $inlibc
16712
16713: see if setrgid exists
16714set setrgid d_setrgid
16715eval $inlibc
16716
16717: see if setruid exists
16718set setruid d_setruid
16719eval $inlibc
16720
16721: see if setservent exists
16722set setservent d_setsent
16723eval $inlibc
16724
10bc17b6
JH
16725: see if setservent_r exists
16726set setservent_r d_setservent_r
16727eval $inlibc
16728case "$d_setservent_r" in
16729"$define")
16730 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16731 case "$d_setservent_r_proto:$usethreads" in
16732 ":define") d_setservent_r_proto=define
a48ec845
JH
16733 set d_setservent_r_proto setservent_r $hdrs
16734 eval $hasproto ;;
16735 *) ;;
16736 esac
16737 case "$d_setservent_r_proto" in
16738 define)
10bc17b6
JH
16739 case "$setservent_r_proto" in
16740 ''|0) try='int setservent_r(int, struct servent_data*);'
16741 ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16742 esac
16743 case "$setservent_r_proto" in
16744 ''|0) try='void setservent_r(int, struct servent_data*);'
16745 ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16746 esac
16747 case "$setservent_r_proto" in
90e831dc 16748 ''|0) d_setservent_r=undef
10bc17b6 16749 setservent_r_proto=0
a48ec845 16750 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16751 * ) case "$setservent_r_proto" in
16752 REENTRANT_PROTO*) ;;
16753 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16754 esac
16755 echo "Prototype: $try" ;;
16756 esac
16757 ;;
c18e646a
JH
16758 *) case "$usethreads" in
16759 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16760 esac
90e831dc
SB
16761 d_setservent_r=undef
16762 setservent_r_proto=0
c18e646a 16763 ;;
a48ec845
JH
16764 esac
16765 ;;
10bc17b6
JH
16766*) setservent_r_proto=0
16767 ;;
16768esac
16769
b4eb6b3d
JH
16770: see if setsid exists
16771set setsid d_setsid
16772eval $inlibc
16773
16774: see if setvbuf exists
16775set setvbuf d_setvbuf
16776eval $inlibc
16777
16778: see if sfio.h is available
16779set sfio.h i_sfio
16780eval $inhdr
16781
16782
16783: see if sfio library is available
16784case "$i_sfio" in
16785$define)
16786 val=''
16787 set sfreserve val
16788 eval $inlibc
16789 ;;
16790*)
16791 val="$undef"
16792 ;;
16793esac
16794: Ok, but do we want to use it.
16795case "$val" in
16796$define)
16797 case "$usesfio" in
16798 true|$define|[yY]*) dflt='y';;
16799 *) dflt='n';;
16800 esac
16801 echo "$package can use the sfio library, but it is experimental."
16802 case "$useperlio" in
16803 "$undef")
16804 echo "For sfio also the PerlIO abstraction layer is needed."
16805 echo "Earlier you said you wouldn't want that."
16806 ;;
16807 esac
16808 rp="You seem to have sfio available, do you want to try using it?"
16809 . ./myread
16810 case "$ans" in
16811 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
16812 useperlio="$define"
16813 val="$define"
16814 ;;
16815 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
16816 val="$undef"
b4eb6b3d
JH
16817 ;;
16818 esac
16819 ;;
16820*) case "$usesfio" in
16821 true|$define|[yY]*)
16822 echo "Sorry, cannot find sfio on this machine." >&4
16823 echo "Ignoring your setting of usesfio=$usesfio." >&4
16824 val="$undef"
16825 ;;
16826 esac
16827 ;;
16828esac
16829set d_sfio
16830eval $setvar
16831case "$d_sfio" in
16832$define) usesfio='true';;
16833*) usesfio='false';;
16834esac
3659ebf1
JH
16835case "$d_sfio" in
16836$define) ;;
16837*) : Remove sfio from list of libraries to use
7483f793
JH
16838 case "$libs" in
16839 *-lsfio*)
16840 echo "Removing unneeded -lsfio from library list" >&4
16841 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16842 shift
16843 libs="$*"
16844 echo "libs = $libs" >&4
16845 ;;
16846 esac
3659ebf1
JH
16847;;
16848esac
16849
b4eb6b3d
JH
16850
16851: see if shmctl exists
16852set shmctl d_shmctl
16853eval $inlibc
16854
16855: see if shmget exists
16856set shmget d_shmget
16857eval $inlibc
16858
16859: see if shmat exists
16860set shmat d_shmat
16861eval $inlibc
16862: see what shmat returns
16863case "$d_shmat" in
16864"$define")
16865 $cat >shmat.c <<'END'
16866#include <sys/shm.h>
16867void *shmat();
16868END
16869 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16870 shmattype='void *'
16871 else
16872 shmattype='char *'
16873 fi
16874 echo "and it returns ($shmattype)." >&4
16875 : see if a prototype for shmat is available
16876 xxx=`./findhdr sys/shm.h`
16877 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16878 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16879 val="$define"
16880 else
16881 val="$undef"
16882 fi
16883 $rm -f shmat.[co]
16884 ;;
16885*)
16886 val="$undef"
16887 ;;
16888esac
16889set d_shmatprototype
16890eval $setvar
16891
16892: see if shmdt exists
16893set shmdt d_shmdt
16894eval $inlibc
16895
16896: see how much of the 'shm*(2)' library is present.
16897h_shm=true
16898echo " "
16899case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16900*"$undef"*) h_shm=false;;
16901esac
16902case "$osname" in
16903freebsd)
16904 case "`ipcs 2>&1`" in
16905 "SVID shared memory"*"not configured"*)
16906 echo "Your $osname does not have the shm*(2) configured." >&4
16907 h_shm=false
16908 val="$undef"
16909 set shmctl d_shmctl
16910 evat $setvar
16911 set shmget d_shmget
16912 evat $setvar
16913 set shmat d_shmat
16914 evat $setvar
16915 set shmdt d_shmdt
16916 evat $setvar
16917 ;;
16918 esac
16919 ;;
16920esac
16921: we could also check for sys/ipc.h ...
16922if $h_shm && $test `./findhdr sys/shm.h`; then
16923 echo "You have the full shm*(2) library." >&4
16924 val="$define"
16925else
16926 echo "You don't have the full shm*(2) library." >&4
16927 val="$undef"
16928fi
16929set d_shm
16930eval $setvar
16931
16932echo " "
16933: see if we have sigaction
16934if set sigaction val -f d_sigaction; eval $csym; $val; then
16935 echo 'sigaction() found.' >&4
073b6de5 16936 $cat > try.c <<EOP
b4eb6b3d
JH
16937#include <stdio.h>
16938#include <sys/types.h>
16939#include <signal.h>
073b6de5
JH
16940#$i_stdlib I_STDLIB
16941#ifdef I_STDLIB
16942#include <stdlib.h>
16943#endif
b4eb6b3d
JH
16944int main()
16945{
16946 struct sigaction act, oact;
16947 act.sa_flags = 0;
16948 oact.sa_handler = 0;
16949 /* so that act and oact are used */
16950 exit(act.sa_flags == 0 && oact.sa_handler == 0);
16951}
16952EOP
16953 set try
16954 if eval $compile_ok; then
16955 val="$define"
16956 else
16957 echo "But you don't seem to have a useable struct sigaction." >&4
16958 val="$undef"
16959 fi
16960else
16961 echo 'sigaction NOT found.' >&4
16962 val="$undef"
16963fi
16964set d_sigaction; eval $setvar
16965$rm -f try try$_o try.c
16966
983dbef6
JH
16967: see if sigprocmask exists
16968set sigprocmask d_sigprocmask
16969eval $inlibc
16970
b4eb6b3d
JH
16971: see if sigsetjmp exists
16972echo " "
16973case "$d_sigsetjmp" in
16974'')
c727eafa 16975 $cat >try.c <<EOP
b4eb6b3d 16976#include <setjmp.h>
d1daaddf
JH
16977#$i_stdlib I_STDLIB
16978#ifdef I_STDLIB
16979#include <stdlib.h>
16980#endif
b4eb6b3d
JH
16981sigjmp_buf env;
16982int set = 1;
16983int main()
16984{
16985 if (sigsetjmp(env,1))
16986 exit(set);
16987 set = 0;
16988 siglongjmp(env, 1);
16989 exit(1);
16990}
16991EOP
16992 set try
16993 if eval $compile; then
5440bc8e 16994 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
16995 echo "POSIX sigsetjmp found." >&4
16996 val="$define"
16997 else
16998 $cat >&4 <<EOM
16999Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17000I'll ignore them.
17001EOM
17002 val="$undef"
17003 fi
17004 else
17005 echo "sigsetjmp not found." >&4
17006 val="$undef"
17007 fi
17008 ;;
17009*) val="$d_sigsetjmp"
17010 case "$d_sigsetjmp" in
17011 $define) echo "POSIX sigsetjmp found." >&4;;
17012 $undef) echo "sigsetjmp not found." >&4;;
17013 esac
17014 ;;
17015esac
17016set d_sigsetjmp
17017eval $setvar
17018$rm -f try.c try
17019
4f5da3e9
SP
17020: see if snprintf exists
17021set snprintf d_snprintf
17022eval $inlibc
17023
17024: see if vsnprintf exists
17025set vsnprintf d_vsnprintf
17026eval $inlibc
17027
2478f7a0
MB
17028case "$d_snprintf-$d_vsnprintf" in
17029"$define-$define")
17030 $cat <<EOM
17031Checking whether your snprintf() and vsnprintf() work okay...
17032EOM
17033 $cat >try.c <<'EOCP'
17034/* v?snprintf testing logic courtesy of Russ Allbery.
17035 * According to C99:
17036 * - if the buffer is too short it still must be \0-terminated
17037 * - if the buffer is too short the potentially required length
17038 * must be returned and not -1
17039 * - if the buffer is NULL the potentially required length
17040 * must be returned and not -1 or core dump
17041 */
17042#include <stdio.h>
17043#include <stdarg.h>
17044
17045char buf[2];
17046
17047int test (char *format, ...)
17048{
17049 va_list args;
17050 int count;
17051
17052 va_start (args, format);
17053 count = vsnprintf (buf, sizeof buf, format, args);
17054 va_end (args);
17055 return count;
17056}
17057
17058int main ()
17059{
17060 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17061 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17062}
17063EOCP
17064 set try
17065 if eval $compile; then
17066 `$run ./try`
17067 case "$?" in
17068 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17069 *) cat <<EOM >&4
17070Your snprintf() and snprintf() don't seem to be working okay.
17071EOM
17072 d_snprintf="$undef"
17073 d_vsnprintf="$undef"
17074 ;;
17075 esac
17076 else
17077 echo "(I can't seem to compile the test program--assuming they don't)"
17078 d_snprintf="$undef"
17079 d_vsnprintf="$undef"
17080 fi
17081 $rm -f try.* try core core.try.*
17082 ;;
17083esac
17084
49a78c82
JH
17085: see if sockatmark exists
17086set sockatmark d_sockatmark
17087eval $inlibc
17088
2ef53570
JH
17089: see if prototype for sockatmark is available
17090echo " "
17091set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17092eval $hasproto
17093
b4eb6b3d
JH
17094: see if socks5_init exists
17095set socks5_init d_socks5_init
17096eval $inlibc
17097
360321b3
YST
17098: see if sprintf returns the length of the string in the buffer as per ANSI
17099$echo "Checking whether sprintf returns the length of the string..." >&4
17100$cat <<EOP >try.c
17101#include <stdio.h>
17102#$i_stdlib I_STDLIB
17103#ifdef I_STDLIB
17104#include <stdlib.h>
17105#endif
17106#$i_string I_STRING
17107#ifdef I_STRING
17108# include <string.h>
17109#else
17110# include <strings.h>
17111#endif
17112#$i_math I_MATH
17113#ifdef I_MATH
17114#include <math.h>
17115#endif
17116
17117char buffer[256];
17118
17119int check (size_t expect, int test) {
17120 size_t got = strlen(buffer);
17121 if (expect == got)
17122 return 0;
17123
17124 printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17125 test, buffer);
17126 exit (test);
17127}
17128
17129int main(int argc, char **argv) {
17130 int test = 0;
17131
17132 check(sprintf(buffer, ""), ++test);
17133 check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17134 check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17135
17136 return 0;
17137}
17138EOP
17139set try
17140
17141d_sprintf_returns_strlen="$undef"
17142if eval $compile; then
17143 xxx="`$run ./try`"
17144 case "$?" in
17145 0) cat >&4 <<EOM
17146sprintf returns the length of the string (as ANSI says it should)
17147EOM
17148 d_sprintf_returns_strlen="$define"
17149 ;;
17150 *) cat >&4 <<EOM
17151sprintf does not return the length of the string (how old is this system?)
17152EOM
17153 d_sprintf_returns_strlen="$undef"
17154 ;;
17155 esac
17156fi
17157
17158$rm -f try.* try
17159
10bc17b6
JH
17160: see if srand48_r exists
17161set srand48_r d_srand48_r
17162eval $inlibc
17163case "$d_srand48_r" in
17164"$define")
17165 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17166 case "$d_srand48_r_proto:$usethreads" in
17167 ":define") d_srand48_r_proto=define
a48ec845
JH
17168 set d_srand48_r_proto srand48_r $hdrs
17169 eval $hasproto ;;
17170 *) ;;
17171 esac
17172 case "$d_srand48_r_proto" in
17173 define)
10bc17b6
JH
17174 case "$srand48_r_proto" in
17175 ''|0) try='int srand48_r(long, struct drand48_data*);'
17176 ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17177 esac
17178 case "$srand48_r_proto" in
90e831dc 17179 ''|0) d_srand48_r=undef
10bc17b6 17180 srand48_r_proto=0
a48ec845 17181 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17182 * ) case "$srand48_r_proto" in
17183 REENTRANT_PROTO*) ;;
17184 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17185 esac
17186 echo "Prototype: $try" ;;
17187 esac
17188 ;;
c18e646a
JH
17189 *) case "$usethreads" in
17190 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17191 esac
90e831dc
SB
17192 d_srand48_r=undef
17193 srand48_r_proto=0
c18e646a 17194 ;;
a48ec845
JH
17195 esac
17196 ;;
10bc17b6
JH
17197*) srand48_r_proto=0
17198 ;;
17199esac
17200
17201: see if srandom_r exists
17202set srandom_r d_srandom_r
17203eval $inlibc
17204case "$d_srandom_r" in
17205"$define")
17206 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17207 case "$d_srandom_r_proto:$usethreads" in
17208 ":define") d_srandom_r_proto=define
a48ec845
JH
17209 set d_srandom_r_proto srandom_r $hdrs
17210 eval $hasproto ;;
17211 *) ;;
17212 esac
17213 case "$d_srandom_r_proto" in
17214 define)
10bc17b6
JH
17215 case "$srandom_r_proto" in
17216 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17217 ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17218 esac
17219 case "$srandom_r_proto" in
90e831dc 17220 ''|0) d_srandom_r=undef
10bc17b6 17221 srandom_r_proto=0
a48ec845 17222 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17223 * ) case "$srandom_r_proto" in
17224 REENTRANT_PROTO*) ;;
17225 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17226 esac
17227 echo "Prototype: $try" ;;
17228 esac
17229 ;;
c18e646a
JH
17230 *) case "$usethreads" in
17231 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17232 esac
90e831dc
SB
17233 d_srandom_r=undef
17234 srandom_r_proto=0
c18e646a 17235 ;;
a48ec845
JH
17236 esac
17237 ;;
10bc17b6
JH
17238*) srandom_r_proto=0
17239 ;;
17240esac
17241
eef837ea
JH
17242: see if prototype for setresgid is available
17243echo " "
17244set d_sresgproto setresgid $i_unistd unistd.h
17245eval $hasproto
17246
640374d0
JH
17247: see if prototype for setresuid is available
17248echo " "
17249set d_sresuproto setresuid $i_unistd unistd.h
17250eval $hasproto
17251
b4eb6b3d
JH
17252: see if sys/stat.h is available
17253set sys/stat.h i_sysstat
17254eval $inhdr
17255
17256
17257: see if stat knows about block sizes
17258echo " "
17259echo "Checking to see if your struct stat has st_blocks field..." >&4
17260set d_statblks stat st_blocks $i_sysstat sys/stat.h
17261eval $hasfield
17262
17263
17264: see if this is a sys/vfs.h system
17265set sys/vfs.h i_sysvfs
17266eval $inhdr
17267
17268
17269: see if this is a sys/statfs.h system
17270set sys/statfs.h i_sysstatfs
17271eval $inhdr
17272
17273
17274echo " "
17275echo "Checking to see if your system supports struct statfs..." >&4
17276set 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
17277eval $hasstruct
17278case "$d_statfs_s" in
17279"$define") echo "Yes, it does." ;;
17280*) echo "No, it doesn't." ;;
17281esac
17282
17283
17284
17285: see if struct statfs knows about f_flags
17286case "$d_statfs_s" in
17287define)
17288 echo " "
17289 echo "Checking to see if your struct statfs has f_flags field..." >&4
17290 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
17291 eval $hasfield
17292 ;;
17293*) val="$undef"
17294 set d_statfs_f_flags
17295 eval $setvar
17296 ;;
17297esac
17298case "$d_statfs_f_flags" in
17299"$define") echo "Yes, it does." ;;
17300*) echo "No, it doesn't." ;;
17301esac
17302
b4eb6b3d
JH
17303$cat >&4 <<EOM
17304Checking how to access stdio streams by file descriptor number...
17305EOM
17306case "$stdio_stream_array" in
17307'') $cat >try.c <<EOCP
17308#include <stdio.h>
17309int main() {
17310 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17311 printf("yes\n");
17312}
17313EOCP
17314 for s in _iob __iob __sF
17315 do
17316 set try -DSTDIO_STREAM_ARRAY=$s
17317 if eval $compile; then
5440bc8e 17318 case "`$run ./try`" in
b4eb6b3d
JH
17319 yes) stdio_stream_array=$s; break ;;
17320 esac
17321 fi
17322 done
17323 $rm -f try.* try$exe_ext
17324esac
17325case "$stdio_stream_array" in
17326'') $cat >&4 <<EOM
17327I can't figure out how to access stdio streams by file descriptor number.
17328EOM
17329 d_stdio_stream_array="$undef"
17330 ;;
17331*) $cat >&4 <<EOM
17332You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17333EOM
17334 d_stdio_stream_array="$define"
17335 ;;
17336esac
17337
17338: see if strcoll exists
17339set strcoll d_strcoll
17340eval $inlibc
17341
17342: check for structure copying
17343echo " "
17344echo "Checking to see if your C compiler can copy structs..." >&4
17345$cat >try.c <<'EOCP'
76f47787 17346int main()
b4eb6b3d
JH
17347{
17348 struct blurfl {
17349 int dyick;
17350 } foo, bar;
17351
17352 foo = bar;
17353}
17354EOCP
17355if $cc -c try.c >/dev/null 2>&1 ; then
17356 val="$define"
17357 echo "Yup, it can."
17358else
17359 val="$undef"
17360 echo "Nope, it can't."
17361fi
17362set d_strctcpy
17363eval $setvar
17364$rm -f try.*
17365
17366: see if strerror and/or sys_errlist[] exist
17367echo " "
17368if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17369 if set strerror val -f d_strerror; eval $csym; $val; then
17370 echo 'strerror() found.' >&4
17371 d_strerror="$define"
17372 d_strerrm='strerror(e)'
17373 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17374 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
17375 d_syserrlst="$define"
17376 else
17377 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17378 d_syserrlst="$undef"
17379 fi
17380 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17381 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17382 echo 'strerror() found in string header.' >&4
17383 d_strerror="$define"
17384 d_strerrm='strerror(e)'
17385 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17386 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17387 d_syserrlst="$define"
17388 else
17389 echo "(You don't appear to have any sys_errlist[], how can this be?)"
17390 d_syserrlst="$undef"
17391 fi
17392 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17393 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17394 d_strerror="$undef"
17395 d_syserrlst="$define"
17396 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17397 else
17398 echo 'strerror() and sys_errlist[] NOT found.' >&4
17399 d_strerror="$undef"
17400 d_syserrlst="$undef"
17401 d_strerrm='"unknown"'
17402 fi
17403fi
17404
10bc17b6
JH
17405: see if strerror_r exists
17406set strerror_r d_strerror_r
17407eval $inlibc
17408case "$d_strerror_r" in
17409"$define")
17410 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
17411 case "$d_strerror_r_proto:$usethreads" in
17412 ":define") d_strerror_r_proto=define
a48ec845
JH
17413 set d_strerror_r_proto strerror_r $hdrs
17414 eval $hasproto ;;
17415 *) ;;
17416 esac
17417 case "$d_strerror_r_proto" in
17418 define)
10bc17b6
JH
17419 case "$strerror_r_proto" in
17420 ''|0) try='int strerror_r(int, char*, size_t);'
17421 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17422 esac
17423 case "$strerror_r_proto" in
17424 ''|0) try='int strerror_r(int, char*, int);'
17425 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17426 esac
17427 case "$strerror_r_proto" in
17428 ''|0) try='char* strerror_r(int, char*, size_t);'
17429 ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17430 esac
17431 case "$strerror_r_proto" in
90e831dc 17432 ''|0) d_strerror_r=undef
10bc17b6 17433 strerror_r_proto=0
a48ec845 17434 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17435 * ) case "$strerror_r_proto" in
17436 REENTRANT_PROTO*) ;;
17437 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17438 esac
17439 echo "Prototype: $try" ;;
17440 esac
17441 ;;
c18e646a
JH
17442 *) case "$usethreads" in
17443 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17444 esac
90e831dc
SB
17445 d_strerror_r=undef
17446 strerror_r_proto=0
c18e646a 17447 ;;
a48ec845
JH
17448 esac
17449 ;;
10bc17b6
JH
17450*) strerror_r_proto=0
17451 ;;
17452esac
17453
b3c85772
JH
17454: see if strftime exists
17455set strftime d_strftime
17456eval $inlibc
17457
08c92000
MB
17458: see if strlcat exists
17459set strlcat d_strlcat
17460eval $inlibc
17461
17462: see if strlcpy exists
17463set strlcpy d_strlcpy
17464eval $inlibc
17465
b4eb6b3d
JH
17466: see if strtod exists
17467set strtod d_strtod
17468eval $inlibc
17469
17470: see if strtol exists
17471set strtol d_strtol
17472eval $inlibc
17473
17474: see if strtold exists
17475set strtold d_strtold
17476eval $inlibc
17477
17478: see if strtoll exists
17479set strtoll d_strtoll
17480eval $inlibc
17481
17482case "$d_longlong-$d_strtoll" in
17483"$define-$define")
17484 $cat <<EOM
17485Checking whether your strtoll() works okay...
17486EOM
17487 $cat >try.c <<'EOCP'
17488#include <errno.h>
17489#ifdef __hpux
17490#define strtoll __strtoll
17491#endif
e75931a7
YST
17492#ifdef __EMX__
17493#define strtoll _strtoll
17494#endif
b4eb6b3d
JH
17495#include <stdio.h>
17496extern long long int strtoll(char *s, char **, int);
17497static int bad = 0;
17498int check(char *s, long long ell, int een) {
17499 long long gll;
17500 errno = 0;
17501 gll = strtoll(s, 0, 10);
17502 if (!((gll == ell) && (errno == een)))
17503 bad++;
17504}
17505int main() {
17506 check(" 1", 1LL, 0);
17507 check(" 0", 0LL, 0);
17508 check("-1", -1LL, 0);
17509 check("-9223372036854775808", -9223372036854775808LL, 0);
17510 check("-9223372036854775808", -9223372036854775808LL, 0);
17511 check(" 9223372036854775807", 9223372036854775807LL, 0);
17512 check("-9223372036854775808", -9223372036854775808LL, 0);
17513 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
17514 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17515 if (!bad)
17516 printf("ok\n");
17517}
17518EOCP
17519 set try
17520 if eval $compile; then
5440bc8e 17521 yyy=`$run ./try`
e75931a7 17522 case "$yyy" in
b4eb6b3d
JH
17523 ok) echo "Your strtoll() seems to be working okay." ;;
17524 *) cat <<EOM >&4
17525Your strtoll() doesn't seem to be working okay.
17526EOM
17527 d_strtoll="$undef"
17528 ;;
69eadf66 17529 esac
e75931a7
YST
17530 else
17531 echo "(I can't seem to compile the test program--assuming it doesn't)"
17532 d_strtoll="$undef"
b4eb6b3d
JH
17533 fi
17534 ;;
17535esac
17536
28e5dec8
JH
17537: see if strtoq exists
17538set strtoq d_strtoq
17539eval $inlibc
17540
b4eb6b3d
JH
17541: see if strtoul exists
17542set strtoul d_strtoul
17543eval $inlibc
17544
d0e6d399
NC
17545case "$d_strtoul" in
17546"$define")
17547 $cat <<EOM
17548Checking whether your strtoul() works okay...
17549EOM
17550 $cat >try.c <<'EOCP'
17551#include <errno.h>
17552#include <stdio.h>
17553extern unsigned long int strtoul(char *s, char **, int);
17554static int bad = 0;
17555void check(char *s, unsigned long eul, int een) {
17556 unsigned long gul;
17557 errno = 0;
17558 gul = strtoul(s, 0, 10);
17559 if (!((gul == eul) && (errno == een)))
17560 bad++;
17561}
17562int main() {
17563 check(" 1", 1L, 0);
17564 check(" 0", 0L, 0);
17565EOCP
17566 case "$longsize" in
17567 8)
17568 $cat >>try.c <<'EOCP'
09c0d2c4
JH
17569 check("18446744073709551615", 18446744073709551615UL, 0);
17570 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 17571#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 17572 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
17573 check("-18446744073709551614", 2, 0);
17574 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
17575 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17576 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 17577#endif
d0e6d399
NC
17578EOCP
17579 ;;
17580 4)
17581 $cat >>try.c <<'EOCP'
17582 check("4294967295", 4294967295UL, 0);
17583 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 17584#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
17585 check("-1", 4294967295UL, 0);
17586 check("-4294967294", 2, 0);
17587 check("-4294967295", 1, 0);
17588 check("-4294967296", 4294967295UL, ERANGE);
17589 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 17590#endif
d0e6d399
NC
17591EOCP
17592 ;;
17593 *)
17594: Should we write these tests to be more portable by sprintf-ing
17595: ~0 and then manipulating that char string as input for strtol?
17596 ;;
17597 esac
17598 $cat >>try.c <<'EOCP'
17599 if (!bad)
17600 printf("ok\n");
17601 return 0;
17602}
17603EOCP
17604 set try
17605 if eval $compile; then
5440bc8e 17606 case "`$run ./try`" in
d0e6d399
NC
17607 ok) echo "Your strtoul() seems to be working okay." ;;
17608 *) cat <<EOM >&4
17609Your strtoul() doesn't seem to be working okay.
17610EOM
17611 d_strtoul="$undef"
17612 ;;
17613 esac
17614 fi
17615 ;;
17616esac
17617
b4eb6b3d
JH
17618: see if strtoull exists
17619set strtoull d_strtoull
17620eval $inlibc
17621
17622case "$d_longlong-$d_strtoull" in
17623"$define-$define")
17624 $cat <<EOM
17625Checking whether your strtoull() works okay...
17626EOM
17627 $cat >try.c <<'EOCP'
17628#include <errno.h>
17629#ifdef __hpux
17630#define strtoull __strtoull
17631#endif
17632#include <stdio.h>
17633extern unsigned long long int strtoull(char *s, char **, int);
17634static int bad = 0;
17635int check(char *s, long long eull, int een) {
17636 long long gull;
17637 errno = 0;
17638 gull = strtoull(s, 0, 10);
17639 if (!((gull == eull) && (errno == een)))
17640 bad++;
17641}
17642int main() {
d0e6d399
NC
17643 check(" 1", 1LL, 0);
17644 check(" 0", 0LL, 0);
17645 check("18446744073709551615", 18446744073709551615ULL, 0);
17646 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 17647#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
17648 check("-1", 18446744073709551615ULL, 0);
17649 check("-18446744073709551614", 2LL, 0);
17650 check("-18446744073709551615", 1LL, 0);
17651 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17652 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 17653#endif
b4eb6b3d
JH
17654 if (!bad)
17655 printf("ok\n");
17656}
17657EOCP
17658 set try
17659 if eval $compile; then
5440bc8e 17660 case "`$run ./try`" in
b4eb6b3d
JH
17661 ok) echo "Your strtoull() seems to be working okay." ;;
17662 *) cat <<EOM >&4
17663Your strtoull() doesn't seem to be working okay.
17664EOM
17665 d_strtoull="$undef"
17666 ;;
17667 esac
17668 fi
17669 ;;
17670esac
17671
17672: see if strtouq exists
17673set strtouq d_strtouq
17674eval $inlibc
17675
d0e6d399
NC
17676case "$d_strtouq" in
17677"$define")
17678 $cat <<EOM
17679Checking whether your strtouq() works okay...
17680EOM
17681 $cat >try.c <<'EOCP'
17682#include <errno.h>
17683#include <stdio.h>
17684extern unsigned long long int strtouq(char *s, char **, int);
17685static int bad = 0;
17686void check(char *s, unsigned long long eull, int een) {
17687 unsigned long long gull;
17688 errno = 0;
17689 gull = strtouq(s, 0, 10);
17690 if (!((gull == eull) && (errno == een)))
17691 bad++;
17692}
17693int main() {
17694 check(" 1", 1LL, 0);
17695 check(" 0", 0LL, 0);
17696 check("18446744073709551615", 18446744073709551615ULL, 0);
17697 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 17698#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
17699 check("-1", 18446744073709551615ULL, 0);
17700 check("-18446744073709551614", 2LL, 0);
17701 check("-18446744073709551615", 1LL, 0);
17702 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17703 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 17704#endif
d0e6d399
NC
17705 if (!bad)
17706 printf("ok\n");
17707 return 0;
17708}
17709EOCP
17710 set try
17711 if eval $compile; then
5440bc8e 17712 case "`$run ./try`" in
d0e6d399
NC
17713 ok) echo "Your strtouq() seems to be working okay." ;;
17714 *) cat <<EOM >&4
17715Your strtouq() doesn't seem to be working okay.
17716EOM
17717 d_strtouq="$undef"
17718 ;;
17719 esac
17720 fi
17721 ;;
17722esac
17723
b4eb6b3d
JH
17724: see if strxfrm exists
17725set strxfrm d_strxfrm
17726eval $inlibc
17727
17728: see if symlink exists
17729set symlink d_symlink
17730eval $inlibc
17731
17732: see if syscall exists
17733set syscall d_syscall
17734eval $inlibc
17735
2ef53570
JH
17736: see if prototype for syscall is available
17737echo " "
17738set d_syscallproto syscall $i_unistd unistd.h
17739eval $hasproto
17740
b4eb6b3d
JH
17741: see if sysconf exists
17742set sysconf d_sysconf
17743eval $inlibc
17744
17745: see if system exists
17746set system d_system
17747eval $inlibc
17748
17749: see if tcgetpgrp exists
17750set tcgetpgrp d_tcgetpgrp
17751eval $inlibc
17752
17753: see if tcsetpgrp exists
17754set tcsetpgrp d_tcsetpgrp
17755eval $inlibc
17756
17757: see if prototype for telldir is available
17758echo " "
17759set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17760eval $hasproto
17761
ad493445
MB
17762: see if time exists
17763echo " "
17764if test "X$d_time" = X -o X"$timetype" = X; then
17765 if set time val -f d_time; eval $csym; $val; then
17766 echo 'time() found.' >&4
17767 val="$define"
17768 rp="What is the type returned by time() on this system?"
17769 set time_t timetype long stdio.h sys/types.h
17770 eval $typedef_ask
17771 else
17772 echo 'time() not found, hope that will do.' >&4
17773 val="$undef"
17774 timetype='int';
17775 fi
17776 set d_time
17777 eval $setvar
17778fi
17779
b4eb6b3d
JH
17780: see if this is a sys/times.h system
17781set sys/times.h i_systimes
17782eval $inhdr
17783
17784: see if times exists
17785echo " "
17786if set times val -f d_times; eval $csym; $val; then
17787 echo 'times() found.' >&4
17788 d_times="$define"
17789 inc=''
17790 case "$i_systimes" in
17791 "$define") inc='sys/times.h';;
17792 esac
17793 rp="What is the type returned by times() on this system?"
17794 set clock_t clocktype long stdio.h sys/types.h $inc
17795 eval $typedef_ask
17796else
17797 echo 'times() NOT found, hope that will do.' >&4
17798 d_times="$undef"
17799 clocktype='int'
17800fi
17801
10bc17b6
JH
17802: see if tmpnam_r exists
17803set tmpnam_r d_tmpnam_r
17804eval $inlibc
17805case "$d_tmpnam_r" in
17806"$define")
31ee0cb7 17807 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
17808 case "$d_tmpnam_r_proto:$usethreads" in
17809 ":define") d_tmpnam_r_proto=define
a48ec845
JH
17810 set d_tmpnam_r_proto tmpnam_r $hdrs
17811 eval $hasproto ;;
17812 *) ;;
17813 esac
17814 case "$d_tmpnam_r_proto" in
17815 define)
10bc17b6
JH
17816 case "$tmpnam_r_proto" in
17817 ''|0) try='char* tmpnam_r(char*);'
17818 ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17819 esac
17820 case "$tmpnam_r_proto" in
90e831dc 17821 ''|0) d_tmpnam_r=undef
10bc17b6 17822 tmpnam_r_proto=0
a48ec845 17823 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17824 * ) case "$tmpnam_r_proto" in
17825 REENTRANT_PROTO*) ;;
17826 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17827 esac
17828 echo "Prototype: $try" ;;
17829 esac
17830 ;;
c18e646a
JH
17831 *) case "$usethreads" in
17832 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17833 esac
90e831dc
SB
17834 d_tmpnam_r=undef
17835 tmpnam_r_proto=0
c18e646a 17836 ;;
a48ec845
JH
17837 esac
17838 ;;
10bc17b6
JH
17839*) tmpnam_r_proto=0
17840 ;;
17841esac
17842
b4eb6b3d
JH
17843: see if truncate exists
17844set truncate d_truncate
17845eval $inlibc
17846
10bc17b6
JH
17847: see if ttyname_r exists
17848set ttyname_r d_ttyname_r
17849eval $inlibc
17850case "$d_ttyname_r" in
17851"$define")
17852 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
17853 case "$d_ttyname_r_proto:$usethreads" in
17854 ":define") d_ttyname_r_proto=define
a48ec845
JH
17855 set d_ttyname_r_proto ttyname_r $hdrs
17856 eval $hasproto ;;
17857 *) ;;
17858 esac
17859 case "$d_ttyname_r_proto" in
17860 define)
10bc17b6
JH
17861 case "$ttyname_r_proto" in
17862 ''|0) try='int ttyname_r(int, char*, size_t);'
17863 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17864 esac
17865 case "$ttyname_r_proto" in
17866 ''|0) try='int ttyname_r(int, char*, int);'
17867 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17868 esac
17869 case "$ttyname_r_proto" in
17870 ''|0) try='char* ttyname_r(int, char*, int);'
17871 ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17872 esac
17873 case "$ttyname_r_proto" in
90e831dc 17874 ''|0) d_ttyname_r=undef
10bc17b6 17875 ttyname_r_proto=0
a48ec845 17876 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17877 * ) case "$ttyname_r_proto" in
17878 REENTRANT_PROTO*) ;;
17879 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17880 esac
17881 echo "Prototype: $try" ;;
17882 esac
17883 ;;
c18e646a
JH
17884 *) case "$usethreads" in
17885 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17886 esac
90e831dc
SB
17887 d_ttyname_r=undef
17888 ttyname_r_proto=0
c18e646a 17889 ;;
a48ec845
JH
17890 esac
17891 ;;
10bc17b6
JH
17892*) ttyname_r_proto=0
17893 ;;
17894esac
17895
b4eb6b3d
JH
17896: see if tzname[] exists
17897echo " "
17898if set tzname val -a d_tzname; eval $csym; $val; then
17899 val="$define"
17900 echo 'tzname[] found.' >&4
17901else
17902 val="$undef"
17903 echo 'tzname[] NOT found.' >&4
17904fi
17905set d_tzname
17906eval $setvar
17907
4e0554ec
JH
17908case "$osname" in
17909next|rhapsody|darwin) multiarch="$define" ;;
17910esac
17911case "$multiarch" in
17912''|[nN]*) multiarch="$undef" ;;
17913esac
17914
24412007 17915: check for ordering of bytes in a UV
4e0554ec 17916echo " "
5440bc8e 17917case "$usecrosscompile$multiarch" in
4e0554ec
JH
17918*$define*)
17919 $cat <<EOM
17920You seem to be either cross-compiling or doing a multiarchitecture build,
17921skipping the byteorder check.
17922
17923EOM
5440bc8e 17924 byteorder='ffff'
4e0554ec
JH
17925 ;;
17926*)
17927 case "$byteorder" in
17928 '')
17929 $cat <<'EOM'
17930In the following, larger digits indicate more significance. A big-endian
17931machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17932little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17933machines may have weird orders like 3412. A Cray will report 87654321,
17934an Alpha will report 12345678. If the test program works the default is
17935probably right.
17936I'm now running the test program...
17937EOM
24412007 17938 $cat >try.c <<EOCP
4e0554ec 17939#include <stdio.h>
55954f19
JH
17940#$i_stdlib I_STDLIB
17941#ifdef I_STDLIB
17942#include <stdlib.h>
17943#endif
24412007
JH
17944#include <sys/types.h>
17945typedef $uvtype UV;
4e0554ec
JH
17946int main()
17947{
17948 int i;
17949 union {
24412007
JH
17950 UV l;
17951 char c[$uvsize];
4e0554ec
JH
17952 } u;
17953
24412007 17954 if ($uvsize > 4)
b5ded3e5 17955 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 17956 else
a4c53327 17957 u.l = (UV)0x04030201;
24412007 17958 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
17959 printf("%c", u.c[i]+'0');
17960 printf("\n");
17961 exit(0);
17962}
17963EOCP
17964 xxx_prompt=y
17965 set try
17966 if eval $compile && ./try > /dev/null; then
5440bc8e 17967 dflt=`$run ./try`
4e0554ec
JH
17968 case "$dflt" in
17969 [1-4][1-4][1-4][1-4]|12345678|87654321)
17970 echo "(The test program ran ok.)"
17971 echo "byteorder=$dflt"
17972 xxx_prompt=n
17973 ;;
17974 ????|????????) echo "(The test program ran ok.)" ;;
17975 *) echo "(The test program didn't run right for some reason.)" ;;
17976 esac
17977 else
17978 dflt='4321'
17979 cat <<'EOM'
17980(I can't seem to compile the test program. Guessing big-endian...)
17981EOM
17982 fi
17983 case "$xxx_prompt" in
17984 y)
24412007 17985 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
17986 . ./myread
17987 byteorder="$ans"
17988 ;;
17989 *) byteorder=$dflt
17990 ;;
17991 esac
17992 ;;
17993 esac
17994 $rm -f try.c try
17995 ;;
17996esac
17997
17998
17999$cat <<EOM
18000
18001Checking to see whether you can access character data unalignedly...
18002EOM
dc7b0a4f
JH
18003case "$d_u32align" in
18004'') $cat >try.c <<EOCP
4e0554ec 18005#include <stdio.h>
d1daaddf
JH
18006#$i_stdlib I_STDLIB
18007#ifdef I_STDLIB
18008#include <stdlib.h>
18009#endif
4e0554ec 18010#define U32 $u32type
d308175a
JH
18011#define BYTEORDER 0x$byteorder
18012#define U8 $u8type
9958dc3c
JH
18013#include <signal.h>
18014#ifdef SIGBUS
7090f861 18015$signal_t bletch(int s) { exit(4); }
9958dc3c 18016#endif
4e0554ec
JH
18017int main() {
18018#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
8906a23e 18019 U8 buf[8];
4e0554ec
JH
18020 U32 *up;
18021 int i;
18022
18023 if (sizeof(U32) != 4) {
18024 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18025 exit(1);
18026 }
18027
18028 fflush(stdout);
18029
9958dc3c
JH
18030#ifdef SIGBUS
18031 signal(SIGBUS, bletch);
18032#endif
18033
8906a23e
JH
18034 buf[0] = 0;
18035 buf[1] = 0;
18036 buf[2] = 0;
18037 buf[3] = 1;
7eac3fd6 18038 buf[4] = 0;
8906a23e
JH
18039 buf[5] = 0;
18040 buf[6] = 0;
7eac3fd6 18041 buf[7] = 1;
8906a23e 18042
4e0554ec
JH
18043 for (i = 0; i < 4; i++) {
18044 up = (U32*)(buf + i);
18045 if (! ((*up == 1 << (8*i)) || /* big-endian */
18046 (*up == 1 << (8*(3-i))) /* little-endian */
18047 )
18048 )
18049 {
18050 printf("read failed (%x)\n", *up);
18051 exit(2);
18052 }
18053 }
18054
18055 /* write test */
18056 for (i = 0; i < 4; i++) {
18057 up = (U32*)(buf + i);
18058 *up = 0xBeef;
18059 if (*up != 0xBeef) {
18060 printf("write failed (%x)\n", *up);
18061 exit(3);
18062 }
18063 }
18064
18065 exit(0);
18066#else
18067 printf("1\n");
18068 exit(1);
18069#endif
18070 return 0;
18071}
18072EOCP
18073set try
18074if eval $compile_ok; then
d308175a 18075 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 18076 $run ./try 2>&1 >/dev/null
4e0554ec
JH
18077 case "$?" in
18078 0) cat >&4 <<EOM
18079You can access character data pretty unalignedly.
18080EOM
18081 d_u32align="$undef"
18082 ;;
18083 *) cat >&4 <<EOM
18084It seems that you must access character data in an aligned manner.
18085EOM
18086 d_u32align="$define"
18087 ;;
18088 esac
4e0554ec
JH
18089else
18090 rp='Can you access character data at unaligned addresses?'
18091 dflt='n'
18092 . ./myread
18093 case "$ans" in
18094 [yY]*) d_u32align="$undef" ;;
18095 *) d_u32align="$define" ;;
18096 esac
18097fi
e36b5403 18098$rm -f core core.try.* try.core
dc7b0a4f
JH
18099;;
18100esac
4e0554ec
JH
18101
18102: see if ualarm exists
18103set ualarm d_ualarm
18104eval $inlibc
18105
b4eb6b3d
JH
18106: see if umask exists
18107set umask d_umask
18108eval $inlibc
18109
758a5d79
JH
18110: see if unordered exists
18111set unordered d_unordered
18112eval $inlibc
18113
bdf33aa7
SP
18114: see if unsetenv exists
18115set unsetenv d_unsetenv
18116eval $inlibc
18117
4e0554ec
JH
18118: see if usleep exists
18119set usleep d_usleep
18120eval $inlibc
18121
2ef53570
JH
18122: see if prototype for usleep is available
18123echo " "
18124set d_usleepproto usleep $i_unistd unistd.h
18125eval $hasproto
18126
b4eb6b3d
JH
18127: see if ustat exists
18128set ustat d_ustat
18129eval $inlibc
18130
b4eb6b3d
JH
18131: see if closedir exists
18132set closedir d_closedir
18133eval $inlibc
18134
18135case "$d_closedir" in
18136"$define")
18137 echo " "
18138 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 18139 cat > try.c <<EOM
b4eb6b3d
JH
18140#$i_dirent I_DIRENT /**/
18141#$i_sysdir I_SYS_DIR /**/
18142#$i_sysndir I_SYS_NDIR /**/
18143#$i_systypes I_SYS_TYPES /**/
18144
18145#if defined(I_SYS_TYPES)
18146#include <sys/types.h>
18147#endif
18148#if defined(I_DIRENT)
18149#include <dirent.h>
18150#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18151#include <sys/dir.h>
18152#endif
18153#else
18154#ifdef I_SYS_NDIR
18155#include <sys/ndir.h>
18156#else
18157#ifdef I_SYS_DIR
18158#ifdef hp9000s500
18159#include <ndir.h> /* may be wrong in the future */
18160#else
18161#include <sys/dir.h>
18162#endif
18163#endif
18164#endif
18165#endif
18166int main() { return closedir(opendir(".")); }
18167EOM
5440bc8e 18168 set try
b4eb6b3d 18169 if eval $compile_ok; then
5440bc8e 18170 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
18171 echo "Yes, it does."
18172 val="$undef"
18173 else
18174 echo "No, it doesn't."
18175 val="$define"
18176 fi
18177 else
18178 echo "(I can't seem to compile the test program--assuming it doesn't)"
18179 val="$define"
18180 fi
18181 ;;
18182*)
18183 val="$undef";
18184 ;;
18185esac
18186set d_void_closedir
18187eval $setvar
5440bc8e 18188$rm -f try try.*
b4eb6b3d
JH
18189: see if there is a wait4
18190set wait4 d_wait4
18191eval $inlibc
18192
18193: see if waitpid exists
18194set waitpid d_waitpid
18195eval $inlibc
18196
18197: see if wcstombs exists
18198set wcstombs d_wcstombs
18199eval $inlibc
18200
18201: see if wctomb exists
18202set wctomb d_wctomb
18203eval $inlibc
18204
4e0554ec
JH
18205: see if writev exists
18206set writev d_writev
18207eval $inlibc
18208
b4eb6b3d
JH
18209: preserve RCS keywords in files with variable substitution, grrr
18210Date='$Date'
18211Id='$Id'
18212Log='$Log'
18213RCSfile='$RCSfile'
18214Revision='$Revision'
18215
b4eb6b3d
JH
18216: check for alignment requirements
18217echo " "
5440bc8e 18218case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
18219*$define*)
18220 $cat <<EOM
18221You seem to be either cross-compiling or doing a multiarchitecture build,
18222skipping the memory alignment check.
18223
18224EOM
18225 case "$alignbytes" in
18226 '') alignbytes=8 ;;
18227 esac
18228 ;;
18229*)
18230 case "$alignbytes" in
18231 '') echo "Checking alignment constraints..." >&4
18232 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18233 $cat >try.c <<'EOCP'
18234typedef long double NV;
18235EOCP
18236 else
18237 $cat >try.c <<'EOCP'
18238typedef double NV;
18239EOCP
18240 fi
18241 $cat >>try.c <<'EOCP'
18242#include <stdio.h>
18243struct foobar {
18244 char foo;
18245 NV bar;
18246} try_algn;
18247int main()
18248{
18249 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18250 return(0);
18251}
18252EOCP
18253 set try
18254 if eval $compile_ok; then
5440bc8e 18255 dflt=`$run ./try`
b4eb6b3d
JH
18256 else
18257 dflt='8'
18258 echo "(I can't seem to compile the test program...)"
18259 fi
18260 ;;
18261 *) dflt="$alignbytes"
18262 ;;
18263 esac
18264 rp="Doubles must be aligned on a how-many-byte boundary?"
18265 . ./myread
18266 alignbytes="$ans"
18267 $rm -f try.c try
18268 ;;
18269esac
18270
18271
18272: set the base revision
18273baserev=5.0
18274
3099fc99 18275: how do we concatenate cpp tokens here?
b4eb6b3d 18276echo " "
3099fc99 18277echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
18278$cat >cpp_stuff.c <<'EOCP'
18279#define RCAT(a,b)a/**/b
18280#define ACAT(a,b)a ## b
18281RCAT(Rei,ser)
18282ACAT(Cir,cus)
18283EOCP
18284$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18285if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18286 echo "Oh! Smells like ANSI's been here." >&4
18287 echo "We can catify or stringify, separately or together!"
18288 cpp_stuff=42
18289elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18290 echo "Ah, yes! The good old days!" >&4
18291 echo "However, in the good old days we don't know how to stringify and"
18292 echo "catify at the same time."
18293 cpp_stuff=1
18294else
18295 $cat >&4 <<EOM
3099fc99
CW
18296Hmm, I don't seem to be able to concatenate tokens with your cpp.
18297You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
18298EOM
18299 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18300fi
18301$rm -f cpp_stuff.*
18302
18303: see if this is a db.h system
18304set db.h i_db
18305eval $inhdr
18306
18307case "$i_db" in
18308$define)
18309 : Check db version.
18310 echo " "
18311 echo "Checking Berkeley DB version ..." >&4
18312 $cat >try.c <<EOCP
18313#$d_const HASCONST
18314#ifndef HASCONST
18315#define const
18316#endif
18317#include <sys/types.h>
18318#include <stdio.h>
55954f19
JH
18319#$i_stdlib I_STDLIB
18320#ifdef I_STDLIB
18321#include <stdlib.h>
18322#endif
b4eb6b3d 18323#include <db.h>
640374d0 18324int main(int argc, char *argv[])
b4eb6b3d
JH
18325{
18326#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18327 int Major, Minor, Patch ;
18328 unsigned long Version ;
18329 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
18330 if (argc == 2) {
18331 printf("%d %d %d %d %d %d\n",
18332 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18333 Major, Minor, Patch);
18334 exit(0);
18335 }
18336 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
18337
18338 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18339 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18340 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18341 Major, Minor, Patch) ;
18342
18343 /* check that db.h & libdb are compatible */
18344 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 18345 printf("db.h and libdb are incompatible.\n") ;
b4eb6b3d
JH
18346 exit(3);
18347 }
18348
640374d0 18349 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
18350
18351 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18352 + DB_VERSION_PATCH ;
18353
18354 /* needs to be >= 2.3.4 */
18355 if (Version < 2003004) {
18356 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 18357 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
b4eb6b3d
JH
18358 exit(2);
18359 }
18360
18361 exit(0);
18362#else
18363#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
18364 if (argc == 2) {
18365 printf("1 0 0\n");
18366 exit(0);
18367 }
18368 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
18369 exit(0); /* DB version < 2: the coast is clear. */
18370#else
18371 exit(1); /* <db.h> not Berkeley DB? */
18372#endif
18373#endif
18374}
18375EOCP
18376 set try
5440bc8e 18377 if eval $compile_ok && $run ./try; then
b4eb6b3d 18378 echo 'Looks OK.' >&4
5440bc8e 18379 set `$run ./try 1`
640374d0
JH
18380 db_version_major=$1
18381 db_version_minor=$2
18382 db_version_patch=$3
b4eb6b3d
JH
18383 else
18384 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
18385 i_db=$undef
18386 case " $libs " in
18387 *"-ldb "*)
18388 : Remove db from list of libraries to use
18389 echo "Removing unusable -ldb from library list" >&4
18390 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18391 shift
18392 libs="$*"
18393 echo "libs = $libs" >&4
18394 ;;
18395 esac
18396 fi
18397 $rm -f try.*
18398 ;;
18399esac
18400
18401case "$i_db" in
18402define)
18403 : Check the return type needed for hash
18404 echo " "
18405 echo "Checking return type needed for hash for Berkeley DB ..." >&4
18406 $cat >try.c <<EOCP
18407#$d_const HASCONST
18408#ifndef HASCONST
18409#define const
18410#endif
18411#include <sys/types.h>
18412#include <db.h>
18413
18414#ifndef DB_VERSION_MAJOR
18415u_int32_t hash_cb (ptr, size)
18416const void *ptr;
18417size_t size;
18418{
18419}
18420HASHINFO info;
18421int main()
18422{
18423 info.hash = hash_cb;
18424}
18425#endif
18426EOCP
18427 if $cc $ccflags -c try.c >try.out 2>&1 ; then
18428 if $contains warning try.out >>/dev/null 2>&1 ; then
18429 db_hashtype='int'
18430 else
18431 db_hashtype='u_int32_t'
18432 fi
18433 else
18434 : XXX Maybe we should just give up here.
18435 db_hashtype=u_int32_t
18436 $cat try.out >&4
18437 echo "Help: I can't seem to compile the db test program." >&4
18438 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18439 fi
18440 $rm -f try.*
18441 echo "Your version of Berkeley DB uses $db_hashtype for hash."
18442 ;;
18443*) db_hashtype=u_int32_t
18444 ;;
18445esac
18446case "$i_db" in
18447define)
18448 : Check the return type needed for prefix
18449 echo " "
18450 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18451 cat >try.c <<EOCP
18452#$d_const HASCONST
18453#ifndef HASCONST
18454#define const
18455#endif
18456#include <sys/types.h>
18457#include <db.h>
18458
18459#ifndef DB_VERSION_MAJOR
18460size_t prefix_cb (key1, key2)
18461const DBT *key1;
18462const DBT *key2;
18463{
18464}
18465BTREEINFO info;
18466int main()
18467{
18468 info.prefix = prefix_cb;
18469}
18470#endif
18471EOCP
18472 if $cc $ccflags -c try.c >try.out 2>&1 ; then
18473 if $contains warning try.out >>/dev/null 2>&1 ; then
18474 db_prefixtype='int'
18475 else
18476 db_prefixtype='size_t'
18477 fi
18478 else
18479 db_prefixtype='size_t'
18480 : XXX Maybe we should just give up here.
18481 $cat try.out >&4
18482 echo "Help: I can't seem to compile the db test program." >&4
18483 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18484 fi
18485 $rm -f try.*
18486 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18487 ;;
18488*) db_prefixtype='size_t'
18489 ;;
18490esac
18491
b4eb6b3d
JH
18492
18493: How can we generate normalized random numbers ?
18494echo " "
18495echo "Looking for a random number function..." >&4
18496case "$randfunc" in
18497'')
18498 if set drand48 val -f; eval $csym; $val; then
18499 dflt="drand48"
18500 echo "Good, found drand48()." >&4
18501 elif set random val -f; eval $csym; $val; then
18502 dflt="random"
18503 echo "OK, found random()." >&4
18504 else
18505 dflt="rand"
18506 echo "Yick, looks like I have to use rand()." >&4
18507 fi
18508 echo " "
18509 ;;
18510*)
18511 dflt="$randfunc"
18512 ;;
18513esac
18514cont=true
18515
18516case "$ccflags" in
18517*-Dmy_rand=*|*-Dmy_srand=*)
18518 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18519 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18520 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18521 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18522 ;;
18523esac
18524
18525while $test "$cont"; do
18526 rp="Use which function to generate random numbers?"
18527 . ./myread
18528 if $test "$ans" = "$dflt"; then
18529 : null
18530 else
18531 randbits=''
18532 fi
18533 randfunc="$ans"
18534 if set $ans val -f; eval $csym; $val; then
18535 cont=''
18536 else
18537 dflt=y
18538 rp="I cannot find function $ans. Use that name anyway?"
18539 . ./myread
18540 dflt=rand
18541 case "$ans" in
18542 [yY]*) cont='';;
18543 esac
18544 fi
18545 case "$cont" in
18546 '')
18547 case "$randfunc" in
18548 drand48)
18549 drand01="drand48()"
18550 seedfunc="srand48"
18551 randbits=48
18552 randseedtype=long
18553 ;;
18554 rand|random)
18555 case "$randbits" in
18556 '')
18557echo "Checking to see how many bits your $randfunc() function produces..." >&4
18558 $cat >try.c <<EOCP
18559#$i_unistd I_UNISTD
18560#$i_stdlib I_STDLIB
18561#include <stdio.h>
18562#ifdef I_UNISTD
18563# include <unistd.h>
18564#endif
18565#ifdef I_STDLIB
18566# include <stdlib.h>
18567#endif
18568int main()
18569{
18570 register int i;
18571 register unsigned long tmp;
18572 register unsigned long max = 0L;
18573
18574 for (i = 1000; i; i--) {
18575 tmp = (unsigned long) $randfunc();
18576 if (tmp > max) max = tmp;
18577 }
18578 for (i = 0; max; i++)
18579 max /= 2;
18580 printf("%d\n",i);
18581}
18582EOCP
18583 set try
18584 if eval $compile_ok; then
18585 dflt=`try`
18586 else
18587 dflt='?'
18588 echo "(I can't seem to compile the test program...)"
18589 fi
18590 ;;
18591 *)
18592 dflt="$randbits"
18593 ;;
18594 esac
18595 rp="How many bits does your $randfunc() function produce?"
18596 . ./myread
18597 randbits="$ans"
18598 $rm -f try.c try
18599 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18600 seedfunc="s$randfunc"
18601 randseedtype=unsigned
18602 ;;
18603 *)
18604 dflt="31"
18605 rp="How many bits does your $randfunc() function produce?"
18606 . ./myread
18607 randbits="$ans"
18608 seedfunc="s$randfunc"
18609 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18610 if set $seedfunc val -f; eval $csym; $val; then
18611 echo "(Using $seedfunc() to seed random generator)"
18612 else
18613 echo "(Warning: no $seedfunc() to seed random generator)"
18614 seedfunc=rand
18615 fi
18616 randseedtype=unsigned
18617 ;;
18618 esac
18619 ;;
18620 esac
18621done
18622
18623echo " "
18624echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 18625$cat >try.c <<'EOM'
b4eb6b3d
JH
18626int main()
18627{
18628 if ('M'==0xd4) return 0;
18629 return 1;
18630}
18631EOM
18632
18633val=$undef
5440bc8e 18634set try
b4eb6b3d 18635if eval $compile_ok; then
5440bc8e 18636 if $run ./try; then
b4eb6b3d
JH
18637 echo "You seem to speak EBCDIC." >&4
18638 val="$define"
18639 else
5440bc8e 18640 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
18641 fi
18642else
18643 echo "I'm unable to compile the test program." >&4
18644 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18645fi
5440bc8e 18646$rm -f try try.*
b4eb6b3d
JH
18647set ebcdic
18648eval $setvar
18649
18650echo " "
18651$cat >&4 <<EOM
18652Checking how to flush all pending stdio output...
18653EOM
18654# I only know how to find the first 32 possibly open files on SunOS.
18655# See also hints/sunos_4_1.sh and util.c --AD
18656case "$osname" in
18657sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18658esac
18659$cat >>try.c <<EOCP
18660#include <stdio.h>
55954f19
JH
18661#$i_stdlib I_STDLIB
18662#ifdef I_STDLIB
18663#include <stdlib.h>
18664#endif
b4eb6b3d
JH
18665#$i_unistd I_UNISTD
18666#ifdef I_UNISTD
18667# include <unistd.h>
18668#endif
18669#$d_sysconf HAS_SYSCONF
18670#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18671#ifdef HAS_STDIO_STREAM_ARRAY
18672# define STDIO_STREAM_ARRAY $stdio_stream_array
18673#endif
18674int main() {
5440bc8e
JH
18675 FILE* p;
18676 unlink("try.out");
18677 p = fopen("try.out", "w");
b4eb6b3d
JH
18678#ifdef TRY_FPUTC
18679 fputc('x', p);
18680#else
18681# ifdef TRY_FPRINTF
18682 fprintf(p, "x");
18683# endif
18684#endif
18685#ifdef TRY_FFLUSH_NULL
18686 fflush(NULL);
18687#endif
18688#ifdef TRY_FFLUSH_ALL
18689 {
18690 long open_max = -1;
18691# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18692 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18693# else
18694# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18695 open_max = sysconf(_SC_OPEN_MAX);
18696# else
18697# ifdef FOPEN_MAX
18698 open_max = FOPEN_MAX;
18699# else
18700# ifdef OPEN_MAX
18701 open_max = OPEN_MAX;
18702# else
18703# ifdef _NFILE
18704 open_max = _NFILE;
18705# endif
18706# endif
18707# endif
18708# endif
18709# endif
18710# ifdef HAS_STDIO_STREAM_ARRAY
18711 if (open_max > 0) {
18712 long i;
18713 for (i = 0; i < open_max; i++)
18714 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18715 STDIO_STREAM_ARRAY[i]._file < open_max &&
18716 STDIO_STREAM_ARRAY[i]._flag)
18717 fflush(&STDIO_STREAM_ARRAY[i]);
18718 }
18719 }
18720# endif
18721#endif
18722 _exit(42);
18723}
18724EOCP
18725: first we have to find out how _not_ to flush
5440bc8e 18726$to try.c
b4eb6b3d
JH
18727if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18728 output=''
18729 set try -DTRY_FPUTC
18730 if eval $compile; then
fbe73d74 18731 $run ./try 2>/dev/null
28f5ac64 18732 code="$?"
5440bc8e 18733 $from try.out
28f5ac64 18734 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18735 output=-DTRY_FPUTC
18736 fi
18737 fi
18738 case "$output" in
18739 '')
18740 set try -DTRY_FPRINTF
b4eb6b3d 18741 if eval $compile; then
fbe73d74 18742 $run ./try 2>/dev/null
28f5ac64 18743 code="$?"
5440bc8e 18744 $from try.out
28f5ac64 18745 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18746 output=-DTRY_FPRINTF
18747 fi
18748 fi
18749 ;;
18750 esac
18751fi
18752: check for fflush NULL behaviour
18753case "$fflushNULL" in
18754'') set try -DTRY_FFLUSH_NULL $output
18755 if eval $compile; then
5440bc8e 18756 $run ./try 2>/dev/null
b4eb6b3d 18757 code="$?"
5440bc8e 18758 $from try.out
b4eb6b3d
JH
18759 if $test -s try.out -a "X$code" = X42; then
18760 fflushNULL="`$cat try.out`"
18761 else
18762 if $test "X$code" != X42; then
18763 $cat >&4 <<EOM
18764(If this test failed, don't worry, we'll try another method shortly.)
18765EOM
18766 fi
18767 fi
18768 fi
18769 $rm -f core try.core core.try.*
18770 case "$fflushNULL" in
18771 x) $cat >&4 <<EOM
18772Your fflush(NULL) works okay for output streams.
18773Let's see if it clobbers input pipes...
18774EOM
18775# As of mid-March 2000 all versions of Solaris appear to have a stdio
18776# bug that improperly flushes the input end of pipes. So we avoid the
18777# autoflush on fork/system/exec support for now. :-(
18778$cat >tryp.c <<EOCP
18779#include <stdio.h>
18780int
18781main(int argc, char **argv)
18782{
18783 char buf[1024];
18784 int i;
18785 char *bp = buf;
18786 while (1) {
18787 while ((i = getc(stdin)) != -1
18788 && (*bp++ = i) != '\n'
18789 && bp < &buf[1024])
18790 /* DO NOTHING */ ;
18791 *bp = '\0';
18792 fprintf(stdout, "%s", buf);
18793 fflush(NULL);
18794 if (i == -1)
18795 return 0;
18796 bp = buf;
18797 }
18798}
18799EOCP
18800 fflushNULL="$define"
18801 set tryp
18802 if eval $compile; then
18803 $rm -f tryp.out
5440bc8e 18804 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18805 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18806 $cat >&4 <<EOM
18807fflush(NULL) seems to behave okay with input streams.
18808EOM
18809 fflushNULL="$define"
18810 else
18811 $cat >&4 <<EOM
18812Ouch, fflush(NULL) clobbers input pipes! We will not use it.
18813EOM
18814 fflushNULL="$undef"
18815 fi
18816 fi
18817 $rm -f core tryp.c tryp.core core.tryp.*
18818 ;;
18819 '') $cat >&4 <<EOM
18820Your fflush(NULL) isn't working (contrary to ANSI C).
18821EOM
18822 fflushNULL="$undef"
18823 ;;
18824 *) $cat >&4 <<EOM
18825Cannot figure out whether your fflush(NULL) works or not.
18826I'm assuming it doesn't (contrary to ANSI C).
18827EOM
18828 fflushNULL="$undef"
18829 ;;
18830 esac
18831 ;;
18832$define|true|[yY]*)
18833 fflushNULL="$define"
18834 ;;
18835*)
18836 fflushNULL="$undef"
18837 ;;
18838esac
18839: check explicit looping only if NULL did not work, and if the pipe
18840: bug does not show up on an explicit flush too
18841case "$fflushNULL" in
18842"$undef")
18843 $cat >tryp.c <<EOCP
18844#include <stdio.h>
18845int
18846main(int argc, char **argv)
18847{
18848 char buf[1024];
18849 int i;
18850 char *bp = buf;
18851 while (1) {
18852 while ((i = getc(stdin)) != -1
18853 && (*bp++ = i) != '\n'
18854 && bp < &buf[1024])
18855 /* DO NOTHING */ ;
18856 *bp = '\0';
18857 fprintf(stdout, "%s", buf);
18858 fflush(stdin);
18859 if (i == -1)
18860 return 0;
18861 bp = buf;
18862 }
18863}
18864EOCP
18865 set tryp
18866 if eval $compile; then
18867 $rm -f tryp.out
5440bc8e 18868 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18869 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18870 $cat >&4 <<EOM
18871Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18872EOM
18873 : now check for fflushall behaviour
18874 case "$fflushall" in
18875 '') set try -DTRY_FFLUSH_ALL $output
18876 if eval $compile; then
18877 $cat >&4 <<EOM
18878(Now testing the other method--but note that this also may fail.)
18879EOM
5440bc8e 18880 $run ./try 2>/dev/null
28f5ac64 18881 code=$?
fbe73d74 18882 $from try.out
28f5ac64 18883 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18884 fflushall="`$cat try.out`"
18885 fi
18886 fi
18887 $rm -f core try.core core.try.*
18888 case "$fflushall" in
18889 x) $cat >&4 <<EOM
18890Whew. Flushing explicitly all the stdio streams works.
18891EOM
18892 fflushall="$define"
18893 ;;
18894 '') $cat >&4 <<EOM
18895Sigh. Flushing explicitly all the stdio streams doesn't work.
18896EOM
18897 fflushall="$undef"
18898 ;;
18899 *) $cat >&4 <<EOM
18900Cannot figure out whether flushing stdio streams explicitly works or not.
18901I'm assuming it doesn't.
18902EOM
18903 fflushall="$undef"
18904 ;;
18905 esac
18906 ;;
18907 "$define"|true|[yY]*)
18908 fflushall="$define"
18909 ;;
18910 *)
18911 fflushall="$undef"
18912 ;;
18913 esac
18914 else
18915 $cat >&4 <<EOM
18916All is futile. Even fflush(stdin) clobbers input pipes!
18917EOM
18918 fflushall="$undef"
18919 fi
18920 else
18921 fflushall="$undef"
18922 fi
18923 $rm -f core tryp.c tryp.core core.tryp.*
18924 ;;
18925*) fflushall="$undef"
18926 ;;
18927esac
18928
18929case "$fflushNULL$fflushall" in
18930undefundef)
18931 $cat <<EOM
18932OK, I give up. I cannot figure out how to flush pending stdio output.
18933We won't be flushing handles at all before fork/exec/popen.
18934EOM
18935 ;;
18936esac
18937$rm -f try.* try$exe_ext
18938
18939: Store the full pathname to the ar program for use in the C program
18940: Respect a hint or command line value for full_ar.
18941case "$full_ar" in
18942'') full_ar=$ar ;;
18943esac
18944
18945: Store the full pathname to the sed program for use in the C program
18946full_sed=$sed
18947
18948: see what type gids are declared as in the kernel
18949echo " "
18950echo "Looking for the type for group ids returned by getgid()."
18951set gid_t gidtype xxx stdio.h sys/types.h
18952eval $typedef
18953case "$gidtype" in
18954xxx)
18955 xxx=`./findhdr sys/user.h`
18956 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18957 case $1 in
18958 unsigned) dflt="$1 $2" ;;
18959 *) dflt="$1" ;;
18960 esac
18961 ;;
18962*) dflt="$gidtype";;
18963esac
18964case "$gidtype" in
18965gid_t) echo "gid_t found." ;;
18966*) rp="What is the type for group ids returned by getgid()?"
18967 . ./myread
18968 gidtype="$ans"
18969 ;;
18970esac
18971
18972echo " "
18973case "$gidtype" in
18974*_t) zzz="$gidtype" ;;
18975*) zzz="gid" ;;
18976esac
18977echo "Checking the size of $zzz..." >&4
18978cat > try.c <<EOCP
18979#include <sys/types.h>
18980#include <stdio.h>
d1daaddf
JH
18981#$i_stdlib I_STDLIB
18982#ifdef I_STDLIB
18983#include <stdlib.h>
18984#endif
b4eb6b3d
JH
18985int main() {
18986 printf("%d\n", (int)sizeof($gidtype));
18987 exit(0);
18988}
18989EOCP
18990set try
18991if eval $compile_ok; then
5440bc8e 18992 yyy=`$run ./try`
b4eb6b3d
JH
18993 case "$yyy" in
18994 '') gidsize=4
18995 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18996 ;;
18997 *) gidsize=$yyy
18998 echo "Your $zzz is $gidsize bytes long."
18999 ;;
19000 esac
19001else
19002 gidsize=4
19003 echo "(I can't compile the test program--guessing $gidsize.)" >&4
19004fi
19005
19006
19007echo " "
19008case "$gidtype" in
19009*_t) zzz="$gidtype" ;;
19010*) zzz="gid" ;;
19011esac
19012echo "Checking the sign of $zzz..." >&4
19013cat > try.c <<EOCP
19014#include <sys/types.h>
19015#include <stdio.h>
19016int main() {
19017 $gidtype foo = -1;
19018 if (foo < 0)
19019 printf("-1\n");
19020 else
19021 printf("1\n");
19022}
19023EOCP
19024set try
19025if eval $compile; then
5440bc8e 19026 yyy=`$run ./try`
b4eb6b3d
JH
19027 case "$yyy" in
19028 '') gidsign=1
19029 echo "(I can't execute the test program--guessing unsigned.)" >&4
19030 ;;
19031 *) gidsign=$yyy
19032 case "$gidsign" in
19033 1) echo "Your $zzz is unsigned." ;;
19034 -1) echo "Your $zzz is signed." ;;
19035 esac
19036 ;;
19037 esac
19038else
19039 gidsign=1
19040 echo "(I can't compile the test program--guessing unsigned.)" >&4
19041fi
19042
19043
19044echo " "
19045
19046if $test X"$quadtype" != X; then
19047
19048echo "Checking how to print 64-bit integers..." >&4
19049
19050if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19051 $cat >try.c <<'EOCP'
19052#include <sys/types.h>
19053#include <stdio.h>
19054int main() {
19055 int q = 12345678901;
19056 printf("%ld\n", q);
19057}
19058EOCP
19059 set try
19060 if eval $compile; then
5440bc8e 19061 yyy=`$run ./try`
b4eb6b3d
JH
19062 case "$yyy" in
19063 12345678901)
19064 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19065 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19066 echo "We will use %d."
19067 ;;
19068 esac
19069 fi
19070fi
19071
19072if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19073 $cat >try.c <<'EOCP'
19074#include <sys/types.h>
19075#include <stdio.h>
19076int main() {
19077 long q = 12345678901;
19078 printf("%ld\n", q);
19079}
19080EOCP
19081 set try
19082 if eval $compile; then
5440bc8e 19083 yyy=`$run ./try`
b4eb6b3d
JH
19084 case "$yyy" in
19085 12345678901)
19086 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19087 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19088 echo "We will use %ld."
19089 ;;
19090 esac
19091 fi
19092fi
19093
19094if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19095 $cat >try.c <<'EOCP'
19096#include <sys/types.h>
19097#include <inttypes.h>
19098#include <stdio.h>
19099int main() {
19100 int64_t q = 12345678901;
19101 printf("%" PRId64 "\n", q);
19102}
19103EOCP
19104 set try
19105 if eval $compile; then
5440bc8e 19106 yyy=`$run ./try`
b4eb6b3d
JH
19107 case "$yyy" in
19108 12345678901)
19109 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19110 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19111 echo "We will use the C9X style."
19112 ;;
19113 esac
19114 fi
19115fi
19116
2ef53570
JH
19117if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19118 $cat >try.c <<EOCP
b4eb6b3d
JH
19119#include <sys/types.h>
19120#include <stdio.h>
19121int main() {
2ef53570
JH
19122 $quadtype q = 12345678901;
19123 printf("%Ld\n", q);
b4eb6b3d
JH
19124}
19125EOCP
19126 set try
19127 if eval $compile; then
5440bc8e 19128 yyy=`$run ./try`
b4eb6b3d
JH
19129 case "$yyy" in
19130 12345678901)
2ef53570
JH
19131 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19132 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19133 echo "We will use %Ld."
b4eb6b3d
JH
19134 ;;
19135 esac
19136 fi
19137fi
19138
2ef53570
JH
19139if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19140 $cat >try.c <<'EOCP'
b4eb6b3d
JH
19141#include <sys/types.h>
19142#include <stdio.h>
19143int main() {
2ef53570
JH
19144 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19145 printf("%lld\n", q);
b4eb6b3d
JH
19146}
19147EOCP
19148 set try
19149 if eval $compile; then
5440bc8e 19150 yyy=`$run ./try`
b4eb6b3d
JH
19151 case "$yyy" in
19152 12345678901)
2ef53570
JH
19153 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19154 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19155 echo "We will use the %lld style."
b4eb6b3d
JH
19156 ;;
19157 esac
19158 fi
19159fi
19160
19161if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19162 $cat >try.c <<EOCP
19163#include <sys/types.h>
19164#include <stdio.h>
19165int main() {
19166 $quadtype q = 12345678901;
19167 printf("%qd\n", q);
19168}
19169EOCP
19170 set try
19171 if eval $compile; then
5440bc8e 19172 yyy=`$run ./try`
b4eb6b3d
JH
19173 case "$yyy" in
19174 12345678901)
19175 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19176 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19177 echo "We will use %qd."
19178 ;;
19179 esac
19180 fi
19181fi
19182
19183if $test X"$sPRId64" = X; then
19184 echo "Cannot figure out how to print 64-bit integers." >&4
19185fi
19186
19187$rm -f try try.*
19188
19189fi
19190
19191case "$sPRId64" in
19192'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19193 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19194 ;;
19195*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19196 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19197 ;;
19198esac
19199
19200
19201echo " "
19202$echo "Checking the format strings to be used for Perl's internal types..." >&4
19203
19204if $test X"$ivsize" = X8; then
19205 ivdformat="$sPRId64"
19206 uvuformat="$sPRIu64"
19207 uvoformat="$sPRIo64"
19208 uvxformat="$sPRIx64"
19209 uvXUformat="$sPRIXU64"
19210else
19211 if $test X"$ivsize" = X"$longsize"; then
19212 ivdformat='"ld"'
19213 uvuformat='"lu"'
19214 uvoformat='"lo"'
19215 uvxformat='"lx"'
19216 uvXUformat='"lX"'
19217 else
19218 if $test X"$ivsize" = X"$intsize"; then
19219 ivdformat='"d"'
19220 uvuformat='"u"'
19221 uvoformat='"o"'
19222 uvxformat='"x"'
19223 uvXUformat='"X"'
19224 else
19225 : far out
19226 if $test X"$ivsize" = X"$shortsize"; then
19227 ivdformat='"hd"'
19228 uvuformat='"hu"'
19229 uvoformat='"ho"'
19230 uvxformat='"hx"'
19231 uvXUformat='"hX"'
19232 fi
19233 fi
19234 fi
19235fi
19236
19237if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19238 nveformat="$sPRIeldbl"
19239 nvfformat="$sPRIfldbl"
19240 nvgformat="$sPRIgldbl"
19241 nvEUformat="$sPRIEUldbl"
19242 nvFUformat="$sPRIFUldbl"
19243 nvGUformat="$sPRIGUldbl"
19244else
19245 nveformat='"e"'
19246 nvfformat='"f"'
19247 nvgformat='"g"'
19248 nvEUformat='"E"'
19249 nvFUformat='"F"'
19250 nvGUformat='"G"'
19251fi
19252
19253case "$ivdformat" in
3c728e00 19254'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
19255 exit 1
19256 ;;
19257esac
19258
19259
19260echo " "
19261$echo "Checking the format string to be used for gids..." >&4
19262
19263case "$gidsign" in
19264-1) if $test X"$gidsize" = X"$ivsize"; then
19265 gidformat="$ivdformat"
19266 else
19267 if $test X"$gidsize" = X"$longsize"; then
19268 gidformat='"ld"'
19269 else
19270 if $test X"$gidsize" = X"$intsize"; then
19271 gidformat='"d"'
19272 else
19273 if $test X"$gidsize" = X"$shortsize"; then
19274 gidformat='"hd"'
19275 fi
19276 fi
19277 fi
19278 fi
19279 ;;
19280*) if $test X"$gidsize" = X"$uvsize"; then
19281 gidformat="$uvuformat"
19282 else
19283 if $test X"$gidsize" = X"$longsize"; then
19284 gidformat='"lu"'
19285 else
19286 if $test X"$gidsize" = X"$intsize"; then
19287 gidformat='"u"'
19288 else
19289 if $test X"$gidsize" = X"$shortsize"; then
19290 gidformat='"hu"'
19291 fi
19292 fi
19293 fi
19294 fi
19295 ;;
19296esac
19297
19298: see if getgroups exists
19299set getgroups d_getgrps
19300eval $inlibc
19301
19302: see if setgroups exists
19303set setgroups d_setgrps
19304eval $inlibc
19305
19306
19307: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19308echo " "
19309case "$d_getgrps$d_setgrps" in
19310*define*)
19311 case "$groupstype" in
19312 '') dflt="$gidtype" ;;
19313 *) dflt="$groupstype" ;;
19314 esac
19315 $cat <<EOM
19316What type of pointer is the second argument to getgroups() and setgroups()?
19317Usually this is the same as group ids, $gidtype, but not always.
19318
19319EOM
19320 rp='What type pointer is the second argument to getgroups() and setgroups()?'
19321 . ./myread
19322 groupstype="$ans"
19323 ;;
19324*) groupstype="$gidtype";;
19325esac
19326
d620c7b3 19327
fd655d33
NC
19328if $test $patchlevel -lt 9; then
19329: MAD is not available in 5.8.x or earlier.
19330 ans=n;
19331else
19332 case "$mad" in
19333 $define|true|[yY]*) dflt='y' ;;
19334 *) dflt='n' ;;
19335 esac
19336 cat <<EOM
d620c7b3
MB
19337
19338Would you like to build with Misc Attribute Decoration? This is development
19339work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19340overhead on the interpreter.
19341
19342If this doesn't make any sense to you, just accept the default '$dflt'.
19343EOM
fd655d33
NC
19344 rp='Build Perl with MAD?'
19345 . ./myread
19346fi
d620c7b3 19347case "$ans" in
00e74f14
NC
19348y|Y) val="$define"
19349 madlyh='madly.h madly.act madly.tab'
19350 madlysrc='madly.c'
19351 madlyobj="madly$_o" ;;
19352*) val="$undef"
19353 madlyh=''
19354 madlysrc=''
19355 madlyobj='' ;;
d620c7b3
MB
19356esac
19357set mad
19358eval $setvar
19359
b4eb6b3d
JH
19360echo " "
19361echo "Checking if your $make program sets \$(MAKE)..." >&4
19362case "$make_set_make" in
19363'')
19364 $sed 's/^X //' > testmake.mak << 'EOF'
19365Xall:
19366X @echo 'maketemp="$(MAKE)"'
19367EOF
19368 case "`$make -f testmake.mak 2>/dev/null`" in
19369 *maketemp=*) make_set_make='#' ;;
19370 *) make_set_make="MAKE=$make" ;;
19371 esac
19372 $rm -f testmake.mak
19373 ;;
19374esac
19375case "$make_set_make" in
19376'#') echo "Yup, it does.";;
19377*) echo "Nope, it doesn't.";;
19378esac
19379
19380: see what type is used for mode_t
19381rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19382set mode_t modetype int stdio.h sys/types.h
19383eval $typedef_ask
19384
2cc61e15
DD
19385: see if we need va_copy
19386echo " "
19387case "$i_stdarg" in
19388"$define")
19389 $cat >try.c <<EOCP
19390#include <stdarg.h>
19391#include <stdio.h>
85c8a686
DD
19392#$i_stdlib I_STDLIB
19393#ifdef I_STDLIB
19394#include <stdlib.h>
19395#endif
19396#include <signal.h>
2cc61e15
DD
19397
19398int
19399ivfprintf(FILE *f, const char *fmt, va_list *valp)
19400{
19401 return vfprintf(f, fmt, *valp);
19402}
19403
19404int
19405myvfprintf(FILE *f, const char *fmt, va_list val)
19406{
19407 return ivfprintf(f, fmt, &val);
19408}
19409
19410int
19411myprintf(char *fmt, ...)
19412{
19413 va_list val;
19414 va_start(val, fmt);
19415 return myvfprintf(stdout, fmt, val);
19416}
19417
19418int
19419main(int ac, char **av)
19420{
85c8a686
DD
19421 signal(SIGSEGV, exit);
19422
2cc61e15
DD
19423 myprintf("%s%cs all right, then\n", "that", '\'');
19424 exit(0);
19425}
19426EOCP
19427 set try
5440bc8e
JH
19428 if eval $compile && $run ./try 2>&1 >/dev/null; then
19429 case "`$run ./try`" in
2cc61e15
DD
19430 "that's all right, then")
19431 okay=yes
19432 ;;
19433 esac
19434 fi
19435 case "$okay" in
19436 yes) echo "It seems that you don't need va_copy()." >&4
19437 need_va_copy="$undef"
19438 ;;
19439 *) echo "It seems that va_copy() or similar will be needed." >&4
19440 need_va_copy="$define"
19441 ;;
19442 esac
19443 $rm -f try.* core core.* *.core *.core.*
19444 ;;
19445*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19446 ;;
19447esac
19448
b4eb6b3d
JH
19449: see what type is used for size_t
19450rp="What is the type used for the length parameter for string functions?"
19451set size_t sizetype 'unsigned int' stdio.h sys/types.h
19452eval $typedef_ask
19453
19454: check for type of arguments to gethostbyaddr.
19455if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19456 case "$d_gethbyaddr" in
19457 $define)
19458 $cat <<EOM
19459
19460Checking to see what type of arguments are accepted by gethostbyaddr().
19461EOM
19462 hdrs="$define sys/types.h
19463 $d_socket sys/socket.h
19464 $i_niin netinet/in.h
19465 $i_netdb netdb.h
19466 $i_unistd unistd.h"
19467 : The first arg can 'char *' or 'void *'
19468 : The second arg is some of integral type
19469 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19470 for yyy in size_t long int; do
19471 case "$netdb_host_type" in
19472 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19473 if ./protochk "$try" $hdrs; then
19474 echo "Your system accepts $xxx for the first arg."
19475 echo "...and $yyy for the second arg."
19476 netdb_host_type="$xxx"
19477 netdb_hlen_type="$yyy"
19478 fi
19479 ;;
19480 esac
19481 done
19482 done
19483 : In case none of those worked, prompt the user.
19484 case "$netdb_host_type" in
19485 '') rp='What is the type for the 1st argument to gethostbyaddr?'
19486 dflt='char *'
19487 . ./myread
19488 netdb_host_type=$ans
19489 rp='What is the type for the 2nd argument to gethostbyaddr?'
19490 dflt="$sizetype"
19491 . ./myread
19492 netdb_hlen_type=$ans
19493 ;;
19494 esac
19495 ;;
19496 *) : no gethostbyaddr, so pick harmless defaults
19497 netdb_host_type='char *'
19498 netdb_hlen_type="$sizetype"
19499 ;;
19500 esac
19501 # Remove the "const" if needed. -- but then we'll have a
19502 # prototype clash!
19503 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19504fi
19505
19506: check for type of argument to gethostbyname.
19507if test "X$netdb_name_type" = X ; then
19508 case "$d_gethbyname" in
19509 $define)
19510 $cat <<EOM
19511
19512Checking to see what type of argument is accepted by gethostbyname().
19513EOM
19514 hdrs="$define sys/types.h
19515 $d_socket sys/socket.h
19516 $i_niin netinet/in.h
19517 $i_netdb netdb.h
19518 $i_unistd unistd.h"
19519 for xxx in "const char *" "char *"; do
19520 case "$netdb_name_type" in
19521 '') try="extern struct hostent *gethostbyname($xxx);"
19522 if ./protochk "$try" $hdrs; then
19523 echo "Your system accepts $xxx."
19524 netdb_name_type="$xxx"
19525 fi
19526 ;;
19527 esac
19528 done
19529 : In case none of those worked, prompt the user.
19530 case "$netdb_name_type" in
19531 '') rp='What is the type for the 1st argument to gethostbyname?'
19532 dflt='char *'
19533 . ./myread
19534 netdb_name_type=$ans
19535 ;;
19536 esac
19537 ;;
19538 *) : no gethostbyname, so pick harmless default
19539 netdb_name_type='char *'
19540 ;;
19541 esac
19542fi
19543
19544: check for type of 1st argument to getnetbyaddr.
19545if test "X$netdb_net_type" = X ; then
19546 case "$d_getnbyaddr" in
19547 $define)
19548 $cat <<EOM
19549
19550Checking to see what type of 1st argument is accepted by getnetbyaddr().
19551EOM
19552 hdrs="$define sys/types.h
19553 $d_socket sys/socket.h
19554 $i_niin netinet/in.h
19555 $i_netdb netdb.h
19556 $i_unistd unistd.h"
19557 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19558 case "$netdb_net_type" in
19559 '') try="extern struct netent *getnetbyaddr($xxx, int);"
19560 if ./protochk "$try" $hdrs; then
19561 echo "Your system accepts $xxx."
19562 netdb_net_type="$xxx"
19563 fi
19564 ;;
19565 esac
19566 done
19567 : In case none of those worked, prompt the user.
19568 case "$netdb_net_type" in
19569 '') rp='What is the type for the 1st argument to getnetbyaddr?'
19570 dflt='long'
19571 . ./myread
19572 netdb_net_type=$ans
19573 ;;
19574 esac
19575 ;;
19576 *) : no getnetbyaddr, so pick harmless default
19577 netdb_net_type='long'
19578 ;;
19579 esac
19580fi
19581: locate the preferred pager for this system
d604bb53 19582fn=f/
b4eb6b3d
JH
19583case "$pager" in
19584'')
19585 dflt=''
19586 case "$pg" in
19587 /*) dflt=$pg;;
19588 [a-zA-Z]:/*) dflt=$pg;;
19589 esac
19590 case "$more" in
19591 /*) dflt=$more;;
19592 [a-zA-Z]:/*) dflt=$more;;
19593 esac
19594 case "$less" in
19595 /*) dflt=$less;;
19596 [a-zA-Z]:/*) dflt=$less;;
19597 esac
19598 case "$dflt" in
19599 '') dflt=/usr/ucb/more;;
19600 esac
19601 ;;
d604bb53
JH
19602*) dflt="$pager"
19603 : Instruct ./getfile to trust the hinted or previous pager value,
19604 : even if it does not begin with a slash. For example, on os2,
19605 : pager might be cmd /c more. See comments in UU/getfile.
19606 fn="f/($pager)"
19607 ;;
b4eb6b3d
JH
19608esac
19609echo " "
b4eb6b3d
JH
19610rp='What pager is used on your system?'
19611. ./getfile
19612pager="$ans"
19613
19614: see what type pids are declared as in the kernel
19615rp="What is the type of process ids on this system?"
19616set pid_t pidtype int stdio.h sys/types.h
19617eval $typedef_ask
19618
b4eb6b3d
JH
19619: see if ar generates random libraries by itself
19620echo " "
19621echo "Checking how to generate random libraries on your machine..." >&4
19622echo 'int bar1() { return bar2(); }' > bar1.c
19623echo 'int bar2() { return 2; }' > bar2.c
55954f19
JH
19624$cat > foo.c <<EOP
19625#$i_stdlib I_STDLIB
19626#ifdef I_STDLIB
19627#include <stdlib.h>
19628#endif
b4eb6b3d
JH
19629int main() { printf("%d\n", bar1()); exit(0); }
19630EOP
19631$cc $ccflags -c bar1.c >/dev/null 2>&1
19632$cc $ccflags -c bar2.c >/dev/null 2>&1
19633$cc $ccflags -c foo.c >/dev/null 2>&1
19634$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 19635if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19636 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19637 echo "$ar appears to generate random libraries itself."
19638 orderlib=false
e39a9d84
LC
19639 if [ "X$ranlib" = "X" ]; then
19640 ranlib=":"
19641 fi
88d4d47b
PC
19642elif $ar s bar$_a >/dev/null 2>&1 &&
19643 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19644 $run ./foobar >/dev/null 2>&1; then
19645 echo "a table of contents needs to be added with '$ar s'."
19646 orderlib=false
19647 ranlib="$ar s"
b4eb6b3d 19648elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 19649 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19650 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19651 echo "a table of contents needs to be added with '$ar ts'."
19652 orderlib=false
19653 ranlib="$ar ts"
19654else
19655 case "$ranlib" in
19656 :) ranlib='';;
19657 '')
19658 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19659 $test -f $ranlib || ranlib=''
19660 ;;
19661 esac
19662 if $test -n "$ranlib"; then
19663 echo "your system has '$ranlib'; we'll use that."
19664 orderlib=false
19665 else
19666 echo "your system doesn't seem to support random libraries"
19667 echo "so we'll use lorder and tsort to order the libraries."
19668 orderlib=true
19669 ranlib=":"
19670 fi
19671fi
88d4d47b 19672$rm -f foo* bar*
b4eb6b3d
JH
19673
19674: check for type of arguments to select.
19675case "$selecttype" in
19676'') case "$d_select" in
19677 $define)
19678 echo " "
19679 $cat <<EOM
19680Checking to see what type of arguments are accepted by select().
19681EOM
19682 hdrs="$define sys/types.h
19683 $i_systime sys/time.h
19684 $i_sysselct sys/select.h
19685 $d_socket sys/socket.h"
19686 : The first arg can be int, unsigned, or size_t
19687 : The last arg may or may not be 'const'
19688 val=''
19689 : void pointer has been seen but using that
19690 : breaks the selectminbits test
19691 for xxx in 'fd_set *' 'int *'; do
19692 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19693 for tmo in 'struct timeval *' 'const struct timeval *'; do
19694 case "$val" in
19695 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19696 if ./protochk "$try" $hdrs; then
19697 echo "Your system accepts $xxx."
19698 val="$xxx"
19699 fi
19700 ;;
19701 esac
19702 done
19703 done
19704 done
19705 case "$val" in
19706 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19707 case "$d_fd_set" in
19708 $define) dflt="fd_set *" ;;
19709 *) dflt="int *" ;;
19710 esac
19711 . ./myread
19712 val=$ans
19713 ;;
19714 esac
19715 selecttype="$val"
19716 ;;
19717 *) : no select, so pick a harmless default
19718 selecttype='int *'
19719 ;;
19720 esac
19721 ;;
19722esac
19723
19724: check for the select 'width'
19725case "$selectminbits" in
e6e7e605
JH
19726'') safebits=`expr $ptrsize \* 8`
19727 case "$d_select" in
b4eb6b3d
JH
19728 $define)
19729 $cat <<EOM
19730
19731Checking to see on how many bits at a time your select() operates...
19732EOM
19733 $cat >try.c <<EOCP
19734#include <sys/types.h>
19735#$i_time I_TIME
19736#$i_systime I_SYS_TIME
19737#$i_systimek I_SYS_TIME_KERNEL
19738#ifdef I_TIME
19739# include <time.h>
19740#endif
19741#ifdef I_SYS_TIME
19742# ifdef I_SYS_TIME_KERNEL
19743# define KERNEL
19744# endif
19745# include <sys/time.h>
19746# ifdef I_SYS_TIME_KERNEL
19747# undef KERNEL
19748# endif
19749#endif
19750#$i_sysselct I_SYS_SELECT
19751#ifdef I_SYS_SELECT
19752#include <sys/select.h>
19753#endif
19754#$d_socket HAS_SOCKET
19755#ifdef HAS_SOCKET
19756# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19757#endif
19758#include <stdio.h>
d1daaddf
JH
19759#$i_stdlib I_STDLIB
19760#ifdef I_STDLIB
19761#include <stdlib.h>
19762#endif
b4eb6b3d
JH
19763$selecttype b;
19764#define S sizeof(*(b))
19765#define MINBITS 64
19766#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19767#define NBITS (NBYTES * 8)
19768int main() {
7090f861 19769 char *s = (char *)malloc(NBYTES);
b4eb6b3d
JH
19770 struct timeval t;
19771 int i;
19772 FILE* fp;
19773 int fd;
19774
e6e7e605
JH
19775 if (!s)
19776 exit(1);
b4eb6b3d
JH
19777 fclose(stdin);
19778 fp = fopen("try.c", "r");
19779 if (fp == 0)
e6e7e605 19780 exit(2);
b4eb6b3d
JH
19781 fd = fileno(fp);
19782 if (fd < 0)
e6e7e605 19783 exit(3);
b4eb6b3d
JH
19784 b = ($selecttype)s;
19785 for (i = 0; i < NBITS; i++)
19786 FD_SET(i, b);
19787 t.tv_sec = 0;
19788 t.tv_usec = 0;
19789 select(fd + 1, b, 0, 0, &t);
19790 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
e6e7e605 19791 free(s);
b4eb6b3d
JH
19792 printf("%d\n", i + 1);
19793 return 0;
19794}
19795EOCP
19796 set try
19797 if eval $compile_ok; then
5440bc8e 19798 selectminbits=`$run ./try`
b4eb6b3d
JH
19799 case "$selectminbits" in
19800 '') cat >&4 <<EOM
19801Cannot figure out on how many bits at a time your select() operates.
e6e7e605 19802I'll play safe and guess it is $safebits bits.
b4eb6b3d 19803EOM
e6e7e605
JH
19804 selectminbits=$safebits
19805 bits="$safebits bits"
b4eb6b3d
JH
19806 ;;
19807 1) bits="1 bit" ;;
19808 *) bits="$selectminbits bits" ;;
19809 esac
19810 echo "Your select() operates on $bits at a time." >&4
19811 else
19812 rp='What is the minimum number of bits your select() operates on?'
19813 case "$byteorder" in
e6e7e605
JH
19814 12345678) dflt=64 ;;
19815 1234) dflt=32 ;;
b4eb6b3d
JH
19816 *) dflt=1 ;;
19817 esac
19818 . ./myread
19819 val=$ans
19820 selectminbits="$val"
19821 fi
19822 $rm -f try.* try
19823 ;;
19824 *) : no select, so pick a harmless default
e6e7e605 19825 selectminbits=$safebits
b4eb6b3d
JH
19826 ;;
19827 esac
19828 ;;
19829esac
19830
19831: Trace out the files included by signal.h, then look for SIGxxx names.
19832: Remove SIGARRAYSIZE used by HPUX.
19833: Remove SIGSTKSIZE used by Linux.
19834: Remove SIGSTKSZ used by Posix.
19835: Remove SIGTYP void lines used by OS2.
19836: Some cpps, like os390, dont give the file name anywhere
19837if [ "X$fieldn" = X ]; then
19838 : Just make some guesses. We check them later.
19839 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19840else
19841 xxx=`echo '#include <signal.h>' |
19842 $cppstdin $cppminus $cppflags 2>/dev/null |
19843 $grep '^[ ]*#.*include' |
a938a3bb 19844 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
19845fi
19846: Check this list of files to be sure we have parsed the cpp output ok.
19847: This will also avoid potentially non-existent files, such
19848: as ../foo/bar.h
19849xxxfiles=''
19850for xx in $xxx /dev/null ; do
19851 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19852done
19853: If we have found no files, at least try signal.h
19854case "$xxxfiles" in
19855'') xxxfiles=`./findhdr signal.h` ;;
19856esac
19857xxx=`awk '
19858$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19859 print substr($2, 4, 20)
19860}
19861$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19862 print substr($3, 4, 20)
19863}' $xxxfiles`
19864: Append some common names just in case the awk scan failed.
19865xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19866xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19867xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19868xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19869xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19870
19871: generate a few handy files for later
55954f19 19872$cat > signal.c <<EOCP
b4eb6b3d
JH
19873#include <sys/types.h>
19874#include <signal.h>
55954f19
JH
19875#$i_stdlib I_STDLIB
19876#ifdef I_STDLIB
19877#include <stdlib.h>
19878#endif
b4eb6b3d
JH
19879#include <stdio.h>
19880int main() {
19881
19882/* Strange style to avoid deeply-nested #if/#else/#endif */
19883#ifndef NSIG
19884# ifdef _NSIG
19885# define NSIG (_NSIG)
19886# endif
19887#endif
19888
19889#ifndef NSIG
19890# ifdef SIGMAX
19891# define NSIG (SIGMAX+1)
19892# endif
19893#endif
19894
19895#ifndef NSIG
19896# ifdef SIG_MAX
19897# define NSIG (SIG_MAX+1)
19898# endif
19899#endif
19900
19901#ifndef NSIG
3609ea0d
JH
19902# ifdef _SIG_MAX
19903# define NSIG (_SIG_MAX+1)
19904# endif
19905#endif
19906
19907#ifndef NSIG
b4eb6b3d
JH
19908# ifdef MAXSIG
19909# define NSIG (MAXSIG+1)
19910# endif
19911#endif
19912
19913#ifndef NSIG
19914# ifdef MAX_SIG
19915# define NSIG (MAX_SIG+1)
19916# endif
19917#endif
19918
19919#ifndef NSIG
19920# ifdef SIGARRAYSIZE
3609ea0d 19921# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
b4eb6b3d
JH
19922# endif
19923#endif
19924
19925#ifndef NSIG
19926# ifdef _sys_nsig
19927# define NSIG (_sys_nsig) /* Solaris 2.5 */
19928# endif
19929#endif
19930
19931/* Default to some arbitrary number that's big enough to get most
19932 of the common signals.
19933*/
19934#ifndef NSIG
19935# define NSIG 50
19936#endif
19937
19938printf("NSIG %d\n", NSIG);
19939
19940#ifndef JUST_NSIG
19941
19942EOCP
19943
19944echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19945{
19946 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 19947 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
19948 printf $1; printf ");\n"
19949 printf "#endif\n"
19950}
19951END {
19952 printf "#endif /* JUST_NSIG */\n";
19953 printf "exit(0);\n}\n";
19954}
19955' >>signal.c
19956$cat >signal.awk <<'EOP'
19957BEGIN { ndups = 0 }
65197d93 19958$1 ~ /^NSIG$/ { nsig = $2 }
1ebe1ffb 19959($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
19960 if ($2 > maxsig) { maxsig = $2 }
19961 if (sig_name[$2]) {
19962 dup_name[ndups] = $1
19963 dup_num[ndups] = $2
b4eb6b3d
JH
19964 ndups++
19965 }
1ebe1ffb 19966 else {
65197d93
JH
19967 sig_name[$2] = $1
19968 sig_num[$2] = $2
b4eb6b3d
JH
19969 }
19970}
19971END {
19972 if (nsig == 0) {
19973 nsig = maxsig + 1
19974 }
19975 printf("NSIG %d\n", nsig);
19976 for (n = 1; n < nsig; n++) {
19977 if (sig_name[n]) {
19978 printf("%s %d\n", sig_name[n], sig_num[n])
19979 }
19980 else {
19981 printf("NUM%d %d\n", n, n)
19982 }
19983 }
19984 for (n = 0; n < ndups; n++) {
19985 printf("%s %d\n", dup_name[n], dup_num[n])
19986 }
19987}
19988EOP
19989$cat >signal_cmd <<EOS
19990$startsh
19991if $test -s signal.lst; then
19992 echo "Using your existing signal.lst file"
19993 exit 0
19994fi
19995xxx="$xxx"
19996EOS
19997$cat >>signal_cmd <<'EOS'
19998
19999set signal
20000if eval $compile_ok; then
1eb9ad5b 20001 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20002else
20003 echo "(I can't seem be able to compile the whole test program)" >&4
20004 echo "(I'll try it in little pieces.)" >&4
20005 set signal -DJUST_NSIG
20006 if eval $compile_ok; then
5440bc8e 20007 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
20008 $cat signal.nsg
20009 else
20010 echo "I can't seem to figure out how many signals you have." >&4
20011 echo "Guessing 50." >&4
20012 echo 'NSIG 50' > signal.nsg
20013 fi
20014 : Now look at all the signal names, one at a time.
20015 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20016 $cat > signal.c <<EOCP
20017#include <sys/types.h>
20018#include <signal.h>
20019#include <stdio.h>
20020int main() {
20021printf("$xx %d\n", SIG${xx});
20022return 0;
20023}
20024EOCP
20025 set signal
20026 if eval $compile; then
20027 echo "SIG${xx} found."
5440bc8e 20028 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
20029 else
20030 echo "SIG${xx} NOT found."
20031 fi
20032 done
20033 if $test -s signal.ls1; then
20034 $cat signal.nsg signal.ls1 |
65197d93 20035 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20036 fi
20037
20038fi
20039if $test -s signal.lst; then
20040 :
20041else
20042 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20043 echo 'kill -l' >signal
20044 set X `csh -f <signal`
20045 $rm -f signal
20046 shift
20047 case $# in
20048 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20049 esac
20050 echo $@ | $tr ' ' $trnl | \
20051 $awk '{ printf "%s %d\n", $1, ++s; }
20052 END { printf "NSIG %d\n", ++s }' >signal.lst
20053fi
20054$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20055EOS
20056chmod a+x signal_cmd
20057$eunicefix signal_cmd
20058
20059: generate list of signal names
20060echo " "
20061case "$sig_name_init" in
20062'') doinit=yes ;;
20063*) case "$sig_num_init" in
20064 ''|*,*) doinit=yes ;;
20065 esac ;;
20066esac
20067case "$doinit" in
20068yes)
20069 echo "Generating a list of signal names and numbers..." >&4
20070 . ./signal_cmd
20071 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20072 sig_name=`$awk 'BEGIN { printf "ZERO " }
20073 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20074 sig_num=`$awk 'BEGIN { printf "0 " }
20075 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20076 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
20077 !/^NSIG/ { printf "\"%s\", ", $1 }
20078 END { printf "0\n" }' signal.lst`
20079 sig_num_init=`$awk 'BEGIN { printf "0, " }
20080 !/^NSIG/ { printf "%d, ", $2}
20081 END { printf "0\n"}' signal.lst`
20082 ;;
20083esac
20084echo "The following $sig_count signals are available:"
20085echo " "
20086echo $sig_name | $awk \
20087'BEGIN { linelen = 0 }
20088{
20089 for (i = 1; i <= NF; i++) {
20090 name = "SIG" $i " "
20091 linelen = linelen + length(name)
20092 if (linelen > 70) {
20093 printf "\n"
20094 linelen = length(name)
20095 }
20096 printf "%s", name
20097 }
20098 printf "\n"
20099}'
76d3c696 20100sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
20101$rm -f signal signal.c signal.awk signal.lst signal_cmd
20102
20103echo " "
20104case "$sizetype" in
20105*_t) zzz="$sizetype" ;;
20106*) zzz="filesize" ;;
20107esac
20108echo "Checking the size of $zzz..." >&4
20109cat > try.c <<EOCP
20110#include <sys/types.h>
20111#include <stdio.h>
d1daaddf
JH
20112#$i_stdlib I_STDLIB
20113#ifdef I_STDLIB
20114#include <stdlib.h>
20115#endif
b4eb6b3d
JH
20116int main() {
20117 printf("%d\n", (int)sizeof($sizetype));
20118 exit(0);
20119}
20120EOCP
20121set try
20122if eval $compile_ok; then
5440bc8e 20123 yyy=`$run ./try`
b4eb6b3d
JH
20124 case "$yyy" in
20125 '') sizesize=4
20126 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20127 ;;
20128 *) sizesize=$yyy
20129 echo "Your $zzz size is $sizesize bytes."
20130 ;;
20131 esac
20132else
20133 sizesize=4
20134 echo "(I can't compile the test program--guessing $sizesize.)" >&4
20135fi
20136
20137
20138: check for socklen_t
20139echo " "
20140echo "Checking to see if you have socklen_t..." >&4
20141$cat >try.c <<EOCP
20142#include <sys/types.h>
20143#$d_socket HAS_SOCKET
20144#ifdef HAS_SOCKET
20145#include <sys/socket.h>
20146#endif
20147int main() { socklen_t x = 16; }
20148EOCP
20149set try
20150if eval $compile; then
20151 val="$define"
20152 echo "You have socklen_t."
20153else
20154 val="$undef"
20155 echo "You do not have socklen_t."
20156 case "$sizetype" in
20157 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20158 esac
20159fi
20160$rm -f try try.*
20161set d_socklen_t
20162eval $setvar
20163
a7710f8d
JH
20164: see if this is a socks.h system
20165set socks.h i_socks
20166eval $inhdr
20167
b4eb6b3d
JH
20168: check for type of the size argument to socket calls
20169case "$d_socket" in
20170"$define")
20171 $cat <<EOM
20172
20173Checking to see what type is the last argument of accept().
20174EOM
b4eb6b3d
JH
20175 yyy=''
20176 case "$d_socklen_t" in
20177 "$define") yyy="$yyy socklen_t"
20178 esac
20179 yyy="$yyy $sizetype int long unsigned"
20180 for xxx in $yyy; do
20181 case "$socksizetype" in
20182 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
20183 case "$usesocks" in
20184 "$define")
20185 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20186 echo "Your system accepts '$xxx *' for the last argument of accept()."
20187 socksizetype="$xxx"
20188 fi
20189 ;;
20190 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
20191 echo "Your system accepts '$xxx *' for the last argument of accept()."
20192 socksizetype="$xxx"
20193 fi
20194 ;;
20195 esac
b4eb6b3d
JH
20196 ;;
20197 esac
20198 done
20199: In case none of those worked, prompt the user.
20200 case "$socksizetype" in
20201 '') rp='What is the type for socket address structure sizes?'
20202 dflt='int'
20203 . ./myread
20204 socksizetype=$ans
20205 ;;
20206 esac
20207 ;;
20208*) : no sockets, so pick relatively harmless default
20209 socksizetype='int'
20210 ;;
20211esac
20212
20213: see what type is used for signed size_t
20214set ssize_t ssizetype int stdio.h sys/types.h
20215eval $typedef
20216dflt="$ssizetype"
5440bc8e 20217$cat > try.c <<EOM
b4eb6b3d 20218#include <stdio.h>
d1daaddf
JH
20219#$i_stdlib I_STDLIB
20220#ifdef I_STDLIB
20221#include <stdlib.h>
20222#endif
b4eb6b3d
JH
20223#include <sys/types.h>
20224#define Size_t $sizetype
20225#define SSize_t $dflt
20226int main()
20227{
20228 if (sizeof(Size_t) == sizeof(SSize_t))
20229 printf("$dflt\n");
20230 else if (sizeof(Size_t) == sizeof(int))
20231 printf("int\n");
20232 else
20233 printf("long\n");
20234 exit(0);
20235}
20236EOM
20237echo " "
5440bc8e
JH
20238set try
20239if eval $compile_ok && $run ./try > /dev/null; then
20240 ssizetype=`$run ./try`
b4eb6b3d
JH
20241 echo "I'll be using $ssizetype for functions returning a byte count." >&4
20242else
20243 $cat >&4 <<EOM
20244Help! I can't compile and run the ssize_t test program: please enlighten me!
20245(This is probably a misconfiguration in your system or libraries, and
20246you really ought to fix it. Still, I'll try anyway.)
20247
20248I need a type that is the same size as $sizetype, but is guaranteed to
20249be signed. Common values are ssize_t, int and long.
20250
20251EOM
20252 rp="What signed type is the same size as $sizetype?"
20253 . ./myread
20254 ssizetype="$ans"
20255fi
5440bc8e 20256$rm -f try try.*
b4eb6b3d
JH
20257
20258: see what type of char stdio uses.
20259echo " "
359842a5
JH
20260echo '#include <stdio.h>' > stdio.c
20261$cppstdin $cppminus < stdio.c > stdioh
aa517f50 20262if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
20263 echo "Your stdio uses unsigned chars." >&4
20264 stdchar="unsigned char"
20265else
aa517f50
JH
20266 echo "Your stdio uses signed chars." >&4
20267 stdchar="char"
b4eb6b3d 20268fi
359842a5 20269$rm -f stdio.* stdioh
b4eb6b3d 20270
b4eb6b3d
JH
20271: see what type uids are declared as in the kernel
20272echo " "
20273echo "Looking for the type for user ids returned by getuid()."
20274set uid_t uidtype xxx stdio.h sys/types.h
20275eval $typedef
20276case "$uidtype" in
20277xxx)
20278 xxx=`./findhdr sys/user.h`
20279 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20280 case $1 in
20281 unsigned) dflt="$1 $2" ;;
20282 *) dflt="$1" ;;
20283 esac
20284 ;;
20285*) dflt="$uidtype";;
20286esac
20287case "$uidtype" in
20288uid_t) echo "uid_t found." ;;
20289*) rp="What is the type for user ids returned by getuid()?"
20290 . ./myread
20291 uidtype="$ans"
20292 ;;
20293esac
20294
20295echo " "
20296case "$uidtype" in
20297*_t) zzz="$uidtype" ;;
20298*) zzz="uid" ;;
20299esac
20300echo "Checking the size of $zzz..." >&4
20301cat > try.c <<EOCP
20302#include <sys/types.h>
20303#include <stdio.h>
d1daaddf
JH
20304#$i_stdlib I_STDLIB
20305#ifdef I_STDLIB
20306#include <stdlib.h>
20307#endif
b4eb6b3d
JH
20308int main() {
20309 printf("%d\n", (int)sizeof($uidtype));
20310 exit(0);
20311}
20312EOCP
20313set try
20314if eval $compile_ok; then
5440bc8e 20315 yyy=`$run ./try`
b4eb6b3d
JH
20316 case "$yyy" in
20317 '') uidsize=4
20318 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20319 ;;
20320 *) uidsize=$yyy
20321 echo "Your $zzz is $uidsize bytes long."
20322 ;;
20323 esac
20324else
20325 uidsize=4
20326 echo "(I can't compile the test program--guessing $uidsize.)" >&4
20327fi
20328
20329echo " "
20330case "$uidtype" in
20331*_t) zzz="$uidtype" ;;
20332*) zzz="uid" ;;
20333esac
20334echo "Checking the sign of $zzz..." >&4
20335cat > try.c <<EOCP
20336#include <sys/types.h>
20337#include <stdio.h>
20338int main() {
20339 $uidtype foo = -1;
20340 if (foo < 0)
20341 printf("-1\n");
20342 else
20343 printf("1\n");
20344}
20345EOCP
20346set try
20347if eval $compile; then
5440bc8e 20348 yyy=`$run ./try`
b4eb6b3d
JH
20349 case "$yyy" in
20350 '') uidsign=1
20351 echo "(I can't execute the test program--guessing unsigned.)" >&4
20352 ;;
20353 *) uidsign=$yyy
20354 case "$uidsign" in
20355 1) echo "Your $zzz is unsigned." ;;
20356 -1) echo "Your $zzz is signed." ;;
20357 esac
20358 ;;
20359 esac
20360else
20361 uidsign=1
20362 echo "(I can't compile the test program--guessing unsigned.)" >&4
20363fi
20364
20365
20366
20367echo " "
20368$echo "Checking the format string to be used for uids..." >&4
20369
20370case "$uidsign" in
20371-1) if $test X"$uidsize" = X"$ivsize"; then
20372 uidformat="$ivdformat"
20373 else
20374 if $test X"$uidsize" = X"$longsize"; then
20375 uidformat='"ld"'
20376 else
20377 if $test X"$uidsize" = X"$intsize"; then
20378 uidformat='"d"'
20379 else
20380 if $test X"$uidsize" = X"$shortsize"; then
20381 uidformat='"hd"'
20382 fi
20383 fi
20384 fi
20385 fi
20386 ;;
20387*) if $test X"$uidsize" = X"$uvsize"; then
20388 uidformat="$uvuformat"
20389 else
20390 if $test X"$uidsize" = X"$longsize"; then
20391 uidformat='"lu"'
20392 else
20393 if $test X"$uidsize" = X"$intsize"; then
20394 uidformat='"u"'
20395 else
20396 if $test X"$uidsize" = X"$shortsize"; then
20397 uidformat='"hu"'
20398 fi
20399 fi
20400 fi
20401 fi
20402 ;;
20403esac
20404
4afd418c
MB
20405
20406case "$usesitecustomize" in
20407 $define|true|[Yy]*)
20408 usesitecustomize="$define"
20409 ;;
20410 *)
20411 usesitecustomize="$undef"
20412 ;;
20413 esac
20414
3659ebf1
JH
20415: determine compiler compiler
20416case "$yacc" in
20417'')
20418 dflt=yacc;;
20419*)
20420 dflt="$yacc";;
20421esac
20422echo " "
20423comp='yacc'
3c728e00 20424if $test -f "$byacc$_exe"; then
3659ebf1
JH
20425 dflt="$byacc"
20426 comp="byacc or $comp"
20427fi
3c728e00 20428if $test -f "$bison$_exe"; then
3659ebf1
JH
20429 comp="$comp or bison -y"
20430fi
20431rp="Which compiler compiler ($comp) shall I use?"
20432. ./myread
20433yacc="$ans"
20434case "$yacc" in
20435*bis*)
20436 case "$yacc" in
20437 *-y*) ;;
20438 *)
20439 yacc="$yacc -y"
20440 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20441 ;;
20442 esac
20443 ;;
20444esac
20445
758a5d79
JH
20446: see if this is a fp.h system
20447set fp.h i_fp
20448eval $inhdr
20449
20450: see if this is a fp_class.h system
20451set fp_class.h i_fp_class
20452eval $inhdr
20453
13cfc98d
MB
20454: see if gdbm.h is available
20455set gdbm.h t_gdbm
20456eval $inhdr
20457case "$t_gdbm" in
20458$define)
20459 : see if gdbm_open exists
20460 set gdbm_open d_gdbm_open
20461 eval $inlibc
20462 case "$d_gdbm_open" in
20463 $undef)
20464 t_gdbm="$undef"
20465 echo "We won't be including <gdbm.h>"
20466 ;;
20467 esac
20468 ;;
20469esac
20470val="$t_gdbm"
20471set i_gdbm
20472eval $setvar
20473
b4eb6b3d 20474: see if this is a ieeefp.h system
b5b9f165
JH
20475case "$i_ieeefp" in
20476'' ) set ieeefp.h i_ieeefp
20477 eval $inhdr
20478 ;;
20479esac
b4eb6b3d
JH
20480
20481: see if this is a libutil.h system
20482set libutil.h i_libutil
20483eval $inhdr
20484
b4eb6b3d
JH
20485: see if mach cthreads are available
20486if test "X$usethreads" = "X$define"; then
20487 set mach/cthreads.h i_machcthr
20488 eval $inhdr
20489else
20490 i_machcthr="$undef"
20491fi
20492
20493
20494
b4eb6b3d
JH
20495: see if this is a mntent.h system
20496set mntent.h i_mntent
20497eval $inhdr
20498
20499: see if ndbm.h is available
20500set ndbm.h t_ndbm
20501eval $inhdr
1c6861ad
JS
20502
20503case "$t_ndbm" in
20504$undef)
20505 # Some Linux distributions such as RedHat 7.1 put the
20506 # ndbm.h header in /usr/include/gdbm/ndbm.h.
20507 if $test -f /usr/include/gdbm/ndbm.h; then
d11b91bf 20508 echo '<gdbm/ndbm.h> found.'
1c6861ad
JS
20509 ccflags="$ccflags -I/usr/include/gdbm"
20510 cppflags="$cppflags -I/usr/include/gdbm"
20511 t_ndbm=$define
20512 fi
20513 ;;
20514esac
20515
b4eb6b3d
JH
20516case "$t_ndbm" in
20517$define)
20518 : see if dbm_open exists
20519 set dbm_open d_dbm_open
20520 eval $inlibc
20521 case "$d_dbm_open" in
20522 $undef)
20523 t_ndbm="$undef"
20524 echo "We won't be including <ndbm.h>"
20525 ;;
20526 esac
20527 ;;
20528esac
20529val="$t_ndbm"
20530set i_ndbm
20531eval $setvar
20532
20533: see if net/errno.h is available
20534val=''
20535set net/errno.h val
20536eval $inhdr
20537
20538: Unfortunately, it causes problems on some systems. Arrgh.
20539case "$val" in
20540$define)
20541 cat > try.c <<'EOM'
20542#include <stdio.h>
20543#include <errno.h>
20544#include <net/errno.h>
20545int func()
20546{
20547 return ENOTSOCK;
20548}
20549EOM
20550 if $cc $ccflags -c try.c >/dev/null 2>&1; then
20551 echo "We'll be including <net/errno.h>." >&4
20552 else
20553 echo "We won't be including <net/errno.h>." >&4
20554 val="$undef"
20555 fi
20556 $rm -f try.* try
20557 ;;
20558esac
20559set i_neterrno
20560eval $setvar
20561
20562: see if netinet/tcp.h is available
20563set netinet/tcp.h i_netinettcp
20564eval $inhdr
20565
20566: see if this is a poll.h system
20567set poll.h i_poll
20568eval $inhdr
20569
20570: see if this is a prot.h system
20571set prot.h i_prot
20572eval $inhdr
20573
20574echo " "
ddfca5da 20575$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
b4eb6b3d
JH
20576$cat <<'EOSH' > Cppsym.know
20577a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20578AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
44c87379 20579alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
d46c9a2d
JH
20580ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20581BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
20582BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20583bull c cadmus clipper CMU COFF COMPILER_VERSION
20584concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
8b7d8421 20585CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
20586Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20587FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20588GLIBC GLIBC_MINOR
20589GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
20590H3050R H3050RX hbullx20 hcx host_mips
20591hp200 hp300 hp700 HP700 hp800 hp9000
20592hp9000s200 hp9000s300 hp9000s400 hp9000s500
20593hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20594i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 20595IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
20596INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20597LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20598LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20599Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20600LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20601M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20602M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20603M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20604MATH_HAS_NO_SIDE_EFFECTS
20605mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20606mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20607mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20608MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20609mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20610NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 20611news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
20612ns32016 ns32332 ns32k nsc32000
20613OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20614pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20615pc532 pdp11 PGC PIC plexus PORTAR posix
20616POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20617POSIX_C_SOURCE POSIX_SOURCE POWER
20618PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 20619riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
20620SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20621sony sony_news sonyrisc sparc sparclite spectrum
20622stardent stdc STDC_EXT stratos sun sun3 sun386
20623Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20624SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20625SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20626sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 20627TM3200 TM5400 TM5600
b4eb6b3d
JH
20628tower tower32 tower32_200 tower32_600 tower32_700
20629tower32_800 tower32_850 tss
20630u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20631ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
20632unix UNIX95 UNIX99 unixpc unos
20633USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20634USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20635USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20636USGr4 USGr4_2
44c87379 20637Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
b4eb6b3d
JH
20638XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20639XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20640z8000
20641EOSH
20642# Maybe put other stuff here too.
20643cat <<EOSH >>Cppsym.know
20644$osname
20645EOSH
20646./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20647./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20648$cat Cppsym.know > Cppsym.c
381aa1ff 20649$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
20650$rm -f Cppsym.a Cppsym.b Cppsym.c
20651cat <<EOSH > Cppsym
20652$startsh
20653if $test \$# -gt 0; then
20654 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20655 if $test -s Cppsym.got; then
20656 $rm -f Cppsym.got
20657 exit 0
20658 fi
20659 $rm -f Cppsym.got
20660 exit 1
20661else
20662 $tr " " "$trnl" | ./Cppsym.try
20663 exit 0
20664fi
20665EOSH
20666chmod +x Cppsym
20667$eunicefix Cppsym
20668cat <<EOSH > Cppsym.try
20669$startsh
20670cat <<'EOCP' > try.c
20671#include <stdio.h>
360321b3
YST
20672#if cpp_stuff == 1
20673#define STRINGIFY(a) "a"
20674#endif
20675#if cpp_stuff == 42
20676#define StGiFy(a) #a
20677#define STRINGIFY(a) StGiFy(a)
20678#endif
20679#if $cpp_stuff != 1 && $cpp_stuff != 42
20680# include "Bletch: How does this C preprocessor stringify macros?"
20681#endif
b4eb6b3d
JH
20682int main() {
20683EOCP
20684$awk \\
20685EOSH
20686cat <<'EOSH' >> Cppsym.try
20687'length($1) > 0 {
360321b3
YST
20688 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20689 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20690 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20691 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
b4eb6b3d 20692}' >> try.c
2ef53570 20693echo 'return 0;}' >> try.c
b4eb6b3d
JH
20694EOSH
20695cat <<EOSH >> Cppsym.try
20696ccflags="$ccflags"
20697case "$osname-$gccversion" in
20698irix-) ccflags="\$ccflags -woff 1178" ;;
20699os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20700esac
360321b3 20701$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
b4eb6b3d
JH
20702EOSH
20703chmod +x Cppsym.try
20704$eunicefix Cppsym.try
20705./Cppsym < Cppsym.know > Cppsym.true
ddfca5da 20706: Add in any linux cpp "predefined macros":
b6a7163e
MB
20707case "$osname::$gccversion" in
20708 *linux*::*.*)
20709 tHdrH=_tmpHdr
20710 rm -f $tHdrH'.h' $tHdrH
20711 touch $tHdrH'.h'
20712 if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20713 sed 's/#define[\ \ ]*//;s/[\ \ ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20714 if [ -s $tHdrH'_cppsym.real' ]; then
20715 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20716 fi
20717 fi
20718 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20719 ;;
20720esac
b4eb6b3d
JH
20721: now check the C compiler for additional symbols
20722postprocess_cc_v=''
20723case "$osname" in
20724aix) postprocess_cc_v="|$tr , ' '" ;;
20725esac
20726$cat >ccsym <<EOS
20727$startsh
20728$cat >tmp.c <<EOF
20729extern int foo;
20730EOF
20731for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20732do
20733 case "\$i" in
20734 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 20735 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
20736 esac
20737done
20738$rm -f try.c
20739EOS
20740postprocess_cc_v=''
20741chmod +x ccsym
20742$eunicefix ccsym
20743./ccsym > ccsym1.raw
20744if $test -s ccsym1.raw; then
20745 $sort ccsym1.raw | $uniq >ccsym.raw
20746else
20747 mv ccsym1.raw ccsym.raw
20748fi
20749
20750$awk '/\=/ { print $0; next }
20751 { print $0"=1" }' ccsym.raw >ccsym.list
360321b3
YST
20752$comm -13 Cppsym.true ccsym.list >ccsym.own
20753$comm -12 Cppsym.true ccsym.list >ccsym.com
20754$comm -23 Cppsym.true ccsym.list >ccsym.cpp
b4eb6b3d
JH
20755also=''
20756if $test -z ccsym.raw; then
20757 echo "Your C compiler doesn't seem to define any symbols!" >&4
20758 echo " "
20759 echo "However, your C preprocessor defines the following symbols:"
20760 $cat Cppsym.true
20761 ccsymbols=''
20762 cppsymbols=`$cat Cppsym.true`
20763 cppsymbols=`echo $cppsymbols`
20764 cppccsymbols="$cppsymbols"
20765else
20766 if $test -s ccsym.com; then
20767 echo "Your C compiler and pre-processor define these symbols:"
20768 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20769 also='also '
20770 symbols='ones'
20771 cppccsymbols=`$cat ccsym.com`
20772 cppccsymbols=`echo $cppccsymbols`
20773 $test "$silent" || sleep 1
20774 fi
20775 if $test -s ccsym.cpp; then
20776 $test "$also" && echo " "
20777 echo "Your C pre-processor ${also}defines the following symbols:"
20778 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20779 also='further '
20780 cppsymbols=`$cat ccsym.cpp`
20781 cppsymbols=`echo $cppsymbols`
20782 $test "$silent" || sleep 1
20783 fi
20784 if $test -s ccsym.own; then
20785 $test "$also" && echo " "
20786 echo "Your C compiler ${also}defines the following cpp symbols:"
20787 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20788 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20789 ccsymbols=`$cat ccsym.own`
20790 ccsymbols=`echo $ccsymbols`
20791 $test "$silent" || sleep 1
20792 fi
20793fi
b4eb6b3d
JH
20794
20795: see if this is a termio system
20796val="$undef"
20797val2="$undef"
20798val3="$undef"
20799if $test `./findhdr termios.h`; then
20800 set tcsetattr i_termios
20801 eval $inlibc
20802 val3="$i_termios"
20803fi
20804echo " "
20805case "$val3" in
20806"$define") echo "You have POSIX termios.h... good!" >&4;;
20807*) if ./Cppsym pyr; then
20808 case "`/bin/universe`" in
20809 ucb) if $test `./findhdr sgtty.h`; then
20810 val2="$define"
20811 echo "<sgtty.h> found." >&4
20812 else
20813 echo "System is pyramid with BSD universe."
20814 echo "<sgtty.h> not found--you could have problems." >&4
20815 fi;;
20816 *) if $test `./findhdr termio.h`; then
20817 val="$define"
20818 echo "<termio.h> found." >&4
20819 else
20820 echo "System is pyramid with USG universe."
20821 echo "<termio.h> not found--you could have problems." >&4
20822 fi;;
20823 esac
20824 elif ./usg; then
20825 if $test `./findhdr termio.h`; then
20826 echo "<termio.h> found." >&4
20827 val="$define"
20828 elif $test `./findhdr sgtty.h`; then
20829 echo "<sgtty.h> found." >&4
20830 val2="$define"
20831 else
20832echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20833 fi
20834 else
20835 if $test `./findhdr sgtty.h`; then
20836 echo "<sgtty.h> found." >&4
20837 val2="$define"
20838 elif $test `./findhdr termio.h`; then
20839 echo "<termio.h> found." >&4
20840 val="$define"
20841 else
20842echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20843 fi
20844 fi;;
20845esac
20846set i_termio; eval $setvar
20847val=$val2; set i_sgtty; eval $setvar
20848val=$val3; set i_termios; eval $setvar
20849
b4eb6b3d
JH
20850: see if stddef is available
20851set stddef.h i_stddef
20852eval $inhdr
923fc586 20853
b4eb6b3d
JH
20854: see if this is a sunmath.h system
20855set sunmath.h i_sunmath
20856eval $inhdr
5f80c64f 20857
b4eb6b3d
JH
20858: see if sys/access.h is available
20859set sys/access.h i_sysaccess
20860eval $inhdr
20861
20862: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20863set sys/filio.h i_sysfilio
20864eval $inhdr
20865echo " "
20866if $test `./findhdr sys/ioctl.h`; then
20867 val="$define"
20868 echo '<sys/ioctl.h> found.' >&4
20869else
20870 val="$undef"
20871 if $test $i_sysfilio = "$define"; then
20872 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 20873 else
b4eb6b3d
JH
20874 $test $i_sgtty = "$define" && xxx="sgtty.h"
20875 $test $i_termio = "$define" && xxx="termio.h"
20876 $test $i_termios = "$define" && xxx="termios.h"
20877echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20878 fi
20879fi
20880set i_sysioctl
20881eval $setvar
20882
49a78c82
JH
20883: see if socket ioctl defs are in sys/sockio.h
20884echo " "
20885xxx=`./findhdr sys/sockio.h`
20886if $test "$xxx"; then
20887 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20888 val="$define"
20889 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20890 else
20891 val="$undef"
20892 echo "No socket ioctls found in <sys/sockio.h>." >&4
20893 fi
20894else
20895 val="$undef"
20896 $cat <<EOM
20897<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20898EOM
20899fi
20900set i_syssockio
20901eval $setvar
20902
b4eb6b3d
JH
20903
20904: see if this is a syslog.h system
20905set syslog.h i_syslog
20906eval $inhdr
20907
20908
20909: see if this is a sys/mode.h system
20910set sys/mode.h i_sysmode
20911eval $inhdr
20912
20913: see if sys/resource.h has to be included
20914set sys/resource.h i_sysresrc
20915eval $inhdr
20916
20917: see if sys/security.h is available
20918set sys/security.h i_syssecrt
20919eval $inhdr
20920
20921: see if this is a sys/statvfs.h system
20922set sys/statvfs.h i_sysstatvfs
20923eval $inhdr
20924
b4eb6b3d
JH
20925: see if this is a sys/un.h system
20926set sys/un.h i_sysun
20927eval $inhdr
20928
20929
20930: see if this is a sys/utsname.h system
20931set sys/utsname.h i_sysutsname
20932eval $inhdr
20933
20934: see if this is a syswait system
20935set sys/wait.h i_syswait
20936eval $inhdr
20937
20938: see if this is a ustat.h system
20939set ustat.h i_ustat
20940eval $inhdr
20941
20942: see if this is an utime system
20943set utime.h i_utime
20944eval $inhdr
20945
20946: see if this is a values.h system
20947set values.h i_values
20948eval $inhdr
20949
20950: see if this is a vfork system
20951case "$d_vfork" in
20952"$define")
20953 set vfork.h i_vfork
20954 eval $inhdr
20955 ;;
20956*)
20957 i_vfork="$undef"
20958 ;;
20959esac
20960
b4eb6b3d
JH
20961echo " "
20962echo "Looking for extensions..." >&4
20963: If we are using the old config.sh, known_extensions may contain
20964: old or inaccurate or duplicate values.
20965known_extensions=''
20966nonxs_extensions=''
20967: We do not use find because it might not be available.
20968: We do not just use MANIFEST because the user may have dropped
20969: some additional extensions into the source tree and expect them
20970: to be built.
20971
20972: Function to recursively find available extensions, ignoring DynaLoader
20973: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20974find_extensions='
20975 for xxx in *; do
822a6ee0
MB
20976 case "$xxx" in
20977 DynaLoader|dynaload) ;;
20978 *)
20979 if $test -f $xxx/$xxx.xs; then
20980 known_extensions="$known_extensions $1$xxx";
20981 elif $test -f $xxx/Makefile.PL; then
20982 nonxs_extensions="$nonxs_extensions $1$xxx";
20983 else
20984 if $test -d $xxx -a $# -lt 10; then
20985 set $1$xxx/ $*;
20986 cd "$xxx";
20987 eval $find_extensions;
20988 cd ..;
20989 shift;
20990 fi;
20991 fi
20992 ;;
20993 esac;
b4eb6b3d
JH
20994 done'
20995tdir=`pwd`
6904989c 20996cd "$rsrc/ext"
b4eb6b3d
JH
20997set X
20998shift
20999eval $find_extensions
4e1a6d26
AD
21000# Special case: Add in threads/shared since it is not picked up by the
21001# recursive find above (and adding in general recursive finding breaks
21002# SDBM_File/sdbm). A.D. 10/25/2001.
998b396c 21003known_extensions="$known_extensions threads/shared"
faae14e6
MB
21004set X $known_extensions
21005shift
21006known_extensions="$*"
21007# Ditto for IO/Compress/Base and IO/Compress/Zlib
59c368f1 21008nonxs_extensions="$nonxs_extensions IO/Compress/Base IO/Compress/Zlib"
b4eb6b3d
JH
21009set X $nonxs_extensions
21010shift
21011nonxs_extensions="$*"
6904989c 21012cd "$tdir"
b4eb6b3d
JH
21013
21014: Now see which are supported on this system.
21015avail_ext=''
21016for xxx in $known_extensions ; do
21017 case "$xxx" in
21018 DB_File|db_file)
21019 case "$i_db" in
21020 $define) avail_ext="$avail_ext $xxx" ;;
21021 esac
21022 ;;
21023 GDBM_File|gdbm_fil)
7c345082 21024 case "$i_gdbm" in
b4eb6b3d
JH
21025 $define) avail_ext="$avail_ext $xxx" ;;
21026 esac
21027 ;;
1d59c593 21028 I18N/Langinfo|i18n_lan)
7c345082 21029 case "$i_langinfo$d_nl_langinfo" in
4bbcc6e8
JH
21030 $define$define) avail_ext="$avail_ext $xxx" ;;
21031 esac
21032 ;;
b4eb6b3d
JH
21033 NDBM_File|ndbm_fil)
21034 case "$i_ndbm" in
21035 $define)
21036 case "$osname-$use64bitint" in
0be9fa5d 21037 hpux-define)
b4eb6b3d
JH
21038 case "$libs" in
21039 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21040 esac
21041 ;;
21042 *) avail_ext="$avail_ext $xxx" ;;
21043 esac
21044 ;;
21045 esac
21046 ;;
7c345082 21047 ODBM_File|odbm_fil)
b4eb6b3d
JH
21048 case "${i_dbm}${i_rpcsvcdbm}" in
21049 *"${define}"*)
21050 case "$osname-$use64bitint" in
0be9fa5d 21051 hpux-define)
b4eb6b3d
JH
21052 case "$libs" in
21053 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21054 esac
21055 ;;
21056 *) avail_ext="$avail_ext $xxx" ;;
21057 esac
21058 ;;
21059 esac
21060 ;;
21061 POSIX|posix)
21062 case "$useposix" in
21063 true|define|y) avail_ext="$avail_ext $xxx" ;;
21064 esac
21065 ;;
21066 Opcode|opcode)
21067 case "$useopcode" in
21068 true|define|y) avail_ext="$avail_ext $xxx" ;;
21069 esac
21070 ;;
21071 Socket|socket)
7c345082 21072 case "$d_socket" in
4a9f028c
JH
21073 true|$define|y)
21074 case "$osname" in
21075 beos) ;; # not unless BONE
21076 *) avail_ext="$avail_ext $xxx" ;;
21077 esac
21078 ;;
b4eb6b3d
JH
21079 esac
21080 ;;
21081 Sys/Syslog|sys/syslog)
21082 : XXX syslog requires socket
7c345082 21083 case "$d_socket" in
b4eb6b3d
JH
21084 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21085 esac
21086 ;;
21087 Thread|thread)
b00ec89b
AB
21088 case "$usethreads" in
21089 true|$define|y)
21090 case "$useithreads" in
21091 $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
21092 esac
b4eb6b3d
JH
21093 esac
21094 ;;
b149d92d
JD
21095 Win32)
21096 case "$osname" in
21097 cygwin) avail_ext="$avail_ext $xxx" ;;
21098 esac
21099 ;;
f9b6ed1c
AD
21100 XS/APItest|xs/apitest)
21101 # This is just for testing. Skip it unless we have dynamic loading.
21102
21103 case "$usedl" in
21104 $define) avail_ext="$avail_ext $xxx" ;;
21105 esac
21106 ;;
21107 XS/Typemap|xs/typemap)
21108 # This is just for testing. Skip it unless we have dynamic loading.
21109 case "$usedl" in
21110 $define) avail_ext="$avail_ext $xxx" ;;
21111 esac
21112 ;;
7deadc5f 21113 threads|threads/shared)
73e09c8f
JH
21114 # threads and threads::shared are special cases.
21115 # To stop people from asking "Perl 5.8.0 was supposed
21116 # to have this new fancy threads implementation but my
21117 # perl doesn't have it" and from people trying to
21118 # (re)install the threads module using CPAN.pm and
21119 # CPAN.pm then offering to reinstall Perl 5.8.0,
21120 # the threads.pm and threads/shared.pm will always be
21121 # there, croaking informatively ("you need to rebuild
21122 # all of Perl with threads, sorry") when threads haven't
21123 # been compiled in.
21124 # --jhi
21125 avail_ext="$avail_ext $xxx"
1dca008a 21126 ;;
b4eb6b3d
JH
21127 IPC/SysV|ipc/sysv)
21128 : XXX Do we need a useipcsysv variable here
7c345082 21129 case "${d_msg}${d_sem}${d_shm}" in
b4eb6b3d
JH
21130 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21131 esac
21132 ;;
21133 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
21134 ;;
21135 esac
b4eb6b3d 21136done
5f80c64f 21137
b4eb6b3d
JH
21138set X $avail_ext
21139shift
21140avail_ext="$*"
5f80c64f 21141
ef0c5be8
JH
21142case "$onlyextensions" in
21143'') ;;
21144*) keepextensions=''
21145 echo "You have requested that only certains extensions be included..." >&4
21146 for i in $onlyextensions; do
21147 case " $avail_ext " in
21148 *" $i "*)
21149 echo "Keeping extension $i."
21150 keepextensions="$keepextensions $i"
21151 ;;
21152 *) echo "Ignoring extension $i." ;;
21153 esac
21154 done
21155 avail_ext="$keepextensions"
21156 ;;
21157esac
21158
21159case "$noextensions" in
21160'') ;;
21161*) keepextensions=''
21162 echo "You have requested that certain extensions be ignored..." >&4
21163 for i in $avail_ext; do
c3dadc13
AD
21164 case " $noextensions " in
21165 *" $i "*) echo "Ignoring extension $i." ;;
ef0c5be8
JH
21166 *) echo "Keeping extension $i.";
21167 keepextensions="$keepextensions $i"
21168 ;;
21169 esac
21170 done
21171 avail_ext="$keepextensions"
21172 ;;
21173esac
21174
b4eb6b3d
JH
21175: Now see which nonxs extensions are supported on this system.
21176: For now assume all are.
21177nonxs_ext=''
21178for xxx in $nonxs_extensions ; do
21179 case "$xxx" in
21180 *) nonxs_ext="$nonxs_ext $xxx"
21181 ;;
21182 esac
21183done
5f80c64f 21184
b4eb6b3d
JH
21185set X $nonxs_ext
21186shift
21187nonxs_ext="$*"
21188
21189case $usedl in
21190$define)
21191 $cat <<EOM
21192A number of extensions are supplied with $package. You may choose to
21193compile these extensions for dynamic loading (the default), compile
21194them into the $package executable (static loading), or not include
21195them at all. Answer "none" to include no extensions.
21196Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
21197
21198EOM
b4eb6b3d 21199 case "$dynamic_ext" in
736accd3
YST
21200 '')
21201 : Exclude those listed in static_ext
21202 dflt=''
21203 for xxx in $avail_ext; do
21204 case " $static_ext " in
21205 *" $xxx "*) ;;
21206 *) dflt="$dflt $xxx" ;;
21207 esac
21208 done
21209 set X $dflt
21210 shift
21211 dflt="$*"
21212 ;;
b4eb6b3d
JH
21213 *) dflt="$dynamic_ext"
21214 # Perhaps we are reusing an old out-of-date config.sh.
21215 case "$hint" in
21216 previous)
21217 if test X"$dynamic_ext" != X"$avail_ext"; then
21218 $cat <<EOM
7c345082
RGS
21219NOTICE: Your previous config.sh list may be incorrect.
21220The extensions now available to you are
b4eb6b3d
JH
21221 ${avail_ext}
21222but the default list from your previous config.sh is
7c345082 21223 ${dynamic_ext}
9c839522 21224
b4eb6b3d
JH
21225EOM
21226 fi
9c839522
PM
21227 ;;
21228 esac
b4eb6b3d
JH
21229 ;;
21230 esac
5f80c64f 21231 case "$dflt" in
b4eb6b3d
JH
21232 '') dflt=none;;
21233 esac
21234 rp="What extensions do you wish to load dynamically?"
21235 . ./myread
21236 case "$ans" in
21237 none) dynamic_ext=' ' ;;
21238 *) dynamic_ext="$ans" ;;
5f80c64f 21239 esac
5f80c64f 21240
b4eb6b3d
JH
21241 case "$static_ext" in
21242 '')
21243 : Exclude those already listed in dynamic linking
21244 dflt=''
21245 for xxx in $avail_ext; do
21246 case " $dynamic_ext " in
21247 *" $xxx "*) ;;
21248 *) dflt="$dflt $xxx" ;;
21249 esac
21250 done
21251 set X $dflt
21252 shift
21253 dflt="$*"
21254 ;;
7c345082 21255 *) dflt="$static_ext"
b4eb6b3d
JH
21256 ;;
21257 esac
9c839522 21258
b4eb6b3d
JH
21259 case "$dflt" in
21260 '') dflt=none;;
21261 esac
21262 rp="What extensions do you wish to load statically?"
21263 . ./myread
21264 case "$ans" in
21265 none) static_ext=' ' ;;
21266 *) static_ext="$ans" ;;
21267 esac
21268 ;;
21269*)
21270 $cat <<EOM
7c345082
RGS
21271A number of extensions are supplied with $package. Answer "none"
21272to include no extensions.
b4eb6b3d 21273Note that DynaLoader is always built and need not be mentioned here.
9c839522 21274
b4eb6b3d
JH
21275EOM
21276 case "$static_ext" in
21277 '') dflt="$avail_ext" ;;
21278 *) dflt="$static_ext"
21279 # Perhaps we are reusing an old out-of-date config.sh.
21280 case "$hint" in
21281 previous)
21282 if test X"$static_ext" != X"$avail_ext"; then
21283 $cat <<EOM
7c345082
RGS
21284NOTICE: Your previous config.sh list may be incorrect.
21285The extensions now available to you are
b4eb6b3d
JH
21286 ${avail_ext}
21287but the default list from your previous config.sh is
7c345082 21288 ${static_ext}
5f80c64f
JH
21289
21290EOM
b4eb6b3d
JH
21291 fi
21292 ;;
21293 esac
21294 ;;
21295 esac
21296 : Exclude those that are not xs extensions
21297 case "$dflt" in
21298 '') dflt=none;;
21299 esac
21300 rp="What extensions do you wish to include?"
21301 . ./myread
21302 case "$ans" in
21303 none) static_ext=' ' ;;
21304 *) static_ext="$ans" ;;
21305 esac
21306 ;;
5f80c64f 21307esac
7c345082 21308#
f1f6834f
AD
21309# Encode is a special case. If we are building Encode as a static
21310# extension, we need to explicitly list its subextensions as well.
21311# For other nested extensions, this is handled automatically by
21312# the appropriate Makefile.PL.
21313case " $static_ext " in
21314 *" Encode "*) # Add the subextensions of Encode
21315 cd "$rsrc/ext"
21316 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21317 static_ext="$static_ext Encode/$xxx"
21318 done
21319 cd "$tdir"
21320 ;;
21321esac
5f80c64f 21322
b4eb6b3d
JH
21323set X $dynamic_ext $static_ext $nonxs_ext
21324shift
21325extensions="$*"
21326
93a2cd18
AD
21327# Sanity check: We require an extension suitable for use with
21328# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
21329# should show up as failures in the test suite, but it's helpful to
21330# catch them now.) The 'extensions' list is normally sorted
21331# alphabetically, so we need to accept either
21332# DB_File ... Fcntl ... IO ....
21333# or something like
21334# Fcntl ... NDBM_File ... IO ....
42fde7b2
JH
21335case " $extensions" in
21336*"_File "*" Fcntl "*" IO "*) ;; # DB_File
21337*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21338*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
7a8675bc
JH
21339*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21340 echo "WARNING: The Perl you are building will be quite crippled." >& 4
21341 ;;
21342esac
21343
9c839522
PM
21344: Remove libraries needed only for extensions
21345: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
21346: The exception is SunOS 4.x, which needs them.
21347case "${osname}X${osvers}" in
21348sunos*X4*)
21349 perllibs="$libs"
21350 ;;
21351*) case "$usedl" in
21352 $define|true|[yY]*)
21353 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
21354 shift
21355 perllibs="$*"
21356 ;;
21357 *) perllibs="$libs"
21358 ;;
21359 esac
21360 ;;
9c839522 21361esac
5f80c64f
JH
21362
21363: Remove build directory name from cppstdin so it can be used from
21364: either the present location or the final installed location.
21365echo " "
21366: Get out of the UU directory to get correct path name.
21367cd ..
21368case "$cppstdin" in
21369`pwd`/cppstdin)
21370 echo "Stripping down cppstdin path name"
21371 cppstdin=cppstdin
21372 ;;
21373esac
21374cd UU
21375
21376: end of configuration questions
21377echo " "
21378echo "End of configuration questions."
21379echo " "
21380
21381: back to where it started
21382if test -d ../UU; then
21383 cd ..
21384fi
21385
48370efc
JH
21386: configuration may be patched via a 'config.arch' file
21387if $test -f config.arch; then
21388 echo "I see a config.arch file, loading it."
21389 . ./config.arch
21390fi
21391
5f80c64f
JH
21392: configuration may be patched via a 'config.over' file
21393if $test -f config.over; then
21394 echo " "
21395 dflt=y
21396 rp='I see a config.over file. Do you wish to load it?'
21397 . UU/myread
21398 case "$ans" in
21399 n*) echo "OK, I'll ignore it.";;
21400 *) . ./config.over
21401 echo "Configuration override changes have been loaded."
21402 ;;
21403 esac
21404fi
21405
21406: in case they want portability, strip down executable paths
21407case "$d_portable" in
21408"$define")
21409 echo " "
21410 echo "Stripping down executable paths..." >&4
21411 for file in $loclist $trylist; do
534ac15a
JH
21412 eval temp=\$$file
21413 eval $file=`basename $temp`
5f80c64f
JH
21414 done
21415 ;;
21416esac
21417
21418: create config.sh file
21419echo " "
21420echo "Creating config.sh..." >&4
21421$spitshell <<EOT >config.sh
21422$startsh
21423#
21424# This file was produced by running the Configure script. It holds all the
21425# definitions figured out by Configure. Should you modify one of these values,
21426# do not forget to propagate your changes by running "Configure -der". You may
21427# instead choose to run each of the .SH files by yourself, or "Configure -S".
21428#
21429
21430# Package name : $package
21431# Source directory : $src
21432# Configuration time: $cf_time
21433# Configured by : $cf_by
21434# Target system : $myuname
21435
21436Author='$Author'
21437Date='$Date'
21438Header='$Header'
21439Id='$Id'
21440Locker='$Locker'
21441Log='$Log'
21442Mcc='$Mcc'
21443RCSfile='$RCSfile'
21444Revision='$Revision'
21445Source='$Source'
21446State='$State'
21447_a='$_a'
21448_exe='$_exe'
21449_o='$_o'
b4eb6b3d 21450afs='$afs'
a6d26a0d 21451afsroot='$afsroot'
b4eb6b3d
JH
21452alignbytes='$alignbytes'
21453ansi2knr='$ansi2knr'
21454aphostname='$aphostname'
21455api_revision='$api_revision'
21456api_subversion='$api_subversion'
21457api_version='$api_version'
21458api_versionstring='$api_versionstring'
5f80c64f 21459ar='$ar'
b4eb6b3d
JH
21460archlib='$archlib'
21461archlibexp='$archlibexp'
21462archname64='$archname64'
21463archname='$archname'
5f80c64f 21464archobjs='$archobjs'
10bc17b6 21465asctime_r_proto='$asctime_r_proto'
5f80c64f 21466awk='$awk'
b4eb6b3d 21467baserev='$baserev'
5f80c64f 21468bash='$bash'
b4eb6b3d 21469bin='$bin'
b4eb6b3d 21470binexp='$binexp'
5f80c64f
JH
21471bison='$bison'
21472byacc='$byacc'
b4eb6b3d 21473byteorder='$byteorder'
5f80c64f 21474c='$c'
b4eb6b3d 21475castflags='$castflags'
5f80c64f
JH
21476cat='$cat'
21477cc='$cc'
21478cccdlflags='$cccdlflags'
21479ccdlflags='$ccdlflags'
21480ccflags='$ccflags'
b4eb6b3d 21481ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 21482ccname='$ccname'
b4eb6b3d 21483ccsymbols='$ccsymbols'
6b356c8e 21484ccversion='$ccversion'
5f80c64f 21485cf_by='$cf_by'
b4eb6b3d 21486cf_email='$cf_email'
5f80c64f 21487cf_time='$cf_time'
b4eb6b3d 21488charsize='$charsize'
5f80c64f
JH
21489chgrp='$chgrp'
21490chmod='$chmod'
21491chown='$chown'
b4eb6b3d 21492clocktype='$clocktype'
5f80c64f
JH
21493comm='$comm'
21494compress='$compress'
21495contains='$contains'
21496cp='$cp'
21497cpio='$cpio'
21498cpp='$cpp'
b4eb6b3d
JH
21499cpp_stuff='$cpp_stuff'
21500cppccsymbols='$cppccsymbols'
5f80c64f
JH
21501cppflags='$cppflags'
21502cpplast='$cpplast'
21503cppminus='$cppminus'
21504cpprun='$cpprun'
21505cppstdin='$cppstdin'
b4eb6b3d 21506cppsymbols='$cppsymbols'
10bc17b6 21507crypt_r_proto='$crypt_r_proto'
b4eb6b3d 21508cryptlib='$cryptlib'
5f80c64f 21509csh='$csh'
10bc17b6
JH
21510ctermid_r_proto='$ctermid_r_proto'
21511ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
21512d_Gconvert='$d_Gconvert'
21513d_PRIEUldbl='$d_PRIEUldbl'
21514d_PRIFUldbl='$d_PRIFUldbl'
21515d_PRIGUldbl='$d_PRIGUldbl'
21516d_PRIXU64='$d_PRIXU64'
21517d_PRId64='$d_PRId64'
21518d_PRIeldbl='$d_PRIeldbl'
21519d_PRIfldbl='$d_PRIfldbl'
21520d_PRIgldbl='$d_PRIgldbl'
21521d_PRIi64='$d_PRIi64'
21522d_PRIo64='$d_PRIo64'
21523d_PRIu64='$d_PRIu64'
21524d_PRIx64='$d_PRIx64'
21525d_SCNfldbl='$d_SCNfldbl'
74cac757 21526d__fwalk='$d__fwalk'
b4eb6b3d
JH
21527d_access='$d_access'
21528d_accessx='$d_accessx'
55954f19 21529d_aintl='$d_aintl'
b4eb6b3d
JH
21530d_alarm='$d_alarm'
21531d_archlib='$d_archlib'
10bc17b6 21532d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
21533d_atolf='$d_atolf'
21534d_atoll='$d_atoll'
0dbb1585
AL
21535d_attribute_format='$d_attribute_format'
21536d_attribute_malloc='$d_attribute_malloc'
21537d_attribute_nonnull='$d_attribute_nonnull'
21538d_attribute_noreturn='$d_attribute_noreturn'
21539d_attribute_pure='$d_attribute_pure'
21540d_attribute_unused='$d_attribute_unused'
21541d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
b4eb6b3d
JH
21542d_bcmp='$d_bcmp'
21543d_bcopy='$d_bcopy'
5f80c64f 21544d_bsd='$d_bsd'
b4eb6b3d
JH
21545d_bsdgetpgrp='$d_bsdgetpgrp'
21546d_bsdsetpgrp='$d_bsdsetpgrp'
635aebb7
AL
21547d_builtin_choose_expr='$d_builtin_choose_expr'
21548d_builtin_expect='$d_builtin_expect'
b4eb6b3d 21549d_bzero='$d_bzero'
a2d23ec2 21550d_c99_variadic_macros='$d_c99_variadic_macros'
b4eb6b3d
JH
21551d_casti32='$d_casti32'
21552d_castneg='$d_castneg'
21553d_charvspr='$d_charvspr'
21554d_chown='$d_chown'
21555d_chroot='$d_chroot'
21556d_chsize='$d_chsize'
758a5d79 21557d_class='$d_class'
b0a2e8e6 21558d_clearenv='$d_clearenv'
b4eb6b3d 21559d_closedir='$d_closedir'
4e0554ec 21560d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 21561d_const='$d_const'
55954f19 21562d_copysignl='$d_copysignl'
666ea192 21563d_cplusplus='$d_cplusplus'
b4eb6b3d 21564d_crypt='$d_crypt'
10bc17b6 21565d_crypt_r='$d_crypt_r'
b4eb6b3d 21566d_csh='$d_csh'
13cfc98d 21567d_ctermid='$d_ctermid'
10bc17b6
JH
21568d_ctermid_r='$d_ctermid_r'
21569d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
21570d_cuserid='$d_cuserid'
21571d_dbl_dig='$d_dbl_dig'
2ef53570 21572d_dbminitproto='$d_dbminitproto'
b4eb6b3d 21573d_difftime='$d_difftime'
de52168c 21574d_dir_dd_fd='$d_dir_dd_fd'
ae0e3d3b 21575d_dirfd='$d_dirfd'
b4eb6b3d
JH
21576d_dirnamlen='$d_dirnamlen'
21577d_dlerror='$d_dlerror'
5f80c64f 21578d_dlopen='$d_dlopen'
b4eb6b3d
JH
21579d_dlsymun='$d_dlsymun'
21580d_dosuid='$d_dosuid'
10bc17b6 21581d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
21582d_drand48proto='$d_drand48proto'
21583d_dup2='$d_dup2'
21584d_eaccess='$d_eaccess'
21585d_endgrent='$d_endgrent'
10bc17b6 21586d_endgrent_r='$d_endgrent_r'
b4eb6b3d 21587d_endhent='$d_endhent'
10bc17b6 21588d_endhostent_r='$d_endhostent_r'
b4eb6b3d 21589d_endnent='$d_endnent'
10bc17b6 21590d_endnetent_r='$d_endnetent_r'
b4eb6b3d 21591d_endpent='$d_endpent'
10bc17b6 21592d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 21593d_endpwent='$d_endpwent'
10bc17b6 21594d_endpwent_r='$d_endpwent_r'
b4eb6b3d 21595d_endsent='$d_endsent'
10bc17b6 21596d_endservent_r='$d_endservent_r'
b4eb6b3d 21597d_eofnblk='$d_eofnblk'
5f80c64f 21598d_eunice='$d_eunice'
15b61c98 21599d_faststdio='$d_faststdio'
b363b713 21600d_fchdir='$d_fchdir'
b4eb6b3d
JH
21601d_fchmod='$d_fchmod'
21602d_fchown='$d_fchown'
21603d_fcntl='$d_fcntl'
9d9004a9 21604d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
21605d_fd_macros='$d_fd_macros'
21606d_fd_set='$d_fd_set'
21607d_fds_bits='$d_fds_bits'
21608d_fgetpos='$d_fgetpos'
758a5d79
JH
21609d_finite='$d_finite'
21610d_finitel='$d_finitel'
b4eb6b3d
JH
21611d_flexfnam='$d_flexfnam'
21612d_flock='$d_flock'
2ef53570 21613d_flockproto='$d_flockproto'
b4eb6b3d 21614d_fork='$d_fork'
758a5d79 21615d_fp_class='$d_fp_class'
b4eb6b3d 21616d_fpathconf='$d_fpathconf'
758a5d79
JH
21617d_fpclass='$d_fpclass'
21618d_fpclassify='$d_fpclassify'
21619d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
21620d_fpos64_t='$d_fpos64_t'
21621d_frexpl='$d_frexpl'
21622d_fs_data_s='$d_fs_data_s'
21623d_fseeko='$d_fseeko'
21624d_fsetpos='$d_fsetpos'
21625d_fstatfs='$d_fstatfs'
21626d_fstatvfs='$d_fstatvfs'
411ab01c 21627d_fsync='$d_fsync'
b4eb6b3d
JH
21628d_ftello='$d_ftello'
21629d_ftime='$d_ftime'
dc814df1 21630d_futimes='$d_futimes'
b4eb6b3d
JH
21631d_getcwd='$d_getcwd'
21632d_getespwnam='$d_getespwnam'
21633d_getfsstat='$d_getfsstat'
21634d_getgrent='$d_getgrent'
10bc17b6
JH
21635d_getgrent_r='$d_getgrent_r'
21636d_getgrgid_r='$d_getgrgid_r'
21637d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
21638d_getgrps='$d_getgrps'
21639d_gethbyaddr='$d_gethbyaddr'
21640d_gethbyname='$d_gethbyname'
21641d_gethent='$d_gethent'
21642d_gethname='$d_gethname'
10bc17b6
JH
21643d_gethostbyaddr_r='$d_gethostbyaddr_r'
21644d_gethostbyname_r='$d_gethostbyname_r'
21645d_gethostent_r='$d_gethostent_r'
b4eb6b3d 21646d_gethostprotos='$d_gethostprotos'
4e0554ec 21647d_getitimer='$d_getitimer'
b4eb6b3d 21648d_getlogin='$d_getlogin'
10bc17b6 21649d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
21650d_getmnt='$d_getmnt'
21651d_getmntent='$d_getmntent'
21652d_getnbyaddr='$d_getnbyaddr'
21653d_getnbyname='$d_getnbyname'
21654d_getnent='$d_getnent'
10bc17b6
JH
21655d_getnetbyaddr_r='$d_getnetbyaddr_r'
21656d_getnetbyname_r='$d_getnetbyname_r'
21657d_getnetent_r='$d_getnetent_r'
b4eb6b3d 21658d_getnetprotos='$d_getnetprotos'
0c0643d0 21659d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
21660d_getpbyname='$d_getpbyname'
21661d_getpbynumber='$d_getpbynumber'
21662d_getpent='$d_getpent'
21663d_getpgid='$d_getpgid'
21664d_getpgrp2='$d_getpgrp2'
21665d_getpgrp='$d_getpgrp'
21666d_getppid='$d_getppid'
21667d_getprior='$d_getprior'
10bc17b6
JH
21668d_getprotobyname_r='$d_getprotobyname_r'
21669d_getprotobynumber_r='$d_getprotobynumber_r'
21670d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
21671d_getprotoprotos='$d_getprotoprotos'
21672d_getprpwnam='$d_getprpwnam'
21673d_getpwent='$d_getpwent'
10bc17b6
JH
21674d_getpwent_r='$d_getpwent_r'
21675d_getpwnam_r='$d_getpwnam_r'
21676d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
21677d_getsbyname='$d_getsbyname'
21678d_getsbyport='$d_getsbyport'
21679d_getsent='$d_getsent'
10bc17b6
JH
21680d_getservbyname_r='$d_getservbyname_r'
21681d_getservbyport_r='$d_getservbyport_r'
21682d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
21683d_getservprotos='$d_getservprotos'
21684d_getspnam='$d_getspnam'
10bc17b6 21685d_getspnam_r='$d_getspnam_r'
b4eb6b3d 21686d_gettimeod='$d_gettimeod'
10bc17b6 21687d_gmtime_r='$d_gmtime_r'
5f80c64f 21688d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
21689d_grpasswd='$d_grpasswd'
21690d_hasmntopt='$d_hasmntopt'
21691d_htonl='$d_htonl'
55954f19 21692d_ilogbl='$d_ilogbl'
f3f1a2d8 21693d_inc_version_list='$d_inc_version_list'
b4eb6b3d
JH
21694d_index='$d_index'
21695d_inetaton='$d_inetaton'
21696d_int64_t='$d_int64_t'
21697d_isascii='$d_isascii'
758a5d79
JH
21698d_isfinite='$d_isfinite'
21699d_isinf='$d_isinf'
b4eb6b3d
JH
21700d_isnan='$d_isnan'
21701d_isnanl='$d_isnanl'
21702d_killpg='$d_killpg'
21703d_lchown='$d_lchown'
21704d_ldbl_dig='$d_ldbl_dig'
0a0abfba 21705d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 21706d_link='$d_link'
10bc17b6 21707d_localtime_r='$d_localtime_r'
8572b25d 21708d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
b4eb6b3d
JH
21709d_locconv='$d_locconv'
21710d_lockf='$d_lockf'
21711d_longdbl='$d_longdbl'
21712d_longlong='$d_longlong'
21713d_lseekproto='$d_lseekproto'
21714d_lstat='$d_lstat'
21715d_madvise='$d_madvise'
7dd121ae
MB
21716d_malloc_good_size='$d_malloc_good_size'
21717d_malloc_size='$d_malloc_size'
b4eb6b3d
JH
21718d_mblen='$d_mblen'
21719d_mbstowcs='$d_mbstowcs'
21720d_mbtowc='$d_mbtowc'
21721d_memchr='$d_memchr'
21722d_memcmp='$d_memcmp'
21723d_memcpy='$d_memcpy'
21724d_memmove='$d_memmove'
21725d_memset='$d_memset'
21726d_mkdir='$d_mkdir'
21727d_mkdtemp='$d_mkdtemp'
21728d_mkfifo='$d_mkfifo'
21729d_mkstemp='$d_mkstemp'
21730d_mkstemps='$d_mkstemps'
21731d_mktime='$d_mktime'
21732d_mmap='$d_mmap'
21733d_modfl='$d_modfl'
e67aeab1 21734d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 21735d_modflproto='$d_modflproto'
b4eb6b3d
JH
21736d_mprotect='$d_mprotect'
21737d_msg='$d_msg'
21738d_msg_ctrunc='$d_msg_ctrunc'
21739d_msg_dontroute='$d_msg_dontroute'
21740d_msg_oob='$d_msg_oob'
21741d_msg_peek='$d_msg_peek'
21742d_msg_proxy='$d_msg_proxy'
21743d_msgctl='$d_msgctl'
21744d_msgget='$d_msgget'
4e0554ec 21745d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
21746d_msgrcv='$d_msgrcv'
21747d_msgsnd='$d_msgsnd'
21748d_msync='$d_msync'
21749d_munmap='$d_munmap'
21750d_mymalloc='$d_mymalloc'
21751d_nice='$d_nice'
2765b840 21752d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 21753d_nv_preserves_uv='$d_nv_preserves_uv'
f607920a 21754d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
b4eb6b3d
JH
21755d_off64_t='$d_off64_t'
21756d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21757d_oldpthreads='$d_oldpthreads'
21758d_oldsock='$d_oldsock'
21759d_open3='$d_open3'
21760d_pathconf='$d_pathconf'
21761d_pause='$d_pause'
21762d_perl_otherlibdirs='$d_perl_otherlibdirs'
21763d_phostname='$d_phostname'
21764d_pipe='$d_pipe'
21765d_poll='$d_poll'
5f80c64f 21766d_portable='$d_portable'
dcb594bc 21767d_printf_format_null='$d_printf_format_null'
c7aff470 21768d_procselfexe='$d_procselfexe'
233e16ce 21769d_pseudofork='$d_pseudofork'
d6483fcc 21770d_pthread_atfork='$d_pthread_atfork'
58d975c3 21771d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
21772d_pthread_yield='$d_pthread_yield'
21773d_pwage='$d_pwage'
21774d_pwchange='$d_pwchange'
21775d_pwclass='$d_pwclass'
21776d_pwcomment='$d_pwcomment'
21777d_pwexpire='$d_pwexpire'
21778d_pwgecos='$d_pwgecos'
21779d_pwpasswd='$d_pwpasswd'
21780d_pwquota='$d_pwquota'
21781d_qgcvt='$d_qgcvt'
21782d_quad='$d_quad'
10bc17b6
JH
21783d_random_r='$d_random_r'
21784d_readdir64_r='$d_readdir64_r'
b4eb6b3d 21785d_readdir='$d_readdir'
10bc17b6 21786d_readdir_r='$d_readdir_r'
b4eb6b3d 21787d_readlink='$d_readlink'
4e0554ec
JH
21788d_readv='$d_readv'
21789d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
21790d_rename='$d_rename'
21791d_rewinddir='$d_rewinddir'
21792d_rmdir='$d_rmdir'
21793d_safebcpy='$d_safebcpy'
21794d_safemcpy='$d_safemcpy'
21795d_sanemcmp='$d_sanemcmp'
ef9f17be 21796d_sbrkproto='$d_sbrkproto'
55954f19 21797d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
21798d_sched_yield='$d_sched_yield'
21799d_scm_rights='$d_scm_rights'
21800d_seekdir='$d_seekdir'
21801d_select='$d_select'
21802d_sem='$d_sem'
21803d_semctl='$d_semctl'
21804d_semctl_semid_ds='$d_semctl_semid_ds'
21805d_semctl_semun='$d_semctl_semun'
21806d_semget='$d_semget'
21807d_semop='$d_semop'
4e0554ec 21808d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
21809d_setegid='$d_setegid'
21810d_seteuid='$d_seteuid'
21811d_setgrent='$d_setgrent'
10bc17b6 21812d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
21813d_setgrps='$d_setgrps'
21814d_sethent='$d_sethent'
10bc17b6 21815d_sethostent_r='$d_sethostent_r'
4e0554ec 21816d_setitimer='$d_setitimer'
b4eb6b3d
JH
21817d_setlinebuf='$d_setlinebuf'
21818d_setlocale='$d_setlocale'
10bc17b6 21819d_setlocale_r='$d_setlocale_r'
b4eb6b3d 21820d_setnent='$d_setnent'
10bc17b6 21821d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
21822d_setpent='$d_setpent'
21823d_setpgid='$d_setpgid'
21824d_setpgrp2='$d_setpgrp2'
21825d_setpgrp='$d_setpgrp'
21826d_setprior='$d_setprior'
21827d_setproctitle='$d_setproctitle'
10bc17b6 21828d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 21829d_setpwent='$d_setpwent'
10bc17b6 21830d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
21831d_setregid='$d_setregid'
21832d_setresgid='$d_setresgid'
21833d_setresuid='$d_setresuid'
21834d_setreuid='$d_setreuid'
21835d_setrgid='$d_setrgid'
21836d_setruid='$d_setruid'
21837d_setsent='$d_setsent'
10bc17b6 21838d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
21839d_setsid='$d_setsid'
21840d_setvbuf='$d_setvbuf'
21841d_sfio='$d_sfio'
21842d_shm='$d_shm'
21843d_shmat='$d_shmat'
21844d_shmatprototype='$d_shmatprototype'
21845d_shmctl='$d_shmctl'
21846d_shmdt='$d_shmdt'
21847d_shmget='$d_shmget'
21848d_sigaction='$d_sigaction'
983dbef6 21849d_sigprocmask='$d_sigprocmask'
b4eb6b3d 21850d_sigsetjmp='$d_sigsetjmp'
c95d0e17 21851d_sitearch='$d_sitearch'
4f5da3e9 21852d_snprintf='$d_snprintf'
49a78c82 21853d_sockatmark='$d_sockatmark'
2ef53570 21854d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
21855d_socket='$d_socket'
21856d_socklen_t='$d_socklen_t'
21857d_sockpair='$d_sockpair'
21858d_socks5_init='$d_socks5_init'
360321b3 21859d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
b4eb6b3d 21860d_sqrtl='$d_sqrtl'
10bc17b6
JH
21861d_srand48_r='$d_srand48_r'
21862d_srandom_r='$d_srandom_r'
eef837ea 21863d_sresgproto='$d_sresgproto'
640374d0 21864d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
21865d_statblks='$d_statblks'
21866d_statfs_f_flags='$d_statfs_f_flags'
21867d_statfs_s='$d_statfs_s'
21868d_statvfs='$d_statvfs'
21869d_stdio_cnt_lval='$d_stdio_cnt_lval'
21870d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
21871d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21872d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
21873d_stdio_stream_array='$d_stdio_stream_array'
21874d_stdiobase='$d_stdiobase'
21875d_stdstdio='$d_stdstdio'
21876d_strchr='$d_strchr'
21877d_strcoll='$d_strcoll'
21878d_strctcpy='$d_strctcpy'
21879d_strerrm='$d_strerrm'
21880d_strerror='$d_strerror'
10bc17b6 21881d_strerror_r='$d_strerror_r'
b3c85772 21882d_strftime='$d_strftime'
08c92000
MB
21883d_strlcat='$d_strlcat'
21884d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
21885d_strtod='$d_strtod'
21886d_strtol='$d_strtol'
21887d_strtold='$d_strtold'
21888d_strtoll='$d_strtoll'
28e5dec8 21889d_strtoq='$d_strtoq'
b4eb6b3d
JH
21890d_strtoul='$d_strtoul'
21891d_strtoull='$d_strtoull'
21892d_strtouq='$d_strtouq'
21893d_strxfrm='$d_strxfrm'
21894d_suidsafe='$d_suidsafe'
21895d_symlink='$d_symlink'
21896d_syscall='$d_syscall'
2ef53570 21897d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
21898d_sysconf='$d_sysconf'
21899d_sysernlst='$d_sysernlst'
21900d_syserrlst='$d_syserrlst'
21901d_system='$d_system'
21902d_tcgetpgrp='$d_tcgetpgrp'
21903d_tcsetpgrp='$d_tcsetpgrp'
21904d_telldir='$d_telldir'
21905d_telldirproto='$d_telldirproto'
21906d_time='$d_time'
21907d_times='$d_times'
14b90194
JH
21908d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21909d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 21910d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 21911d_truncate='$d_truncate'
10bc17b6 21912d_ttyname_r='$d_ttyname_r'
b4eb6b3d 21913d_tzname='$d_tzname'
4e0554ec
JH
21914d_u32align='$d_u32align'
21915d_ualarm='$d_ualarm'
b4eb6b3d
JH
21916d_umask='$d_umask'
21917d_uname='$d_uname'
21918d_union_semun='$d_union_semun'
758a5d79 21919d_unordered='$d_unordered'
bdf33aa7 21920d_unsetenv='$d_unsetenv'
4e0554ec 21921d_usleep='$d_usleep'
2ef53570 21922d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
21923d_ustat='$d_ustat'
21924d_vendorarch='$d_vendorarch'
21925d_vendorbin='$d_vendorbin'
21926d_vendorlib='$d_vendorlib'
6e1038e0 21927d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
21928d_vfork='$d_vfork'
21929d_void_closedir='$d_void_closedir'
21930d_voidsig='$d_voidsig'
21931d_voidtty='$d_voidtty'
21932d_volatile='$d_volatile'
21933d_vprintf='$d_vprintf'
4f5da3e9 21934d_vsnprintf='$d_vsnprintf'
b4eb6b3d
JH
21935d_wait4='$d_wait4'
21936d_waitpid='$d_waitpid'
21937d_wcstombs='$d_wcstombs'
21938d_wctomb='$d_wctomb'
4e0554ec 21939d_writev='$d_writev'
5f80c64f
JH
21940d_xenix='$d_xenix'
21941date='$date'
b4eb6b3d
JH
21942db_hashtype='$db_hashtype'
21943db_prefixtype='$db_prefixtype'
640374d0
JH
21944db_version_major='$db_version_major'
21945db_version_minor='$db_version_minor'
21946db_version_patch='$db_version_patch'
b4eb6b3d
JH
21947defvoidused='$defvoidused'
21948direntrytype='$direntrytype'
21949dlext='$dlext'
5f80c64f 21950dlsrc='$dlsrc'
b4eb6b3d
JH
21951doublesize='$doublesize'
21952drand01='$drand01'
10bc17b6 21953drand48_r_proto='$drand48_r_proto'
b4eb6b3d
JH
21954dynamic_ext='$dynamic_ext'
21955eagain='$eagain'
21956ebcdic='$ebcdic'
5f80c64f
JH
21957echo='$echo'
21958egrep='$egrep'
21959emacs='$emacs'
10bc17b6
JH
21960endgrent_r_proto='$endgrent_r_proto'
21961endhostent_r_proto='$endhostent_r_proto'
21962endnetent_r_proto='$endnetent_r_proto'
21963endprotoent_r_proto='$endprotoent_r_proto'
21964endpwent_r_proto='$endpwent_r_proto'
21965endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
21966eunicefix='$eunicefix'
21967exe_ext='$exe_ext'
21968expr='$expr'
b4eb6b3d 21969extensions='$extensions'
6fcddf3b 21970extras='$extras'
b4eb6b3d
JH
21971fflushNULL='$fflushNULL'
21972fflushall='$fflushall'
5f80c64f
JH
21973find='$find'
21974firstmakefile='$firstmakefile'
21975flex='$flex'
b4eb6b3d
JH
21976fpossize='$fpossize'
21977fpostype='$fpostype'
21978freetype='$freetype'
5440bc8e 21979from='$from'
b4eb6b3d
JH
21980full_ar='$full_ar'
21981full_csh='$full_csh'
21982full_sed='$full_sed'
2d736872 21983gccansipedantic='$gccansipedantic'
5b463ca7 21984gccosandvers='$gccosandvers'
5f80c64f 21985gccversion='$gccversion'
10bc17b6
JH
21986getgrent_r_proto='$getgrent_r_proto'
21987getgrgid_r_proto='$getgrgid_r_proto'
21988getgrnam_r_proto='$getgrnam_r_proto'
21989gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21990gethostbyname_r_proto='$gethostbyname_r_proto'
21991gethostent_r_proto='$gethostent_r_proto'
21992getlogin_r_proto='$getlogin_r_proto'
21993getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21994getnetbyname_r_proto='$getnetbyname_r_proto'
21995getnetent_r_proto='$getnetent_r_proto'
21996getprotobyname_r_proto='$getprotobyname_r_proto'
21997getprotobynumber_r_proto='$getprotobynumber_r_proto'
21998getprotoent_r_proto='$getprotoent_r_proto'
21999getpwent_r_proto='$getpwent_r_proto'
22000getpwnam_r_proto='$getpwnam_r_proto'
22001getpwuid_r_proto='$getpwuid_r_proto'
22002getservbyname_r_proto='$getservbyname_r_proto'
22003getservbyport_r_proto='$getservbyport_r_proto'
22004getservent_r_proto='$getservent_r_proto'
22005getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
22006gidformat='$gidformat'
22007gidsign='$gidsign'
22008gidsize='$gidsize'
22009gidtype='$gidtype'
5f80c64f 22010glibpth='$glibpth'
3c728e00 22011gmake='$gmake'
10bc17b6 22012gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 22013gnulibc_version='$gnulibc_version'
5f80c64f 22014grep='$grep'
b4eb6b3d
JH
22015groupcat='$groupcat'
22016groupstype='$groupstype'
5f80c64f 22017gzip='$gzip'
b4eb6b3d
JH
22018h_fcntl='$h_fcntl'
22019h_sysfile='$h_sysfile'
5f80c64f 22020hint='$hint'
b4eb6b3d 22021hostcat='$hostcat'
6e1038e0
MB
22022html1dir='$html1dir'
22023html1direxp='$html1direxp'
22024html3dir='$html3dir'
22025html3direxp='$html3direxp'
b4eb6b3d
JH
22026i16size='$i16size'
22027i16type='$i16type'
22028i32size='$i32size'
22029i32type='$i32type'
22030i64size='$i64size'
22031i64type='$i64type'
22032i8size='$i8size'
22033i8type='$i8type'
22034i_arpainet='$i_arpainet'
22035i_bsdioctl='$i_bsdioctl'
10bc17b6 22036i_crypt='$i_crypt'
b4eb6b3d
JH
22037i_db='$i_db'
22038i_dbm='$i_dbm'
22039i_dirent='$i_dirent'
5f80c64f 22040i_dld='$i_dld'
b4eb6b3d
JH
22041i_dlfcn='$i_dlfcn'
22042i_fcntl='$i_fcntl'
22043i_float='$i_float'
758a5d79
JH
22044i_fp='$i_fp'
22045i_fp_class='$i_fp_class'
b4eb6b3d
JH
22046i_gdbm='$i_gdbm'
22047i_grp='$i_grp'
b4eb6b3d
JH
22048i_ieeefp='$i_ieeefp'
22049i_inttypes='$i_inttypes'
2765b840 22050i_langinfo='$i_langinfo'
b4eb6b3d
JH
22051i_libutil='$i_libutil'
22052i_limits='$i_limits'
22053i_locale='$i_locale'
22054i_machcthr='$i_machcthr'
22055i_malloc='$i_malloc'
22056i_math='$i_math'
22057i_memory='$i_memory'
22058i_mntent='$i_mntent'
22059i_ndbm='$i_ndbm'
22060i_netdb='$i_netdb'
22061i_neterrno='$i_neterrno'
22062i_netinettcp='$i_netinettcp'
22063i_niin='$i_niin'
22064i_poll='$i_poll'
22065i_prot='$i_prot'
22066i_pthread='$i_pthread'
22067i_pwd='$i_pwd'
22068i_rpcsvcdbm='$i_rpcsvcdbm'
22069i_sfio='$i_sfio'
22070i_sgtty='$i_sgtty'
22071i_shadow='$i_shadow'
22072i_socks='$i_socks'
22073i_stdarg='$i_stdarg'
22074i_stddef='$i_stddef'
22075i_stdlib='$i_stdlib'
22076i_string='$i_string'
22077i_sunmath='$i_sunmath'
22078i_sysaccess='$i_sysaccess'
22079i_sysdir='$i_sysdir'
22080i_sysfile='$i_sysfile'
22081i_sysfilio='$i_sysfilio'
22082i_sysin='$i_sysin'
22083i_sysioctl='$i_sysioctl'
22084i_syslog='$i_syslog'
22085i_sysmman='$i_sysmman'
22086i_sysmode='$i_sysmode'
22087i_sysmount='$i_sysmount'
22088i_sysndir='$i_sysndir'
22089i_sysparam='$i_sysparam'
22090i_sysresrc='$i_sysresrc'
22091i_syssecrt='$i_syssecrt'
22092i_sysselct='$i_sysselct'
22093i_syssockio='$i_syssockio'
22094i_sysstat='$i_sysstat'
22095i_sysstatfs='$i_sysstatfs'
22096i_sysstatvfs='$i_sysstatvfs'
22097i_systime='$i_systime'
22098i_systimek='$i_systimek'
22099i_systimes='$i_systimes'
22100i_systypes='$i_systypes'
22101i_sysuio='$i_sysuio'
22102i_sysun='$i_sysun'
22103i_sysutsname='$i_sysutsname'
22104i_sysvfs='$i_sysvfs'
22105i_syswait='$i_syswait'
22106i_termio='$i_termio'
22107i_termios='$i_termios'
22108i_time='$i_time'
22109i_unistd='$i_unistd'
22110i_ustat='$i_ustat'
22111i_utime='$i_utime'
22112i_values='$i_values'
22113i_varargs='$i_varargs'
22114i_varhdr='$i_varhdr'
22115i_vfork='$i_vfork'
5f80c64f 22116ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
22117inc_version_list='$inc_version_list'
22118inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
22119incpath='$incpath'
22120inews='$inews'
f3f1a2d8 22121initialinstalllocation='$initialinstalllocation'
b4eb6b3d
JH
22122installarchlib='$installarchlib'
22123installbin='$installbin'
6e1038e0
MB
22124installhtml1dir='$installhtml1dir'
22125installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
22126installman1dir='$installman1dir'
22127installman3dir='$installman3dir'
22128installprefix='$installprefix'
22129installprefixexp='$installprefixexp'
22130installprivlib='$installprivlib'
22131installscript='$installscript'
22132installsitearch='$installsitearch'
22133installsitebin='$installsitebin'
8d2cbf27
JH
22134installsitehtml1dir='$installsitehtml1dir'
22135installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 22136installsitelib='$installsitelib'
91e123a8
JH
22137installsiteman1dir='$installsiteman1dir'
22138installsiteman3dir='$installsiteman3dir'
6e1038e0 22139installsitescript='$installsitescript'
b4eb6b3d
JH
22140installstyle='$installstyle'
22141installusrbinperl='$installusrbinperl'
22142installvendorarch='$installvendorarch'
22143installvendorbin='$installvendorbin'
8d2cbf27
JH
22144installvendorhtml1dir='$installvendorhtml1dir'
22145installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 22146installvendorlib='$installvendorlib'
91e123a8
JH
22147installvendorman1dir='$installvendorman1dir'
22148installvendorman3dir='$installvendorman3dir'
6e1038e0 22149installvendorscript='$installvendorscript'
b4eb6b3d 22150intsize='$intsize'
4b661809 22151issymlink='$issymlink'
b4eb6b3d
JH
22152ivdformat='$ivdformat'
22153ivsize='$ivsize'
22154ivtype='$ivtype'
22155known_extensions='$known_extensions'
5f80c64f 22156ksh='$ksh'
5f80c64f
JH
22157ld='$ld'
22158lddlflags='$lddlflags'
22159ldflags='$ldflags'
b4eb6b3d
JH
22160ldflags_uselargefiles='$ldflags_uselargefiles'
22161ldlibpthname='$ldlibpthname'
5f80c64f
JH
22162less='$less'
22163lib_ext='$lib_ext'
22164libc='$libc'
b4eb6b3d 22165libperl='$libperl'
5f80c64f
JH
22166libpth='$libpth'
22167libs='$libs'
43999f95
JH
22168libsdirs='$libsdirs'
22169libsfiles='$libsfiles'
22170libsfound='$libsfound'
13b3f787 22171libspath='$libspath'
5f80c64f 22172libswanted='$libswanted'
b4eb6b3d 22173libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
22174line='$line'
22175lint='$lint'
22176lkflags='$lkflags'
22177ln='$ln'
22178lns='$lns'
10bc17b6 22179localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
22180locincpth='$locincpth'
22181loclibpth='$loclibpth'
b4eb6b3d
JH
22182longdblsize='$longdblsize'
22183longlongsize='$longlongsize'
22184longsize='$longsize'
5f80c64f
JH
22185lp='$lp'
22186lpr='$lpr'
22187ls='$ls'
b4eb6b3d
JH
22188lseeksize='$lseeksize'
22189lseektype='$lseektype'
a724edfe 22190mad='$mad'
f3f1a2d8
MB
22191madlyh='$madlyh'
22192madlyobj='$madlyobj'
22193madlysrc='$madlysrc'
5f80c64f
JH
22194mail='$mail'
22195mailx='$mailx'
22196make='$make'
22197make_set_make='$make_set_make'
b4eb6b3d
JH
22198mallocobj='$mallocobj'
22199mallocsrc='$mallocsrc'
22200malloctype='$malloctype'
22201man1dir='$man1dir'
22202man1direxp='$man1direxp'
22203man1ext='$man1ext'
22204man3dir='$man3dir'
22205man3direxp='$man3direxp'
22206man3ext='$man3ext'
5f80c64f 22207mips_type='$mips_type'
5129fff4 22208mistrustnm='$mistrustnm'
5f80c64f 22209mkdir='$mkdir'
b4eb6b3d
JH
22210mmaptype='$mmaptype'
22211modetype='$modetype'
5f80c64f 22212more='$more'
b4eb6b3d 22213multiarch='$multiarch'
5f80c64f 22214mv='$mv'
b4eb6b3d
JH
22215myarchname='$myarchname'
22216mydomain='$mydomain'
22217myhostname='$myhostname'
5f80c64f
JH
22218myuname='$myuname'
22219n='$n'
2cc61e15 22220need_va_copy='$need_va_copy'
b4eb6b3d
JH
22221netdb_hlen_type='$netdb_hlen_type'
22222netdb_host_type='$netdb_host_type'
22223netdb_name_type='$netdb_name_type'
22224netdb_net_type='$netdb_net_type'
5f80c64f
JH
22225nm='$nm'
22226nm_opt='$nm_opt'
22227nm_so_opt='$nm_so_opt'
b4eb6b3d 22228nonxs_ext='$nonxs_ext'
5f80c64f 22229nroff='$nroff'
b4eb6b3d
JH
22230nvEUformat='$nvEUformat'
22231nvFUformat='$nvFUformat'
22232nvGUformat='$nvGUformat'
53133ed1 22233nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
22234nveformat='$nveformat'
22235nvfformat='$nvfformat'
22236nvgformat='$nvgformat'
22237nvsize='$nvsize'
22238nvtype='$nvtype'
22239o_nonblock='$o_nonblock'
5f80c64f 22240obj_ext='$obj_ext'
b4eb6b3d 22241old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 22242optimize='$optimize'
b4eb6b3d 22243orderlib='$orderlib'
5f80c64f
JH
22244osname='$osname'
22245osvers='$osvers'
b4eb6b3d 22246otherlibdirs='$otherlibdirs'
5f80c64f 22247package='$package'
b4eb6b3d
JH
22248pager='$pager'
22249passcat='$passcat'
22250patchlevel='$patchlevel'
5f80c64f 22251path_sep='$path_sep'
b4eb6b3d 22252perl5='$perl5'
5f80c64f 22253perl='$perl'
151e6568 22254perl_patchlevel='$perl_patchlevel'
b4eb6b3d 22255perladmin='$perladmin'
9c839522 22256perllibs='$perllibs'
b4eb6b3d 22257perlpath='$perlpath'
5f80c64f 22258pg='$pg'
b4eb6b3d
JH
22259phostname='$phostname'
22260pidtype='$pidtype'
5f80c64f
JH
22261plibpth='$plibpth'
22262pmake='$pmake'
22263pr='$pr'
b4eb6b3d
JH
22264prefix='$prefix'
22265prefixexp='$prefixexp'
22266privlib='$privlib'
22267privlibexp='$privlibexp'
f24dbf84 22268procselfexe='$procselfexe'
b4eb6b3d
JH
22269prototype='$prototype'
22270ptrsize='$ptrsize'
22271quadkind='$quadkind'
22272quadtype='$quadtype'
22273randbits='$randbits'
22274randfunc='$randfunc'
10bc17b6 22275random_r_proto='$random_r_proto'
b4eb6b3d
JH
22276randseedtype='$randseedtype'
22277ranlib='$ranlib'
22278rd_nodata='$rd_nodata'
10bc17b6
JH
22279readdir64_r_proto='$readdir64_r_proto'
22280readdir_r_proto='$readdir_r_proto'
b4eb6b3d 22281revision='$revision'
5f80c64f
JH
22282rm='$rm'
22283rmail='$rmail'
5440bc8e 22284run='$run'
5f80c64f 22285runnm='$runnm'
b4eb6b3d
JH
22286sPRIEUldbl='$sPRIEUldbl'
22287sPRIFUldbl='$sPRIFUldbl'
22288sPRIGUldbl='$sPRIGUldbl'
22289sPRIXU64='$sPRIXU64'
22290sPRId64='$sPRId64'
22291sPRIeldbl='$sPRIeldbl'
22292sPRIfldbl='$sPRIfldbl'
22293sPRIgldbl='$sPRIgldbl'
22294sPRIi64='$sPRIi64'
22295sPRIo64='$sPRIo64'
22296sPRIu64='$sPRIu64'
22297sPRIx64='$sPRIx64'
22298sSCNfldbl='$sSCNfldbl'
22299sched_yield='$sched_yield'
22300scriptdir='$scriptdir'
22301scriptdirexp='$scriptdirexp'
5f80c64f 22302sed='$sed'
b4eb6b3d
JH
22303seedfunc='$seedfunc'
22304selectminbits='$selectminbits'
22305selecttype='$selecttype'
5f80c64f 22306sendmail='$sendmail'
10bc17b6
JH
22307setgrent_r_proto='$setgrent_r_proto'
22308sethostent_r_proto='$sethostent_r_proto'
22309setlocale_r_proto='$setlocale_r_proto'
22310setnetent_r_proto='$setnetent_r_proto'
22311setprotoent_r_proto='$setprotoent_r_proto'
22312setpwent_r_proto='$setpwent_r_proto'
22313setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
22314sh='$sh'
22315shar='$shar'
22316sharpbang='$sharpbang'
b4eb6b3d
JH
22317shmattype='$shmattype'
22318shortsize='$shortsize'
22319shrpenv='$shrpenv'
5f80c64f 22320shsharp='$shsharp'
b4eb6b3d
JH
22321sig_count='$sig_count'
22322sig_name='$sig_name'
22323sig_name_init='$sig_name_init'
22324sig_num='$sig_num'
22325sig_num_init='$sig_num_init'
76d3c696 22326sig_size='$sig_size'
b4eb6b3d
JH
22327signal_t='$signal_t'
22328sitearch='$sitearch'
22329sitearchexp='$sitearchexp'
22330sitebin='$sitebin'
22331sitebinexp='$sitebinexp'
8d2cbf27
JH
22332sitehtml1dir='$sitehtml1dir'
22333sitehtml1direxp='$sitehtml1direxp'
22334sitehtml3dir='$sitehtml3dir'
22335sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
22336sitelib='$sitelib'
22337sitelib_stem='$sitelib_stem'
22338sitelibexp='$sitelibexp'
91e123a8
JH
22339siteman1dir='$siteman1dir'
22340siteman1direxp='$siteman1direxp'
22341siteman3dir='$siteman3dir'
22342siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
22343siteprefix='$siteprefix'
22344siteprefixexp='$siteprefixexp'
6e1038e0
MB
22345sitescript='$sitescript'
22346sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
22347sizesize='$sizesize'
22348sizetype='$sizetype'
5f80c64f
JH
22349sleep='$sleep'
22350smail='$smail'
5f80c64f 22351so='$so'
b4eb6b3d
JH
22352sockethdr='$sockethdr'
22353socketlib='$socketlib'
22354socksizetype='$socksizetype'
5f80c64f
JH
22355sort='$sort'
22356spackage='$spackage'
22357spitshell='$spitshell'
10bc17b6
JH
22358srand48_r_proto='$srand48_r_proto'
22359srandom_r_proto='$srandom_r_proto'
5f80c64f 22360src='$src'
b4eb6b3d
JH
22361ssizetype='$ssizetype'
22362startperl='$startperl'
5f80c64f 22363startsh='$startsh'
b4eb6b3d
JH
22364static_ext='$static_ext'
22365stdchar='$stdchar'
22366stdio_base='$stdio_base'
22367stdio_bufsiz='$stdio_bufsiz'
22368stdio_cnt='$stdio_cnt'
22369stdio_filbuf='$stdio_filbuf'
22370stdio_ptr='$stdio_ptr'
22371stdio_stream_array='$stdio_stream_array'
10bc17b6 22372strerror_r_proto='$strerror_r_proto'
b4eb6b3d 22373strings='$strings'
5f80c64f 22374submit='$submit'
b4eb6b3d
JH
22375subversion='$subversion'
22376sysman='$sysman'
5f80c64f
JH
22377tail='$tail'
22378tar='$tar'
5440bc8e 22379targetarch='$targetarch'
5f80c64f
JH
22380tbl='$tbl'
22381tee='$tee'
22382test='$test'
b4eb6b3d
JH
22383timeincl='$timeincl'
22384timetype='$timetype'
10bc17b6 22385tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 22386to='$to'
5f80c64f
JH
22387touch='$touch'
22388tr='$tr'
22389trnl='$trnl'
22390troff='$troff'
10bc17b6 22391ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
22392u16size='$u16size'
22393u16type='$u16type'
22394u32size='$u32size'
22395u32type='$u32type'
22396u64size='$u64size'
22397u64type='$u64type'
22398u8size='$u8size'
22399u8type='$u8type'
22400uidformat='$uidformat'
22401uidsign='$uidsign'
22402uidsize='$uidsize'
22403uidtype='$uidtype'
5f80c64f
JH
22404uname='$uname'
22405uniq='$uniq'
b4eb6b3d
JH
22406uquadtype='$uquadtype'
22407use5005threads='$use5005threads'
22408use64bitall='$use64bitall'
22409use64bitint='$use64bitint'
5440bc8e 22410usecrosscompile='$usecrosscompile'
5f80c64f 22411usedl='$usedl'
15b61c98 22412usefaststdio='$usefaststdio'
b4eb6b3d
JH
22413useithreads='$useithreads'
22414uselargefiles='$uselargefiles'
22415uselongdouble='$uselongdouble'
19a100ff 22416usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
22417usemorebits='$usemorebits'
22418usemultiplicity='$usemultiplicity'
22419usemymalloc='$usemymalloc'
5f80c64f 22420usenm='$usenm'
b4eb6b3d
JH
22421useopcode='$useopcode'
22422useperlio='$useperlio'
22423useposix='$useposix'
9514c62b 22424usereentrant='$usereentrant'
d51aaa9d 22425userelocatableinc='$userelocatableinc'
b4eb6b3d
JH
22426usesfio='$usesfio'
22427useshrplib='$useshrplib'
5f106f9c 22428usesitecustomize='$usesitecustomize'
29209bc5 22429usesocks='$usesocks'
b4eb6b3d
JH
22430usethreads='$usethreads'
22431usevendorprefix='$usevendorprefix'
22432usevfork='$usevfork'
5f80c64f
JH
22433usrinc='$usrinc'
22434uuname='$uuname'
b4eb6b3d
JH
22435uvXUformat='$uvXUformat'
22436uvoformat='$uvoformat'
22437uvsize='$uvsize'
22438uvtype='$uvtype'
22439uvuformat='$uvuformat'
22440uvxformat='$uvxformat'
22441vendorarch='$vendorarch'
22442vendorarchexp='$vendorarchexp'
22443vendorbin='$vendorbin'
22444vendorbinexp='$vendorbinexp'
8d2cbf27
JH
22445vendorhtml1dir='$vendorhtml1dir'
22446vendorhtml1direxp='$vendorhtml1direxp'
22447vendorhtml3dir='$vendorhtml3dir'
22448vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
22449vendorlib='$vendorlib'
22450vendorlib_stem='$vendorlib_stem'
22451vendorlibexp='$vendorlibexp'
91e123a8
JH
22452vendorman1dir='$vendorman1dir'
22453vendorman1direxp='$vendorman1direxp'
22454vendorman3dir='$vendorman3dir'
22455vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
22456vendorprefix='$vendorprefix'
22457vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
22458vendorscript='$vendorscript'
22459vendorscriptexp='$vendorscriptexp'
b4eb6b3d 22460version='$version'
861eb78d 22461version_patchlevel_string='$version_patchlevel_string'
d56c5707 22462versiononly='$versiononly'
5f80c64f 22463vi='$vi'
b4eb6b3d 22464voidflags='$voidflags'
5f80c64f 22465xlibpth='$xlibpth'
3659ebf1
JH
22466yacc='$yacc'
22467yaccflags='$yaccflags'
5f80c64f
JH
22468zcat='$zcat'
22469zip='$zip'
22470EOT
22471
22472: Add in command line options if available
22473$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22474
22475: add special variables
22476$test -f $src/patchlevel.h && \
d00b958f 22477awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 22478echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 22479echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
22480
22481: propagate old symbols
22482if $test -f UU/config.sh; then
381aa1ff 22483 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 22484 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 22485 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
22486 set X `cat UU/oldsyms`
22487 shift
22488 case $# in
22489 0) ;;
22490 *)
22491 cat <<EOM
22492Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22493EOM
22494 echo "# Variables propagated from previous config.sh file." >>config.sh
22495 for sym in `cat UU/oldsyms`; do
22496 echo " Propagating $hint variable "'$'"$sym..."
22497 eval 'tmp="$'"${sym}"'"'
22498 echo "$tmp" | \
22499 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22500 done
22501 ;;
22502 esac
22503fi
22504
22505: Finish up by extracting the .SH files
22506case "$alldone" in
22507exit)
22508 $rm -rf UU
24ccb310 22509 echo "Extraction done."
5f80c64f
JH
22510 exit 0
22511 ;;
22512cont)
22513 ;;
22514'')
22515 dflt=''
22516 nostick=true
22517 $cat <<EOM
22518
22519If you'd like to make any changes to the config.sh file before I begin
22520to configure things, do it as a shell escape now (e.g. !vi config.sh).
22521
22522EOM
22523 rp="Press return or use a shell escape to edit config.sh:"
22524 . UU/myread
22525 nostick=''
22526 case "$ans" in
22527 '') ;;
22528 *) : in case they cannot read
22529 sh 1>&4 -c "$ans";;
22530 esac
22531 ;;
22532esac
22533
22534: if this fails, just run all the .SH files by hand
22535. ./config.sh
22536
22537echo " "
22538exec 1>&4
a43e8593 22539pwd=`pwd`
5f80c64f 22540. ./UU/extract
6904989c 22541cd "$pwd"
5f80c64f
JH
22542
22543if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22544 dflt=y
22545 case "$silent" in
22546 true) ;;
22547 *)
22548 $cat <<EOM
22549
22550Now you need to generate make dependencies by running "$make depend".
22551You might prefer to run it in background: "$make depend > makedepend.out &"
22552It can take a while, so you might not want to run it right now.
22553
22554EOM
22555 ;;
22556 esac
22557 rp="Run $make depend now?"
22558 . UU/myread
22559 case "$ans" in
22560 y*)
3d5d58b1 22561 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
22562 ;;
22563 *)
22564 echo "You must run '$make depend' then '$make'."
22565 ;;
22566 esac
22567elif test -f [Mm]akefile; then
22568 echo " "
22569 echo "Now you must run a $make."
22570else
24ccb310 22571 echo "Configure done."
5f80c64f
JH
22572fi
22573
22574if $test -f Policy.sh; then
22575 $cat <<EOM
22576
22577If you compile $package on a different machine or from a different object
22578directory, copy the Policy.sh file from this object directory to the
22579new one before you run Configure -- this will help you with most of
22580the policy defaults.
22581
22582EOM
22583fi
22584if $test -f config.msg; then
22585 echo "Hmm. I also noted the following information while running:"
22586 echo " "
22587 $cat config.msg >&4
22588 $rm -f config.msg
22589fi
22590$rm -f kit*isdone ark*isdone
22591$rm -rf UU
22592
22593: End of Configure
22594