This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
merge perly.y and madlu.y
[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#
7c345082 29# Generated on Mon Dec 4 16:19:54 CET 2006 [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
JH
797d_ustat=''
798d_vfork=''
799usevfork=''
800d_voidsig=''
801signal_t=''
802d_volatile=''
803d_charvspr=''
804d_vprintf=''
805d_wait4=''
806d_waitpid=''
807d_wcstombs=''
808d_wctomb=''
4e0554ec 809d_writev=''
b4eb6b3d 810dlext=''
85e6fe83
LW
811cccdlflags=''
812ccdlflags=''
2304df62 813dlsrc=''
232e078e 814ld=''
85e6fe83 815lddlflags=''
2304df62 816usedl=''
b4eb6b3d
JH
817doublesize=''
818ebcdic=''
819fflushNULL=''
820fflushall=''
821fpossize=''
822fpostype=''
2d736872 823gccansipedantic=''
5b463ca7 824gccosandvers=''
8a27cf78 825gccversion=''
b4eb6b3d
JH
826gidformat=''
827gidsign=''
828gidsize=''
829gidtype=''
830groupstype=''
831h_fcntl=''
832h_sysfile=''
6e1038e0
MB
833html1dir=''
834html1direxp=''
835installhtml1dir=''
836html3dir=''
837html3direxp=''
838installhtml3dir=''
b4eb6b3d 839i_arpainet=''
10bc17b6 840i_crypt=''
b4eb6b3d
JH
841db_hashtype=''
842db_prefixtype=''
640374d0
JH
843db_version_major=''
844db_version_minor=''
845db_version_patch=''
b4eb6b3d
JH
846i_db=''
847i_dbm=''
848i_rpcsvcdbm=''
849d_dirnamlen=''
850direntrytype=''
851i_dirent=''
a0d0e21e 852i_dld=''
b4eb6b3d
JH
853i_dlfcn=''
854i_fcntl=''
855i_float=''
758a5d79
JH
856i_fp=''
857i_fp_class=''
b4eb6b3d
JH
858i_gdbm=''
859d_grpasswd=''
860i_grp=''
b4eb6b3d
JH
861i_ieeefp=''
862i_inttypes=''
2765b840 863i_langinfo=''
b4eb6b3d
JH
864i_libutil=''
865i_limits=''
866i_locale=''
867i_machcthr=''
868i_malloc=''
869i_math=''
870i_memory=''
871i_mntent=''
872i_ndbm=''
873i_netdb=''
874i_neterrno=''
875i_netinettcp=''
876i_niin=''
877i_sysin=''
878i_poll=''
879i_prot=''
880i_pthread=''
881d_pwage=''
882d_pwchange=''
883d_pwclass=''
884d_pwcomment=''
885d_pwexpire=''
886d_pwgecos=''
887d_pwpasswd=''
888d_pwquota=''
889i_pwd=''
890i_sfio=''
891i_shadow=''
892i_socks=''
893i_stddef=''
894i_stdlib=''
895i_string=''
896strings=''
897i_sunmath=''
898i_sysaccess=''
899i_sysdir=''
900i_sysfile=''
901d_voidtty=''
902i_bsdioctl=''
903i_sysfilio=''
904i_sysioctl=''
905i_syssockio=''
906i_syslog=''
907i_sysmman=''
908i_sysmode=''
909i_sysmount=''
910i_sysndir=''
911i_sysparam=''
912i_sysresrc=''
913i_syssecrt=''
914i_sysselct=''
915i_sysstat=''
916i_sysstatfs=''
917i_sysstatvfs=''
918i_systimes=''
919i_systypes=''
920i_sysuio=''
921i_sysun=''
922i_sysutsname=''
923i_sysvfs=''
924i_syswait=''
925i_sgtty=''
926i_termio=''
927i_termios=''
14b90194
JH
928d_tm_tm_gmtoff=''
929d_tm_tm_zone=''
b4eb6b3d
JH
930i_systime=''
931i_systimek=''
932i_time=''
933timeincl=''
934i_unistd=''
935i_ustat=''
936i_utime=''
937i_values=''
938i_stdarg=''
939i_varargs=''
940i_varhdr=''
941i_vfork=''
f3f1a2d8 942d_inc_version_list=''
b4eb6b3d
JH
943inc_version_list=''
944inc_version_list_init=''
945installprefix=''
946installprefixexp=''
947installstyle=''
948installusrbinperl=''
949intsize=''
950longsize=''
951shortsize=''
4b661809 952issymlink=''
2304df62 953libc=''
b4eb6b3d
JH
954ldlibpthname=''
955libperl=''
956shrpenv=''
957useshrplib=''
a0d0e21e 958glibpth=''
2304df62 959libpth=''
8e07c86e 960loclibpth=''
2304df62
AD
961plibpth=''
962xlibpth=''
1cfa4ec7 963ignore_versioned_solibs=''
2304df62 964libs=''
43999f95
JH
965libsdirs=''
966libsfiles=''
967libsfound=''
13b3f787 968libspath=''
85e6fe83 969lns=''
b4eb6b3d
JH
970d_PRIEUldbl=''
971d_PRIFUldbl=''
972d_PRIGUldbl=''
973d_PRIeldbl=''
974d_PRIfldbl=''
975d_PRIgldbl=''
976d_SCNfldbl=''
977sPRIEUldbl=''
978sPRIFUldbl=''
979sPRIGUldbl=''
980sPRIeldbl=''
981sPRIfldbl=''
982sPRIgldbl=''
983sSCNfldbl=''
984lseeksize=''
985lseektype=''
d620c7b3 986mad=''
00e74f14
NC
987madlyh=''
988madlyobj=''
989madlysrc=''
f3f1a2d8
MB
990make_set_make=''
991d_mymalloc=''
992freetype=''
b4eb6b3d
JH
993mallocobj=''
994mallocsrc=''
995malloctype=''
9df442c2 996usemallocwrap=''
b4eb6b3d
JH
997usemymalloc=''
998installman1dir=''
999man1dir=''
1000man1direxp=''
1001man1ext=''
1002installman3dir=''
1003man3dir=''
1004man3direxp=''
1005man3ext=''
1006modetype=''
1007multiarch=''
1008mydomain=''
1009myhostname=''
1010phostname=''
2304df62
AD
1011c=''
1012n=''
b4eb6b3d
JH
1013d_eofnblk=''
1014eagain=''
1015o_nonblock=''
1016rd_nodata=''
2cc61e15 1017need_va_copy=''
b4eb6b3d
JH
1018netdb_hlen_type=''
1019netdb_host_type=''
1020netdb_name_type=''
1021netdb_net_type=''
1022groupcat=''
1023hostcat=''
1024passcat=''
1025orderlib=''
1026ranlib=''
1027d_perl_otherlibdirs=''
1028otherlibdirs=''
2304df62
AD
1029package=''
1030spackage=''
b4eb6b3d
JH
1031pager=''
1032api_revision=''
1033api_subversion=''
1034api_version=''
1035api_versionstring=''
1036patchlevel=''
151e6568 1037perl_patchlevel=''
b4eb6b3d
JH
1038revision=''
1039subversion=''
1040version=''
861eb78d 1041version_patchlevel_string=''
b4eb6b3d
JH
1042perl5=''
1043perladmin=''
1044perlpath=''
1045d_nv_preserves_uv=''
f607920a 1046d_nv_zero_is_allbits_zero=''
b4eb6b3d
JH
1047i16size=''
1048i16type=''
1049i32size=''
1050i32type=''
1051i64size=''
1052i64type=''
1053i8size=''
1054i8type=''
1055ivsize=''
1056ivtype=''
53133ed1 1057nv_preserves_uv_bits=''
b4eb6b3d
JH
1058nvsize=''
1059nvtype=''
1060u16size=''
1061u16type=''
1062u32size=''
1063u32type=''
1064u64size=''
1065u64type=''
1066u8size=''
1067u8type=''
1068uvsize=''
1069uvtype=''
1070ivdformat=''
1071nvEUformat=''
1072nvFUformat=''
1073nvGUformat=''
1074nveformat=''
1075nvfformat=''
1076nvgformat=''
1077uvXUformat=''
1078uvoformat=''
1079uvuformat=''
1080uvxformat=''
1081pidtype=''
1082prefix=''
1083prefixexp=''
1084installprivlib=''
1085privlib=''
1086privlibexp=''
1087prototype=''
1088ptrsize=''
1089d_PRIXU64=''
1090d_PRId64=''
1091d_PRIi64=''
1092d_PRIo64=''
1093d_PRIu64=''
1094d_PRIx64=''
1095sPRIXU64=''
1096sPRId64=''
1097sPRIi64=''
1098sPRIo64=''
1099sPRIu64=''
1100sPRIx64=''
1101d_quad=''
1102quadkind=''
1103quadtype=''
1104uquadtype=''
1105drand01=''
1106randbits=''
1107randfunc=''
1108randseedtype=''
1109seedfunc=''
1110installscript=''
1111scriptdir=''
1112scriptdirexp=''
1113selectminbits=''
1114selecttype=''
8ff267be 1115sh=''
b4eb6b3d
JH
1116sig_count=''
1117sig_name=''
1118sig_name_init=''
1119sig_num=''
1120sig_num_init=''
76d3c696 1121sig_size=''
f3f1a2d8 1122d_sitearch=''
b4eb6b3d
JH
1123installsitearch=''
1124sitearch=''
1125sitearchexp=''
1126installsitebin=''
1127sitebin=''
1128sitebinexp=''
8d2cbf27
JH
1129installsitehtml1dir=''
1130sitehtml1dir=''
1131sitehtml1direxp=''
1132installsitehtml3dir=''
1133sitehtml3dir=''
1134sitehtml3direxp=''
b4eb6b3d
JH
1135installsitelib=''
1136sitelib=''
1137sitelib_stem=''
1138sitelibexp=''
91e123a8
JH
1139installsiteman1dir=''
1140siteman1dir=''
1141siteman1direxp=''
1142installsiteman3dir=''
1143siteman3dir=''
1144siteman3direxp=''
b4eb6b3d
JH
1145siteprefix=''
1146siteprefixexp=''
6e1038e0
MB
1147installsitescript=''
1148sitescript=''
1149sitescriptexp=''
b4eb6b3d
JH
1150sizesize=''
1151sizetype=''
a0d0e21e 1152so=''
b4eb6b3d 1153socksizetype=''
2304df62
AD
1154sharpbang=''
1155shsharp=''
1156spitshell=''
dfe9444c 1157src=''
b4eb6b3d
JH
1158ssizetype=''
1159startperl=''
2304df62 1160startsh=''
b4eb6b3d
JH
1161stdchar=''
1162d_stdio_stream_array=''
1163stdio_stream_array=''
1164sysman=''
5ff3f7a4 1165trnl=''
b4eb6b3d
JH
1166uidformat=''
1167uidsign=''
1168uidsize=''
1169uidtype=''
1170archname64=''
1171use64bitall=''
1172use64bitint=''
15b61c98 1173usefaststdio=''
b4eb6b3d
JH
1174ccflags_uselargefiles=''
1175ldflags_uselargefiles=''
1176libswanted_uselargefiles=''
1177uselargefiles=''
1178uselongdouble=''
1179usemorebits=''
1180usemultiplicity=''
2304df62 1181nm_opt=''
40a7a20a 1182nm_so_opt=''
2304df62
AD
1183runnm=''
1184usenm=''
b4eb6b3d 1185useperlio=''
29209bc5 1186usesocks=''
b4eb6b3d
JH
1187d_oldpthreads=''
1188use5005threads=''
1189useithreads=''
9514c62b 1190usereentrant=''
b4eb6b3d 1191usethreads=''
2304df62 1192incpath=''
2304df62
AD
1193mips_type=''
1194usrinc=''
b4eb6b3d
JH
1195d_vendorarch=''
1196installvendorarch=''
1197vendorarch=''
1198vendorarchexp=''
1199d_vendorbin=''
1200installvendorbin=''
1201vendorbin=''
1202vendorbinexp=''
8d2cbf27
JH
1203installvendorhtml1dir=''
1204vendorhtml1dir=''
1205vendorhtml1direxp=''
1206installvendorhtml3dir=''
1207vendorhtml3dir=''
1208vendorhtml3direxp=''
b4eb6b3d
JH
1209d_vendorlib=''
1210installvendorlib=''
1211vendorlib=''
1212vendorlib_stem=''
1213vendorlibexp=''
91e123a8
JH
1214installvendorman1dir=''
1215vendorman1dir=''
1216vendorman1direxp=''
1217installvendorman3dir=''
1218vendorman3dir=''
1219vendorman3direxp=''
b4eb6b3d
JH
1220usevendorprefix=''
1221vendorprefix=''
1222vendorprefixexp=''
6e1038e0
MB
1223d_vendorscript=''
1224installvendorscript=''
1225vendorscript=''
1226vendorscriptexp=''
d56c5707 1227versiononly=''
b4eb6b3d
JH
1228defvoidused=''
1229voidflags=''
3659ebf1
JH
1230yacc=''
1231yaccflags=''
2304df62
AD
1232CONFIG=''
1233
ecfc5424
AD
1234define='define'
1235undef='undef'
1236smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1237rmlist=''
1238
1239: We must find out about Eunice early
1240eunicefix=':'
1241if test -f /etc/unixtovms; then
1242 eunicefix=/etc/unixtovms
1243fi
1244if test -f /etc/unixtovms.exe; then
1245 eunicefix=/etc/unixtovms.exe
1246fi
1247
cfb04860 1248: Set executable suffix now -- needed before hints available
6153ba32
PG
1249if test -f "/libs/version.library"; then
1250: Amiga OS
1251 _exe=""
1252elif test -f "/system/gnu_library/bin/ar.pm"; then
1253: Stratus VOS
cfb04860 1254 _exe=".pm"
6153ba32
PG
1255elif test -n "$DJGPP"; then
1256: DOS DJGPP
cfb04860 1257 _exe=".exe"
5c728af0 1258elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1259: OS/2 or cygwin
ba863942
JH
1260 _exe=".exe"
1261fi
868439a2 1262
b4eb6b3d 1263i_whoami=''
9da7673b
MB
1264ccname=''
1265ccversion=''
1266perllibs=''
1267: set useposix=false in your hint file to disable the POSIX extension.
1268useposix=true
1269: set useopcode=false in your hint file to disable the Opcode extension.
1270useopcode=true
1271: Trailing extension. Override this in a hint file, if needed.
1272: Extra object files, if any, needed on this platform.
1273archobjs=''
1274archname=''
ff935051
JH
1275: Possible local include directories to search.
1276: Set locincpth to "" in a hint file to defeat local include searches.
1277locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1278locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1279:
1280: no include file wanted by default
1281inclwanted=''
1282
eaf812ae
MB
1283: Enable -DEBUGGING and -DDEBUGGING from the command line
1284EBUGGING=''
1285DEBUGGING=old
1286
b4eb6b3d 1287groupstype=''
64615a5e 1288libnames=''
732c9516
JH
1289: change the next line if compiling for Xenix/286 on Xenix/386
1290xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1291: Possible local library directories to search.
1292loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1293loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1294
1295: general looking path for locating libraries
5869b1f1 1296glibpth="/lib /usr/lib $xlibpth"
732c9516 1297glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1298test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1299test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1300
1301: Private path used by Configure to find libraries. Its value
1302: is prepended to libpth. This variable takes care of special
1303: machines, like the mips. Usually, it should be empty.
1304plibpth=''
1305
1cfa4ec7
GS
1306: default library list
1307libswanted=''
921b2963 1308: some systems want to use only the non-versioned libso:s
1cfa4ec7 1309ignore_versioned_solibs=''
9da7673b
MB
1310siteman1dir=''
1311siteman3dir=''
1312sitescript=''
b4eb6b3d
JH
1313archname64=''
1314ccflags_uselargefiles=''
1315ldflags_uselargefiles=''
1316libswanted_uselargefiles=''
1317: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1318: set usesocks on the Configure command line to enable socks.
b4eb6b3d 1319: set usethreads on the Configure command line to enable threads.
cd040c5e 1320usereentrant='undef'
9da7673b
MB
1321: full support for void wanted by default
1322defvoidused=15
1323
ecfc5424 1324: List of libraries we want.
15431986 1325: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef
AB
1326libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1327libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1328: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1329: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1330glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1331glibpth="/usr/shlib $glibpth"
1332: Do not use vfork unless overridden by a hint file.
1333usevfork=false
1334
8ff267be 1335: Find the basic shell for Bourne shell scripts
1336case "$sh" in
1337'')
8ff267be 1338 case "$SYSTYPE" in
1339 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1340 *) xxx='/bin/sh';;
1341 esac
1342 if test -f "$xxx"; then
1343 sh="$xxx"
1344 else
1345 : Build up a list and do a single loop so we can 'break' out.
1346 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1347 for xxx in sh bash ksh pdksh ash; do
1348 for p in $pth; do
1349 try="$try ${p}/${xxx}"
1350 done
1351 done
1352 for xxx in $try; do
1353 if test -f "$xxx"; then
1354 sh="$xxx";
8ff267be 1355 break
a5a94ea5
JH
1356 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1357 sh="$xxx";
1358 break
8ff267be 1359 elif test -f "$xxx.exe"; then
1360 sh="$xxx";
8ff267be 1361 break
1362 fi
1363 done
1364 fi
1365 ;;
1366esac
1367
1368case "$sh" in
a33c94aa 1369'') cat >&2 <<EOM
8ff267be 1370$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1371
8ff267be 1372Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1373Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1374we'll try to straighten this all out.
8ff267be 1375EOM
1376 exit 1
1377 ;;
1378esac
1379
760ac839 1380: see if sh knows # comments
73614538 1381if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1382 shsharp=true
1383 spitshell=cat
760ac839 1384 xcat=/bin/cat
a931254c
JH
1385 test -f $xcat$_exe || xcat=/usr/bin/cat
1386 if test ! -f $xcat$_exe; then
4bdb8fb5 1387 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1388 if test -f $p/cat$_exe; then
1deb0a86 1389 xcat=$p/cat
3c728e00
JH
1390 break
1391 fi
1392 done
1deb0a86
JH
1393 if test ! -f $xcat$_exe; then
1394 echo "Can't find cat anywhere!"
3c728e00
JH
1395 exit 1
1396 fi
1397 fi
5440bc8e
JH
1398 echo "#!$xcat" >sharp
1399 $eunicefix sharp
1400 chmod +x sharp
1401 ./sharp > today
760ac839 1402 if test -s today; then
760ac839
LW
1403 sharpbang='#!'
1404 else
5440bc8e
JH
1405 echo "#! $xcat" > sharp
1406 $eunicefix sharp
1407 chmod +x sharp
1408 ./sharp > today
760ac839 1409 if test -s today; then
760ac839
LW
1410 sharpbang='#! '
1411 else
760ac839
LW
1412 sharpbang=': use '
1413 fi
1414 fi
1415else
dfe9444c 1416 echo " "
8ff267be 1417 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1418 shsharp=false
1419 cd ..
1420 echo "exec grep -v '^[ ]*#'" >spitshell
1421 chmod +x spitshell
1422 $eunicefix spitshell
1423 spitshell=`pwd`/spitshell
1424 cd UU
1425 echo "I presume that if # doesn't work, #! won't work either!"
1426 sharpbang=': use '
1427fi
5440bc8e 1428rm -f sharp today
760ac839
LW
1429
1430: figure out how to guarantee sh startup
8ff267be 1431case "$startsh" in
1432'') startsh=${sharpbang}${sh} ;;
1433*)
760ac839 1434esac
5440bc8e 1435cat >sharp <<EOSS
760ac839
LW
1436$startsh
1437set abc
1438test "$?abc" != 1
1439EOSS
1440
5440bc8e
JH
1441chmod +x sharp
1442$eunicefix sharp
1443if ./sharp; then
8ff267be 1444 : echo "Yup, it does."
760ac839 1445else
dfe9444c
AD
1446 echo "Hmm... '$startsh' does not guarantee sh startup..."
1447 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1448fi
5440bc8e 1449rm -f sharp
760ac839 1450
aebf16e7
AD
1451
1452: Save command line options in file UU/cmdline.opt for later use in
1453: generating config.sh.
1454cat > cmdline.opt <<EOSH
1455# Configure command line arguments.
1456config_arg0='$0'
1457config_args='$*'
1458config_argc=$#
1459EOSH
1460argn=1
ee45ea83
IZ
1461args_exp=''
1462args_sep=''
aebf16e7
AD
1463for arg in "$@"; do
1464 cat >>cmdline.opt <<EOSH
1465config_arg$argn='$arg'
1466EOSH
ee45ea83
IZ
1467 # Extreme backslashitis: replace each ' by '"'"'
1468 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1469$arg
1470EOC
1471 arg_exp=`cat cmdl.opt`
1472 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1473 argn=`expr $argn + 1`
ee45ea83 1474 args_sep=' '
aebf16e7 1475done
ee45ea83
IZ
1476# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1477# used by ./hints/os2.sh
1478rm -f cmdl.opt
aebf16e7 1479
2304df62
AD
1480: produce awk script to parse command line options
1481cat >options.awk <<'EOF'
1482BEGIN {
02e93a22 1483 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1484
1485 len = length(optstr);
1486 for (i = 1; i <= len; i++) {
1487 c = substr(optstr, i, 1);
1488 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1489 if (a == ":") {
1490 arg[c] = 1;
1491 i++;
1492 }
1493 opt[c] = 1;
1494 }
1495}
1496{
1497 expect = 0;
1498 str = $0;
1499 if (substr(str, 1, 1) != "-") {
1500 printf("'%s'\n", str);
1501 next;
1502 }
1503 len = length($0);
1504 for (i = 2; i <= len; i++) {
1505 c = substr(str, i, 1);
1506 if (!opt[c]) {
1507 printf("-%s\n", substr(str, i));
1508 next;
1509 }
1510 printf("-%s\n", c);
1511 if (arg[c]) {
1512 if (i < len)
1513 printf("'%s'\n", substr(str, i + 1));
1514 else
1515 expect = 1;
1516 next;
1517 }
1518 }
1519}
1520END {
1521 if (expect)
1522 print "?";
1523}
1524EOF
1525
1526: process the command line options
4633a7c4
LW
1527set X `for arg in "$@"; do echo "X$arg"; done |
1528 sed -e s/X// | awk -f options.awk`
2304df62
AD
1529eval "set $*"
1530shift
1531rm -f options.awk
1532
1533: set up default values
1534fastread=''
1535reuseval=false
1536config_sh=''
1537alldone=''
1538error=''
1539silent=''
1540extractsh=''
ecfc5424 1541override=''
16d20bd9 1542knowitall=''
02e93a22 1543rm -f optdef.sh posthint.sh
28757baa 1544cat >optdef.sh <<EOS
1545$startsh
1546EOS
2304df62 1547
dfe9444c 1548
2304df62
AD
1549: option parsing
1550while test $# -gt 0; do
1551 case "$1" in
1552 -d) shift; fastread=yes;;
1553 -e) shift; alldone=cont;;
1554 -f)
1555 shift
1556 cd ..
1557 if test -r "$1"; then
1558 config_sh="$1"
1559 else
a0d0e21e 1560 echo "$me: cannot read config file $1." >&2
2304df62
AD
1561 error=true
1562 fi
1563 cd UU
1564 shift;;
1565 -h) shift; error=true;;
1566 -r) shift; reuseval=true;;
dfe9444c 1567 -s) shift; silent=true; realsilent=true;;
2304df62 1568 -E) shift; alldone=exit;;
16d20bd9 1569 -K) shift; knowitall=true;;
ecfc5424 1570 -O) shift; override=true;;
dfe9444c 1571 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1572 -D)
1573 shift
1574 case "$1" in
1575 *=)
1576 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1577 echo "$me: ignoring -D $1" >&2
1578 ;;
ecfc5424 1579 *=*) echo "$1" | \
1aef975c
AD
1580 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1581 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1582 esac
1583 shift
1584 ;;
1585 -U)
1586 shift
1587 case "$1" in
1aef975c 1588 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1589 *=*)
1590 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1591 echo "$me: ignoring -U $1" >&2
1592 ;;
1aef975c 1593 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1594 esac
1595 shift
1596 ;;
02e93a22
JH
1597 -A)
1598 shift
1599 xxx=''
1600 yyy="$1"
02e93a22 1601 zzz=''
5f83a3e9 1602 uuu=undef
02e93a22 1603 case "$yyy" in
f7c31117 1604 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1605 case "$zzz" in
1606 *:*) zzz='' ;;
1607 *) xxx=append
f7c31117
JH
1608 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1609 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1610 esac
1611 ;;
1612 esac
1613 case "$xxx" in
1614 '') case "$yyy" in
f7c31117
JH
1615 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1616 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1617 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1618 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1619 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1620 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9
JH
1621 esac
1622 ;;
1623 esac
02e93a22
JH
1624 case "$xxx" in
1625 append)
5f83a3e9 1626 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1627 clear)
5f83a3e9 1628 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1629 define)
1630 case "$zzz" in
1631 '') zzz=define ;;
1632 esac
5f83a3e9 1633 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1634 eval)
5f83a3e9 1635 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1636 prepend)
5f83a3e9 1637 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1638 undef)
1639 case "$zzz" in
1640 '') zzz="$uuu" ;;
1641 esac
5f83a3e9
JH
1642 echo "$yyy=$zzz" >> posthint.sh ;;
1643 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1644 esac
bde6b06b 1645 shift
02e93a22 1646 ;;
dfe9444c 1647 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1648 exit 0;;
2304df62 1649 --) break;;
a0d0e21e 1650 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1651 *) break;;
1652 esac
1653done
1654
1655case "$error" in
1656true)
1657 cat >&2 <<EOM
2afac517 1658Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1659 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1660 -d : use defaults for all answers.
1661 -e : go on without questioning past the production of config.sh.
1662 -f : specify an alternate default configuration file.
1663 -h : print this help message and exit (with an error status).
1664 -r : reuse C symbols value if possible (skips costly nm extraction).
1665 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1666 -D : define symbol to have some value:
1667 -D symbol symbol gets the value 'define'
1668 -D symbol=value symbol gets the value 'value'
2304df62 1669 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1670 -K : do not use unless you know what you are doing.
ecfc5424 1671 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1672 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1673 -U : undefine symbol:
1674 -U symbol symbol gets the value 'undef'
1675 -U symbol= symbol gets completely empty
02e93a22 1676 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1677 -A symbol=value append " "value to symbol
02e93a22
JH
1678 -A append:symbol=value append value to symbol
1679 -A define:symbol=value define symbol to have value
02e93a22
JH
1680 -A clear:symbol define symbol to be ''
1681 -A define:symbol define symbol to be 'define'
1682 -A eval:symbol=value define symbol to be eval of value
1683 -A prepend:symbol=value prepend value to symbol
1684 -A undef:symbol define symbol to be 'undef'
1685 -A undef:symbol= define symbol to be ''
2304df62
AD
1686 -V : print version number and exit (with a zero status).
1687EOM
1688 exit 1
1689 ;;
1690esac
1691
dfe9444c
AD
1692: Sanity checks
1693case "$fastread$alldone" in
1694yescont|yesexit) ;;
1695*)
aaeb8e51
GS
1696 case "$extractsh" in
1697 true) ;;
1698 *)
1699 if test ! -t 0; then
1700 echo "Say 'sh Configure', not 'sh <Configure'"
1701 exit 1
1702 fi
1703 ;;
1704 esac
dfe9444c
AD
1705 ;;
1706esac
1707
2304df62
AD
1708exec 4>&1
1709case "$silent" in
1710true) exec 1>/dev/null;;
1711esac
1712
ecfc5424 1713: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1714touch optdef.sh
1715. ./optdef.sh
02e93a22
JH
1716: create the posthint manipulation script and leave the file out there...
1717touch posthint.sh
a0d0e21e 1718
2304df62 1719: set package name
85e6fe83 1720package=perl5
b4eb6b3d
JH
1721first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1722last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1723case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1724ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1725*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1726esac
2304df62 1727
2304df62
AD
1728: Some greps do not return status, grrr.
1729echo "grimblepritz" >grimble
1730if grep blurfldyick grimble >/dev/null 2>&1 ; then
1731 contains=contains
1732elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1733 contains=grep
1734else
1735 contains=contains
1736fi
1737rm -f grimble
1738: the following should work in any shell
1739case "$contains" in
1740contains*)
1741 echo " "
1742 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1743 cat >contains <<'EOSS'
1744grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1745EOSS
1746chmod +x contains
1747esac
1748
dfe9444c
AD
1749: Find the path to the source tree
1750case "$src" in
1751'') case "$0" in
b233458b
JH
1752 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1753 case "$src" in
1754 /*) ;;
8504afb7 1755 .) ;;
b233458b
JH
1756 *) src=`cd ../$src && pwd` ;;
1757 esac
1758 ;;
dfe9444c
AD
1759 *) src='.';;
1760 esac;;
1761esac
1762case "$src" in
1763'') src=/
1764 rsrc=/
1765 ;;
1766/*) rsrc="$src";;
1767*) rsrc="../$src";;
1768esac
1769if test -f $rsrc/Configure && \
1770 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1771then
1772 : found it, so we are ok.
1773else
1774 rsrc=''
1775 for src in . .. ../.. ../../.. ../../../..; do
1776 if test -f ../$src/Configure && \
1777 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1778 then
1779 rsrc=../$src
1780 break
1781 fi
1782 done
1783fi
1784case "$rsrc" in
1785'')
1786 cat <<EOM >&4
1787
1788Sorry, I can't seem to locate the source dir for $package. Please start
1789Configure with an explicit path -- i.e. /some/path/Configure.
1790
1791EOM
1792 exit 1
1793 ;;
1794../.) rsrc='..';;
1795*)
1796 echo " "
1797 echo "Sources for $package found in \"$src\"." >&4
1798 ;;
1799esac
1800
1801: script used to extract .SH files with variable substitutions
1802cat >extract <<'EOS'
a02608de 1803PERL_CONFIG_SH=true
dfe9444c 1804echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1805if test -f MANIFEST; then
1806 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1807else
1808 echo "(Looking for .SH files under the source directory.)"
6904989c 1809 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1810fi
1811shift
1812case $# in
6904989c 18130) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1814esac
6904989c 1815if test ! -f "$src/$1"; then
dfe9444c
AD
1816 shift
1817fi
1818mkdir_p='
1819name=$1;
1820create="";
1821while test $name; do
1822 if test ! -d "$name"; then
1823 create="$name $create";
1824 name=`echo $name | sed -e "s|^[^/]*$||"`;
1825 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1826 else
1827 name="";
1828 fi;
1829done;
1830for file in $create; do
1831 mkdir $file;
1832done
1833'
1834for file in $*; do
1835 case "$src" in
1836 ".")
1837 case "$file" in
1838 */*)
1839 dir=`expr X$file : 'X\(.*\)/'`
1840 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1841 (cd "$dir" && . ./$file)
dfe9444c
AD
1842 ;;
1843 *)
1844 . ./$file
1845 ;;
1846 esac
1847 ;;
1848 *)
1849 case "$file" in
1850 */*)
1851 dir=`expr X$file : 'X\(.*\)/'`
1852 file=`expr X$file : 'X.*/\(.*\)'`
1853 (set x $dir; shift; eval $mkdir_p)
6904989c 1854 sh <"$src/$dir/$file"
dfe9444c
AD
1855 ;;
1856 *)
6904989c 1857 sh <"$src/$file"
dfe9444c
AD
1858 ;;
1859 esac
1860 ;;
1861 esac
1862done
6904989c 1863if test -f "$src/config_h.SH"; then
dfe9444c
AD
1864 if test ! -f config.h; then
1865 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1866 . "$src/config_h.SH"
dfe9444c
AD
1867 fi
1868fi
1869EOS
1870
1871: extract files and exit if asked to do so
1872case "$extractsh" in
1873true)
1874 case "$realsilent" in
1875 true) ;;
1876 *) exec 1>&4;;
1877 esac
1878 case "$config_sh" in
1879 '') config_sh='config.sh';;
1880 esac
1881 echo " "
1882 echo "Fetching answers from $config_sh..."
1883 cd ..
1884 . $config_sh
1885 test "$override" && . ./optdef.sh
1886 echo " "
1887 . UU/extract
1888 rm -rf UU
24ccb310 1889 echo "Extraction done."
dfe9444c
AD
1890 exit 0
1891 ;;
1892esac
1893
1894: Eunice requires " " instead of "", can you believe it
1895echo " "
1896: Here we go...
1897echo "Beginning of configuration questions for $package."
1898
1899trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1900
2304df62
AD
1901: first determine how to suppress newline on echo command
1902echo " "
1903echo "Checking echo to see how to suppress newlines..."
1904(echo "hi there\c" ; echo " ") >.echotmp
1905if $contains c .echotmp >/dev/null 2>&1 ; then
1906 echo "...using -n."
1907 n='-n'
1908 c=''
1909else
1910 cat <<'EOM'
1911...using \c
1912EOM
1913 n=''
1914 c='\c'
1915fi
1916echo $n "The star should be here-->$c"
1917echo '*'
1918rm -f .echotmp
1919
1920: Now test for existence of everything in MANIFEST
1921echo " "
6904989c 1922if test -f "$rsrc/MANIFEST"; then
2304df62 1923 echo "First let's make sure your kit is complete. Checking..." >&4
4242830c 1924 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
2304df62 1925 rm -f missing
dfe9444c 1926 tmppwd=`pwd`
2304df62 1927 for filelist in x??; do
6904989c 1928 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1929 done
1930 if test -s missing; then
1931 cat missing >&4
1932 cat >&4 <<'EOM'
1933
1934THIS PACKAGE SEEMS TO BE INCOMPLETE.
1935
1936You have the option of continuing the configuration process, despite the
1937distinct possibility that your kit is damaged, by typing 'y'es. If you
1938do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1939and contact the author (perlbug@perl.org).
2304df62
AD
1940
1941EOM
1942 echo $n "Continue? [n] $c" >&4
1943 read ans
1944 case "$ans" in
1945 y*)
1946 echo "Continuing..." >&4
1947 rm -f missing
1948 ;;
1949 *)
1950 echo "ABORTING..." >&4
1951 kill $$
1952 ;;
1953 esac
1954 else
dfe9444c 1955 echo "Looks good..."
2304df62
AD
1956 fi
1957else
1958 echo "There is no MANIFEST file. I hope your kit is complete !"
1959fi
1960rm -f missing x??
1961
5ff3f7a4
GS
1962echo " "
1963: Find the appropriate value for a newline for tr
1964if test -n "$DJGPP"; then
1965 trnl='\012'
1966fi
1967if test X"$trnl" = X; then
1968 case "`echo foo|tr '\n' x 2>/dev/null`" in
1969 foox) trnl='\n' ;;
1970 esac
1971fi
1972if test X"$trnl" = X; then
1973 case "`echo foo|tr '\012' x 2>/dev/null`" in
1974 foox) trnl='\012' ;;
1975 esac
1976fi
1977if test X"$trnl" = X; then
8be2c24c
JH
1978 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1979 fooxy) trnl='\n\r' ;;
1980 esac
1981fi
1982if test X"$trnl" = X; then
5ff3f7a4
GS
1983 cat <<EOM >&2
1984
1985$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1986
1987EOM
1988 exit 1
1989fi
1990
2304df62
AD
1991: compute the number of columns on the terminal for proper question formatting
1992case "$COLUMNS" in
1993'') COLUMNS='80';;
1994esac
1995
1996: set up the echo used in my read
1997myecho="case \"\$xxxm\" in
1998'') echo $n \"\$rp $c\" >&4;;
1999*) case \"\$rp\" in
2000 '') echo $n \"[\$xxxm] $c\";;
2001 *)
2002 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
2003 echo \"\$rp\" >&4
2004 echo $n \"[\$xxxm] $c\" >&4
2005 else
2006 echo $n \"\$rp [\$xxxm] $c\" >&4
2007 fi
2008 ;;
2009 esac;;
2010esac"
2011
2012: now set up to do reads with possible shell escape and default assignment
2013cat <<EOSC >myread
28757baa 2014$startsh
2304df62
AD
2015xxxm=\$dflt
2016$myecho
2017ans='!'
2018case "\$fastread" in
2019yes) case "\$dflt" in
2020 '') ;;
2021 *) ans='';
2022 case "\$silent-\$rp" in
2023 true-) ;;
2024 *) echo " " >&4;;
2025 esac;;
2026 esac;;
2027*) case "\$silent" in
2028 true) case "\$rp" in
2029 '') ans='';;
2030 esac;;
2031 esac;;
2032esac
2033while expr "X\$ans" : "X!" >/dev/null; do
2034 read answ
2035 set x \$xxxm
2036 shift
dfe9444c 2037 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 2038 case "\$answ" in
dfe9444c
AD
2039 "!")
2040 sh 1>&4
2041 echo " "
2042 $myecho
2043 ;;
2044 !*)
2045 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2046 shift
2047 sh 1>&4 -c "\$*"
2048 echo " "
2049 $myecho
2050 ;;
2304df62
AD
2051 "\$ans")
2052 case "\$ans" in
ecfc5424
AD
2053 \\&*)
2054 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2055 shift
2056 case "\$1" in
2057 -d)
2058 fastread=yes
40a7a20a 2059 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2060 ;;
2061 -*)
40a7a20a 2062 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2063 ;;
2064 esac
2065 $myecho
2066 ans=!
2067 ;;
2304df62
AD
2068 esac;;
2069 *)
2070 case "\$aok" in
2071 y)
2072 echo "*** Substitution done -- please confirm."
2073 xxxm="\$ans"
c9795ab7 2074 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2075 xxxm="\$ans"
2076 ans=!
2077 ;;
2078 *)
2079 echo "*** Error -- try again."
2080 ans=!
2081 ;;
2082 esac
2083 $myecho
2084 ;;
2085 esac
2086 case "\$ans\$xxxm\$nostick" in
2087 '')
2088 ans=!
2089 $myecho
2090 ;;
2091 esac
2092done
2093case "\$ans" in
2094'') ans="\$xxxm";;
2095esac
2096EOSC
2097
2098: create .config dir to save info across Configure sessions
2099test -d ../.config || mkdir ../.config
2100cat >../.config/README <<EOF
2101This directory created by Configure to save information that should
dfe9444c 2102persist across sessions for $package.
2304df62
AD
2103
2104You may safely delete it if you wish.
2105EOF
2106
9507cadf 2107xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2108case "$usedevel" in
0107c034 2109$define|true|[yY]*) ;;
9507cadf 2110*) case "$xversion" in
0107c034
JH
2111 *[13579])
2112 cat >&4 <<EOH
2113*** WHOA THERE!!! ***
2114
2115 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2116 The version of this $package distribution is $xversion, that is, odd,
2117 (as opposed to even) and that signifies a development release.
3d5d58b1 2118 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2119
2120 Do ***NOT*** install this into production use.
2121 Data corruption and crashes are possible.
2122
2123 It is most seriously suggested that you do not continue any further
2124 unless you want to help in developing and debugging Perl.
2125
6adc6a45
JH
2126 If you *still* want to build perl, you can answer 'y' now,
2127 or pass -Dusedevel to Configure.
2128
0107c034
JH
2129EOH
2130 rp='Do you really want to continue?'
2131 dflt='n'
2132 . ./myread
2133 case "$ans" in
8feeef0e
JH
2134 [yY]) echo >&4 "Okay, continuing."
2135 usedevel="$define" ;;
0107c034
JH
2136 *) echo >&4 "Okay, bye."
2137 exit 1
2138 ;;
2139 esac
2140 ;;
2141 esac
2142 ;;
2143esac
8feeef0e
JH
2144case "$usedevel" in
2145$define|true|[yY]*)
2146 case "$versiononly" in
2147 '') versiononly="$define" ;;
2148 esac
2149 case "$installusrbinperl" in
2150 '') installusrbinperl="$undef" ;;
2151 esac
2152 ;;
2153esac
0107c034 2154
2304df62
AD
2155: general instructions
2156needman=true
2157firsttime=true
760ac839 2158user=`(logname) 2>/dev/null`
dfe9444c
AD
2159case "$user" in
2160'') user=`whoami 2>&1`;;
760ac839 2161esac
2304df62
AD
2162if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2163 firsttime=false
2164 echo " "
2165 rp='Would you like to see the instructions?'
2166 dflt=n
2167 . ./myread
2168 case "$ans" in
2169 [yY]*) ;;
2170 *) needman=false;;
2171 esac
2172fi
2173if $needman; then
2174 cat <<EOH
4e2a5f63 2175
2304df62 2176This installation shell script will examine your system and ask you questions
a0d0e21e 2177to determine how the perl5 package should be installed. If you get
2304df62
AD
2178stuck on a question, you may use a ! shell escape to start a subshell or
2179execute a command. Many of the questions will have default answers in square
2180brackets; typing carriage return will give you the default.
2181
2182On some of the questions which ask for file or directory names you are allowed
2183to use the ~name construct to specify the login directory belonging to "name",
2184even if you don't have a shell which knows about that. Questions where this is
2185allowed will be marked "(~name ok)".
2186
2187EOH
2188 rp=''
2189 dflt='Type carriage return to continue'
2190 . ./myread
2191 cat <<'EOH'
2192
2193The prompter used in this script allows you to use shell variables and
2194backticks in your answers. You may use $1, $2, etc... to refer to the words
2195in the default answer, as if the default line was a set of arguments given to a
2196script shell. This means you may also use $* to repeat the whole default line,
2197so you do not have to re-type everything to add something to the default.
2198
2199Everytime there is a substitution, you will have to confirm. If there is an
2200error (e.g. an unmatched backtick), the default answer will remain unchanged
2201and you will be prompted again.
2202
2203If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2204the questions and use the computed defaults (or the previous answers if there
2205was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2206You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2207on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2208
2209EOH
2210 . ./myread
2211 cat <<EOH
2212
2213Much effort has been expended to ensure that this shell script will run on any
2214Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2215Configure and run it again. If you can't run Configure for some reason,
2216you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2217have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2218
2219This installation script affects things in two ways:
2220
22211) it may do direct variable substitutions on some of the files included
2222 in this kit.
22232) it builds a config.h file for inclusion in C programs. You may edit
2224 any of these files as the need arises after running this script.
2225
2226If you make a mistake on a question, there is no easy way to back up to it
2227currently. The easiest thing to do is to edit config.sh and rerun all the SH
2228files. Configure will offer to let you do this before it runs the SH files.
2229
2230EOH
2231 dflt='Type carriage return to continue'
2232 . ./myread
2233 case "$firsttime" in
2234 true) echo $user >>../.config/instruct;;
2235 esac
2236fi
2237
2304df62
AD
2238: find out where common programs are
2239echo " "
2240echo "Locating common programs..." >&4
2241cat <<EOSC >loc
2242$startsh
2243case \$# in
22440) exit 1;;
2245esac
2246thing=\$1
2247shift
2248dflt=\$1
2249shift
2250for dir in \$*; do
2251 case "\$thing" in
2252 .)
2253 if test -d \$dir/\$thing; then
2254 echo \$dir
2255 exit 0
2256 fi
2257 ;;
2258 *)
a0d0e21e 2259 for thisthing in \$dir/\$thing; do
ecfc5424 2260 : just loop through to pick last item
a0d0e21e 2261 done
25f94b33 2262 if test -f \$thisthing; then
a0d0e21e 2263 echo \$thisthing
2304df62 2264 exit 0
a5a94ea5
JH
2265 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2266 echo \$thisthing
2267 exit 0
2304df62 2268 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2269 if test -n "$DJGPP"; then
2270 echo \$dir/\$thing.exe
b921d661 2271 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2272 : on Eunice apparently
2273 echo \$dir/\$thing
b921d661 2274 exit 0
c4f23d77 2275 fi
2d736872 2276 exit 0
2304df62
AD
2277 fi
2278 ;;
2279 esac
2280done
2281echo \$dflt
2282exit 1
2283EOSC
2284chmod +x loc
2285$eunicefix loc
2286loclist="
2287awk
2288cat
f8006fac 2289chmod
b4eb6b3d
JH
2290comm
2291cp
2304df62
AD
2292echo
2293expr
2294grep
a0d0e21e 2295ls
b4eb6b3d 2296mkdir
2304df62
AD
2297rm
2298sed
b4eb6b3d 2299sort
85e6fe83 2300touch
2304df62 2301tr
b4eb6b3d 2302uniq
2304df62
AD
2303"
2304trylist="
2305Mcc
dfe9444c 2306ar
3659ebf1 2307bison
b4eb6b3d 2308byacc
2304df62 2309cpp
b4eb6b3d 2310csh
2304df62
AD
2311date
2312egrep
1fef16b3 2313gmake
8ff267be 2314gzip
b4eb6b3d 2315less
8ff267be 2316ln
3c728e00 2317make
b4eb6b3d 2318more
693762b4 2319nm
b4eb6b3d
JH
2320nroff
2321pg
2304df62
AD
2322test
2323uname
8ff267be 2324zip
2304df62 2325"
8e07c86e 2326pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2327pth="$pth /lib /usr/lib"
2328for file in $loclist; do
dfe9444c
AD
2329 eval xxx=\$$file
2330 case "$xxx" in
2331 /*|?:[\\/]*)
2332 if test -f "$xxx"; then
2333 : ok
2334 else
2335 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2336 xxx=`./loc $file $file $pth`
2337 fi
2338 ;;
2339 '') xxx=`./loc $file $file $pth`;;
2340 *) xxx=`./loc $xxx $xxx $pth`;;
2341 esac
a5a94ea5 2342 eval $file=$xxx$_exe
2304df62
AD
2343 eval _$file=$xxx
2344 case "$xxx" in
2345 /*)
2346 echo $file is in $xxx.
2347 ;;
8e07c86e
AD
2348 ?:[\\/]*)
2349 echo $file is in $xxx.
2350 ;;
2304df62 2351 *)
25f94b33
AD
2352 echo "I don't know where '$file' is, and my life depends on it." >&4
2353 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2354 exit 1
2304df62
AD
2355 ;;
2356 esac
2357done
2358echo " "
2359echo "Don't worry if any of the following aren't found..."
2360say=offhand
2361for file in $trylist; do
dfe9444c
AD
2362 eval xxx=\$$file
2363 case "$xxx" in
2364 /*|?:[\\/]*)
2365 if test -f "$xxx"; then
2366 : ok
2367 else
2368 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2369 xxx=`./loc $file $file $pth`
2370 fi
2371 ;;
2372 '') xxx=`./loc $file $file $pth`;;
2373 *) xxx=`./loc $xxx $xxx $pth`;;
2374 esac
306a8474 2375 eval $file=$xxx$_exe
2304df62
AD
2376 eval _$file=$xxx
2377 case "$xxx" in
2378 /*)
2379 echo $file is in $xxx.
2380 ;;
8e07c86e
AD
2381 ?:[\\/]*)
2382 echo $file is in $xxx.
2383 ;;
2304df62
AD
2384 *)
2385 echo "I don't see $file out there, $say."
2386 say=either
2387 ;;
2388 esac
2389done
2390case "$egrep" in
1fef16b3 2391egrep)
2304df62
AD
2392 echo "Substituting grep for egrep."
2393 egrep=$grep
868439a2 2394 _egrep=$grep
2304df62
AD
2395 ;;
2396esac
8ff267be 2397case "$ln" in
1fef16b3 2398ln)
8ff267be 2399 echo "Substituting cp for ln."
2400 ln=$cp
868439a2 2401 _ln=$cp
8ff267be 2402 ;;
2403esac
2e26f1d5
JH
2404case "$make" in
2405make)
2406 case "$gmake" in
2407 gmake)
2408 echo "I can't find make or gmake, and my life depends on it." >&4
2409 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2410 exit 1
2411 ;;
2412 esac
2413 ;;
2414esac
2415case "$gmake" in
2416gmake) ;;
2417*) # We can't have osname yet.
1fef16b3
JH
2418 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2419 # Assume that gmake, if found, is definitely GNU make
2420 # and prefer it over the system make.
2421 echo "Substituting gmake for make."
2422 make=$gmake
868439a2 2423 _make=$gmake
1fef16b3
JH
2424 fi
2425 ;;
a5a94ea5 2426esac
2304df62
AD
2427case "$test" in
2428test)
2429 echo "Hopefully test is built into your sh."
2430 ;;
2431*)
73614538 2432 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2433 echo "Using the test built into your sh."
2304df62
AD
2434 test=test
2435 _test=test
2436 fi
2437 ;;
2438esac
2439case "$echo" in
2440echo)
2441 echo "Hopefully echo is built into your sh."
2442 ;;
2443'') ;;
2444*)
2445 echo " "
2446echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2447 $echo $n "hi there$c" >foo1
2448 echo $n "hi there$c" >foo2
2449 if cmp foo1 foo2 >/dev/null 2>&1; then
2450 echo "They are compatible. In fact, they may be identical."
2451 else
2452 case "$n" in
2453 '-n') n='' c='\c';;
2454 *) n='-n' c='';;
2455 esac
2456 cat <<FOO
2457They are not compatible! You are probably running ksh on a non-USG system.
2458I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2459have echo built in and we may have to run some Bourne shell scripts. That
2460means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2461
2462FOO
2463 $echo $n "The star should be here-->$c"
2464 $echo "*"
2465 fi
2466 $rm -f foo1 foo2
2467 ;;
2468esac
2469
6b769f8f 2470cat <<EOS >trygcc
2573c5f9
JH
2471$startsh
2472EOS
6b769f8f 2473cat <<'EOSC' >>trygcc
2573c5f9
JH
2474case "$cc" in
2475'') ;;
2476*) $rm -f try try.*
2477 $cat >try.c <<EOM
2478int main(int argc, char *argv[]) {
2479 return 0;
2480}
2481EOM
e4778687 2482 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2483 :
2484 else
2485 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2486 despair=yes
2487 trygcc=yes
2488 case "$cc" in
2489 *gcc*) trygcc=no ;;
2490 esac
2491 case "`$cc -v -c try.c 2>&1`" in
2492 *gcc*) trygcc=no ;;
2493 esac
2494 if $test X"$trygcc" = Xyes; then
2495 if gcc -o try -c try.c; then
2496 echo " "
2497 echo "You seem to have a working gcc, though." >&4
2498 rp="Would you like to use it?"
2499 dflt=y
2500 if $test -f myread; then
2501 . ./myread
2502 else
2503 if $test -f UU/myread; then
2504 . ./UU/myread
2505 else
2506 echo "Cannot find myread, sorry. Aborting." >&2
2507 exit 1
2508 fi
2509 fi
2510 case "$ans" in
6371411c
RB
2511 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2512 if $test -f usethreads.cbu; then
2513 $cat >&4 <<EOM
2514
2515*** However, any setting of the C compiler flags (e.g. for thread support)
2516*** has been lost. It may be necessary to pass -Dcc=gcc to Configure
2517*** (together with e.g. -Dusethreads).
2518
2519EOM
2520 fi;;
2573c5f9
JH
2521 esac
2522 fi
2523 fi
6b769f8f
RB
2524 fi
2525 $rm -f try try.*
2526 ;;
2527esac
2528EOSC
2529
2530cat <<EOS >checkcc
2531$startsh
2532EOS
2533cat <<'EOSC' >>checkcc
2534case "$cc" in
2535'') ;;
2536*) $rm -f try try.*
2537 $cat >try.c <<EOM
2538int main(int argc, char *argv[]) {
2539 return 0;
2540}
2541EOM
2542 if $cc -o try $ccflags $ldflags try.c; then
2543 :
2544 else
2573c5f9 2545 if $test X"$despair" = Xyes; then
6b769f8f
RB
2546 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2547 fi
2548 $cat >&4 <<EOM
5dd4fbdf
MB
2549You need to find a working C compiler.
2550Either (purchase and) install the C compiler supplied by your OS vendor,
2551or for a free C compiler try http://gcc.gnu.org/
2552I cannot continue any further, aborting.
2553EOM
6b769f8f 2554 exit 1
2573c5f9
JH
2555 fi
2556 $rm -f try try.*
2557 ;;
2558esac
2559EOSC
2560
a0d0e21e
LW
2561: determine whether symbolic links are supported
2562echo " "
2563$touch blurfl
2564if $ln -s blurfl sym > /dev/null 2>&1 ; then
2565 echo "Symbolic links are supported." >&4
818f00be 2566 lns="$ln -s"
a0d0e21e
LW
2567else
2568 echo "Symbolic links are NOT supported." >&4
2569 lns="$ln"
2570fi
2571$rm -f blurfl sym
2572
dafca956
JH
2573: determine whether symbolic links are supported
2574echo " "
2575case "$lns" in
18ea2752 2576*"ln"*" -s")
dafca956
JH
2577 echo "Checking how to test for symbolic links..." >&4
2578 $lns blurfl sym
4b661809 2579 if $test "X$issymlink" = X; then
2e2a97a6
JH
2580 case "$newsh" in
2581 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2582 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2583 esac
5d644a95
MB
2584 if test $? = 0; then
2585 issymlink="test -h"
2e2a97a6
JH
2586 else
2587 echo "Your builtin 'test -h' may be broken." >&4
2588 case "$test" in
2589 /*) ;;
2590 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2591 for p in $pth
2592 do
2593 if test -f "$p/$test"; then
2594 test="$p/$test"
2595 break
2596 fi
2597 done
2598 ;;
2599 esac
2600 case "$test" in
2601 /*)
2602 echo "Trying external '$test -h'." >&4
2603 issymlink="$test -h"
2604 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2605 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2606 issymlink=''
2607 fi
2608 ;;
2609 *) issymlink='' ;;
2610 esac
5d644a95
MB
2611 fi
2612 fi
4b661809 2613 if $test "X$issymlink" = X; then
dafca956 2614 if $test -L sym 2>/dev/null; then
5d644a95 2615 issymlink="$test -L"
2e2a97a6 2616 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2617 fi
2618 fi
4b661809 2619 if $test "X$issymlink" != X; then
5d644a95 2620 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2621 else
2622 echo "I do not know how you can test for symbolic links." >&4
2623 fi
2624 $rm -f blurfl sym
2625 ;;
2626*) echo "No symbolic links, so not testing for their testing..." >&4
2627 ;;
2628esac
2629echo " "
2630
2631
2632case "$mksymlinks" in
2633$define|true|[yY]*)
2634 case "$src" in
2635 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2636 exit 1
2637 ;;
4b661809 2638 *) case "$lns:$issymlink" in
f314eb9f 2639 *"ln"*" -s:"*"test -"?)
dafca956
JH
2640 echo "Creating the symbolic links..." >&4
2641 echo "(First creating the subdirectories...)" >&4
2642 cd ..
2643 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2644 read directory
2645 test -z "$directory" && break
2646 mkdir -p $directory
2647 done
2648 # Sanity check 1.
2649 if test ! -d t/base; then
2650 echo "Failed to create the subdirectories. Aborting." >&4
2651 exit 1
2652 fi
2653 echo "(Then creating the symlinks...)" >&4
2654 awk '{print $1}' $src/MANIFEST | while true; do
2655 read filename
2656 test -z "$filename" && break
2657 if test -f $filename; then
5d644a95 2658 if $issymlink $filename; then
dafca956
JH
2659 rm -f $filename
2660 fi
2661 fi
2662 if test -f $filename; then
2663 echo "$filename already exists, not symlinking."
2664 else
2665 ln -s $src/$filename $filename
2666 fi
2667 done
2668 # Sanity check 2.
a0d24b8a
JH
2669 if test ! -f t/base/lex.t; then
2670 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2671 exit 1
2672 fi
2673 cd UU
2674 ;;
2675 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2676 ;;
2677 esac
2678 ;;
2679 esac
2680 ;;
2681esac
2682
5440bc8e
JH
2683
2684case "$usecrosscompile" in
2685$define|true|[yY]*)
93bc48fa 2686 $echo "Cross-compiling..."
5440bc8e
JH
2687 croak=''
2688 case "$cc" in
2689 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2690 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2691 ar=$targetarch-ar
2692 # leave out ld, choosing it is more complex
2693 nm=$targetarch-nm
2694 ranlib=$targetarch-ranlib
93bc48fa 2695 $echo 'extern int foo;' > try.c
f8006fac 2696 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2697 shift
2698 if $test $# -gt 0; then
2699 incpth="$incpth $*"
f8006fac
JH
2700 incpth="`$echo $incpth|$sed 's/^ //'`"
2701 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2702 for i in $*; do
f8006fac 2703 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2704 if $test -d $j; then
2705 libpth="$libpth $j"
2706 fi
2707 done
f8006fac
JH
2708 libpth="`$echo $libpth|$sed 's/^ //'`"
2709 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2710 fi
2711 $rm -f try.c
5440bc8e
JH
2712 ;;
2713 esac
2714 case "$targetarch" in
93bc48fa
JH
2715 '') echo "Targetarch not defined." >&4; croak=y ;;
2716 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2717 esac
2718 case "$incpth" in
93bc48fa 2719 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2720 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2721 esac
2722 case "$libpth" in
93bc48fa 2723 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2724 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2725 esac
93bc48fa
JH
2726 case "$usrinc" in
2727 '') for i in $incpth; do
2728 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2729 usrinc=$i
2730 echo "Guessing usrinc $usrinc." >&4
2731 break
2732 fi
2733 done
2734 case "$usrinc" in
2735 '') echo "Usrinc not defined." >&4; croak=y ;;
2736 esac
2737 ;;
2738 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2739 esac
93bc48fa
JH
2740 case "$targethost" in
2741 '') echo "Targethost not defined." >&4; croak=y ;;
2742 *) echo "Using targethost $targethost." >&4
5440bc8e 2743 esac
93bc48fa
JH
2744 locincpth=' '
2745 loclibpth=' '
5440bc8e 2746 case "$croak" in
93bc48fa 2747 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2748 esac
2749 case "$src" in
2750 /*) run=$src/Cross/run
93c0359c 2751 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2752 to=$src/Cross/to
2753 from=$src/Cross/from
2754 ;;
93bc48fa 2755 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2756 run=$pwd/Cross/run
f8006fac 2757 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2758 to=$pwd/Cross/to
2759 from=$pwd/Cross/from
2760 ;;
2761 esac
2762 case "$targetrun" in
2763 '') targetrun=ssh ;;
2764 esac
2765 case "$targetto" in
2766 '') targetto=scp ;;
2767 esac
2768 case "$targetfrom" in
2769 '') targetfrom=scp ;;
2770 esac
2771 run=$run-$targetrun
2772 to=$to-$targetto
2773 from=$from-$targetfrom
93bc48fa
JH
2774 case "$targetdir" in
2775 '') targetdir=/tmp
2776 echo "Guessing targetdir $targetdir." >&4
2777 ;;
2778 esac
5440bc8e 2779 case "$targetuser" in
93bc48fa
JH
2780 '') targetuser=root
2781 echo "Guessing targetuser $targetuser." >&4
2782 ;;
5440bc8e
JH
2783 esac
2784 case "$targetfrom" in
2785 scp) q=-q ;;
2786 *) q='' ;;
2787 esac
2788 case "$targetrun" in
2789 ssh|rsh)
2790 cat >$run <<EOF
2791#!/bin/sh
93c0359c
JH
2792case "\$1" in
2793-cwd)
2794 shift
2795 cwd=\$1
2796 shift
2797 ;;
2798esac
2799case "\$cwd" in
2800'') cwd=$targetdir ;;
2801esac
5440bc8e
JH
2802exe=\$1
2803shift
93c0359c
JH
2804if $test ! -f \$exe.xok; then
2805 $to \$exe
2806 $touch \$exe.xok
2807fi
2808$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2809EOF
2810 ;;
93bc48fa 2811 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2812 exit 1
2813 ;;
2814 esac
93c0359c
JH
2815 case "$targetmkdir" in
2816 */Cross/mkdir)
2817 cat >$targetmkdir <<EOF
2818#!/bin/sh
2819$targetrun -l $targetuser $targethost "mkdir -p \$@"
2820EOF
f8006fac 2821 $chmod a+rx $targetmkdir
93c0359c
JH
2822 ;;
2823 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2824 exit 1
2825 ;;
2826 esac
5440bc8e
JH
2827 case "$targetto" in
2828 scp|rcp)
2829 cat >$to <<EOF
2830#!/bin/sh
2831for f in \$@
2832do
93c0359c
JH
2833 case "\$f" in
2834 /*)
2835 $targetmkdir \`dirname \$f\`
2836 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2837 ;;
2838 *)
2839 $targetmkdir $targetdir/\`dirname \$f\`
2840 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2841 ;;
2842 esac
5440bc8e
JH
2843done
2844exit 0
2845EOF
2846 ;;
2847 cp) cat >$to <<EOF
2848#!/bin/sh
93c0359c
JH
2849for f in \$@
2850do
2851 case "\$f" in
2852 /*)
2853 $mkdir -p $targetdir/\`dirname \$f\`
2854 $cp \$f $targetdir/\$f || exit 1
2855 ;;
2856 *)
2857 $targetmkdir $targetdir/\`dirname \$f\`
2858 $cp \$f $targetdir/\$f || exit 1
2859 ;;
2860 esac
2861done
2862exit 0
5440bc8e
JH
2863EOF
2864 ;;
93bc48fa 2865 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2866 exit 1
2867 ;;
2868 esac
2869 case "$targetfrom" in
2870 scp|rcp)
2871 cat >$from <<EOF
2872#!/bin/sh
2873for f in \$@
2874do
93c0359c 2875 $rm -f \$f
5440bc8e
JH
2876 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2877done
2878exit 0
2879EOF
2880 ;;
2881 cp) cat >$from <<EOF
2882#!/bin/sh
2883for f in \$@
2884do
93c0359c 2885 $rm -f \$f
5440bc8e
JH
2886 cp $targetdir/\$f . || exit 1
2887done
2888exit 0
2889EOF
2890 ;;
93bc48fa 2891 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2892 exit 1
2893 ;;
2894 esac
93bc48fa
JH
2895 if $test ! -f $run; then
2896 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2897 else
f8006fac 2898 $chmod a+rx $run
5440bc8e 2899 fi
93bc48fa
JH
2900 if $test ! -f $to; then
2901 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2902 else
f8006fac 2903 $chmod a+rx $to
5440bc8e 2904 fi
93bc48fa
JH
2905 if $test ! -f $from; then
2906 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2907 else
f8006fac 2908 $chmod a+rx $from
5440bc8e 2909 fi
93bc48fa 2910 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2911 exit 1
2912 fi
2913 cat >&4 <<EOF
f8006fac
JH
2914Using '$run' for remote execution,
2915and '$from' and '$to'
93bc48fa 2916for remote file transfer.
5440bc8e
JH
2917EOF
2918 ;;
2919*) run=''
2920 to=:
2921 from=:
2922 usecrosscompile='undef'
2923 targetarch=''
2924 ;;
2925esac
2926
ecfc5424
AD
2927: see whether [:lower:] and [:upper:] are supported character classes
2928echo " "
ecfc5424
AD
2929case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2930ABYZ)
2931 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2932 up='[:upper:]'
2933 low='[:lower:]'
2934 ;;
416d0bea
MB
2935*) # There is a discontinuity in EBCDIC between 'R' and 'S'
2936 # (0xd9 and 0xe2), therefore that is a nice testing point.
2937 if test "X$up" = X -o "X$low" = X; then
2938 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2939 rs) up='[A-Z]'
2940 low='[a-z]'
28e8609d
JH
2941 ;;
2942 esac
416d0bea 2943 fi
28e8609d 2944 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2945 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2946 rs) up='A-Z'
28e8609d
JH
2947 low='a-z'
2948 ;;
2949 esac
416d0bea 2950 fi
28e8609d 2951 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2952 case "`echo RS | od -x 2>/dev/null`" in
2953 *D9E2*|*d9e2*)
28e8609d
JH
2954 echo "Hey, this might be EBCDIC." >&4
2955 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2956 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2957 rs) up='[A-IJ-RS-Z]'
2958 low='[a-ij-rs-z]'
28e8609d
JH
2959 ;;
2960 esac
2961 fi
2962 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2963 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2964 rs) up='A-IJ-RS-Z'
2965 low='a-ij-rs-z'
28e8609d
JH
2966 ;;
2967 esac
2968 fi
2969 ;;
2970 esac
2971 fi
2972esac
416d0bea
MB
2973case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2974rs)
28e8609d
JH
2975 echo "Using $up and $low to convert case." >&4
2976 ;;
ecfc5424 2977*)
28e8609d
JH
2978 echo "I don't know how to translate letters from upper to lower case." >&4
2979 echo "Your tr is not acting any way I know of." >&4
2980 exit 1
2981 ;;
ecfc5424
AD
2982esac
2983: set up the translation script tr, must be called with ./tr of course
2984cat >tr <<EOSC
2985$startsh
2986case "\$1\$2" in
2987'[A-Z][a-z]') exec $tr '$up' '$low';;
2988'[a-z][A-Z]') exec $tr '$low' '$up';;
2989esac
2990exec $tr "\$@"
2991EOSC
2992chmod +x tr
2993$eunicefix tr
2994
2304df62
AD
2995: Try to determine whether config.sh was made on this system
2996case "$config_sh" in
2997'')
43999f95
JH
2998myuname=`$uname -a 2>/dev/null`
2999$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
3000# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3001# because the A-Z/a-z are not consecutive.
a0d0e21e 3002myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 3003 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 3004newmyuname="$myuname"
2304df62 3005dflt=n
16d20bd9
AD
3006case "$knowitall" in
3007'')
3008 if test -f ../config.sh; then
3009 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3010 eval "`grep myuname= ../config.sh`"
3011 fi
3012 if test "X$myuname" = "X$newmyuname"; then
3013 dflt=y
3014 fi
2304df62 3015 fi
16d20bd9
AD
3016 ;;
3017*) dflt=y;;
3018esac
2304df62
AD
3019
3020: Get old answers from old config file if Configure was run on the
3021: same system, otherwise use the hints.
3022hint=default
3023cd ..
3024if test -f config.sh; then
16d20bd9
AD
3025 echo " "
3026 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
3027 . UU/myread
3028 case "$ans" in
f83701cd
AD
3029 n*|N*) echo "OK, I'll ignore it."
3030 mv config.sh config.sh.old
3031 myuname="$newmyuname"
3032 ;;
2304df62 3033 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
3034 tmp_n="$n"
3035 tmp_c="$c"
85cad39c 3036 tmp_sh="$sh"
2304df62
AD
3037 . ./config.sh
3038 cp config.sh UU
ecfc5424
AD
3039 n="$tmp_n"
3040 c="$tmp_c"
85cad39c 3041 : Older versions did not always set $sh. Catch re-use of such
3042 : an old config.sh.
3043 case "$sh" in
3044 '') sh="$tmp_sh" ;;
3045 esac
2304df62
AD
3046 hint=previous
3047 ;;
3048 esac
3049fi
2573c5f9 3050. ./UU/checkcc
2304df62
AD
3051if test ! -f config.sh; then
3052 $cat <<EOM
3053
4e2a5f63
AD
3054First time through, eh? I have some defaults handy for some systems
3055that need some extra help getting the Configure answers right:
2304df62
AD
3056
3057EOM
dfe9444c 3058 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3059 dflt=''
3060 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3061 : tests or hints, please send them to perlbug@perl.org
2304df62 3062 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3063 $test -f /irix && osname=irix
85e6fe83
LW
3064 $test -f /xenix && osname=sco_xenix
3065 $test -f /dynix && osname=dynix
3066 $test -f /dnix && osname=dnix
5f05dabc 3067 $test -f /lynx.os && osname=lynxos
3068 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3069 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3070 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3071 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3072 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3073 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3074 $test -d /usr/apollo/bin && osname=apollo
3075 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3076 $test -d /usr/include/minix && osname=minix
d54344fc 3077 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3078 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3079 osname=machten
4633a7c4 3080 if $test -x /sbin/version; then
dfe9444c 3081 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3082 $sed -e 's/[A-Za-z]$//'`
3083 elif $test -x /usr/etc/version; then
dfe9444c 3084 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3085 $sed -e 's/[A-Za-z]$//'`
3086 else
3087 osvers="$2.$3"
3088 fi
3089 fi
aaacdc8b
GS
3090
3091 $test -f /sys/posix.dll &&
3092 $test -f /usr/bin/what &&
3093 set X `/usr/bin/what /sys/posix.dll` &&
3094 $test "$3" = UWIN &&
3095 osname=uwin &&
3096 osvers="$5"
3097
2304df62
AD
3098 if $test -f $uname; then
3099 set X $myuname
3100 shift
3101
2304df62 3102 case "$5" in
85e6fe83 3103 fps*) osname=fps ;;
2304df62
AD
3104 mips*)
3105 case "$4" in
85e6fe83
LW
3106 umips) osname=umips ;;
3107 *) osname=mips ;;
2304df62 3108 esac;;
85e6fe83
LW
3109 [23]100) osname=mips ;;
3110 next*) osname=next ;;
ecfc5424 3111 i386*)
c6912327
JH
3112 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3113 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3114 osname='sco'
3115 osvers=$tmp
3116 elif $test -f /etc/kconfig; then
ecfc5424 3117 osname=isc
bd628c73 3118 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3119 osvers=4
3120 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3121 osvers=3
2304df62 3122 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3123 osvers=2
ecfc5424
AD
3124 fi
3125 fi
2000072c 3126 tmp=''
ecfc5424 3127 ;;
c4f23d77
AD
3128 pc*)
3129 if test -n "$DJGPP"; then
3130 osname=dos
3131 osvers=djgpp
3132 fi
3133 ;;
2304df62
AD
3134 esac
3135
3136 case "$1" in
a0d0e21e
LW
3137 aix) osname=aix
3138 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3139 case "$tmp" in
e81c5c2a
NC
3140 # oslevel can fail with:
3141 # oslevel: Unable to acquire lock.
3142 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3143 '<3240'|'<>3240') osvers=3.2.0 ;;
3144 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3145 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3146 *) osvers=$tmp;;
a0d0e21e
LW
3147 esac
3148 ;;
aaacdc8b
GS
3149 bsd386) osname=bsd386
3150 osvers=`$uname -r`
3151 ;;
3152 cygwin*) osname=cygwin
3153 osvers="$3"
3154 ;;
23f87696
SZ
3155 *dc.osx) osname=dcosx
3156 osvers="$3"
3157 ;;
a0d0e21e
LW
3158 dnix) osname=dnix
3159 osvers="$3"
3160 ;;
3161 domainos) osname=apollo
3162 osvers="$3"
3163 ;;
a774dfe6
RSG
3164 dgux) osname=dgux
3165 osvers="$3"
3166 ;;
3167 dragonfly) osname=dragonfly
a0d0e21e
LW
3168 osvers="$3"
3169 ;;
760ac839 3170 dynixptx*) osname=dynixptx
e58e581d 3171 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3172 ;;
a774dfe6 3173 freebsd) osname=freebsd
a0d0e21e 3174 osvers="$3" ;;
761ee4e8
BD
3175 genix) osname=genix ;;
3176 gnu) osname=gnu
3177 osvers="$3" ;;
a774dfe6 3178 hp*) osname=hpux
bfb7748a 3179 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3180 ;;
761ee4e8 3181 irix*) osname=irix
a0d0e21e
LW
3182 case "$3" in
3183 4*) osvers=4 ;;
3184 5*) osvers=5 ;;
ecfc5424 3185 *) osvers="$3" ;;
a0d0e21e
LW
3186 esac
3187 ;;
761ee4e8 3188 linux) osname=linux
a0d0e21e 3189 case "$3" in
a0d0e21e
LW
3190 *) osvers="$3" ;;
3191 esac
3192 ;;
761ee4e8 3193 MiNT) osname=mint
28e8609d
JH
3194 ;;
3195 netbsd*) osname=netbsd
ecfc5424
AD
3196 osvers="$3"
3197 ;;
4e81affe
MM
3198 news-os) osvers="$3"
3199 case "$3" in
3200 4*) osname=newsos4 ;;
3201 *) osname=newsos ;;
3202 esac
3203 ;;
aaacdc8b 3204 next*) osname=next ;;
28bb1e2c 3205 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3206 openbsd) osname=openbsd
3207 osvers="$3"
3208 ;;
5c728af0
IZ
3209 os2) osname=os2
3210 osvers="$4"
3211 ;;
aaacdc8b
GS
3212 POSIX-BC | posix-bc ) osname=posix-bc
3213 osvers="$3"
a0d0e21e 3214 ;;
ae3afa4e
TH
3215 powerux | power_ux | powermax_os | powermaxos | \
3216 powerunix | power_unix) osname=powerux
3217 osvers="$3"
3218 ;;
aaacdc8b
GS
3219 qnx) osname=qnx
3220 osvers="$4"
3221 ;;
a0d0e21e
LW
3222 solaris) osname=solaris
3223 case "$3" in
3224 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3225 *) osvers="$3" ;;
a0d0e21e
LW
3226 esac
3227 ;;
85e6fe83
LW
3228 sunos) osname=sunos
3229 case "$3" in
85e6fe83
LW
3230 5*) osname=solaris
3231 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3232 *) osvers="$3" ;;
2304df62
AD
3233 esac
3234 ;;
a0d0e21e 3235 titanos) osname=titanos
85e6fe83 3236 case "$3" in
a0d0e21e
LW
3237 1*) osvers=1 ;;
3238 2*) osvers=2 ;;
3239 3*) osvers=3 ;;
3240 4*) osvers=4 ;;
ecfc5424 3241 *) osvers="$3" ;;
2304df62
AD
3242 esac
3243 ;;
85e6fe83 3244 ultrix) osname=ultrix
ecfc5424 3245 osvers="$3"
2304df62 3246 ;;
28757baa 3247 osf1|mls+) case "$5" in
fed7345c
AD
3248 alpha)
3249 osname=dec_osf
fdd85a03 3250 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3251 case "$osvers" in
3252 [1-9].[0-9]*) ;;
3253 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3254 esac
ecfc5424
AD
3255 ;;
3256 hp*) osname=hp_osf1 ;;
3257 mips) osname=mips_osf1 ;;
85e6fe83
LW
3258 esac
3259 ;;
af1ff193 3260 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3261 openunix|unixware) osname=svr5
0337d152
BG
3262 osvers="$4"
3263 ;;
3c728e00 3264 uts) osname=uts
a0d0e21e
LW
3265 osvers="$3"
3266 ;;
3c728e00
JH
3267 vos) osvers="$3"
3268 ;;
85e6fe83 3269 $2) case "$osname" in
2304df62 3270 *isc*) ;;
a0d0e21e 3271 *freebsd*) ;;
5f05dabc 3272 svr*)
a0d0e21e 3273 : svr4.x or possibly later
a774dfe6 3274 case "svr$3" in
a0d0e21e
LW
3275 ${osname}*)
3276 osname=svr$3
3277 osvers=$4
3278 ;;
3279 esac
3280 case "$osname" in
3281 svr4.0)
3282 : Check for ESIX
3283 if test -f /stand/boot ; then
3284 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3285 if test -n "$INITPROG" -a -f "$INITPROG"; then
3286 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3287 if test -n "$isesix"; then
a0d0e21e
LW
3288 osname=esix4
3289 fi
3290 fi
3291 fi
3292 ;;
3293 esac
3294 ;;
2304df62 3295 *) if test -f /etc/systemid; then
a0d0e21e
LW
3296 osname=sco
3297 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3298 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3299 osvers=$1.$2.$3
c4f23d77 3300 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3301 osvers=$1.$2
c4f23d77 3302 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3303 osvers=$1
2304df62 3304 fi
a0d0e21e
LW
3305 else
3306 case "$osname" in
3307 '') : Still unknown. Probably a generic Sys V.
3308 osname="sysv"
3309 osvers="$3"
3310 ;;
3311 esac
2304df62
AD
3312 fi
3313 ;;
3314 esac
3315 ;;
a0d0e21e
LW
3316 *) case "$osname" in
3317 '') : Still unknown. Probably a generic BSD.
3318 osname="$1"
3319 osvers="$3"
3320 ;;
3321 esac
3322 ;;
2304df62
AD
3323 esac
3324 else
dfe9444c
AD
3325 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3326 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3327 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3328 osname=news_os
2304df62 3329 fi
dfe9444c 3330 $rm -f UU/kernel.what
5c728af0 3331 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3332 set X $myuname
3333 osname=os2
3334 osvers="$5"
2304df62
AD
3335 fi
3336 fi
a774dfe6 3337
5440bc8e
JH
3338 case "$targetarch" in
3339 '') ;;
3340 *) hostarch=$osname
3341 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3342 osvers=''
3343 ;;
3344 esac
3345
a0d0e21e
LW
3346 : Now look for a hint file osname_osvers, unless one has been
3347 : specified already.
3348 case "$hintfile" in
3349 ''|' ')
1e127011 3350 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3351 : Also try without trailing minor version numbers.
1e127011
DD
3352 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3353 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3354 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3355 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3356 case "$file" in
3357 '') dflt=none ;;
3358 *) case "$osvers" in
3359 '') dflt=$file
3360 ;;
dfe9444c 3361 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3362 dflt=$file
dfe9444c 3363 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3364 dflt=$xfile
dfe9444c 3365 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3366 dflt=$xxfile
dfe9444c 3367 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3368 dflt=$xxxfile
dfe9444c 3369 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3370 dflt=$xxxxfile
dfe9444c 3371 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3372 dflt="${osname}"
3373 else
3374 dflt=none
3375 fi
3376 ;;
3377 esac
85e6fe83
LW
3378 ;;
3379 esac
4e2a5f63
AD
3380 if $test -f Policy.sh ; then
3381 case "$dflt" in
3382 *Policy*) ;;
3383 none) dflt="Policy" ;;
3384 *) dflt="Policy $dflt" ;;
3385 esac
3386 fi
85e6fe83 3387 ;;
a0d0e21e 3388 *)
ecfc5424 3389 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3390 ;;
2304df62 3391 esac
1aef975c 3392
4e2a5f63
AD
3393 if $test -f Policy.sh ; then
3394 $cat <<EOM
3395
3396There's also a Policy hint file available, which should make the
3397site-specific (policy) questions easier to answer.
3398EOM
3399
3400 fi
3401
2304df62
AD
3402 $cat <<EOM
3403
3404You may give one or more space-separated answers, or "none" if appropriate.
a2d23ec2
MB
3405If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3406previous run of Configure, you may specify it as well as or instead of
3407OS-specific hints. If hints are provided for your OS, you should use them:
3408although Perl can probably be built without hints on many platforms, using
3409hints often improve performance and may enable features that Configure can't
3410set up on its own. If there are no hints that match your OS, specify "none";
3411DO NOT give a wrong version or a wrong OS.
2304df62
AD
3412
3413EOM
4e2a5f63 3414
2304df62 3415 rp="Which of these apply, if any?"
dfe9444c 3416 . UU/myread
85e6fe83
LW
3417 tans=$ans
3418 for file in $tans; do
4e2a5f63
AD
3419 if $test X$file = XPolicy -a -f Policy.sh; then
3420 . Policy.sh
3421 $cat Policy.sh >> UU/config.sh
3422 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3423 . $src/hints/$file.sh
3424 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3425 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3426 : nothing
3427 else
85e6fe83
LW
3428 : Give one chance to correct a possible typo.
3429 echo "$file.sh does not exist"
3430 dflt=$file
3431 rp="hint to use instead?"
dfe9444c 3432 . UU/myread
85e6fe83 3433 for file in $ans; do
dfe9444c
AD
3434 if $test -f "$src/hints/$file.sh"; then
3435 . $src/hints/$file.sh
3436 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3437 elif $test X$ans = X -o X$ans = Xnone ; then
3438 : nothing
3439 else
3440 echo "$file.sh does not exist -- ignored."
3441 fi
3442 done
2304df62
AD
3443 fi
3444 done
85e6fe83 3445
2304df62 3446 hint=recommended
85e6fe83 3447 : Remember our hint file for later.
dfe9444c 3448 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3449 hintfile="$file"
85e6fe83 3450 else
a0d0e21e 3451 hintfile=''
85e6fe83 3452 fi
2304df62
AD
3453fi
3454cd UU
3455;;
3456*)
3457 echo " "
3458 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3459 tmp_n="$n"
3460 tmp_c="$c"
2304df62
AD
3461 cd ..
3462 cp $config_sh config.sh 2>/dev/null
a78b0d02 3463 chmod +w config.sh
2304df62
AD
3464 . ./config.sh
3465 cd UU
3466 cp ../config.sh .
ecfc5424
AD
3467 n="$tmp_n"
3468 c="$tmp_c"
2304df62
AD
3469 hint=previous
3470 ;;
3471esac
1aef975c 3472test "$override" && . ./optdef.sh
2304df62
AD
3473
3474: Restore computed paths
3475for file in $loclist $trylist; do
3476 eval $file="\$_$file"
3477done
3478
85e6fe83 3479cat << EOM
a0d0e21e 3480
85e6fe83 3481Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3482The default value is probably right if the name rings a bell. Otherwise,
3483since spelling matters for me, either accept the default or answer "none"
3484to leave it blank.
a0d0e21e 3485
85e6fe83 3486EOM
85e6fe83 3487case "$osname" in
a0d0e21e 3488 ''|' ')
85e6fe83 3489 case "$hintfile" in
a0d0e21e 3490 ''|' '|none) dflt=none ;;
ecfc5424 3491 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3492 esac
3493 ;;
3494 *) dflt="$osname" ;;
3495esac
3496rp="Operating system name?"
3497. ./myread
3498case "$ans" in
ecfc5424
AD
3499none) osname='' ;;
3500*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3501esac
8ff267be 3502echo " "
3503case "$osvers" in
3504 ''|' ')
3505 case "$hintfile" in
3506 ''|' '|none) dflt=none ;;
3507 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3508 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3509 case "$dflt" in
3510 ''|' ') dflt=none ;;
3511 esac
3512 ;;
3513 esac
3514 ;;
3515 *) dflt="$osvers" ;;
3516esac
3517rp="Operating system version?"
3518. ./myread
3519case "$ans" in
3520none) osvers='' ;;
3521*) osvers="$ans" ;;
3522esac
3523
02e93a22
JH
3524
3525. ./posthint.sh
3526
2304df62 3527: who configured the system
59b83a6f 3528cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3529case "$cf_by" in
3530"")
7c04078e 3531 cf_by=`(logname) 2>/dev/null`
dfe9444c 3532 case "$cf_by" in
7c04078e
GA
3533 "")
3534 cf_by=`(whoami) 2>/dev/null`
3535 case "$cf_by" in
3536 "") cf_by=unknown ;;
3537 esac ;;
8ff267be 3538 esac ;;
3539esac
2304df62 3540
f3f1a2d8
MB
3541: decide how portable to be. Allow command line overrides.
3542case "$d_portable" in
3543"$undef") ;;
3544*) d_portable="$define" ;;
b4eb6b3d 3545esac
b4eb6b3d 3546
f3f1a2d8
MB
3547: set up shell script to do ~ expansion
3548cat >filexp <<EOSS
3549$startsh
3550: expand filename
3551case "\$1" in
3552 ~/*|~)
3553 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3554 ;;
3555 ~*)
3556 if $test -f /bin/csh; then
3557 /bin/csh -f -c "glob \$1"
3558 failed=\$?
3559 echo ""
3560 exit \$failed
3561 else
3562 name=\`$expr x\$1 : '..\([^/]*\)'\`
3563 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3564 if $test ! -d "\$dir"; then
3565 me=\`basename \$0\`
3566 echo "\$me: can't locate home directory for: \$name" >&2
3567 exit 1
3568 fi
3569 case "\$1" in
3570 */*)
3571 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3572 ;;
3573 *)
3574 echo \$dir
3575 ;;
3576 esac
3577 fi
3578 ;;
3579*)
3580 echo \$1
3581 ;;
b29b105d 3582esac
f3f1a2d8
MB
3583EOSS
3584chmod +x filexp
3585$eunicefix filexp
b29b105d 3586
f3f1a2d8
MB
3587: now set up to get a file name
3588cat <<EOS >getfile
3589$startsh
3590EOS
3591cat <<'EOSC' >>getfile
3592tilde=''
3593fullpath=''
3594already=''
3595skip=''
3596none_ok=''
3597exp_file=''
3598nopath_ok=''
3599orig_rp="$rp"
3600orig_dflt="$dflt"
3601case "$gfpth" in
3602'') gfpth='.' ;;
b29b105d 3603esac
b29b105d 3604
f3f1a2d8
MB
3605case "$fn" in
3606*\(*)
3607 : getfile will accept an answer from the comma-separated list
3608 : enclosed in parentheses even if it does not meet other criteria.
3609 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3610 fn=`echo $fn | sed 's/(.*)//'`
3611 ;;
b29b105d
JH
3612esac
3613
f3f1a2d8
MB
3614case "$fn" in
3615*:*)
3616 loc_file=`expr $fn : '.*:\(.*\)'`
3617 fn=`expr $fn : '\(.*\):.*'`
3618 ;;
b29b105d 3619esac
b29b105d 3620
f3f1a2d8
MB
3621case "$fn" in
3622*~*) tilde=true;;
3623esac
3624case "$fn" in
3625*/*) fullpath=true;;
3626esac
3627case "$fn" in
3628*+*) skip=true;;
3629esac
3630case "$fn" in
3631*n*) none_ok=true;;
3632esac
3633case "$fn" in
3634*e*) exp_file=true;;
3635esac
3636case "$fn" in
3637*p*) nopath_ok=true;;
b29b105d 3638esac
b29b105d 3639
f3f1a2d8
MB
3640case "$fn" in
3641*f*) type='File';;
3642*d*) type='Directory';;
3643*l*) type='Locate';;
3644esac
b29b105d 3645
f3f1a2d8
MB
3646what="$type"
3647case "$what" in
3648Locate) what='File';;
3649esac
b29b105d 3650
f3f1a2d8
MB
3651case "$exp_file" in
3652'')
3653 case "$d_portable" in
3654 "$define") ;;
3655 *) exp_file=true;;
b29b105d
JH
3656 esac
3657 ;;
3658esac
3659
f3f1a2d8
MB
3660cd ..
3661while test "$type"; do
3662 redo=''
3663 rp="$orig_rp"
3664 dflt="$orig_dflt"
3665 case "$tilde" in
3666 true) rp="$rp (~name ok)";;
3667 esac
3668 . UU/myread
3669 if test -f UU/getfile.ok && \
3670 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3671 then
3672 value="$ans"
3673 ansexp="$ans"
3674 break
3675 fi
3676 case "$ans" in
3677 none)
3678 value=''
3679 ansexp=''
3680 case "$none_ok" in
3681 true) type='';;
b29b105d
JH
3682 esac
3683 ;;
f3f1a2d8
MB
3684 *)
3685 case "$tilde" in
3686 '') value="$ans"
3687 ansexp="$ans";;
3688 *)
3689 value=`UU/filexp $ans`
3690 case $? in
3691 0)
3692 if test "$ans" != "$value"; then
3693 echo "(That expands to $value on this system.)"
3694 fi
3695 ;;
3696 *) value="$ans";;
3697 esac
3698 ansexp="$value"
3699 case "$exp_file" in
3700 '') value="$ans";;
3701 esac
3702 ;;
3703 esac
3704 case "$fullpath" in
3705 true)
3706 case "$ansexp" in
3707 /*) value="$ansexp" ;;
3708 [a-zA-Z]:/*) value="$ansexp" ;;
3709 *)
3710 redo=true
3711 case "$already" in
3712 true)
3713 echo "I shall only accept a full path name, as in /bin/ls." >&4
3714 echo "Use a ! shell escape if you wish to check pathnames." >&4
3715 ;;
3716 *)
3717 echo "Please give a full path name, starting with slash." >&4
3718 case "$tilde" in
3719 true)
3720 echo "Note that using ~name is ok provided it expands well." >&4
3721 already=true
3722 ;;
3723 esac
3724 esac
3725 ;;
3726 esac
3727 ;;
3728 esac
3729 case "$redo" in
3730 '')
3731 case "$type" in
3732 File)
3733 for fp in $gfpth; do
3734 if test "X$fp" = X.; then
3735 pf="$ansexp"
3736 else
3737 pf="$fp/$ansexp"
3738 fi
3739 if test -f "$pf"; then
3740 type=''
3741 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3742 then
3743 echo "($value is not a plain file, but that's ok.)"
3744 type=''
3745 fi
3746 if test X"$type" = X; then
3747 value="$pf"
3748 break
3749 fi
3750 done
3751 ;;
3752 Directory)
3753 for fp in $gfpth; do
3754 if test "X$fp" = X.; then
3755 dir="$ans"
3756 direxp="$ansexp"
3757 else
3758 dir="$fp/$ansexp"
3759 direxp="$fp/$ansexp"
3760 fi
3761 if test -d "$direxp"; then
3762 type=''
3763 value="$dir"
3764 break
3765 fi
3766 done
3767 ;;
3768 Locate)
3769 if test -d "$ansexp"; then
3770 echo "(Looking for $loc_file in directory $value.)"
3771 value="$value/$loc_file"
3772 ansexp="$ansexp/$loc_file"
3773 fi
3774 if test -f "$ansexp"; then
3775 type=''
3776 fi
3777 case "$nopath_ok" in
3778 true) case "$value" in
3779 */*) ;;
3780 *) echo "Assuming $value will be in people's path."
3781 type=''
3782 ;;
3783 esac
3784 ;;
3785 esac
3786 ;;
3787 esac
b4eb6b3d 3788
f3f1a2d8
MB
3789 case "$skip" in
3790 true) type='';
3791 esac
3792
3793 case "$type" in
3794 '') ;;
3795 *)
3796 if test "$fastread" = yes; then
3797 dflt=y
3798 else
3799 dflt=n
3800 fi
3801 rp="$what $value doesn't exist. Use that name anyway?"
3802 . UU/myread
3803 dflt=''
3804 case "$ans" in
3805 y*) type='';;
3806 *) echo " ";;
3807 esac
3808 ;;
3809 esac
3810 ;;
3811 esac
3812 ;;
b4eb6b3d 3813 esac
f3f1a2d8
MB
3814done
3815cd UU
3816ans="$value"
3817rp="$orig_rp"
3818dflt="$orig_dflt"
3819rm -f getfile.ok
3820test "X$gfpthkeep" != Xy && gfpth=""
3821EOSC
3822
3823: determine root of directory hierarchy where package will be installed.
3824case "$prefix" in
3825'')
3826 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3827 ;;
3828*?/)
3829 dflt=`echo "$prefix" | sed 's/.$//'`
b4eb6b3d
JH
3830 ;;
3831*)
f3f1a2d8 3832 dflt="$prefix"
b4eb6b3d
JH
3833 ;;
3834esac
f3f1a2d8 3835$cat <<EOM
b4eb6b3d 3836
f3f1a2d8
MB
3837By default, $package will be installed in $dflt/bin, manual pages
3838under $dflt/man, etc..., i.e. with $dflt as prefix for all
3839installation directories. Typically this is something like /usr/local.
3840If you wish to have binaries under /usr/bin but other parts of the
3841installation under /usr/local, that's ok: you will be prompted
3842separately for each of the installation directories, the prefix being
3843only used to set the defaults.
c915ce7f
JH
3844
3845EOM
f3f1a2d8
MB
3846fn=d~
3847rp='Installation prefix to use?'
3848. ./getfile
3849oldprefix=''
3850case "$prefix" in
3851'') ;;
3852*)
3853 case "$ans" in
3854 "$prefix") ;;
3855 *) oldprefix="$prefix";;
3856 esac
c915ce7f
JH
3857 ;;
3858esac
f3f1a2d8
MB
3859prefix="$ans"
3860prefixexp="$ansexp"
c915ce7f 3861
f3f1a2d8
MB
3862case "$afsroot" in
3863'') afsroot=/afs ;;
3864*) afsroot=$afsroot ;;
b4eb6b3d 3865esac
b4eb6b3d 3866
f3f1a2d8
MB
3867: is AFS running?
3868echo " "
3869case "$afs" in
3870$define|true) afs=true ;;
3871$undef|false) afs=false ;;
3872*) if test -d $afsroot; then
3873 afs=true
3874 else
3875 afs=false
3876 fi
b4eb6b3d 3877 ;;
f3f1a2d8
MB
3878esac
3879if $afs; then
3880 echo "AFS may be running... I'll be extra cautious then..." >&4
3881else
3882 echo "AFS does not seem to be running..." >&4
9da7673b 3883fi
b4eb6b3d 3884
f3f1a2d8
MB
3885: determine installation prefix for where package is to be installed.
3886if $afs; then
3887$cat <<EOM
3888
3889Since you are running AFS, I need to distinguish the directory in which
3890files will reside from the directory in which they are installed (and from
3891which they are presumably copied to the former directory by occult means).
b4eb6b3d 3892
b4eb6b3d 3893EOM
f3f1a2d8
MB
3894 case "$installprefix" in
3895 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3896 *) dflt="$installprefix";;
3897 esac
3898else
3899$cat <<EOM
b4eb6b3d 3900
f3f1a2d8
MB
3901In some special cases, particularly when building $package for distribution,
3902it is convenient to distinguish the directory in which files should be
3903installed from the directory ($prefix) in which they will
3904eventually reside. For most users, these two directories are the same.
3905
3906EOM
3907 case "$installprefix" in
3908 '') dflt=$prefix ;;
3909 *) dflt=$installprefix;;
3910 esac
3911fi
3912fn=d~
3913rp='What installation prefix should I use for installing files?'
3914. ./getfile
3915installprefix="$ans"
3916installprefixexp="$ansexp"
3917
3918: Perform the prefixexp/installprefixexp correction if necessary
3919cat <<EOS >installprefix
3920$startsh
3921EOS
3922cat <<'EOSC' >>installprefix
3923: Change installation prefix, if necessary.
3924if $test X"$prefix" != X"$installprefix"; then
3925 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3926else
3927 eval "install${prefixvar}=\"\$${prefixvar}exp\""
3928fi
3929EOSC
3930chmod +x installprefix
3931$eunicefix installprefix
3932
3933: Set variables such as privlib and privlibexp from the output of ./getfile
3934: performing the prefixexp/installprefixexp correction if necessary.
3935cat <<EOS >setprefixvar
3936$startsh
3937EOS
3938cat <<'EOSC' >>setprefixvar
3939eval "${prefixvar}=\"\$ans\""
3940eval "${prefixvar}exp=\"\$ansexp\""
3941. ./installprefix
3942EOSC
3943chmod +x setprefixvar
3944$eunicefix setprefixvar
3945
3946: set up the script used to warn in case of inconsistency
3947cat <<EOS >whoa
3948$startsh
3949EOS
3950cat <<'EOSC' >>whoa
3951dflt=y
dcb594bc
MB
3952case "$hint" in
3953 recommended)
3954 case "$hintfile" in
3955 '') echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3956 ;;
3957 *) echo "Hmm. Based on the hints in hints/$hintfile.sh, " >&4
3958 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
3959 ;;
3960 esac
3961 ;;
3962 *) echo " "
3963 echo "*** WHOA THERE!!! ***" >&4
3964 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3965 ;;
3966esac
f3f1a2d8
MB
3967rp=" Keep the $hint value?"
3968. ./myread
3969case "$ans" in
3970y) td=$was; tu=$was;;
3971esac
3972EOSC
3973
3974: function used to set $1 to $val
3975setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3976case "$val$was" in
3977$define$undef) . ./whoa; eval "$var=\$td";;
3978$undef$define) . ./whoa; eval "$var=\$tu";;
3979*) eval "$var=$val";;
3980esac'
3981
3982case "$usesocks" in
3983$define|true|[yY]*) dflt='y';;
3984*) dflt='n';;
3985esac
3986cat <<EOM
3987
3988Perl can be built to use the SOCKS proxy protocol library. To do so,
3989Configure must be run with -Dusesocks. If you use SOCKS you also need
3990to use the PerlIO abstraction layer, this will be implicitly selected.
3991
3992If this doesn't make any sense to you, just accept the default '$dflt'.
3993EOM
3994rp='Build Perl for SOCKS?'
3995. ./myread
3996case "$ans" in
3997y|Y) val="$define" ;;
3998*) val="$undef" ;;
3999esac
4000set usesocks
4001eval $setvar
4002
4003case "$usesocks" in
4004$define|true|[yY]*) useperlio="$define";;
4005esac
4006
4007case "$useperlio" in
4008$define|true|[yY]*|'') dflt='y';;
4009*) dflt='n';;
4010esac
4011cat <<EOM
4012
4013Previous version of $package used the standard IO mechanisms as
4014defined in <stdio.h>. Versions 5.003_02 and later of $package allow
4015alternate IO mechanisms via the PerlIO abstraction layer, but the
4016stdio mechanism is still available if needed. The abstraction layer
4017can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4018Using PerlIO with sfio may cause problems with some extension modules.
4019
4020If this doesn't make any sense to you, just accept the default '$dflt'.
b4eb6b3d 4021EOM
f3f1a2d8
MB
4022rp='Use the PerlIO abstraction layer?'
4023. ./myread
4024case "$ans" in
4025y|Y)
b4eb6b3d
JH
4026 val="$define"
4027 ;;
f3f1a2d8
MB
4028*)
4029 echo "Ok, doing things the stdio way."
4030 val="$undef"
4031 ;;
4032esac
4033set useperlio
4034eval $setvar
4035
4036case "$usesocks" in
4037$define|true|[yY]*)
4038 case "$useperlio" in
4039 $define|true|[yY]*) ;;
4040 *) cat >&4 <<EOM
4041
4042You are using the SOCKS proxy protocol library which means that you
4043should also use the PerlIO layer. You may be headed for trouble.
4044
4045EOM
4046 ;;
b4eb6b3d 4047 esac
f3f1a2d8
MB
4048 ;;
4049esac
4050
4051
5c40187f
MB
4052: get the patchlevel
4053echo " "
4054echo "Getting the current patchlevel..." >&4
4055if $test -r $rsrc/patchlevel.h;then
4056 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4057 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4058 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4059 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4060 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4061 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4062 perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
4063else
4064 revision=0
4065 patchlevel=0
4066 subversion=0
4067 api_revision=0
4068 api_version=0
4069 api_subversion=0
4070 perl_patchlevel=0
4071 $echo "(You do not have patchlevel.h. Eek.)"
4072fi
4073if $test -r $rsrc/.patch ; then
4074 if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4075 perl_patchlevel=`cat $rsrc/.patch`
4076 fi
4077fi
4078: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4079version_patchlevel_string="version $patchlevel subversion $subversion"
4080case "$perl_patchlevel" in
40810|'') ;;
4082*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4083esac
4084
4085$echo "(You have $package $version_patchlevel_string.)"
4086
4087case "$osname" in
4088dos|vms)
4089 : XXX Should be a Configure test for double-dots in filenames.
4090 version=`echo $revision $patchlevel $subversion | \
4091 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4092 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4093 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4094 ;;
4095*)
4096 version=`echo $revision $patchlevel $subversion | \
4097 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4098 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4099 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4100 ;;
4101esac
4102: Special case the 5.005_xx maintenance series, which used 5.005
4103: without any subversion label as a subdirectory in $sitelib
4104if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4105 api_versionstring='5.005'
4106fi
4107
f3f1a2d8
MB
4108case "$usethreads" in
4109$define|true|[yY]*) dflt='y';;
4110*) # Catch case where user specified ithreads or 5005threads but
4111 # forgot -Dusethreads (A.D. 4/2002)
4112 case "$useithreads$use5005threads" in
4113 *$define*)
4114 case "$useperlio" in
4115 "$define") dflt='y' ;;
4116 *) dflt='n' ;;
4117 esac
4118 ;;
4119 *) dflt='n';;
4120 esac
4121 ;;
4122esac
4123cat <<EOM
4124
4125Perl can be built to take advantage of threads on some systems.
4126To do so, Configure can be run with -Dusethreads.
4127
4128Note that Perl built with threading support runs slightly slower
4129and uses more memory than plain Perl. The current implementation
4130is believed to be stable, but it is fairly new, and so should be
4131treated with caution.
4132
4133If this doesn't make any sense to you, just accept the default '$dflt'.
4134EOM
4135rp='Build a threading Perl?'
4136. ./myread
4137case "$ans" in
4138y|Y) val="$define" ;;
4139*) val="$undef" ;;
4140esac
4141set usethreads
4142eval $setvar
4143
5c40187f
MB
4144if $test $patchlevel -lt 9; then
4145 case "$usethreads" in
4146 $define)
f3f1a2d8
MB
4147 $cat <<EOM
4148
4149Since release 5.6, Perl has had two different threading implementations,
4150the newer interpreter-based version (ithreads) with one interpreter per
4151thread, and the older 5.005 version (5005threads).
4152The 5005threads version is effectively unmaintained and will probably be
4153removed in Perl 5.10, so there should be no need to build a Perl using it
4154unless needed for backwards compatibility with some existing 5.005threads
4155code.
4156
4157EOM
4158 : Default to ithreads unless overridden on command line or with
4159 : old config.sh
4160 dflt='y'
4161 case "$use5005threads" in
4162 $define|true|[yY]*) dflt='n';;
4163 esac
4164 case "$useithreads" in
4165 $undef|false|[nN]*) dflt='n';;
4166 esac
4167 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
4168 . ./myread
4169 case "$ans" in
f3f1a2d8 4170 y|Y) val="$define" ;;
b4eb6b3d
JH
4171 *) val="$undef" ;;
4172 esac
f3f1a2d8
MB
4173 set useithreads
4174 eval $setvar
4175 : Now set use5005threads to the opposite value.
4176 case "$useithreads" in
4177 $define) val="$undef" ;;
4178 *) val="$define" ;;
4179 esac
4180 set use5005threads
4181 eval $setvar
4182 ;;
5c40187f 4183 *)
f3f1a2d8
MB
4184 useithreads="$undef"
4185 use5005threads="$undef"
b4eb6b3d 4186 ;;
5c40187f 4187 esac
b4eb6b3d 4188
5c40187f
MB
4189 case "$useithreads$use5005threads" in
4190 "$define$define")
f3f1a2d8 4191 $cat >&4 <<EOM
96056487 4192
f3f1a2d8
MB
4193You cannot have both the ithreads and the 5.005 threads enabled
4194at the same time. Disabling the 5.005 threads since they are
4195much less stable than the ithreads.
4196
4197EOM
4198 use5005threads="$undef"
96056487 4199 ;;
5c40187f
MB
4200 esac
4201
4202else
4203: perl-5.9.x and later
4204
4205 use5005threads="$undef"
4206 case "$usethreads" in
4207 $define)
4208 : Default to ithreads unless overridden on command line or with
4209 : old config.sh
4210 dflt='y'
4211 case "$useithreads" in
4212 $undef|false|[nN]*) dflt='n';;
4213 esac
4214 rp='Use the newer interpreter-based ithreads?'
4215 . ./myread
4216 case "$ans" in
4217 y|Y) val="$define" ;;
4218 *) val="$undef" ;;
4219 esac
4220 set useithreads
4221 eval $setvar
4222 ;;
4223 *)
4224 useithreads="$undef"
4225 ;;
4226 esac
4227
4228fi
96056487 4229
f3f1a2d8
MB
4230if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4231 cat >&4 <<EOF
4232***
4233*** To build with ithreads you must also use the PerlIO layer.
4234*** Cannot continue, aborting.
4235***
4236EOF
4237 exit 1
4238fi
4239
4240case "$d_oldpthreads" in
4241'') : Configure tests would be welcome here. For now, assume undef.
4242 val="$undef" ;;
4243*) val="$d_oldpthreads" ;;
4244esac
4245set d_oldpthreads
4246eval $setvar
4247
4248
4249: Look for a hint-file generated 'call-back-unit'. If the
4250: user has specified that a threading perl is to be built,
4251: we may need to set or change some other defaults.
4252if $test -f usethreads.cbu; then
4253 echo "Your platform has some specific hints regarding threaded builds, using them..."
4254 . ./usethreads.cbu
4255else
4256 case "$usethreads" in
4257 "$define"|true|[yY]*)
4258 $cat <<EOM
4259(Your platform does not have any specific hints for threaded builds.
4260 Assuming POSIX threads, then.)
4261EOM
4262 ;;
4263 esac
4264fi
4265
4266cat <<EOM
4267
4268Perl can be built so that multiple Perl interpreters can coexist
4269within the same Perl executable.
4270EOM
4271
4272case "$useithreads" in
4273$define)
4274 cat <<EOM
4275This multiple interpreter support is required for interpreter-based threads.
4276EOM
4277 val="$define"
4278 ;;
4279*) case "$usemultiplicity" in
4280 $define|true|[yY]*) dflt='y';;
4281 *) dflt='n';;
4282 esac
4283 echo " "
4284 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4285 rp='Build Perl for multiplicity?'
4286 . ./myread
4287 case "$ans" in
4288 y|Y) val="$define" ;;
4289 *) val="$undef" ;;
4290 esac
4291 ;;
4292esac
4293set usemultiplicity
4294eval $setvar
4295
4296
4297case "$usemorebits" in
4298"$define"|true|[yY]*)
4299 use64bitint="$define"
4300 uselongdouble="$define"
4301 usemorebits="$define"
4302 ;;
4303*) usemorebits="$undef"
4304 ;;
4305esac
4306
4307: make some quick guesses about what we are up against
4308echo " "
4309$echo $n "Hmm... $c"
4310echo exit 1 >bsd
4311echo exit 1 >usg
4312echo exit 1 >v7
4313echo exit 1 >osf1
4314echo exit 1 >eunice
4315echo exit 1 >xenix
4316echo exit 1 >venix
4317echo exit 1 >os2
4318d_bsd="$undef"
4319$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4320if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
e5e20432
JH
4321then
4322 echo "Looks kind of like an OSF/1 system, but we'll see..."
4323 echo exit 0 >osf1
381aa1ff 4324elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
4325 xxx=`./loc addbib blurfl $pth`
4326 if $test -f $xxx; then
4327 echo "Looks kind of like a USG system with BSD features, but we'll see..."
4328 echo exit 0 >bsd
4329 echo exit 0 >usg
4330 else
4331 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4332 echo "Looks kind of like an extended USG system, but we'll see..."
4333 else
4334 echo "Looks kind of like a USG system, but we'll see..."
4335 fi
4336 echo exit 0 >usg
4337 fi
4338elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4339 echo "Looks kind of like a BSD system, but we'll see..."
4340 d_bsd="$define"
4341 echo exit 0 >bsd
4342else
4343 echo "Looks kind of like a Version 7 system, but we'll see..."
4344 echo exit 0 >v7
4345fi
4346case "$eunicefix" in
4347*unixtovms*)
4348 $cat <<'EOI'
4349There is, however, a strange, musty smell in the air that reminds me of
4350something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4351EOI
4352 echo exit 0 >eunice
4353 d_eunice="$define"
4354: it so happens the Eunice I know will not run shell scripts in Unix format
4355 ;;
4356*)
4357 echo " "
4358 echo "Congratulations. You aren't running Eunice."
4359 d_eunice="$undef"
4360 ;;
4361esac
4362: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
4363: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4364: semicolon as a patch separator
e5e20432
JH
4365case "$p_" in
4366:) ;;
4367*)
4368 $cat <<'EOI'
4369I have the feeling something is not exactly right, however...don't tell me...
4370lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 4371(Or you may be running DOS with DJGPP.)
e5e20432
JH
4372EOI
4373 echo exit 0 >os2
4374 ;;
4375esac
4376if test -f /xenix; then
4377 echo "Actually, this looks more like a XENIX system..."
4378 echo exit 0 >xenix
4379 d_xenix="$define"
4380else
4381 echo " "
4382 echo "It's not Xenix..."
4383 d_xenix="$undef"
4384fi
4385chmod +x xenix
4386$eunicefix xenix
4387if test -f /venix; then
4388 echo "Actually, this looks more like a VENIX system..."
4389 echo exit 0 >venix
4390else
4391 echo " "
4392 if ./xenix; then
4393 : null
4394 else
4395 echo "Nor is it Venix..."
4396 fi
4397fi
4398chmod +x bsd usg v7 osf1 eunice xenix venix os2
4399$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4400$rm -f foo
4401
5869b1f1
JH
4402case "$cc" in
4403'') dflt=cc;;
4404*) dflt="$cc";;
4405esac
4406rp="Use which C compiler?"
4407. ./myread
4408cc="$ans"
6b769f8f
RB
4409
4410: See if they have not cc but they do have gcc
4411. ./trygcc
e5e20432
JH
4412: Look for a hint-file generated 'call-back-unit'. Now that the
4413: user has specified the compiler, we may need to set or change some
4414: other defaults.
4415if $test -f cc.cbu; then
4416 . ./cc.cbu
4417fi
2573c5f9 4418. ./checkcc
8a27cf78 4419
e5e20432
JH
4420echo " "
4421echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 4422$cat >try.c <<EOM
e5e20432
JH
4423#include <stdio.h>
4424int main() {
7686528e 4425#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
e5e20432
JH
4426#ifdef __VERSION__
4427 printf("%s\n", __VERSION__);
4428#else
4429 printf("%s\n", "1");
4430#endif
4431#endif
073b6de5 4432 return(0);
e5e20432
JH
4433}
4434EOM
5440bc8e
JH
4435if $cc -o try $ccflags $ldflags try.c; then
4436 gccversion=`$run ./try`
f3f1a2d8
MB
4437 case "$gccversion" in
4438 '') echo "You are not using GNU cc." ;;
4439 *) echo "You are using GNU cc $gccversion."
4440 ccname=gcc
4441 ;;
4442 esac
4443else
4444 echo " "
4445 echo "*** WHOA THERE!!! ***" >&4
4446 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
4447 case "$knowitall" in
4448 '')
4449 echo " You'd better start hunting for one and let me know about it." >&4
4450 exit 1
2304df62
AD
4451 ;;
4452 esac
f3f1a2d8
MB
4453fi
4454$rm -f try try.*
4455case "$gccversion" in
44561*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4457esac
4458case "$gccversion" in
4459'') gccosandvers='' ;;
4460*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4461 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4462 gccshortvers=''
4463 case "$gccosandvers" in
4464 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4465 $osname$osvers) ;; # looking good
4466 $osname*) cat <<EOM >&4
4467
4468*** WHOA THERE!!! ***
4469
4470 Your gcc has not been compiled for the exact release of
4471 your operating system ($gccosandvers versus $osname$osvers).
4472
4473 In general it is a good idea to keep gcc synchronized with
4474 the operating system because otherwise serious problems
4475 may ensue when trying to compile software, like Perl.
4476
4477 I'm trying to be optimistic here, though, and will continue.
4478 If later during the configuration and build icky compilation
4479 problems appear (headerfile conflicts being the most common
4480 manifestation), I suggest reinstalling the gcc to match
4481 your operating system release.
4482
4483EOM
4484 ;;
4485 *) gccosandvers='' ;; # failed to parse, better be silent
4486 esac
4487 ;;
4488esac
4489case "$ccname" in
4490'') ccname="$cc" ;;
4491esac
4492
4493# gcc 3.* complain about adding -Idirectories that they already know about,
4494# so we will take those off from locincpth.
4495case "$gccversion" in
44963*)
4497 echo "main(){}">try.c
4498 for incdir in $locincpth; do
4499 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4500 grep '^c[cp]p*[01]: warning: changing search order '`
4501 if test "X$warn" != X; then
4502 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4503 fi
4504 done
4505 $rm -f try try.*
4506esac
2304df62 4507
bd9b35c9
JH
4508: What should the include directory be ?
4509echo " "
4510$echo $n "Hmm... $c"
4511dflt='/usr/include'
4512incpath=''
4513mips_type=''
4514if $test -f /bin/mips && /bin/mips; then
4515 echo "Looks like a MIPS system..."
4516 $cat >usr.c <<'EOCP'
4517#ifdef SYSTYPE_BSD43
4518/bsd43
4519#endif
4520EOCP
8a27cf78 4521 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4522 dflt='/bsd43/usr/include'
4523 incpath='/bsd43'
4524 mips_type='BSD 4.3'
4525 else
4526 mips_type='System V'
4527 fi
4528 $rm -f usr.c usr.out
4529 echo "and you're compiling with the $mips_type compiler and libraries."
4530 xxx_prompt=y
4531 echo "exit 0" >mips
4532else
4533 echo "Doesn't look like a MIPS system."
4534 xxx_prompt=n
4535 echo "exit 1" >mips
4536fi
4537chmod +x mips
4538$eunicefix mips
4539case "$usrinc" in
4540'') ;;
4541*) dflt="$usrinc";;
4542esac
4543case "$xxx_prompt" in
4544y) fn=d/
4545 echo " "
4546 rp='Where are the include files you want to use?'
4547 . ./getfile
4548 usrinc="$ans"
8e07c86e 4549 ;;
bd9b35c9 4550*) usrinc="$dflt"
8e07c86e
AD
4551 ;;
4552esac
2304df62 4553
96056487
JH
4554: see how we invoke the C preprocessor
4555echo " "
4556echo "Now, how can we feed standard input to your C preprocessor..." >&4
4557cat <<'EOT' >testcpp.c
4558#define ABC abc
4559#define XYZ xyz
4560ABC.XYZ
4561EOT
4562cd ..
4563if test ! -f cppstdin; then
4564 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4565 # AIX cc -E doesn't show the absolute headerfile
4566 # locations but we'll cheat by using the -M flag.
4567 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
4568 else
4569 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4570 fi
4571else
4572 echo "Keeping your $hint cppstdin wrapper."
4573fi
4574chmod 755 cppstdin
4575wrapper=`pwd`/cppstdin
4576ok='false'
4577cd UU
4578
4579if $test "X$cppstdin" != "X" && \
4580 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4581 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4582then
4583 echo "You used to use $cppstdin $cppminus so we'll use that again."
4584 case "$cpprun" in
4585 '') echo "But let's see if we can live without a wrapper..." ;;
4586 *)
4587 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4588 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4589 then
4590 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4591 ok='true'
4592 else
4593 echo "(However, $cpprun $cpplast does not work, let's see...)"
4594 fi
4595 ;;
4596 esac
4597else
4598 case "$cppstdin" in
4599 '') ;;
4600 *)
4601 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4602 ;;
4603 esac
4604fi
4605
4606if $ok; then
4607 : nothing
4608elif echo 'Maybe "'"$cc"' -E" will work...'; \
4609 $cc -E <testcpp.c >testcpp.out 2>&1; \
4610 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4611 echo "Yup, it does."
4612 x_cpp="$cc -E"
4613 x_minus='';
4614elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4615 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4616 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4617 echo "Yup, it does."
4618 x_cpp="$cc -E"
4619 x_minus='-';
4620elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4621 $cc -P <testcpp.c >testcpp.out 2>&1; \
4622 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4623 echo "Yipee, that works!"
4624 x_cpp="$cc -P"
4625 x_minus='';
4626elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4627 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4628 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4629 echo "At long last!"
4630 x_cpp="$cc -P"
4631 x_minus='-';
4632elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4633 $cpp <testcpp.c >testcpp.out 2>&1; \
4634 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4635 echo "It works!"
4636 x_cpp="$cpp"
4637 x_minus='';
4638elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4639 $cpp - <testcpp.c >testcpp.out 2>&1; \
4640 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4641 echo "Hooray, it works! I was beginning to wonder."
4642 x_cpp="$cpp"
4643 x_minus='-';
4644elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4645 $wrapper <testcpp.c >testcpp.out 2>&1; \
4646 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4647 x_cpp="$wrapper"
4648 x_minus=''
4649 echo "Eureka!"
4650else
4651 dflt=''
4652 rp="No dice. I can't find a C preprocessor. Name one:"
4653 . ./myread
4654 x_cpp="$ans"
4655 x_minus=''
4656 $x_cpp <testcpp.c >testcpp.out 2>&1
4657 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4658 echo "OK, that will do." >&4
4659 else
4660echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4661 exit 1
4662 fi
4663fi
4664
4665case "$ok" in
4666false)
4667 cppstdin="$x_cpp"
4668 cppminus="$x_minus"
4669 cpprun="$x_cpp"
4670 cpplast="$x_minus"
4671 set X $x_cpp
4672 shift
4673 case "$1" in
4674 "$cpp")
4675 echo "Perhaps can we force $cc -E using a wrapper..."
4676 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4677 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4678 then
4679 echo "Yup, we can."
4680 cppstdin="$wrapper"
4681 cppminus='';
4682 else
4683 echo "Nope, we'll have to live without it..."
4684 fi
4685 ;;
4686 esac
4687 case "$cpprun" in
4688 "$wrapper")
4689 cpprun=''
4690 cpplast=''
4691 ;;
4692 esac
4693 ;;
4694esac
4695
4696case "$cppstdin" in
4697"$wrapper"|'cppstdin') ;;
4698*) $rm -f $wrapper;;
4699esac
4700$rm -f testcpp.c testcpp.out
4701
bd9b35c9
JH
4702: Set private lib path
4703case "$plibpth" in
4704'') if ./mips; then
4705 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4706 fi;;
4707esac
4708case "$libpth" in
4709' ') dlist='';;
4710'') dlist="$loclibpth $plibpth $glibpth";;
4711*) dlist="$libpth";;
4712esac
4713
4714: Now check and see which directories actually exist, avoiding duplicates
4715libpth=''
4716for xxx in $dlist
4717do
4718 if $test -d $xxx; then
4719 case " $libpth " in
4720 *" $xxx "*) ;;
4721 *) libpth="$libpth $xxx";;
4722 esac
4723 fi
4724done
4725$cat <<'EOM'
4726
4727Some systems have incompatible or broken versions of libraries. Among
4728the directories listed in the question below, please remove any you
4729know not to be holding relevant libraries, and add any that are needed.
4730Say "none" for none.
8e07c86e
AD
4731
4732EOM
bd9b35c9
JH
4733case "$libpth" in
4734'') dflt='none';;
8e07c86e 4735*)
bd9b35c9
JH
4736 set X $libpth
4737 shift
4738 dflt=${1+"$@"}
8e07c86e 4739 ;;
a0d0e21e 4740esac
bd9b35c9
JH
4741rp="Directories to use for library searches?"
4742. ./myread
4743case "$ans" in
4744none) libpth=' ';;
4745*) libpth="$ans";;
4746esac
a0d0e21e 4747
bd9b35c9
JH
4748: compute shared library extension
4749case "$so" in
4750'')
4751 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4752 dflt='sl'
dd4e71fd 4753 else
bd9b35c9 4754 dflt='so'
dd4e71fd
JH
4755 fi
4756 ;;
bd9b35c9 4757*) dflt="$so";;
dd4e71fd 4758esac
dd4e71fd
JH
4759$cat <<EOM
4760
bd9b35c9 4761On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4762you want to suppress searching of shared libraries for the remainder
bd9b35c9 4763of this configuration.
dd4e71fd
JH
4764
4765EOM
bd9b35c9
JH
4766rp='What is the file extension used for shared libraries?'
4767. ./myread
4768so="$ans"
dd4e71fd 4769
bd9b35c9
JH
4770: Define several unixisms.
4771: Hints files or command line option can be used to override them.
4772: The convoluted testing is in case hints files set either the old
4773: or the new name.
4774case "$_exe" in
4775'') case "$exe_ext" in
1fef16b3 4776 '') ;;
bd9b35c9 4777 *) _exe="$exe_ext" ;;
dd4e71fd 4778 esac
bd9b35c9 4779 ;;
bfb7748a 4780esac
bd9b35c9
JH
4781case "$_a" in
4782'') case "$lib_ext" in
4783 '') _a='.a';;
4784 *) _a="$lib_ext" ;;
dd4e71fd
JH
4785 esac
4786 ;;
dd4e71fd 4787esac
bd9b35c9
JH
4788case "$_o" in
4789'') case "$obj_ext" in
4790 '') _o='.o';;
4791 *) _o="$obj_ext";;
4792 esac
4793 ;;
4794esac
4795case "$p_" in
4796'') case "$path_sep" in
4797 '') p_=':';;
4798 *) p_="$path_sep";;
4799 esac
4800 ;;
4801esac
4802exe_ext=$_exe
4803lib_ext=$_a
4804obj_ext=$_o
4805path_sep=$p_
dd4e71fd 4806
b4eb6b3d
JH
4807: Which makefile gets called first. This is used by make depend.
4808case "$firstmakefile" in
4809'') firstmakefile='makefile';;
4633a7c4 4810esac
4633a7c4 4811
1f603089
JH
4812case "$ccflags" in
4813*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4814esac
4815
4816case "$uselongdouble" in
4817$define|true|[yY]*) dflt='y';;
4818*) dflt='n';;
4819esac
4820cat <<EOM
4821
4822Perl can be built to take advantage of long doubles which
4823(if available) may give more accuracy and range for floating point numbers.
4824
4825If this doesn't make any sense to you, just accept the default '$dflt'.
4826EOM
4827rp='Try to use long doubles if available?'
4828. ./myread
4829case "$ans" in
4830y|Y) val="$define" ;;
4831*) val="$undef" ;;
4832esac
4833set uselongdouble
4834eval $setvar
4835
4836case "$uselongdouble" in
4837true|[yY]*) uselongdouble="$define" ;;
4838esac
4839
1f603089
JH
4840: Look for a hint-file generated 'call-back-unit'. If the
4841: user has specified that long doubles should be used,
4842: we may need to set or change some other defaults.
9da7673b
MB
4843if $test -f uselongdouble.cbu; then
4844 echo "Your platform has some specific hints regarding long doubles, using them..."
4845 . ./uselongdouble.cbu
4846else
4847 case "$uselongdouble" in
4848 $define)
1f603089 4849 $cat <<EOM
9da7673b 4850(Your platform does not have any specific hints for long doubles.)
1f603089 4851EOM
1f603089 4852 ;;
9da7673b
MB
4853 esac
4854fi
1f603089 4855
bd9b35c9
JH
4856: Looking for optional libraries
4857echo " "
4858echo "Checking for optional libraries..." >&4
4859case "$libs" in
4860' '|'') dflt='';;
4861*) dflt="$libs";;
4862esac
4863case "$libswanted" in
4864'') libswanted='c_s';;
4865esac
4866case "$usesocks" in
923fc586 4867"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4868esac
68435ea7
JH
4869libsfound=''
4870libsfiles=''
4871libsdirs=''
13b3f787
JH
4872libspath=''
4873for thisdir in $libpth $xlibpth; do
4874 test -d $thisdir && libspath="$libspath $thisdir"
4875done
bd9b35c9 4876for thislib in $libswanted; do
13b3f787 4877 for thisdir in $libspath; do
f7dd4e7f
JH
4878 xxx=''
4879 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4880 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4881 $test -f "$xxx" && eval $libscheck
4882 $test -f "$xxx" && libstyle=shared
4883 fi
4884 if test ! -f "$xxx"; then
4885 xxx=$thisdir/lib$thislib.$so
4886 $test -f "$xxx" && eval $libscheck
4887 $test -f "$xxx" && libstyle=shared
4888 fi
4889 if test ! -f "$xxx"; then
4890 xxx=$thisdir/lib$thislib$_a
4891 $test -f "$xxx" && eval $libscheck
4892 $test -f "$xxx" && libstyle=static
4893 fi
4894 if test ! -f "$xxx"; then
4895 xxx=$thisdir/$thislib$_a
4896 $test -f "$xxx" && eval $libscheck
4897 $test -f "$xxx" && libstyle=static
4898 fi
4899 if test ! -f "$xxx"; then
4900 xxx=$thisdir/lib${thislib}_s$_a
4901 $test -f "$xxx" && eval $libscheck
4902 $test -f "$xxx" && libstyle=static
09ea5ba9 4903 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4904 fi
4905 if test ! -f "$xxx"; then
4906 xxx=$thisdir/Slib$thislib$_a
4907 $test -f "$xxx" && eval $libscheck
4908 $test -f "$xxx" && libstyle=static
4909 fi
4910 if $test -f "$xxx"; then
43999f95 4911 case "$libstyle" in
f7dd4e7f
JH
4912 shared) echo "Found -l$thislib (shared)." ;;
4913 static) echo "Found -l$thislib." ;;
4914 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4915 esac
bd9b35c9
JH
4916 case " $dflt " in
4917 *"-l$thislib "*);;
f7dd4e7f 4918 *) dflt="$dflt -l$thislib"
43999f95
JH
4919 libsfound="$libsfound $xxx"
4920 yyy=`basename $xxx`
4921 libsfiles="$libsfiles $yyy"
1e127011 4922 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4923 case " $libsdirs " in
4924 *" $yyy "*) ;;
4925 *) libsdirs="$libsdirs $yyy" ;;
4926 esac
4927 ;;
bd9b35c9 4928 esac
f7dd4e7f
JH
4929 break
4930 fi
4931 done
4932 if $test ! -f "$xxx"; then
4933 echo "No -l$thislib."
bd9b35c9
JH
4934 fi
4935done
4936set X $dflt
4937shift
4938dflt="$*"
4939case "$libs" in
4940'') dflt="$dflt";;
4941*) dflt="$libs";;
4942esac
4943case "$dflt" in
4944' '|'') dflt='none';;
4945esac
4633a7c4 4946
bd9b35c9 4947$cat <<EOM
4633a7c4 4948
bd9b35c9
JH
4949In order to compile $package on your machine, a number of libraries
4950are usually needed. Include any other special libraries here as well.
4951Say "none" for none. The default list is almost always right.
8e07c86e 4952EOM
8e07c86e 4953
bd9b35c9
JH
4954echo " "
4955rp="What libraries to use?"
4956. ./myread
4957case "$ans" in
4958none) libs=' ';;
4959*) libs="$ans";;
4960esac
d71b2b6b 4961
bd9b35c9
JH
4962: determine optimization, if desired, or use for debug flag also
4963case "$optimize" in
4964' '|$undef) dflt='none';;
4965'') dflt='-O';;
4966*) dflt="$optimize";;
4967esac
4968$cat <<EOH
d71b2b6b 4969
bd9b35c9
JH
4970By default, $package compiles with the -O flag to use the optimizer.
4971Alternately, you might want to use the symbolic debugger, which uses
4972the -g flag (on traditional Unix systems). Either flag can be
4973specified here. To use neither flag, specify the word "none".
d71b2b6b 4974
bd9b35c9
JH
4975EOH
4976rp="What optimizer/debugger flag should be used?"
4977. ./myread
4978optimize="$ans"
4979case "$optimize" in
4980'none') optimize=" ";;
4981esac
4982
eaf812ae
MB
4983: Check what DEBUGGING is required from the command line
4984: -DEBUGGING or -DDEBUGGING or
4985: -DEBUGGING=both = -g + -DDEBUGGING
4986: -DEBUGGING=-g or -Doptimize=-g = -g
4987: -DEBUGGING=none or -UDEBUGGING =
4988: -DEBUGGING=old or -DEBUGGING=default = ? $optimize
4989case "$EBUGGING" in
4990'') ;;
4991*) DEBUGGING=$EBUGGING ;;
4992esac
4993
4994case "$DEBUGGING" in
5a7c70d6 4995-g|both|$define)
eaf812ae
MB
4996 case "$optimize" in
4997 *-g*) ;;
4998 *) optimize="$optimize -g" ;;
4999 esac ;;
5000none|$undef)
5001 case "$optimize" in
5002 *-g*) set `echo "X $optimize " | sed 's/ -g / /'`
5003 shift
5004 optimize="$*"
5005 ;;
5006 esac ;;
5007esac
5008
bd9b35c9 5009dflt=''
eaf812ae
MB
5010case "$DEBUGGING" in
5011both|$define) dflt='-DDEBUGGING'
5012esac
5013
bd9b35c9
JH
5014: We will not override a previous value, but we might want to
5015: augment a hint file
5016case "$hint" in
5017default|recommended)
5018 case "$gccversion" in
eaf812ae 5019 1*) dflt="$dflt -fpcc-struct-return" ;;
d71b2b6b 5020 esac
eaf812ae
MB
5021 case "$optimize:$DEBUGGING" in
5022 *-g*:old) dflt="$dflt -DDEBUGGING";;
d71b2b6b 5023 esac
bd9b35c9
JH
5024 case "$gccversion" in
5025 2*) if test -d /etc/conf/kconfig.d &&
5026 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5027 then
00e89ad4 5028 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
5029 dflt="$dflt -posix"
5030 fi
f0d04425 5031 ;;
bd9b35c9
JH
5032 esac
5033 case "$gccversion" in
5034 1*) ;;
5035 2.[0-8]*) ;;
5036 ?*) echo " "
5037 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
5038 echo 'int main(void) { return 0; }' > gcctest.c
5039 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
5040 echo "Yes, it does." 2>&1
5041 case "$ccflags" in
00e89ad4 5042 *strict-aliasing*)
bd9b35c9
JH
5043 echo "Leaving current flags $ccflags alone." 2>&1
5044 ;;
5045 *) dflt="$dflt -fno-strict-aliasing" ;;
5046 esac
5047 else
5048 echo "Nope, it doesn't, but that's ok." 2>&1
5049 fi
f0d04425 5050 ;;
e5e20432 5051 esac
00e89ad4
AD
5052 # For gcc, adding -pipe speeds up compilations for some, but apparently
5053 # some assemblers can't read from stdin. (It also slows down compilations
5054 # in other cases, but those are apparently rarer these days.) AD 5/2004.
5055 case "$gccversion" in
5056 ?*) echo " "
5057 echo "Checking if your compiler accepts -pipe" 2>&1
5058 echo 'int main(void) { return 0; }' > gcctest.c
6347b5be 5059 if $cc -pipe -o gcctest gcctest.c; then
00e89ad4
AD
5060 echo "Yes, it does." 2>&1
5061 case "$ccflags" in
5062 *-pipe*)
5063 echo "Leaving current flags $ccflags alone." 2>&1
5064 ;;
5065 *) dflt="$dflt -pipe" ;;
5066 esac
5067 else
5068 echo "Nope, it doesn't, but that's ok." 2>&1
5069 fi
5070 ;;
5071 esac
e5e20432
JH
5072 ;;
5073esac
5074
bd9b35c9
JH
5075case "$mips_type" in
5076*BSD*|'') inclwanted="$locincpth $usrinc";;
5077*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5078esac
5079for thisincl in $inclwanted; do
5080 if $test -d $thisincl; then
5081 if $test x$thisincl != x$usrinc; then
5082 case "$dflt" in
00e89ad4
AD
5083 *" -I$thisincl "*);;
5084 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
5085 esac
5086 fi
5087 fi
5088done
40a7a20a 5089
bd9b35c9
JH
5090inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5091 xxx=true;
5092elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5093 xxx=true;
5094else
5095 xxx=false;
5096fi;
5097if $xxx; then
5098 case "$dflt" in
5099 *$2*);;
5100 *) dflt="$dflt -D$2";;
5101 esac;
5102fi'
40a7a20a 5103
bd9b35c9 5104set signal.h LANGUAGE_C; eval $inctest
40a7a20a 5105
bd9b35c9
JH
5106case "$usesocks" in
5107$define)
5108 ccflags="$ccflags -DSOCKS"
5109 ;;
5110esac
40a7a20a 5111
bd9b35c9
JH
5112case "$hint" in
5113default|recommended) dflt="$ccflags $dflt" ;;
5114*) dflt="$ccflags";;
5115esac
40a7a20a 5116
bd9b35c9
JH
5117case "$dflt" in
5118''|' ') dflt=none;;
5119esac
422af00a 5120
bd9b35c9 5121$cat <<EOH
40a7a20a 5122
bd9b35c9
JH
5123Your C compiler may want other flags. For this question you should include
5124-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5125but you should NOT include libraries or ld flags like -lwhatever. If you
5126want $package to honor its debug switch, you should include -DDEBUGGING here.
5127Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 5128
bd9b35c9 5129To use no flags, specify the word "none".
40a7a20a 5130
bd9b35c9
JH
5131EOH
5132set X $dflt
5133shift
5134dflt=${1+"$@"}
5135rp="Any additional cc flags?"
5136. ./myread
5137case "$ans" in
5138none) ccflags='';;
5139*) ccflags="$ans";;
5140esac
8e07c86e 5141
bd9b35c9 5142: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
5143case "$cppflags" in
5144'') cppflags="$ccflags" ;;
5145*) cppflags="$cppflags $ccflags" ;;
5146esac
bd9b35c9
JH
5147case "$gccversion" in
51481*) cppflags="$cppflags -D__GNUC__"
4633a7c4 5149esac
bd9b35c9
JH
5150case "$mips_type" in
5151'');;
5152*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5153esac
5154case "$cppflags" in
5155'');;
5156*)
5157 echo " "
5158 echo "Let me guess what the preprocessor flags are..." >&4
5159 set X $cppflags
5160 shift
5161 cppflags=''
5162 $cat >cpp.c <<'EOM'
5163#define BLURFL foo
8e07c86e 5164
bd9b35c9
JH
5165BLURFL xx LFRULB
5166EOM
5167 previous=''
5168 for flag in $*
5169 do
5170 case "$flag" in
5171 -*) ftry="$flag";;
5172 *) ftry="$previous $flag";;
5173 esac
5174 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5175 >cpp1.out 2>/dev/null && \
5176 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5177 >cpp2.out 2>/dev/null && \
5178 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5179 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5180 then
5181 cppflags="$cppflags $ftry"
5182 previous=''
5183 else
5184 previous="$flag"
5185 fi
5186 done
5187 set X $cppflags
5188 shift
5189 cppflags=${1+"$@"}
5190 case "$cppflags" in
5191 *-*) echo "They appear to be: $cppflags";;
5192 esac
5193 $rm -f cpp.c cpp?.out
2afac517 5194 ;;
5195esac
8e07c86e 5196
bd9b35c9
JH
5197: flags used in final linking phase
5198case "$ldflags" in
5199'') if ./venix; then
5200 dflt='-i -z'
10a23457 5201 else
bd9b35c9 5202 dflt=''
10a23457 5203 fi
bd9b35c9
JH
5204 case "$ccflags" in
5205 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 5206 esac
bd9b35c9
JH
5207 ;;
5208*) dflt="$ldflags";;
5209esac
5210
5211: Try to guess additional flags to pick up local libraries.
5212for thislibdir in $libpth; do
5213 case " $loclibpth " in
5214 *" $thislibdir "*)
00e89ad4 5215 case "$dflt " in
bd9b35c9
JH
5216 *"-L$thislibdir "*) ;;
5217 *) dflt="$dflt -L$thislibdir" ;;
5218 esac
c4f23d77
AD
5219 ;;
5220 esac
bd9b35c9 5221done
c4f23d77 5222
bd9b35c9
JH
5223case "$dflt" in
5224'') dflt='none' ;;
5225esac
c4f23d77 5226
bd9b35c9
JH
5227$cat <<EOH
5228
5229Your C linker may need flags. For this question you should
5230include -L/whatever and any other flags used by the C linker, but you
5231should NOT include libraries like -lwhatever.
5232
5233Make sure you include the appropriate -L/path flags if your C linker
5234does not normally search all of the directories you specified above,
5235namely
5236 $libpth
5237To use no flags, specify the word "none".
5238
5239EOH
5240
5241rp="Any additional ld flags (NOT including libraries)?"
5242. ./myread
5243case "$ans" in
5244none) ldflags='';;
5245*) ldflags="$ans";;
5246esac
5247rmlist="$rmlist pdp11"
5248
5249: coherency check
5250echo " "
5251echo "Checking your choice of C compiler and flags for coherency..." >&4
5252$cat > try.c <<'EOF'
5253#include <stdio.h>
55954f19 5254int main() { printf("Ok\n"); return(0); }
bd9b35c9 5255EOF
7a282f6d 5256set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
5257shift
5258$cat >try.msg <<'EOM'
5259I've tried to compile and run the following simple program:
5260
5261EOM
5262$cat try.c >> try.msg
5263
5264$cat >> try.msg <<EOM
5265
5266I used the command:
5267
5268 $*
5440bc8e 5269 $run ./try
bd9b35c9
JH
5270
5271and I got the following output:
5272
5273EOM
5274dflt=y
73614538 5275if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5440bc8e
JH
5276 if $sh -c "$run ./try" >>try.msg 2>&1; then
5277 xxx=`$run ./try`
bd9b35c9
JH
5278 case "$xxx" in
5279 "Ok") dflt=n ;;
5280 *) echo 'The program compiled OK, but produced no output.' >> try.msg
5281 case " $libs " in
5282 *" -lsfio "*)
5283 cat >> try.msg <<'EOQS'
5284If $libs contains -lsfio, and sfio is mis-configured, then it
5285sometimes (apparently) runs and exits with a 0 status, but with no
5286output! It may have to do with sfio's use of _exit vs. exit.
5287
5288EOQS
5289 rp="You have a big problem. Shall I abort Configure"
5290 dflt=y
5291 ;;
5292 esac
5293 ;;
5294 esac
5295 else
5296 echo "The program compiled OK, but exited with status $?." >>try.msg
5297 rp="You have a problem. Shall I abort Configure"
5298 dflt=y
5299 fi
5300else
5301 echo "I can't compile the test program." >>try.msg
5302 rp="You have a BIG problem. Shall I abort Configure"
5303 dflt=y
5304fi
5305case "$dflt" in
5306y)
5307 $cat try.msg >&4
5308 case "$knowitall" in
5309 '')
5310 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5311 ;;
bd9b35c9 5312 *) dflt=n;;
c4f23d77 5313 esac
bd9b35c9
JH
5314 echo " "
5315 . ./myread
5316 case "$ans" in
5317 n*|N*) ;;
5318 *) echo "Ok. Stopping Configure." >&4
5319 exit 1
c4f23d77
AD
5320 ;;
5321 esac
5322 ;;
bd9b35c9 5323n) echo "OK, that should do.";;
c4f23d77 5324esac
bd9b35c9 5325$rm -f try try.* core
c4f23d77 5326
bd9b35c9
JH
5327: define a shorthand compile call
5328compile='
5329mc_file=$1;
5330shift;
08413ebc 5331$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5332: define a shorthand compile call for compilations that should be ok.
5333compile_ok='
5334mc_file=$1;
5335shift;
7a282f6d 5336$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5337
8dfa8df9
JH
5338: determine filename position in cpp output
5339echo " "
5340echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5341case "$osname" in
5342vos) testaccess=-e ;;
5343*) testaccess=-r ;;
5344esac
8dfa8df9
JH
5345echo '#include <stdio.h>' > foo.c
5346$cat >fieldn <<EOF
5347$startsh
5348$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5349$grep '^[ ]*#.*stdio\.h' | \
5350while read cline; do
5351 pos=1
5352 set \$cline
5353 while $test \$# -gt 0; do
a5a94ea5 5354 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5355 echo "\$pos"
5356 exit 0
5357 fi
5358 shift
5359 pos=\`expr \$pos + 1\`
5360 done
5361done
5362EOF
5363chmod +x fieldn
5364fieldn=`./fieldn`
5365$rm -f foo.c fieldn
5366case $fieldn in
5367'') pos='???';;
53681) pos=first;;
53692) pos=second;;
53703) pos=third;;
5371*) pos="${fieldn}th";;
5372esac
5373echo "Your cpp writes the filename in the $pos field of the line."
5374
3c728e00
JH
5375case "$osname" in
5376vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5c728af0 5377os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5378*) cppfilter='' ;;
5379esac
8dfa8df9
JH
5380: locate header file
5381$cat >findhdr <<EOF
5382$startsh
5383wanted=\$1
5384name=''
5385for usrincdir in $usrinc
5386do
5387 if test -f \$usrincdir/\$wanted; then
5388 echo "\$usrincdir/\$wanted"
5389 exit 0
5390 fi
5391done
5392awkprg='{ print \$$fieldn }'
5393echo "#include <\$wanted>" > foo\$\$.c
5394$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5395$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5396while read cline; do
5397 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5398 case "\$name" in
5399 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5400 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5401 *) exit 2;;
5402 esac;
5403done;
5404#
5405# status = 0: grep returned 0 lines, case statement not executed
5406# status = 1: headerfile found
5407# status = 2: while loop executed, no headerfile found
5408#
5409status=\$?
5410$rm -f foo\$\$.c;
5411if test \$status -eq 1; then
5412 exit 0;
5413fi
5414exit 1
5415EOF
5416chmod +x findhdr
5417
5418: define an alternate in-header-list? function
5419inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5420cont=true; xxf="echo \"<\$1> found.\" >&4";
5421case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5422*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5423esac;
5424case $# in 4) instead=instead;; *) instead="at last";; esac;
5425while $test "$cont"; do
5426 xxx=`./findhdr $1`
5427 var=$2; eval "was=\$$2";
5428 if $test "$xxx" && $test -r "$xxx";
5429 then eval $xxf;
5430 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5431 cont="";
5432 else eval $xxnf;
5433 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5434 set $yyy; shift; shift; yyy=$@;
5435 case $# in 0) cont="";;
5436 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5437 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5438 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5439 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5440 esac;
5441done;
5442while $test "$yyy";
5443do set $yyy; var=$2; eval "was=\$$2";
5444 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5445 set $yyy; shift; shift; yyy=$@;
5446done'
5447
d1daaddf
JH
5448: see if stdlib is available
5449set stdlib.h i_stdlib
5450eval $inhdr
5451
5452: check for lengths of integral types
5453echo " "
5454case "$intsize" in
5455'')
5456 echo "Checking to see how big your integers are..." >&4
c63dfae1 5457 $cat >try.c <<EOCP
d1daaddf
JH
5458#include <stdio.h>
5459#$i_stdlib I_STDLIB
5460#ifdef I_STDLIB
5461#include <stdlib.h>
5462#endif
5463int main()
5464{
5465 printf("intsize=%d;\n", (int)sizeof(int));
5466 printf("longsize=%d;\n", (int)sizeof(long));
5467 printf("shortsize=%d;\n", (int)sizeof(short));
5468 exit(0);
5469}
5470EOCP
5471 set try
5472 if eval $compile_ok && $run ./try > /dev/null; then
5473 eval `$run ./try`
5474 echo "Your integers are $intsize bytes long."
5475 echo "Your long integers are $longsize bytes long."
5476 echo "Your short integers are $shortsize bytes long."
5477 else
5478 $cat >&4 <<EOM
5479!
5480Help! I can't compile and run the intsize test program: please enlighten me!
5481(This is probably a misconfiguration in your system or libraries, and
5482you really ought to fix it. Still, I'll try anyway.)
5483!
5484EOM
5485 dflt=4
5486 rp="What is the size of an integer (in bytes)?"
5487 . ./myread
5488 intsize="$ans"
5489 dflt=$intsize
5490 rp="What is the size of a long integer (in bytes)?"
5491 . ./myread
5492 longsize="$ans"
5493 dflt=2
5494 rp="What is the size of a short integer (in bytes)?"
5495 . ./myread
5496 shortsize="$ans"
5497 fi
5498 ;;
5499esac
5500$rm -f try try.*
5501
5502: check for long long
5503echo " "
5504echo "Checking to see if you have long long..." >&4
5505echo 'int main() { long long x = 7; return 0; }' > try.c
5506set try
5507if eval $compile; then
5508 val="$define"
5509 echo "You have long long."
5510else
5511 val="$undef"
5512 echo "You do not have long long."
5513fi
5514$rm try.*
5515set d_longlong
5516eval $setvar
5517
5518: check for length of long long
5519case "${d_longlong}${longlongsize}" in
5520$define)
5521 echo " "
5522 echo "Checking to see how big your long longs are..." >&4
5523 $cat >try.c <<'EOCP'
5524#include <stdio.h>
5525int main()
5526{
5527 printf("%d\n", (int)sizeof(long long));
5528 return(0);
5529}
5530EOCP
5531 set try
5532 if eval $compile_ok; then
5533 longlongsize=`$run ./try`
5534 echo "Your long longs are $longlongsize bytes long."
5535 else
5536 dflt='8'
5537 echo " "
5538 echo "(I can't seem to compile the test program. Guessing...)"
5539 rp="What is the size of a long long (in bytes)?"
5540 . ./myread
5541 longlongsize="$ans"
5542 fi
5543 if $test "X$longsize" = "X$longlongsize"; then
5544 echo "(That isn't any different from an ordinary long.)"
5545 fi
5546 ;;
5547esac
5548$rm -f try.* try
5549
8dfa8df9
JH
5550: see if inttypes.h is available
5551: we want a real compile instead of Inhdr because some systems
5552: have an inttypes.h which includes non-existent headers
5553echo " "
5554$cat >try.c <<EOCP
5555#include <inttypes.h>
5556int main() {
5557 static int32_t foo32 = 0x12345678;
5558}
5559EOCP
5560set try
5561if eval $compile; then
5562 echo "<inttypes.h> found." >&4
5563 val="$define"
5564else
5565 echo "<inttypes.h> NOT found." >&4
5566 val="$undef"
5567fi
5568$rm -f try.c try
5569set i_inttypes
5570eval $setvar
5571
5572: check for int64_t
5573echo " "
5574echo "Checking to see if you have int64_t..." >&4
5575$cat >try.c <<EOCP
5576#include <sys/types.h>
5577#$i_inttypes I_INTTYPES
5578#ifdef I_INTTYPES
5579#include <inttypes.h>
5580#endif
5581int main() { int64_t x = 7; }
5582EOCP
5583set try
5584if eval $compile; then
5585 val="$define"
5586 echo "You have int64_t."
5587else
5588 val="$undef"
5589 echo "You do not have int64_t."
5590fi
5591$rm -f try try.*
5592set d_int64_t
5593eval $setvar
5594
5595
5596echo " "
5597echo "Checking which 64-bit integer type we could use..." >&4
5598
5599case "$intsize" in
56008) val=int
5601 set quadtype
5602 eval $setvar
5603 val='"unsigned int"'
5604 set uquadtype
5605 eval $setvar
5606 quadkind=1
5607 ;;
5608*) case "$longsize" in
5609 8) val=long
5610 set quadtype
5611 eval $setvar
5612 val='"unsigned long"'
5613 set uquadtype
5614 eval $setvar
5615 quadkind=2
5616 ;;
5617 *) case "$d_longlong:$longlongsize" in
5618 define:8)
5619 val='"long long"'
5620 set quadtype
5621 eval $setvar
5622 val='"unsigned long long"'
5623 set uquadtype
5624 eval $setvar
5625 quadkind=3
5626 ;;
5627 *) case "$d_int64_t" in
5628 define)
5629 val=int64_t
5630 set quadtype
5631 eval $setvar
5632 val=uint64_t
5633 set uquadtype
5634 eval $setvar
5635 quadkind=4
5636 ;;
5637 esac
5638 ;;
5639 esac
5640 ;;
5641 esac
5642 ;;
5643esac
5644
5645case "$quadtype" in
5646'') echo "Alas, no 64-bit integer types in sight." >&4
5647 d_quad="$undef"
5648 ;;
5649*) echo "We could use '$quadtype' for 64-bit integers." >&4
5650 d_quad="$define"
5651 ;;
5652esac
5653
b4eb6b3d
JH
5654
5655case "$uselonglong" in
5656"$define"|true|[yY]*)
5657 cat <<EOM >&4
5658
5659*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5660EOM
5661 use64bitint="$define"
5662 ;;
5663esac
5664case "$use64bits" in
5665"$define"|true|[yY]*)
5666 cat <<EOM >&4
5667
5668*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5669EOM
5670 use64bitint="$define"
5671 ;;
5672esac
5673case "$use64bitints" in
5674"$define"|true|[yY]*)
5675 cat <<EOM >&4
5676
5677*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5678EOM
5679 use64bitint="$define"
5680 ;;
5681esac
5682case "$use64bitsint" in
5683"$define"|true|[yY]*)
5684 cat <<EOM >&4
5685
5686*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5687EOM
5688 use64bitint="$define"
5689 ;;
5690esac
5691case "$uselonglongs" in
5692"$define"|true|[yY]*)
5693 cat <<EOM >&4
5694
5695*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5696EOM
5697 use64bitint="$define"
5698 ;;
5699esac
5700case "$use64bitsall" in
5701"$define"|true|[yY]*)
5702 cat <<EOM >&4
5703
5704*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5705EOM
5706 use64bitall="$define"
5707 ;;
5708esac
5709
5710case "$ccflags" in
5711*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5712esac
5713case "$use64bitall" in
5714"$define"|true|[yY]*) use64bitint="$define" ;;
5715esac
5716
5717case "$longsize" in
57188) cat <<EOM
5719
5720You have natively 64-bit long integers.
5721EOM
5722 val="$define"
5723 ;;
5724*) case "$use64bitint" in
5725 "$define"|true|[yY]*) dflt='y';;
5726 *) dflt='n';;
5727 esac
8dfa8df9
JH
5728 case "$d_quad" in
5729 "$define") ;;
5730 *) dflt='n' ;;
5731 esac
b4eb6b3d
JH
5732 cat <<EOM
5733
5734Perl can be built to take advantage of 64-bit integer types
5735on some systems. To do so, Configure can be run with -Duse64bitint.
5736Choosing this option will most probably introduce binary incompatibilities.
5737
5738If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5739(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5740EOM
5741 rp='Try to use 64-bit integers, if available?'
5742 . ./myread
5743 case "$ans" in
5744 [yY]*) val="$define" ;;
5745 *) val="$undef" ;;
5746 esac
5747 ;;
5748esac
5749set use64bitint
5750eval $setvar
5751
5752case "$use64bitall" in
5753"$define"|true|[yY]*) dflt='y' ;;
5754*) case "$longsize" in
5755 8) dflt='y' ;;
5756 *) dflt='n' ;;
5757 esac
5758 ;;
5759esac
5760cat <<EOM
5761
5762You may also choose to try maximal 64-bitness. It means using as much
576364-bitness as possible on the platform. This in turn means even more
5764binary incompatibilities. On the other hand, your platform may not
5765have any more 64-bitness available than what you already have chosen.
5766
5767If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5768(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5769EOM
5770rp='Try to use maximal 64-bit support, if available?'
5771. ./myread
5772case "$ans" in
5773[yY]*) val="$define" ;;
5774*) val="$undef" ;;
5775esac
5776set use64bitall
5777eval $setvar
5778case "$use64bitall" in
5779"$define")
5780 case "$use64bitint" in
5781 "$undef")
5782 cat <<EOM
5783
5784Since you have chosen a maximally 64-bit build, I'm also turning on
5785the use of 64-bit integers.
5786EOM
5787 use64bitint="$define" ;;
5788 esac
5789 ;;
5790esac
5791
b4eb6b3d
JH
5792: Look for a hint-file generated 'call-back-unit'. If the
5793: user has specified that a 64-bit perl is to be built,
5794: we may need to set or change some other defaults.
19a100ff 5795if $test -f use64bitint.cbu; then
9da7673b 5796 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
19a100ff
MB
5797 . ./use64bitint.cbu
5798fi
9da7673b
MB
5799case "$use64bitint" in
5800"$define"|true|[yY]*)
b4eb6b3d
JH
5801 case "$longsize" in
5802 4) case "$archname64" in
5803 '') archname64=64int ;;
5804 esac
5805 ;;
5806 esac
5807 ;;
5808esac
5809
b4eb6b3d
JH
5810: Look for a hint-file generated 'call-back-unit'. If the
5811: user has specified that a maximally 64-bit perl is to be built,
5812: we may need to set or change some other defaults.
19a100ff 5813if $test -f use64bitall.cbu; then
9da7673b 5814 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
19a100ff
MB
5815 . ./use64bitall.cbu
5816fi
9da7673b
MB
5817case "$use64bitall" in
5818"$define"|true|[yY]*)
b4eb6b3d
JH
5819 case "$longsize" in
5820 4) case "$archname64" in
5821 ''|64int) archname64=64all ;;
5822 esac
5823 ;;
5824 esac
5825 ;;
5826esac
5827
1911a026
JH
5828case "$d_quad:$use64bitint" in
5829$undef:$define)
5830 cat >&4 <<EOF
5831
5832*** You have chosen to use 64-bit integers,
19a100ff 5833*** but none can be found.
09b58c7b 5834*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
1911a026
JH
5835*** Cannot continue, aborting.
5836
5837EOF
5838 exit 1
5839 ;;
5840esac
5841
36adc09b
JH
5842: check for length of double
5843echo " "
5844case "$doublesize" in
5845'')
5846 echo "Checking to see how big your double precision numbers are..." >&4
5847 $cat >try.c <<EOCP
5848#include <stdio.h>
1911a026
JH
5849#$i_stdlib I_STDLIB
5850#ifdef I_STDLIB
5851#include <stdlib.h>
5852#endif
36adc09b
JH
5853int main()
5854{
5855 printf("%d\n", (int)sizeof(double));
1911a026 5856 exit(0);
36adc09b
JH
5857}
5858EOCP
5859 set try
5860 if eval $compile_ok; then
5861 doublesize=`$run ./try`
5862 echo "Your double is $doublesize bytes long."
5863 else
5864 dflt='8'
5865 echo "(I can't seem to compile the test program. Guessing...)"
5866 rp="What is the size of a double precision number (in bytes)?"
5867 . ./myread
5868 doublesize="$ans"
5869 fi
5870 ;;
5871esac
5872$rm -f try.c try
5873
5874: check for long doubles
5875echo " "
5876echo "Checking to see if you have long double..." >&4
5877echo 'int main() { long double x = 7.0; }' > try.c
5878set try
5879if eval $compile; then
5880 val="$define"
5881 echo "You have long double."
5882else
5883 val="$undef"
5884 echo "You do not have long double."
5885fi
5886$rm try.*
5887set d_longdbl
5888eval $setvar
5889
5890: check for length of long double
5891case "${d_longdbl}${longdblsize}" in
5892$define)
5893 echo " "
5894 echo "Checking to see how big your long doubles are..." >&4
5895 $cat >try.c <<'EOCP'
5896#include <stdio.h>
5897int main()
5898{
5899 printf("%d\n", sizeof(long double));
5900}
5901EOCP
5902 set try
5903 set try
5904 if eval $compile; then
5905 longdblsize=`$run ./try`
5906 echo "Your long doubles are $longdblsize bytes long."
5907 else
5908 dflt='8'
5909 echo " "
5910 echo "(I can't seem to compile the test program. Guessing...)" >&4
5911 rp="What is the size of a long double (in bytes)?"
5912 . ./myread
5913 longdblsize="$ans"
5914 fi
5915 if $test "X$doublesize" = "X$longdblsize"; then
7ad90562
AD
5916 echo "That isn't any different from an ordinary double."
5917 echo "I'll keep your setting anyway, but you may see some"
5918 echo "harmless compilation warnings."
36adc09b
JH
5919 fi
5920 ;;
5921esac
5922$rm -f try.* try
5923
89ce900e 5924: determine the architecture name
b4eb6b3d 5925echo " "
89ce900e
JH
5926if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5927 tarch=`arch`"-$osname"
5928elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5929 if uname -m > tmparch 2>&1 ; then
5930 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5931 -e 's/$/'"-$osname/" tmparch`
5932 else
5933 tarch="$osname"
5934 fi
5935 $rm -f tmparch
b4eb6b3d 5936else
89ce900e 5937 tarch="$osname"
b4eb6b3d 5938fi
89ce900e
JH
5939case "$myarchname" in
5940''|"$tarch") ;;
5941*)
5942 echo "(Your architecture name used to be $myarchname.)"
5943 archname=''
5944 ;;
5945esac
5946case "$targetarch" in
5947'') ;;
5948*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5949esac
5950myarchname="$tarch"
5951case "$archname" in
5952'') dflt="$tarch";;
5953*) dflt="$archname";;
5954esac
5955rp='What is your architecture name'
5956. ./myread
5957archname="$ans"
5958case "$usethreads" in
5959$define)
5960 echo "Threads selected." >&4
5961 case "$archname" in
5962 *-thread*) echo "...and architecture name already has -thread." >&4
5963 ;;
5964 *) archname="$archname-thread"
5965 echo "...setting architecture name to $archname." >&4
5966 ;;
5967 esac
5968 ;;
5969esac
5970case "$usemultiplicity" in
5971$define)
5972 echo "Multiplicity selected." >&4
5973 case "$archname" in
5974 *-multi*) echo "...and architecture name already has -multi." >&4
5975 ;;
5976 *) archname="$archname-multi"
5977 echo "...setting architecture name to $archname." >&4
5978 ;;
5979 esac
5980 ;;
5981esac
5982case "$use64bitint$use64bitall" in
5983*"$define"*)
5984 case "$archname64" in
5985 '')
5986 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
bd9b35c9 5987 ;;
89ce900e
JH
5988 *)
5989 case "$use64bitint" in
5990 "$define") echo "64 bit integers selected." >&4 ;;
5991 esac
5992 case "$use64bitall" in
5993 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5994 esac
5995 case "$archname" in
5996 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5997 ;;
5998 *) archname="$archname-$archname64"
5999 echo "...setting architecture name to $archname." >&4
6000 ;;
6001 esac
c1a7f87b
JH
6002 ;;
6003 esac
89ce900e
JH
6004esac
6005case "$uselongdouble" in
6006$define)
6007 echo "Long doubles selected." >&4
6008 case "$longdblsize" in
6009 $doublesize)
6010 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6011 ;;
6012 *)
6013 case "$archname" in
6014 *-ld*) echo "...and architecture name already has -ld." >&4
6015 ;;
6016 *) archname="$archname-ld"
6017 echo "...setting architecture name to $archname." >&4
6018 ;;
6019 esac
bd9b35c9
JH
6020 ;;
6021 esac
bd9b35c9 6022 ;;
89ce900e
JH
6023esac
6024case "$useperlio" in
6025$define)
6026 echo "Perlio selected." >&4
6027 ;;
bd9b35c9 6028*)
89ce900e
JH
6029 echo "Perlio not selected, using stdio." >&4
6030 case "$archname" in
6031 *-stdio*) echo "...and architecture name already has -stdio." >&4
6032 ;;
6033 *) archname="$archname-stdio"
6034 echo "...setting architecture name to $archname." >&4
6035 ;;
6036 esac
bd9b35c9
JH
6037 ;;
6038esac
d2e0c6f7
JH
6039if $test -f archname.cbu; then
6040 echo "Your platform has some specific hints for architecture name, using them..."
6041 . ./archname.cbu
6042fi
bd9b35c9 6043
b4eb6b3d
JH
6044: set the prefixit variable, to compute a suitable default value
6045prefixit='case "$3" in
6046""|none)
6047 case "$oldprefix" in
6048 "") eval "$1=\"\$$2\"";;
6049 *)
6050 case "$3" in
6051 "") eval "$1=";;
6052 none)
6053 eval "tp=\"\$$2\"";
6054 case "$tp" in
6055 ""|" ") eval "$1=\"\$$2\"";;
6056 *) eval "$1=";;
6057 esac;;
6058 esac;;
6059 esac;;
6060*)
6061 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6062 case "$tp" in
6063 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6064 /*-$oldprefix/*|\~*-$oldprefix/*)
6065 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6066 *) eval "$1=\"\$$2\"";;
6067 esac;;
6068esac'
6069
f3f1a2d8
MB
6070: determine installation style
6071: For now, try to deduce it from prefix unless it is already set.
6072: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6073case "$installstyle" in
6074'') case "$prefix" in
6075 *perl*) dflt='lib';;
6076 *) dflt='lib/perl5' ;;
6077 esac
6078 ;;
6079*) dflt="$installstyle" ;;
4d20abad 6080esac
f3f1a2d8
MB
6081: Probably not worth prompting for this since we prompt for all
6082: the directories individually, and the prompt would be too long and
6083: confusing anyway.
6084installstyle=$dflt
4d20abad 6085
eaf812ae
MB
6086: determine where public executables go
6087echo " "
6088set dflt bin bin
6089eval $prefixit
6090fn=d~
6091rp='Pathname where the public executables will reside?'
6092. ./getfile
6093if $test "X$ansexp" != "X$binexp"; then
6094 installbin=''
6095fi
6096prefixvar=bin
6097: XXX Bug? -- ignores Configure -Dinstallprefix setting.
d0e36aa9 6098: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
a2d23ec2 6099: this via initialinstalllocation
eaf812ae
MB
6100. ./setprefixvar
6101
6102case "$userelocatableinc" in
6103$define|true|[yY]*) dflt='y' ;;
6104*) dflt='n' ;;
6105esac
6106cat <<EOM
6107
6108Would you like to build Perl so that the installation is relocatable, so that
6109library paths in @INC are determined relative to the path of the perl binary?
6110This is not advised for system Perl installs, or if you need to run setid
6111scripts or scripts under taint mode.
6112
6113If this doesn't make any sense to you, just accept the default '$dflt'.
6114EOM
6115rp='Use relocatable @INC?'
6116. ./myread
6117case "$ans" in
6118y|Y) val="$define" ;;
6119*) val="$undef" ;;
6120esac
6121set userelocatableinc
6122eval $setvar
6123
ea7d701d 6124initialinstalllocation="$binexp"
eaf812ae
MB
6125: Default prefix is now "up one level from where the binaries are"
6126case "$userelocatableinc" in
6127$define|true|[yY]*)
eaf812ae
MB
6128 bin=".../"
6129 binexp=".../"
6130 prefix=".../.."
6131 prefixexp=".../.."
6132 installprefixexp=".../.."
6133 ;;
6134esac
6135
b4eb6b3d
JH
6136: determine where private library files go
6137: Usual default is /usr/local/lib/perl5/$version.
f3f1a2d8 6138: Also allow things like /opt/perl/lib/$version, since
b4eb6b3d
JH
6139: /opt/perl/lib/perl5... would be redundant.
6140: The default "style" setting is made in installstyle.U
6141case "$installstyle" in
6142*lib/perl5*) set dflt privlib lib/$package/$version ;;
6143*) set dflt privlib lib/$version ;;
6144esac
6145eval $prefixit
6146$cat <<EOM
6147
6148There are some auxiliary files for $package that need to be put into a
6149private library directory that is accessible by everyone.
6150
6151EOM
eaf812ae 6152fn=$binexp
b4eb6b3d
JH
6153fn=d~+
6154rp='Pathname where the private library files will reside?'
6155. ./getfile
79522dd2
NC
6156prefixvar=privlib
6157. ./setprefixvar
b4eb6b3d
JH
6158
6159: set the prefixup variable, to restore leading tilda escape
6160prefixup='case "$prefixexp" in
6161"$prefix") ;;
6162*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6163esac'
6164
6165: determine where public architecture dependent libraries go
6166set archlib archlib
6167eval $prefixit
6168: privlib default is /usr/local/lib/$package/$version
6169: archlib default is /usr/local/lib/$package/$version/$archname
6170: privlib may have an optional trailing /share.
6171tdflt=`echo $privlib | $sed 's,/share$,,'`
6172tdflt=$tdflt/$archname
6173case "$archlib" in
6174'') dflt=$tdflt
6175 ;;
6176*) dflt="$archlib"
6177 ;;
6178esac
6179$cat <<EOM
6180
6181$spackage contains architecture-dependent library files. If you are
6182sharing libraries in a heterogeneous environment, you might store
6183these files in a separate location. Otherwise, you can just include
6184them with the rest of the public library files.
6185
6186EOM
eaf812ae 6187fn=$binexp
b4eb6b3d
JH
6188fn=d+~
6189rp='Where do you want to put the public architecture-dependent libraries?'
6190. ./getfile
79522dd2
NC
6191prefixvar=archlib
6192. ./setprefixvar
b4eb6b3d
JH
6193if $test X"$archlib" = X"$privlib"; then
6194 d_archlib="$undef"
6195else
6196 d_archlib="$define"
6197fi
b4eb6b3d 6198
b4eb6b3d
JH
6199: see if setuid scripts can be secure
6200$cat <<EOM
6201
6202Some kernels have a bug that prevents setuid #! scripts from being
6203secure. Some sites have disabled setuid #! scripts because of this.
6204
6205First let's decide if your kernel supports secure setuid #! scripts.
6206(If setuid #! scripts would be secure but have been disabled anyway,
6207don't say that they are secure if asked.)
6208
6209EOM
6210
6211val="$undef"
6212if $test -d /dev/fd; then
6213 echo "#!$ls" >reflect
6214 chmod +x,u+s reflect
6215 ./reflect >flect 2>&1
6216 if $contains "/dev/fd" flect >/dev/null; then
6217 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6218 val="$define"
6219 else
6220 $cat <<EOM
6221If you are not sure if they are secure, I can check but I'll need a
6222username and password different from the one you are using right now.
6223If you don't have such a username or don't want me to test, simply
6224enter 'none'.
6225
6226EOM
6227 rp='Other username to test security of setuid scripts with?'
6228 dflt='none'
6229 . ./myread
6230 case "$ans" in
6231 n|none)
6232 case "$d_suidsafe" in
6233 '') echo "I'll assume setuid scripts are *not* secure." >&4
6234 dflt=n;;
6235 "$undef")
6236 echo "Well, the $hint value is *not* secure." >&4
6237 dflt=n;;
6238 *) echo "Well, the $hint value *is* secure." >&4
6239 dflt=y;;
6240 esac
c1a7f87b 6241 ;;
b4eb6b3d
JH
6242 *)
6243 $rm -f reflect flect
6244 echo "#!$ls" >reflect
6245 chmod +x,u+s reflect
6246 echo >flect
6247 chmod a+w flect
6248 echo '"su" will (probably) prompt you for '"$ans's password."
6249 su $ans -c './reflect >flect'
6250 if $contains "/dev/fd" flect >/dev/null; then
6251 echo "Okay, it looks like setuid scripts are secure." >&4
6252 dflt=y
6253 else
6254 echo "I don't think setuid scripts are secure." >&4
6255 dflt=n
6256 fi
6257 ;;
6258 esac
6259 rp='Does your kernel have *secure* setuid scripts?'
6260 . ./myread
6261 case "$ans" in
6262 [yY]*) val="$define";;
6263 *) val="$undef";;
6264 esac
6265 fi
6266else
6267 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6268 echo "(That's for file descriptors, not floppy disks.)"
6269 val="$undef"
6270fi
6271set d_suidsafe
6272eval $setvar
6273
6274$rm -f reflect flect
6275
6276: now see if they want to do setuid emulation
6277echo " "
6278val="$undef"
6279case "$d_suidsafe" in
6280"$define")
6281 val="$undef"
3c728e00 6282 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d 6283 ;;
f3f1a2d8
MB
6284*)
6285 $cat <<EOM
6286Some systems have disabled setuid scripts, especially systems where
6287setuid scripts cannot be secure. On systems where setuid scripts have
6288been disabled, the setuid/setgid bits on scripts are currently
6289useless. It is possible for $package to detect those bits and emulate
6290setuid/setgid in a secure fashion. This emulation will only work if
6291setuid scripts have been disabled in your kernel.
6292
6293EOM
6294 case "$d_dosuid" in
6295 "$define") dflt=y ;;
6296 *) dflt=n ;;
6297 esac
6298 rp="Do you want to do setuid/setgid emulation?"
6299 . ./myread
6300 case "$ans" in
6301 [yY]*) val="$define";;
6302 *) val="$undef";;
6303 esac
6304 ;;
6305esac
6306set d_dosuid
6307eval $setvar
6308
f3f1a2d8
MB
6309: Find perl5.005 or later.
6310echo "Looking for a previously installed perl5.005 or later... "
6311case "$perl5" in
6312'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6313 : Check if this perl is recent and can load a simple module
6314 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6315 perl5=$tdir/perl
6316 break;
6317 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6318 perl5=$tdir/perl5
6319 break;
6320 fi
6321 done
6322 ;;
6323*) perl5="$perl5"
6324 ;;
6325esac
6326case "$perl5" in
6327'') echo "None found. That's ok.";;
6328*) echo "Using $perl5." ;;
6329esac
6330
6331$cat <<EOM
6332
6333After $package is installed, you may wish to install various
6334add-on modules and utilities. Typically, these add-ons will
6335be installed under $prefix with the rest
6336of this package. However, you may wish to install such add-ons
6337elsewhere under a different prefix.
6338
6339If you do not wish to put everything under a single prefix, that's
6340ok. You will be prompted for the individual locations; this siteprefix
6341is only used to suggest the defaults.
6342
6343The default should be fine for most people.
6344
6345EOM
6346fn=d~+
6347rp='Installation prefix to use for add-on modules and utilities?'
6348: XXX Here might be another good place for an installstyle setting.
6349case "$siteprefix" in
6350'') dflt=$prefix ;;
6351*) dflt=$siteprefix ;;
6352esac
6353. ./getfile
6354: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6355oldsiteprefix=''
6356case "$siteprefix" in
6357'') ;;
6358*) case "$ans" in
6359 "$prefix") ;;
6360 *) oldsiteprefix="$prefix";;
6361 esac
6362 ;;
6363esac
6364siteprefix="$ans"
6365siteprefixexp="$ansexp"
6366
6367: determine where site specific libraries go.
6368: Usual default is /usr/local/lib/perl5/site_perl/$version
6369: The default "style" setting is made in installstyle.U
6370: XXX No longer works with Prefixit stuff.
6371prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6372case "$sitelib" in
6373'') case "$installstyle" in
6374 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6375 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6376 esac
6377 ;;
6378*) dflt="$sitelib"
6379 ;;
6380esac
6381$cat <<EOM
6382
6383The installation process will create a directory for
6384site-specific extensions and modules. Most users find it convenient
6385to place all site-specific files in this directory rather than in the
6386main distribution directory.
6387
6388EOM
6389fn=d~+
6390rp='Pathname for the site-specific library files?'
6391. ./getfile
6392prefixvar=sitelib
6393. ./setprefixvar
6394sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6395
6396: Determine list of previous versions to include in @INC
6397$cat > getverlist <<EOPL
6398#!$perl5 -w
6399use File::Basename;
6400\$api_versionstring = "$api_versionstring";
6401\$version = "$version";
6402\$stem = "$sitelib_stem";
6403\$archname = "$archname";
6404EOPL
6405 $cat >> getverlist <<'EOPL'
13cfc98d
MB
6406# The list found is store twice for each entry: the original name, and
6407# the binary broken down version as pack "sss", so sorting is easy and
6408# unambiguous. This will work for all versions that have a maximum of
6409# three digit groups, separate by '.'s or '_'s. Names are extended with
6410# ".0.0" to ensure at least three elements for the pack.
6411# -- H.Merijn Brand (m)'06 23-10-2006
6412
f3f1a2d8
MB
6413# Can't have leading @ because metaconfig interprets it as a command!
6414;@inc_version_list=();
6415# XXX Redo to do opendir/readdir?
6416if (-d $stem) {
6417 chdir($stem);
13cfc98d
MB
6418 ;@candidates = map {
6419 [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
f3f1a2d8
MB
6420}
6421else {
6422 ;@candidates = ();
6423}
6424
13cfc98d
MB
6425($pversion, $aversion, $vsn5005) = map {
6426 pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
f3f1a2d8 6427foreach $d (@candidates) {
13cfc98d
MB
6428 if ($d->[1] lt $pversion) {
6429 if ($d->[1] ge $aversion) {
6430 unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
f3f1a2d8 6431 }
13cfc98d
MB
6432 elsif ($d->[1] ge $vsn5005) {
6433 unshift(@inc_version_list, grep { -d } $d->[0]);
f3f1a2d8
MB
6434 }
6435 }
6436 else {
6437 # Skip newer version. I.e. don't look in
6438 # 5.7.0 if we're installing 5.6.1.
6439 }
6440}
6441
6442if (@inc_version_list) {
6443 print join(' ', @inc_version_list);
6444}
6445else {
6446 # Blank space to preserve value for next Configure run.
6447 print " ";
6448}
6449EOPL
6450chmod +x getverlist
6451case "$inc_version_list" in
6452'') if test -x "$perl5$exe_ext"; then
6453 dflt=`$perl5 getverlist`
6454 else
6455 dflt='none'
6456 fi
6457 ;;
6458$undef) dflt='none' ;;
6459*) eval dflt=\"$inc_version_list\" ;;
6460esac
6461case "$dflt" in
6462''|' ') dflt=none ;;
6463esac
6464case "$dflt" in
64655.005) dflt=none ;;
6466esac
6467$cat <<EOM
6468
6469In order to ease the process of upgrading, this version of perl
6470can be configured to use modules built and installed with earlier
6471versions of perl that were installed under $prefix. Specify here
6472the list of earlier versions that this version of perl should check.
6473If Configure detected no earlier versions of perl installed under
6474$prefix, then the list will be empty. Answer 'none' to tell perl
6475to not search earlier versions.
b4eb6b3d 6476
f3f1a2d8
MB
6477The default should almost always be sensible, so if you're not sure,
6478just accept the default.
b4eb6b3d 6479EOM
f3f1a2d8
MB
6480
6481rp='List of earlier versions to include in @INC?'
6482. ./myread
6483case "$ans" in
6484[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6485*) inc_version_list="$ans" ;;
6486esac
6487case "$inc_version_list" in
6488''|' ')
6489 inc_version_list_init='0'
6490 d_inc_version_list="$undef"
6491 ;;
6492*) inc_version_list_init=`echo $inc_version_list |
6493 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6494 d_inc_version_list="$define"
b4eb6b3d
JH
6495 ;;
6496esac
f3f1a2d8 6497$rm -f getverlist
b4eb6b3d 6498
b4eb6b3d 6499: see if this is a malloc.h system
01d07975
YST
6500: we want a real compile instead of Inhdr because some systems have a
6501: malloc.h that just gives a compile error saying to use stdlib.h instead
6502echo " "
6503$cat >try.c <<EOCP
6504#include <stdlib.h>
6505#include <malloc.h>
6506int main () { return 0; }
6507EOCP
6508set try
6509if eval $compile; then
6510 echo "<malloc.h> found." >&4
6511 val="$define"
6512else
6513 echo "<malloc.h> NOT found." >&4
6514 val="$undef"
6515fi
6516$rm -f try.c try
6517set i_malloc
6518eval $setvar
b4eb6b3d 6519
c8b93cf9
JH
6520: check for void type
6521echo " "
6522echo "Checking to see how well your C compiler groks the void type..." >&4
6523case "$voidflags" in
6524'')
c727eafa 6525 $cat >try.c <<EOCP
d1daaddf
JH
6526#$i_stdlib I_STDLIB
6527#ifdef I_STDLIB
6528#include <stdlib.h>
6529#endif
c8b93cf9
JH
6530#if TRY & 1
6531void sub() {
6532#else
6533sub() {
6534#endif
6535 extern void moo(); /* function returning void */
6536 void (*goo)(); /* ptr to func returning void */
6537#if TRY & 8
6538 void *hue; /* generic ptr */
6539#endif
6540#if TRY & 2
6541 void (*foo[10])();
6542#endif
6543
6544#if TRY & 4
6545 if(goo == moo) {
6546 exit(0);
6547 }
6548#endif
6549 exit(0);
6550}
6551int main() { sub(); }
6552EOCP
6553 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6554 voidflags=$defvoidused
6555 echo "Good. It appears to support void to the level $package wants.">&4
6556 if $contains warning .out >/dev/null 2>&1; then
6557 echo "However, you might get some warnings that look like this:"
6558 $cat .out
6559 fi
6560 else
6561echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6562 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6563 echo "It supports 1..."
6564 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6565 echo "It also supports 2..."
6566 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6567 voidflags=7
6568 echo "And it supports 4 but not 8 definitely."
6569 else
6570 echo "It doesn't support 4..."
6571 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6572 voidflags=11
6573 echo "But it supports 8."
6574 else
6575 voidflags=3
6576 echo "Neither does it support 8."
6577 fi
6578 fi
6579 else
6580 echo "It does not support 2..."
6581 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6582 voidflags=13
6583 echo "But it supports 4 and 8."
6584 else
6585 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6586 voidflags=5
6587 echo "And it supports 4 but has not heard about 8."
6588 else
6589 echo "However it supports 8 but not 4."
6590 fi
6591 fi
6592 fi
6593 else
6594 echo "There is no support at all for void."
6595 voidflags=0
6596 fi
6597 fi
6598esac
6599case "$voidflags" in
6600"$defvoidused") ;;
6601*) $cat >&4 <<'EOM'
6602 Support flag bits are:
6603 1: basic void declarations.
6604 2: arrays of pointers to functions returning void.
6605 4: operations between pointers to and addresses of void functions.
6606 8: generic void pointers.
6607EOM
6608 dflt="$voidflags";
6609 rp="Your void support flags add up to what?"
6610 . ./myread
6611 voidflags="$ans"
6612 ;;
6613esac
6614$rm -f try.* .out
6615
6616: check for length of pointer
6617echo " "
6618case "$ptrsize" in
6619'')
6620 echo "Checking to see how big your pointers are..." >&4
6621 if test "$voidflags" -gt 7; then
6622 echo '#define VOID_PTR char *' > try.c
6623 else
6624 echo '#define VOID_PTR void *' > try.c
6625 fi
74d00865 6626 $cat >>try.c <<EOCP
c8b93cf9 6627#include <stdio.h>
d1daaddf
JH
6628#$i_stdlib I_STDLIB
6629#ifdef I_STDLIB
6630#include <stdlib.h>
6631#endif
c8b93cf9
JH
6632int main()
6633{
6634 printf("%d\n", (int)sizeof(VOID_PTR));
6635 exit(0);
6636}
6637EOCP
6638 set try
6639 if eval $compile_ok; then
6640 ptrsize=`$run ./try`
6641 echo "Your pointers are $ptrsize bytes long."
6642 else
6643 dflt='4'
6644 echo "(I can't seem to compile the test program. Guessing...)" >&4
6645 rp="What is the size of a pointer (in bytes)?"
6646 . ./myread
6647 ptrsize="$ans"
6648 fi
6649 ;;
6650esac
6651$rm -f try.c try
6652case "$use64bitall" in
6653"$define"|true|[yY]*)
6654 case "$ptrsize" in
6655 4) cat <<EOM >&4
6656
1911a026
JH
6657*** You have chosen a maximally 64-bit build,
6658*** but your pointers are only 4 bytes wide.
09b58c7b
JH
6659*** Please rerun Configure without -Duse64bitall.
6660EOM
6661 case "$d_quad" in
6662 define)
6663 cat <<EOM >&4
6664*** Since you have quads, you could possibly try with -Duse64bitint.
6665EOM
6666 ;;
6667 esac
6668 cat <<EOM >&4
1911a026 6669*** Cannot continue, aborting.
c8b93cf9
JH
6670
6671EOM
09b58c7b 6672
1911a026 6673 exit 1
c8b93cf9
JH
6674 ;;
6675 esac
6676 ;;
6677esac
6678
19a100ff 6679
9df442c2
NC
6680: determine whether to use malloc wrapping
6681echo " "
6682case "$usemallocwrap" in
6683[yY]*|true|$define) dflt='y' ;;
6684[nN]*|false|$undef) dflt='n' ;;
6685*) case "$usedevel" in
6686 [yY]*|true|$define) dflt='y' ;;
6687 *) dflt='n' ;;
6688 esac
6689 ;;
6690esac
6691rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6692. ./myread
6693usemallocwrap="$ans"
6694case "$ans" in
6695y*|true)
6696 usemallocwrap="$define" ;;
6697*)
6698 usemallocwrap="$undef" ;;
6699esac
c8b93cf9 6700
b4eb6b3d
JH
6701: determine which malloc to compile in
6702echo " "
6703case "$usemymalloc" in
c4163172
JH
6704[yY]*|true|$define) dflt='y' ;;
6705[nN]*|false|$undef) dflt='n' ;;
6706*) case "$ptrsize" in
6707 4) dflt='y' ;;
6708 *) dflt='n' ;;
6709 esac
6710 ;;
8dfa8df9 6711esac
b4eb6b3d
JH
6712rp="Do you wish to attempt to use the malloc that comes with $package?"
6713. ./myread
6714usemymalloc="$ans"
6715case "$ans" in
6716y*|true)
6717 usemymalloc='y'
6718 mallocsrc='malloc.c'
6719 mallocobj="malloc$_o"
6720 d_mymalloc="$define"
6721 case "$libs" in
6722 *-lmalloc*)
6723 : Remove malloc from list of libraries to use
6724 echo "Removing unneeded -lmalloc from library list" >&4
6725 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6726 shift
6727 libs="$*"
6728 echo "libs = $libs" >&4
6729 ;;
6730 esac
6731 ;;
6732*)
6733 usemymalloc='n'
6734 mallocsrc=''
6735 mallocobj=''
6736 d_mymalloc="$undef"
6737 ;;
6738esac
6739
6740: compute the return types of malloc and free
6741echo " "
6742$cat >malloc.c <<END
6743#$i_malloc I_MALLOC
6744#$i_stdlib I_STDLIB
6745#include <stdio.h>
6746#include <sys/types.h>
6747#ifdef I_MALLOC
6748#include <malloc.h>
6749#endif
6750#ifdef I_STDLIB
6751#include <stdlib.h>
6752#endif
6753#ifdef TRY_MALLOC
6754void *malloc();
6755#endif
6756#ifdef TRY_FREE
6757void free();
6758#endif
6759END
6760case "$malloctype" in
6761'')
6762 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6763 malloctype='void *'
6764 else
6765 malloctype='char *'
6766 fi
6767 ;;
6768esac
6769echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6770
6771case "$freetype" in
6772'')
6773 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6774 freetype='void'
6775 else
6776 freetype='int'
6777 fi
6778 ;;
6779esac
6780echo "Your system uses $freetype free(), it would seem." >&4
6781$rm -f malloc.[co]
b4eb6b3d
JH
6782: determine where site specific architecture-dependent libraries go.
6783: sitelib default is /usr/local/lib/perl5/site_perl/$version
6784: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6785: sitelib may have an optional trailing /share.
6786case "$sitearch" in
6787'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6788 dflt="$dflt/$archname"
6789 ;;
6790*) dflt="$sitearch"
6791 ;;
6792esac
6793set sitearch sitearch none
6794eval $prefixit
6795$cat <<EOM
6796
6797The installation process will also create a directory for
6798architecture-dependent site-specific extensions and modules.
6799
6800EOM
6801fn=d~+
6802rp='Pathname for the site-specific architecture-dependent library files?'
6803. ./getfile
79522dd2
NC
6804prefixvar=sitearch
6805. ./setprefixvar
c95d0e17
GA
6806if $test X"$sitearch" = X"$sitelib"; then
6807 d_sitearch="$undef"
6808else
6809 d_sitearch="$define"
6810fi
b4eb6b3d
JH
6811
6812$cat <<EOM
6813
6814The installation process will also create a directory for
6815vendor-supplied add-ons. Vendors who supply perl with their system
6816may find it convenient to place all vendor-supplied files in this
6817directory rather than in the main distribution directory. This will
6818ease upgrades between binary-compatible maintenance versions of perl.
6819
6820Of course you may also use these directories in whatever way you see
6821fit. For example, you might use them to access modules shared over a
6822company-wide network.
6823
6824The default answer should be fine for most people.
6825This causes further questions about vendor add-ons to be skipped
6826and no vendor-specific directories will be configured for perl.
6827
6828EOM
6829rp='Do you want to configure vendor-specific add-on directories?'
6830case "$usevendorprefix" in
6831define|true|[yY]*) dflt=y ;;
6832*) : User may have set vendorprefix directly on Configure command line.
6833 case "$vendorprefix" in
6834 ''|' ') dflt=n ;;
6835 *) dflt=y ;;
6836 esac
6837 ;;
6838esac
6839. ./myread
6840case "$ans" in
6841[yY]*) fn=d~+
6842 rp='Installation prefix to use for vendor-supplied add-ons?'
6843 case "$vendorprefix" in
6844 '') dflt='' ;;
6845 *) dflt=$vendorprefix ;;
6846 esac
6847 . ./getfile
6848 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6849 oldvendorprefix=''
6850 case "$vendorprefix" in
6851 '') ;;
6852 *) case "$ans" in
6853 "$prefix") ;;
6854 *) oldvendorprefix="$prefix";;
6855 esac
6856 ;;
6857 esac
6858 usevendorprefix="$define"
6859 vendorprefix="$ans"
6860 vendorprefixexp="$ansexp"
6861 ;;
6862*) usevendorprefix="$undef"
6863 vendorprefix=''
6864 vendorprefixexp=''
6865 ;;
6866esac
6867
6868case "$vendorprefix" in
6869'') d_vendorlib="$undef"
6870 vendorlib=''
6871 vendorlibexp=''
6872 ;;
6873*) d_vendorlib="$define"
6874 : determine where vendor-supplied modules go.
6875 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6876 case "$vendorlib" in
6877 '')
6878 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6879 case "$installstyle" in
6880 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6881 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6882 esac
6883 ;;
6884 *) dflt="$vendorlib"
6885 ;;
6886 esac
6887 fn=d~+
6888 rp='Pathname for the vendor-supplied library files?'
6889 . ./getfile
6890 vendorlib="$ans"
6891 vendorlibexp="$ansexp"
6892 ;;
6893esac
6894vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
a092d240
NC
6895prefixvar=vendorlib
6896. ./installprefix
b4eb6b3d
JH
6897
6898case "$vendorprefix" in
6899'') d_vendorarch="$undef"
6900 vendorarch=''
6901 vendorarchexp=''
6902 ;;
6903*) d_vendorarch="$define"
6904 : determine where vendor-supplied architecture-dependent libraries go.
6905 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6906 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6907 : vendorlib may have an optional trailing /share.
6908 case "$vendorarch" in
6909 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6910 dflt="$dflt/$archname"
6911 ;;
6912 *) dflt="$vendorarch" ;;
6913 esac
6914 fn=d~+
6915 rp='Pathname for vendor-supplied architecture-dependent files?'
6916 . ./getfile
6917 vendorarch="$ans"
6918 vendorarchexp="$ansexp"
6919 ;;
6920esac
a092d240
NC
6921prefixvar=vendorarch
6922. ./installprefix
b4eb6b3d
JH
6923
6924: Final catch-all directories to search
6925$cat <<EOM
6926
6927Lastly, you can have perl look in other directories for extensions and
6928modules in addition to those already specified.
6929These directories will be searched after
6930 $sitearch
6931 $sitelib
6932EOM
6933test X"$vendorlib" != "X" && echo ' ' $vendorlib
6934test X"$vendorarch" != "X" && echo ' ' $vendorarch
6935echo ' '
6936case "$otherlibdirs" in
6937''|' ') dflt='none' ;;
6938*) dflt="$otherlibdirs" ;;
6939esac
6940$cat <<EOM
6941Enter a colon-separated set of extra paths to include in perl's @INC
6942search path, or enter 'none' for no extra paths.
6943
6944EOM
6945
6946rp='Colon-separated list of additional directories for perl to search?'
6947. ./myread
6948case "$ans" in
6949' '|''|none) otherlibdirs=' ' ;;
6950*) otherlibdirs="$ans" ;;
6951esac
6952case "$otherlibdirs" in
6953' ') val=$undef ;;
6954*) val=$define ;;
6955esac
6956set d_perl_otherlibdirs
6957eval $setvar
6958
6959: Cruising for prototypes
6960echo " "
6961echo "Checking out function prototypes..." >&4
55954f19
JH
6962$cat >prototype.c <<EOCP
6963#$i_stdlib I_STDLIB
6964#ifdef I_STDLIB
6965#include <stdlib.h>
6966#endif
b4eb6b3d
JH
6967int main(int argc, char *argv[]) {
6968 exit(0);}
6969EOCP
6970if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6971 echo "Your C compiler appears to support function prototypes."
6972 val="$define"
6973else
6974 echo "Your C compiler doesn't seem to understand function prototypes."
6975 val="$undef"
6976fi
6977set prototype
6978eval $setvar
6979$rm -f prototype*
6980
6981case "$prototype" in
6982"$define") ;;
6983*) ansi2knr='ansi2knr'
6984 echo " "
6985 cat <<EOM >&4
6986
6987$me: FATAL ERROR:
6988This version of $package can only be compiled by a compiler that
6989understands function prototypes. Unfortunately, your C compiler
6990 $cc $ccflags
6991doesn't seem to understand them. Sorry about that.
6992
6993If GNU cc is available for your system, perhaps you could try that instead.
6994
6995Eventually, we hope to support building Perl with pre-ANSI compilers.
6996If you would like to help in that effort, please contact <perlbug@perl.org>.
6997
6998Aborting Configure now.
6999EOM
7000 exit 2
7001 ;;
7002esac
7003
6fcddf3b 7004echo " "
6fcddf3b 7005case "$extras" in
bf35c3f6
JH
7006'') dflt='n';;
7007*) dflt='y';;
6fcddf3b
JH
7008esac
7009cat <<EOM
7010Perl can be built with extra modules or bundles of modules which
7011will be fetched from the CPAN and installed alongside Perl.
7012
7013Notice that you will need access to the CPAN; either via the Internet,
7014or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
7015be asked later to configure the CPAN.pm module which will in turn do
7016the installation of the rest of the extra modules or bundles.)
7017
7018Notice also that if the modules require any external software such as
dd2de242
JH
7019libraries and headers (the libz library and the zlib.h header for the
7020Compress::Zlib module, for example) you MUST have any such software
7021already installed, this configuration process will NOT install such
7022things for you.
6fcddf3b
JH
7023
7024If this doesn't make any sense to you, just accept the default '$dflt'.
7025EOM
dd2de242 7026rp='Install any extra modules (y or n)?'
6fcddf3b
JH
7027. ./myread
7028case "$ans" in
7029y|Y)
7030 cat <<EOM
7031
7032Please list any extra modules or bundles to be installed from CPAN,
7033with spaces between the names. The names can be in any format the
dd2de242
JH
7034'install' command of CPAN.pm will understand. (Answer 'none',
7035without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
7036EOM
7037 rp='Extras?'
7038 dflt="$extras"
7039 . ./myread
7040 extras="$ans"
7041esac
7042case "$extras" in
7043''|'none')
7044 val=''
7045 $rm -f ../extras.lst
7046 ;;
7047*) echo "(Saving the list of extras for later...)"
dd2de242
JH
7048 echo "$extras" > ../extras.lst
7049 val="'$extras'"
6fcddf3b
JH
7050 ;;
7051esac
7052set extras
7053eval $setvar
7054echo " "
7055
6e1038e0
MB
7056: determine where html pages for programs go
7057set html1dir html1dir none
7058eval $prefixit
7059$cat <<EOM
7060
f3f1a2d8 7061If you wish to install html files for programs in $spackage, indicate
6e1038e0
MB
7062the appropriate directory here. To skip installing html files,
7063answer "none".
7064EOM
7065case "$html1dir" in
7066''|none|$undef|' ') dflt=none ;;
7067*) dflt=$html1dir ;;
7068esac
7069fn=dn+~
7070rp="Directory for the main $spackage html pages?"
7071. ./getfile
79522dd2
NC
7072prefixvar=html1dir
7073. ./setprefixvar
6e1038e0
MB
7074: Use ' ' for none so value is preserved next time through Configure
7075$test X"$html1dir" = "X" && html1dir=' '
6e1038e0
MB
7076
7077: determine where html pages for libraries and modules go
7078set html3dir html3dir none
7079eval $prefixit
7080$cat <<EOM
7081
7082If you wish to install html files for modules associated with $spackage,
7083indicate the appropriate directory here. To skip installing html files,
7084answer "none".
7085EOM
7086: There is no obvious default. If they have specified html1dir, then
7087: try to key off that, possibly changing .../html1 into .../html3.
7088case "$html3dir" in
7089'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7090*) dflt=$html3dir ;;
7091esac
7092fn=dn+~
7093rp="Directory for the $spackage module html pages?"
7094. ./getfile
79522dd2
NC
7095prefixvar=html3dir
7096. ./setprefixvar
6e1038e0
MB
7097: Use ' ' for none so value is preserved next time through Configure
7098$test X"$html3dir" = "X" && html3dir=' '
6e1038e0 7099
89ce900e
JH
7100: determine whether to install perl also as /usr/bin/perl
7101
7102echo " "
7103if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7104 $cat <<EOM
7105Many scripts expect perl to be installed as /usr/bin/perl.
7106
7107If you want to, I can install the perl you are about to compile
7108as /usr/bin/perl (in addition to $bin/perl).
7109EOM
7110 if test -f /usr/bin/perl; then
7111 $cat <<EOM
7112
7113However, please note that because you already have a /usr/bin/perl,
7114overwriting that with a new Perl would very probably cause problems.
7115Therefore I'm assuming you don't want to do that (unless you insist).
7116
7117EOM
7118 case "$installusrbinperl" in
7119 "$define"|[yY]*) dflt='y';;
7120 *) dflt='n';;
7121 esac
7122 else
7123 $cat <<EOM
7124
7125Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7126
7127EOM
7128 case "$installusrbinperl" in
7129 "$undef"|[nN]*) dflt='n';;
7130 *) dflt='y';;
7131 esac
7132 fi
7133 rp="Do you want to install perl as /usr/bin/perl?"
7134 . ./myread
7135 case "$ans" in
7136 [yY]*) val="$define";;
7137 *) val="$undef" ;;
7138 esac
7139else
7140 val="$undef"
7141fi
7142set installusrbinperl
7143eval $setvar
7144
7145echo " "
7146echo "Checking for GNU C Library..." >&4
7147cat >try.c <<'EOCP'
7148/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7149 alone are insufficient to distinguish different versions, such as
7150 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7151 libc version 2.1.0. A. Dougherty, June 3, 2002.
7152*/
7153#include <stdio.h>
7154int main(void)
7155{
7156#ifdef __GLIBC__
7157# ifdef __GLIBC_MINOR__
4fb7dc7d 7158# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
89ce900e
JH
7159# include <gnu/libc-version.h>
7160 printf("%s\n", gnu_get_libc_version());
7161# else
7162 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7163# endif
7164# else
7165 printf("%d\n", __GLIBC__);
7166# endif
7167 return 0;
7168#else
7169 return 1;
7170#endif
7171}
7172EOCP
7173set try
7174if eval $compile_ok && $run ./try > glibc.ver; then
7175 val="$define"
7176 gnulibc_version=`$cat glibc.ver`
7177 echo "You are using the GNU C Library version $gnulibc_version"
7178else
7179 val="$undef"
7180 gnulibc_version=''
7181 echo "You are not using the GNU C Library"
7182fi
7183$rm -f try try.* glibc.ver
7184set d_gnulibc
7185eval $setvar
7186
7187: see if nm is to be used to determine whether a symbol is defined or not
7188case "$usenm" in
7189'')
7190 dflt=''
7191 case "$d_gnulibc" in
7192 "$define")
7193 echo " "
7194 echo "nm probably won't work on the GNU C Library." >&4
7195 dflt=n
7196 ;;
7197 esac
7198 case "$dflt" in
7199 '')
7200 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7201 echo " "
7202 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7203 echo "'nm' won't be sufficient on this sytem." >&4
7204 dflt=n
7205 fi
7206 ;;
7207 esac
7208 case "$dflt" in
7209 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7210 if $test $dflt -gt 20; then
7211 dflt=y
7212 else
7213 dflt=n
7214 fi
7215 ;;
7216 esac
b4eb6b3d 7217 ;;
89ce900e
JH
7218*)
7219 case "$usenm" in
7220 true|$define) dflt=y;;
7221 *) dflt=n;;
7222 esac
b4eb6b3d
JH
7223 ;;
7224esac
89ce900e 7225$cat <<EOM
b4eb6b3d 7226
89ce900e
JH
7227I can use $nm to extract the symbols from your C libraries. This
7228is a time consuming task which may generate huge output on the disk (up
7229to 3 megabytes) but that should make the symbols extraction faster. The
7230alternative is to skip the 'nm' extraction part and to compile a small
7231test program instead to determine whether each symbol is present. If
7232you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7233this may be the best solution.
b4eb6b3d 7234
89ce900e 7235You probably shouldn't let me use 'nm' if you are using the GNU C Library.
b4eb6b3d 7236
89ce900e
JH
7237EOM
7238rp="Shall I use $nm to extract C symbols from the libraries?"
7239. ./myread
7240case "$ans" in
7241[Nn]*) usenm=false;;
7242*) usenm=true;;
b4eb6b3d 7243esac
89ce900e
JH
7244
7245runnm=$usenm
7246case "$reuseval" in
7247true) runnm=false;;
b4eb6b3d 7248esac
b4eb6b3d 7249
89ce900e
JH
7250: nm options which may be necessary
7251case "$nm_opt" in
7252'') if $test -f /mach_boot; then
7253 nm_opt='' # Mach
7254 elif $test -d /usr/ccs/lib; then
7255 nm_opt='-p' # Solaris (and SunOS?)
7256 elif $test -f /dgux; then
7257 nm_opt='-p' # DG-UX
7258 elif $test -f /lib64/rld; then
7259 nm_opt='-p' # 64-bit Irix
7260 else
7261 nm_opt=''
7262 fi;;
7263esac
b4eb6b3d 7264
89ce900e
JH
7265: nm options which may be necessary for shared libraries but illegal
7266: for archive libraries. Thank you, Linux.
7267case "$nm_so_opt" in
7268'') case "$myuname" in
fb2e1bc0 7269 *linux*|gnu*)
89ce900e
JH
7270 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7271 nm_so_opt='--dynamic'
7272 fi
7273 ;;
7274 esac
7275 ;;
7276esac
b4eb6b3d 7277
89ce900e
JH
7278case "$runnm" in
7279true)
7280: get list of predefined functions in a handy place
7281echo " "
7282case "$libc" in
7283'') libc=unknown
7284 case "$libs" in
7285 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7286 esac
7287 ;;
b4eb6b3d 7288esac
89ce900e
JH
7289case "$libs" in
7290'') ;;
7291*) for thislib in $libs; do
7292 case "$thislib" in
7293 -lc|-lc_s)
7294 : Handle C library specially below.
7295 ;;
7296 -l*)
7297 thislib=`echo $thislib | $sed -e 's/^-l//'`
7298 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7299 :
7300 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7301 :
7302 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7303 :
7304 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7305 :
7306 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7307 :
7308 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7309 :
7310 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7311 :
7312 else
7313 try=''
7314 fi
7315 libnames="$libnames $try"
7316 ;;
7317 *) libnames="$libnames $thislib" ;;
7318 esac
7319 done
b4eb6b3d
JH
7320 ;;
7321esac
89ce900e
JH
7322xxx=normal
7323case "$libc" in
7324unknown)
7325 set /lib/libc.$so
7326 for xxx in $libpth; do
7327 $test -r $1 || set $xxx/libc.$so
7328 : The messy sed command sorts on library version numbers.
7329 $test -r $1 || \
7330 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7331 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7332 h
7333 s/[0-9][0-9]*/0000&/g
7334 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7335 G
7336 s/\n/ /' | \
7337 $sort | $sed -e 's/^.* //'`
7338 eval set \$$#
7339 done
7340 $test -r $1 || set /usr/ccs/lib/libc.$so
7341 $test -r $1 || set /lib/libsys_s$_a
7342 ;;
7343*)
7344 set blurfl
7345 ;;
7346esac
7347if $test -r "$1"; then
7348 echo "Your (shared) C library seems to be in $1."
7349 libc="$1"
7350elif $test -r /lib/libc && $test -r /lib/clib; then
7351 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7352 xxx=apollo
7353 libc='/lib/clib /lib/libc'
7354 if $test -r /lib/syslib; then
7355 echo "(Your math library is in /lib/syslib.)"
7356 libc="$libc /lib/syslib"
7357 fi
7358elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7359 echo "Your C library seems to be in $libc, as you said before."
7360elif $test -r $incpath/usr/lib/libc$_a; then
7361 libc=$incpath/usr/lib/libc$_a;
7362 echo "Your C library seems to be in $libc. That's fine."
7363elif $test -r /lib/libc$_a; then
7364 libc=/lib/libc$_a;
7365 echo "Your C library seems to be in $libc. You're normal."
7366else
7367 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7368 :
7369 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7370 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7371 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7372 :
7373 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7374 :
7375 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7376 :
7377 else
7378 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7379 fi
7380 if $test -r "$tans"; then
7381 echo "Your C library seems to be in $tans, of all places."
7382 libc=$tans
7383 else
7384 libc='blurfl'
7385 fi
7386fi
7387if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7388 dflt="$libc"
7389 cat <<EOM
b4eb6b3d 7390
89ce900e
JH
7391If the guess above is wrong (which it might be if you're using a strange
7392compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7393
89ce900e
JH
7394EOM
7395else
7396 dflt=''
7397 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7398 cat >&4 <<EOM
7399I can't seem to find your C library. I've looked in the following places:
5e366f65 7400
b4eb6b3d 7401EOM
89ce900e
JH
7402 $sed 's/^/ /' libpath
7403 cat <<EOM
5e366f65 7404
89ce900e 7405None of these seems to contain your C library. I need to get its name...
5e366f65
JH
7406
7407EOM
89ce900e
JH
7408fi
7409fn=f
7410rp='Where is your C library?'
7411. ./getfile
7412libc="$ans"
5e366f65 7413
89ce900e
JH
7414echo " "
7415echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7416set X `cat libnames`
7417shift
7418xxx=files
7419case $# in 1) xxx=file; esac
7420echo "Extracting names from the following $xxx for later perusal:" >&4
7421echo " "
7422$sed 's/^/ /' libnames >&4
7423echo " "
7424$echo $n "This may take a while...$c" >&4
5e366f65 7425
89ce900e
JH
7426for file in $*; do
7427 case $file in
7428 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7429 *) $nm $nm_opt $file 2>/dev/null;;
b4eb6b3d 7430 esac
89ce900e
JH
7431done >libc.tmp
7432
7433$echo $n ".$c"
7434$grep fprintf libc.tmp > libc.ptf
7435xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7436xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7437xxx='[ADTSIW]'
ab900c53 7438if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
89ce900e
JH
7439 eval $xscan;\
7440 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7441 eval $xrun
7442elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7443 eval $xscan;\
7444 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7445 eval $xrun
7446elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7447 eval $xscan;\
7448 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7449 eval $xrun
7450elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7451 eval $xscan;\
7452 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7453 eval $xrun
7454elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7455 eval $xscan;\
7456 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7457 eval $xrun
7458elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7459 eval $xscan;\
7460 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7461 eval $xrun
7462elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7463 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7464 eval $xscan;\
7465 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7466 eval $xrun
7467elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7468 eval $xscan;\
7469 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7470 eval $xrun
7471elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7472 eval $xscan;\
7473 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7474 eval $xrun
7475elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7476 eval $xscan;\
7477 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7478 eval $xrun
7479elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7480 eval $xscan;\
7481 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7482 eval $xrun
7483elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7484 eval $xscan;\
7485 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7486 eval $xrun
7487elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7488 eval $xscan;\
7489 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7490 eval $xrun
7491elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7492 eval $xscan;\
7493 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7494 eval $xrun
b4eb6b3d 7495else
89ce900e
JH
7496 $nm -p $* 2>/dev/null >libc.tmp
7497 $grep fprintf libc.tmp > libc.ptf
7498 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7499 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7500 then
7501 nm_opt='-p'
7502 eval $xrun
7503 else
7504 echo " "
7505 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7506 com=''
7507 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7508 for thisname in $libnames $libc; do
7509 $ar t $thisname >>libc.tmp
7510 done
7511 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7512 echo "Ok." >&4
7513 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7514 # Repeat libc to extract forwarders to DLL entries too
7515 for thisname in $libnames $libc; do
7516 $ar tv $thisname >>libc.tmp
7517 # Revision 50 of EMX has bug in $ar.
7518 # it will not extract forwarders to DLL entries
7519 # Use emximp which will extract exactly them.
7520 emximp -o tmp.imp $thisname \
7521 2>/dev/null && \
7522 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7523 < tmp.imp >>libc.tmp
7524 $rm tmp.imp
7525 done
7526 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7527 echo "Ok." >&4
7528 else
7529 echo "$ar didn't seem to work right." >&4
7530 echo "Maybe this is a Cray...trying bld instead..." >&4
7531 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7532 then
7533 for thisname in $libnames; do
7534 bld t $libnames | \
7535 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7536 $ar t $thisname >>libc.tmp
7537 done
7538 echo "Ok." >&4
7539 else
7540 echo "That didn't work either. Giving up." >&4
7541 exit 1
7542 fi
7543 fi
7544 fi
b4eb6b3d 7545fi
89ce900e
JH
7546nm_extract="$com"
7547case "$PASE" in
7548define)
7549 echo " "
7550 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7551 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7552 ;;
7553*) if $test -f /lib/syscalls.exp; then
7554 echo " "
7555 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7556 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' /lib/syscalls.exp >>libc.list
7557 fi
7558 ;;
7559esac
7560;;
7561esac
7562$rm -f libnames libpath
b4eb6b3d
JH
7563
7564: see if dld is available
7565set dld.h i_dld
7566eval $inhdr
7567
89ce900e
JH
7568: is a C symbol defined?
7569csym='tlook=$1;
7570case "$3" in
373dfab3
JH
7571-v) tf=libc.tmp; tdc="";;
7572-a) tf=libc.tmp; tdc="[]";;
7573*) tlook="^$1\$"; tf=libc.list; tdc="()";;
89ce900e
JH
7574esac;
7575tx=yes;
7576case "$reuseval-$4" in
7577true-) ;;
7578true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7579esac;
7580case "$tx" in
7581yes)
ab900c53 7582 tval=false;
5129fff4
JH
7583 if $test "$runnm" = true; then
7584 if $contains $tlook $tf >/dev/null 2>&1; then
ab900c53 7585 tval=true;
5129fff4 7586 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
373dfab3 7587 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7588 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
373dfab3
JH
7589 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7590 $rm -f try$_exe try.c core core.* try.core;
89ce900e 7591 fi;
5129fff4 7592 else
373dfab3 7593 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7594 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
373dfab3 7595 $rm -f try$_exe try.c;
ab900c53
AB
7596 fi;
7597 ;;
89ce900e
JH
7598*)
7599 case "$tval" in
7600 $define) tval=true;;
7601 *) tval=false;;
ab900c53
AB
7602 esac;
7603 ;;
89ce900e
JH
7604esac;
7605eval "$2=$tval"'
7606
7607: define an is-in-libc? function
7608inlibc='echo " "; td=$define; tu=$undef;
7609sym=$1; var=$2; eval "was=\$$2";
7610tx=yes;
7611case "$reuseval$was" in
7612true) ;;
7613true*) tx=no;;
7614esac;
7615case "$tx" in
7616yes)
7617 set $sym tres -f;
7618 eval $csym;
7619 case "$tres" in
7620 true)
7621 echo "$sym() found." >&4;
7622 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7623 *)
7624 echo "$sym() NOT found." >&4;
7625 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7626 esac;;
7627*)
7628 case "$was" in
7629 $define) echo "$sym() found." >&4;;
7630 *) echo "$sym() NOT found." >&4;;
7631 esac;;
7632esac'
7633
f244a502
JH
7634
7635echo " "
7636echo "Checking for C++..." >&4
7637cat >try.c <<'EOCP'
7638#include <stdio.h>
7639int main(void)
7640{
7641#ifdef __cplusplus
7642 printf("define\n");
7643#else
7644 printf("undef\n");
7645#endif
7646 return 0;
7647}
7648EOCP
7649set try
7650if eval $compile_ok && $run ./try >cplusplus$$; then
7651 val=`$cat cplusplus$$`
7652 echo "You are using a C++ compiler."
7653else
7654 val="$undef"
7655 echo "You are not using a C++ compiler."
7656fi
7657$rm -f try try.* cplusplus$$
7658set d_cplusplus
7659eval $setvar
7660
b4eb6b3d
JH
7661: see if dlopen exists
7662xxx_runnm="$runnm"
666ea192 7663xxx_ccflags="$ccflags"
b4eb6b3d 7664runnm=false
666ea192
JH
7665: with g++ one needs -shared to get is-in-libc to work for dlopen
7666case "$gccversion" in
7667'') ;;
7668*) case "$d_cplusplus" in
7669 "$define") ccflags="$ccflags -shared" ;;
7670 esac
7671 ;;
7672esac
b4eb6b3d
JH
7673set dlopen d_dlopen
7674eval $inlibc
7675runnm="$xxx_runnm"
666ea192 7676ccflags="$xxx_ccflags"
b4eb6b3d 7677
4fb7dc7d
JH
7678: see if this is a unistd.h system
7679set unistd.h i_unistd
7680eval $inhdr
7681
b4eb6b3d
JH
7682: determine which dynamic loading, if any, to compile in
7683echo " "
7684dldir="ext/DynaLoader"
7685case "$usedl" in
7686$define|y|true)
7687 dflt='y'
7688 usedl="$define"
7689 ;;
7690$undef|n|false)
7691 dflt='n'
7692 usedl="$undef"
7693 ;;
7694*)
7695 dflt='n'
7696 case "$d_dlopen" in
7697 $define) dflt='y' ;;
7698 esac
7699 case "$i_dld" in
7700 $define) dflt='y' ;;
7701 esac
7702 : Does a dl_xxx.xs file exist for this operating system
7703 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7704 ;;
7705esac
7706rp="Do you wish to use dynamic loading?"
7707. ./myread
7708usedl="$ans"
7709case "$ans" in
7710y*) usedl="$define"
7711 case "$dlsrc" in
7712 '')
7713 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7714 dflt="$dldir/dl_${osname}.xs"
7715 elif $test "$d_dlopen" = "$define" ; then
7716 dflt="$dldir/dl_dlopen.xs"
7717 elif $test "$i_dld" = "$define" ; then
7718 dflt="$dldir/dl_dld.xs"
7719 else
7720 dflt=''
7721 fi
7722 ;;
7723 *) dflt="$dldir/$dlsrc"
7724 ;;
7725 esac
7726 echo "The following dynamic loading files are available:"
7727 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7728 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7729 rp="Source file to use for dynamic loading"
7730 fn="fne"
7731 gfpth="$src"
7732 . ./getfile
7733 usedl="$define"
7734 : emulate basename
7735 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7736
7737 $cat << EOM
7738
7739Some systems may require passing special flags to $cc -c to
7740compile modules that will be used to create a shared library.
7741To use no flags, say "none".
7742
7743EOM
7744 case "$cccdlflags" in
7745 '') case "$gccversion" in
7746 '') case "$osname" in
7747 hpux) dflt='+z' ;;
7748 next) dflt='none' ;;
7749 irix*) dflt='-KPIC' ;;
48bcfe03 7750 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7751 sunos) dflt='-pic' ;;
7752 *) dflt='none' ;;
7753 esac
7754 ;;
7755 *) case "$osname" in
b6cc0f4c 7756 darwin) dflt='none' ;;
48bcfe03 7757 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7758 *) dflt='-fpic' ;;
7759 esac ;;
7760 esac ;;
7761 ' ') dflt='none' ;;
7762 *) dflt="$cccdlflags" ;;
7763 esac
7764 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7765 . ./myread
7766 case "$ans" in
7767 none) cccdlflags=' ' ;;
7768 *) cccdlflags="$ans" ;;
7769 esac
7770
7771 cat << EOM
7772
7773Some systems use ld to create libraries that can be dynamically loaded,
7774while other systems (such as those using ELF) use $cc.
7775
7776EOM
7777 case "$ld" in
55954f19 7778 '') $cat >try.c <<EOM
b4eb6b3d
JH
7779/* Test for whether ELF binaries are produced */
7780#include <fcntl.h>
55954f19
JH
7781#$i_stdlib I_STDLIB
7782#ifdef I_STDLIB
b4eb6b3d 7783#include <stdlib.h>
55954f19 7784#endif
4fb7dc7d
JH
7785#$i_unistd I_UNISTD
7786#ifdef I_UNISTD
7787#include <unistd.h>
7788#endif
b4eb6b3d
JH
7789int main() {
7790 char b[4];
7791 int i = open("a.out",O_RDONLY);
7792 if(i == -1)
7793 exit(1); /* fail */
7794 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7795 exit(0); /* succeed (yes, it's ELF) */
7796 else
7797 exit(1); /* fail */
7798}
7799EOM
5440bc8e 7800 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7801 cat <<EOM
7802You appear to have ELF support. I'll use $cc to build dynamic libraries.
7803EOM
7804 dflt="$cc"
7805 else
7806 echo "I'll use ld to build dynamic libraries."
7807 dflt='ld'
7808 fi
7809 rm -f try.c a.out
7810 ;;
7811 *) dflt="$ld"
7812 ;;
7813 esac
7814
7815 rp="What command should be used to create dynamic libraries?"
7816 . ./myread
7817 ld="$ans"
7818
7819 cat << EOM
7820
7821Some systems may require passing special flags to $ld to create a
7822library that can be dynamically loaded. If your ld flags include
7823-L/other/path options to locate libraries outside your loader's normal
7824search path, you may need to specify those -L options here as well. To
7825use no flags, say "none".
7826
7827EOM
7828 case "$lddlflags" in
7829 '') case "$osname" in
7830 beos) dflt='-nostart' ;;
7831 hpux) dflt='-b';
7832 case "$gccversion" in
7833 '') dflt="$dflt +vnocompatwarnings" ;;
7834 esac
7835 ;;
fb2e1bc0 7836 linux|irix*|gnu*) dflt='-shared' ;;
b4eb6b3d
JH
7837 next) dflt='none' ;;
7838 solaris) dflt='-G' ;;
7839 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 7840 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
7841 *) dflt='none' ;;
7842 esac
7843 ;;
7844 *) dflt="$lddlflags" ;;
7845 esac
7846
7847 : Try to guess additional flags to pick up local libraries.
7848 : Be careful not to append to a plain 'none'
7849 case "$dflt" in
7850 none) dflt='' ;;
7851 esac
7852 for thisflag in $ldflags; do
7853 case "$thisflag" in
b5b9f165 7854 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
7855 case " $dflt " in
7856 *" $thisflag "*) ;;
7857 *) dflt="$dflt $thisflag" ;;
7858 esac
7859 ;;
7860 esac
7861 done
7862
7863 case "$dflt" in
7864 ''|' ') dflt='none' ;;
7865 esac
7866
7867 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7868 . ./myread
7869 case "$ans" in
7870 none) lddlflags=' ' ;;
7871 *) lddlflags="$ans" ;;
7872 esac
7873
7874 cat <<EOM
7875
7876Some systems may require passing special flags to $cc to indicate that
7877the resulting executable will use dynamic linking. To use no flags,
7878say "none".
7879
7880EOM
7881 case "$ccdlflags" in
7882 '') case "$osname" in
fb2e1bc0 7883 linux|hpux|gnu*) dflt='-Wl,-E' ;;
91fc0aa5
AH
7884 next|sunos) dflt='none' ;;
7885 *) dflt='none' ;;
b4eb6b3d
JH
7886 esac ;;
7887 ' ') dflt='none' ;;
7888 *) dflt="$ccdlflags" ;;
7889 esac
7890 rp="Any special flags to pass to $cc to use dynamic linking?"
7891 . ./myread
7892 case "$ans" in
7893 none) ccdlflags=' ' ;;
7894 *) ccdlflags="$ans" ;;
7895 esac
7896 ;;
7897*) usedl="$undef"
7898 ld='ld'
7899 dlsrc='dl_none.xs'
7900 lddlflags=''
7901 ccdlflags=''
7902 ;;
7903esac
7904
7905also=''
7906case "$usedl" in
7907$undef)
7908 # No dynamic loading being used, so don't bother even to prompt.
7909 useshrplib='false'
7910 ;;
7911*) case "$useshrplib" in
7912 '') case "$osname" in
48bcfe03 7913 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7914 dflt=y
7915 also='Building a shared libperl is required for dynamic loading to work on your system.'
7916 ;;
7917 next*)
7918 case "$osvers" in
7919 4*) dflt=y
7920 also='Building a shared libperl is needed for MAB support.'
7921 ;;
7922 *) dflt=n
7923 ;;
7924 esac
7925 ;;
7926 *) dflt=n
7927 ;;
7928 esac
7929 ;;
7930 $define|true|[Yy]*)
7931 dflt=y
7932 ;;
7933 *) dflt=n
7934 ;;
7935 esac
7936 $cat << EOM
7937
7938The perl executable is normally obtained by linking perlmain.c with
7939libperl${_a}, any static extensions (usually just DynaLoader), and
7940any other libraries needed on this system (such as -lm, etc.). Since
7941your system supports dynamic loading, it is probably possible to build
7942a shared libperl.$so. If you will have more than one executable linked
7943to libperl.$so, this will significantly reduce the size of each
5cadb3f3 7944executable, but it may have a noticeable effect on performance. The
b4eb6b3d
JH
7945default is probably sensible for your system.
7946$also
7947
7948EOM
7949 rp="Build a shared libperl.$so (y/n)"
7950 . ./myread
7951 case "$ans" in
7952 true|$define|[Yy]*)
7953 useshrplib='true' ;;
7954 *) useshrplib='false' ;;
7955 esac
7956 ;;
7957esac
7958
7959case "$useshrplib" in
7960true)
7961 case "$libperl" in
7962 '')
7963 # Figure out a good name for libperl.so. Since it gets stored in
7964 # a version-specific architecture-dependent library, the version
7965 # number isn't really that important, except for making cc/ld happy.
7966 #
7967 # A name such as libperl.so.3.1
7968 majmin="libperl.$so.$patchlevel.$subversion"
7969 # A name such as libperl.so.301
7970 majonly=`echo $patchlevel $subversion |
7971 $awk '{printf "%d%02d", $1, $2}'`
7972 majonly=libperl.$so.$majonly
7973 # I'd prefer to keep the os-specific stuff here to a minimum, and
7974 # rely on figuring it out from the naming of libc.
7975 case "${osname}${osvers}" in
7976 next4*)
7977 dflt=libperl.5.$so
7978 # XXX How handle the --version stuff for MAB?
7979 ;;
fb2e1bc0 7980 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
7981 dflt=libperl.$so
7982 ;;
b53432e4
GH
7983 cygwin*) # ld links against an importlib
7984 dflt=libperl$lib_ext
b4eb6b3d
JH
7985 ;;
7986 *) # Try to guess based on whether libc has major.minor.
7987 case "$libc" in
7988 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7989 *libc.$so.[0-9]*) dflt=$majonly ;;
7990 *) dflt=libperl.$so ;;
7991 esac
7992 ;;
7993 esac
7994 ;;
7995 *) dflt=$libperl
7996 ;;
7997 esac
7998 cat << EOM
7999
8000I need to select a good name for the shared libperl. If your system uses
8001library names with major and minor numbers, then you might want something
8002like $majmin. Alternatively, if your system uses a single version
8003number for shared libraries, then you might want to use $majonly.
8004Or, your system might be quite happy with a simple libperl.$so.
8005
8006Since the shared libperl will get installed into a version-specific
8007architecture-dependent directory, the version number of the shared perl
8008library probably isn't important, so the default should be o.k.
8009
8010EOM
8011 rp='What name do you want to give to the shared libperl?'
8012 . ./myread
8013 libperl=$ans
8014 echo "Ok, I'll use $libperl"
8015 ;;
8016*)
8017 libperl="libperl${_a}"
8018 ;;
8019esac
8020
8021# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8022case "$shrpdir" in
8023'') ;;
8024*) $cat >&4 <<EOM
8025WARNING: Use of the shrpdir variable for the installation location of
8026the shared $libperl is not supported. It was never documented and
8027will not work in this version. Let me (perlbug@perl.org)
8028know of any problems this may cause.
8029
8030EOM
8031 case "$shrpdir" in
8032 "$archlibexp/CORE")
8033 $cat >&4 <<EOM
8034But your current setting of $shrpdir is
8035the default anyway, so it's harmless.
8036EOM
8037 ;;
8038 *)
8039 $cat >&4 <<EOM
8040Further, your current attempted setting of $shrpdir
8041conflicts with the value of $archlibexp/CORE
8042that installperl will use.
8043EOM
8044 ;;
8045 esac
8046 ;;
8047esac
8048
8049# How will the perl executable find the installed shared $libperl?
8050# Add $xxx to ccdlflags.
8051# If we can't figure out a command-line option, use $shrpenv to
8052# set env LD_RUN_PATH. The main perl makefile uses this.
8053shrpdir=$archlibexp/CORE
8054xxx=''
8055tmp_shrpenv=''
8056if "$useshrplib"; then
8057 case "$osname" in
8058 aix)
8059 # We'll set it in Makefile.SH...
8060 ;;
b5b9f165 8061 solaris)
b4eb6b3d
JH
8062 xxx="-R $shrpdir"
8063 ;;
a774dfe6 8064 freebsd|netbsd|openbsd|interix|dragonfly)
b4eb6b3d
JH
8065 xxx="-Wl,-R$shrpdir"
8066 ;;
fb2e1bc0 8067 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
8068 xxx="-Wl,-rpath,$shrpdir"
8069 ;;
8070 next)
8071 # next doesn't like the default...
8072 ;;
8073 beos)
8074 # beos doesn't like the default, either.
8075 ;;
8076 hpux*)
8077 # hpux doesn't like the default, either.
8078 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8079 ;;
8080 *)
8081 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8082 ;;
8083 esac
8084 case "$xxx" in
8085 '') ;;
8086 *)
8087 # Only add $xxx if it isn't already in ccdlflags.
8088 case " $ccdlflags " in
8089 *" $xxx "*) ;;
8090 *) ccdlflags="$ccdlflags $xxx"
8091 cat <<EOM >&4
8092
8093Adding $xxx to the flags
8094passed to $ld so that the perl executable will find the
8095installed shared $libperl.
8096
8097EOM
8098 ;;
8099 esac
8100 ;;
8101 esac
8102fi
8103# Fix ccdlflags in AIX for building external extensions.
8104# (For building Perl itself bare -bE:perl.exp is needed,
8105# Makefile.SH takes care of this.)
8106case "$osname" in
8107aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8108esac
8109# Respect a hint or command-line value.
8110case "$shrpenv" in
8111'') shrpenv="$tmp_shrpenv" ;;
8112esac
8113case "$ldlibpthname" in
8114'') ldlibpthname=LD_LIBRARY_PATH ;;
8115none) ldlibpthname='' ;;
8116esac
8117
8118: determine where manual pages are on this system
8119echo " "
8120case "$sysman" in
8121'')
4a0a3829
SD
8122 syspath='/usr/share/man/man1 /usr/man/man1'
8123 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8124 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
8125 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8126 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8127 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8128 sysman=`./loc . /usr/man/man1 $syspath`
8129 ;;
8130esac
8131if $test -d "$sysman"; then
8132 echo "System manual is in $sysman." >&4
8133else
8134 echo "Could not find manual pages in source form." >&4
8135fi
8136
8137: determine where manual pages go
8138set man1dir man1dir none
8139eval $prefixit
8140$cat <<EOM
8141
8142$spackage has manual pages available in source form.
8143EOM
8144case "$nroff" in
8145nroff)
8146 echo "However, you don't have nroff, so they're probably useless to you."
8147 case "$man1dir" in
8148 '') man1dir="none";;
8149 esac;;
8150esac
8151echo "If you don't want the manual sources installed, answer 'none'."
8152case "$man1dir" in
8153' ') dflt=none
8154 ;;
8155'')
4a0a3829
SD
8156 lookpath="$prefixexp/share/man/man1"
8157 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
8158 lookpath="$lookpath $prefixexp/man/p_man/man1"
8159 lookpath="$lookpath $prefixexp/man/u_man/man1"
8160 lookpath="$lookpath $prefixexp/man/man.1"
8161 case "$sysman" in
8162 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8163 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8164 esac
8165 set dflt
8166 eval $prefixup
8167 ;;
8168*) dflt="$man1dir"
8169 ;;
8170esac
8171echo " "
8172fn=dn+~
8173rp="Where do the main $spackage manual pages (source) go?"
8174. ./getfile
8175if $test "X$man1direxp" != "X$ansexp"; then
8176 installman1dir=''
8177fi
79522dd2
NC
8178prefixvar=man1dir
8179. ./setprefixvar
8180
477140ee
NC
8181case "$man1dir" in
8182'') man1dir=' '
8183 installman1dir='';;
8184esac
b4eb6b3d
JH
8185
8186: What suffix to use on installed man pages
8187
8188case "$man1dir" in
8189' ')
8190 man1ext='0'
8191 ;;
8192*)
8193 rp="What suffix should be used for the main $spackage man pages?"
8194 case "$man1ext" in
8195 '') case "$man1dir" in
8196 *1) dflt=1 ;;
8197 *1p) dflt=1p ;;
8198 *1pm) dflt=1pm ;;
8199 *l) dflt=l;;
8200 *n) dflt=n;;
8201 *o) dflt=o;;
8202 *p) dflt=p;;
8203 *C) dflt=C;;
8204 *L) dflt=L;;
8205 *L1) dflt=L1;;
8206 *) dflt=1;;
8207 esac
8208 ;;
8209 *) dflt="$man1ext";;
8210 esac
8211 . ./myread
8212 man1ext="$ans"
8213 ;;
8214esac
8215
8216: see if we can have long filenames
8217echo " "
8218first=123456789abcdef
8219$rm -f $first
8220if (echo hi >$first) 2>/dev/null; then
8221 if $test -f 123456789abcde; then
8222 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8223 val="$undef"
8224 else
8225 echo 'You can have filenames longer than 14 characters.'>&4
8226 val="$define"
8227 fi
8228else
8229 $cat <<'EOM'
8230You can't have filenames longer than 14 chars.
8231You can't even think about them!
8232EOM
8233 val="$undef"
8234fi
8235set d_flexfnam
8236eval $setvar
8237$rm -rf 123456789abcde*
8238
8239: determine where library module manual pages go
8240set man3dir man3dir none
8241eval $prefixit
8242$cat <<EOM
8243
8244$spackage has manual pages for many of the library modules.
8245EOM
8246
8247case "$nroff" in
8248nroff)
8249 $cat <<'EOM'
8250However, you don't have nroff, so they're probably useless to you.
8251EOM
8252 case "$man3dir" in
8253 '') man3dir="none";;
8254 esac;;
8255esac
8256
8257case "$d_flexfnam" in
8258undef)
8259 $cat <<'EOM'
f3f1a2d8 8260However, your system can't handle the long file names like File::Basename.3.
b4eb6b3d
JH
8261EOM
8262 case "$man3dir" in
8263 '') man3dir="none";;
8264 esac;;
8265esac
8266
8267echo "If you don't want the manual sources installed, answer 'none'."
8268prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8269case "$man3dir" in
8270'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8271 if $test -d "$privlib/man/man3"; then
8272 cat <<EOM >&4
8273
8274WARNING: Previous versions of perl installed man3 pages into
f3f1a2d8
MB
8275$privlib/man/man3. This version will suggest a
8276new default of $dflt.
b4eb6b3d
JH
8277EOM
8278 tdflt=$dflt
8279 dflt='n'
8280 rp='Do you wish to preserve the old behavior?(y/n)'
8281 . ./myread
8282 case "$ans" in
8283 y*) dflt="$privlib/man/man3" ;;
8284 *) dflt=$tdflt ;;
8285 esac
8286 fi
8287 ;;
8288*) dflt="$man3dir" ;;
8289esac
8290case "$dflt" in
8291' ') dflt=none ;;
8292esac
8293echo " "
8294fn=dn+~
8295rp="Where do the $package library man pages (source) go?"
8296. ./getfile
79522dd2
NC
8297prefixvar=man3dir
8298. ./setprefixvar
8299
477140ee
NC
8300case "$man3dir" in
8301'') man3dir=' '
8302 installman3dir='';;
8303esac
b4eb6b3d
JH
8304
8305: What suffix to use on installed man pages
8306case "$man3dir" in
8307' ')
8308 man3ext='0'
8309 ;;
8310*)
8311 rp="What suffix should be used for the $package library man pages?"
8312 case "$man3ext" in
8313 '') case "$man3dir" in
8314 *3) dflt=3 ;;
8315 *3p) dflt=3p ;;
8316 *3pm) dflt=3pm ;;
8317 *l) dflt=l;;
8318 *n) dflt=n;;
8319 *o) dflt=o;;
8320 *p) dflt=p;;
8321 *C) dflt=C;;
8322 *L) dflt=L;;
8323 *L3) dflt=L3;;
8324 *) dflt=3;;
8325 esac
8326 ;;
8327 *) dflt="$man3ext";;
8328 esac
8329 . ./myread
8330 man3ext="$ans"
8331 ;;
8332esac
8333
8334: see if we have to deal with yellow pages, now NIS.
0384a54a 8335if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8336 if $test -f /usr/etc/nibindd; then
8337 echo " "
8338 echo "I'm fairly confident you're on a NeXT."
8339 echo " "
8340 rp='Do you get the hosts file via NetInfo?'
8341 dflt=y
8342 case "$hostcat" in
8343 nidump*) ;;
8344 '') ;;
8345 *) dflt=n;;
8346 esac
8347 . ./myread
8348 case "$ans" in
8349 y*) hostcat='nidump hosts .';;
8350 *) case "$hostcat" in
8351 nidump*) hostcat='';;
8352 esac
8353 ;;
8354 esac
8355 fi
8356 case "$hostcat" in
8357 nidump*) ;;
8358 *)
8359 case "$hostcat" in
8360 *ypcat*) dflt=y;;
8361 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8362 dflt=y
8363 else
8364 dflt=n
8365 fi;;
8366 *) dflt=n;;
8367 esac
8368 echo " "
8369 rp='Are you getting the hosts file via yellow pages?'
8370 . ./myread
8371 case "$ans" in
8372 y*) hostcat='ypcat hosts';;
8373 *) hostcat='cat /etc/hosts';;
8374 esac
8375 ;;
8376 esac
8377fi
8378case "$hostcat" in
8379'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8380esac
8381case "$groupcat" in
8382'') test -f /etc/group && groupcat='cat /etc/group';;
8383esac
8384case "$passcat" in
8385'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8386esac
8387
8388: now get the host name
8389echo " "
8390echo "Figuring out host name..." >&4
8391case "$myhostname" in
8392'') cont=true
8393 echo 'Maybe "hostname" will work...'
73614538 8394 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8395 myhostname=$tans
8396 phostname=hostname
8397 cont=''
8398 fi
8399 ;;
8400*) cont='';;
8401esac
8402if $test "$cont"; then
8403 if ./xenix; then
8404 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8405 if tans=`cat /etc/systemid 2>&1` ; then
8406 myhostname=$tans
8407 phostname='cat /etc/systemid'
8408 echo "Whadyaknow. Xenix always was a bit strange..."
8409 cont=''
8410 fi
8411 elif $test -r /etc/systemid; then
8412 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8413 fi
8414fi
8415if $test "$cont"; then
8416 echo 'No, maybe "uuname -l" will work...'
73614538 8417 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8418 myhostname=$tans
8419 phostname='uuname -l'
8420 else
8421 echo 'Strange. Maybe "uname -n" will work...'
73614538 8422 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8423 myhostname=$tans
8424 phostname='uname -n'
8425 else
8426 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8427 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8428 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8429 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8430 else
8431 case "$myhostname" in
8432 '') echo "Does this machine have an identity crisis or something?"
8433 phostname='';;
8434 *)
8435 echo "Well, you said $myhostname before..."
8436 phostname='echo $myhostname';;
8437 esac
8438 fi
8439 fi
8440 fi
8441fi
52a549d0
JH
8442case "$myhostname" in
8443'') myhostname=noname ;;
8444esac
b4eb6b3d
JH
8445: you do not want to know about this
8446set $myhostname
8447myhostname=$1
8448
8449: verify guess
8450if $test "$myhostname" ; then
8451 dflt=y
8452 rp='Your host name appears to be "'$myhostname'".'" Right?"
8453 . ./myread
8454 case "$ans" in
8455 y*) ;;
8456 *) myhostname='';;
8457 esac
8458fi
8459
8460: bad guess or no guess
8461while $test "X$myhostname" = X ; do
8462 dflt=''
8463 rp="Please type the (one word) name of your host:"
8464 . ./myread
8465 myhostname="$ans"
8466done
8467
8468: translate upper to lower if necessary
8469case "$myhostname" in
8470*[A-Z]*)
8471 echo "(Normalizing case in your host name)"
8472 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8473 ;;
8474esac
8475
8476case "$myhostname" in
8477*.*)
8478 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8479 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8480 echo "(Trimming domain name from host name--host name is now $myhostname)"
8481 ;;
8482*) case "$mydomain" in
8483 '')
8484 {
8485 test "X$hostcat" = "Xypcat hosts" &&
8486 ypmatch "$myhostname" hosts 2>/dev/null |\
8487 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8488 $test -s hosts
8489 } || {
8490 test "X$hostcat" != "X" &&
8491 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8492 /[ ]$myhostname[ . ]/p" > hosts
8493 }
8494 tmp_re="[ . ]"
f08cbdd1
PP
8495 if $test -f hosts; then
8496 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8497 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8498 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8499 hosts | $sort | $uniq | \
8500 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8501 case `$echo X$dflt` in
8502 X*\ *) echo "(Several hosts in the database matched hostname)"
8503 dflt=.
8504 ;;
8505 X.) echo "(You do not have fully-qualified names in the hosts database)"
8506 ;;
8507 esac
8508 else
8509 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8510 dflt=.
f08cbdd1 8511 fi
b4eb6b3d
JH
8512 case "$dflt" in
8513 .)
8514 tans=`./loc resolv.conf X /etc /usr/etc`
8515 if $test -f "$tans"; then
8516 echo "(Attempting domain name extraction from $tans)"
8517 dflt=.`$sed -n -e 's/ / /g' \
8518 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
8519 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8520 case "$dflt" in
8521 .) dflt=.`$sed -n -e 's/ / /g' \
8522 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
8523 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8524 ;;
8525 esac
8526 fi
8527 ;;
8528 esac
8529 case "$dflt" in
8530 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8531 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8532 case "$dflt" in
8533 '') dflt='.';;
8534 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8535 esac
8536 ;;
8537 esac
59c9e5d6
PP
8538 case "$dflt$osname" in
8539 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8540 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8541 ;;
8542 esac
b4eb6b3d
JH
8543 case "$dflt" in
8544 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8545 dflt='.nonet'
b4eb6b3d
JH
8546 ;;
8547 esac
8548 $rm -f hosts
8549 ;;
8550 *) dflt="$mydomain";;
8551 esac;;
8552esac
8553echo " "
8554rp="What is your domain name?"
8555. ./myread
8556tans="$ans"
8557case "$ans" in
8558'') ;;
8559.*) ;;
8560*) tans=".$tans";;
8561esac
8562mydomain="$tans"
8563
8564: translate upper to lower if necessary
8565case "$mydomain" in
8566*[A-Z]*)
8567 echo "(Normalizing case in your domain name)"
8568 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8569 ;;
8570esac
8571
8572: a little sanity check here
8573case "$phostname" in
8574'') ;;
8575*)
8576 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8577 $myhostname$mydomain|$myhostname) ;;
8578 *)
8579 case "$phostname" in
8580 sed*)
8581 echo "(That doesn't agree with your whoami.h file, by the way.)"
8582 ;;
8583 *)
8584 echo "(That doesn't agree with your $phostname command, by the way.)"
8585 ;;
8586 esac
8587 ;;
8588 esac
8589 ;;
8590esac
8591
8592$cat <<EOM
8593
8594I need to get your e-mail address in Internet format if possible, i.e.
8595something like user@host.domain. Please answer accurately since I have
8596no easy means to double check it. The default value provided below
8597is most probably close to reality but may not be valid from outside
8598your organization...
8599
8600EOM
8601cont=x
8602while test "$cont"; do
8603 case "$cf_email" in
8604 '') dflt="$cf_by@$myhostname$mydomain";;
8605 *) dflt="$cf_email";;
8606 esac
8607 rp='What is your e-mail address?'
8608 . ./myread
8609 cf_email="$ans"
8610 case "$cf_email" in
8611 *@*.*) cont='' ;;
8612 *)
8613 rp='Address does not look like an Internet one. Use it anyway?'
8614 case "$fastread" in
8615 yes) dflt=y ;;
8616 *) dflt=n ;;
8617 esac
8618 . ./myread
8619 case "$ans" in
8620 y*) cont='' ;;
8621 *) echo " " ;;
8622 esac
8623 ;;
8624 esac
8625done
8626
8627$cat <<EOM
8628
8629If you or somebody else will be maintaining perl at your site, please
8630fill in the correct e-mail address here so that they may be contacted
8631if necessary. Currently, the "perlbug" program included with perl
8632will send mail to this address in addition to perlbug@perl.org. You may
8633enter "none" for no administrator.
8634
8635EOM
8636case "$perladmin" in
8637'') dflt="$cf_email";;
8638*) dflt="$perladmin";;
8639esac
8640rp='Perl administrator e-mail address'
8641. ./myread
8642perladmin="$ans"
8643
674912d7
RB
8644: determine whether to only install version-specific parts.
8645echo " "
8646$cat <<EOM
8647Do you want to install only the version-specific parts of the perl
8648distribution? Usually you do *not* want to do this.
8649EOM
8650case "$versiononly" in
8651"$define"|[Yy]*|true) dflt='y' ;;
8652*) dflt='n';
8653esac
8654rp="Do you want to install only the version-specific parts of perl?"
8655. ./myread
8656case "$ans" in
8657[yY]*) val="$define";;
8658*) val="$undef" ;;
8659esac
8660set versiononly
8661eval $setvar
8662
ad493445
MB
8663case "$versiononly" in
8664"$define") inc_version_list=''
8665 inc_version_list_init=0
8666 ;;
8667esac
8668
b4eb6b3d 8669: figure out how to guarantee perl startup
d0e36aa9 8670: XXX Note that this currently takes advantage of the bug that binexp ignores
a2d23ec2
MB
8671: the Configure -Dinstallprefix setting, which in turn means that under
8672: relocatable @INC, initialinstalllocation is what binexp started as.
b4eb6b3d
JH
8673case "$startperl" in
8674'')
8675 case "$sharpbang" in
8676 *!)
8677 $cat <<EOH
8678
8679I can use the #! construct to start perl on your system. This will
8680make startup of perl scripts faster, but may cause problems if you
8681want to share those scripts and perl is not in a standard place
a2d23ec2
MB
8682($initialinstalllocation/perl) on all your platforms. The alternative
8683is to force a shell by starting the script with a single ':' character.
b4eb6b3d
JH
8684
8685EOH
674912d7 8686 case "$versiononly" in
a2d23ec2 8687 "$define") dflt="$initialinstalllocation/perl$version";;
d0e36aa9 8688 *) dflt="$initialinstalllocation/perl";;
674912d7 8689 esac
b4eb6b3d
JH
8690 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8691 . ./myread
8692 case "$ans" in
8693 none) startperl=": # use perl";;
8694 *) startperl="#!$ans"
8695 if $test 30 -lt `echo "$ans" | wc -c`; then
8696 $cat >&4 <<EOM
8697
8698WARNING: Some systems limit the #! command to 32 characters.
8699If you experience difficulty running Perl scripts with #!, try
8700installing Perl in a directory with a shorter pathname.
8701
8702EOM
8703 fi ;;
8704 esac
8705 ;;
8706 *) startperl=": # use perl"
8707 ;;
8708 esac
8709 ;;
8710esac
8711echo "I'll use $startperl to start perl scripts."
8712
8713: figure best path for perl in scripts
8714case "$perlpath" in
8715'')
5e20a8ca 8716 case "$versiononly" in
d0e36aa9
NC
8717 "$define") perlpath="$initialinstalllocation/perl$version";;
8718 *) perlpath="$initialinstalllocation/perl";;
5e20a8ca 8719 esac
b4eb6b3d
JH
8720 case "$startperl" in
8721 *!*) ;;
8722 *)
8723 $cat <<EOH
8724
8725I will use the "eval 'exec'" idiom to start Perl on your system.
8726I can use the full path of your Perl binary for this purpose, but
8727doing so may cause problems if you want to share those scripts and
d0e36aa9 8728Perl is not always in a standard place ($initialinstalllocation/perl).
b4eb6b3d
JH
8729
8730EOH
d0e36aa9 8731 dflt="$initialinstalllocation/perl"
b4eb6b3d
JH
8732 rp="What path shall I use in \"eval 'exec'\"?"
8733 . ./myread
8734 perlpath="$ans"
8735 ;;
8736 esac
8737 ;;
8738esac
8739case "$startperl" in
8740*!*) ;;
8741*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8742esac
8743
8744: determine where public executable scripts go
8745set scriptdir scriptdir
8746eval $prefixit
8747case "$scriptdir" in
8748'')
8749 dflt="$bin"
8750 : guess some guesses
8751 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8752 $test -d /usr/share/bin && dflt=/usr/share/bin
8753 $test -d /usr/local/script && dflt=/usr/local/script
8754 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8755 $test -d $prefixexp/script && dflt=$prefixexp/script
8756 set dflt
8757 eval $prefixup
8758 ;;
8759*) dflt="$scriptdir"
8760 ;;
8761esac
8762$cat <<EOM
f3f1a2d8 8763
b4eb6b3d
JH
8764Some installations have a separate directory just for executable scripts so
8765that they can mount it across multiple architectures but keep the scripts in
8766one spot. You might, for example, have a subdirectory of /usr/share for this.
8767Or you might just lump your scripts in with all your other executables.
f3f1a2d8 8768
b4eb6b3d
JH
8769EOM
8770fn=d~
8771rp='Where do you keep publicly executable scripts?'
8772. ./getfile
8773if $test "X$ansexp" != "X$scriptdirexp"; then
8774 installscript=''
8775fi
f3f1a2d8 8776installscriptdir=''
79522dd2
NC
8777prefixvar=scriptdir
8778. ./setprefixvar
8779: A little fix up for an irregularly named variable.
8780installscript="$installscriptdir"
8781
b4eb6b3d
JH
8782: determine where add-on public executables go
8783case "$sitebin" in
8784'') dflt=$siteprefix/bin ;;
8785*) dflt=$sitebin ;;
8786esac
8787fn=d~
8788rp='Pathname where the add-on public executables should be installed?'
8789. ./getfile
79522dd2
NC
8790prefixvar=sitebin
8791. ./setprefixvar
b4eb6b3d 8792
6e1038e0 8793: determine where add-on html pages go
8d2cbf27 8794: There is no standard location, so try to copy the previously-selected
6e1038e0 8795: directory structure for the core html pages.
8d2cbf27
JH
8796case "$sitehtml1dir" in
8797'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8798*) dflt=$sitehtml1dir ;;
6e1038e0
MB
8799esac
8800case "$dflt" in
8801''|' ') dflt=none ;;
8802esac
8803fn=dn+~
8804rp='Pathname where the site-specific html pages should be installed?'
8805. ./getfile
79522dd2
NC
8806prefixvar=sitehtml1dir
8807. ./setprefixvar
6e1038e0
MB
8808
8809: determine where add-on library html pages go
8810: There is no standard location, so try to copy the previously-selected
8811: directory structure for the core html pages.
8d2cbf27
JH
8812case "$sitehtml3dir" in
8813'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8814*) dflt=$sitehtml3dir ;;
6e1038e0
MB
8815esac
8816case "$dflt" in
8817''|' ') dflt=none ;;
8818esac
8819fn=dn+~
8820rp='Pathname where the site-specific library html pages should be installed?'
8821. ./getfile
79522dd2
NC
8822prefixvar=sitehtml3dir
8823. ./setprefixvar
6e1038e0
MB
8824
8825: determine where add-on manual pages go
91e123a8
JH
8826case "$siteman1dir" in
8827'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 8828*) dflt=$siteman1dir ;;
6e1038e0 8829esac
257059b5
JH
8830case "$dflt" in
8831''|' ') dflt=none ;;
8832esac
6e1038e0
MB
8833fn=dn+~
8834rp='Pathname where the site-specific manual pages should be installed?'
8835. ./getfile
79522dd2
NC
8836prefixvar=siteman1dir
8837. ./setprefixvar
6e1038e0
MB
8838
8839: determine where add-on library man pages go
91e123a8
JH
8840case "$siteman3dir" in
8841'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 8842*) dflt=$siteman3dir ;;
6e1038e0 8843esac
257059b5
JH
8844case "$dflt" in
8845''|' ') dflt=none ;;
8846esac
6e1038e0
MB
8847fn=dn+~
8848rp='Pathname where the site-specific library manual pages should be installed?'
8849. ./getfile
79522dd2
NC
8850prefixvar=siteman3dir
8851. ./setprefixvar
6e1038e0
MB
8852
8853: determine where add-on public executable scripts go
8854case "$sitescript" in
8855'') dflt=$siteprefix/script
8856 $test -d $dflt || dflt=$sitebin ;;
8857*) dflt="$sitescript" ;;
8858esac
8859fn=d~+
8860rp='Pathname where add-on public executable scripts should be installed?'
8861. ./getfile
79522dd2
NC
8862prefixvar=sitescript
8863. ./setprefixvar
6e1038e0 8864
15b61c98
JH
8865case "$usefaststdio" in
8866$define|true|[yY]*|'')
8867 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8868 case "$xversion" in
8869 [68]) dflt='y' ;;
8870 *) dflt='n' ;;
8871 esac
8872 ;;
8873*) dflt='n';;
8874esac
8875cat <<EOM
8876
8877Perl can be built to use 'fast stdio', which means using the stdio
8878library but also directly manipulating the stdio buffers to enable
8879faster I/O. Using stdio is better for backward compatibility (especially
8880for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8881interface has been preferred instead of stdio.
8882
8883If this doesn't make any sense to you, just accept the default '$dflt'.
8884EOM
8885rp='Use the "fast stdio" if available?'
8886. ./myread
8887case "$ans" in
8888y|Y) val="$define" ;;
8889*) val="$undef" ;;
8890esac
8891set usefaststdio
8892eval $setvar
8893
8894
96056487
JH
8895: define an is-a-typedef? function
8896typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8897case "$inclist" in
8898"") inclist="sys/types.h";;
8899esac;
8900eval "varval=\$$var";
8901case "$varval" in
8902"")
8903 $rm -f temp.c;
8904 for inc in $inclist; do
8905 echo "#include <$inc>" >>temp.c;
8906 done;
8907 echo "#ifdef $type" >> temp.c;
8908 echo "printf(\"We have $type\");" >> temp.c;
8909 echo "#endif" >> temp.c;
8910 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8911 if $contains $type temp.E >/dev/null 2>&1; then
8912 eval "$var=\$type";
8913 else
8914 eval "$var=\$def";
8915 fi;
8916 $rm -f temp.?;;
8917*) eval "$var=\$varval";;
8918esac'
8919
8920: define an is-a-typedef? function that prompts if the type is not available.
8921typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8922case "$inclist" in
8923"") inclist="sys/types.h";;
8924esac;
8925eval "varval=\$$var";
8926case "$varval" in
8927"")
8928 $rm -f temp.c;
8929 for inc in $inclist; do
8930 echo "#include <$inc>" >>temp.c;
8931 done;
8932 echo "#ifdef $type" >> temp.c;
8933 echo "printf(\"We have $type\");" >> temp.c;
8934 echo "#endif" >> temp.c;
8935 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8936 echo " " ;
8937 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8938 if $contains $type temp.E >/dev/null 2>&1; then
8939 echo "$type found." >&4;
8940 eval "$var=\$type";
8941 else
8942 echo "$type NOT found." >&4;
8943 dflt="$def";
8944 . ./myread ;
8945 eval "$var=\$ans";
8946 fi;
8947 $rm -f temp.?;;
8948*) eval "$var=\$varval";;
8949esac'
8950
8951: see what type lseek is declared as in the kernel
8952rp="What is the type used for lseek's offset on this system?"
8953set off_t lseektype long stdio.h sys/types.h
8954eval $typedef_ask
8955
8956echo " "
8957echo "Checking to see how big your file offsets are..." >&4
8958$cat >try.c <<EOCP
8959#include <sys/types.h>
8960#include <stdio.h>
8961int main()
8962{
8963 printf("%d\n", (int)sizeof($lseektype));
8964 return(0);
8965}
8966EOCP
8967set try
8968if eval $compile_ok; then
8969 lseeksize=`$run ./try`
8970 echo "Your file offsets are $lseeksize bytes long."
8971else
8972 dflt=$longsize
8973 echo " "
8974 echo "(I can't seem to compile the test program. Guessing...)"
8975 rp="What is the size of your file offsets (in bytes)?"
8976 . ./myread
8977 lseeksize="$ans"
8978fi
8979$rm -f try.c try
8980
8981: see what type file positions are declared as in the library
8982rp="What is the type for file position used by fsetpos()?"
8983set fpos_t fpostype long stdio.h sys/types.h
8984eval $typedef_ask
8985
8986echo " "
8987case "$fpostype" in
8988*_t) zzz="$fpostype" ;;
8989*) zzz="fpos_t" ;;
8990esac
8991echo "Checking the size of $zzz..." >&4
8992cat > try.c <<EOCP
8993#include <sys/types.h>
8994#include <stdio.h>
d1daaddf
JH
8995#$i_stdlib I_STDLIB
8996#ifdef I_STDLIB
8997#include <stdlib.h>
8998#endif
96056487
JH
8999int main() {
9000 printf("%d\n", (int)sizeof($fpostype));
9001 exit(0);
9002}
9003EOCP
9004set try
9005if eval $compile_ok; then
9006 yyy=`$run ./try`
9007 case "$yyy" in
9008 '') fpossize=4
9009 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9010 ;;
9011 *) fpossize=$yyy
9012 echo "Your $zzz is $fpossize bytes long."
9013 ;;
9014 esac
9015else
9016 dflt="$longsize"
9017 echo " " >&4
9018 echo "(I can't compile the test program. Guessing...)" >&4
9019 rp="What is the size of your file positions (in bytes)?"
9020 . ./myread
9021 fpossize="$ans"
9022fi
9023
96056487
JH
9024# Backward compatibility (uselfs is deprecated).
9025case "$uselfs" in
9026"$define"|true|[yY]*)
9027 cat <<EOM >&4
9028
9029*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9030EOM
9031 uselargefiles="$define"
9032 ;;
9033esac
9034
9035case "$lseeksize:$fpossize" in
90368:8) cat <<EOM
9037
9038You can have files larger than 2 gigabytes.
9039EOM
9040 val="$define" ;;
9041*) case "$uselargefiles" in
9042 "$undef"|false|[nN]*) dflt='n' ;;
9043 *) dflt='y' ;;
9044 esac
9045 cat <<EOM
9046
9047Perl can be built to understand large files (files larger than 2 gigabytes)
9048on some systems. To do so, Configure can be run with -Duselargefiles.
9049
9050If this doesn't make any sense to you, just accept the default '$dflt'.
9051EOM
9052 rp='Try to understand large files, if available?'
9053 . ./myread
9054 case "$ans" in
9055 y|Y) val="$define" ;;
9056 *) val="$undef" ;;
9057 esac
9058 ;;
9059esac
9060set uselargefiles
9061eval $setvar
96056487
JH
9062: Look for a hint-file generated 'call-back-unit'. If the
9063: user has specified that a large files perl is to be built,
9064: we may need to set or change some other defaults.
9da7673b
MB
9065if $test -f uselargefiles.cbu; then
9066 echo "Your platform has some specific hints regarding large file builds, using them..."
9067 . ./uselargefiles.cbu
9068fi
9069case "$uselargefiles" in
9070"$define")
96056487 9071 if $test -f uselargefiles.cbu; then
96056487
JH
9072 echo " "
9073 echo "Rechecking to see how big your file offsets are..." >&4
9074 $cat >try.c <<EOCP
9075#include <sys/types.h>
9076#include <stdio.h>
9077int main()
9078{
9079 printf("%d\n", (int)sizeof($lseektype));
9080 return(0);
9081}
9082EOCP
9083 set try
9084 if eval $compile_ok; then
9085 lseeksize=`$run ./try`
9086 $echo "Your file offsets are now $lseeksize bytes long."
9087 else
9088 dflt="$lseeksize"
9089 echo " "
9090 echo "(I can't seem to compile the test program. Guessing...)"
9091 rp="What is the size of your file offsets (in bytes)?"
9092 . ./myread
9093 lseeksize="$ans"
9094 fi
9095 case "$fpostype" in
9096 *_t) zzz="$fpostype" ;;
9097 *) zzz="fpos_t" ;;
9098 esac
9099 $echo $n "Rechecking the size of $zzz...$c" >&4
9100 $cat > try.c <<EOCP
9101#include <sys/types.h>
9102#include <stdio.h>
55954f19
JH
9103#$i_stdlib I_STDLIB
9104#ifdef I_STDLIB
9105#include <stdlib.h>
9106#endif
96056487
JH
9107int main() {
9108 printf("%d\n", (int)sizeof($fpostype));
073b6de5 9109 return(0);
96056487
JH
9110}
9111EOCP
9112 set try
9113 if eval $compile_ok; then
9114 yyy=`$run ./try`
9115 dflt="$lseeksize"
9116 case "$yyy" in
9117 '') echo " "
9118 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9119 ;;
9120 *) fpossize=$yyy
9121 echo " $fpossize bytes." >&4
9122 ;;
9123 esac
9124 else
9125 dflt="$fpossize"
9126 echo " "
9127 echo "(I can't compile the test program. Guessing...)" >&4
9128 rp="What is the size of your file positions (in bytes)?"
9129 . ./myread
9130 fpossize="$ans"
9131 fi
9132 $rm -f try.c try
9133 fi
9134 ;;
9135esac
9136
b4eb6b3d
JH
9137case "$vendorprefix" in
9138'') d_vendorbin="$undef"
9139 vendorbin=''
9140 vendorbinexp=''
9141 ;;
9142*) d_vendorbin="$define"
9143 : determine where vendor-supplied executables go.
9144 case "$vendorbin" in
9145 '') dflt=$vendorprefix/bin ;;
9146 *) dflt="$vendorbin" ;;
9147 esac
9148 fn=d~+
9149 rp='Pathname for the vendor-supplied executables directory?'
9150 . ./getfile
9151 vendorbin="$ans"
9152 vendorbinexp="$ansexp"
9153 ;;
9154esac
a092d240
NC
9155prefixvar=vendorbin
9156. ./installprefix
b4eb6b3d 9157
6e1038e0 9158case "$vendorprefix" in
8d2cbf27
JH
9159'') vendorhtml1dir=''
9160 vendorhtml1direxp=''
6e1038e0
MB
9161 ;;
9162*) : determine where vendor-supplied html pages go.
9163 : There is no standard location, so try to copy the previously-selected
9164 : directory structure for the core html pages.
9165 : XXX Better default suggestions would be welcome.
8d2cbf27 9166 case "$vendorhtml1dir" in
6e1038e0 9167 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9168 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9169 esac
9170 case "$dflt" in
9171 ''|' ') dflt=none ;;
9172 esac
9173 fn=dn+~
9174 rp='Pathname for the vendor-supplied html pages?'
9175 . ./getfile
8d2cbf27
JH
9176 vendorhtml1dir="$ans"
9177 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9178 ;;
9179esac
9180: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9181$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
a092d240
NC
9182prefixvar=vendorhtml1dir
9183. ./installprefix
6e1038e0
MB
9184
9185case "$vendorprefix" in
8d2cbf27
JH
9186'') vendorhtml3dir=''
9187 vendorhtml3direxp=''
6e1038e0
MB
9188 ;;
9189*) : determine where vendor-supplied module html pages go.
9190 : There is no standard location, so try to copy the previously-selected
9191 : directory structure for the core html pages.
9192 : XXX Better default suggestions would be welcome.
8d2cbf27 9193 case "$vendorhtml3dir" in
6e1038e0 9194 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9195 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9196 esac
9197 case "$dflt" in
9198 ''|' ') dflt=none ;;
9199 esac
9200 fn=dn+~
9201 rp='Pathname for the vendor-supplied html pages?'
9202 . ./getfile
8d2cbf27
JH
9203 vendorhtml3dir="$ans"
9204 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9205 ;;
9206esac
9207: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9208$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
a092d240
NC
9209prefixvar=vendorhtml3dir
9210. ./installprefix
6e1038e0
MB
9211
9212case "$vendorprefix" in
91e123a8
JH
9213'') vendorman1dir=''
9214 vendorman1direxp=''
6e1038e0
MB
9215 ;;
9216*) : determine where vendor-supplied manual pages go.
91e123a8 9217 case "$vendorman1dir" in
6e1038e0 9218 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9219 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9220 esac
9221 case "$dflt" in
9222 ''|' ') dflt=none ;;
9223 esac
9224 fn=nd~+
9225 rp='Pathname for the vendor-supplied manual section 1 pages?'
9226 . ./getfile
91e123a8
JH
9227 vendorman1dir="$ans"
9228 vendorman1direxp="$ansexp"
6e1038e0
MB
9229 ;;
9230esac
9231: Use ' ' for none so value is preserved next time through Configure
91e123a8 9232$test X"$vendorman1dir" = "X" && vendorman1dir=' '
a092d240
NC
9233prefixvar=vendorman1dir
9234. ./installprefix
6e1038e0
MB
9235
9236case "$vendorprefix" in
91e123a8
JH
9237'') vendorman3dir=''
9238 vendorman3direxp=''
6e1038e0
MB
9239 ;;
9240*) : determine where vendor-supplied module manual pages go.
91e123a8 9241 case "$vendorman3dir" in
6e1038e0 9242 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9243 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9244 esac
9245 case "$dflt" in
9246 ''|' ') dflt=none ;;
9247 esac
9248 fn=nd~+
9249 rp='Pathname for the vendor-supplied manual section 3 pages?'
9250 . ./getfile
91e123a8
JH
9251 vendorman3dir="$ans"
9252 vendorman3direxp="$ansexp"
6e1038e0
MB
9253 ;;
9254esac
9255: Use ' ' for none so value is preserved next time through Configure
91e123a8 9256$test X"$vendorman3dir" = "X" && vendorman3dir=' '
a092d240
NC
9257prefixvar=vendorman3dir
9258. ./installprefix
6e1038e0
MB
9259
9260case "$vendorprefix" in
9261'') d_vendorscript="$undef"
9262 vendorscript=''
9263 vendorscriptexp=''
9264 ;;
9265*) d_vendorscript="$define"
9266 : determine where vendor-supplied scripts go.
9267 case "$vendorscript" in
9268 '') dflt=$vendorprefix/script
9269 $test -d $dflt || dflt=$vendorbin ;;
9270 *) dflt="$vendorscript" ;;
9271 esac
9272 $cat <<EOM
9273
f3f1a2d8 9274The installation process will create a directory for
6e1038e0
MB
9275vendor-supplied scripts.
9276
9277EOM
9278 fn=d~+
9279 rp='Pathname for the vendor-supplied scripts directory?'
9280 . ./getfile
9281 vendorscript="$ans"
9282 vendorscriptexp="$ansexp"
9283 ;;
9284esac
a092d240
NC
9285prefixvar=vendorscript
9286. ./installprefix
6e1038e0 9287
b4eb6b3d
JH
9288: see if qgcvt exists
9289set qgcvt d_qgcvt
9290eval $inlibc
9291
89ce900e
JH
9292echo " "
9293
9294if $test X"$d_longdbl" = X"$define"; then
9295
9296echo "Checking how to print long doubles..." >&4
9297
9298if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9299 $cat >try.c <<'EOCP'
9300#include <sys/types.h>
9301#include <stdio.h>
9302int main() {
9303 double d = 123.456;
9304 printf("%.3f\n", d);
9305}
9306EOCP
9307 set try
9308 if eval $compile; then
9309 yyy=`$run ./try`
9310 case "$yyy" in
9311 123.456)
9312 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9313 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9314 echo "We will use %f."
9315 ;;
9316 esac
9317 fi
9318fi
9319
9320if $test X"$sPRIfldbl" = X; then
9321 $cat >try.c <<'EOCP'
9322#include <sys/types.h>
9323#include <stdio.h>
9324int main() {
9325 long double d = 123.456;
9326 printf("%.3Lf\n", d);
9327}
9328EOCP
9329 set try
9330 if eval $compile; then
9331 yyy=`$run ./try`
9332 case "$yyy" in
9333 123.456)
9334 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9335 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9336 echo "We will use %Lf."
9337 ;;
9338 esac
9339 fi
9340fi
9341
9342if $test X"$sPRIfldbl" = X; then
9343 $cat >try.c <<'EOCP'
9344#include <sys/types.h>
9345#include <stdio.h>
9346int main() {
9347 long double d = 123.456;
9348 printf("%.3llf\n", d);
9349}
9350EOCP
9351 set try
9352 if eval $compile; then
9353 yyy=`$run ./try`
9354 case "$yyy" in
9355 123.456)
9356 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9357 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9358 echo "We will use %llf."
9359 ;;
9360 esac
9361 fi
9362fi
9363
9364if $test X"$sPRIfldbl" = X; then
9365 $cat >try.c <<'EOCP'
9366#include <sys/types.h>
9367#include <stdio.h>
9368int main() {
9369 long double d = 123.456;
9370 printf("%.3lf\n", d);
9371}
9372EOCP
9373 set try
9374 if eval $compile; then
9375 yyy=`$run ./try`
9376 case "$yyy" in
9377 123.456)
9378 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9379 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9380 echo "We will use %lf."
9381 ;;
9382 esac
9383 fi
9384fi
9385
9386if $test X"$sPRIfldbl" = X; then
9387 echo "Cannot figure out how to print long doubles." >&4
9388else
9389 sSCNfldbl=$sPRIfldbl # expect consistency
9390fi
9391
9392$rm -f try try.*
9393
9394fi # d_longdbl
9395
9396case "$sPRIfldbl" in
9397'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9398 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9399 d_SCNfldbl="$undef";
9400 ;;
9401*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9402 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9403 d_SCNfldbl="$define";
9404 ;;
9405esac
9406
b4eb6b3d 9407: Check how to convert floats to strings.
a5b10d80
YST
9408
9409if test "X$d_Gconvert" = X; then
9410
b4eb6b3d
JH
9411echo " "
9412echo "Checking for an efficient way to convert floats to strings."
9413echo " " > try.c
9414case "$uselongdouble" in
9415"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9416esac
9417case "$d_longdbl" in
9418"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9419esac
9420case "$d_PRIgldbl" in
9421"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9422esac
9423$cat >>try.c <<EOP
9424#ifdef TRY_gconvert
9425#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9426char *myname = "gconvert";
9427#endif
9428#ifdef TRY_gcvt
9429#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9430char *myname = "gcvt";
9431#endif
9432#ifdef TRY_qgcvt
9433#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9434char *myname = "qgcvt";
9435#define DOUBLETYPE long double
9436#endif
9437#ifdef TRY_sprintf
a5b10d80
YST
9438#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9439#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9440#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9441#else
a5b10d80
YST
9442#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9443#endif
9444#else
b4eb6b3d
JH
9445#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9446#endif
9447char *myname = "sprintf";
9448#endif
9449
9450#ifndef DOUBLETYPE
9451#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9452#define DOUBLETYPE long double
9453#else
9454#define DOUBLETYPE double
9455#endif
9456#endif
9457
9458#include <stdio.h>
9459
9460#define I_STDLIB $i_stdlib
9461#ifdef I_STDLIB
9462#include <stdlib.h>
9463#endif
9464
9465int
9466checkit(expect, got)
9467char *expect;
9468char *got;
9469{
9470 if (strcmp(expect, got)) {
9471 printf("%s oddity: Expected %s, got %s\n",
9472 myname, expect, got);
9473 exit(1);
9474 }
9475}
9476
9477int main()
9478{
9479 char buf[64];
9480 buf[63] = '\0';
9481
9482 /* This must be 1st test on (which?) platform */
9483 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9484 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9485 checkit("0.1", buf);
9486
a5b10d80
YST
9487 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9488 checkit("0.01", buf);
9489
9490 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9491 checkit("0.001", buf);
9492
9493 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9494 checkit("0.0001", buf);
9495
9496 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9497 if (strlen(buf) > 5)
9498 checkit("9e-005", buf); /* for Microsoft ?? */
9499 else
9500 checkit("9e-05", buf);
9501
b4eb6b3d
JH
9502 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9503 checkit("1", buf);
9504
9505 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9506 checkit("1.1", buf);
9507
9508 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9509 checkit("1.01", buf);
9510
9511 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9512 checkit("1.001", buf);
9513
9514 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9515 checkit("1.0001", buf);
9516
9517 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9518 checkit("1.00001", buf);
9519
9520 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9521 checkit("1.000001", buf);
9522
9523 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9524 checkit("0", buf);
9525
9526 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9527 checkit("-1", buf);
9528
9529 /* Some Linux gcvt's give 1.e+5 here. */
9530 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9531 checkit("100000", buf);
9532
9533 /* Some Linux gcvt's give -1.e+5 here. */
9534 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9535 checkit("-100000", buf);
9536
9537 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9538 checkit("123.456", buf);
9539
ab6ca9f4 9540 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9541 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9542 /* 34 should be enough to scare even long double
9543 * places into using the e notation. */
ab6ca9f4 9544 if (strlen(buf) > 5)
94b339ad 9545 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9546 else
94b339ad 9547 checkit("1e+34", buf);
8e2a5ede 9548
d1eb8299
YST
9549 /* For Perl, if you add additional tests here, also add them to
9550 * t/base/num.t for benefit of platforms not using Configure or
9551 * overriding d_Gconvert */
9552
b4eb6b3d
JH
9553 exit(0);
9554}
9555EOP
ab6ca9f4 9556: first add preferred functions to our list
a5b10d80 9557xxx_list=""
ab6ca9f4 9558for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9559 case $xxx_convert in
9560 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9561 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
a5b10d80
YST
9562 esac
9563done
9564: then add any others
9565for xxx_convert in gconvert gcvt sprintf; do
9566 case "$xxx_list" in
9567 *$xxx_convert*) ;;
9568 *) xxx_list="$xxx_list $xxx_convert" ;;
9569 esac
9570done
9571
9572case "$d_longdbl$uselongdouble" in
9573"$define$define")
9574 : again, add prefered functions to our list first
9575 xxx_ld_list=""
ab6ca9f4 9576 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9577 case $xxx_convert in
9578 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9579 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9580 esac
9581 done
9582 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9583 for xxx_convert in qgcvt sprintf $xxx_list; do
9584 case "$xxx_ld_list" in
9585 $xxx_convert*|*" $xxx_convert"*) ;;
9586 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9587 esac
9588 done
9589 : if sprintf cannot do long doubles, move it to the end
9590 if test "$d_PRIgldbl" != "$define"; then
9591 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9592 fi
9593 : if no qgcvt, remove it
9594 if test "$d_qgcvt" != "$define"; then
9595 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9596 fi
9597 : use the ld_list
9598 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9599 ;;
9600esac
9601
9602for xxx_convert in $xxx_list; do
9603 echo "Trying $xxx_convert..."
9604 $rm -f try try$_o
9605 set try -DTRY_$xxx_convert
9606 if eval $compile; then
9607 echo "$xxx_convert() found." >&4
5440bc8e 9608 if $run ./try; then
b4eb6b3d
JH
9609 echo "I'll use $xxx_convert to convert floats into a string." >&4
9610 break;
9611 else
9612 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9613 xxx_convert=''
b4eb6b3d
JH
9614 fi
9615 else
9616 echo "$xxx_convert NOT found." >&4
9617 fi
9618done
ab6ca9f4 9619
a5b10d80
YST
9620if test X$xxx_convert = X; then
9621 echo "*** WHOA THERE!!! ***" >&4
9622 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9623 xxx_convert=sprintf
9624fi
9625
b4eb6b3d
JH
9626case "$xxx_convert" in
9627gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9628gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9629qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9630*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9631 "$define$define$define")
9632 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9633 "$define$define$undef")
9634 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9635 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9636 esac
9637 ;;
9638esac
9639
a5b10d80
YST
9640fi
9641
74cac757
JH
9642: see if _fwalk exists
9643set fwalk d__fwalk
9644eval $inlibc
9645
b4eb6b3d
JH
9646: Initialize h_fcntl
9647h_fcntl=false
9648
9649: Initialize h_sysfile
9650h_sysfile=false
9651
9652: access call always available on UNIX
9653set access d_access
9654eval $inlibc
9655
9656: locate the flags for 'access()'
9657case "$d_access" in
9658"$define")
9659 echo " "
55954f19 9660 $cat >access.c <<EOCP
b4eb6b3d
JH
9661#include <sys/types.h>
9662#ifdef I_FCNTL
9663#include <fcntl.h>
9664#endif
9665#ifdef I_SYS_FILE
9666#include <sys/file.h>
9667#endif
9668#ifdef I_UNISTD
9669#include <unistd.h>
9670#endif
55954f19
JH
9671#$i_stdlib I_STDLIB
9672#ifdef I_STDLIB
9673#include <stdlib.h>
9674#endif
b4eb6b3d
JH
9675int main() {
9676 exit(R_OK);
9677}
9678EOCP
9679 : check sys/file.h first, no particular reason here
9680 if $test `./findhdr sys/file.h` && \
7a282f6d 9681 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9682 h_sysfile=true;
9683 echo "<sys/file.h> defines the *_OK access constants." >&4
9684 elif $test `./findhdr fcntl.h` && \
7a282f6d 9685 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9686 h_fcntl=true;
9687 echo "<fcntl.h> defines the *_OK access constants." >&4
9688 elif $test `./findhdr unistd.h` && \
7a282f6d 9689 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9690 echo "<unistd.h> defines the *_OK access constants." >&4
9691 else
9692 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9693 fi
9694 ;;
9695esac
9696$rm -f access*
9697
9698: see if accessx exists
9699set accessx d_accessx
9700eval $inlibc
9701
89ce900e
JH
9702: see if aintl exists
9703set aintl d_aintl
9704eval $inlibc
9705
b4eb6b3d
JH
9706: see if alarm exists
9707set alarm d_alarm
9708eval $inlibc
9709
a9dade78
JH
9710: see if POSIX threads are available
9711set pthread.h i_pthread
9712eval $inhdr
9713
10bc17b6
JH
9714: define a fucntion to check prototypes
9715$cat > protochk <<EOSH
9716$startsh
9717cc="$cc"
9718optimize="$optimize"
9719ccflags="$ccflags"
9720prototype="$prototype"
9721define="$define"
9722rm=$rm
a9dade78
JH
9723usethreads=$usethreads
9724i_pthread=$i_pthread
9725pthread_h_first=$pthread_h_first
10bc17b6
JH
9726EOSH
9727
9728$cat >> protochk <<'EOSH'
9729
9730$rm -f try.c
9731foo="$1"
9732shift
9733while test $# -ge 2; do
9734 case "$1" in
9735 $define) echo "#include <$2>" >> try.c ;;
9736 literal) echo "$2" >> try.c ;;
9737 esac
cce6a207
MB
9738 # Extra magic for the benefit of systems that need pthread.h
9739 # to be included early to correctly detect threadsafe functions.
9740 # Such functions must guarantee themselves, though, that the usethreads
9741 # and i_pthread have been defined, before calling protochk.
9742 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9743 echo "#include <pthread.h>" >> try.c
9744 pthread_h_done=yes
9745 fi
10bc17b6
JH
9746 shift 2
9747done
9748test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
9749cat >> try.c <<'EOCP'
9750#ifdef CAN_PROTOTYPE
9751#define _(args) args
9752#else
9753#define _(args) ()
9754#endif
9755EOCP
9756echo "$foo" >> try.c
9757echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9758$cc $optimize $ccflags -c try.c > /dev/null 2>&1
9759status=$?
9760$rm -f try.[co]
9761exit $status
9762EOSH
9763chmod +x protochk
9764$eunicefix protochk
9765
89ce900e
JH
9766hasproto='varname=$1; func=$2; shift; shift;
9767while $test $# -ge 2; do
9768 case "$1" in
9769 $define) echo "#include <$2>";;
9770 esac ;
9771 shift 2;
9772done > try.c;
9773$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9774if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9775 echo "$func() prototype found.";
9776 val="$define";
9777else
9778 echo "$func() prototype NOT found.";
9779 val="$undef";
9780fi;
9781set $varname;
9782eval $setvar;
9783$rm -f try.c tryout.c'
9784
10bc17b6
JH
9785: see if sys/types.h has to be included
9786set sys/types.h i_systypes
9787eval $inhdr
9788
9789: see if sys/select.h has to be included
9790set sys/select.h i_sysselct
9791eval $inhdr
9792
9793hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9794while $test $# -ge 2; do
9795 case "$1" in
9796 $define) echo "#include <$2>";;
9797 esac ;
9798 shift 2;
9799done > try.c;
9800echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9801set try;
9802if eval $compile; then
9803 val="$define";
9804else
9805 val="$undef";
9806fi;
9807set $varname;
9808eval $setvar;
9809$rm -f try.c try.o'
9810
9811: see if we should include time.h, sys/time.h, or both
9812echo " "
9813if test "X$timeincl" = X; then
9814 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9815 $echo $n "I'm now running the test program...$c"
55954f19 9816 $cat >try.c <<EOCP
10bc17b6
JH
9817#include <sys/types.h>
9818#ifdef I_TIME
9819#include <time.h>
9820#endif
9821#ifdef I_SYSTIME
9822#ifdef SYSTIMEKERNEL
9823#define KERNEL
9824#endif
9825#include <sys/time.h>
9826#endif
9827#ifdef I_SYSSELECT
9828#include <sys/select.h>
9829#endif
55954f19
JH
9830#$i_stdlib I_STDLIB
9831#ifdef I_STDLIB
9832#include <stdlib.h>
9833#endif
10bc17b6
JH
9834int main()
9835{
9836 struct tm foo;
9837#ifdef S_TIMEVAL
9838 struct timeval bar;
9839#endif
9840#ifdef S_TIMEZONE
9841 struct timezone tzp;
9842#endif
9843 if (foo.tm_sec == foo.tm_sec)
9844 exit(0);
9845#ifdef S_TIMEVAL
9846 if (bar.tv_sec == bar.tv_sec)
9847 exit(0);
9848#endif
9849 exit(1);
9850}
9851EOCP
9852 flags=''
9853 for s_timezone in '-DS_TIMEZONE' ''; do
9854 sysselect=''
9855 for s_timeval in '-DS_TIMEVAL' ''; do
9856 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9857 for i_time in '' '-DI_TIME'; do
9858 for i_systime in '-DI_SYSTIME' ''; do
9859 case "$flags" in
9860 '') $echo $n ".$c"
9861 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9862 if eval $compile; then
9863 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9864 shift
9865 flags="$*"
9866 echo " "
9867 $echo $n "Succeeded with $flags$c"
9868 fi
9869 ;;
9870 esac
9871 done
9872 done
9873 done
9874 done
9875 done
9876 timeincl=''
9877 echo " "
9878 case "$flags" in
9879 *SYSTIMEKERNEL*) i_systimek="$define"
9880 timeincl=`./findhdr sys/time.h`
9881 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9882 *) i_systimek="$undef";;
9883 esac
9884 case "$flags" in
9885 *I_TIME*) i_time="$define"
9886 timeincl=`./findhdr time.h`" $timeincl"
9887 echo "We'll include <time.h>." >&4;;
9888 *) i_time="$undef";;
9889 esac
9890 case "$flags" in
9891 *I_SYSTIME*) i_systime="$define"
9892 timeincl=`./findhdr sys/time.h`" $timeincl"
9893 echo "We'll include <sys/time.h>." >&4;;
9894 *) i_systime="$undef";;
9895 esac
9896 $rm -f try.c try
9897fi
9898: see if struct tm knows about tm_zone
9899case "$i_systime$i_time" in
9900*$define*)
9901 echo " "
9902 echo "Checking to see if your struct tm has tm_zone field..." >&4
9903 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9904 eval $hasfield
9905 ;;
9906*) val="$undef"
9907 set d_tm_tm_zone
9908 eval $setvar
9909 ;;
9910esac
9911case "$d_tm_tm_zone" in
9912"$define") echo "Yes, it does." ;;
9913*) echo "No, it doesn't." ;;
9914esac
9915: see if struct tm knows about tm_gmtoff
9916case "$i_systime$i_time" in
9917*$define*)
9918 echo " "
9919 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9920 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9921 eval $hasfield
9922 ;;
9923*) val="$undef"
9924 set d_tm_tm_gmtoff
9925 eval $setvar
9926 ;;
9927esac
9928case "$d_tm_tm_gmtoff" in
9929"$define") echo "Yes, it does." ;;
9930*) echo "No, it doesn't." ;;
9931esac
9932
9933: see if asctime_r exists
9934set asctime_r d_asctime_r
9935eval $inlibc
9936case "$d_asctime_r" in
9937"$define")
d63eadf0 9938 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
9939 case "$d_asctime_r_proto:$usethreads" in
9940 ":define") d_asctime_r_proto=define
a48ec845
JH
9941 set d_asctime_r_proto asctime_r $hdrs
9942 eval $hasproto ;;
9943 *) ;;
9944 esac
9945 case "$d_asctime_r_proto" in
9946 define)
10bc17b6
JH
9947 case "$asctime_r_proto" in
9948 ''|0) try='char* asctime_r(const struct tm*, char*);'
9949 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9950 esac
9951 case "$asctime_r_proto" in
9952 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9953 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9954 esac
9955 case "$asctime_r_proto" in
9956 ''|0) try='int asctime_r(const struct tm*, char*);'
9957 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9958 esac
9959 case "$asctime_r_proto" in
9960 ''|0) try='int asctime_r(const struct tm*, char*, int);'
9961 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9962 esac
9963 case "$asctime_r_proto" in
90e831dc 9964 ''|0) d_asctime_r=undef
10bc17b6 9965 asctime_r_proto=0
a48ec845 9966 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
9967 * ) case "$asctime_r_proto" in
9968 REENTRANT_PROTO*) ;;
9969 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9970 esac
9971 echo "Prototype: $try" ;;
9972 esac
9973 ;;
c18e646a
JH
9974 *) case "$usethreads" in
9975 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9976 esac
90e831dc
SB
9977 d_asctime_r=undef
9978 asctime_r_proto=0
c18e646a 9979 ;;
a48ec845
JH
9980 esac
9981 ;;
10bc17b6
JH
9982*) asctime_r_proto=0
9983 ;;
9984esac
9985
b4eb6b3d
JH
9986: see if atolf exists
9987set atolf d_atolf
9988eval $inlibc
9989
9990: see if atoll exists
9991set atoll d_atoll
9992eval $inlibc
9993
0dbb1585
AL
9994: Look for GCC-style attribute format
9995case "$d_attribute_format" in
bde30f85 9996'')
b4eb6b3d 9997echo " "
0dbb1585 9998echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
b4eb6b3d
JH
9999$cat >attrib.c <<'EOCP'
10000#include <stdio.h>
0dbb1585 10001void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
b4eb6b3d
JH
10002EOCP
10003if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10004 if $contains 'warning' attrib.out >/dev/null 2>&1; then
0dbb1585 10005 echo "Your C compiler doesn't support __attribute__((format))."
b4eb6b3d
JH
10006 val="$undef"
10007 else
0dbb1585 10008 echo "Your C compiler supports __attribute__((format))."
b4eb6b3d
JH
10009 val="$define"
10010 fi
10011else
10012 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10013 val="$undef"
10014fi
bde30f85 10015;;
0dbb1585 10016*) val="$d_attribute_format" ;;
bde30f85 10017esac
0dbb1585
AL
10018set d_attribute_format
10019eval $setvar
10020$rm -f attrib*
10021
dcb594bc
MB
10022: Look for GCC-style attribute format with null format allowed
10023case "$d_printf_format_null" in
10024'') case "$d_attribute_format" in
10025 $define)
10026 echo " "
10027 echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10028$cat >attrib.c <<EOCP
10029#include <stdio.h>
10030#$i_stdlib I_STDLIB
10031#ifdef I_STDLIB
10032#include <stdlib.h>
10033#endif
10034int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10035int null_printf (char* pat,...) { return (int)pat; }
10036int main () { exit(null_printf(NULL)); }
10037EOCP
10038 if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10039 : run the executable in case it produces a run-time warning
10040 if $run ./attrib >>attrib.out 2>&1; then
10041 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10042 echo "Your C compiler doesn't allow __printf__ format to be null."
10043 val="$undef"
10044 else
10045 echo "Your C compiler allows __printf__ format to be null."
10046 val="$define"
10047 fi
10048 else
10049 echo "Your C compiler executable failed with __printf__ format null."
10050 val="$undef"
10051 fi
10052 else
10053 echo "Your C compiler fails with __printf__ format null."
10054 val="$undef"
10055 fi
10056 ;;
10057 *) val="$undef" ;;
10058 esac
10059;;
10060*) val="$d_printf_format_null" ;;
10061esac
10062set d_printf_format_null
10063eval $setvar
10064$rm -f attrib*
10065
0dbb1585
AL
10066: Look for GCC-style attribute malloc
10067case "$d_attribute_malloc" in
10068'')
10069echo " "
10070echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10071$cat >attrib.c <<'EOCP'
10072#include <stdio.h>
10073char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10074EOCP
10075if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10076 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10077 echo "Your C compiler doesn't support __attribute__((malloc))."
10078 val="$undef"
10079 else
10080 echo "Your C compiler supports __attribute__((malloc))."
10081 val="$define"
10082 fi
10083else
10084 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10085 val="$undef"
10086fi
10087;;
10088*) val="$d_attribute_malloc" ;;
10089esac
10090set d_attribute_malloc
10091eval $setvar
10092$rm -f attrib*
10093
10094: Look for GCC-style attribute nonnull
10095case "$d_attribute_nonnull" in
10096'')
10097echo " "
10098echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10099$cat >attrib.c <<'EOCP'
10100#include <stdio.h>
10101void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10102EOCP
10103if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10104 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10105 echo "Your C compiler doesn't support __attribute__((nonnull))."
10106 val="$undef"
10107 else
10108 echo "Your C compiler supports __attribute__((nonnull))."
10109 val="$define"
10110 fi
10111else
10112 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10113 val="$undef"
10114fi
10115;;
10116*) val="$d_attribute_nonnull" ;;
10117esac
10118set d_attribute_nonnull
10119eval $setvar
10120$rm -f attrib*
10121
10122: Look for GCC-style attribute noreturn
10123case "$d_attribute_noreturn" in
10124'')
10125echo " "
10126echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10127$cat >attrib.c <<'EOCP'
10128#include <stdio.h>
10129void fall_over_dead( void ) __attribute__((noreturn));
10130EOCP
10131if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10132 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10133 echo "Your C compiler doesn't support __attribute__((noreturn))."
10134 val="$undef"
10135 else
10136 echo "Your C compiler supports __attribute__((noreturn))."
10137 val="$define"
10138 fi
10139else
10140 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10141 val="$undef"
10142fi
10143;;
10144*) val="$d_attribute_noreturn" ;;
10145esac
10146set d_attribute_noreturn
10147eval $setvar
10148$rm -f attrib*
10149
10150: Look for GCC-style attribute pure
10151case "$d_attribute_pure" in
10152'')
10153echo " "
10154echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10155$cat >attrib.c <<'EOCP'
10156#include <stdio.h>
10157int square( int n ) __attribute__((pure));
10158EOCP
10159if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10160 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10161 echo "Your C compiler doesn't support __attribute__((pure))."
10162 val="$undef"
10163 else
10164 echo "Your C compiler supports __attribute__((pure))."
10165 val="$define"
10166 fi
10167else
10168 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10169 val="$undef"
10170fi
10171;;
10172*) val="$d_attribute_pure" ;;
10173esac
10174set d_attribute_pure
10175eval $setvar
10176$rm -f attrib*
10177
10178: Look for GCC-style attribute unused
10179case "$d_attribute_unused" in
10180'')
10181echo " "
10182echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10183$cat >attrib.c <<'EOCP'
10184#include <stdio.h>
10185int do_something( int dummy __attribute__((unused)), int n );
10186EOCP
10187if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10188 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10189 echo "Your C compiler doesn't support __attribute__((unused))."
10190 val="$undef"
10191 else
10192 echo "Your C compiler supports __attribute__((unused))."
10193 val="$define"
10194 fi
10195else
10196 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10197 val="$undef"
10198fi
10199;;
10200*) val="$d_attribute_unused" ;;
10201esac
10202set d_attribute_unused
10203eval $setvar
10204$rm -f attrib*
10205
10206: Look for GCC-style attribute warn_unused_result
10207case "$d_attribute_warn_unused_result" in
10208'')
10209echo " "
10210echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10211$cat >attrib.c <<'EOCP'
10212#include <stdio.h>
10213int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10214EOCP
10215if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10216 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10217 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10218 val="$undef"
10219 else
10220 echo "Your C compiler supports __attribute__((warn_unused_result))."
10221 val="$define"
10222 fi
10223else
10224 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10225 val="$undef"
10226fi
10227;;
10228*) val="$d_attribute_warn_unused_result" ;;
10229esac
10230set d_attribute_warn_unused_result
b4eb6b3d
JH
10231eval $setvar
10232$rm -f attrib*
10233
10234: see if bcmp exists
10235set bcmp d_bcmp
10236eval $inlibc
10237
10238: see if bcopy exists
10239set bcopy d_bcopy
10240eval $inlibc
10241
b4eb6b3d
JH
10242: see if getpgrp exists
10243set getpgrp d_getpgrp
10244eval $inlibc
10245
10246case "$d_getpgrp" in
10247"$define")
10248 echo " "
10249 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 10250 $cat >try.c <<EOP
b4eb6b3d
JH
10251#$i_unistd I_UNISTD
10252#include <sys/types.h>
10253#ifdef I_UNISTD
10254# include <unistd.h>
10255#endif
55954f19
JH
10256#$i_stdlib I_STDLIB
10257#ifdef I_STDLIB
10258#include <stdlib.h>
10259#endif
b4eb6b3d
JH
10260int main()
10261{
10262 if (getuid() == 0) {
10263 printf("(I see you are running Configure as super-user...)\n");
10264 setuid(1);
10265 }
10266#ifdef TRY_BSD_PGRP
10267 if (getpgrp(1) == 0)
10268 exit(0);
10269#else
10270 if (getpgrp() > 0)
10271 exit(0);
10272#endif
10273 exit(1);
10274}
10275EOP
5440bc8e 10276 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10277 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10278 val="$define"
5440bc8e 10279 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10280 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10281 val="$undef"
10282 else
10283 echo "I can't seem to compile and run the test program."
10284 if ./usg; then
10285 xxx="a USG one, i.e. you use getpgrp()."
10286 else
10287 # SVR4 systems can appear rather BSD-ish.
10288 case "$i_unistd" in
10289 $undef)
10290 xxx="a BSD one, i.e. you use getpgrp(pid)."
10291 val="$define"
10292 ;;
10293 $define)
10294 xxx="probably a USG one, i.e. you use getpgrp()."
10295 val="$undef"
10296 ;;
10297 esac
10298 fi
10299 echo "Assuming your getpgrp is $xxx" >&4
10300 fi
10301 ;;
10302*) val="$undef";;
10303esac
10304set d_bsdgetpgrp
10305eval $setvar
5440bc8e 10306$rm -f try try.*
b4eb6b3d
JH
10307
10308: see if setpgrp exists
10309set setpgrp d_setpgrp
10310eval $inlibc
10311
10312case "$d_setpgrp" in
10313"$define")
10314 echo " "
10315 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 10316 $cat >try.c <<EOP
b4eb6b3d
JH
10317#$i_unistd I_UNISTD
10318#include <sys/types.h>
10319#ifdef I_UNISTD
10320# include <unistd.h>
10321#endif
55954f19
JH
10322#$i_stdlib I_STDLIB
10323#ifdef I_STDLIB
10324#include <stdlib.h>
10325#endif
b4eb6b3d
JH
10326int main()
10327{
10328 if (getuid() == 0) {
10329 printf("(I see you are running Configure as super-user...)\n");
10330 setuid(1);
10331 }
10332#ifdef TRY_BSD_PGRP
10333 if (-1 == setpgrp(1, 1))
10334 exit(0);
10335#else
10336 if (setpgrp() != -1)
10337 exit(0);
10338#endif
10339 exit(1);
10340}
10341EOP
5440bc8e 10342 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10343 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10344 val="$define"
5440bc8e 10345 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10346 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10347 val="$undef"
10348 else
10349 echo "(I can't seem to compile and run the test program.)"
10350 if ./usg; then
10351 xxx="a USG one, i.e. you use setpgrp()."
10352 else
10353 # SVR4 systems can appear rather BSD-ish.
10354 case "$i_unistd" in
10355 $undef)
10356 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10357 val="$define"
10358 ;;
10359 $define)
10360 xxx="probably a USG one, i.e. you use setpgrp()."
10361 val="$undef"
10362 ;;
10363 esac
10364 fi
10365 echo "Assuming your setpgrp is $xxx" >&4
10366 fi
10367 ;;
10368*) val="$undef";;
10369esac
10370set d_bsdsetpgrp
10371eval $setvar
5440bc8e 10372$rm -f try try.*
635aebb7
AL
10373: Look for GCC-style __builtin_choose_expr
10374case "$d_builtin_choose_expr" in
10375'')
10376 echo " "
10377 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10378 $cat >try.c <<'EOCP'
10379#include <assert.h>
10380#include <stdlib.h>
10381#include <stdio.h>
10382
10383#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10384
10385int main(void) {
10386 assert( SYRINX(1) == 2112 );
10387 assert( SYRINX(1) != 5150 );
10388 assert( SYRINX(0) == 5150 );
10389 assert( SYRINX(0) != 2112 );
10390 puts( "All good!" );
10391 exit(0);
10392}
10393
10394EOCP
10395 set try
10396 if eval $compile; then
10397 echo "Your C compiler supports __builtin_choose_expr."
10398 val="$define"
10399 else
10400 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10401 val="$undef"
10402 fi
10403;;
10404*) val="$d_builtin_choose_expr" ;;
10405esac
10406
10407set d_builtin_choose_expr
10408eval $setvar
10409$rm -f try.* try core core.try.*
10410
10411: Look for GCC-style __builtin_expect
10412case "$d_builtin_expect" in
10413'')
10414 echo " "
10415 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10416 $cat >builtin.c <<'EOCP'
10417int main(void) {
10418 int n = 50;
10419 if ( __builtin_expect(n, 0) ) n = 1;
10420}
10421EOCP
10422 set try
10423 if eval $compile; then
10424 echo "Your C compiler supports __builtin_choose_expr."
10425 val="$define"
10426 else
10427 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10428 val="$undef"
10429 fi
10430 ;;
10431*) val="$d_builtin_expect" ;;
10432esac
10433
10434set d_builtin_expect
10435eval $setvar
10436$rm -f try.* try core core.try.*
10437
b4eb6b3d
JH
10438: see if bzero exists
10439set bzero d_bzero
10440eval $inlibc
10441
a2d23ec2
MB
10442: see if stdarg is available
10443echo " "
10444if $test `./findhdr stdarg.h`; then
10445 echo "<stdarg.h> found." >&4
10446 valstd="$define"
10447else
10448 echo "<stdarg.h> NOT found." >&4
10449 valstd="$undef"
10450fi
10451
10452: see if varags is available
10453echo " "
10454if $test `./findhdr varargs.h`; then
10455 echo "<varargs.h> found." >&4
10456else
10457 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10458fi
10459
10460: set up the varargs testing programs
10461$cat > varargs.c <<EOP
10462#ifdef I_STDARG
10463#include <stdarg.h>
10464#endif
10465#ifdef I_VARARGS
10466#include <varargs.h>
10467#endif
10468
10469#ifdef I_STDARG
10470int f(char *p, ...)
10471#else
10472int f(va_alist)
10473va_dcl
10474#endif
10475{
10476 va_list ap;
10477#ifndef I_STDARG
10478 char *p;
10479#endif
10480#ifdef I_STDARG
10481 va_start(ap,p);
10482#else
10483 va_start(ap);
10484 p = va_arg(ap, char *);
10485#endif
10486 va_end(ap);
4fb7dc7d 10487 return 0;
a2d23ec2
MB
10488}
10489EOP
10490$cat > varargs <<EOP
10491$startsh
10492if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10493 echo "true"
10494else
10495 echo "false"
10496fi
10497$rm -f varargs$_o
10498EOP
10499chmod +x varargs
10500
10501: now check which varargs header should be included
10502echo " "
10503i_varhdr=''
10504case "$valstd" in
10505"$define")
10506 if `./varargs I_STDARG`; then
10507 val='stdarg.h'
10508 elif `./varargs I_VARARGS`; then
10509 val='varargs.h'
10510 fi
10511 ;;
10512*)
10513 if `./varargs I_VARARGS`; then
10514 val='varargs.h'
10515 fi
10516 ;;
10517esac
10518case "$val" in
10519'')
10520echo "I could not find the definition for va_dcl... You have problems..." >&4
10521 val="$undef"; set i_stdarg; eval $setvar
10522 val="$undef"; set i_varargs; eval $setvar
10523 ;;
10524*)
10525 set i_varhdr
10526 eval $setvar
10527 case "$i_varhdr" in
10528 stdarg.h)
10529 val="$define"; set i_stdarg; eval $setvar
10530 val="$undef"; set i_varargs; eval $setvar
10531 ;;
10532 varargs.h)
10533 val="$undef"; set i_stdarg; eval $setvar
10534 val="$define"; set i_varargs; eval $setvar
10535 ;;
10536 esac
10537 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10538esac
10539$rm -f varargs*
10540
10541: see if the Compiler supports C99 variadic macros
10542case "$i_stdarg$i_stdlib" in
10543 "$define$define")
10544 echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10545 $cat >try.c <<EOCP
10546#include <stdio.h>
10547#include <stdarg.h>
10548
10549#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10550
10551int main() {
10552 char buf[20];
10553 foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10554 puts(buf);
10555 return 0;
10556}
10557EOCP
10558 set try
10559 if eval $compile && $run ./try 2>&1 >/dev/null; then
10560 case "`$run ./try`" in
10561 "123 456 789")
10562 echo "You have C99 variadic macros." >&4
10563 d_c99_variadic_macros="$define"
10564 ;;
10565 *)
10566 echo "You don't have functional C99 variadic macros." >&4
10567 d_c99_variadic_macros="$undef"
10568 ;;
10569 esac
10570 else
10571 echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10572 d_c99_variadic_macros="$undef"
10573 fi
10574 $rm -f try.* try core core.try.*
10575 ;;
10576 *)
10577 echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10578 d_c99_variadic_macros="$undef"
10579 ;;
10580esac
10581
b4eb6b3d
JH
10582: see if signal is declared as pointer to function returning int or void
10583echo " "
10584xxx=`./findhdr signal.h`
10585$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10586if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10587 echo "You have int (*signal())() instead of void." >&4
10588 val="$undef"
10589elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10590 echo "You have void (*signal())()." >&4
10591 val="$define"
10592elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10593 echo "You have int (*signal())() instead of void." >&4
10594 val="$undef"
10595elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10596 echo "You have void (*signal())()." >&4
10597 val="$define"
10598else
10599 case "$d_voidsig" in
10600 '')
10601 echo "I can't determine whether signal handler returns void or int..." >&4
10602 dflt=void
10603 rp="What type does your signal handler return?"
10604 . ./myread
10605 case "$ans" in
10606 v*) val="$define";;
10607 *) val="$undef";;
10608 esac;;
10609 "$define")
10610 echo "As you already told me, signal handler returns void." >&4
10611 val="$define"
10612 ;;
10613 *) echo "As you already told me, signal handler returns int." >&4
10614 val="$undef"
10615 ;;
10616 esac
10617fi
10618set d_voidsig
10619eval $setvar
10620case "$d_voidsig" in
10621"$define") signal_t="void";;
10622*) signal_t="int";;
10623esac
10624$rm -f $$.tmp
10625
10626: check for ability to cast large floats to 32-bit ints.
10627echo " "
10628echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10629if $test "$intsize" -ge 4; then
10630 xxx=int
10631else
10632 xxx=long
10633fi
10634$cat >try.c <<EOCP
10635#include <stdio.h>
d1daaddf
JH
10636#$i_stdlib I_STDLIB
10637#ifdef I_STDLIB
10638#include <stdlib.h>
10639#endif
b4eb6b3d
JH
10640#include <sys/types.h>
10641#include <signal.h>
7090f861 10642$signal_t blech(int s) { exit(3); }
b4eb6b3d
JH
10643int main()
10644{
10645 $xxx i32;
10646 double f, g;
10647 int result = 0;
10648 char str[16];
10649 signal(SIGFPE, blech);
10650
10651 /* Don't let compiler optimize the test away. Store the number
10652 in a writable string for gcc to pass to sscanf under HP/UX.
10653 */
10654 sprintf(str, "2147483647");
10655 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10656 g = 10 * f;
10657 i32 = ($xxx) g;
10658
10659 /* x86 processors will probably give 0x8000 0000, which is a
4a39fcde 10660 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
10661 behavior here, which is to preserve the sign and give
10662 back 0x7fff ffff.
10663 */
10664 if (i32 != ($xxx) f)
10665 result |= 1;
10666 exit(result);
10667}
10668EOCP
10669set try
10670if eval $compile_ok; then
5440bc8e 10671 $run ./try
b4eb6b3d
JH
10672 yyy=$?
10673else
10674 echo "(I can't seem to compile the test program--assuming it can't)"
10675 yyy=1
10676fi
10677case "$yyy" in
106780) val="$define"
10679 echo "Yup, it can."
10680 ;;
10681*) val="$undef"
10682 echo "Nope, it can't."
10683 ;;
10684esac
10685set d_casti32
10686eval $setvar
10687$rm -f try try.*
10688
10689: check for ability to cast negative floats to unsigned
10690echo " "
10691echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10692$cat >try.c <<EOCP
10693#include <stdio.h>
d1daaddf
JH
10694#$i_stdlib I_STDLIB
10695#ifdef I_STDLIB
10696#include <stdlib.h>
10697#endif
b4eb6b3d
JH
10698#include <sys/types.h>
10699#include <signal.h>
7090f861
JH
10700$signal_t blech(int s) { exit(7); }
10701$signal_t blech_in_list(int s) { exit(4); }
10702unsigned long dummy_long(unsigned long p) { return p; }
10703unsigned int dummy_int(unsigned int p) { return p; }
10704unsigned short dummy_short(unsigned short p) { return p; }
b4eb6b3d
JH
10705int main()
10706{
10707 double f;
10708 unsigned long along;
10709 unsigned int aint;
10710 unsigned short ashort;
10711 int result = 0;
10712 char str[16];
10713
10714 /* Frustrate gcc-2.7.2's optimizer which failed this test with
10715 a direct f = -123. assignment. gcc-2.8.0 reportedly
10716 optimized the whole file away
10717 */
10718 /* Store the number in a writable string for gcc to pass to
10719 sscanf under HP/UX.
10720 */
10721 sprintf(str, "-123");
10722 sscanf(str, "%lf", &f); /* f = -123.; */
10723
10724 signal(SIGFPE, blech);
10725 along = (unsigned long)f;
10726 aint = (unsigned int)f;
10727 ashort = (unsigned short)f;
10728 if (along != (unsigned long)-123)
10729 result |= 1;
10730 if (aint != (unsigned int)-123)
10731 result |= 1;
10732 if (ashort != (unsigned short)-123)
10733 result |= 1;
10734 sprintf(str, "1073741824.");
10735 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10736 f = f + f;
10737 along = 0;
10738 along = (unsigned long)f;
10739 if (along != 0x80000000)
10740 result |= 2;
10741 f -= 1.;
10742 along = 0;
10743 along = (unsigned long)f;
10744 if (along != 0x7fffffff)
10745 result |= 1;
10746 f += 2.;
10747 along = 0;
10748 along = (unsigned long)f;
10749 if (along != 0x80000001)
10750 result |= 2;
10751 if (result)
10752 exit(result);
10753 signal(SIGFPE, blech_in_list);
10754 sprintf(str, "123.");
10755 sscanf(str, "%lf", &f); /* f = 123.; */
10756 along = dummy_long((unsigned long)f);
10757 aint = dummy_int((unsigned int)f);
10758 ashort = dummy_short((unsigned short)f);
10759 if (along != (unsigned long)123)
10760 result |= 4;
10761 if (aint != (unsigned int)123)
10762 result |= 4;
10763 if (ashort != (unsigned short)123)
10764 result |= 4;
10765 exit(result);
10766
10767}
10768EOCP
10769set try
10770if eval $compile_ok; then
5440bc8e 10771 $run ./try
b4eb6b3d
JH
10772 castflags=$?
10773else
10774 echo "(I can't seem to compile the test program--assuming it can't)"
10775 castflags=7
10776fi
10777case "$castflags" in
107780) val="$define"
10779 echo "Yup, it can."
10780 ;;
10781*) val="$undef"
10782 echo "Nope, it can't."
10783 ;;
10784esac
10785set d_castneg
10786eval $setvar
10787$rm -f try.*
10788
10789: see if vprintf exists
10790echo " "
10791if set vprintf val -f d_vprintf; eval $csym; $val; then
10792 echo 'vprintf() found.' >&4
10793 val="$define"
55954f19 10794 $cat >try.c <<EOF
b4eb6b3d 10795#include <varargs.h>
55954f19
JH
10796#$i_stdlib I_STDLIB
10797#ifdef I_STDLIB
10798#include <stdlib.h>
10799#endif
b4eb6b3d
JH
10800
10801int main() { xxx("foo"); }
10802
10803xxx(va_alist)
10804va_dcl
10805{
10806 va_list args;
10807 char buf[10];
10808
10809 va_start(args);
10810 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10811}
10812EOF
5440bc8e
JH
10813 set try
10814 if eval $compile && $run ./try; then
b4eb6b3d
JH
10815 echo "Your vsprintf() returns (int)." >&4
10816 val2="$undef"
10817 else
10818 echo "Your vsprintf() returns (char*)." >&4
10819 val2="$define"
10820 fi
10821else
10822 echo 'vprintf() NOT found.' >&4
10823 val="$undef"
10824 val2="$undef"
10825fi
5440bc8e 10826$rm -f try try.*
b4eb6b3d
JH
10827set d_vprintf
10828eval $setvar
10829val=$val2
10830set d_charvspr
10831eval $setvar
10832
10833: see if chown exists
10834set chown d_chown
10835eval $inlibc
10836
10837: see if chroot exists
10838set chroot d_chroot
10839eval $inlibc
10840
10841: see if chsize exists
10842set chsize d_chsize
10843eval $inlibc
10844
758a5d79
JH
10845: see if class exists
10846set class d_class
10847eval $inlibc
10848
b0a2e8e6
MB
10849: see if clearenv exists
10850set clearenv d_clearenv
10851eval $inlibc
10852
4e0554ec
JH
10853hasstruct='varname=$1; struct=$2; shift; shift;
10854while $test $# -ge 2; do
10855 case "$1" in
10856 $define) echo "#include <$2>";;
10857 esac ;
10858 shift 2;
10859done > try.c;
10860echo "int main () { struct $struct foo; }" >> try.c;
10861set try;
10862if eval $compile; then
10863 val="$define";
10864else
10865 val="$undef";
10866fi;
10867set $varname;
10868eval $setvar;
10869$rm -f try.c try.o'
10870
4e0554ec
JH
10871socketlib=''
10872sockethdr=''
10873: see whether socket exists
10874echo " "
10875$echo $n "Hmm... $c" >&4
10876if set socket val -f d_socket; eval $csym; $val; then
10877 echo "Looks like you have Berkeley networking support." >&4
10878 d_socket="$define"
10879 if set setsockopt val -f; eval $csym; $val; then
10880 d_oldsock="$undef"
10881 else
10882 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10883 d_oldsock="$define"
10884 fi
10885else
10886 if $contains socklib libc.list >/dev/null 2>&1; then
10887 echo "Looks like you have Berkeley networking support." >&4
10888 d_socket="$define"
10889 : we will have to assume that it supports the 4.2 BSD interface
10890 d_oldsock="$undef"
10891 else
10892 echo "You don't have Berkeley networking in libc$_a..." >&4
10893 if test "X$d_socket" = "X$define"; then
10894 echo "...but you seem to believe that you have sockets." >&4
10895 else
10896 for net in net socket
10897 do
10898 if test -f /usr/lib/lib$net$_a; then
10899 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
10900 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10901 if $contains socket libc.list >/dev/null 2>&1; then
10902 d_socket="$define"
10903 socketlib="-l$net"
10904 case "$net" in
10905 net)
10906 echo "...but the Wollongong group seems to have hacked it in." >&4
10907 sockethdr="-I/usr/netinclude"
10908 ;;
10909 esac
3c728e00 10910 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
10911 if $contains setsockopt libc.list >/dev/null 2>&1; then
10912 d_oldsock="$undef"
10913 else
10914 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10915 d_oldsock="$define"
10916 fi
10917 break
10918 fi
10919 fi
10920 done
10921 if test "X$d_socket" != "X$define"; then
10922 echo "or anywhere else I see." >&4
10923 d_socket="$undef"
10924 d_oldsock="$undef"
10925 fi
10926 fi
10927 fi
10928fi
10929
10930: see if socketpair exists
10931set socketpair d_sockpair
10932eval $inlibc
10933
10934
10935echo " "
3c728e00 10936echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
10937for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10938 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10939 $cat >try.c <<EOF
10940#include <sys/types.h>
10941#include <sys/socket.h>
10942int main() {
10943 int i = $ENUM;
10944}
10945EOF
10946 val="$undef"
10947 set try; if eval $compile; then
10948 val="$define"
10949 fi
10950 set d_${enum}; eval $setvar
10951 $rm -f try.c try
10952done
10953
10954: see if this is a sys/uio.h system
10955set sys/uio.h i_sysuio
10956eval $inhdr
10957
10958
10959echo " "
10960echo "Checking to see if your system supports struct cmsghdr..." >&4
10961set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10962eval $hasstruct
10963case "$d_cmsghdr_s" in
10964"$define") echo "Yes, it does." ;;
10965*) echo "No, it doesn't." ;;
10966esac
10967
10968
b4eb6b3d
JH
10969: check for const keyword
10970echo " "
10971echo 'Checking to see if your C compiler knows about "const"...' >&4
10972$cat >const.c <<'EOCP'
10973typedef struct spug { int drokk; } spug;
76f47787 10974int main()
b4eb6b3d
JH
10975{
10976 const char *foo;
666ea192 10977 const spug y = { 0 };
b4eb6b3d
JH
10978}
10979EOCP
10980if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10981 val="$define"
10982 echo "Yup, it does."
10983else
10984 val="$undef"
10985 echo "Nope, it doesn't."
10986fi
10987set d_const
10988eval $setvar
10989
89ce900e
JH
10990: see if copysignl exists
10991set copysignl d_copysignl
10992eval $inlibc
10993
b4eb6b3d
JH
10994: see if crypt exists
10995echo " "
a5a94ea5
JH
10996set crypt d_crypt
10997eval $inlibc
10998case "$d_crypt" in
10999$define) cryptlib='' ;;
11000*) if set crypt val -f d_crypt; eval $csym; $val; then
11001 echo 'crypt() found.' >&4
b4eb6b3d 11002 val="$define"
a5a94ea5
JH
11003 cryptlib=''
11004 else
11005 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11006 if $test -z "$cryptlib"; then
11007 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11008 else
11009 cryptlib=-lcrypt
11010 fi
11011 if $test -z "$cryptlib"; then
11012 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11013 else
11014 cryptlib=-lcrypt
11015 fi
11016 if $test -z "$cryptlib"; then
11017 cryptlib=`./loc libcrypt$_a "" $libpth`
11018 else
11019 cryptlib=-lcrypt
11020 fi
11021 if $test -z "$cryptlib"; then
11022 echo 'crypt() NOT found.' >&4
11023 val="$undef"
11024 else
11025 val="$define"
11026 fi
b4eb6b3d 11027 fi
a5a94ea5
JH
11028 set d_crypt
11029 eval $setvar
11030 ;;
11031esac
b4eb6b3d 11032
10bc17b6
JH
11033: see if this is a crypt.h system
11034set crypt.h i_crypt
11035eval $inhdr
11036
11037: see if crypt_r exists
11038set crypt_r d_crypt_r
11039eval $inlibc
11040case "$d_crypt_r" in
11041"$define")
11042 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
11043 case "$d_crypt_r_proto:$usethreads" in
11044 ":define") d_crypt_r_proto=define
a48ec845
JH
11045 set d_crypt_r_proto crypt_r $hdrs
11046 eval $hasproto ;;
11047 *) ;;
11048 esac
11049 case "$d_crypt_r_proto" in
11050 define)
10bc17b6
JH
11051 case "$crypt_r_proto" in
11052 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11053 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11054 esac
11055 case "$crypt_r_proto" in
b430fd04
JH
11056 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11057 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11058 esac
11059 case "$crypt_r_proto" in
90e831dc 11060 ''|0) d_crypt_r=undef
10bc17b6 11061 crypt_r_proto=0
a48ec845 11062 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11063 * ) case "$crypt_r_proto" in
11064 REENTRANT_PROTO*) ;;
11065 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11066 esac
11067 echo "Prototype: $try" ;;
11068 esac
11069 ;;
c18e646a
JH
11070 *) case "$usethreads" in
11071 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11072 esac
90e831dc
SB
11073 d_crypt_r=undef
11074 crypt_r_proto=0
c18e646a 11075 ;;
a48ec845
JH
11076 esac
11077 ;;
10bc17b6
JH
11078*) crypt_r_proto=0
11079 ;;
11080esac
11081
b4eb6b3d
JH
11082: get csh whereabouts
11083case "$csh" in
11084'csh') val="$undef" ;;
11085*) val="$define" ;;
11086esac
11087set d_csh
11088eval $setvar
11089: Respect a hint or command line value for full_csh.
11090case "$full_csh" in
11091'') full_csh=$csh ;;
11092esac
11093
13cfc98d
MB
11094: see if ctermid exists
11095set ctermid d_ctermid
11096eval $inlibc
11097
10bc17b6
JH
11098: see if ctermid_r exists
11099set ctermid_r d_ctermid_r
11100eval $inlibc
11101case "$d_ctermid_r" in
11102"$define")
31ee0cb7 11103 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
11104 case "$d_ctermid_r_proto:$usethreads" in
11105 ":define") d_ctermid_r_proto=define
a48ec845
JH
11106 set d_ctermid_r_proto ctermid_r $hdrs
11107 eval $hasproto ;;
11108 *) ;;
11109 esac
11110 case "$d_ctermid_r_proto" in
11111 define)
10bc17b6
JH
11112 case "$ctermid_r_proto" in
11113 ''|0) try='char* ctermid_r(char*);'
11114 ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11115 esac
11116 case "$ctermid_r_proto" in
90e831dc 11117 ''|0) d_ctermid_r=undef
10bc17b6 11118 ctermid_r_proto=0
a48ec845 11119 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11120 * ) case "$ctermid_r_proto" in
11121 REENTRANT_PROTO*) ;;
11122 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11123 esac
11124 echo "Prototype: $try" ;;
11125 esac
11126 ;;
c18e646a
JH
11127 *) case "$usethreads" in
11128 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11129 esac
90e831dc
SB
11130 d_ctermid_r=undef
11131 ctermid_r_proto=0
c18e646a 11132 ;;
a48ec845
JH
11133 esac
11134 ;;
10bc17b6
JH
11135*) ctermid_r_proto=0
11136 ;;
11137esac
11138
11139: see if ctime_r exists
11140set ctime_r d_ctime_r
11141eval $inlibc
11142case "$d_ctime_r" in
11143"$define")
d63eadf0 11144 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
11145 case "$d_ctime_r_proto:$usethreads" in
11146 ":define") d_ctime_r_proto=define
a48ec845
JH
11147 set d_ctime_r_proto ctime_r $hdrs
11148 eval $hasproto ;;
11149 *) ;;
11150 esac
11151 case "$d_ctime_r_proto" in
11152 define)
10bc17b6
JH
11153 case "$ctime_r_proto" in
11154 ''|0) try='char* ctime_r(const time_t*, char*);'
11155 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11156 esac
11157 case "$ctime_r_proto" in
11158 ''|0) try='char* ctime_r(const time_t*, char*, int);'
11159 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11160 esac
11161 case "$ctime_r_proto" in
11162 ''|0) try='int ctime_r(const time_t*, char*);'
11163 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11164 esac
11165 case "$ctime_r_proto" in
11166 ''|0) try='int ctime_r(const time_t*, char*, int);'
11167 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11168 esac
11169 case "$ctime_r_proto" in
90e831dc 11170 ''|0) d_ctime_r=undef
10bc17b6 11171 ctime_r_proto=0
a48ec845 11172 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11173 * ) case "$ctime_r_proto" in
11174 REENTRANT_PROTO*) ;;
11175 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11176 esac
11177 echo "Prototype: $try" ;;
11178 esac
11179 ;;
c18e646a
JH
11180 *) case "$usethreads" in
11181 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11182 esac
90e831dc
SB
11183 d_ctime_r=undef
11184 ctime_r_proto=0
c18e646a 11185 ;;
a48ec845
JH
11186 esac
11187 ;;
10bc17b6
JH
11188*) ctime_r_proto=0
11189 ;;
11190esac
11191
b4eb6b3d
JH
11192: see if cuserid exists
11193set cuserid d_cuserid
11194eval $inlibc
11195
11196: see if this is a limits.h system
11197set limits.h i_limits
11198eval $inhdr
11199
11200: see if this is a float.h system
11201set float.h i_float
11202eval $inhdr
11203
11204: See if number of significant digits in a double precision number is known
11205echo " "
11206$cat >dbl_dig.c <<EOM
11207#$i_limits I_LIMITS
11208#$i_float I_FLOAT
11209#ifdef I_LIMITS
11210#include <limits.h>
11211#endif
11212#ifdef I_FLOAT
11213#include <float.h>
11214#endif
11215#ifdef DBL_DIG
11216printf("Contains DBL_DIG");
11217#endif
11218EOM
11219$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11220if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11221 echo "DBL_DIG found." >&4
11222 val="$define"
11223else
11224 echo "DBL_DIG NOT found." >&4
11225 val="$undef"
11226fi
11227$rm -f dbl_dig.?
11228set d_dbl_dig
11229eval $setvar
11230
2ef53570
JH
11231: see if dbm.h is available
11232: see if dbmclose exists
11233set dbmclose d_dbmclose
11234eval $inlibc
11235
11236case "$d_dbmclose" in
11237$define)
11238 set dbm.h i_dbm
11239 eval $inhdr
11240 case "$i_dbm" in
11241 $define)
11242 val="$undef"
11243 set i_rpcsvcdbm
11244 eval $setvar
11245 ;;
11246 *) set rpcsvc/dbm.h i_rpcsvcdbm
11247 eval $inhdr
11248 ;;
11249 esac
11250 ;;
11251*) echo "We won't be including <dbm.h>"
11252 val="$undef"
11253 set i_dbm
11254 eval $setvar
11255 val="$undef"
11256 set i_rpcsvcdbm
11257 eval $setvar
11258 ;;
11259esac
11260
11261: see if prototype for dbminit is available
11262echo " "
11263set d_dbminitproto dbminit $i_dbm dbm.h
11264eval $hasproto
11265
b4eb6b3d
JH
11266: see if difftime exists
11267set difftime d_difftime
11268eval $inlibc
11269
11270: see if this is a dirent system
11271echo " "
11272if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11273 val="$define"
11274 echo "<dirent.h> found." >&4
11275else
11276 val="$undef"
11277 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11278 echo "<sys/dir.h> found." >&4
11279 echo " "
11280 else
11281 xinc=`./findhdr sys/ndir.h`
11282 fi
11283 echo "<dirent.h> NOT found." >&4
11284fi
11285set i_dirent
11286eval $setvar
11287
11288: Look for type of directory structure.
11289echo " "
11290$cppstdin $cppflags $cppminus < "$xinc" > try.c
11291
11292case "$direntrytype" in
11293''|' ')
11294 case "$i_dirent" in
11295 $define) guess1='struct dirent' ;;
11296 *) guess1='struct direct' ;;
11297 esac
11298 ;;
11299*) guess1="$direntrytype"
11300 ;;
11301esac
11302
11303case "$guess1" in
11304'struct dirent') guess2='struct direct' ;;
11305*) guess2='struct dirent' ;;
11306esac
11307
11308if $contains "$guess1" try.c >/dev/null 2>&1; then
11309 direntrytype="$guess1"
11310 echo "Your directory entries are $direntrytype." >&4
11311elif $contains "$guess2" try.c >/dev/null 2>&1; then
11312 direntrytype="$guess2"
11313 echo "Your directory entries seem to be $direntrytype." >&4
11314else
11315 echo "I don't recognize your system's directory entries." >&4
11316 rp="What type is used for directory entries on this system?"
11317 dflt="$guess1"
11318 . ./myread
11319 direntrytype="$ans"
11320fi
11321$rm -f try.c
11322
11323
11324: see if the directory entry stores field length
11325echo " "
11326$cppstdin $cppflags $cppminus < "$xinc" > try.c
11327if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11328 echo "Good, your directory entry keeps length information in d_namlen." >&4
11329 val="$define"
11330else
11331 echo "Your directory entry does not know about the d_namlen field." >&4
11332 val="$undef"
11333fi
11334set d_dirnamlen
11335eval $setvar
11336$rm -f try.c
11337
de52168c
SP
11338: Look for DIR.dd_fd
11339case "$i_dirent" in
11340"$define")
11341 echo "Checking to see if DIR has a dd_fd member variable" >&4
11342 $cat >try.c <<EOCP
11343#$i_stdlib I_STDLIB
11344#ifdef I_STDLIB
11345#include <stdlib.h>
11346#endif
11347#include <dirent.h>
11348
11349int main() {
11350 DIR dir;
11351 dir.dd_fd = 1;
11352 return 0;
11353}
11354EOCP
11355 val=$undef
11356 set try
11357 if eval $compile; then
11358 echo "Yes, it does."
11359 val="$define"
11360 else
11361 echo "No, it does not."
11362 val="$undef"
11363 fi
11364 ;;
11365*)
11366 echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11367 val="$undef"
11368 ;;
11369esac
11370set d_dir_dd_fd
11371eval $setvar
11372$rm -f try try.*
11373
ae0e3d3b
JH
11374: see if this is an sysdir system
11375set sys/dir.h i_sysdir
11376eval $inhdr
11377
11378: see if this is an sysndir system
11379set sys/ndir.h i_sysndir
11380eval $inhdr
11381
11382: Look for dirfd
11383echo " "
11384$cat >dirfd.c <<EOM
11385#include <stdio.h>
55954f19
JH
11386#$i_stdlib I_STDLIB
11387#ifdef I_STDLIB
11388#include <stdlib.h>
11389#endif
ae0e3d3b
JH
11390#$i_dirent I_DIRENT /**/
11391#$i_sysdir I_SYS_DIR /**/
11392#$i_sysndir I_SYS_NDIR /**/
11393#$i_systypes I_SYS_TYPES /**/
11394#if defined(I_SYS_TYPES)
11395#include <sys/types.h>
11396#endif
11397#if defined(I_DIRENT)
11398#include <dirent.h>
11399#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11400#include <sys/dir.h>
11401#endif
11402#else
11403#ifdef I_SYS_NDIR
11404#include <sys/ndir.h>
11405#else
11406#ifdef I_SYS_DIR
11407#ifdef hp9000s500
11408#include <ndir.h> /* may be wrong in the future */
11409#else
11410#include <sys/dir.h>
11411#endif
11412#endif
11413#endif
11414#endif
11415int main() {
11416 DIR *dirp = opendir(".");
11417 if (dirfd(dirp) >= 0)
11418 exit(0);
11419 else
11420 exit(1);
11421}
11422EOM
5cadb3f3 11423val=$undef
ae0e3d3b
JH
11424set dirfd
11425if eval $compile; then
11426 val="$define"
11427fi
11428case "$val" in
11429$define) echo "dirfd() found." >&4 ;;
11430*) echo "dirfd() NOT found." >&4 ;;
11431esac
11432set d_dirfd
11433eval $setvar
11434$rm -f dirfd*
11435
b4eb6b3d
JH
11436: see if dlerror exists
11437xxx_runnm="$runnm"
11438runnm=false
11439set dlerror d_dlerror
11440eval $inlibc
11441runnm="$xxx_runnm"
11442
11443: see if dlfcn is available
11444set dlfcn.h i_dlfcn
11445eval $inhdr
11446
11447case "$usedl" in
11448$define|y|true)
11449 $cat << EOM
11450
11451On a few systems, the dynamically loaded modules that perl generates and uses
11452will need a different extension than shared libs. The default will probably
11453be appropriate.
11454
11455EOM
11456 case "$dlext" in
11457 '') dflt="$so" ;;
11458 *) dflt="$dlext" ;;
11459 esac
11460 rp='What is the extension of dynamically loaded modules'
11461 . ./myread
11462 dlext="$ans"
11463 ;;
11464*)
11465 dlext="none"
11466 ;;
11467esac
11468
11469: Check if dlsym need a leading underscore
11470echo " "
11471val="$undef"
11472
11473case "$dlsrc" in
11474dl_dlopen.xs)
11475 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11476 $cat >dyna.c <<'EOM'
11477fred () { }
11478EOM
11479
11480$cat >fred.c<<EOM
11481
11482#include <stdio.h>
55954f19
JH
11483#$i_stdlib I_STDLIB
11484#ifdef I_STDLIB
11485#include <stdlib.h>
11486#endif
b4eb6b3d
JH
11487#$i_dlfcn I_DLFCN
11488#ifdef I_DLFCN
5440bc8e 11489#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
11490#else
11491#include <sys/types.h>
11492#include <nlist.h>
11493#include <link.h>
11494#endif
11495
11496extern int fred() ;
11497
11498int main()
11499{
11500 void * handle ;
11501 void * symbol ;
11502#ifndef RTLD_LAZY
11503 int mode = 1 ;
11504#else
11505 int mode = RTLD_LAZY ;
11506#endif
11507 handle = dlopen("./dyna.$dlext", mode) ;
11508 if (handle == NULL) {
11509 printf ("1\n") ;
11510 fflush (stdout) ;
11511 exit(0);
11512 }
11513 symbol = dlsym(handle, "fred") ;
11514 if (symbol == NULL) {
11515 /* try putting a leading underscore */
11516 symbol = dlsym(handle, "_fred") ;
11517 if (symbol == NULL) {
11518 printf ("2\n") ;
11519 fflush (stdout) ;
11520 exit(0);
11521 }
11522 printf ("3\n") ;
11523 }
11524 else
11525 printf ("4\n") ;
11526 fflush (stdout) ;
11527 exit(0);
11528}
11529EOM
11530 : Call the object file tmp-dyna.o in case dlext=o.
11531 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11532 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 11533 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
11534 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11535 xxx=`$run ./fred`
b4eb6b3d
JH
11536 case $xxx in
11537 1) echo "Test program failed using dlopen." >&4
11538 echo "Perhaps you should not use dynamic loading." >&4;;
11539 2) echo "Test program failed using dlsym." >&4
11540 echo "Perhaps you should not use dynamic loading." >&4;;
11541 3) echo "dlsym needs a leading underscore" >&4
11542 val="$define" ;;
11543 4) echo "dlsym doesn't need a leading underscore." >&4;;
11544 esac
11545 else
11546 echo "I can't compile and run the test program." >&4
11547 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11548 fi
11549 ;;
11550esac
11551
3c728e00 11552$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
11553
11554set d_dlsymun
11555eval $setvar
11556
10bc17b6
JH
11557: see if drand48_r exists
11558set drand48_r d_drand48_r
11559eval $inlibc
11560case "$d_drand48_r" in
11561"$define")
11562 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
11563 case "$d_drand48_r_proto:$usethreads" in
11564 ":define") d_drand48_r_proto=define
a48ec845
JH
11565 set d_drand48_r_proto drand48_r $hdrs
11566 eval $hasproto ;;
11567 *) ;;
11568 esac
11569 case "$d_drand48_r_proto" in
11570 define)
10bc17b6
JH
11571 case "$drand48_r_proto" in
11572 ''|0) try='int drand48_r(struct drand48_data*, double*);'
11573 ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11574 esac
11575 case "$drand48_r_proto" in
90e831dc 11576 ''|0) d_drand48_r=undef
10bc17b6 11577 drand48_r_proto=0
a48ec845 11578 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11579 * ) case "$drand48_r_proto" in
11580 REENTRANT_PROTO*) ;;
11581 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11582 esac
11583 echo "Prototype: $try" ;;
11584 esac
11585 ;;
c18e646a
JH
11586 *) case "$usethreads" in
11587 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11588 esac
90e831dc
SB
11589 d_drand48_r=undef
11590 drand48_r_proto=0
c18e646a 11591 ;;
a48ec845
JH
11592 esac
11593 ;;
10bc17b6
JH
11594*) drand48_r_proto=0
11595 ;;
11596esac
11597
11598: see if prototype for drand48 is available
11599echo " "
11600set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11601eval $hasproto
11602
b4eb6b3d
JH
11603: see if dup2 exists
11604set dup2 d_dup2
11605eval $inlibc
11606
11607: see if eaccess exists
11608set eaccess d_eaccess
11609eval $inlibc
11610
11611: see if endgrent exists
11612set endgrent d_endgrent
11613eval $inlibc
11614
10bc17b6
JH
11615: see if this is an grp system
11616set grp.h i_grp
11617eval $inhdr
11618
11619case "$i_grp" in
11620$define)
11621 xxx=`./findhdr grp.h`
11622 $cppstdin $cppflags $cppminus < $xxx >$$.h
11623
11624 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11625 val="$define"
11626 else
11627 val="$undef"
11628 fi
11629 set d_grpasswd
11630 eval $setvar
11631
11632 $rm -f $$.h
11633 ;;
11634*)
11635 val="$undef";
11636 set d_grpasswd; eval $setvar
11637 ;;
11638esac
11639
11640: see if endgrent_r exists
11641set endgrent_r d_endgrent_r
11642eval $inlibc
11643case "$d_endgrent_r" in
11644"$define")
11645 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11646 case "$d_endgrent_r_proto:$usethreads" in
11647 ":define") d_endgrent_r_proto=define
a48ec845
JH
11648 set d_endgrent_r_proto endgrent_r $hdrs
11649 eval $hasproto ;;
11650 *) ;;
11651 esac
11652 case "$d_endgrent_r_proto" in
11653 define)
10bc17b6
JH
11654 case "$endgrent_r_proto" in
11655 ''|0) try='int endgrent_r(FILE**);'
11656 ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11657 esac
11658 case "$endgrent_r_proto" in
11659 ''|0) try='void endgrent_r(FILE**);'
11660 ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11661 esac
11662 case "$endgrent_r_proto" in
90e831dc 11663 ''|0) d_endgrent_r=undef
10bc17b6 11664 endgrent_r_proto=0
a48ec845 11665 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11666 * ) case "$endgrent_r_proto" in
11667 REENTRANT_PROTO*) ;;
11668 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11669 esac
11670 echo "Prototype: $try" ;;
11671 esac
11672 ;;
c18e646a
JH
11673 *) case "$usethreads" in
11674 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11675 esac
90e831dc
SB
11676 d_endgrent_r=undef
11677 endgrent_r_proto=0
c18e646a 11678 ;;
a48ec845
JH
11679 esac
11680 ;;
10bc17b6
JH
11681*) endgrent_r_proto=0
11682 ;;
11683esac
11684
b4eb6b3d
JH
11685: see if endhostent exists
11686set endhostent d_endhent
11687eval $inlibc
11688
10bc17b6
JH
11689: see if this is a netdb.h system
11690set netdb.h i_netdb
11691eval $inhdr
11692
11693: see if endhostent_r exists
11694set endhostent_r d_endhostent_r
11695eval $inlibc
11696case "$d_endhostent_r" in
11697"$define")
11698 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11699 case "$d_endhostent_r_proto:$usethreads" in
11700 ":define") d_endhostent_r_proto=define
a48ec845
JH
11701 set d_endhostent_r_proto endhostent_r $hdrs
11702 eval $hasproto ;;
11703 *) ;;
11704 esac
11705 case "$d_endhostent_r_proto" in
11706 define)
10bc17b6
JH
11707 case "$endhostent_r_proto" in
11708 ''|0) try='int endhostent_r(struct hostent_data*);'
31ee0cb7 11709 ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
11710 esac
11711 case "$endhostent_r_proto" in
11712 ''|0) try='void endhostent_r(struct hostent_data*);'
31ee0cb7 11713 ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
11714 esac
11715 case "$endhostent_r_proto" in
90e831dc 11716 ''|0) d_endhostent_r=undef
10bc17b6 11717 endhostent_r_proto=0
a48ec845 11718 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11719 * ) case "$endhostent_r_proto" in
11720 REENTRANT_PROTO*) ;;
11721 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11722 esac
11723 echo "Prototype: $try" ;;
11724 esac
11725 ;;
c18e646a
JH
11726 *) case "$usethreads" in
11727 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11728 esac
90e831dc
SB
11729 d_endhostent_r=undef
11730 endhostent_r_proto=0
c18e646a 11731 ;;
a48ec845
JH
11732 esac
11733 ;;
10bc17b6
JH
11734*) endhostent_r_proto=0
11735 ;;
11736esac
11737
b4eb6b3d
JH
11738: see if endnetent exists
11739set endnetent d_endnent
11740eval $inlibc
11741
10bc17b6
JH
11742: see if endnetent_r exists
11743set endnetent_r d_endnetent_r
11744eval $inlibc
11745case "$d_endnetent_r" in
11746"$define")
11747 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11748 case "$d_endnetent_r_proto:$usethreads" in
11749 ":define") d_endnetent_r_proto=define
a48ec845
JH
11750 set d_endnetent_r_proto endnetent_r $hdrs
11751 eval $hasproto ;;
11752 *) ;;
11753 esac
11754 case "$d_endnetent_r_proto" in
11755 define)
10bc17b6
JH
11756 case "$endnetent_r_proto" in
11757 ''|0) try='int endnetent_r(struct netent_data*);'
31ee0cb7 11758 ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
11759 esac
11760 case "$endnetent_r_proto" in
11761 ''|0) try='void endnetent_r(struct netent_data*);'
31ee0cb7 11762 ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
11763 esac
11764 case "$endnetent_r_proto" in
90e831dc 11765 ''|0) d_endnetent_r=undef
10bc17b6 11766 endnetent_r_proto=0
a48ec845 11767 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11768 * ) case "$endnetent_r_proto" in
11769 REENTRANT_PROTO*) ;;
11770 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11771 esac
11772 echo "Prototype: $try" ;;
11773 esac
11774 ;;
c18e646a
JH
11775 *) case "$usethreads" in
11776 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11777 esac
90e831dc
SB
11778 d_endnetent_r=undef
11779 endnetent_r_proto=0
c18e646a 11780 ;;
a48ec845
JH
11781 esac
11782 ;;
10bc17b6
JH
11783*) endnetent_r_proto=0
11784 ;;
11785esac
11786
b4eb6b3d
JH
11787: see if endprotoent exists
11788set endprotoent d_endpent
11789eval $inlibc
11790
10bc17b6
JH
11791: see if endprotoent_r exists
11792set endprotoent_r d_endprotoent_r
11793eval $inlibc
11794case "$d_endprotoent_r" in
11795"$define")
11796 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11797 case "$d_endprotoent_r_proto:$usethreads" in
11798 ":define") d_endprotoent_r_proto=define
a48ec845
JH
11799 set d_endprotoent_r_proto endprotoent_r $hdrs
11800 eval $hasproto ;;
11801 *) ;;
11802 esac
11803 case "$d_endprotoent_r_proto" in
11804 define)
10bc17b6
JH
11805 case "$endprotoent_r_proto" in
11806 ''|0) try='int endprotoent_r(struct protoent_data*);'
31ee0cb7 11807 ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
11808 esac
11809 case "$endprotoent_r_proto" in
11810 ''|0) try='void endprotoent_r(struct protoent_data*);'
31ee0cb7 11811 ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
11812 esac
11813 case "$endprotoent_r_proto" in
90e831dc 11814 ''|0) d_endprotoent_r=undef
10bc17b6 11815 endprotoent_r_proto=0
a48ec845 11816 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11817 * ) case "$endprotoent_r_proto" in
11818 REENTRANT_PROTO*) ;;
11819 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11820 esac
11821 echo "Prototype: $try" ;;
11822 esac
11823 ;;
c18e646a
JH
11824 *) case "$usethreads" in
11825 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11826 esac
90e831dc
SB
11827 d_endprotoent_r=undef
11828 endprotoent_r_proto=0
c18e646a 11829 ;;
a48ec845
JH
11830 esac
11831 ;;
10bc17b6
JH
11832*) endprotoent_r_proto=0
11833 ;;
11834esac
11835
b4eb6b3d
JH
11836: see if endpwent exists
11837set endpwent d_endpwent
11838eval $inlibc
11839
10bc17b6
JH
11840: see if this is a pwd.h system
11841set pwd.h i_pwd
11842eval $inhdr
11843
11844case "$i_pwd" in
11845$define)
11846 xxx=`./findhdr pwd.h`
11847 $cppstdin $cppflags $cppminus < $xxx >$$.h
11848
11849 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11850 val="$define"
11851 else
11852 val="$undef"
11853 fi
11854 set d_pwquota
11855 eval $setvar
11856
11857 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11858 val="$define"
11859 else
11860 val="$undef"
11861 fi
11862 set d_pwage
11863 eval $setvar
11864
11865 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11866 val="$define"
11867 else
11868 val="$undef"
11869 fi
11870 set d_pwchange
11871 eval $setvar
11872
11873 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11874 val="$define"
11875 else
11876 val="$undef"
11877 fi
11878 set d_pwclass
11879 eval $setvar
11880
11881 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11882 val="$define"
11883 else
11884 val="$undef"
11885 fi
11886 set d_pwexpire
11887 eval $setvar
11888
11889 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11890 val="$define"
11891 else
11892 val="$undef"
11893 fi
11894 set d_pwcomment
11895 eval $setvar
11896
11897 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11898 val="$define"
11899 else
11900 val="$undef"
11901 fi
11902 set d_pwgecos
11903 eval $setvar
11904
11905 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11906 val="$define"
11907 else
11908 val="$undef"
11909 fi
11910 set d_pwpasswd
11911 eval $setvar
11912
11913 $rm -f $$.h
11914 ;;
11915*)
11916 val="$undef";
11917 set d_pwquota; eval $setvar
11918 set d_pwage; eval $setvar
11919 set d_pwchange; eval $setvar
11920 set d_pwclass; eval $setvar
11921 set d_pwexpire; eval $setvar
11922 set d_pwcomment; eval $setvar
11923 set d_pwgecos; eval $setvar
11924 set d_pwpasswd; eval $setvar
11925 ;;
11926esac
11927
11928: see if endpwent_r exists
11929set endpwent_r d_endpwent_r
11930eval $inlibc
11931case "$d_endpwent_r" in
11932"$define")
11933 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
11934 case "$d_endpwent_r_proto:$usethreads" in
11935 ":define") d_endpwent_r_proto=define
a48ec845
JH
11936 set d_endpwent_r_proto endpwent_r $hdrs
11937 eval $hasproto ;;
11938 *) ;;
11939 esac
11940 case "$d_endpwent_r_proto" in
11941 define)
10bc17b6
JH
11942 case "$endpwent_r_proto" in
11943 ''|0) try='int endpwent_r(FILE**);'
11944 ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11945 esac
11946 case "$endpwent_r_proto" in
11947 ''|0) try='void endpwent_r(FILE**);'
11948 ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11949 esac
11950 case "$endpwent_r_proto" in
90e831dc 11951 ''|0) d_endpwent_r=undef
10bc17b6 11952 endpwent_r_proto=0
a48ec845 11953 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11954 * ) case "$endpwent_r_proto" in
11955 REENTRANT_PROTO*) ;;
11956 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11957 esac
11958 echo "Prototype: $try" ;;
11959 esac
11960 ;;
c18e646a
JH
11961 *) case "$usethreads" in
11962 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11963 esac
90e831dc
SB
11964 d_endpwent_r=undef
11965 endpwent_r_proto=0
c18e646a 11966 ;;
a48ec845
JH
11967 esac
11968 ;;
10bc17b6
JH
11969*) endpwent_r_proto=0
11970 ;;
11971esac
11972
b4eb6b3d
JH
11973: see if endservent exists
11974set endservent d_endsent
11975eval $inlibc
11976
10bc17b6
JH
11977: see if endservent_r exists
11978set endservent_r d_endservent_r
11979eval $inlibc
11980case "$d_endservent_r" in
11981"$define")
11982 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11983 case "$d_endservent_r_proto:$usethreads" in
11984 ":define") d_endservent_r_proto=define
a48ec845
JH
11985 set d_endservent_r_proto endservent_r $hdrs
11986 eval $hasproto ;;
11987 *) ;;
11988 esac
11989 case "$d_endservent_r_proto" in
11990 define)
10bc17b6
JH
11991 case "$endservent_r_proto" in
11992 ''|0) try='int endservent_r(struct servent_data*);'
31ee0cb7 11993 ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
11994 esac
11995 case "$endservent_r_proto" in
11996 ''|0) try='void endservent_r(struct servent_data*);'
31ee0cb7 11997 ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
11998 esac
11999 case "$endservent_r_proto" in
90e831dc 12000 ''|0) d_endservent_r=undef
10bc17b6 12001 endservent_r_proto=0
a48ec845 12002 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12003 * ) case "$endservent_r_proto" in
12004 REENTRANT_PROTO*) ;;
12005 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12006 esac
12007 echo "Prototype: $try" ;;
12008 esac
12009 ;;
c18e646a
JH
12010 *) case "$usethreads" in
12011 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12012 esac
90e831dc
SB
12013 d_endservent_r=undef
12014 endservent_r_proto=0
c18e646a 12015 ;;
a48ec845
JH
12016 esac
12017 ;;
10bc17b6
JH
12018*) endservent_r_proto=0
12019 ;;
12020esac
12021
b4eb6b3d
JH
12022: Locate the flags for 'open()'
12023echo " "
55954f19 12024$cat >try.c <<EOCP
b4eb6b3d
JH
12025#include <sys/types.h>
12026#ifdef I_FCNTL
12027#include <fcntl.h>
12028#endif
12029#ifdef I_SYS_FILE
12030#include <sys/file.h>
12031#endif
55954f19
JH
12032#$i_stdlib I_STDLIB
12033#ifdef I_STDLIB
12034#include <stdlib.h>
12035#endif
b4eb6b3d
JH
12036int main() {
12037 if(O_RDONLY);
12038#ifdef O_TRUNC
12039 exit(0);
12040#else
12041 exit(1);
12042#endif
12043}
12044EOCP
12045: check sys/file.h first to get FREAD on Sun
12046if $test `./findhdr sys/file.h` && \
5440bc8e 12047 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
12048 h_sysfile=true;
12049 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 12050 if $run ./try; then
b4eb6b3d
JH
12051 echo "and you have the 3 argument form of open()." >&4
12052 val="$define"
12053 else
12054 echo "but not the 3 argument form of open(). Oh, well." >&4
12055 val="$undef"
12056 fi
12057elif $test `./findhdr fcntl.h` && \
5440bc8e 12058 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
12059 h_fcntl=true;
12060 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 12061 if $run ./try; then
b4eb6b3d
JH
12062 echo "and you have the 3 argument form of open()." >&4
12063 val="$define"
12064 else
12065 echo "but not the 3 argument form of open(). Oh, well." >&4
12066 val="$undef"
12067 fi
12068else
12069 val="$undef"
12070 echo "I can't find the O_* constant definitions! You got problems." >&4
12071fi
12072set d_open3
12073eval $setvar
5440bc8e 12074$rm -f try try.*
b4eb6b3d
JH
12075
12076: see which of string.h or strings.h is needed
12077echo " "
12078strings=`./findhdr string.h`
12079if $test "$strings" && $test -r "$strings"; then
12080 echo "Using <string.h> instead of <strings.h>." >&4
12081 val="$define"
12082else
12083 val="$undef"
12084 strings=`./findhdr strings.h`
12085 if $test "$strings" && $test -r "$strings"; then
12086 echo "Using <strings.h> instead of <string.h>." >&4
12087 else
12088 echo "No string header found -- You'll surely have problems." >&4
12089 fi
12090fi
12091set i_string
12092eval $setvar
12093case "$i_string" in
12094"$undef") strings=`./findhdr strings.h`;;
12095*) strings=`./findhdr string.h`;;
12096esac
12097
3c728e00
JH
12098: see if this is a sys/file.h system
12099val=''
12100set sys/file.h val
12101eval $inhdr
12102
12103: do we need to include sys/file.h ?
12104case "$val" in
12105"$define")
12106 echo " "
12107 if $h_sysfile; then
12108 val="$define"
12109 echo "We'll be including <sys/file.h>." >&4
12110 else
12111 val="$undef"
12112 echo "We won't be including <sys/file.h>." >&4
12113 fi
12114 ;;
12115*)
12116 h_sysfile=false
12117 ;;
12118esac
12119set i_sysfile
12120eval $setvar
12121
12122: see if fcntl.h is there
12123val=''
12124set fcntl.h val
12125eval $inhdr
12126
12127: see if we can include fcntl.h
12128case "$val" in
12129"$define")
12130 echo " "
12131 if $h_fcntl; then
12132 val="$define"
12133 echo "We'll be including <fcntl.h>." >&4
12134 else
12135 val="$undef"
12136 if $h_sysfile; then
12137 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12138 else
12139 echo "We won't be including <fcntl.h>." >&4
12140 fi
12141 fi
12142 ;;
12143*)
12144 h_fcntl=false
12145 val="$undef"
12146 ;;
12147esac
12148set i_fcntl
12149eval $setvar
12150
b4eb6b3d
JH
12151: check for non-blocking I/O stuff
12152case "$h_sysfile" in
a0acbdc3
JH
12153true) echo "#include <sys/file.h>" > head.c;;
12154*)
12155 case "$h_fcntl" in
12156 true) echo "#include <fcntl.h>" > head.c;;
12157 *) echo "#include <sys/fcntl.h>" > head.c;;
12158 esac
12159 ;;
b4eb6b3d
JH
12160esac
12161echo " "
12162echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12163case "$o_nonblock" in
12164'')
12165 $cat head.c > try.c
3c728e00 12166 $cat >>try.c <<EOCP
b4eb6b3d 12167#include <stdio.h>
55954f19
JH
12168#$i_stdlib I_STDLIB
12169#ifdef I_STDLIB
80b3ef99 12170#include <stdlib.h>
55954f19 12171#endif
3c728e00
JH
12172#$i_fcntl I_FCNTL
12173#ifdef I_FCNTL
12174#include <fcntl.h>
12175#endif
b4eb6b3d
JH
12176int main() {
12177#ifdef O_NONBLOCK
12178 printf("O_NONBLOCK\n");
12179 exit(0);
12180#endif
12181#ifdef O_NDELAY
12182 printf("O_NDELAY\n");
12183 exit(0);
12184#endif
12185#ifdef FNDELAY
12186 printf("FNDELAY\n");
12187 exit(0);
12188#endif
12189 exit(0);
12190}
12191EOCP
12192 set try
12193 if eval $compile_ok; then
5440bc8e 12194 o_nonblock=`$run ./try`
b4eb6b3d
JH
12195 case "$o_nonblock" in
12196 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12197 *) echo "Seems like we can use $o_nonblock.";;
12198 esac
12199 else
12200 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12201 fi
12202 ;;
12203*) echo "Using $hint value $o_nonblock.";;
12204esac
12205$rm -f try try.* .out core
12206
12207echo " "
12208echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12209case "$eagain" in
12210'')
12211 $cat head.c > try.c
12212 $cat >>try.c <<EOCP
12213#include <errno.h>
12214#include <sys/types.h>
12215#include <signal.h>
12216#include <stdio.h>
55954f19
JH
12217#$i_stdlib I_STDLIB
12218#ifdef I_STDLIB
12219#include <stdlib.h>
12220#endif
1deb0a86
JH
12221#$i_fcntl I_FCNTL
12222#ifdef I_FCNTL
12223#include <fcntl.h>
12224#endif
b4eb6b3d
JH
12225#define MY_O_NONBLOCK $o_nonblock
12226#ifndef errno /* XXX need better Configure test */
12227extern int errno;
12228#endif
12229#$i_unistd I_UNISTD
12230#ifdef I_UNISTD
12231#include <unistd.h>
12232#endif
12233#$i_string I_STRING
12234#ifdef I_STRING
12235#include <string.h>
12236#else
12237#include <strings.h>
12238#endif
7090f861 12239$signal_t blech(int x) { exit(3); }
b4eb6b3d
JH
12240EOCP
12241 $cat >> try.c <<'EOCP'
12242int main()
12243{
12244 int pd[2];
12245 int pu[2];
12246 char buf[1];
12247 char string[100];
12248
12249 pipe(pd); /* Down: child -> parent */
12250 pipe(pu); /* Up: parent -> child */
12251 if (0 != fork()) {
12252 int ret;
12253 close(pd[1]); /* Parent reads from pd[0] */
12254 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 12255#ifdef F_SETFL
b4eb6b3d
JH
12256 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12257 exit(1);
a0acbdc3
JH
12258#else
12259 exit(4);
12260#endif
b4eb6b3d
JH
12261 signal(SIGALRM, blech);
12262 alarm(5);
12263 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
12264 exit(2);
12265 sprintf(string, "%d\n", ret);
12266 write(2, string, strlen(string));
12267 alarm(0);
12268#ifdef EAGAIN
12269 if (errno == EAGAIN) {
12270 printf("EAGAIN\n");
12271 goto ok;
12272 }
12273#endif
12274#ifdef EWOULDBLOCK
12275 if (errno == EWOULDBLOCK)
12276 printf("EWOULDBLOCK\n");
12277#endif
12278 ok:
12279 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
12280 sleep(2); /* Give it time to close our pipe */
12281 alarm(5);
12282 ret = read(pd[0], buf, 1); /* Should read EOF */
12283 alarm(0);
12284 sprintf(string, "%d\n", ret);
868439a2 12285 write(4, string, strlen(string));
b4eb6b3d
JH
12286 exit(0);
12287 }
12288
12289 close(pd[0]); /* We write to pd[1] */
12290 close(pu[1]); /* We read from pu[0] */
12291 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
12292 close(pd[1]); /* Pipe pd is now fully closed! */
12293 exit(0); /* Bye bye, thank you for playing! */
12294}
12295EOCP
12296 set try
12297 if eval $compile_ok; then
12298 echo "$startsh" >mtry
868439a2 12299 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
12300 chmod +x mtry
12301 ./mtry >/dev/null 2>&1
12302 case $? in
12303 0) eagain=`$cat try.out`;;
12304 1) echo "Could not perform non-blocking setting!";;
12305 2) echo "I did a successful read() for something that was not there!";;
12306 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 12307 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
12308 *) echo "Something terribly wrong happened during testing.";;
12309 esac
12310 rd_nodata=`$cat try.ret`
12311 echo "A read() system call with no data present returns $rd_nodata."
12312 case "$rd_nodata" in
12313 0|-1) ;;
12314 *)
12315 echo "(That's peculiar, fixing that to be -1.)"
12316 rd_nodata=-1
12317 ;;
12318 esac
12319 case "$eagain" in
12320 '')
12321 echo "Forcing errno EAGAIN on read() with no data available."
12322 eagain=EAGAIN
12323 ;;
12324 *)
12325 echo "Your read() sets errno to $eagain when no data is available."
12326 ;;
12327 esac
12328 status=`$cat try.err`
12329 case "$status" in
12330 0) echo "And it correctly returns 0 to signal EOF.";;
12331 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12332 *) echo "However, your read() returns '$status' on EOF??";;
12333 esac
12334 val="$define"
12335 if test "$status" = "$rd_nodata"; then
12336 echo "WARNING: you can't distinguish between EOF and no data!"
12337 val="$undef"
12338 fi
12339 else
12340 echo "I can't compile the test program--assuming errno EAGAIN will do."
12341 eagain=EAGAIN
12342 fi
12343 set d_eofnblk
12344 eval $setvar
12345 ;;
12346*)
12347 echo "Using $hint value $eagain."
12348 echo "Your read() returns $rd_nodata when no data is present."
12349 case "$d_eofnblk" in
12350 "$define") echo "And you can see EOF because read() returns 0.";;
12351 "$undef") echo "But you can't see EOF status from read() returned value.";;
12352 *)
12353 echo "(Assuming you can't see EOF status from read anyway.)"
12354 d_eofnblk=$undef
12355 ;;
12356 esac
12357 ;;
12358esac
12359$rm -f try try.* .out core head.c mtry
12360
15b61c98
JH
12361: see if _ptr and _cnt from stdio act std
12362echo " "
b4eb6b3d 12363
15b61c98
JH
12364if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12365 echo "(Looks like you have stdio.h from BSD.)"
12366 case "$stdio_ptr" in
12367 '') stdio_ptr='((fp)->_p)'
12368 ptr_lval=$define
12369 ;;
12370 *) ptr_lval=$d_stdio_ptr_lval;;
12371 esac
12372 case "$stdio_cnt" in
12373 '') stdio_cnt='((fp)->_r)'
12374 cnt_lval=$define
12375 ;;
12376 *) cnt_lval=$d_stdio_cnt_lval;;
12377 esac
12378 case "$stdio_base" in
12379 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12380 esac
12381 case "$stdio_bufsiz" in
12382 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12383 esac
12384elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12385 echo "(Looks like you have stdio.h from Linux.)"
12386 case "$stdio_ptr" in
12387 '') stdio_ptr='((fp)->_IO_read_ptr)'
12388 ptr_lval=$define
12389 ;;
12390 *) ptr_lval=$d_stdio_ptr_lval;;
12391 esac
12392 case "$stdio_cnt" in
12393 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12394 cnt_lval=$undef
12395 ;;
12396 *) cnt_lval=$d_stdio_cnt_lval;;
12397 esac
12398 case "$stdio_base" in
12399 '') stdio_base='((fp)->_IO_read_base)';;
12400 esac
12401 case "$stdio_bufsiz" in
12402 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12403 esac
12404else
12405 case "$stdio_ptr" in
12406 '') stdio_ptr='((fp)->_ptr)'
12407 ptr_lval=$define
12408 ;;
12409 *) ptr_lval=$d_stdio_ptr_lval;;
12410 esac
12411 case "$stdio_cnt" in
12412 '') stdio_cnt='((fp)->_cnt)'
12413 cnt_lval=$define
12414 ;;
12415 *) cnt_lval=$d_stdio_cnt_lval;;
12416 esac
12417 case "$stdio_base" in
12418 '') stdio_base='((fp)->_base)';;
12419 esac
12420 case "$stdio_bufsiz" in
12421 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12422 esac
12423fi
b4eb6b3d 12424
15b61c98
JH
12425: test whether _ptr and _cnt really work
12426echo "Checking how std your stdio is..." >&4
12427$cat >try.c <<EOP
12428#include <stdio.h>
55954f19
JH
12429#$i_stdlib I_STDLIB
12430#ifdef I_STDLIB
9d9004a9 12431#include <stdlib.h>
55954f19 12432#endif
15b61c98
JH
12433#define FILE_ptr(fp) $stdio_ptr
12434#define FILE_cnt(fp) $stdio_cnt
9d9004a9 12435int main() {
15b61c98
JH
12436 FILE *fp = fopen("try.c", "r");
12437 char c = getc(fp);
12438 if (
12439 18 <= FILE_cnt(fp) &&
12440 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12441 )
12442 exit(0);
12443 exit(1);
9d9004a9 12444}
15b61c98
JH
12445EOP
12446val="$undef"
12447set try
12448if eval $compile && $to try.c; then
12449 if $run ./try; then
12450 echo "Your stdio acts pretty std."
12451 val="$define"
9d9004a9 12452 else
15b61c98 12453 echo "Your stdio isn't very std."
9d9004a9 12454 fi
15b61c98
JH
12455else
12456 echo "Your stdio doesn't appear very std."
12457fi
12458$rm -f try.c try
12459
12460# glibc 2.2.90 and above apparently change stdio streams so Perl's
12461# direct buffer manipulation no longer works. The Configure tests
12462# should be changed to correctly detect this, but until then,
12463# the following check should at least let perl compile and run.
12464# (This quick fix should be updated before 5.8.1.)
12465# To be defensive, reject all unknown versions, and all versions > 2.2.9.
12466# A. Dougherty, June 3, 2002.
12467case "$d_gnulibc" in
12468$define)
12469 case "$gnulibc_version" in
12470 2.[01]*) ;;
12471 2.2) ;;
12472 2.2.[0-9]) ;;
12473 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12474 val="$undef"
12475 ;;
12476 esac
9d9004a9
AD
12477 ;;
12478esac
15b61c98 12479set d_stdstdio
9d9004a9 12480eval $setvar
9d9004a9 12481
15b61c98
JH
12482: Can _ptr be used as an lvalue?
12483case "$d_stdstdio$ptr_lval" in
12484$define$define) val=$define ;;
12485*) val=$undef ;;
12486esac
12487set d_stdio_ptr_lval
12488eval $setvar
9d9004a9 12489
15b61c98
JH
12490: Can _cnt be used as an lvalue?
12491case "$d_stdstdio$cnt_lval" in
12492$define$define) val=$define ;;
12493*) val=$undef ;;
12494esac
12495set d_stdio_cnt_lval
12496eval $setvar
b4eb6b3d 12497
15b61c98
JH
12498
12499: test whether setting _ptr sets _cnt as a side effect
12500d_stdio_ptr_lval_sets_cnt="$undef"
12501d_stdio_ptr_lval_nochange_cnt="$undef"
12502case "$d_stdio_ptr_lval$d_stdstdio" in
12503$define$define)
12504 echo "Checking to see what happens if we set the stdio ptr..." >&4
12505$cat >try.c <<EOP
12506#include <stdio.h>
12507/* Can we scream? */
12508/* Eat dust sed :-) */
12509/* In the buffer space, no one can hear you scream. */
55954f19
JH
12510#$i_stdlib I_STDLIB
12511#ifdef I_STDLIB
12512#include <stdlib.h>
12513#endif
15b61c98
JH
12514#define FILE_ptr(fp) $stdio_ptr
12515#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 12516#include <sys/types.h>
b4eb6b3d 12517int main() {
15b61c98
JH
12518 FILE *fp = fopen("try.c", "r");
12519 int c;
12520 char *ptr;
12521 size_t cnt;
12522 if (!fp) {
12523 puts("Fail even to read");
12524 exit(1);
12525 }
12526 c = getc(fp); /* Read away the first # */
12527 if (c == EOF) {
12528 puts("Fail even to read");
12529 exit(1);
12530 }
12531 if (!(
12532 18 <= FILE_cnt(fp) &&
12533 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12534 )) {
12535 puts("Fail even to read");
12536 exit (1);
12537 }
12538 ptr = (char*) FILE_ptr(fp);
12539 cnt = (size_t)FILE_cnt(fp);
12540
12541 FILE_ptr(fp) += 42;
12542
12543 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12544 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12545 exit (1);
12546 }
12547 if (FILE_cnt(fp) <= 20) {
12548 printf ("Fail (<20 chars to test)");
12549 exit (1);
12550 }
12551 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12552 puts("Fail compare");
12553 exit (1);
12554 }
12555 if (cnt == FILE_cnt(fp)) {
12556 puts("Pass_unchanged");
12557 exit (0);
12558 }
12559 if (FILE_cnt(fp) == (cnt - 42)) {
12560 puts("Pass_changed");
12561 exit (0);
12562 }
12563 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12564 return 1;
12565
12566}
12567EOP
12568 set try
12569 if eval $compile && $to try.c; then
12570 case `$run ./try` in
12571 Pass_changed)
12572 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
12573 d_stdio_ptr_lval_sets_cnt="$define" ;;
12574 Pass_unchanged)
12575 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12576 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12577 Fail*)
12578 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12579 *)
12580 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12581 esac
12582 else
12583 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12584 fi
12585 $rm -f try.c try
12586 ;;
12587esac
12588
12589: see if _base is also standard
12590val="$undef"
12591case "$d_stdstdio" in
12592$define)
12593 $cat >try.c <<EOP
12594#include <stdio.h>
12595#$i_stdlib I_STDLIB
12596#ifdef I_STDLIB
12597#include <stdlib.h>
12598#endif
12599#define FILE_base(fp) $stdio_base
12600#define FILE_bufsiz(fp) $stdio_bufsiz
12601int main() {
12602 FILE *fp = fopen("try.c", "r");
12603 char c = getc(fp);
12604 if (
12605 19 <= FILE_bufsiz(fp) &&
12606 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12607 )
12608 exit(0);
12609 exit(1);
12610}
12611EOP
12612 set try
12613 if eval $compile && $to try.c; then
12614 if $run ./try; then
12615 echo "And its _base field acts std."
12616 val="$define"
12617 else
12618 echo "But its _base field isn't std."
12619 fi
12620 else
12621 echo "However, it seems to be lacking the _base field."
12622 fi
12623 $rm -f try.c try
12624 ;;
12625esac
12626set d_stdiobase
12627eval $setvar
12628
12629: see if fast_stdio exists
12630val="$undef"
12631case "$d_stdstdio:$d_stdio_ptr_lval" in
12632"$define:$define")
12633 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12634 *$define*)
12635 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12636 val="$define"
12637 ;;
12638 esac
12639 ;;
12640esac
12641set d_faststdio
12642eval $setvar
12643
12644
12645
12646: see if fchdir exists
12647set fchdir d_fchdir
12648eval $inlibc
12649
12650: see if fchmod exists
12651set fchmod d_fchmod
12652eval $inlibc
12653
12654: see if fchown exists
12655set fchown d_fchown
12656eval $inlibc
12657
12658: see if this is an fcntl system
12659set fcntl d_fcntl
12660eval $inlibc
12661
12662echo " "
12663: See if fcntl-based locking works.
12664$cat >try.c <<EOCP
12665#$i_stdlib I_STDLIB
12666#ifdef I_STDLIB
12667#include <stdlib.h>
12668#endif
12669#include <unistd.h>
12670#include <fcntl.h>
12671#include <signal.h>
7090f861 12672$signal_t blech(int x) { exit(3); }
15b61c98
JH
12673int main() {
12674#if defined(F_SETLK) && defined(F_SETLKW)
12675 struct flock flock;
12676 int retval, fd;
12677 fd = open("try.c", O_RDONLY);
12678 flock.l_type = F_RDLCK;
12679 flock.l_whence = SEEK_SET;
12680 flock.l_start = flock.l_len = 0;
12681 signal(SIGALRM, blech);
12682 alarm(10);
12683 retval = fcntl(fd, F_SETLK, &flock);
12684 close(fd);
12685 (retval < 0 ? exit(2) : exit(0));
12686#else
12687 exit(2);
12688#endif
12689}
12690EOCP
12691echo "Checking if fcntl-based file locking works... "
12692case "$d_fcntl" in
12693"$define")
12694 set try
12695 if eval $compile_ok; then
12696 if $run ./try; then
12697 echo "Yes, it seems to work."
12698 val="$define"
12699 else
12700 echo "Nope, it didn't work."
12701 val="$undef"
12702 case "$?" in
12703 3) $cat >&4 <<EOM
12704***
12705*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12706*** This is (almost) impossible.
12707*** If your NFS lock daemons are not feeling well, something like
12708*** this may happen, please investigate. Cannot continue, aborting.
12709***
12710EOM
12711 exit 1
12712 ;;
12713 esac
12714 fi
12715 else
12716 echo "I'm unable to compile the test program, so I'll assume not."
12717 val="$undef"
12718 fi
12719 ;;
12720*) val="$undef";
12721 echo "Nope, since you don't even have fcntl()."
12722 ;;
12723esac
12724set d_fcntl_can_lock
12725eval $setvar
12726$rm -f try*
12727
12728
12729: check for fd_set items
12730$cat <<EOM
12731
12732Checking to see how well your C compiler handles fd_set and friends ...
12733EOM
12734$cat >try.c <<EOCP
12735#$i_stdlib I_STDLIB
12736#ifdef I_STDLIB
12737#include <stdlib.h>
12738#endif
12739#$i_systime I_SYS_TIME
12740#$i_sysselct I_SYS_SELECT
12741#$d_socket HAS_SOCKET
12742#include <sys/types.h>
12743#ifdef HAS_SOCKET
12744#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12745#endif
12746#ifdef I_SYS_TIME
12747#include <sys/time.h>
12748#endif
12749#ifdef I_SYS_SELECT
12750#include <sys/select.h>
12751#endif
12752int main() {
12753 fd_set fds;
12754
12755#ifdef TRYBITS
12756 if(fds.fds_bits);
12757#endif
12758
12759#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12760 exit(0);
12761#else
12762 exit(1);
12763#endif
12764}
12765EOCP
12766set try -DTRYBITS
12767if eval $compile; then
12768 d_fds_bits="$define"
12769 d_fd_set="$define"
12770 echo "Well, your system knows about the normal fd_set typedef..." >&4
12771 if $run ./try; then
b4eb6b3d
JH
12772 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12773 d_fd_macros="$define"
12774 else
12775 $cat >&4 <<'EOM'
12776but not the normal fd_set macros! Gaaack! I'll have to cover for you.
12777EOM
12778 d_fd_macros="$undef"
12779 fi
12780else
12781 $cat <<'EOM'
12782Hmm, your compiler has some difficulty with fd_set. Checking further...
12783EOM
5440bc8e 12784 set try
b4eb6b3d
JH
12785 if eval $compile; then
12786 d_fds_bits="$undef"
12787 d_fd_set="$define"
12788 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 12789 if $run ./try; then
b4eb6b3d
JH
12790 echo "and you have the normal fd_set macros." >&4
12791 d_fd_macros="$define"
12792 else
12793 $cat <<'EOM'
12794but not the normal fd_set macros! Gross! More work for me...
12795EOM
12796 d_fd_macros="$undef"
12797 fi
12798 else
12799 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
12800 d_fd_set="$undef"
12801 d_fds_bits="$undef"
12802 d_fd_macros="$undef"
12803 fi
12804fi
5440bc8e 12805$rm -f try try.*
b4eb6b3d
JH
12806
12807: see if fgetpos exists
12808set fgetpos d_fgetpos
12809eval $inlibc
12810
758a5d79
JH
12811: see if finite exists
12812set finite d_finite
12813eval $inlibc
12814
12815: see if finitel exists
12816set finitel d_finitel
12817eval $inlibc
12818
b4eb6b3d
JH
12819: see if flock exists
12820set flock d_flock
12821eval $inlibc
12822
2ef53570
JH
12823: see if prototype for flock is available
12824echo " "
12825set d_flockproto flock $i_sysfile sys/file.h
12826eval $hasproto
12827
b4eb6b3d
JH
12828: see if fork exists
12829set fork d_fork
12830eval $inlibc
12831
758a5d79
JH
12832: see if fp_class exists
12833set fp_class d_fp_class
12834eval $inlibc
12835
b4eb6b3d
JH
12836: see if pathconf exists
12837set pathconf d_pathconf
12838eval $inlibc
12839
12840: see if fpathconf exists
12841set fpathconf d_fpathconf
12842eval $inlibc
12843
758a5d79
JH
12844: see if fpclass exists
12845set fpclass d_fpclass
12846eval $inlibc
12847
12848: see if fpclassify exists
12849set fpclassify d_fpclassify
12850eval $inlibc
12851
12852: see if fpclassl exists
12853set fpclassl d_fpclassl
12854eval $inlibc
12855
b4eb6b3d
JH
12856
12857: check for fpos64_t
12858echo " "
12859echo "Checking to see if you have fpos64_t..." >&4
12860$cat >try.c <<EOCP
12861#include <stdio.h>
12862int main() { fpos64_t x = 7; }
12863EOCP
12864set try
12865if eval $compile; then
12866 val="$define"
12867 echo "You have fpos64_t."
12868else
12869 val="$undef"
12870 echo "You do not have fpos64_t."
12871 case "$fpossize" in
12872 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12873 esac
12874fi
12875$rm -f try.* try
12876set d_fpos64_t
12877eval $setvar
12878
12879: see if frexpl exists
12880set frexpl d_frexpl
12881eval $inlibc
12882
b4eb6b3d
JH
12883: see if this is a sys/param system
12884set sys/param.h i_sysparam
12885eval $inhdr
12886
12887: see if this is a sys/mount.h system
12888set sys/mount.h i_sysmount
12889eval $inhdr
12890
b4eb6b3d
JH
12891
12892echo " "
12893echo "Checking to see if your system supports struct fs_data..." >&4
12894set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12895eval $hasstruct
12896case "$d_fs_data_s" in
12897"$define") echo "Yes, it does." ;;
12898*) echo "No, it doesn't." ;;
12899esac
12900
12901: see if fseeko exists
12902set fseeko d_fseeko
12903eval $inlibc
12904case "$longsize" in
129058) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12906esac
12907
12908: see if fsetpos exists
12909set fsetpos d_fsetpos
12910eval $inlibc
12911
12912
12913: see if fstatfs exists
12914set fstatfs d_fstatfs
12915eval $inlibc
12916
12917
12918: see if statvfs exists
12919set statvfs d_statvfs
12920eval $inlibc
12921
12922: see if fstatvfs exists
12923set fstatvfs d_fstatvfs
12924eval $inlibc
12925
12926
411ab01c
JH
12927: see if fsync exists
12928set fsync d_fsync
12929eval $inlibc
12930
b4eb6b3d
JH
12931: see if ftello exists
12932set ftello d_ftello
12933eval $inlibc
12934case "$longsize" in
129358) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12936esac
12937
bff98e24
SP
12938d_futimes="$undef"
12939: check for a working futimes
12940echo " "
12941echo "Checking for a working futimes()" >&4
12942$cat >try.c <<EOCP
12943#include <stdio.h>
12944#include <sys/time.h>
12945#include <errno.h>
12946#include <fcntl.h>
12947
12948int main ()
12949{
12950 int fd, rv;
12951 fd = open ("try.c", O_RDWR);
12952 if (-1 == fd) exit (1);
12953 rv = futimes (fd, NULL);
12954 exit (rv == -1 ? errno : 0);
12955}
12956EOCP
12957set try
12958if eval $compile; then
12959 `$run ./try`
12960 rc=$?
12961 case "$rc" in
12962 0) echo "Yes, it does" >&4
12963 d_futimes="$define"
12964 ;;
12965 *) echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12966 ;;
12967 esac
12968else
12969 echo "No, it does not (probably harmless)\n" >&4
12970fi
12971$rm -f try.* try core core.try.*
dc814df1 12972
b4eb6b3d
JH
12973: see if getcwd exists
12974set getcwd d_getcwd
12975eval $inlibc
12976
12977: see if getespwnam exists
12978set getespwnam d_getespwnam
12979eval $inlibc
12980
12981
12982: see if getfsstat exists
12983set getfsstat d_getfsstat
12984eval $inlibc
12985
12986: see if getgrent exists
12987set getgrent d_getgrent
12988eval $inlibc
12989
10bc17b6
JH
12990: see if getgrent_r exists
12991set getgrent_r d_getgrent_r
12992eval $inlibc
12993case "$d_getgrent_r" in
12994"$define")
12995 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12996 case "$d_getgrent_r_proto:$usethreads" in
12997 ":define") d_getgrent_r_proto=define
a48ec845
JH
12998 set d_getgrent_r_proto getgrent_r $hdrs
12999 eval $hasproto ;;
13000 *) ;;
13001 esac
13002 case "$d_getgrent_r_proto" in
13003 define)
10bc17b6
JH
13004 case "$getgrent_r_proto" in
13005 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13006 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13007 esac
13008 case "$getgrent_r_proto" in
13009 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13010 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13011 esac
13012 case "$getgrent_r_proto" in
13013 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13014 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13015 esac
13016 case "$getgrent_r_proto" in
13017 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13018 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13019 esac
13020 case "$getgrent_r_proto" in
13021 ''|0) try='int getgrent_r(struct group*, char*, int);'
13022 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13023 esac
13024 case "$getgrent_r_proto" in
13025 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13026 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13027 esac
13028 case "$getgrent_r_proto" in
90e831dc 13029 ''|0) d_getgrent_r=undef
10bc17b6 13030 getgrent_r_proto=0
a48ec845 13031 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13032 * ) case "$getgrent_r_proto" in
13033 REENTRANT_PROTO*) ;;
13034 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13035 esac
13036 echo "Prototype: $try" ;;
13037 esac
13038 ;;
c18e646a
JH
13039 *) case "$usethreads" in
13040 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13041 esac
90e831dc
SB
13042 d_getgrent_r=undef
13043 getgrent_r_proto=0
c18e646a 13044 ;;
a48ec845
JH
13045 esac
13046 ;;
10bc17b6
JH
13047*) getgrent_r_proto=0
13048 ;;
13049esac
13050
13051: see if getgrgid_r exists
13052set getgrgid_r d_getgrgid_r
13053eval $inlibc
13054case "$d_getgrgid_r" in
13055"$define")
13056 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13057 case "$d_getgrgid_r_proto:$usethreads" in
13058 ":define") d_getgrgid_r_proto=define
a48ec845
JH
13059 set d_getgrgid_r_proto getgrgid_r $hdrs
13060 eval $hasproto ;;
13061 *) ;;
13062 esac
13063 case "$d_getgrgid_r_proto" in
13064 define)
10bc17b6
JH
13065 case "$getgrgid_r_proto" in
13066 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13067 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13068 esac
13069 case "$getgrgid_r_proto" in
13070 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13071 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13072 esac
13073 case "$getgrgid_r_proto" in
13074 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13075 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13076 esac
13077 case "$getgrgid_r_proto" in
13078 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13079 ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13080 esac
13081 case "$getgrgid_r_proto" in
90e831dc 13082 ''|0) d_getgrgid_r=undef
10bc17b6 13083 getgrgid_r_proto=0
a48ec845 13084 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13085 * ) case "$getgrgid_r_proto" in
13086 REENTRANT_PROTO*) ;;
13087 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13088 esac
13089 echo "Prototype: $try" ;;
13090 esac
13091 ;;
c18e646a
JH
13092 *) case "$usethreads" in
13093 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13094 esac
90e831dc
SB
13095 d_getgrgid_r=undef
13096 getgrgid_r_proto=0
c18e646a 13097 ;;
a48ec845
JH
13098 esac
13099 ;;
10bc17b6
JH
13100*) getgrgid_r_proto=0
13101 ;;
13102esac
13103
13104: see if getgrnam_r exists
13105set getgrnam_r d_getgrnam_r
13106eval $inlibc
13107case "$d_getgrnam_r" in
13108"$define")
13109 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13110 case "$d_getgrnam_r_proto:$usethreads" in
13111 ":define") d_getgrnam_r_proto=define
a48ec845
JH
13112 set d_getgrnam_r_proto getgrnam_r $hdrs
13113 eval $hasproto ;;
13114 *) ;;
13115 esac
13116 case "$d_getgrnam_r_proto" in
13117 define)
10bc17b6
JH
13118 case "$getgrnam_r_proto" in
13119 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13120 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13121 esac
13122 case "$getgrnam_r_proto" in
13123 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13124 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13125 esac
13126 case "$getgrnam_r_proto" in
13127 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13128 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13129 esac
13130 case "$getgrnam_r_proto" in
13131 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13132 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13133 esac
13134 case "$getgrnam_r_proto" in
13135 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13136 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13137 esac
13138 case "$getgrnam_r_proto" in
90e831dc 13139 ''|0) d_getgrnam_r=undef
10bc17b6 13140 getgrnam_r_proto=0
a48ec845 13141 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13142 * ) case "$getgrnam_r_proto" in
13143 REENTRANT_PROTO*) ;;
13144 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13145 esac
13146 echo "Prototype: $try" ;;
13147 esac
13148 ;;
c18e646a
JH
13149 *) case "$usethreads" in
13150 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13151 esac
90e831dc
SB
13152 d_getgrnam_r=undef
13153 getgrnam_r_proto=0
c18e646a 13154 ;;
a48ec845
JH
13155 esac
13156 ;;
10bc17b6
JH
13157*) getgrnam_r_proto=0
13158 ;;
13159esac
13160
b4eb6b3d
JH
13161: see if gethostbyaddr exists
13162set gethostbyaddr d_gethbyaddr
13163eval $inlibc
13164
13165: see if gethostbyname exists
13166set gethostbyname d_gethbyname
13167eval $inlibc
13168
13169: see if gethostent exists
13170set gethostent d_gethent
13171eval $inlibc
13172
13173: see how we will look up host name
13174echo " "
13175call=''
13176if set gethostname val -f d_gethname; eval $csym; $val; then
13177 echo 'gethostname() found.' >&4
13178 d_gethname="$define"
13179 call=gethostname
13180fi
13181if set uname val -f d_uname; eval $csym; $val; then
13182 if ./xenix; then
13183 $cat <<'EOM'
13184uname() was found, but you're running xenix, and older versions of xenix
13185have a broken uname(). If you don't really know whether your xenix is old
13186enough to have a broken system call, use the default answer.
13187
13188EOM
13189 dflt=y
13190 case "$d_uname" in
13191 "$define") dflt=n;;
13192 esac
13193 rp='Is your uname() broken?'
13194 . ./myread
13195 case "$ans" in
13196 n*) d_uname="$define"; call=uname;;
13197 esac
13198 else
13199 echo 'uname() found.' >&4
13200 d_uname="$define"
13201 case "$call" in
13202 '') call=uname ;;
13203 esac
13204 fi
13205fi
13206case "$d_gethname" in
13207'') d_gethname="$undef";;
13208esac
13209case "$d_uname" in
13210'') d_uname="$undef";;
13211esac
13212case "$d_uname$d_gethname" in
13213*define*)
13214 dflt=n
13215 cat <<EOM
13216
13217Every now and then someone has a $call() that lies about the hostname
13218but can't be fixed for political or economic reasons. If you wish, I can
13219pretend $call() isn't there and maybe compute hostname at run-time
13220thanks to the '$phostname' command.
13221
13222EOM
13223 rp="Shall I ignore $call() from now on?"
13224 . ./myread
13225 case "$ans" in
13226 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13227 esac;;
13228esac
13229case "$phostname" in
13230'') aphostname='';;
13231*) case "$aphostname" in
13232 /*) ;;
13233 *) set X $phostname
13234 shift
13235 file=$1
13236 shift
13237 file=`./loc $file $file $pth`
13238 aphostname=`echo $file $*`
13239 ;;
13240 esac
13241 ;;
13242esac
13243case "$d_uname$d_gethname" in
13244*define*) ;;
13245*)
13246 case "$phostname" in
13247 '')
13248 echo "There will be no way for $package to get your hostname." >&4;;
13249 *)
13250 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13251 ;;
13252 esac;;
13253esac
13254case "$d_phostname" in
13255'') d_phostname="$undef";;
13256esac
13257
10bc17b6
JH
13258: see if gethostbyaddr_r exists
13259set gethostbyaddr_r d_gethostbyaddr_r
13260eval $inlibc
13261case "$d_gethostbyaddr_r" in
13262"$define")
13263 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13264 case "$d_gethostbyaddr_r_proto:$usethreads" in
13265 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
13266 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13267 eval $hasproto ;;
13268 *) ;;
13269 esac
13270 case "$d_gethostbyaddr_r_proto" in
13271 define)
10bc17b6
JH
13272 case "$gethostbyaddr_r_proto" in
13273 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13274 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13275 esac
13276 case "$gethostbyaddr_r_proto" in
13277 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13278 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13279 esac
13280 case "$gethostbyaddr_r_proto" in
13281 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13282 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13283 esac
13284 case "$gethostbyaddr_r_proto" in
13285 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13286 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13287 esac
13288 case "$gethostbyaddr_r_proto" in
13289 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13290 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13291 esac
13292 case "$gethostbyaddr_r_proto" in
13293 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13294 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13295 esac
13296 case "$gethostbyaddr_r_proto" in
13297 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13298 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13299 esac
13300 case "$gethostbyaddr_r_proto" in
13301 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13302 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13303 esac
13304 case "$gethostbyaddr_r_proto" in
13305 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13306 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13307 esac
13308 case "$gethostbyaddr_r_proto" in
13309 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13310 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13311 esac
13312 case "$gethostbyaddr_r_proto" in
a845a0d4
JH
13313 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13314 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13315 esac
13316 case "$gethostbyaddr_r_proto" in
90e831dc 13317 ''|0) d_gethostbyaddr_r=undef
10bc17b6 13318 gethostbyaddr_r_proto=0
a48ec845 13319 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13320 * ) case "$gethostbyaddr_r_proto" in
13321 REENTRANT_PROTO*) ;;
13322 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13323 esac
13324 echo "Prototype: $try" ;;
13325 esac
13326 ;;
c18e646a
JH
13327 *) case "$usethreads" in
13328 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13329 esac
90e831dc
SB
13330 d_gethostbyaddr_r=undef
13331 gethostbyaddr_r_proto=0
c18e646a 13332 ;;
a48ec845
JH
13333 esac
13334 ;;
10bc17b6
JH
13335*) gethostbyaddr_r_proto=0
13336 ;;
13337esac
13338
13339: see if gethostbyname_r exists
13340set gethostbyname_r d_gethostbyname_r
13341eval $inlibc
13342case "$d_gethostbyname_r" in
13343"$define")
13344 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13345 case "$d_gethostbyname_r_proto:$usethreads" in
13346 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
13347 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13348 eval $hasproto ;;
13349 *) ;;
13350 esac
13351 case "$d_gethostbyname_r_proto" in
13352 define)
10bc17b6
JH
13353 case "$gethostbyname_r_proto" in
13354 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13355 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13356 esac
13357 case "$gethostbyname_r_proto" in
13358 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13359 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13360 esac
13361 case "$gethostbyname_r_proto" in
13362 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13363 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13364 esac
13365 case "$gethostbyname_r_proto" in
90e831dc 13366 ''|0) d_gethostbyname_r=undef
10bc17b6 13367 gethostbyname_r_proto=0
a48ec845 13368 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13369 * ) case "$gethostbyname_r_proto" in
13370 REENTRANT_PROTO*) ;;
13371 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13372 esac
13373 echo "Prototype: $try" ;;
13374 esac
13375 ;;
c18e646a
JH
13376 *) case "$usethreads" in
13377 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13378 esac
90e831dc
SB
13379 d_gethostbyname_r=undef
13380 gethostbyname_r_proto=0
c18e646a 13381 ;;
a48ec845
JH
13382 esac
13383 ;;
10bc17b6
JH
13384*) gethostbyname_r_proto=0
13385 ;;
13386esac
13387
13388: see if gethostent_r exists
13389set gethostent_r d_gethostent_r
13390eval $inlibc
13391case "$d_gethostent_r" in
13392"$define")
13393 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13394 case "$d_gethostent_r_proto:$usethreads" in
13395 ":define") d_gethostent_r_proto=define
a48ec845
JH
13396 set d_gethostent_r_proto gethostent_r $hdrs
13397 eval $hasproto ;;
13398 *) ;;
13399 esac
13400 case "$d_gethostent_r_proto" in
13401 define)
10bc17b6
JH
13402 case "$gethostent_r_proto" in
13403 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13404 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13405 esac
13406 case "$gethostent_r_proto" in
13407 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13408 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13409 esac
13410 case "$gethostent_r_proto" in
13411 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13412 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13413 esac
13414 case "$gethostent_r_proto" in
13415 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13416 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13417 esac
13418 case "$gethostent_r_proto" in
13419 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13420 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13421 esac
13422 case "$gethostent_r_proto" in
13423 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13424 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13425 esac
13426 case "$gethostent_r_proto" in
90e831dc 13427 ''|0) d_gethostent_r=undef
10bc17b6 13428 gethostent_r_proto=0
a48ec845 13429 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13430 * ) case "$gethostent_r_proto" in
13431 REENTRANT_PROTO*) ;;
13432 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13433 esac
13434 echo "Prototype: $try" ;;
13435 esac
13436 ;;
c18e646a
JH
13437 *) case "$usethreads" in
13438 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13439 esac
90e831dc
SB
13440 d_gethostent_r=undef
13441 gethostent_r_proto=0
c18e646a 13442 ;;
a48ec845
JH
13443 esac
13444 ;;
10bc17b6
JH
13445*) gethostent_r_proto=0
13446 ;;
13447esac
b4eb6b3d
JH
13448
13449: see if prototypes for various gethostxxx netdb.h functions are available
13450echo " "
13451set d_gethostprotos gethostent $i_netdb netdb.h
13452eval $hasproto
13453
4e0554ec
JH
13454: see if getitimer exists
13455set getitimer d_getitimer
13456eval $inlibc
13457
b4eb6b3d
JH
13458: see if getlogin exists
13459set getlogin d_getlogin
13460eval $inlibc
13461
10bc17b6
JH
13462: see if getlogin_r exists
13463set getlogin_r d_getlogin_r
13464eval $inlibc
13465case "$d_getlogin_r" in
13466"$define")
13467 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
13468 case "$d_getlogin_r_proto:$usethreads" in
13469 ":define") d_getlogin_r_proto=define
a48ec845
JH
13470 set d_getlogin_r_proto getlogin_r $hdrs
13471 eval $hasproto ;;
13472 *) ;;
13473 esac
13474 case "$d_getlogin_r_proto" in
13475 define)
10bc17b6
JH
13476 case "$getlogin_r_proto" in
13477 ''|0) try='int getlogin_r(char*, size_t);'
13478 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13479 esac
13480 case "$getlogin_r_proto" in
13481 ''|0) try='int getlogin_r(char*, int);'
13482 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13483 esac
13484 case "$getlogin_r_proto" in
13485 ''|0) try='char* getlogin_r(char*, size_t);'
13486 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13487 esac
13488 case "$getlogin_r_proto" in
13489 ''|0) try='char* getlogin_r(char*, int);'
13490 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13491 esac
13492 case "$getlogin_r_proto" in
90e831dc 13493 ''|0) d_getlogin_r=undef
10bc17b6 13494 getlogin_r_proto=0
a48ec845 13495 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13496 * ) case "$getlogin_r_proto" in
13497 REENTRANT_PROTO*) ;;
13498 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13499 esac
13500 echo "Prototype: $try" ;;
13501 esac
13502 ;;
c18e646a
JH
13503 *) case "$usethreads" in
13504 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13505 esac
90e831dc
SB
13506 d_getlogin_r=undef
13507 getlogin_r_proto=0
c18e646a 13508 ;;
a48ec845
JH
13509 esac
13510 ;;
10bc17b6
JH
13511*) getlogin_r_proto=0
13512 ;;
13513esac
13514
b4eb6b3d
JH
13515: see if getmnt exists
13516set getmnt d_getmnt
13517eval $inlibc
13518
13519: see if getmntent exists
13520set getmntent d_getmntent
13521eval $inlibc
13522
13523: see if getnetbyaddr exists
13524set getnetbyaddr d_getnbyaddr
13525eval $inlibc
13526
13527: see if getnetbyname exists
13528set getnetbyname d_getnbyname
13529eval $inlibc
13530
13531: see if getnetent exists
13532set getnetent d_getnent
13533eval $inlibc
13534
10bc17b6
JH
13535: see if getnetbyaddr_r exists
13536set getnetbyaddr_r d_getnetbyaddr_r
13537eval $inlibc
13538case "$d_getnetbyaddr_r" in
13539"$define")
13540 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13541 case "$d_getnetbyaddr_r_proto:$usethreads" in
13542 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
13543 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13544 eval $hasproto ;;
13545 *) ;;
13546 esac
13547 case "$d_getnetbyaddr_r_proto" in
13548 define)
10bc17b6
JH
13549 case "$getnetbyaddr_r_proto" in
13550 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13551 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13552 esac
13553 case "$getnetbyaddr_r_proto" in
13554 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13555 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13556 esac
13557 case "$getnetbyaddr_r_proto" in
13558 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13559 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13560 esac
13561 case "$getnetbyaddr_r_proto" in
13562 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13563 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13564 esac
13565 case "$getnetbyaddr_r_proto" in
13566 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13567 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13568 esac
13569 case "$getnetbyaddr_r_proto" in
13570 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13571 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13572 esac
13573 case "$getnetbyaddr_r_proto" in
13574 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13575 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13576 esac
13577 case "$getnetbyaddr_r_proto" in
a845a0d4
JH
13578 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13579 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13580 esac
13581 case "$getnetbyaddr_r_proto" in
90e831dc 13582 ''|0) d_getnetbyaddr_r=undef
10bc17b6 13583 getnetbyaddr_r_proto=0
a48ec845 13584 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13585 * ) case "$getnetbyaddr_r_proto" in
13586 REENTRANT_PROTO*) ;;
13587 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13588 esac
13589 echo "Prototype: $try" ;;
13590 esac
13591 ;;
c18e646a
JH
13592 *) case "$usethreads" in
13593 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13594 esac
90e831dc
SB
13595 d_getnetbyaddr_r=undef
13596 getnetbyaddr_r_proto=0
c18e646a 13597 ;;
a48ec845
JH
13598 esac
13599 ;;
10bc17b6
JH
13600*) getnetbyaddr_r_proto=0
13601 ;;
13602esac
13603
13604: see if getnetbyname_r exists
13605set getnetbyname_r d_getnetbyname_r
13606eval $inlibc
13607case "$d_getnetbyname_r" in
13608"$define")
13609 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13610 case "$d_getnetbyname_r_proto:$usethreads" in
13611 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
13612 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13613 eval $hasproto ;;
13614 *) ;;
13615 esac
13616 case "$d_getnetbyname_r_proto" in
13617 define)
10bc17b6
JH
13618 case "$getnetbyname_r_proto" in
13619 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13620 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13621 esac
13622 case "$getnetbyname_r_proto" in
13623 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13624 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13625 esac
13626 case "$getnetbyname_r_proto" in
13627 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13628 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13629 esac
13630 case "$getnetbyname_r_proto" in
13631 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13632 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13633 esac
13634 case "$getnetbyname_r_proto" in
90e831dc 13635 ''|0) d_getnetbyname_r=undef
10bc17b6 13636 getnetbyname_r_proto=0
a48ec845 13637 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13638 * ) case "$getnetbyname_r_proto" in
13639 REENTRANT_PROTO*) ;;
13640 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13641 esac
13642 echo "Prototype: $try" ;;
13643 esac
13644 ;;
c18e646a
JH
13645 *) case "$usethreads" in
13646 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13647 esac
90e831dc
SB
13648 d_getnetbyname_r=undef
13649 getnetbyname_r_proto=0
c18e646a 13650 ;;
a48ec845
JH
13651 esac
13652 ;;
10bc17b6
JH
13653*) getnetbyname_r_proto=0
13654 ;;
13655esac
13656
13657: see if getnetent_r exists
13658set getnetent_r d_getnetent_r
13659eval $inlibc
13660case "$d_getnetent_r" in
13661"$define")
13662 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13663 case "$d_getnetent_r_proto:$usethreads" in
13664 ":define") d_getnetent_r_proto=define
a48ec845
JH
13665 set d_getnetent_r_proto getnetent_r $hdrs
13666 eval $hasproto ;;
13667 *) ;;
13668 esac
13669 case "$d_getnetent_r_proto" in
13670 define)
10bc17b6
JH
13671 case "$getnetent_r_proto" in
13672 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13673 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13674 esac
13675 case "$getnetent_r_proto" in
13676 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13677 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13678 esac
13679 case "$getnetent_r_proto" in
13680 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13681 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13682 esac
13683 case "$getnetent_r_proto" in
13684 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13685 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13686 esac
13687 case "$getnetent_r_proto" in
13688 ''|0) try='int getnetent_r(struct netent*, char*, int);'
13689 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13690 esac
13691 case "$getnetent_r_proto" in
13692 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13693 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13694 esac
13695 case "$getnetent_r_proto" in
90e831dc 13696 ''|0) d_getnetent_r=undef
10bc17b6 13697 getnetent_r_proto=0
a48ec845 13698 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13699 * ) case "$getnetent_r_proto" in
13700 REENTRANT_PROTO*) ;;
13701 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13702 esac
13703 echo "Prototype: $try" ;;
13704 esac
13705 ;;
c18e646a
JH
13706 *) case "$usethreads" in
13707 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13708 esac
90e831dc
SB
13709 d_getnetent_r=undef
13710 getnetent_r_proto=0
c18e646a 13711 ;;
a48ec845
JH
13712 esac
13713 ;;
10bc17b6
JH
13714*) getnetent_r_proto=0
13715 ;;
13716esac
13717
b4eb6b3d
JH
13718: see if prototypes for various getnetxxx netdb.h functions are available
13719echo " "
13720set d_getnetprotos getnetent $i_netdb netdb.h
13721eval $hasproto
13722
0c0643d0
JH
13723: see if getpagesize exists
13724set getpagesize d_getpagsz
13725eval $inlibc
13726
b4eb6b3d
JH
13727
13728: see if getprotobyname exists
13729set getprotobyname d_getpbyname
13730eval $inlibc
13731
13732: see if getprotobynumber exists
13733set getprotobynumber d_getpbynumber
13734eval $inlibc
13735
13736: see if getprotoent exists
13737set getprotoent d_getpent
13738eval $inlibc
13739
13740: see if getpgid exists
13741set getpgid d_getpgid
13742eval $inlibc
13743
13744: see if getpgrp2 exists
13745set getpgrp2 d_getpgrp2
13746eval $inlibc
13747
13748: see if getppid exists
13749set getppid d_getppid
13750eval $inlibc
13751
13752: see if getpriority exists
13753set getpriority d_getprior
13754eval $inlibc
13755
10bc17b6
JH
13756: see if getprotobyname_r exists
13757set getprotobyname_r d_getprotobyname_r
13758eval $inlibc
13759case "$d_getprotobyname_r" in
13760"$define")
13761 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13762 case "$d_getprotobyname_r_proto:$usethreads" in
13763 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
13764 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13765 eval $hasproto ;;
13766 *) ;;
13767 esac
13768 case "$d_getprotobyname_r_proto" in
13769 define)
10bc17b6
JH
13770 case "$getprotobyname_r_proto" in
13771 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13772 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13773 esac
13774 case "$getprotobyname_r_proto" in
13775 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13776 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13777 esac
13778 case "$getprotobyname_r_proto" in
13779 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13780 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13781 esac
13782 case "$getprotobyname_r_proto" in
90e831dc 13783 ''|0) d_getprotobyname_r=undef
10bc17b6 13784 getprotobyname_r_proto=0
a48ec845 13785 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13786 * ) case "$getprotobyname_r_proto" in
13787 REENTRANT_PROTO*) ;;
13788 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13789 esac
13790 echo "Prototype: $try" ;;
13791 esac
13792 ;;
c18e646a
JH
13793 *) case "$usethreads" in
13794 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13795 esac
90e831dc
SB
13796 d_getprotobyname_r=undef
13797 getprotobyname_r_proto=0
c18e646a 13798 ;;
a48ec845
JH
13799 esac
13800 ;;
10bc17b6
JH
13801*) getprotobyname_r_proto=0
13802 ;;
13803esac
13804
13805: see if getprotobynumber_r exists
13806set getprotobynumber_r d_getprotobynumber_r
13807eval $inlibc
13808case "$d_getprotobynumber_r" in
13809"$define")
13810 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13811 case "$d_getprotobynumber_r_proto:$usethreads" in
13812 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
13813 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13814 eval $hasproto ;;
13815 *) ;;
13816 esac
13817 case "$d_getprotobynumber_r_proto" in
13818 define)
10bc17b6
JH
13819 case "$getprotobynumber_r_proto" in
13820 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13821 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13822 esac
13823 case "$getprotobynumber_r_proto" in
13824 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13825 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13826 esac
13827 case "$getprotobynumber_r_proto" in
13828 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13829 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13830 esac
13831 case "$getprotobynumber_r_proto" in
90e831dc 13832 ''|0) d_getprotobynumber_r=undef
10bc17b6 13833 getprotobynumber_r_proto=0
a48ec845 13834 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13835 * ) case "$getprotobynumber_r_proto" in
13836 REENTRANT_PROTO*) ;;
13837 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13838 esac
13839 echo "Prototype: $try" ;;
13840 esac
13841 ;;
c18e646a
JH
13842 *) case "$usethreads" in
13843 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13844 esac
90e831dc
SB
13845 d_getprotobynumber_r=undef
13846 getprotobynumber_r_proto=0
c18e646a 13847 ;;
a48ec845
JH
13848 esac
13849 ;;
10bc17b6
JH
13850*) getprotobynumber_r_proto=0
13851 ;;
13852esac
13853
13854: see if getprotoent_r exists
13855set getprotoent_r d_getprotoent_r
13856eval $inlibc
13857case "$d_getprotoent_r" in
13858"$define")
13859 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13860 case "$d_getprotoent_r_proto:$usethreads" in
13861 ":define") d_getprotoent_r_proto=define
a48ec845
JH
13862 set d_getprotoent_r_proto getprotoent_r $hdrs
13863 eval $hasproto ;;
13864 *) ;;
13865 esac
13866 case "$d_getprotoent_r_proto" in
13867 define)
10bc17b6
JH
13868 case "$getprotoent_r_proto" in
13869 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13870 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13871 esac
13872 case "$getprotoent_r_proto" in
13873 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13874 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13875 esac
13876 case "$getprotoent_r_proto" in
13877 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13878 ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13879 esac
13880 case "$getprotoent_r_proto" in
13881 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13882 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13883 esac
13884 case "$getprotoent_r_proto" in
90e831dc 13885 ''|0) d_getprotoent_r=undef
10bc17b6 13886 getprotoent_r_proto=0
a48ec845 13887 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13888 * ) case "$getprotoent_r_proto" in
13889 REENTRANT_PROTO*) ;;
13890 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13891 esac
13892 echo "Prototype: $try" ;;
13893 esac
13894 ;;
c18e646a
JH
13895 *) case "$usethreads" in
13896 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13897 esac
90e831dc
SB
13898 d_getprotoent_r=undef
13899 getprotoent_r_proto=0
c18e646a 13900 ;;
a48ec845
JH
13901 esac
13902 ;;
10bc17b6
JH
13903*) getprotoent_r_proto=0
13904 ;;
13905esac
13906
b4eb6b3d
JH
13907: see if prototypes for various getprotoxxx netdb.h functions are available
13908echo " "
13909set d_getprotoprotos getprotoent $i_netdb netdb.h
13910eval $hasproto
13911
13912: see if getprpwnam exists
13913set getprpwnam d_getprpwnam
13914eval $inlibc
13915
13916: see if getpwent exists
13917set getpwent d_getpwent
13918eval $inlibc
13919
10bc17b6
JH
13920: see if getpwent_r exists
13921set getpwent_r d_getpwent_r
13922eval $inlibc
13923case "$d_getpwent_r" in
13924"$define")
13925 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13926 case "$d_getpwent_r_proto:$usethreads" in
13927 ":define") d_getpwent_r_proto=define
a48ec845
JH
13928 set d_getpwent_r_proto getpwent_r $hdrs
13929 eval $hasproto ;;
13930 *) ;;
13931 esac
13932 case "$d_getpwent_r_proto" in
13933 define)
10bc17b6
JH
13934 case "$getpwent_r_proto" in
13935 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13936 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13937 esac
13938 case "$getpwent_r_proto" in
13939 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13940 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13941 esac
13942 case "$getpwent_r_proto" in
13943 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13944 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13945 esac
13946 case "$getpwent_r_proto" in
13947 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13948 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13949 esac
13950 case "$getpwent_r_proto" in
13951 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13952 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13953 esac
13954 case "$getpwent_r_proto" in
13955 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13956 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13957 esac
13958 case "$getpwent_r_proto" in
90e831dc 13959 ''|0) d_getpwent_r=undef
10bc17b6 13960 getpwent_r_proto=0
a48ec845 13961 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13962 * ) case "$getpwent_r_proto" in
13963 REENTRANT_PROTO*) ;;
13964 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13965 esac
13966 echo "Prototype: $try" ;;
13967 esac
13968 ;;
c18e646a
JH
13969 *) case "$usethreads" in
13970 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13971 esac
90e831dc
SB
13972 d_getpwent_r=undef
13973 getpwent_r_proto=0
c18e646a 13974 ;;
a48ec845
JH
13975 esac
13976 ;;
10bc17b6
JH
13977*) getpwent_r_proto=0
13978 ;;
13979esac
13980
13981: see if getpwnam_r exists
13982set getpwnam_r d_getpwnam_r
13983eval $inlibc
13984case "$d_getpwnam_r" in
13985"$define")
13986 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13987 case "$d_getpwnam_r_proto:$usethreads" in
13988 ":define") d_getpwnam_r_proto=define
a48ec845
JH
13989 set d_getpwnam_r_proto getpwnam_r $hdrs
13990 eval $hasproto ;;
13991 *) ;;
13992 esac
13993 case "$d_getpwnam_r_proto" in
13994 define)
10bc17b6
JH
13995 case "$getpwnam_r_proto" in
13996 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13997 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13998 esac
13999 case "$getpwnam_r_proto" in
14000 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14001 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14002 esac
14003 case "$getpwnam_r_proto" in
14004 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14005 ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14006 esac
14007 case "$getpwnam_r_proto" in
14008 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14009 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14010 esac
14011 case "$getpwnam_r_proto" in
90e831dc 14012 ''|0) d_getpwnam_r=undef
10bc17b6 14013 getpwnam_r_proto=0
a48ec845 14014 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14015 * ) case "$getpwnam_r_proto" in
14016 REENTRANT_PROTO*) ;;
14017 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14018 esac
14019 echo "Prototype: $try" ;;
14020 esac
14021 ;;
c18e646a
JH
14022 *) case "$usethreads" in
14023 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14024 esac
90e831dc
SB
14025 d_getpwnam_r=undef
14026 getpwnam_r_proto=0
c18e646a 14027 ;;
a48ec845
JH
14028 esac
14029 ;;
10bc17b6
JH
14030*) getpwnam_r_proto=0
14031 ;;
14032esac
14033
14034: see if getpwuid_r exists
14035set getpwuid_r d_getpwuid_r
14036eval $inlibc
14037case "$d_getpwuid_r" in
14038"$define")
14039 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14040 case "$d_getpwuid_r_proto:$usethreads" in
14041 ":define") d_getpwuid_r_proto=define
a48ec845
JH
14042 set d_getpwuid_r_proto getpwuid_r $hdrs
14043 eval $hasproto ;;
14044 *) ;;
14045 esac
14046 case "$d_getpwuid_r_proto" in
14047 define)
10bc17b6
JH
14048 case "$getpwuid_r_proto" in
14049 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14050 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14051 esac
14052 case "$getpwuid_r_proto" in
14053 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14054 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14055 esac
14056 case "$getpwuid_r_proto" in
14057 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14058 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14059 esac
14060 case "$getpwuid_r_proto" in
14061 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14062 ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14063 esac
14064 case "$getpwuid_r_proto" in
90e831dc 14065 ''|0) d_getpwuid_r=undef
10bc17b6 14066 getpwuid_r_proto=0
a48ec845 14067 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14068 * ) case "$getpwuid_r_proto" in
14069 REENTRANT_PROTO*) ;;
14070 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14071 esac
14072 echo "Prototype: $try" ;;
14073 esac
14074 ;;
c18e646a
JH
14075 *) case "$usethreads" in
14076 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14077 esac
90e831dc
SB
14078 d_getpwuid_r=undef
14079 getpwuid_r_proto=0
c18e646a 14080 ;;
a48ec845
JH
14081 esac
14082 ;;
10bc17b6
JH
14083*) getpwuid_r_proto=0
14084 ;;
14085esac
14086
b4eb6b3d
JH
14087
14088: see if getservbyname exists
14089set getservbyname d_getsbyname
14090eval $inlibc
14091
14092: see if getservbyport exists
14093set getservbyport d_getsbyport
14094eval $inlibc
14095
14096: see if getservent exists
14097set getservent d_getsent
14098eval $inlibc
14099
10bc17b6
JH
14100: see if getservbyname_r exists
14101set getservbyname_r d_getservbyname_r
14102eval $inlibc
14103case "$d_getservbyname_r" in
14104"$define")
14105 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14106 case "$d_getservbyname_r_proto:$usethreads" in
14107 ":define") d_getservbyname_r_proto=define
a48ec845
JH
14108 set d_getservbyname_r_proto getservbyname_r $hdrs
14109 eval $hasproto ;;
14110 *) ;;
14111 esac
14112 case "$d_getservbyname_r_proto" in
14113 define)
10bc17b6
JH
14114 case "$getservbyname_r_proto" in
14115 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14116 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14117 esac
14118 case "$getservbyname_r_proto" in
14119 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14120 ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14121 esac
14122 case "$getservbyname_r_proto" in
14123 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14124 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14125 esac
14126 case "$getservbyname_r_proto" in
90e831dc 14127 ''|0) d_getservbyname_r=undef
10bc17b6 14128 getservbyname_r_proto=0
a48ec845 14129 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14130 * ) case "$getservbyname_r_proto" in
14131 REENTRANT_PROTO*) ;;
14132 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14133 esac
14134 echo "Prototype: $try" ;;
14135 esac
14136 ;;
c18e646a
JH
14137 *) case "$usethreads" in
14138 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14139 esac
90e831dc
SB
14140 d_getservbyname_r=undef
14141 getservbyname_r_proto=0
c18e646a 14142 ;;
a48ec845
JH
14143 esac
14144 ;;
10bc17b6
JH
14145*) getservbyname_r_proto=0
14146 ;;
14147esac
14148
14149: see if getservbyport_r exists
14150set getservbyport_r d_getservbyport_r
14151eval $inlibc
14152case "$d_getservbyport_r" in
14153"$define")
14154 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14155 case "$d_getservbyport_r_proto:$usethreads" in
14156 ":define") d_getservbyport_r_proto=define
a48ec845
JH
14157 set d_getservbyport_r_proto getservbyport_r $hdrs
14158 eval $hasproto ;;
14159 *) ;;
14160 esac
14161 case "$d_getservbyport_r_proto" in
14162 define)
10bc17b6
JH
14163 case "$getservbyport_r_proto" in
14164 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14165 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14166 esac
14167 case "$getservbyport_r_proto" in
14168 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14169 ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14170 esac
14171 case "$getservbyport_r_proto" in
14172 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14173 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14174 esac
14175 case "$getservbyport_r_proto" in
90e831dc 14176 ''|0) d_getservbyport_r=undef
10bc17b6 14177 getservbyport_r_proto=0
a48ec845 14178 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14179 * ) case "$getservbyport_r_proto" in
14180 REENTRANT_PROTO*) ;;
14181 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14182 esac
14183 echo "Prototype: $try" ;;
14184 esac
14185 ;;
c18e646a
JH
14186 *) case "$usethreads" in
14187 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14188 esac
90e831dc
SB
14189 d_getservbyport_r=undef
14190 getservbyport_r_proto=0
c18e646a 14191 ;;
a48ec845
JH
14192 esac
14193 ;;
10bc17b6
JH
14194*) getservbyport_r_proto=0
14195 ;;
14196esac
14197
14198: see if getservent_r exists
14199set getservent_r d_getservent_r
14200eval $inlibc
14201case "$d_getservent_r" in
14202"$define")
14203 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14204 case "$d_getservent_r_proto:$usethreads" in
14205 ":define") d_getservent_r_proto=define
a48ec845
JH
14206 set d_getservent_r_proto getservent_r $hdrs
14207 eval $hasproto ;;
14208 *) ;;
14209 esac
14210 case "$d_getservent_r_proto" in
14211 define)
10bc17b6
JH
14212 case "$getservent_r_proto" in
14213 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14214 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14215 esac
14216 case "$getservent_r_proto" in
14217 ''|0) try='int getservent_r(struct servent*, char*, int);'
14218 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14219 esac
14220 case "$getservent_r_proto" in
14221 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14222 ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14223 esac
14224 case "$getservent_r_proto" in
14225 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14226 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14227 esac
14228 case "$getservent_r_proto" in
90e831dc 14229 ''|0) d_getservent_r=undef
10bc17b6 14230 getservent_r_proto=0
a48ec845 14231 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14232 * ) case "$getservent_r_proto" in
14233 REENTRANT_PROTO*) ;;
14234 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14235 esac
14236 echo "Prototype: $try" ;;
14237 esac
14238 ;;
c18e646a
JH
14239 *) case "$usethreads" in
14240 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14241 esac
90e831dc
SB
14242 d_getservent_r=undef
14243 getservent_r_proto=0
c18e646a 14244 ;;
a48ec845
JH
14245 esac
14246 ;;
10bc17b6
JH
14247*) getservent_r_proto=0
14248 ;;
14249esac
14250
b4eb6b3d
JH
14251: see if prototypes for various getservxxx netdb.h functions are available
14252echo " "
14253set d_getservprotos getservent $i_netdb netdb.h
14254eval $hasproto
14255
14256: see if getspnam exists
14257set getspnam d_getspnam
14258eval $inlibc
14259
10bc17b6
JH
14260: see if this is a shadow.h system
14261set shadow.h i_shadow
14262eval $inhdr
14263
14264: see if getspnam_r exists
14265set getspnam_r d_getspnam_r
14266eval $inlibc
14267case "$d_getspnam_r" in
14268"$define")
14269 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
14270 case "$d_getspnam_r_proto:$usethreads" in
14271 ":define") d_getspnam_r_proto=define
a48ec845
JH
14272 set d_getspnam_r_proto getspnam_r $hdrs
14273 eval $hasproto ;;
14274 *) ;;
14275 esac
14276 case "$d_getspnam_r_proto" in
14277 define)
10bc17b6
JH
14278 case "$getspnam_r_proto" in
14279 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14280 ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14281 esac
14282 case "$getspnam_r_proto" in
14283 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14284 ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14285 esac
14286 case "$getspnam_r_proto" in
90e831dc 14287 ''|0) d_getspnam_r=undef
10bc17b6 14288 getspnam_r_proto=0
a48ec845 14289 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14290 * ) case "$getspnam_r_proto" in
14291 REENTRANT_PROTO*) ;;
14292 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14293 esac
14294 echo "Prototype: $try" ;;
14295 esac
14296 ;;
c18e646a
JH
14297 *) case "$usethreads" in
14298 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14299 esac
90e831dc
SB
14300 d_getspnam_r=undef
14301 getspnam_r_proto=0
c18e646a 14302 ;;
a48ec845
JH
14303 esac
14304 ;;
10bc17b6
JH
14305*) getspnam_r_proto=0
14306 ;;
14307esac
14308
b4eb6b3d
JH
14309: see if gettimeofday or ftime exists
14310set gettimeofday d_gettimeod
14311eval $inlibc
14312case "$d_gettimeod" in
14313"$undef")
14314 set ftime d_ftime
14315 eval $inlibc
14316 ;;
14317*)
14318 val="$undef"; set d_ftime; eval $setvar
14319 ;;
14320esac
14321case "$d_gettimeod$d_ftime" in
14322"$undef$undef")
14323 echo " "
14324 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14325 ;;
14326esac
14327
10bc17b6
JH
14328: see if gmtime_r exists
14329set gmtime_r d_gmtime_r
14330eval $inlibc
14331case "$d_gmtime_r" in
14332"$define")
d63eadf0 14333 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14334 case "$d_gmtime_r_proto:$usethreads" in
14335 ":define") d_gmtime_r_proto=define
a48ec845
JH
14336 set d_gmtime_r_proto gmtime_r $hdrs
14337 eval $hasproto ;;
14338 *) ;;
14339 esac
14340 case "$d_gmtime_r_proto" in
14341 define)
10bc17b6
JH
14342 case "$gmtime_r_proto" in
14343 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14344 ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14345 esac
14346 case "$gmtime_r_proto" in
14347 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14348 ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14349 esac
14350 case "$gmtime_r_proto" in
90e831dc 14351 ''|0) d_gmtime_r=undef
10bc17b6 14352 gmtime_r_proto=0
a48ec845 14353 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14354 * ) case "$gmtime_r_proto" in
14355 REENTRANT_PROTO*) ;;
14356 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14357 esac
14358 echo "Prototype: $try" ;;
14359 esac
b4eb6b3d 14360 ;;
c18e646a
JH
14361 *) case "$usethreads" in
14362 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14363 esac
90e831dc
SB
14364 d_gmtime_r=undef
14365 gmtime_r_proto=0
c18e646a 14366 ;;
a48ec845
JH
14367 esac
14368 ;;
10bc17b6 14369*) gmtime_r_proto=0
b4eb6b3d
JH
14370 ;;
14371esac
14372
14373: see if hasmntopt exists
14374set hasmntopt d_hasmntopt
14375eval $inlibc
14376
14377: see if this is a netinet/in.h or sys/in.h system
14378set netinet/in.h i_niin sys/in.h i_sysin
14379eval $inhdr
14380
14381: see if arpa/inet.h has to be included
14382set arpa/inet.h i_arpainet
14383eval $inhdr
14384
14385: see if htonl --and friends-- exists
14386val=''
14387set htonl val
14388eval $inlibc
14389
14390: Maybe they are macros.
14391case "$val" in
14392$undef)
14393 $cat >htonl.c <<EOM
14394#include <stdio.h>
14395#include <sys/types.h>
14396#$i_niin I_NETINET_IN
14397#$i_sysin I_SYS_IN
14398#$i_arpainet I_ARPA_INET
14399#ifdef I_NETINET_IN
14400#include <netinet/in.h>
14401#endif
14402#ifdef I_SYS_IN
14403#include <sys/in.h>
14404#endif
14405#ifdef I_ARPA_INET
14406#include <arpa/inet.h>
14407#endif
14408#ifdef htonl
14409printf("Defined as a macro.");
14410#endif
14411EOM
14412 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14413 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14414 val="$define"
14415 echo "But it seems to be defined as a macro." >&4
14416 fi
14417 $rm -f htonl.?
14418 ;;
14419esac
14420set d_htonl
14421eval $setvar
14422
36adc09b
JH
14423: see if ilogbl exists
14424set ilogbl d_ilogbl
14425eval $inlibc
14426
b4eb6b3d
JH
14427: index or strchr
14428echo " "
14429if set index val -f; eval $csym; $val; then
14430 if set strchr val -f d_strchr; eval $csym; $val; then
14431 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14432 val="$define"
14433 vali="$undef"
14434 echo "strchr() found." >&4
14435 else
14436 val="$undef"
14437 vali="$define"
14438 echo "index() found." >&4
14439 fi
14440 else
14441 val="$undef"
14442 vali="$define"
8dfa8df9
JH
14443 echo "index() found." >&4
14444 fi
b4eb6b3d 14445else
8dfa8df9
JH
14446 if set strchr val -f d_strchr; eval $csym; $val; then
14447 val="$define"
14448 vali="$undef"
14449 echo "strchr() found." >&4
14450 else
14451 echo "No index() or strchr() found!" >&4
14452 val="$undef"
14453 vali="$undef"
14454 fi
b4eb6b3d 14455fi
8dfa8df9
JH
14456set d_strchr; eval $setvar
14457val="$vali"
14458set d_index; eval $setvar
14459
14460: check whether inet_aton exists
14461set inet_aton d_inetaton
14462eval $inlibc
b4eb6b3d
JH
14463
14464: Look for isascii
14465echo " "
36adc09b 14466$cat >isascii.c <<EOCP
b4eb6b3d
JH
14467#include <stdio.h>
14468#include <ctype.h>
55954f19
JH
14469#$i_stdlib I_STDLIB
14470#ifdef I_STDLIB
14471#include <stdlib.h>
14472#endif
b4eb6b3d
JH
14473int main() {
14474 int c = 'A';
14475 if (isascii(c))
14476 exit(0);
14477 else
14478 exit(1);
14479}
14480EOCP
14481set isascii
14482if eval $compile; then
14483 echo "isascii() found." >&4
14484 val="$define"
14485else
14486 echo "isascii() NOT found." >&4
14487 val="$undef"
14488fi
14489set d_isascii
14490eval $setvar
14491$rm -f isascii*
14492
758a5d79
JH
14493: see if isfinite exists
14494set isfinite d_isfinite
14495eval $inlibc
14496
14497: see if isinf exists
14498set isinf d_isinf
14499eval $inlibc
14500
b4eb6b3d
JH
14501: see if isnan exists
14502set isnan d_isnan
14503eval $inlibc
14504
14505: see if isnanl exists
14506set isnanl d_isnanl
14507eval $inlibc
14508
14509: see if killpg exists
14510set killpg d_killpg
14511eval $inlibc
14512
14513: see if lchown exists
14514echo " "
14515$cat > try.c <<'EOCP'
14516/* System header to define __stub macros and hopefully few prototypes,
14517 which can conflict with char lchown(); below. */
14518#include <assert.h>
14519/* Override any gcc2 internal prototype to avoid an error. */
14520/* We use char because int might match the return type of a gcc2
14521 builtin and then its argument prototype would still apply. */
14522char lchown();
14523int main() {
14524 /* The GNU C library defines this for functions which it implements
14525 to always fail with ENOSYS. Some functions are actually named
14526 something starting with __ and the normal name is an alias. */
14527#if defined (__stub_lchown) || defined (__stub___lchown)
14528choke me
14529#else
14530lchown();
14531#endif
14532; return 0; }
14533EOCP
14534set try
14535if eval $compile; then
14536 $echo "lchown() found." >&4
14537 val="$define"
14538else
14539 $echo "lchown() NOT found." >&4
14540 val="$undef"
14541fi
14542set d_lchown
14543eval $setvar
14544
14545: See if number of significant digits in a double precision number is known
14546echo " "
14547$cat >ldbl_dig.c <<EOM
14548#$i_limits I_LIMITS
14549#$i_float I_FLOAT
14550#ifdef I_LIMITS
14551#include <limits.h>
14552#endif
14553#ifdef I_FLOAT
14554#include <float.h>
14555#endif
14556#ifdef LDBL_DIG
14557printf("Contains LDBL_DIG");
14558#endif
14559EOM
14560$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14561if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14562 echo "LDBL_DIG found." >&4
14563 val="$define"
14564else
14565 echo "LDBL_DIG NOT found." >&4
14566 val="$undef"
14567fi
14568$rm -f ldbl_dig.?
14569set d_ldbl_dig
14570eval $setvar
14571
0a0abfba
MB
14572: see if this is a math.h system
14573set math.h i_math
14574eval $inhdr
14575
14576d_libm_lib_version="$undef"
14577case $i_math in
14578 $define)
14579 : check to see if math.h defines _LIB_VERSION
14580 echo " "
14581 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14582 $cat >try.c <<EOCP
14583#include <unistd.h>
14584#include <math.h>
14585int main (int argc, char *argv[])
14586{
14587 printf ("%d\n", _LIB_VERSION);
14588 return (0);
14589 } /* main */
14590EOCP
14591 set try
14592 if eval $compile; then
14593 foo=`$run ./try`
14594 echo "Yes, it does ($foo)" >&4
14595 d_libm_lib_version="$define"
14596 else
14597 echo "No, it does not (probably harmless)\n" >&4
14598 fi
14599 $rm -f try.* try core core.try.*
14600 ;;
14601
14602 esac
14603
b4eb6b3d
JH
14604: see if link exists
14605set link d_link
14606eval $inlibc
14607
10bc17b6
JH
14608: see if localtime_r exists
14609set localtime_r d_localtime_r
14610eval $inlibc
14611case "$d_localtime_r" in
14612"$define")
d63eadf0 14613 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14614 case "$d_localtime_r_proto:$usethreads" in
14615 ":define") d_localtime_r_proto=define
a48ec845
JH
14616 set d_localtime_r_proto localtime_r $hdrs
14617 eval $hasproto ;;
14618 *) ;;
14619 esac
14620 case "$d_localtime_r_proto" in
14621 define)
10bc17b6
JH
14622 case "$localtime_r_proto" in
14623 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14624 ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14625 esac
14626 case "$localtime_r_proto" in
14627 ''|0) try='int localtime_r(const time_t*, struct tm*);'
14628 ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14629 esac
14630 case "$localtime_r_proto" in
90e831dc 14631 ''|0) d_localtime_r=undef
10bc17b6 14632 localtime_r_proto=0
a48ec845 14633 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14634 * ) case "$localtime_r_proto" in
14635 REENTRANT_PROTO*) ;;
14636 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14637 esac
14638 echo "Prototype: $try" ;;
14639 esac
14640 ;;
c18e646a
JH
14641 *) case "$usethreads" in
14642 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14643 esac
90e831dc
SB
14644 d_localtime_r=undef
14645 localtime_r_proto=0
c18e646a 14646 ;;
a48ec845
JH
14647 esac
14648 ;;
10bc17b6
JH
14649*) localtime_r_proto=0
14650 ;;
14651esac
14652
8572b25d
BH
14653: see if localtime_r calls tzset
14654case "$localtime_r_proto" in
14655REENTRANT_PROTO*)
14656 $cat >try.c <<EOCP
14657/* Does our libc's localtime_r call tzset ?
14658 * return 0 if so, 1 otherwise.
14659 */
14660#include <sys/types.h>
14661#include <unistd.h>
14662#include <time.h>
14663#include <string.h>
14664#include <malloc.h>
14665int main()
14666{
14667 time_t t = time(0L);
14668 char w_tz[]="TZ" "=GMT+5",
14669 e_tz[]="TZ" "=GMT-5",
14670 *tz_e = (char*)malloc(16),
14671 *tz_w = (char*)malloc(16);
14672 struct tm tm_e, tm_w;
14673 memset(&tm_e,'\0',sizeof(struct tm));
14674 memset(&tm_w,'\0',sizeof(struct tm));
14675 strcpy(tz_e,e_tz);
14676 strcpy(tz_w,w_tz);
14677
14678 putenv(tz_e);
14679 localtime_r(&t, &tm_e);
14680
14681 putenv(tz_w);
14682 localtime_r(&t, &tm_w);
14683
14684 if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14685 return 1;
14686 return 0;
14687}
14688EOCP
14689 set try
14690 if eval $compile; then
14691 if ./try; then
14692 d_localtime_r_needs_tzset=undef;
14693 else
14694 d_localtime_r_needs_tzset=define;
14695 fi;
14696 else
14697 d_localtime_r_needs_tzset=undef;
14698 fi;
14699 ;;
14700 *)
14701 d_localtime_r_needs_tzset=undef;
14702 ;;
14703esac
14704$rm -f try try.* core
14705
b4eb6b3d
JH
14706: see if localeconv exists
14707set localeconv d_locconv
14708eval $inlibc
14709
14710: see if lockf exists
14711set lockf d_lockf
14712eval $inlibc
14713
b4eb6b3d
JH
14714: see if prototype for lseek is available
14715echo " "
4786929f 14716set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
14717eval $hasproto
14718
14719: see if lstat exists
14720set lstat d_lstat
14721eval $inlibc
14722
14723: see if madvise exists
14724set madvise d_madvise
14725eval $inlibc
14726
7dd121ae
MB
14727: see if malloc_size exists
14728set malloc_size d_malloc_size
14729eval $inlibc
14730
14731: see if malloc_size_good exists
14732set malloc_good_size d_malloc_good_size
14733eval $inlibc
14734
b4eb6b3d
JH
14735: see if mblen exists
14736set mblen d_mblen
14737eval $inlibc
14738
14739: see if mbstowcs exists
14740set mbstowcs d_mbstowcs
14741eval $inlibc
14742
14743: see if mbtowc exists
14744set mbtowc d_mbtowc
14745eval $inlibc
14746
14747: see if memchr exists
14748set memchr d_memchr
14749eval $inlibc
14750
14751: see if memcmp exists
14752set memcmp d_memcmp
14753eval $inlibc
14754
14755: see if memcpy exists
14756set memcpy d_memcpy
14757eval $inlibc
14758
14759: see if memmove exists
14760set memmove d_memmove
14761eval $inlibc
14762
14763: see if memset exists
14764set memset d_memset
14765eval $inlibc
14766
14767: see if mkdir exists
14768set mkdir d_mkdir
14769eval $inlibc
14770
14771: see if mkdtemp exists
14772set mkdtemp d_mkdtemp
14773eval $inlibc
14774
14775: see if mkfifo exists
14776set mkfifo d_mkfifo
14777eval $inlibc
14778
14779: see if mkstemp exists
14780set mkstemp d_mkstemp
14781eval $inlibc
14782
14783: see if mkstemps exists
14784set mkstemps d_mkstemps
14785eval $inlibc
14786
14787: see if mktime exists
14788set mktime d_mktime
14789eval $inlibc
14790
14791: see if this is a sys/mman.h system
14792set sys/mman.h i_sysmman
14793eval $inhdr
14794
14795: see if mmap exists
14796set mmap d_mmap
14797eval $inlibc
14798: see what shmat returns
14799: default to something harmless
14800mmaptype='void *'
14801case "$i_sysmman$d_mmap" in
14802"$define$define")
14803 $cat >mmap.c <<'END'
14804#include <sys/mman.h>
14805void *mmap();
14806END
14807 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14808 mmaptype='void *'
14809 else
14810 mmaptype='caddr_t'
14811 fi
14812 echo "and it returns ($mmaptype)." >&4
14813 ;;
14814esac
14815
14816
14817
89ce900e
JH
14818: see if sqrtl exists
14819set sqrtl d_sqrtl
14820eval $inlibc
14821
af1ff193
JH
14822: see if scalbnl exists
14823set scalbnl d_scalbnl
14824eval $inlibc
14825
89ce900e
JH
14826: see if modfl exists
14827set modfl d_modfl
14828eval $inlibc
14829
14830: see if prototype for modfl is available
14831echo " "
3a794506 14832set d_modflproto modfl $i_math math.h
89ce900e
JH
14833eval $hasproto
14834
14835d_modfl_pow32_bug="$undef"
14836
14837case "$d_longdbl$d_modfl" in
14838$define$define)
14839 $cat <<EOM
14840Checking to see whether your modfl() is okay for large values...
14841EOM
14842$cat >try.c <<EOCP
14843#include <math.h>
14844#include <stdio.h>
14845EOCP
14846if $test "X$d_modflproto" != "X$define"; then
14847 $cat >>try.c <<EOCP
14848/* Sigh. many current glibcs provide the function, but do not prototype it. */
14849long double modfl (long double, long double *);
14850EOCP
14851fi
14852$cat >>try.c <<EOCP
14853int main() {
14854 long double nv = 4294967303.15;
14855 long double v, w;
14856 v = modfl(nv, &w);
14857#ifdef __GLIBC__
14858 printf("glibc");
14859#endif
14860 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14861 return 0;
14862}
14863EOCP
14864 case "$osname:$gccversion" in
14865 aix:) saveccflags="$ccflags"
14866 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14867 esac
14868 set try
14869 if eval $compile; then
14870 foo=`$run ./try`
14871 case "$foo" in
14872 *" 4294967303.150000 1.150000 4294967302.000000")
14873 echo >&4 "Your modfl() is broken for large values."
14874 d_modfl_pow32_bug="$define"
14875 case "$foo" in
14876 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14877 ;;
14878 esac
14879 ;;
14880 *" 4294967303.150000 0.150000 4294967303.000000")
14881 echo >&4 "Your modfl() seems okay for large values."
14882 ;;
14883 *) echo >&4 "I don't understand your modfl() at all."
14884 d_modfl="$undef"
14885 ;;
14886 esac
14887 $rm -f try.* try core core.try.*
14888 else
14889 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14890 d_modfl="$undef"
14891 fi
14892 case "$osname:$gccversion" in
14893 aix:) ccflags="$saveccflags" ;; # restore
14894 esac
14895 ;;
14896esac
14897
14898if $test "$uselongdouble" = "$define"; then
af1ff193
JH
14899 message=""
14900 if $test "$d_sqrtl" != "$define"; then
14901 message="$message sqrtl"
14902 fi
14903 if $test "$d_modfl" != "$define"; then
89ce900e
JH
14904 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14905 echo "You have both aintl and copysignl, so I can emulate modfl."
14906 else
af1ff193 14907 message="$message modfl"
89ce900e 14908 fi
af1ff193
JH
14909 fi
14910 if $test "$d_frexpl" != "$define"; then
14911 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14912 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14913 else
14914 message="$message frexpl"
14915 fi
14916 fi
89ce900e 14917
af1ff193 14918 if $test "$message" != ""; then
89ce900e
JH
14919 $cat <<EOM >&4
14920
14921*** You requested the use of long doubles but you do not seem to have
af1ff193
JH
14922*** the following mathematical functions needed for long double support:
14923*** $message
fe63a0b4
JH
14924*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14925*** Cannot continue, aborting.
89ce900e
JH
14926
14927EOM
14928
fe63a0b4 14929 exit 1
89ce900e
JH
14930 fi
14931fi
14932
b4eb6b3d
JH
14933: see if mprotect exists
14934set mprotect d_mprotect
14935eval $inlibc
14936
14937: see if msgctl exists
14938set msgctl d_msgctl
14939eval $inlibc
14940
14941: see if msgget exists
14942set msgget d_msgget
14943eval $inlibc
14944
14945: see if msgsnd exists
14946set msgsnd d_msgsnd
14947eval $inlibc
14948
14949: see if msgrcv exists
14950set msgrcv d_msgrcv
14951eval $inlibc
14952
14953: see how much of the 'msg*(2)' library is present.
14954h_msg=true
14955echo " "
14956case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14957*"$undef"*) h_msg=false;;
14958esac
14959case "$osname" in
14960freebsd)
14961 case "`ipcs 2>&1`" in
14962 "SVID messages"*"not configured"*)
14963 echo "Your $osname does not have the msg*(2) configured." >&4
14964 h_msg=false
14965 val="$undef"
14966 set msgctl d_msgctl
14967 eval $setvar
14968 set msgget d_msgget
14969 eval $setvar
14970 set msgsnd d_msgsnd
14971 eval $setvar
14972 set msgrcv d_msgrcv
14973 eval $setvar
14974 ;;
14975 esac
14976 ;;
14977esac
14978: we could also check for sys/ipc.h ...
14979if $h_msg && $test `./findhdr sys/msg.h`; then
14980 echo "You have the full msg*(2) library." >&4
14981 val="$define"
14982else
14983 echo "You don't have the full msg*(2) library." >&4
14984 val="$undef"
14985fi
14986set d_msg
14987eval $setvar
14988
4e0554ec
JH
14989
14990echo " "
14991echo "Checking to see if your system supports struct msghdr..." >&4
14992set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14993eval $hasstruct
14994case "$d_msghdr_s" in
14995"$define") echo "Yes, it does." ;;
14996*) echo "No, it doesn't." ;;
14997esac
14998
14999
b4eb6b3d
JH
15000: see if msync exists
15001set msync d_msync
15002eval $inlibc
15003
15004: see if munmap exists
15005set munmap d_munmap
15006eval $inlibc
15007
15008: see if nice exists
15009set nice d_nice
15010eval $inlibc
15011
2765b840
JH
15012: see if this is a langinfo.h system
15013set langinfo.h i_langinfo
15014eval $inhdr
15015
15016: see if nl_langinfo exists
15017set nl_langinfo d_nl_langinfo
15018eval $inlibc
15019
b4eb6b3d
JH
15020: check for length of character
15021echo " "
15022case "$charsize" in
15023'')
15024 echo "Checking to see how big your characters are (hey, you never know)..." >&4
74d00865 15025 $cat >try.c <<EOCP
b4eb6b3d 15026#include <stdio.h>
d1daaddf
JH
15027#$i_stdlib I_STDLIB
15028#ifdef I_STDLIB
15029#include <stdlib.h>
15030#endif
b4eb6b3d
JH
15031int main()
15032{
15033 printf("%d\n", (int)sizeof(char));
15034 exit(0);
15035}
15036EOCP
15037 set try
15038 if eval $compile_ok; then
5440bc8e 15039 dflt=`$run ./try`
b4eb6b3d
JH
15040 else
15041 dflt='1'
15042 echo "(I can't seem to compile the test program. Guessing...)"
15043 fi
15044 ;;
15045*)
15046 dflt="$charsize"
15047 ;;
15048esac
15049rp="What is the size of a character (in bytes)?"
15050. ./myread
15051charsize="$ans"
15052$rm -f try.c try
15053
1d1be0dc
NC
15054: check for volatile keyword
15055echo " "
15056echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15057$cat >try.c <<'EOCP'
76f47787 15058int main()
1d1be0dc
NC
15059{
15060 typedef struct _goo_struct goo_struct;
15061 goo_struct * volatile goo = ((goo_struct *)0);
15062 struct _goo_struct {
15063 long long_int;
15064 int reg_int;
15065 char char_var;
15066 };
15067 typedef unsigned short foo_t;
15068 char *volatile foo;
15069 volatile int bar;
15070 volatile foo_t blech;
15071 foo = foo;
15072}
15073EOCP
15074if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15075 val="$define"
15076 echo "Yup, it does."
15077else
15078 val="$undef"
15079 echo "Nope, it doesn't."
15080fi
15081set d_volatile
15082eval $setvar
15083$rm -f try.*
15084
b4eb6b3d
JH
15085
15086echo " "
15087$echo "Choosing the C types to be used for Perl's internal types..." >&4
15088
15089case "$use64bitint:$d_quad:$quadtype" in
15090define:define:?*)
15091 ivtype="$quadtype"
15092 uvtype="$uquadtype"
15093 ivsize=8
15094 uvsize=8
15095 ;;
15096*) ivtype="long"
15097 uvtype="unsigned long"
15098 ivsize=$longsize
15099 uvsize=$longsize
15100 ;;
15101esac
15102
15103case "$uselongdouble:$d_longdbl" in
15104define:define)
15105 nvtype="long double"
15106 nvsize=$longdblsize
15107 ;;
15108*) nvtype=double
15109 nvsize=$doublesize
15110 ;;
15111esac
15112
15113$echo "(IV will be "$ivtype", $ivsize bytes)"
15114$echo "(UV will be "$uvtype", $uvsize bytes)"
15115$echo "(NV will be "$nvtype", $nvsize bytes)"
15116
15117$cat >try.c <<EOCP
15118#$i_inttypes I_INTTYPES
15119#ifdef I_INTTYPES
15120#include <inttypes.h>
15121#endif
15122#include <stdio.h>
15123int main() {
15124#ifdef INT8
15125 int8_t i = INT8_MAX;
15126 uint8_t u = UINT8_MAX;
15127 printf("int8_t\n");
15128#endif
15129#ifdef INT16
15130 int16_t i = INT16_MAX;
15131 uint16_t i = UINT16_MAX;
15132 printf("int16_t\n");
15133#endif
15134#ifdef INT32
15135 int32_t i = INT32_MAX;
15136 uint32_t u = UINT32_MAX;
15137 printf("int32_t\n");
15138#endif
15139}
15140EOCP
15141
15142case "$i8type" in
15143'') case "$charsize" in
15144 1) i8type=char
15145 u8type="unsigned char"
15146 i8size=$charsize
15147 u8size=$charsize
15148 ;;
15149 esac
15150 ;;
15151esac
15152case "$i8type" in
15153'') set try -DINT8
15154 if eval $compile; then
5440bc8e 15155 case "`$run ./try`" in
b4eb6b3d
JH
15156 int8_t) i8type=int8_t
15157 u8type=uint8_t
15158 i8size=1
15159 u8size=1
15160 ;;
15161 esac
15162 fi
15163 ;;
15164esac
15165case "$i8type" in
15166'') if $test $charsize -ge 1; then
15167 i8type=char
15168 u8type="unsigned char"
15169 i8size=$charsize
15170 u8size=$charsize
15171 fi
15172 ;;
15173esac
15174
15175case "$i16type" in
15176'') case "$shortsize" in
15177 2) i16type=short
15178 u16type="unsigned short"
15179 i16size=$shortsize
15180 u16size=$shortsize
15181 ;;
15182 esac
15183 ;;
15184esac
15185case "$i16type" in
15186'') set try -DINT16
15187 if eval $compile; then
5440bc8e 15188 case "`$run ./try`" in
b4eb6b3d
JH
15189 int16_t)
15190 i16type=int16_t
15191 u16type=uint16_t
15192 i16size=2
15193 u16size=2
15194 ;;
15195 esac
15196 fi
15197 ;;
15198esac
15199case "$i16type" in
15200'') if $test $shortsize -ge 2; then
15201 i16type=short
15202 u16type="unsigned short"
15203 i16size=$shortsize
15204 u16size=$shortsize
15205 fi
15206 ;;
15207esac
15208
15209case "$i32type" in
15210'') case "$longsize" in
15211 4) i32type=long
15212 u32type="unsigned long"
15213 i32size=$longsize
15214 u32size=$longsize
15215 ;;
15216 *) case "$intsize" in
15217 4) i32type=int
15218 u32type="unsigned int"
15219 i32size=$intsize
15220 u32size=$intsize
15221 ;;
15222 esac
15223 ;;
15224 esac
15225 ;;
15226esac
15227case "$i32type" in
15228'') set try -DINT32
15229 if eval $compile; then
5440bc8e 15230 case "`$run ./try`" in
b4eb6b3d
JH
15231 int32_t)
15232 i32type=int32_t
15233 u32type=uint32_t
15234 i32size=4
15235 u32size=4
15236 ;;
15237 esac
15238 fi
15239 ;;
15240esac
15241case "$i32type" in
15242'') if $test $intsize -ge 4; then
15243 i32type=int
15244 u32type="unsigned int"
15245 i32size=$intsize
15246 u32size=$intsize
15247 fi
15248 ;;
15249esac
15250
15251case "$i64type" in
15252'') case "$d_quad:$quadtype" in
15253 define:?*)
15254 i64type="$quadtype"
15255 u64type="$uquadtype"
15256 i64size=8
15257 u64size=8
15258 ;;
15259 esac
15260 ;;
15261esac
15262
1d1be0dc
NC
15263$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15264: volatile so that the compiler has to store it out to memory.
15265if test X"$d_volatile" = X"$define"; then
15266 volatile=volatile
15267fi
b4eb6b3d
JH
15268$cat <<EOP >try.c
15269#include <stdio.h>
55954f19
JH
15270#$i_stdlib I_STDLIB
15271#ifdef I_STDLIB
15272#include <stdlib.h>
15273#endif
1d1be0dc
NC
15274#include <sys/types.h>
15275#include <signal.h>
15276#ifdef SIGFPE
15277$volatile int bletched = 0;
7090f861 15278$signal_t blech(int s) { bletched = 1; }
1d1be0dc 15279#endif
b4eb6b3d
JH
15280int main() {
15281 $uvtype u = 0;
1d1be0dc 15282 $nvtype d;
b4eb6b3d
JH
15283 int n = 8 * $uvsize;
15284 int i;
1d1be0dc
NC
15285#ifdef SIGFPE
15286 signal(SIGFPE, blech);
15287#endif
15288
b4eb6b3d
JH
15289 for (i = 0; i < n; i++) {
15290 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
15291 d = ($nvtype)u;
15292 if (($uvtype)d != u)
b4eb6b3d 15293 break;
1d1be0dc
NC
15294 if (d <= 0)
15295 break;
15296 d = ($nvtype)(u - 1);
15297 if (($uvtype)d != (u - 1))
15298 break;
15299#ifdef SIGFPE
15300 if (bletched) {
15301 break;
15302#endif
15303 }
b4eb6b3d 15304 }
efd1522b 15305 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
15306 exit(0);
15307}
15308EOP
1d1be0dc
NC
15309set try
15310
15311d_nv_preserves_uv="$undef"
15312if eval $compile; then
53133ed1 15313 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 15314fi
53133ed1 15315case "$nv_preserves_uv_bits" in
1d1be0dc 15316\-[1-9]*)
53133ed1
NC
15317 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15318 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 15319 d_nv_preserves_uv="$define"
b4eb6b3d 15320 ;;
53133ed1 15321[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
15322 d_nv_preserves_uv="$undef" ;;
15323*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
53133ed1 15324 nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
15325esac
15326
1d1be0dc
NC
15327$rm -f try.* try
15328
f607920a
CB
15329$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15330: volatile so that the compiler has to store it out to memory.
15331if test X"$d_volatile" = X"$define"; then
15332 volatile=volatile
15333fi
15334$cat <<EOP >try.c
15335#include <stdio.h>
15336#$i_stdlib I_STDLIB
15337#ifdef I_STDLIB
15338#include <stdlib.h>
15339#endif
15340#$i_string I_STRING
15341#ifdef I_STRING
15342# include <string.h>
15343#else
15344# include <strings.h>
15345#endif
15346#include <sys/types.h>
15347#include <signal.h>
15348#ifdef SIGFPE
15349$volatile int bletched = 0;
7090f861 15350$signal_t blech(int s) { bletched = 1; }
f607920a
CB
15351#endif
15352
15353int checkit($nvtype d, char *where) {
15354 unsigned char *p = (char *)&d;
15355 unsigned char *end = p + sizeof(d);
15356 int fail = 0;
15357
15358 while (p < end)
15359 fail += *p++;
15360
15361 if (!fail)
17f6277d 15362 return 0;
f607920a
CB
15363
15364 p = (char *)&d;
15365 printf("No - %s: 0x", where);
15366 while (p < end)
15367 printf ("%02X", *p++);
15368 printf("\n");
15369 return 1;
15370}
15371
15372int main(int argc, char **argv) {
15373 $nvtype d = 0.0;
15374 int fail = 0;
15375 fail += checkit(d, "0.0");
15376
15377 /* The compiler shouldn't be assuming that bletched is 0 */
15378 d = bletched;
15379
15380 fail += checkit(d, "bleched");
15381
15382#ifdef SIGFPE
15383 signal(SIGFPE, blech);
15384#endif
15385
15386 /* Paranoia - the compiler should have no way of knowing that ANSI says
15387 that argv[argc] will always be NULL. Actually, if it did assume this it
15388 would be buggy, as this is C and main() can be called from elsewhere in
15389 the program. */
15390 d = argv[argc] ? 1 : 0;
15391
15392 if (d) {
15393 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15394 }
15395
15396 fail += checkit(d, "ternary");
15397
15398 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15399
15400 if (d != 0.0) {
15401 printf("No - memset doesn't give 0.0\n");
15402 /* This might just blow up: */
15403 printf("(gives %g)\n", d);
15404 return 1;
15405 }
15406
15407#ifdef SIGFPE
15408 if (bletched) {
15409 printf("No - something bleched\n");
15410 return 1;
15411 }
15412#endif
15413 if (fail) {
15414 printf("No - %d fail(s)\n", fail);
15415 return 1;
15416 }
15417 printf("Yes\n");
15418 return 0;
15419}
15420EOP
15421set try
15422
15423d_nv_zero_is_allbits_zero="$undef"
15424if eval $compile; then
15425 xxx="`$run ./try`"
15426 case "$?" in
15427 0)
15428 case "$xxx" in
15429 Yes) cat >&4 <<EOM
154300.0 is represented as all bits zero in memory
15431EOM
15432 d_nv_zero_is_allbits_zero="$define"
15433 ;;
15434 *) cat >&4 <<EOM
154350.0 is not represented as all bits zero in memory
15436EOM
15437 d_nv_zero_is_allbits_zero="$undef"
15438 ;;
15439 esac
15440 ;;
15441 *) cat >&4 <<EOM
154420.0 is not represented as all bits zero in memory
15443EOM
15444 d_nv_zero_is_allbits_zero="$undef"
15445 ;;
15446 esac
15447fi
15448
15449$rm -f try.* try
15450
b4eb6b3d
JH
15451
15452: check for off64_t
15453echo " "
15454echo "Checking to see if you have off64_t..." >&4
15455$cat >try.c <<EOCP
15456#include <sys/types.h>
15457#include <unistd.h>
15458int main() { off64_t x = 7; }
15459EOCP
15460set try
15461if eval $compile; then
15462 val="$define"
15463 echo "You have off64_t."
15464else
15465 val="$undef"
15466 echo "You do not have off64_t."
15467 case "$lseeksize" in
15468 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15469 esac
15470fi
15471$rm -f try.* try
15472set d_off64_t
15473eval $setvar
15474
b4eb6b3d
JH
15475: how to create joinable pthreads
15476if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15477 echo " "
15478 echo "Checking what constant to use for creating joinable pthreads..." >&4
15479 $cat >try.c <<'EOCP'
15480#include <pthread.h>
15481int main() {
15482 int detachstate = JOINABLE;
15483}
15484EOCP
15485 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15486 if eval $compile; then
15487 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15488 val="$undef" # Yes, undef.
15489 set d_old_pthread_create_joinable
15490 eval $setvar
15491 val=""
15492 set old_pthread_create_joinable
15493 eval $setvar
15494 else
15495 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15496 if eval $compile; then
15497 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15498 val="$define"
15499 set d_old_pthread_create_joinable
15500 eval $setvar
15501 val=PTHREAD_CREATE_UNDETACHED
15502 set old_pthread_create_joinable
15503 eval $setvar
15504 else
15505 set try -DJOINABLE=__UNDETACHED
15506 if eval $compile; then
15507 echo "You seem to use __UNDETACHED." >&4
15508 val="$define"
15509 set d_old_pthread_create_joinable
15510 eval $setvar
15511 val=__UNDETACHED
15512 set old_pthread_create_joinable
15513 eval $setvar
15514 else
15515 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
15516 val="$define"
15517 set d_old_pthread_create_joinable
15518 eval $setvar
15519 val=0
15520 set old_pthread_create_joinable
15521 eval $setvar
15522 fi
15523 fi
15524 fi
15525 $rm -f try try.*
15526else
15527 d_old_pthread_create_joinable="$undef"
15528 old_pthread_create_joinable=""
15529fi
15530
15531: see if pause exists
15532set pause d_pause
15533eval $inlibc
15534
15535: see if pipe exists
15536set pipe d_pipe
15537eval $inlibc
15538
15539: see if poll exists
15540set poll d_poll
15541eval $inlibc
15542
c7aff470
NIS
15543: see if readlink exists
15544set readlink d_readlink
15545eval $inlibc
15546
15547echo " "
f24dbf84 15548procselfexe=''
c7aff470 15549val="$undef"
a33c94aa
JH
15550case "$d_readlink" in
15551"$define")
c7aff470
NIS
15552 if $issymlink /proc/self/exe ; then
15553 $ls -l /proc/self/exe > reflect
51660ed5 15554 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 15555 echo "You have Linux-like /proc/self/exe."
92236451 15556 procselfexe='"/proc/self/exe"'
f24dbf84 15557 val="$define"
f24dbf84
JH
15558 fi
15559 fi
15560 if $issymlink /proc/curproc/file ; then
15561 $ls -l /proc/curproc/file > reflect
15562 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15563 echo "You have BSD-like /proc/curproc/file."
92236451 15564 procselfexe='"/proc/curproc/file"'
f24dbf84 15565 val="$define"
c7aff470 15566 fi
c7aff470 15567 fi
a33c94aa
JH
15568 ;;
15569esac
428dc699 15570$rm -f reflect
c7aff470
NIS
15571set d_procselfexe
15572eval $setvar
15573
263fee3f
JH
15574: see whether the pthread_atfork exists
15575$cat >try.c <<EOP
15576#include <pthread.h>
15577#include <stdio.h>
15578int main() {
15579#ifdef PTHREAD_ATFORK
15580 pthread_atfork(NULL,NULL,NULL);
15581#endif
15582}
15583EOP
15584
d6483fcc 15585: see if pthread_atfork exists
263fee3f
JH
15586set try -DPTHREAD_ATFORK
15587if eval $compile; then
15588 val="$define"
15589else
15590 val="$undef"
15591fi
15592case "$usethreads" in
15593$define)
15594 case "$val" in
15595 $define) echo 'pthread_atfork found.' >&4 ;;
15596 *) echo 'pthread_atfork NOT found.' >&4 ;;
15597 esac
15598esac
15599set d_pthread_atfork
15600eval $setvar
d6483fcc 15601
58d975c3
JH
15602: see if pthread_attr_setscope exists
15603set pthread_attr_setscope d_pthread_attr_setscope
15604eval $inlibc
15605
b4eb6b3d
JH
15606
15607: see whether the various POSIXish _yields exist
15608$cat >try.c <<EOP
15609#include <pthread.h>
15610#include <stdio.h>
15611int main() {
15612#ifdef SCHED_YIELD
15613 sched_yield();
15614#else
15615#ifdef PTHREAD_YIELD
15616 pthread_yield();
15617#else
15618#ifdef PTHREAD_YIELD_NULL
15619 pthread_yield(NULL);
15620#endif
15621#endif
15622#endif
15623}
15624EOP
15625: see if sched_yield exists
15626set try -DSCHED_YIELD
15627if eval $compile; then
15628 val="$define"
15629 sched_yield='sched_yield()'
15630else
15631 val="$undef"
15632fi
15633case "$usethreads" in
15634$define)
15635 case "$val" in
15636 $define) echo 'sched_yield() found.' >&4 ;;
15637 *) echo 'sched_yield() NOT found.' >&4 ;;
15638 esac
15639esac
10bc17b6
JH
15640set d_sched_yield
15641eval $setvar
b4eb6b3d 15642
10bc17b6
JH
15643: see if pthread_yield exists
15644set try -DPTHREAD_YIELD
15645if eval $compile; then
15646 val="$define"
15647 case "$sched_yield" in
15648 '') sched_yield='pthread_yield()' ;;
15649 esac
15650else
15651 set try -DPTHREAD_YIELD_NULL
15652 if eval $compile; then
15653 val="$define"
15654 case "$sched_yield" in
15655 '') sched_yield='pthread_yield(NULL)' ;;
15656 esac
15657 else
15658 val="$undef"
15659 fi
15660fi
15661case "$usethreads" in
15662$define)
15663 case "$val" in
15664 $define) echo 'pthread_yield() found.' >&4 ;;
15665 *) echo 'pthread_yield() NOT found.' >&4 ;;
15666 esac
15667 ;;
15668esac
15669set d_pthread_yield
15670eval $setvar
b4eb6b3d 15671
10bc17b6
JH
15672case "$sched_yield" in
15673'') sched_yield=undef ;;
15674esac
b4eb6b3d 15675
10bc17b6
JH
15676$rm -f try try.*
15677
15678: see if random_r exists
15679set random_r d_random_r
15680eval $inlibc
15681case "$d_random_r" in
15682"$define")
15683 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
15684 case "$d_random_r_proto:$usethreads" in
15685 ":define") d_random_r_proto=define
a48ec845
JH
15686 set d_random_r_proto random_r $hdrs
15687 eval $hasproto ;;
15688 *) ;;
15689 esac
15690 case "$d_random_r_proto" in
15691 define)
10bc17b6
JH
15692 case "$random_r_proto" in
15693 ''|0) try='int random_r(int*, struct random_data*);'
a845a0d4
JH
15694 ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15695 esac
15696 case "$random_r_proto" in
15697 ''|0) try='int random_r(long*, struct random_data*);'
15698 ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15699 esac
15700 case "$random_r_proto" in
15701 ''|0) try='int random_r(struct random_data*, int32_t*);'
15702 ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
15703 esac
15704 case "$random_r_proto" in
90e831dc 15705 ''|0) d_random_r=undef
10bc17b6 15706 random_r_proto=0
a48ec845 15707 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15708 * ) case "$random_r_proto" in
15709 REENTRANT_PROTO*) ;;
15710 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15711 esac
15712 echo "Prototype: $try" ;;
15713 esac
b4eb6b3d 15714 ;;
c18e646a
JH
15715 *) case "$usethreads" in
15716 define) echo "random_r has no prototype, not using it." >&4 ;;
15717 esac
90e831dc
SB
15718 d_random_r=undef
15719 random_r_proto=0
c18e646a 15720 ;;
a48ec845
JH
15721 esac
15722 ;;
10bc17b6 15723*) random_r_proto=0
b4eb6b3d
JH
15724 ;;
15725esac
15726
15727: see if readdir and friends exist
15728set readdir d_readdir
15729eval $inlibc
15730set seekdir d_seekdir
15731eval $inlibc
15732set telldir d_telldir
15733eval $inlibc
15734set rewinddir d_rewinddir
15735eval $inlibc
15736
10bc17b6
JH
15737: see if readdir64_r exists
15738set readdir64_r d_readdir64_r
15739eval $inlibc
15740case "$d_readdir64_r" in
15741"$define")
15742 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15743 case "$d_readdir64_r_proto:$usethreads" in
15744 ":define") d_readdir64_r_proto=define
a48ec845
JH
15745 set d_readdir64_r_proto readdir64_r $hdrs
15746 eval $hasproto ;;
15747 *) ;;
15748 esac
15749 case "$d_readdir64_r_proto" in
15750 define)
10bc17b6
JH
15751 case "$readdir64_r_proto" in
15752 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15753 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15754 esac
15755 case "$readdir64_r_proto" in
15756 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15757 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15758 esac
15759 case "$readdir64_r_proto" in
90e831dc 15760 ''|0) d_readdir64_r=undef
10bc17b6 15761 readdir64_r_proto=0
a48ec845 15762 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15763 * ) case "$readdir64_r_proto" in
15764 REENTRANT_PROTO*) ;;
15765 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15766 esac
15767 echo "Prototype: $try" ;;
15768 esac
15769 ;;
c18e646a
JH
15770 *) case "$usethreads" in
15771 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15772 esac
90e831dc
SB
15773 d_readdir64_r=undef
15774 readdir64_r_proto=0
c18e646a 15775 ;;
a48ec845
JH
15776 esac
15777 ;;
10bc17b6
JH
15778*) readdir64_r_proto=0
15779 ;;
15780esac
15781
15782: see if readdir_r exists
15783set readdir_r d_readdir_r
15784eval $inlibc
15785case "$d_readdir_r" in
15786"$define")
15787 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15788 case "$d_readdir_r_proto:$usethreads" in
15789 ":define") d_readdir_r_proto=define
a48ec845
JH
15790 set d_readdir_r_proto readdir_r $hdrs
15791 eval $hasproto ;;
15792 *) ;;
15793 esac
15794 case "$d_readdir_r_proto" in
15795 define)
10bc17b6
JH
15796 case "$readdir_r_proto" in
15797 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15798 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15799 esac
15800 case "$readdir_r_proto" in
15801 ''|0) try='int readdir_r(DIR*, struct dirent*);'
15802 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15803 esac
15804 case "$readdir_r_proto" in
90e831dc 15805 ''|0) d_readdir_r=undef
10bc17b6 15806 readdir_r_proto=0
a48ec845 15807 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15808 * ) case "$readdir_r_proto" in
15809 REENTRANT_PROTO*) ;;
15810 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15811 esac
15812 echo "Prototype: $try" ;;
15813 esac
15814 ;;
c18e646a
JH
15815 *) case "$usethreads" in
15816 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15817 esac
90e831dc
SB
15818 d_readdir_r=undef
15819 readdir_r_proto=0
c18e646a 15820 ;;
a48ec845
JH
15821 esac
15822 ;;
10bc17b6
JH
15823*) readdir_r_proto=0
15824 ;;
15825esac
15826
4e0554ec
JH
15827: see if readv exists
15828set readv d_readv
15829eval $inlibc
15830
15831: see if recvmsg exists
15832set recvmsg d_recvmsg
15833eval $inlibc
15834
b4eb6b3d
JH
15835: see if rename exists
15836set rename d_rename
15837eval $inlibc
15838
15839: see if rmdir exists
15840set rmdir d_rmdir
15841eval $inlibc
15842
15843: see if memory.h is available.
15844val=''
15845set memory.h val
15846eval $inhdr
15847
15848: See if it conflicts with string.h
15849case "$val" in
15850$define)
15851 case "$strings" in
15852 '') ;;
15853 *)
15854 $cppstdin $cppflags $cppminus < $strings > mem.h
15855 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15856 echo " "
15857 echo "We won't be including <memory.h>."
15858 val="$undef"
15859 fi
15860 $rm -f mem.h
15861 ;;
15862 esac
15863esac
15864set i_memory
15865eval $setvar
15866
15867: can bcopy handle overlapping blocks?
b6cc3bc4 15868echo " "
b4eb6b3d 15869val="$undef"
b6cc3bc4
AD
15870case "$d_memmove" in
15871"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15872*) case "$d_bcopy" in
15873 "$define")
15874 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15875 $cat >try.c <<EOCP
b4eb6b3d
JH
15876#$i_memory I_MEMORY
15877#$i_stdlib I_STDLIB
15878#$i_string I_STRING
15879#$i_unistd I_UNISTD
15880EOCP
15881 $cat >>try.c <<'EOCP'
15882#include <stdio.h>
15883#ifdef I_MEMORY
15884# include <memory.h>
15885#endif
15886#ifdef I_STDLIB
15887# include <stdlib.h>
15888#endif
15889#ifdef I_STRING
15890# include <string.h>
15891#else
15892# include <strings.h>
15893#endif
15894#ifdef I_UNISTD
15895# include <unistd.h> /* Needed for NetBSD */
15896#endif
15897int main()
15898{
15899char buf[128], abc[128];
15900char *b;
15901int len;
15902int off;
15903int align;
15904
b6cc3bc4
AD
15905/* Copy "abcde..." string to char abc[] so that gcc doesn't
15906 try to store the string in read-only memory. */
b4eb6b3d
JH
15907bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15908
15909for (align = 7; align >= 0; align--) {
15910 for (len = 36; len; len--) {
15911 b = buf+align;
15912 bcopy(abc, b, len);
15913 for (off = 1; off <= len; off++) {
15914 bcopy(b, b+off, len);
15915 bcopy(b+off, b, len);
15916 if (bcmp(b, abc, len))
15917 exit(1);
15918 }
15919 }
15920}
15921exit(0);
15922}
15923EOCP
b6cc3bc4
AD
15924 set try
15925 if eval $compile_ok; then
15926 if ./try 2>/dev/null; then
15927 echo "Yes, it can."
15928 val="$define"
15929 else
15930 echo "It can't, sorry."
15931 fi
b4eb6b3d 15932 else
b6cc3bc4 15933 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15934 fi
b6cc3bc4
AD
15935 ;;
15936 esac
15937 $rm -f try.* try core
b4eb6b3d
JH
15938 ;;
15939esac
b4eb6b3d
JH
15940set d_safebcpy
15941eval $setvar
15942
15943: can memcpy handle overlapping blocks?
b6cc3bc4 15944echo " "
b4eb6b3d 15945val="$undef"
b6cc3bc4
AD
15946case "$d_memmove" in
15947"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15948*) case "$d_memcpy" in
15949 "$define")
15950 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15951 $cat >try.c <<EOCP
b4eb6b3d
JH
15952#$i_memory I_MEMORY
15953#$i_stdlib I_STDLIB
15954#$i_string I_STRING
15955#$i_unistd I_UNISTD
15956EOCP
15957 $cat >>try.c <<'EOCP'
15958#include <stdio.h>
15959#ifdef I_MEMORY
15960# include <memory.h>
15961#endif
15962#ifdef I_STDLIB
15963# include <stdlib.h>
15964#endif
15965#ifdef I_STRING
15966# include <string.h>
15967#else
15968# include <strings.h>
15969#endif
15970#ifdef I_UNISTD
15971# include <unistd.h> /* Needed for NetBSD */
15972#endif
15973int main()
15974{
15975char buf[128], abc[128];
15976char *b;
15977int len;
15978int off;
15979int align;
15980
15981/* Copy "abcde..." string to char abc[] so that gcc doesn't
15982 try to store the string in read-only memory. */
15983memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15984
15985for (align = 7; align >= 0; align--) {
15986 for (len = 36; len; len--) {
15987 b = buf+align;
15988 memcpy(b, abc, len);
15989 for (off = 1; off <= len; off++) {
15990 memcpy(b+off, b, len);
15991 memcpy(b, b+off, len);
15992 if (memcmp(b, abc, len))
15993 exit(1);
15994 }
15995 }
15996}
15997exit(0);
15998}
15999EOCP
b6cc3bc4
AD
16000 set try
16001 if eval $compile_ok; then
16002 if ./try 2>/dev/null; then
16003 echo "Yes, it can."
16004 val="$define"
16005 else
16006 echo "It can't, sorry."
16007 fi
b4eb6b3d 16008 else
b6cc3bc4 16009 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16010 fi
b6cc3bc4
AD
16011 ;;
16012 esac
16013 $rm -f try.* try core
b4eb6b3d
JH
16014 ;;
16015esac
b4eb6b3d
JH
16016set d_safemcpy
16017eval $setvar
16018
16019: can memcmp be trusted to compare relative magnitude?
16020val="$undef"
16021case "$d_memcmp" in
16022"$define")
16023 echo " "
16024 echo "Checking if your memcmp() can compare relative magnitude..." >&4
16025 $cat >try.c <<EOCP
16026#$i_memory I_MEMORY
16027#$i_stdlib I_STDLIB
16028#$i_string I_STRING
16029#$i_unistd I_UNISTD
16030EOCP
16031 $cat >>try.c <<'EOCP'
16032#include <stdio.h>
16033#ifdef I_MEMORY
16034# include <memory.h>
16035#endif
16036#ifdef I_STDLIB
36adc09b 16037# include <stdlib.h>
b4eb6b3d
JH
16038#endif
16039#ifdef I_STRING
16040# include <string.h>
16041#else
16042# include <strings.h>
16043#endif
16044#ifdef I_UNISTD
16045# include <unistd.h> /* Needed for NetBSD */
16046#endif
16047int main()
16048{
16049char a = -1;
16050char b = 0;
16051if ((a < b) && memcmp(&a, &b, 1) < 0)
16052 exit(1);
16053exit(0);
16054}
16055EOCP
16056 set try
16057 if eval $compile_ok; then
5440bc8e 16058 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
16059 echo "Yes, it can."
16060 val="$define"
16061 else
16062 echo "No, it can't (it uses signed chars)."
16063 fi
16064 else
16065 echo "(I can't compile the test program, so we'll assume not...)"
16066 fi
16067 ;;
16068esac
16069$rm -f try.* try core
16070set d_sanemcmp
16071eval $setvar
16072
ef9f17be
JH
16073: see if prototype for sbrk is available
16074echo " "
16075set d_sbrkproto sbrk $i_unistd unistd.h
16076eval $hasproto
16077
b4eb6b3d
JH
16078: see if select exists
16079set select d_select
16080eval $inlibc
16081
16082: see if semctl exists
16083set semctl d_semctl
16084eval $inlibc
16085
16086: see if semget exists
16087set semget d_semget
16088eval $inlibc
16089
16090: see if semop exists
16091set semop d_semop
16092eval $inlibc
16093
16094: see how much of the 'sem*(2)' library is present.
16095h_sem=true
16096echo " "
16097case "$d_semctl$d_semget$d_semop" in
16098*"$undef"*) h_sem=false;;
16099esac
16100case "$osname" in
16101freebsd)
16102 case "`ipcs 2>&1`" in
16103 "SVID messages"*"not configured"*)
16104 echo "Your $osname does not have the sem*(2) configured." >&4
16105 h_sem=false
16106 val="$undef"
16107 set semctl d_semctl
16108 eval $setvar
16109 set semget d_semget
16110 eval $setvar
16111 set semop d_semop
16112 eval $setvar
16113 ;;
16114 esac
16115 ;;
16116esac
16117: we could also check for sys/ipc.h ...
16118if $h_sem && $test `./findhdr sys/sem.h`; then
16119 echo "You have the full sem*(2) library." >&4
16120 val="$define"
16121else
16122 echo "You don't have the full sem*(2) library." >&4
16123 val="$undef"
16124fi
16125set d_sem
16126eval $setvar
16127
16128: see whether sys/sem.h defines union semun
16129echo " "
16130$cat > try.c <<'END'
16131#include <sys/types.h>
16132#include <sys/ipc.h>
16133#include <sys/sem.h>
16134int main () { union semun semun; semun.buf = 0; }
16135END
16136set try
16137if eval $compile; then
16138 echo "You have union semun in <sys/sem.h>." >&4
16139 val="$define"
16140else
16141 echo "You do not have union semun in <sys/sem.h>." >&4
16142 val="$undef"
16143fi
2fad75a1 16144$rm -f try try.c
b4eb6b3d
JH
16145set d_union_semun
16146eval $setvar
16147
16148: see how to do semctl IPC_STAT
16149case "$d_sem" in
16150$define)
b4eb6b3d
JH
16151 echo " "
16152 $cat > try.h <<END
16153#ifndef S_IRUSR
16154# ifdef S_IREAD
16155# define S_IRUSR S_IREAD
16156# define S_IWUSR S_IWRITE
16157# define S_IXUSR S_IEXEC
16158# else
16159# define S_IRUSR 0400
16160# define S_IWUSR 0200
16161# define S_IXUSR 0100
16162# endif
16163# define S_IRGRP (S_IRUSR>>3)
16164# define S_IWGRP (S_IWUSR>>3)
16165# define S_IXGRP (S_IXUSR>>3)
16166# define S_IROTH (S_IRUSR>>6)
16167# define S_IWOTH (S_IWUSR>>6)
16168# define S_IXOTH (S_IXUSR>>6)
16169#endif
16170#ifndef S_IRWXU
16171# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16172# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16173# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16174#endif
16175END
2fad75a1 16176 : see whether semctl IPC_STAT can use union semun
2fad75a1
JH
16177 case "$d_semctl_semun" in
16178 '')
35918792 16179 val="$undef"
2fad75a1 16180 $cat > try.c <<END
b4eb6b3d
JH
16181#include <sys/types.h>
16182#include <sys/ipc.h>
16183#include <sys/sem.h>
16184#include <sys/stat.h>
16185#include <stdio.h>
16186#include <errno.h>
16187#include "try.h"
16188#ifndef errno
16189extern int errno;
16190#endif
16191#$d_union_semun HAS_UNION_SEMUN
16192int main() {
16193 union semun
16194#ifndef HAS_UNION_SEMUN
16195 {
16196 int val;
16197 struct semid_ds *buf;
16198 unsigned short *array;
16199 }
16200#endif
16201 arg;
16202 int sem, st;
16203
16204#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16205 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16206 if (sem > -1) {
16207 struct semid_ds argbuf;
16208 arg.buf = &argbuf;
16209# ifdef IPC_STAT
16210 st = semctl(sem, 0, IPC_STAT, arg);
16211 if (st == 0)
16212 printf("semun\n");
16213 else
16214# endif /* IPC_STAT */
16215 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16216# ifdef IPC_RMID
16217 if (semctl(sem, 0, IPC_RMID, arg) != 0)
35918792 16218# endif /* IPC_RMID */
b4eb6b3d
JH
16219 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16220 } else
16221#endif /* IPC_PRIVATE && ... */
16222 printf("semget failed: errno = %d\n", errno);
16223 return 0;
16224}
16225END
2fad75a1
JH
16226 set try
16227 if eval $compile; then
16228 xxx=`$run ./try`
16229 case "$xxx" in
16230 semun) val="$define" ;;
16231 esac
16232 fi
16233 $rm -f try try.c
35918792
YST
16234 set d_semctl_semun
16235 eval $setvar
2fad75a1
JH
16236 ;;
16237 esac
b4eb6b3d
JH
16238 case "$d_semctl_semun" in
16239 $define)
16240 echo "You can use union semun for semctl IPC_STAT." >&4
16241 also='also'
16242 ;;
16243 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
16244 also=''
16245 ;;
16246 esac
16247
16248 : see whether semctl IPC_STAT can use struct semid_ds pointer
2fad75a1
JH
16249 case "$d_semctl_semid_ds" in
16250 '')
35918792 16251 val="$undef"
2fad75a1 16252 $cat > try.c <<'END'
b4eb6b3d
JH
16253#include <sys/types.h>
16254#include <sys/ipc.h>
16255#include <sys/sem.h>
16256#include <sys/stat.h>
16257#include "try.h"
16258#include <stdio.h>
16259#include <errno.h>
16260#ifndef errno
16261extern int errno;
16262#endif
16263int main() {
16264 struct semid_ds arg;
16265 int sem, st;
16266
16267#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16268 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16269 if (sem > -1) {
16270# ifdef IPC_STAT
16271 st = semctl(sem, 0, IPC_STAT, &arg);
16272 if (st == 0)
16273 printf("semid_ds\n");
16274 else
16275# endif /* IPC_STAT */
16276 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16277# ifdef IPC_RMID
16278 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16279# endif /* IPC_RMID */
16280 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16281 } else
16282#endif /* IPC_PRIVATE && ... */
16283 printf("semget failed: errno = %d\n", errno);
16284
16285 return 0;
16286}
16287END
2fad75a1
JH
16288 set try
16289 if eval $compile; then
16290 xxx=`$run ./try`
16291 case "$xxx" in
16292 semid_ds) val="$define" ;;
16293 esac
16294 fi
16295 $rm -f try try.c
35918792
YST
16296 set d_semctl_semid_ds
16297 eval $setvar
2fad75a1
JH
16298 ;;
16299 esac
b4eb6b3d
JH
16300 case "$d_semctl_semid_ds" in
16301 $define)
16302 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16303 ;;
16304 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16305 ;;
16306 esac
16307 $rm -f try.h
16308 ;;
16309*) val="$undef"
16310
16311 # We do not have the full sem*(2) library, so assume we can not
16312 # use either.
16313
16314 set d_semctl_semun
16315 eval $setvar
16316
16317 set d_semctl_semid_ds
16318 eval $setvar
16319 ;;
16320esac
16321
4e0554ec
JH
16322: see if sendmsg exists
16323set sendmsg d_sendmsg
16324eval $inlibc
16325
b4eb6b3d
JH
16326: see if setegid exists
16327set setegid d_setegid
16328eval $inlibc
16329
16330: see if seteuid exists
16331set seteuid d_seteuid
16332eval $inlibc
16333
16334: see if setgrent exists
16335set setgrent d_setgrent
16336eval $inlibc
16337
10bc17b6
JH
16338: see if setgrent_r exists
16339set setgrent_r d_setgrent_r
16340eval $inlibc
16341case "$d_setgrent_r" in
16342"$define")
16343 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
16344 case "$d_setgrent_r_proto:$usethreads" in
16345 ":define") d_setgrent_r_proto=define
a48ec845
JH
16346 set d_setgrent_r_proto setgrent_r $hdrs
16347 eval $hasproto ;;
16348 *) ;;
16349 esac
16350 case "$d_setgrent_r_proto" in
16351 define)
10bc17b6
JH
16352 case "$setgrent_r_proto" in
16353 ''|0) try='int setgrent_r(FILE**);'
16354 ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16355 esac
16356 case "$setgrent_r_proto" in
16357 ''|0) try='void setgrent_r(FILE**);'
16358 ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16359 esac
16360 case "$setgrent_r_proto" in
90e831dc 16361 ''|0) d_setgrent_r=undef
10bc17b6 16362 setgrent_r_proto=0
a48ec845 16363 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16364 * ) case "$setgrent_r_proto" in
16365 REENTRANT_PROTO*) ;;
16366 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16367 esac
16368 echo "Prototype: $try" ;;
16369 esac
16370 ;;
c18e646a
JH
16371 *) case "$usethreads" in
16372 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16373 esac
90e831dc
SB
16374 d_setgrent_r=undef
16375 setgrent_r_proto=0
c18e646a 16376 ;;
a48ec845
JH
16377 esac
16378 ;;
10bc17b6
JH
16379*) setgrent_r_proto=0
16380 ;;
16381esac
16382
b4eb6b3d
JH
16383: see if sethostent exists
16384set sethostent d_sethent
16385eval $inlibc
16386
10bc17b6
JH
16387: see if sethostent_r exists
16388set sethostent_r d_sethostent_r
16389eval $inlibc
16390case "$d_sethostent_r" in
16391"$define")
16392 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16393 case "$d_sethostent_r_proto:$usethreads" in
16394 ":define") d_sethostent_r_proto=define
a48ec845
JH
16395 set d_sethostent_r_proto sethostent_r $hdrs
16396 eval $hasproto ;;
16397 *) ;;
16398 esac
16399 case "$d_sethostent_r_proto" in
16400 define)
10bc17b6
JH
16401 case "$sethostent_r_proto" in
16402 ''|0) try='int sethostent_r(int, struct hostent_data*);'
16403 ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16404 esac
16405 case "$sethostent_r_proto" in
16406 ''|0) try='void sethostent_r(int, struct hostent_data*);'
16407 ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16408 esac
16409 case "$sethostent_r_proto" in
90e831dc 16410 ''|0) d_sethostent_r=undef
10bc17b6 16411 sethostent_r_proto=0
a48ec845 16412 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16413 * ) case "$sethostent_r_proto" in
16414 REENTRANT_PROTO*) ;;
16415 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16416 esac
16417 echo "Prototype: $try" ;;
16418 esac
16419 ;;
c18e646a
JH
16420 *) case "$usethreads" in
16421 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16422 esac
90e831dc
SB
16423 d_sethostent_r=undef
16424 sethostent_r_proto=0
c18e646a 16425 ;;
a48ec845
JH
16426 esac
16427 ;;
10bc17b6
JH
16428*) sethostent_r_proto=0
16429 ;;
16430esac
16431
4e0554ec
JH
16432: see if setitimer exists
16433set setitimer d_setitimer
16434eval $inlibc
16435
b4eb6b3d
JH
16436: see if setlinebuf exists
16437set setlinebuf d_setlinebuf
16438eval $inlibc
16439
16440: see if setlocale exists
16441set setlocale d_setlocale
16442eval $inlibc
16443
10bc17b6
JH
16444: see if locale.h is available
16445set locale.h i_locale
16446eval $inhdr
16447
16448: see if setlocale_r exists
16449set setlocale_r d_setlocale_r
16450eval $inlibc
16451case "$d_setlocale_r" in
16452"$define")
16453 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
16454 case "$d_setlocale_r_proto:$usethreads" in
16455 ":define") d_setlocale_r_proto=define
a48ec845
JH
16456 set d_setlocale_r_proto setlocale_r $hdrs
16457 eval $hasproto ;;
16458 *) ;;
16459 esac
16460 case "$d_setlocale_r_proto" in
16461 define)
10bc17b6
JH
16462 case "$setlocale_r_proto" in
16463 ''|0) try='int setlocale_r(int, const char*, char*, int);'
16464 ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16465 esac
16466 case "$setlocale_r_proto" in
90e831dc 16467 ''|0) d_setlocale_r=undef
10bc17b6 16468 setlocale_r_proto=0
a48ec845 16469 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16470 * ) case "$setlocale_r_proto" in
16471 REENTRANT_PROTO*) ;;
16472 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16473 esac
16474 echo "Prototype: $try" ;;
16475 esac
16476 ;;
c18e646a
JH
16477 *) case "$usethreads" in
16478 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16479 esac
90e831dc
SB
16480 d_setlocale_r=undef
16481 setlocale_r_proto=0
c18e646a 16482 ;;
a48ec845
JH
16483 esac
16484 ;;
10bc17b6
JH
16485*) setlocale_r_proto=0
16486 ;;
16487esac
16488
b4eb6b3d
JH
16489: see if setnetent exists
16490set setnetent d_setnent
16491eval $inlibc
16492
10bc17b6
JH
16493: see if setnetent_r exists
16494set setnetent_r d_setnetent_r
16495eval $inlibc
16496case "$d_setnetent_r" in
16497"$define")
16498 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16499 case "$d_setnetent_r_proto:$usethreads" in
16500 ":define") d_setnetent_r_proto=define
a48ec845
JH
16501 set d_setnetent_r_proto setnetent_r $hdrs
16502 eval $hasproto ;;
16503 *) ;;
16504 esac
16505 case "$d_setnetent_r_proto" in
16506 define)
10bc17b6
JH
16507 case "$setnetent_r_proto" in
16508 ''|0) try='int setnetent_r(int, struct netent_data*);'
16509 ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16510 esac
16511 case "$setnetent_r_proto" in
16512 ''|0) try='void setnetent_r(int, struct netent_data*);'
16513 ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16514 esac
16515 case "$setnetent_r_proto" in
90e831dc 16516 ''|0) d_setnetent_r=undef
10bc17b6 16517 setnetent_r_proto=0
a48ec845 16518 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16519 * ) case "$setnetent_r_proto" in
16520 REENTRANT_PROTO*) ;;
16521 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16522 esac
16523 echo "Prototype: $try" ;;
16524 esac
16525 ;;
c18e646a
JH
16526 *) case "$usethreads" in
16527 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16528 esac
90e831dc
SB
16529 d_setnetent_r=undef
16530 setnetent_r_proto=0
c18e646a 16531 ;;
a48ec845
JH
16532 esac
16533 ;;
10bc17b6
JH
16534*) setnetent_r_proto=0
16535 ;;
16536esac
16537
b4eb6b3d
JH
16538: see if setprotoent exists
16539set setprotoent d_setpent
16540eval $inlibc
16541
16542: see if setpgid exists
16543set setpgid d_setpgid
16544eval $inlibc
16545
16546: see if setpgrp2 exists
16547set setpgrp2 d_setpgrp2
16548eval $inlibc
16549
16550: see if setpriority exists
16551set setpriority d_setprior
16552eval $inlibc
16553
16554: see if setproctitle exists
16555set setproctitle d_setproctitle
16556eval $inlibc
16557
10bc17b6
JH
16558: see if setprotoent_r exists
16559set setprotoent_r d_setprotoent_r
16560eval $inlibc
16561case "$d_setprotoent_r" in
16562"$define")
16563 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16564 case "$d_setprotoent_r_proto:$usethreads" in
16565 ":define") d_setprotoent_r_proto=define
a48ec845
JH
16566 set d_setprotoent_r_proto setprotoent_r $hdrs
16567 eval $hasproto ;;
16568 *) ;;
16569 esac
16570 case "$d_setprotoent_r_proto" in
16571 define)
10bc17b6
JH
16572 case "$setprotoent_r_proto" in
16573 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16574 ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16575 esac
16576 case "$setprotoent_r_proto" in
16577 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16578 ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16579 esac
16580 case "$setprotoent_r_proto" in
90e831dc 16581 ''|0) d_setprotoent_r=undef
10bc17b6 16582 setprotoent_r_proto=0
a48ec845 16583 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16584 * ) case "$setprotoent_r_proto" in
16585 REENTRANT_PROTO*) ;;
16586 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16587 esac
16588 echo "Prototype: $try" ;;
16589 esac
16590 ;;
c18e646a
JH
16591 *) case "$usethreads" in
16592 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16593 esac
90e831dc
SB
16594 d_setprotoent_r=undef
16595 setprotoent_r_proto=0
c18e646a 16596 ;;
a48ec845
JH
16597 esac
16598 ;;
10bc17b6
JH
16599*) setprotoent_r_proto=0
16600 ;;
16601esac
16602
b4eb6b3d
JH
16603: see if setpwent exists
16604set setpwent d_setpwent
16605eval $inlibc
16606
10bc17b6
JH
16607: see if setpwent_r exists
16608set setpwent_r d_setpwent_r
16609eval $inlibc
16610case "$d_setpwent_r" in
16611"$define")
16612 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
16613 case "$d_setpwent_r_proto:$usethreads" in
16614 ":define") d_setpwent_r_proto=define
a48ec845
JH
16615 set d_setpwent_r_proto setpwent_r $hdrs
16616 eval $hasproto ;;
16617 *) ;;
16618 esac
16619 case "$d_setpwent_r_proto" in
16620 define)
10bc17b6
JH
16621 case "$setpwent_r_proto" in
16622 ''|0) try='int setpwent_r(FILE**);'
16623 ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16624 esac
16625 case "$setpwent_r_proto" in
16626 ''|0) try='void setpwent_r(FILE**);'
16627 ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16628 esac
16629 case "$setpwent_r_proto" in
90e831dc 16630 ''|0) d_setpwent_r=undef
10bc17b6 16631 setpwent_r_proto=0
a48ec845 16632 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16633 * ) case "$setpwent_r_proto" in
16634 REENTRANT_PROTO*) ;;
16635 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16636 esac
16637 echo "Prototype: $try" ;;
16638 esac
16639 ;;
c18e646a
JH
16640 *) case "$usethreads" in
16641 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16642 esac
90e831dc
SB
16643 d_setpwent_r=undef
16644 setpwent_r_proto=0
c18e646a 16645 ;;
a48ec845
JH
16646 esac
16647 ;;
10bc17b6
JH
16648*) setpwent_r_proto=0
16649 ;;
16650esac
16651
b4eb6b3d
JH
16652: see if setregid exists
16653set setregid d_setregid
16654eval $inlibc
16655set setresgid d_setresgid
16656eval $inlibc
16657
16658: see if setreuid exists
16659set setreuid d_setreuid
16660eval $inlibc
16661set setresuid d_setresuid
16662eval $inlibc
16663
16664: see if setrgid exists
16665set setrgid d_setrgid
16666eval $inlibc
16667
16668: see if setruid exists
16669set setruid d_setruid
16670eval $inlibc
16671
16672: see if setservent exists
16673set setservent d_setsent
16674eval $inlibc
16675
10bc17b6
JH
16676: see if setservent_r exists
16677set setservent_r d_setservent_r
16678eval $inlibc
16679case "$d_setservent_r" in
16680"$define")
16681 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16682 case "$d_setservent_r_proto:$usethreads" in
16683 ":define") d_setservent_r_proto=define
a48ec845
JH
16684 set d_setservent_r_proto setservent_r $hdrs
16685 eval $hasproto ;;
16686 *) ;;
16687 esac
16688 case "$d_setservent_r_proto" in
16689 define)
10bc17b6
JH
16690 case "$setservent_r_proto" in
16691 ''|0) try='int setservent_r(int, struct servent_data*);'
16692 ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16693 esac
16694 case "$setservent_r_proto" in
16695 ''|0) try='void setservent_r(int, struct servent_data*);'
16696 ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16697 esac
16698 case "$setservent_r_proto" in
90e831dc 16699 ''|0) d_setservent_r=undef
10bc17b6 16700 setservent_r_proto=0
a48ec845 16701 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16702 * ) case "$setservent_r_proto" in
16703 REENTRANT_PROTO*) ;;
16704 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16705 esac
16706 echo "Prototype: $try" ;;
16707 esac
16708 ;;
c18e646a
JH
16709 *) case "$usethreads" in
16710 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16711 esac
90e831dc
SB
16712 d_setservent_r=undef
16713 setservent_r_proto=0
c18e646a 16714 ;;
a48ec845
JH
16715 esac
16716 ;;
10bc17b6
JH
16717*) setservent_r_proto=0
16718 ;;
16719esac
16720
b4eb6b3d
JH
16721: see if setsid exists
16722set setsid d_setsid
16723eval $inlibc
16724
16725: see if setvbuf exists
16726set setvbuf d_setvbuf
16727eval $inlibc
16728
16729: see if sfio.h is available
16730set sfio.h i_sfio
16731eval $inhdr
16732
16733
16734: see if sfio library is available
16735case "$i_sfio" in
16736$define)
16737 val=''
16738 set sfreserve val
16739 eval $inlibc
16740 ;;
16741*)
16742 val="$undef"
16743 ;;
16744esac
16745: Ok, but do we want to use it.
16746case "$val" in
16747$define)
16748 case "$usesfio" in
16749 true|$define|[yY]*) dflt='y';;
16750 *) dflt='n';;
16751 esac
16752 echo "$package can use the sfio library, but it is experimental."
16753 case "$useperlio" in
16754 "$undef")
16755 echo "For sfio also the PerlIO abstraction layer is needed."
16756 echo "Earlier you said you wouldn't want that."
16757 ;;
16758 esac
16759 rp="You seem to have sfio available, do you want to try using it?"
16760 . ./myread
16761 case "$ans" in
16762 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
16763 useperlio="$define"
16764 val="$define"
16765 ;;
16766 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
16767 val="$undef"
b4eb6b3d
JH
16768 ;;
16769 esac
16770 ;;
16771*) case "$usesfio" in
16772 true|$define|[yY]*)
16773 echo "Sorry, cannot find sfio on this machine." >&4
16774 echo "Ignoring your setting of usesfio=$usesfio." >&4
16775 val="$undef"
16776 ;;
16777 esac
16778 ;;
16779esac
16780set d_sfio
16781eval $setvar
16782case "$d_sfio" in
16783$define) usesfio='true';;
16784*) usesfio='false';;
16785esac
3659ebf1
JH
16786case "$d_sfio" in
16787$define) ;;
16788*) : Remove sfio from list of libraries to use
7483f793
JH
16789 case "$libs" in
16790 *-lsfio*)
16791 echo "Removing unneeded -lsfio from library list" >&4
16792 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16793 shift
16794 libs="$*"
16795 echo "libs = $libs" >&4
16796 ;;
16797 esac
3659ebf1
JH
16798;;
16799esac
16800
b4eb6b3d
JH
16801
16802: see if shmctl exists
16803set shmctl d_shmctl
16804eval $inlibc
16805
16806: see if shmget exists
16807set shmget d_shmget
16808eval $inlibc
16809
16810: see if shmat exists
16811set shmat d_shmat
16812eval $inlibc
16813: see what shmat returns
16814case "$d_shmat" in
16815"$define")
16816 $cat >shmat.c <<'END'
16817#include <sys/shm.h>
16818void *shmat();
16819END
16820 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16821 shmattype='void *'
16822 else
16823 shmattype='char *'
16824 fi
16825 echo "and it returns ($shmattype)." >&4
16826 : see if a prototype for shmat is available
16827 xxx=`./findhdr sys/shm.h`
16828 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16829 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16830 val="$define"
16831 else
16832 val="$undef"
16833 fi
16834 $rm -f shmat.[co]
16835 ;;
16836*)
16837 val="$undef"
16838 ;;
16839esac
16840set d_shmatprototype
16841eval $setvar
16842
16843: see if shmdt exists
16844set shmdt d_shmdt
16845eval $inlibc
16846
16847: see how much of the 'shm*(2)' library is present.
16848h_shm=true
16849echo " "
16850case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16851*"$undef"*) h_shm=false;;
16852esac
16853case "$osname" in
16854freebsd)
16855 case "`ipcs 2>&1`" in
16856 "SVID shared memory"*"not configured"*)
16857 echo "Your $osname does not have the shm*(2) configured." >&4
16858 h_shm=false
16859 val="$undef"
16860 set shmctl d_shmctl
16861 evat $setvar
16862 set shmget d_shmget
16863 evat $setvar
16864 set shmat d_shmat
16865 evat $setvar
16866 set shmdt d_shmdt
16867 evat $setvar
16868 ;;
16869 esac
16870 ;;
16871esac
16872: we could also check for sys/ipc.h ...
16873if $h_shm && $test `./findhdr sys/shm.h`; then
16874 echo "You have the full shm*(2) library." >&4
16875 val="$define"
16876else
16877 echo "You don't have the full shm*(2) library." >&4
16878 val="$undef"
16879fi
16880set d_shm
16881eval $setvar
16882
16883echo " "
16884: see if we have sigaction
16885if set sigaction val -f d_sigaction; eval $csym; $val; then
16886 echo 'sigaction() found.' >&4
073b6de5 16887 $cat > try.c <<EOP
b4eb6b3d
JH
16888#include <stdio.h>
16889#include <sys/types.h>
16890#include <signal.h>
073b6de5
JH
16891#$i_stdlib I_STDLIB
16892#ifdef I_STDLIB
16893#include <stdlib.h>
16894#endif
b4eb6b3d
JH
16895int main()
16896{
16897 struct sigaction act, oact;
16898 act.sa_flags = 0;
16899 oact.sa_handler = 0;
16900 /* so that act and oact are used */
16901 exit(act.sa_flags == 0 && oact.sa_handler == 0);
16902}
16903EOP
16904 set try
16905 if eval $compile_ok; then
16906 val="$define"
16907 else
16908 echo "But you don't seem to have a useable struct sigaction." >&4
16909 val="$undef"
16910 fi
16911else
16912 echo 'sigaction NOT found.' >&4
16913 val="$undef"
16914fi
16915set d_sigaction; eval $setvar
16916$rm -f try try$_o try.c
16917
983dbef6
JH
16918: see if sigprocmask exists
16919set sigprocmask d_sigprocmask
16920eval $inlibc
16921
b4eb6b3d
JH
16922: see if sigsetjmp exists
16923echo " "
16924case "$d_sigsetjmp" in
16925'')
c727eafa 16926 $cat >try.c <<EOP
b4eb6b3d 16927#include <setjmp.h>
d1daaddf
JH
16928#$i_stdlib I_STDLIB
16929#ifdef I_STDLIB
16930#include <stdlib.h>
16931#endif
b4eb6b3d
JH
16932sigjmp_buf env;
16933int set = 1;
16934int main()
16935{
16936 if (sigsetjmp(env,1))
16937 exit(set);
16938 set = 0;
16939 siglongjmp(env, 1);
16940 exit(1);
16941}
16942EOP
16943 set try
16944 if eval $compile; then
5440bc8e 16945 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
16946 echo "POSIX sigsetjmp found." >&4
16947 val="$define"
16948 else
16949 $cat >&4 <<EOM
16950Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16951I'll ignore them.
16952EOM
16953 val="$undef"
16954 fi
16955 else
16956 echo "sigsetjmp not found." >&4
16957 val="$undef"
16958 fi
16959 ;;
16960*) val="$d_sigsetjmp"
16961 case "$d_sigsetjmp" in
16962 $define) echo "POSIX sigsetjmp found." >&4;;
16963 $undef) echo "sigsetjmp not found." >&4;;
16964 esac
16965 ;;
16966esac
16967set d_sigsetjmp
16968eval $setvar
16969$rm -f try.c try
16970
4f5da3e9
SP
16971: see if snprintf exists
16972set snprintf d_snprintf
16973eval $inlibc
16974
16975: see if vsnprintf exists
16976set vsnprintf d_vsnprintf
16977eval $inlibc
16978
2478f7a0
MB
16979case "$d_snprintf-$d_vsnprintf" in
16980"$define-$define")
16981 $cat <<EOM
16982Checking whether your snprintf() and vsnprintf() work okay...
16983EOM
16984 $cat >try.c <<'EOCP'
16985/* v?snprintf testing logic courtesy of Russ Allbery.
16986 * According to C99:
16987 * - if the buffer is too short it still must be \0-terminated
16988 * - if the buffer is too short the potentially required length
16989 * must be returned and not -1
16990 * - if the buffer is NULL the potentially required length
16991 * must be returned and not -1 or core dump
16992 */
16993#include <stdio.h>
16994#include <stdarg.h>
16995
16996char buf[2];
16997
16998int test (char *format, ...)
16999{
17000 va_list args;
17001 int count;
17002
17003 va_start (args, format);
17004 count = vsnprintf (buf, sizeof buf, format, args);
17005 va_end (args);
17006 return count;
17007}
17008
17009int main ()
17010{
17011 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17012 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17013}
17014EOCP
17015 set try
17016 if eval $compile; then
17017 `$run ./try`
17018 case "$?" in
17019 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17020 *) cat <<EOM >&4
17021Your snprintf() and snprintf() don't seem to be working okay.
17022EOM
17023 d_snprintf="$undef"
17024 d_vsnprintf="$undef"
17025 ;;
17026 esac
17027 else
17028 echo "(I can't seem to compile the test program--assuming they don't)"
17029 d_snprintf="$undef"
17030 d_vsnprintf="$undef"
17031 fi
17032 $rm -f try.* try core core.try.*
17033 ;;
17034esac
17035
49a78c82
JH
17036: see if sockatmark exists
17037set sockatmark d_sockatmark
17038eval $inlibc
17039
2ef53570
JH
17040: see if prototype for sockatmark is available
17041echo " "
17042set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17043eval $hasproto
17044
b4eb6b3d
JH
17045: see if socks5_init exists
17046set socks5_init d_socks5_init
17047eval $inlibc
17048
360321b3
YST
17049: see if sprintf returns the length of the string in the buffer as per ANSI
17050$echo "Checking whether sprintf returns the length of the string..." >&4
17051$cat <<EOP >try.c
17052#include <stdio.h>
17053#$i_stdlib I_STDLIB
17054#ifdef I_STDLIB
17055#include <stdlib.h>
17056#endif
17057#$i_string I_STRING
17058#ifdef I_STRING
17059# include <string.h>
17060#else
17061# include <strings.h>
17062#endif
17063#$i_math I_MATH
17064#ifdef I_MATH
17065#include <math.h>
17066#endif
17067
17068char buffer[256];
17069
17070int check (size_t expect, int test) {
17071 size_t got = strlen(buffer);
17072 if (expect == got)
17073 return 0;
17074
17075 printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17076 test, buffer);
17077 exit (test);
17078}
17079
17080int main(int argc, char **argv) {
17081 int test = 0;
17082
17083 check(sprintf(buffer, ""), ++test);
17084 check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17085 check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17086
17087 return 0;
17088}
17089EOP
17090set try
17091
17092d_sprintf_returns_strlen="$undef"
17093if eval $compile; then
17094 xxx="`$run ./try`"
17095 case "$?" in
17096 0) cat >&4 <<EOM
17097sprintf returns the length of the string (as ANSI says it should)
17098EOM
17099 d_sprintf_returns_strlen="$define"
17100 ;;
17101 *) cat >&4 <<EOM
17102sprintf does not return the length of the string (how old is this system?)
17103EOM
17104 d_sprintf_returns_strlen="$undef"
17105 ;;
17106 esac
17107fi
17108
17109$rm -f try.* try
17110
10bc17b6
JH
17111: see if srand48_r exists
17112set srand48_r d_srand48_r
17113eval $inlibc
17114case "$d_srand48_r" in
17115"$define")
17116 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17117 case "$d_srand48_r_proto:$usethreads" in
17118 ":define") d_srand48_r_proto=define
a48ec845
JH
17119 set d_srand48_r_proto srand48_r $hdrs
17120 eval $hasproto ;;
17121 *) ;;
17122 esac
17123 case "$d_srand48_r_proto" in
17124 define)
10bc17b6
JH
17125 case "$srand48_r_proto" in
17126 ''|0) try='int srand48_r(long, struct drand48_data*);'
17127 ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17128 esac
17129 case "$srand48_r_proto" in
90e831dc 17130 ''|0) d_srand48_r=undef
10bc17b6 17131 srand48_r_proto=0
a48ec845 17132 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17133 * ) case "$srand48_r_proto" in
17134 REENTRANT_PROTO*) ;;
17135 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17136 esac
17137 echo "Prototype: $try" ;;
17138 esac
17139 ;;
c18e646a
JH
17140 *) case "$usethreads" in
17141 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17142 esac
90e831dc
SB
17143 d_srand48_r=undef
17144 srand48_r_proto=0
c18e646a 17145 ;;
a48ec845
JH
17146 esac
17147 ;;
10bc17b6
JH
17148*) srand48_r_proto=0
17149 ;;
17150esac
17151
17152: see if srandom_r exists
17153set srandom_r d_srandom_r
17154eval $inlibc
17155case "$d_srandom_r" in
17156"$define")
17157 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17158 case "$d_srandom_r_proto:$usethreads" in
17159 ":define") d_srandom_r_proto=define
a48ec845
JH
17160 set d_srandom_r_proto srandom_r $hdrs
17161 eval $hasproto ;;
17162 *) ;;
17163 esac
17164 case "$d_srandom_r_proto" in
17165 define)
10bc17b6
JH
17166 case "$srandom_r_proto" in
17167 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17168 ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17169 esac
17170 case "$srandom_r_proto" in
90e831dc 17171 ''|0) d_srandom_r=undef
10bc17b6 17172 srandom_r_proto=0
a48ec845 17173 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17174 * ) case "$srandom_r_proto" in
17175 REENTRANT_PROTO*) ;;
17176 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17177 esac
17178 echo "Prototype: $try" ;;
17179 esac
17180 ;;
c18e646a
JH
17181 *) case "$usethreads" in
17182 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17183 esac
90e831dc
SB
17184 d_srandom_r=undef
17185 srandom_r_proto=0
c18e646a 17186 ;;
a48ec845
JH
17187 esac
17188 ;;
10bc17b6
JH
17189*) srandom_r_proto=0
17190 ;;
17191esac
17192
eef837ea
JH
17193: see if prototype for setresgid is available
17194echo " "
17195set d_sresgproto setresgid $i_unistd unistd.h
17196eval $hasproto
17197
640374d0
JH
17198: see if prototype for setresuid is available
17199echo " "
17200set d_sresuproto setresuid $i_unistd unistd.h
17201eval $hasproto
17202
b4eb6b3d
JH
17203: see if sys/stat.h is available
17204set sys/stat.h i_sysstat
17205eval $inhdr
17206
17207
17208: see if stat knows about block sizes
17209echo " "
17210echo "Checking to see if your struct stat has st_blocks field..." >&4
17211set d_statblks stat st_blocks $i_sysstat sys/stat.h
17212eval $hasfield
17213
17214
17215: see if this is a sys/vfs.h system
17216set sys/vfs.h i_sysvfs
17217eval $inhdr
17218
17219
17220: see if this is a sys/statfs.h system
17221set sys/statfs.h i_sysstatfs
17222eval $inhdr
17223
17224
17225echo " "
17226echo "Checking to see if your system supports struct statfs..." >&4
17227set 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
17228eval $hasstruct
17229case "$d_statfs_s" in
17230"$define") echo "Yes, it does." ;;
17231*) echo "No, it doesn't." ;;
17232esac
17233
17234
17235
17236: see if struct statfs knows about f_flags
17237case "$d_statfs_s" in
17238define)
17239 echo " "
17240 echo "Checking to see if your struct statfs has f_flags field..." >&4
17241 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
17242 eval $hasfield
17243 ;;
17244*) val="$undef"
17245 set d_statfs_f_flags
17246 eval $setvar
17247 ;;
17248esac
17249case "$d_statfs_f_flags" in
17250"$define") echo "Yes, it does." ;;
17251*) echo "No, it doesn't." ;;
17252esac
17253
b4eb6b3d
JH
17254$cat >&4 <<EOM
17255Checking how to access stdio streams by file descriptor number...
17256EOM
17257case "$stdio_stream_array" in
17258'') $cat >try.c <<EOCP
17259#include <stdio.h>
17260int main() {
17261 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17262 printf("yes\n");
17263}
17264EOCP
17265 for s in _iob __iob __sF
17266 do
17267 set try -DSTDIO_STREAM_ARRAY=$s
17268 if eval $compile; then
5440bc8e 17269 case "`$run ./try`" in
b4eb6b3d
JH
17270 yes) stdio_stream_array=$s; break ;;
17271 esac
17272 fi
17273 done
17274 $rm -f try.* try$exe_ext
17275esac
17276case "$stdio_stream_array" in
17277'') $cat >&4 <<EOM
17278I can't figure out how to access stdio streams by file descriptor number.
17279EOM
17280 d_stdio_stream_array="$undef"
17281 ;;
17282*) $cat >&4 <<EOM
17283You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17284EOM
17285 d_stdio_stream_array="$define"
17286 ;;
17287esac
17288
17289: see if strcoll exists
17290set strcoll d_strcoll
17291eval $inlibc
17292
17293: check for structure copying
17294echo " "
17295echo "Checking to see if your C compiler can copy structs..." >&4
17296$cat >try.c <<'EOCP'
76f47787 17297int main()
b4eb6b3d
JH
17298{
17299 struct blurfl {
17300 int dyick;
17301 } foo, bar;
17302
17303 foo = bar;
17304}
17305EOCP
17306if $cc -c try.c >/dev/null 2>&1 ; then
17307 val="$define"
17308 echo "Yup, it can."
17309else
17310 val="$undef"
17311 echo "Nope, it can't."
17312fi
17313set d_strctcpy
17314eval $setvar
17315$rm -f try.*
17316
17317: see if strerror and/or sys_errlist[] exist
17318echo " "
17319if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17320 if set strerror val -f d_strerror; eval $csym; $val; then
17321 echo 'strerror() found.' >&4
17322 d_strerror="$define"
17323 d_strerrm='strerror(e)'
17324 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17325 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
17326 d_syserrlst="$define"
17327 else
17328 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17329 d_syserrlst="$undef"
17330 fi
17331 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17332 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17333 echo 'strerror() found in string header.' >&4
17334 d_strerror="$define"
17335 d_strerrm='strerror(e)'
17336 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17337 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17338 d_syserrlst="$define"
17339 else
17340 echo "(You don't appear to have any sys_errlist[], how can this be?)"
17341 d_syserrlst="$undef"
17342 fi
17343 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17344 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17345 d_strerror="$undef"
17346 d_syserrlst="$define"
17347 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17348 else
17349 echo 'strerror() and sys_errlist[] NOT found.' >&4
17350 d_strerror="$undef"
17351 d_syserrlst="$undef"
17352 d_strerrm='"unknown"'
17353 fi
17354fi
17355
10bc17b6
JH
17356: see if strerror_r exists
17357set strerror_r d_strerror_r
17358eval $inlibc
17359case "$d_strerror_r" in
17360"$define")
17361 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
17362 case "$d_strerror_r_proto:$usethreads" in
17363 ":define") d_strerror_r_proto=define
a48ec845
JH
17364 set d_strerror_r_proto strerror_r $hdrs
17365 eval $hasproto ;;
17366 *) ;;
17367 esac
17368 case "$d_strerror_r_proto" in
17369 define)
10bc17b6
JH
17370 case "$strerror_r_proto" in
17371 ''|0) try='int strerror_r(int, char*, size_t);'
17372 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17373 esac
17374 case "$strerror_r_proto" in
17375 ''|0) try='int strerror_r(int, char*, int);'
17376 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17377 esac
17378 case "$strerror_r_proto" in
17379 ''|0) try='char* strerror_r(int, char*, size_t);'
17380 ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17381 esac
17382 case "$strerror_r_proto" in
90e831dc 17383 ''|0) d_strerror_r=undef
10bc17b6 17384 strerror_r_proto=0
a48ec845 17385 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17386 * ) case "$strerror_r_proto" in
17387 REENTRANT_PROTO*) ;;
17388 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17389 esac
17390 echo "Prototype: $try" ;;
17391 esac
17392 ;;
c18e646a
JH
17393 *) case "$usethreads" in
17394 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17395 esac
90e831dc
SB
17396 d_strerror_r=undef
17397 strerror_r_proto=0
c18e646a 17398 ;;
a48ec845
JH
17399 esac
17400 ;;
10bc17b6
JH
17401*) strerror_r_proto=0
17402 ;;
17403esac
17404
b3c85772
JH
17405: see if strftime exists
17406set strftime d_strftime
17407eval $inlibc
17408
08c92000
MB
17409: see if strlcat exists
17410set strlcat d_strlcat
17411eval $inlibc
17412
17413: see if strlcpy exists
17414set strlcpy d_strlcpy
17415eval $inlibc
17416
b4eb6b3d
JH
17417: see if strtod exists
17418set strtod d_strtod
17419eval $inlibc
17420
17421: see if strtol exists
17422set strtol d_strtol
17423eval $inlibc
17424
17425: see if strtold exists
17426set strtold d_strtold
17427eval $inlibc
17428
17429: see if strtoll exists
17430set strtoll d_strtoll
17431eval $inlibc
17432
17433case "$d_longlong-$d_strtoll" in
17434"$define-$define")
17435 $cat <<EOM
17436Checking whether your strtoll() works okay...
17437EOM
17438 $cat >try.c <<'EOCP'
17439#include <errno.h>
17440#ifdef __hpux
17441#define strtoll __strtoll
17442#endif
e75931a7
YST
17443#ifdef __EMX__
17444#define strtoll _strtoll
17445#endif
b4eb6b3d
JH
17446#include <stdio.h>
17447extern long long int strtoll(char *s, char **, int);
17448static int bad = 0;
17449int check(char *s, long long ell, int een) {
17450 long long gll;
17451 errno = 0;
17452 gll = strtoll(s, 0, 10);
17453 if (!((gll == ell) && (errno == een)))
17454 bad++;
17455}
17456int main() {
17457 check(" 1", 1LL, 0);
17458 check(" 0", 0LL, 0);
17459 check("-1", -1LL, 0);
17460 check("-9223372036854775808", -9223372036854775808LL, 0);
17461 check("-9223372036854775808", -9223372036854775808LL, 0);
17462 check(" 9223372036854775807", 9223372036854775807LL, 0);
17463 check("-9223372036854775808", -9223372036854775808LL, 0);
17464 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
17465 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17466 if (!bad)
17467 printf("ok\n");
17468}
17469EOCP
17470 set try
17471 if eval $compile; then
5440bc8e 17472 yyy=`$run ./try`
e75931a7 17473 case "$yyy" in
b4eb6b3d
JH
17474 ok) echo "Your strtoll() seems to be working okay." ;;
17475 *) cat <<EOM >&4
17476Your strtoll() doesn't seem to be working okay.
17477EOM
17478 d_strtoll="$undef"
17479 ;;
69eadf66 17480 esac
e75931a7
YST
17481 else
17482 echo "(I can't seem to compile the test program--assuming it doesn't)"
17483 d_strtoll="$undef"
b4eb6b3d
JH
17484 fi
17485 ;;
17486esac
17487
28e5dec8
JH
17488: see if strtoq exists
17489set strtoq d_strtoq
17490eval $inlibc
17491
b4eb6b3d
JH
17492: see if strtoul exists
17493set strtoul d_strtoul
17494eval $inlibc
17495
d0e6d399
NC
17496case "$d_strtoul" in
17497"$define")
17498 $cat <<EOM
17499Checking whether your strtoul() works okay...
17500EOM
17501 $cat >try.c <<'EOCP'
17502#include <errno.h>
17503#include <stdio.h>
17504extern unsigned long int strtoul(char *s, char **, int);
17505static int bad = 0;
17506void check(char *s, unsigned long eul, int een) {
17507 unsigned long gul;
17508 errno = 0;
17509 gul = strtoul(s, 0, 10);
17510 if (!((gul == eul) && (errno == een)))
17511 bad++;
17512}
17513int main() {
17514 check(" 1", 1L, 0);
17515 check(" 0", 0L, 0);
17516EOCP
17517 case "$longsize" in
17518 8)
17519 $cat >>try.c <<'EOCP'
09c0d2c4
JH
17520 check("18446744073709551615", 18446744073709551615UL, 0);
17521 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 17522#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 17523 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
17524 check("-18446744073709551614", 2, 0);
17525 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
17526 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17527 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 17528#endif
d0e6d399
NC
17529EOCP
17530 ;;
17531 4)
17532 $cat >>try.c <<'EOCP'
17533 check("4294967295", 4294967295UL, 0);
17534 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 17535#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
17536 check("-1", 4294967295UL, 0);
17537 check("-4294967294", 2, 0);
17538 check("-4294967295", 1, 0);
17539 check("-4294967296", 4294967295UL, ERANGE);
17540 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 17541#endif
d0e6d399
NC
17542EOCP
17543 ;;
17544 *)
17545: Should we write these tests to be more portable by sprintf-ing
17546: ~0 and then manipulating that char string as input for strtol?
17547 ;;
17548 esac
17549 $cat >>try.c <<'EOCP'
17550 if (!bad)
17551 printf("ok\n");
17552 return 0;
17553}
17554EOCP
17555 set try
17556 if eval $compile; then
5440bc8e 17557 case "`$run ./try`" in
d0e6d399
NC
17558 ok) echo "Your strtoul() seems to be working okay." ;;
17559 *) cat <<EOM >&4
17560Your strtoul() doesn't seem to be working okay.
17561EOM
17562 d_strtoul="$undef"
17563 ;;
17564 esac
17565 fi
17566 ;;
17567esac
17568
b4eb6b3d
JH
17569: see if strtoull exists
17570set strtoull d_strtoull
17571eval $inlibc
17572
17573case "$d_longlong-$d_strtoull" in
17574"$define-$define")
17575 $cat <<EOM
17576Checking whether your strtoull() works okay...
17577EOM
17578 $cat >try.c <<'EOCP'
17579#include <errno.h>
17580#ifdef __hpux
17581#define strtoull __strtoull
17582#endif
17583#include <stdio.h>
17584extern unsigned long long int strtoull(char *s, char **, int);
17585static int bad = 0;
17586int check(char *s, long long eull, int een) {
17587 long long gull;
17588 errno = 0;
17589 gull = strtoull(s, 0, 10);
17590 if (!((gull == eull) && (errno == een)))
17591 bad++;
17592}
17593int main() {
d0e6d399
NC
17594 check(" 1", 1LL, 0);
17595 check(" 0", 0LL, 0);
17596 check("18446744073709551615", 18446744073709551615ULL, 0);
17597 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 17598#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
17599 check("-1", 18446744073709551615ULL, 0);
17600 check("-18446744073709551614", 2LL, 0);
17601 check("-18446744073709551615", 1LL, 0);
17602 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17603 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 17604#endif
b4eb6b3d
JH
17605 if (!bad)
17606 printf("ok\n");
17607}
17608EOCP
17609 set try
17610 if eval $compile; then
5440bc8e 17611 case "`$run ./try`" in
b4eb6b3d
JH
17612 ok) echo "Your strtoull() seems to be working okay." ;;
17613 *) cat <<EOM >&4
17614Your strtoull() doesn't seem to be working okay.
17615EOM
17616 d_strtoull="$undef"
17617 ;;
17618 esac
17619 fi
17620 ;;
17621esac
17622
17623: see if strtouq exists
17624set strtouq d_strtouq
17625eval $inlibc
17626
d0e6d399
NC
17627case "$d_strtouq" in
17628"$define")
17629 $cat <<EOM
17630Checking whether your strtouq() works okay...
17631EOM
17632 $cat >try.c <<'EOCP'
17633#include <errno.h>
17634#include <stdio.h>
17635extern unsigned long long int strtouq(char *s, char **, int);
17636static int bad = 0;
17637void check(char *s, unsigned long long eull, int een) {
17638 unsigned long long gull;
17639 errno = 0;
17640 gull = strtouq(s, 0, 10);
17641 if (!((gull == eull) && (errno == een)))
17642 bad++;
17643}
17644int main() {
17645 check(" 1", 1LL, 0);
17646 check(" 0", 0LL, 0);
17647 check("18446744073709551615", 18446744073709551615ULL, 0);
17648 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 17649#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
17650 check("-1", 18446744073709551615ULL, 0);
17651 check("-18446744073709551614", 2LL, 0);
17652 check("-18446744073709551615", 1LL, 0);
17653 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17654 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 17655#endif
d0e6d399
NC
17656 if (!bad)
17657 printf("ok\n");
17658 return 0;
17659}
17660EOCP
17661 set try
17662 if eval $compile; then
5440bc8e 17663 case "`$run ./try`" in
d0e6d399
NC
17664 ok) echo "Your strtouq() seems to be working okay." ;;
17665 *) cat <<EOM >&4
17666Your strtouq() doesn't seem to be working okay.
17667EOM
17668 d_strtouq="$undef"
17669 ;;
17670 esac
17671 fi
17672 ;;
17673esac
17674
b4eb6b3d
JH
17675: see if strxfrm exists
17676set strxfrm d_strxfrm
17677eval $inlibc
17678
17679: see if symlink exists
17680set symlink d_symlink
17681eval $inlibc
17682
17683: see if syscall exists
17684set syscall d_syscall
17685eval $inlibc
17686
2ef53570
JH
17687: see if prototype for syscall is available
17688echo " "
17689set d_syscallproto syscall $i_unistd unistd.h
17690eval $hasproto
17691
b4eb6b3d
JH
17692: see if sysconf exists
17693set sysconf d_sysconf
17694eval $inlibc
17695
17696: see if system exists
17697set system d_system
17698eval $inlibc
17699
17700: see if tcgetpgrp exists
17701set tcgetpgrp d_tcgetpgrp
17702eval $inlibc
17703
17704: see if tcsetpgrp exists
17705set tcsetpgrp d_tcsetpgrp
17706eval $inlibc
17707
17708: see if prototype for telldir is available
17709echo " "
17710set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17711eval $hasproto
17712
ad493445
MB
17713: see if time exists
17714echo " "
17715if test "X$d_time" = X -o X"$timetype" = X; then
17716 if set time val -f d_time; eval $csym; $val; then
17717 echo 'time() found.' >&4
17718 val="$define"
17719 rp="What is the type returned by time() on this system?"
17720 set time_t timetype long stdio.h sys/types.h
17721 eval $typedef_ask
17722 else
17723 echo 'time() not found, hope that will do.' >&4
17724 val="$undef"
17725 timetype='int';
17726 fi
17727 set d_time
17728 eval $setvar
17729fi
17730
b4eb6b3d
JH
17731: see if this is a sys/times.h system
17732set sys/times.h i_systimes
17733eval $inhdr
17734
17735: see if times exists
17736echo " "
17737if set times val -f d_times; eval $csym; $val; then
17738 echo 'times() found.' >&4
17739 d_times="$define"
17740 inc=''
17741 case "$i_systimes" in
17742 "$define") inc='sys/times.h';;
17743 esac
17744 rp="What is the type returned by times() on this system?"
17745 set clock_t clocktype long stdio.h sys/types.h $inc
17746 eval $typedef_ask
17747else
17748 echo 'times() NOT found, hope that will do.' >&4
17749 d_times="$undef"
17750 clocktype='int'
17751fi
17752
10bc17b6
JH
17753: see if tmpnam_r exists
17754set tmpnam_r d_tmpnam_r
17755eval $inlibc
17756case "$d_tmpnam_r" in
17757"$define")
31ee0cb7 17758 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
17759 case "$d_tmpnam_r_proto:$usethreads" in
17760 ":define") d_tmpnam_r_proto=define
a48ec845
JH
17761 set d_tmpnam_r_proto tmpnam_r $hdrs
17762 eval $hasproto ;;
17763 *) ;;
17764 esac
17765 case "$d_tmpnam_r_proto" in
17766 define)
10bc17b6
JH
17767 case "$tmpnam_r_proto" in
17768 ''|0) try='char* tmpnam_r(char*);'
17769 ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17770 esac
17771 case "$tmpnam_r_proto" in
90e831dc 17772 ''|0) d_tmpnam_r=undef
10bc17b6 17773 tmpnam_r_proto=0
a48ec845 17774 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17775 * ) case "$tmpnam_r_proto" in
17776 REENTRANT_PROTO*) ;;
17777 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17778 esac
17779 echo "Prototype: $try" ;;
17780 esac
17781 ;;
c18e646a
JH
17782 *) case "$usethreads" in
17783 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17784 esac
90e831dc
SB
17785 d_tmpnam_r=undef
17786 tmpnam_r_proto=0
c18e646a 17787 ;;
a48ec845
JH
17788 esac
17789 ;;
10bc17b6
JH
17790*) tmpnam_r_proto=0
17791 ;;
17792esac
17793
b4eb6b3d
JH
17794: see if truncate exists
17795set truncate d_truncate
17796eval $inlibc
17797
10bc17b6
JH
17798: see if ttyname_r exists
17799set ttyname_r d_ttyname_r
17800eval $inlibc
17801case "$d_ttyname_r" in
17802"$define")
17803 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
17804 case "$d_ttyname_r_proto:$usethreads" in
17805 ":define") d_ttyname_r_proto=define
a48ec845
JH
17806 set d_ttyname_r_proto ttyname_r $hdrs
17807 eval $hasproto ;;
17808 *) ;;
17809 esac
17810 case "$d_ttyname_r_proto" in
17811 define)
10bc17b6
JH
17812 case "$ttyname_r_proto" in
17813 ''|0) try='int ttyname_r(int, char*, size_t);'
17814 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17815 esac
17816 case "$ttyname_r_proto" in
17817 ''|0) try='int ttyname_r(int, char*, int);'
17818 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17819 esac
17820 case "$ttyname_r_proto" in
17821 ''|0) try='char* ttyname_r(int, char*, int);'
17822 ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17823 esac
17824 case "$ttyname_r_proto" in
90e831dc 17825 ''|0) d_ttyname_r=undef
10bc17b6 17826 ttyname_r_proto=0
a48ec845 17827 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17828 * ) case "$ttyname_r_proto" in
17829 REENTRANT_PROTO*) ;;
17830 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17831 esac
17832 echo "Prototype: $try" ;;
17833 esac
17834 ;;
c18e646a
JH
17835 *) case "$usethreads" in
17836 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17837 esac
90e831dc
SB
17838 d_ttyname_r=undef
17839 ttyname_r_proto=0
c18e646a 17840 ;;
a48ec845
JH
17841 esac
17842 ;;
10bc17b6
JH
17843*) ttyname_r_proto=0
17844 ;;
17845esac
17846
b4eb6b3d
JH
17847: see if tzname[] exists
17848echo " "
17849if set tzname val -a d_tzname; eval $csym; $val; then
17850 val="$define"
17851 echo 'tzname[] found.' >&4
17852else
17853 val="$undef"
17854 echo 'tzname[] NOT found.' >&4
17855fi
17856set d_tzname
17857eval $setvar
17858
4e0554ec
JH
17859case "$osname" in
17860next|rhapsody|darwin) multiarch="$define" ;;
17861esac
17862case "$multiarch" in
17863''|[nN]*) multiarch="$undef" ;;
17864esac
17865
24412007 17866: check for ordering of bytes in a UV
4e0554ec 17867echo " "
5440bc8e 17868case "$usecrosscompile$multiarch" in
4e0554ec
JH
17869*$define*)
17870 $cat <<EOM
17871You seem to be either cross-compiling or doing a multiarchitecture build,
17872skipping the byteorder check.
17873
17874EOM
5440bc8e 17875 byteorder='ffff'
4e0554ec
JH
17876 ;;
17877*)
17878 case "$byteorder" in
17879 '')
17880 $cat <<'EOM'
17881In the following, larger digits indicate more significance. A big-endian
17882machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17883little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17884machines may have weird orders like 3412. A Cray will report 87654321,
17885an Alpha will report 12345678. If the test program works the default is
17886probably right.
17887I'm now running the test program...
17888EOM
24412007 17889 $cat >try.c <<EOCP
4e0554ec 17890#include <stdio.h>
55954f19
JH
17891#$i_stdlib I_STDLIB
17892#ifdef I_STDLIB
17893#include <stdlib.h>
17894#endif
24412007
JH
17895#include <sys/types.h>
17896typedef $uvtype UV;
4e0554ec
JH
17897int main()
17898{
17899 int i;
17900 union {
24412007
JH
17901 UV l;
17902 char c[$uvsize];
4e0554ec
JH
17903 } u;
17904
24412007 17905 if ($uvsize > 4)
b5ded3e5 17906 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 17907 else
a4c53327 17908 u.l = (UV)0x04030201;
24412007 17909 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
17910 printf("%c", u.c[i]+'0');
17911 printf("\n");
17912 exit(0);
17913}
17914EOCP
17915 xxx_prompt=y
17916 set try
17917 if eval $compile && ./try > /dev/null; then
5440bc8e 17918 dflt=`$run ./try`
4e0554ec
JH
17919 case "$dflt" in
17920 [1-4][1-4][1-4][1-4]|12345678|87654321)
17921 echo "(The test program ran ok.)"
17922 echo "byteorder=$dflt"
17923 xxx_prompt=n
17924 ;;
17925 ????|????????) echo "(The test program ran ok.)" ;;
17926 *) echo "(The test program didn't run right for some reason.)" ;;
17927 esac
17928 else
17929 dflt='4321'
17930 cat <<'EOM'
17931(I can't seem to compile the test program. Guessing big-endian...)
17932EOM
17933 fi
17934 case "$xxx_prompt" in
17935 y)
24412007 17936 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
17937 . ./myread
17938 byteorder="$ans"
17939 ;;
17940 *) byteorder=$dflt
17941 ;;
17942 esac
17943 ;;
17944 esac
17945 $rm -f try.c try
17946 ;;
17947esac
17948
17949
17950$cat <<EOM
17951
17952Checking to see whether you can access character data unalignedly...
17953EOM
dc7b0a4f
JH
17954case "$d_u32align" in
17955'') $cat >try.c <<EOCP
4e0554ec 17956#include <stdio.h>
d1daaddf
JH
17957#$i_stdlib I_STDLIB
17958#ifdef I_STDLIB
17959#include <stdlib.h>
17960#endif
4e0554ec 17961#define U32 $u32type
d308175a
JH
17962#define BYTEORDER 0x$byteorder
17963#define U8 $u8type
9958dc3c
JH
17964#include <signal.h>
17965#ifdef SIGBUS
7090f861 17966$signal_t bletch(int s) { exit(4); }
9958dc3c 17967#endif
4e0554ec
JH
17968int main() {
17969#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
8906a23e 17970 U8 buf[8];
4e0554ec
JH
17971 U32 *up;
17972 int i;
17973
17974 if (sizeof(U32) != 4) {
17975 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17976 exit(1);
17977 }
17978
17979 fflush(stdout);
17980
9958dc3c
JH
17981#ifdef SIGBUS
17982 signal(SIGBUS, bletch);
17983#endif
17984
8906a23e
JH
17985 buf[0] = 0;
17986 buf[1] = 0;
17987 buf[2] = 0;
17988 buf[3] = 1;
7eac3fd6 17989 buf[4] = 0;
8906a23e
JH
17990 buf[5] = 0;
17991 buf[6] = 0;
7eac3fd6 17992 buf[7] = 1;
8906a23e 17993
4e0554ec
JH
17994 for (i = 0; i < 4; i++) {
17995 up = (U32*)(buf + i);
17996 if (! ((*up == 1 << (8*i)) || /* big-endian */
17997 (*up == 1 << (8*(3-i))) /* little-endian */
17998 )
17999 )
18000 {
18001 printf("read failed (%x)\n", *up);
18002 exit(2);
18003 }
18004 }
18005
18006 /* write test */
18007 for (i = 0; i < 4; i++) {
18008 up = (U32*)(buf + i);
18009 *up = 0xBeef;
18010 if (*up != 0xBeef) {
18011 printf("write failed (%x)\n", *up);
18012 exit(3);
18013 }
18014 }
18015
18016 exit(0);
18017#else
18018 printf("1\n");
18019 exit(1);
18020#endif
18021 return 0;
18022}
18023EOCP
18024set try
18025if eval $compile_ok; then
d308175a 18026 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 18027 $run ./try 2>&1 >/dev/null
4e0554ec
JH
18028 case "$?" in
18029 0) cat >&4 <<EOM
18030You can access character data pretty unalignedly.
18031EOM
18032 d_u32align="$undef"
18033 ;;
18034 *) cat >&4 <<EOM
18035It seems that you must access character data in an aligned manner.
18036EOM
18037 d_u32align="$define"
18038 ;;
18039 esac
4e0554ec
JH
18040else
18041 rp='Can you access character data at unaligned addresses?'
18042 dflt='n'
18043 . ./myread
18044 case "$ans" in
18045 [yY]*) d_u32align="$undef" ;;
18046 *) d_u32align="$define" ;;
18047 esac
18048fi
e36b5403 18049$rm -f core core.try.* try.core
dc7b0a4f
JH
18050;;
18051esac
4e0554ec
JH
18052
18053: see if ualarm exists
18054set ualarm d_ualarm
18055eval $inlibc
18056
b4eb6b3d
JH
18057: see if umask exists
18058set umask d_umask
18059eval $inlibc
18060
758a5d79
JH
18061: see if unordered exists
18062set unordered d_unordered
18063eval $inlibc
18064
bdf33aa7
SP
18065: see if unsetenv exists
18066set unsetenv d_unsetenv
18067eval $inlibc
18068
4e0554ec
JH
18069: see if usleep exists
18070set usleep d_usleep
18071eval $inlibc
18072
2ef53570
JH
18073: see if prototype for usleep is available
18074echo " "
18075set d_usleepproto usleep $i_unistd unistd.h
18076eval $hasproto
18077
b4eb6b3d
JH
18078: see if ustat exists
18079set ustat d_ustat
18080eval $inlibc
18081
18082: backward compatibility for d_hvfork
18083if test X$d_hvfork != X; then
18084 d_vfork="$d_hvfork"
18085 d_hvfork=''
18086fi
18087: see if there is a vfork
18088val=''
18089set vfork val
18090eval $inlibc
18091
18092: Ok, but do we want to use it. vfork is reportedly unreliable in
18093: perl on Solaris 2.x, and probably elsewhere.
18094case "$val" in
18095$define)
18096 echo " "
18097 case "$usevfork" in
18098 false) dflt='n';;
18099 *) dflt='y';;
18100 esac
18101 cat <<'EOM'
18102
18103Perl can only use a vfork() that doesn't suffer from strict
18104restrictions on calling functions or modifying global data in
18105the child. For example, glibc-2.1 contains such a vfork()
18106that is unsuitable. If your system provides a proper fork()
18107call, chances are that you do NOT want perl to use vfork().
18108
18109EOM
18110 rp="Do you still want to use vfork()?"
18111 . ./myread
18112 case "$ans" in
18113 y|Y) ;;
18114 *)
18115 echo "Ok, we won't use vfork()."
18116 val="$undef"
18117 ;;
18118 esac
18119 ;;
18120esac
18121set d_vfork
18122eval $setvar
18123case "$d_vfork" in
18124$define) usevfork='true';;
18125*) usevfork='false';;
18126esac
18127
b4eb6b3d
JH
18128: see if closedir exists
18129set closedir d_closedir
18130eval $inlibc
18131
18132case "$d_closedir" in
18133"$define")
18134 echo " "
18135 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 18136 cat > try.c <<EOM
b4eb6b3d
JH
18137#$i_dirent I_DIRENT /**/
18138#$i_sysdir I_SYS_DIR /**/
18139#$i_sysndir I_SYS_NDIR /**/
18140#$i_systypes I_SYS_TYPES /**/
18141
18142#if defined(I_SYS_TYPES)
18143#include <sys/types.h>
18144#endif
18145#if defined(I_DIRENT)
18146#include <dirent.h>
18147#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18148#include <sys/dir.h>
18149#endif
18150#else
18151#ifdef I_SYS_NDIR
18152#include <sys/ndir.h>
18153#else
18154#ifdef I_SYS_DIR
18155#ifdef hp9000s500
18156#include <ndir.h> /* may be wrong in the future */
18157#else
18158#include <sys/dir.h>
18159#endif
18160#endif
18161#endif
18162#endif
18163int main() { return closedir(opendir(".")); }
18164EOM
5440bc8e 18165 set try
b4eb6b3d 18166 if eval $compile_ok; then
5440bc8e 18167 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
18168 echo "Yes, it does."
18169 val="$undef"
18170 else
18171 echo "No, it doesn't."
18172 val="$define"
18173 fi
18174 else
18175 echo "(I can't seem to compile the test program--assuming it doesn't)"
18176 val="$define"
18177 fi
18178 ;;
18179*)
18180 val="$undef";
18181 ;;
18182esac
18183set d_void_closedir
18184eval $setvar
5440bc8e 18185$rm -f try try.*
b4eb6b3d
JH
18186: see if there is a wait4
18187set wait4 d_wait4
18188eval $inlibc
18189
18190: see if waitpid exists
18191set waitpid d_waitpid
18192eval $inlibc
18193
18194: see if wcstombs exists
18195set wcstombs d_wcstombs
18196eval $inlibc
18197
18198: see if wctomb exists
18199set wctomb d_wctomb
18200eval $inlibc
18201
4e0554ec
JH
18202: see if writev exists
18203set writev d_writev
18204eval $inlibc
18205
b4eb6b3d
JH
18206: preserve RCS keywords in files with variable substitution, grrr
18207Date='$Date'
18208Id='$Id'
18209Log='$Log'
18210RCSfile='$RCSfile'
18211Revision='$Revision'
18212
b4eb6b3d
JH
18213: check for alignment requirements
18214echo " "
5440bc8e 18215case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
18216*$define*)
18217 $cat <<EOM
18218You seem to be either cross-compiling or doing a multiarchitecture build,
18219skipping the memory alignment check.
18220
18221EOM
18222 case "$alignbytes" in
18223 '') alignbytes=8 ;;
18224 esac
18225 ;;
18226*)
18227 case "$alignbytes" in
18228 '') echo "Checking alignment constraints..." >&4
18229 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18230 $cat >try.c <<'EOCP'
18231typedef long double NV;
18232EOCP
18233 else
18234 $cat >try.c <<'EOCP'
18235typedef double NV;
18236EOCP
18237 fi
18238 $cat >>try.c <<'EOCP'
18239#include <stdio.h>
18240struct foobar {
18241 char foo;
18242 NV bar;
18243} try_algn;
18244int main()
18245{
18246 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18247 return(0);
18248}
18249EOCP
18250 set try
18251 if eval $compile_ok; then
5440bc8e 18252 dflt=`$run ./try`
b4eb6b3d
JH
18253 else
18254 dflt='8'
18255 echo "(I can't seem to compile the test program...)"
18256 fi
18257 ;;
18258 *) dflt="$alignbytes"
18259 ;;
18260 esac
18261 rp="Doubles must be aligned on a how-many-byte boundary?"
18262 . ./myread
18263 alignbytes="$ans"
18264 $rm -f try.c try
18265 ;;
18266esac
18267
18268
18269: set the base revision
18270baserev=5.0
18271
3099fc99 18272: how do we concatenate cpp tokens here?
b4eb6b3d 18273echo " "
3099fc99 18274echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
18275$cat >cpp_stuff.c <<'EOCP'
18276#define RCAT(a,b)a/**/b
18277#define ACAT(a,b)a ## b
18278RCAT(Rei,ser)
18279ACAT(Cir,cus)
18280EOCP
18281$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18282if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18283 echo "Oh! Smells like ANSI's been here." >&4
18284 echo "We can catify or stringify, separately or together!"
18285 cpp_stuff=42
18286elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18287 echo "Ah, yes! The good old days!" >&4
18288 echo "However, in the good old days we don't know how to stringify and"
18289 echo "catify at the same time."
18290 cpp_stuff=1
18291else
18292 $cat >&4 <<EOM
3099fc99
CW
18293Hmm, I don't seem to be able to concatenate tokens with your cpp.
18294You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
18295EOM
18296 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18297fi
18298$rm -f cpp_stuff.*
18299
18300: see if this is a db.h system
18301set db.h i_db
18302eval $inhdr
18303
18304case "$i_db" in
18305$define)
18306 : Check db version.
18307 echo " "
18308 echo "Checking Berkeley DB version ..." >&4
18309 $cat >try.c <<EOCP
18310#$d_const HASCONST
18311#ifndef HASCONST
18312#define const
18313#endif
18314#include <sys/types.h>
18315#include <stdio.h>
55954f19
JH
18316#$i_stdlib I_STDLIB
18317#ifdef I_STDLIB
18318#include <stdlib.h>
18319#endif
b4eb6b3d 18320#include <db.h>
640374d0 18321int main(int argc, char *argv[])
b4eb6b3d
JH
18322{
18323#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18324 int Major, Minor, Patch ;
18325 unsigned long Version ;
18326 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
18327 if (argc == 2) {
18328 printf("%d %d %d %d %d %d\n",
18329 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18330 Major, Minor, Patch);
18331 exit(0);
18332 }
18333 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
18334
18335 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18336 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18337 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18338 Major, Minor, Patch) ;
18339
18340 /* check that db.h & libdb are compatible */
18341 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 18342 printf("db.h and libdb are incompatible.\n") ;
b4eb6b3d
JH
18343 exit(3);
18344 }
18345
640374d0 18346 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
18347
18348 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18349 + DB_VERSION_PATCH ;
18350
18351 /* needs to be >= 2.3.4 */
18352 if (Version < 2003004) {
18353 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 18354 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
b4eb6b3d
JH
18355 exit(2);
18356 }
18357
18358 exit(0);
18359#else
18360#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
18361 if (argc == 2) {
18362 printf("1 0 0\n");
18363 exit(0);
18364 }
18365 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
18366 exit(0); /* DB version < 2: the coast is clear. */
18367#else
18368 exit(1); /* <db.h> not Berkeley DB? */
18369#endif
18370#endif
18371}
18372EOCP
18373 set try
5440bc8e 18374 if eval $compile_ok && $run ./try; then
b4eb6b3d 18375 echo 'Looks OK.' >&4
5440bc8e 18376 set `$run ./try 1`
640374d0
JH
18377 db_version_major=$1
18378 db_version_minor=$2
18379 db_version_patch=$3
b4eb6b3d
JH
18380 else
18381 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
18382 i_db=$undef
18383 case " $libs " in
18384 *"-ldb "*)
18385 : Remove db from list of libraries to use
18386 echo "Removing unusable -ldb from library list" >&4
18387 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18388 shift
18389 libs="$*"
18390 echo "libs = $libs" >&4
18391 ;;
18392 esac
18393 fi
18394 $rm -f try.*
18395 ;;
18396esac
18397
18398case "$i_db" in
18399define)
18400 : Check the return type needed for hash
18401 echo " "
18402 echo "Checking return type needed for hash for Berkeley DB ..." >&4
18403 $cat >try.c <<EOCP
18404#$d_const HASCONST
18405#ifndef HASCONST
18406#define const
18407#endif
18408#include <sys/types.h>
18409#include <db.h>
18410
18411#ifndef DB_VERSION_MAJOR
18412u_int32_t hash_cb (ptr, size)
18413const void *ptr;
18414size_t size;
18415{
18416}
18417HASHINFO info;
18418int main()
18419{
18420 info.hash = hash_cb;
18421}
18422#endif
18423EOCP
18424 if $cc $ccflags -c try.c >try.out 2>&1 ; then
18425 if $contains warning try.out >>/dev/null 2>&1 ; then
18426 db_hashtype='int'
18427 else
18428 db_hashtype='u_int32_t'
18429 fi
18430 else
18431 : XXX Maybe we should just give up here.
18432 db_hashtype=u_int32_t
18433 $cat try.out >&4
18434 echo "Help: I can't seem to compile the db test program." >&4
18435 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18436 fi
18437 $rm -f try.*
18438 echo "Your version of Berkeley DB uses $db_hashtype for hash."
18439 ;;
18440*) db_hashtype=u_int32_t
18441 ;;
18442esac
18443case "$i_db" in
18444define)
18445 : Check the return type needed for prefix
18446 echo " "
18447 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18448 cat >try.c <<EOCP
18449#$d_const HASCONST
18450#ifndef HASCONST
18451#define const
18452#endif
18453#include <sys/types.h>
18454#include <db.h>
18455
18456#ifndef DB_VERSION_MAJOR
18457size_t prefix_cb (key1, key2)
18458const DBT *key1;
18459const DBT *key2;
18460{
18461}
18462BTREEINFO info;
18463int main()
18464{
18465 info.prefix = prefix_cb;
18466}
18467#endif
18468EOCP
18469 if $cc $ccflags -c try.c >try.out 2>&1 ; then
18470 if $contains warning try.out >>/dev/null 2>&1 ; then
18471 db_prefixtype='int'
18472 else
18473 db_prefixtype='size_t'
18474 fi
18475 else
18476 db_prefixtype='size_t'
18477 : XXX Maybe we should just give up here.
18478 $cat try.out >&4
18479 echo "Help: I can't seem to compile the db test program." >&4
18480 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18481 fi
18482 $rm -f try.*
18483 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18484 ;;
18485*) db_prefixtype='size_t'
18486 ;;
18487esac
18488
b4eb6b3d
JH
18489
18490: How can we generate normalized random numbers ?
18491echo " "
18492echo "Looking for a random number function..." >&4
18493case "$randfunc" in
18494'')
18495 if set drand48 val -f; eval $csym; $val; then
18496 dflt="drand48"
18497 echo "Good, found drand48()." >&4
18498 elif set random val -f; eval $csym; $val; then
18499 dflt="random"
18500 echo "OK, found random()." >&4
18501 else
18502 dflt="rand"
18503 echo "Yick, looks like I have to use rand()." >&4
18504 fi
18505 echo " "
18506 ;;
18507*)
18508 dflt="$randfunc"
18509 ;;
18510esac
18511cont=true
18512
18513case "$ccflags" in
18514*-Dmy_rand=*|*-Dmy_srand=*)
18515 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18516 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18517 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18518 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18519 ;;
18520esac
18521
18522while $test "$cont"; do
18523 rp="Use which function to generate random numbers?"
18524 . ./myread
18525 if $test "$ans" = "$dflt"; then
18526 : null
18527 else
18528 randbits=''
18529 fi
18530 randfunc="$ans"
18531 if set $ans val -f; eval $csym; $val; then
18532 cont=''
18533 else
18534 dflt=y
18535 rp="I cannot find function $ans. Use that name anyway?"
18536 . ./myread
18537 dflt=rand
18538 case "$ans" in
18539 [yY]*) cont='';;
18540 esac
18541 fi
18542 case "$cont" in
18543 '')
18544 case "$randfunc" in
18545 drand48)
18546 drand01="drand48()"
18547 seedfunc="srand48"
18548 randbits=48
18549 randseedtype=long
18550 ;;
18551 rand|random)
18552 case "$randbits" in
18553 '')
18554echo "Checking to see how many bits your $randfunc() function produces..." >&4
18555 $cat >try.c <<EOCP
18556#$i_unistd I_UNISTD
18557#$i_stdlib I_STDLIB
18558#include <stdio.h>
18559#ifdef I_UNISTD
18560# include <unistd.h>
18561#endif
18562#ifdef I_STDLIB
18563# include <stdlib.h>
18564#endif
18565int main()
18566{
18567 register int i;
18568 register unsigned long tmp;
18569 register unsigned long max = 0L;
18570
18571 for (i = 1000; i; i--) {
18572 tmp = (unsigned long) $randfunc();
18573 if (tmp > max) max = tmp;
18574 }
18575 for (i = 0; max; i++)
18576 max /= 2;
18577 printf("%d\n",i);
18578}
18579EOCP
18580 set try
18581 if eval $compile_ok; then
18582 dflt=`try`
18583 else
18584 dflt='?'
18585 echo "(I can't seem to compile the test program...)"
18586 fi
18587 ;;
18588 *)
18589 dflt="$randbits"
18590 ;;
18591 esac
18592 rp="How many bits does your $randfunc() function produce?"
18593 . ./myread
18594 randbits="$ans"
18595 $rm -f try.c try
18596 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18597 seedfunc="s$randfunc"
18598 randseedtype=unsigned
18599 ;;
18600 *)
18601 dflt="31"
18602 rp="How many bits does your $randfunc() function produce?"
18603 . ./myread
18604 randbits="$ans"
18605 seedfunc="s$randfunc"
18606 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18607 if set $seedfunc val -f; eval $csym; $val; then
18608 echo "(Using $seedfunc() to seed random generator)"
18609 else
18610 echo "(Warning: no $seedfunc() to seed random generator)"
18611 seedfunc=rand
18612 fi
18613 randseedtype=unsigned
18614 ;;
18615 esac
18616 ;;
18617 esac
18618done
18619
18620echo " "
18621echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 18622$cat >try.c <<'EOM'
b4eb6b3d
JH
18623int main()
18624{
18625 if ('M'==0xd4) return 0;
18626 return 1;
18627}
18628EOM
18629
18630val=$undef
5440bc8e 18631set try
b4eb6b3d 18632if eval $compile_ok; then
5440bc8e 18633 if $run ./try; then
b4eb6b3d
JH
18634 echo "You seem to speak EBCDIC." >&4
18635 val="$define"
18636 else
5440bc8e 18637 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
18638 fi
18639else
18640 echo "I'm unable to compile the test program." >&4
18641 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18642fi
5440bc8e 18643$rm -f try try.*
b4eb6b3d
JH
18644set ebcdic
18645eval $setvar
18646
18647echo " "
18648$cat >&4 <<EOM
18649Checking how to flush all pending stdio output...
18650EOM
18651# I only know how to find the first 32 possibly open files on SunOS.
18652# See also hints/sunos_4_1.sh and util.c --AD
18653case "$osname" in
18654sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18655esac
18656$cat >>try.c <<EOCP
18657#include <stdio.h>
55954f19
JH
18658#$i_stdlib I_STDLIB
18659#ifdef I_STDLIB
18660#include <stdlib.h>
18661#endif
b4eb6b3d
JH
18662#$i_unistd I_UNISTD
18663#ifdef I_UNISTD
18664# include <unistd.h>
18665#endif
18666#$d_sysconf HAS_SYSCONF
18667#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18668#ifdef HAS_STDIO_STREAM_ARRAY
18669# define STDIO_STREAM_ARRAY $stdio_stream_array
18670#endif
18671int main() {
5440bc8e
JH
18672 FILE* p;
18673 unlink("try.out");
18674 p = fopen("try.out", "w");
b4eb6b3d
JH
18675#ifdef TRY_FPUTC
18676 fputc('x', p);
18677#else
18678# ifdef TRY_FPRINTF
18679 fprintf(p, "x");
18680# endif
18681#endif
18682#ifdef TRY_FFLUSH_NULL
18683 fflush(NULL);
18684#endif
18685#ifdef TRY_FFLUSH_ALL
18686 {
18687 long open_max = -1;
18688# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18689 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18690# else
18691# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18692 open_max = sysconf(_SC_OPEN_MAX);
18693# else
18694# ifdef FOPEN_MAX
18695 open_max = FOPEN_MAX;
18696# else
18697# ifdef OPEN_MAX
18698 open_max = OPEN_MAX;
18699# else
18700# ifdef _NFILE
18701 open_max = _NFILE;
18702# endif
18703# endif
18704# endif
18705# endif
18706# endif
18707# ifdef HAS_STDIO_STREAM_ARRAY
18708 if (open_max > 0) {
18709 long i;
18710 for (i = 0; i < open_max; i++)
18711 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18712 STDIO_STREAM_ARRAY[i]._file < open_max &&
18713 STDIO_STREAM_ARRAY[i]._flag)
18714 fflush(&STDIO_STREAM_ARRAY[i]);
18715 }
18716 }
18717# endif
18718#endif
18719 _exit(42);
18720}
18721EOCP
18722: first we have to find out how _not_ to flush
5440bc8e 18723$to try.c
b4eb6b3d
JH
18724if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18725 output=''
18726 set try -DTRY_FPUTC
18727 if eval $compile; then
fbe73d74 18728 $run ./try 2>/dev/null
28f5ac64 18729 code="$?"
5440bc8e 18730 $from try.out
28f5ac64 18731 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18732 output=-DTRY_FPUTC
18733 fi
18734 fi
18735 case "$output" in
18736 '')
18737 set try -DTRY_FPRINTF
b4eb6b3d 18738 if eval $compile; then
fbe73d74 18739 $run ./try 2>/dev/null
28f5ac64 18740 code="$?"
5440bc8e 18741 $from try.out
28f5ac64 18742 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18743 output=-DTRY_FPRINTF
18744 fi
18745 fi
18746 ;;
18747 esac
18748fi
18749: check for fflush NULL behaviour
18750case "$fflushNULL" in
18751'') set try -DTRY_FFLUSH_NULL $output
18752 if eval $compile; then
5440bc8e 18753 $run ./try 2>/dev/null
b4eb6b3d 18754 code="$?"
5440bc8e 18755 $from try.out
b4eb6b3d
JH
18756 if $test -s try.out -a "X$code" = X42; then
18757 fflushNULL="`$cat try.out`"
18758 else
18759 if $test "X$code" != X42; then
18760 $cat >&4 <<EOM
18761(If this test failed, don't worry, we'll try another method shortly.)
18762EOM
18763 fi
18764 fi
18765 fi
18766 $rm -f core try.core core.try.*
18767 case "$fflushNULL" in
18768 x) $cat >&4 <<EOM
18769Your fflush(NULL) works okay for output streams.
18770Let's see if it clobbers input pipes...
18771EOM
18772# As of mid-March 2000 all versions of Solaris appear to have a stdio
18773# bug that improperly flushes the input end of pipes. So we avoid the
18774# autoflush on fork/system/exec support for now. :-(
18775$cat >tryp.c <<EOCP
18776#include <stdio.h>
18777int
18778main(int argc, char **argv)
18779{
18780 char buf[1024];
18781 int i;
18782 char *bp = buf;
18783 while (1) {
18784 while ((i = getc(stdin)) != -1
18785 && (*bp++ = i) != '\n'
18786 && bp < &buf[1024])
18787 /* DO NOTHING */ ;
18788 *bp = '\0';
18789 fprintf(stdout, "%s", buf);
18790 fflush(NULL);
18791 if (i == -1)
18792 return 0;
18793 bp = buf;
18794 }
18795}
18796EOCP
18797 fflushNULL="$define"
18798 set tryp
18799 if eval $compile; then
18800 $rm -f tryp.out
5440bc8e 18801 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18802 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18803 $cat >&4 <<EOM
18804fflush(NULL) seems to behave okay with input streams.
18805EOM
18806 fflushNULL="$define"
18807 else
18808 $cat >&4 <<EOM
18809Ouch, fflush(NULL) clobbers input pipes! We will not use it.
18810EOM
18811 fflushNULL="$undef"
18812 fi
18813 fi
18814 $rm -f core tryp.c tryp.core core.tryp.*
18815 ;;
18816 '') $cat >&4 <<EOM
18817Your fflush(NULL) isn't working (contrary to ANSI C).
18818EOM
18819 fflushNULL="$undef"
18820 ;;
18821 *) $cat >&4 <<EOM
18822Cannot figure out whether your fflush(NULL) works or not.
18823I'm assuming it doesn't (contrary to ANSI C).
18824EOM
18825 fflushNULL="$undef"
18826 ;;
18827 esac
18828 ;;
18829$define|true|[yY]*)
18830 fflushNULL="$define"
18831 ;;
18832*)
18833 fflushNULL="$undef"
18834 ;;
18835esac
18836: check explicit looping only if NULL did not work, and if the pipe
18837: bug does not show up on an explicit flush too
18838case "$fflushNULL" in
18839"$undef")
18840 $cat >tryp.c <<EOCP
18841#include <stdio.h>
18842int
18843main(int argc, char **argv)
18844{
18845 char buf[1024];
18846 int i;
18847 char *bp = buf;
18848 while (1) {
18849 while ((i = getc(stdin)) != -1
18850 && (*bp++ = i) != '\n'
18851 && bp < &buf[1024])
18852 /* DO NOTHING */ ;
18853 *bp = '\0';
18854 fprintf(stdout, "%s", buf);
18855 fflush(stdin);
18856 if (i == -1)
18857 return 0;
18858 bp = buf;
18859 }
18860}
18861EOCP
18862 set tryp
18863 if eval $compile; then
18864 $rm -f tryp.out
5440bc8e 18865 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18866 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18867 $cat >&4 <<EOM
18868Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18869EOM
18870 : now check for fflushall behaviour
18871 case "$fflushall" in
18872 '') set try -DTRY_FFLUSH_ALL $output
18873 if eval $compile; then
18874 $cat >&4 <<EOM
18875(Now testing the other method--but note that this also may fail.)
18876EOM
5440bc8e 18877 $run ./try 2>/dev/null
28f5ac64 18878 code=$?
fbe73d74 18879 $from try.out
28f5ac64 18880 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18881 fflushall="`$cat try.out`"
18882 fi
18883 fi
18884 $rm -f core try.core core.try.*
18885 case "$fflushall" in
18886 x) $cat >&4 <<EOM
18887Whew. Flushing explicitly all the stdio streams works.
18888EOM
18889 fflushall="$define"
18890 ;;
18891 '') $cat >&4 <<EOM
18892Sigh. Flushing explicitly all the stdio streams doesn't work.
18893EOM
18894 fflushall="$undef"
18895 ;;
18896 *) $cat >&4 <<EOM
18897Cannot figure out whether flushing stdio streams explicitly works or not.
18898I'm assuming it doesn't.
18899EOM
18900 fflushall="$undef"
18901 ;;
18902 esac
18903 ;;
18904 "$define"|true|[yY]*)
18905 fflushall="$define"
18906 ;;
18907 *)
18908 fflushall="$undef"
18909 ;;
18910 esac
18911 else
18912 $cat >&4 <<EOM
18913All is futile. Even fflush(stdin) clobbers input pipes!
18914EOM
18915 fflushall="$undef"
18916 fi
18917 else
18918 fflushall="$undef"
18919 fi
18920 $rm -f core tryp.c tryp.core core.tryp.*
18921 ;;
18922*) fflushall="$undef"
18923 ;;
18924esac
18925
18926case "$fflushNULL$fflushall" in
18927undefundef)
18928 $cat <<EOM
18929OK, I give up. I cannot figure out how to flush pending stdio output.
18930We won't be flushing handles at all before fork/exec/popen.
18931EOM
18932 ;;
18933esac
18934$rm -f try.* try$exe_ext
18935
18936: Store the full pathname to the ar program for use in the C program
18937: Respect a hint or command line value for full_ar.
18938case "$full_ar" in
18939'') full_ar=$ar ;;
18940esac
18941
18942: Store the full pathname to the sed program for use in the C program
18943full_sed=$sed
18944
18945: see what type gids are declared as in the kernel
18946echo " "
18947echo "Looking for the type for group ids returned by getgid()."
18948set gid_t gidtype xxx stdio.h sys/types.h
18949eval $typedef
18950case "$gidtype" in
18951xxx)
18952 xxx=`./findhdr sys/user.h`
18953 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18954 case $1 in
18955 unsigned) dflt="$1 $2" ;;
18956 *) dflt="$1" ;;
18957 esac
18958 ;;
18959*) dflt="$gidtype";;
18960esac
18961case "$gidtype" in
18962gid_t) echo "gid_t found." ;;
18963*) rp="What is the type for group ids returned by getgid()?"
18964 . ./myread
18965 gidtype="$ans"
18966 ;;
18967esac
18968
18969echo " "
18970case "$gidtype" in
18971*_t) zzz="$gidtype" ;;
18972*) zzz="gid" ;;
18973esac
18974echo "Checking the size of $zzz..." >&4
18975cat > try.c <<EOCP
18976#include <sys/types.h>
18977#include <stdio.h>
d1daaddf
JH
18978#$i_stdlib I_STDLIB
18979#ifdef I_STDLIB
18980#include <stdlib.h>
18981#endif
b4eb6b3d
JH
18982int main() {
18983 printf("%d\n", (int)sizeof($gidtype));
18984 exit(0);
18985}
18986EOCP
18987set try
18988if eval $compile_ok; then
5440bc8e 18989 yyy=`$run ./try`
b4eb6b3d
JH
18990 case "$yyy" in
18991 '') gidsize=4
18992 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18993 ;;
18994 *) gidsize=$yyy
18995 echo "Your $zzz is $gidsize bytes long."
18996 ;;
18997 esac
18998else
18999 gidsize=4
19000 echo "(I can't compile the test program--guessing $gidsize.)" >&4
19001fi
19002
19003
19004echo " "
19005case "$gidtype" in
19006*_t) zzz="$gidtype" ;;
19007*) zzz="gid" ;;
19008esac
19009echo "Checking the sign of $zzz..." >&4
19010cat > try.c <<EOCP
19011#include <sys/types.h>
19012#include <stdio.h>
19013int main() {
19014 $gidtype foo = -1;
19015 if (foo < 0)
19016 printf("-1\n");
19017 else
19018 printf("1\n");
19019}
19020EOCP
19021set try
19022if eval $compile; then
5440bc8e 19023 yyy=`$run ./try`
b4eb6b3d
JH
19024 case "$yyy" in
19025 '') gidsign=1
19026 echo "(I can't execute the test program--guessing unsigned.)" >&4
19027 ;;
19028 *) gidsign=$yyy
19029 case "$gidsign" in
19030 1) echo "Your $zzz is unsigned." ;;
19031 -1) echo "Your $zzz is signed." ;;
19032 esac
19033 ;;
19034 esac
19035else
19036 gidsign=1
19037 echo "(I can't compile the test program--guessing unsigned.)" >&4
19038fi
19039
19040
19041echo " "
19042
19043if $test X"$quadtype" != X; then
19044
19045echo "Checking how to print 64-bit integers..." >&4
19046
19047if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19048 $cat >try.c <<'EOCP'
19049#include <sys/types.h>
19050#include <stdio.h>
19051int main() {
19052 int q = 12345678901;
19053 printf("%ld\n", q);
19054}
19055EOCP
19056 set try
19057 if eval $compile; then
5440bc8e 19058 yyy=`$run ./try`
b4eb6b3d
JH
19059 case "$yyy" in
19060 12345678901)
19061 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19062 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19063 echo "We will use %d."
19064 ;;
19065 esac
19066 fi
19067fi
19068
19069if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19070 $cat >try.c <<'EOCP'
19071#include <sys/types.h>
19072#include <stdio.h>
19073int main() {
19074 long q = 12345678901;
19075 printf("%ld\n", q);
19076}
19077EOCP
19078 set try
19079 if eval $compile; then
5440bc8e 19080 yyy=`$run ./try`
b4eb6b3d
JH
19081 case "$yyy" in
19082 12345678901)
19083 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19084 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19085 echo "We will use %ld."
19086 ;;
19087 esac
19088 fi
19089fi
19090
19091if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19092 $cat >try.c <<'EOCP'
19093#include <sys/types.h>
19094#include <inttypes.h>
19095#include <stdio.h>
19096int main() {
19097 int64_t q = 12345678901;
19098 printf("%" PRId64 "\n", q);
19099}
19100EOCP
19101 set try
19102 if eval $compile; then
5440bc8e 19103 yyy=`$run ./try`
b4eb6b3d
JH
19104 case "$yyy" in
19105 12345678901)
19106 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19107 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19108 echo "We will use the C9X style."
19109 ;;
19110 esac
19111 fi
19112fi
19113
2ef53570
JH
19114if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19115 $cat >try.c <<EOCP
b4eb6b3d
JH
19116#include <sys/types.h>
19117#include <stdio.h>
19118int main() {
2ef53570
JH
19119 $quadtype q = 12345678901;
19120 printf("%Ld\n", q);
b4eb6b3d
JH
19121}
19122EOCP
19123 set try
19124 if eval $compile; then
5440bc8e 19125 yyy=`$run ./try`
b4eb6b3d
JH
19126 case "$yyy" in
19127 12345678901)
2ef53570
JH
19128 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19129 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19130 echo "We will use %Ld."
b4eb6b3d
JH
19131 ;;
19132 esac
19133 fi
19134fi
19135
2ef53570
JH
19136if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19137 $cat >try.c <<'EOCP'
b4eb6b3d
JH
19138#include <sys/types.h>
19139#include <stdio.h>
19140int main() {
2ef53570
JH
19141 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19142 printf("%lld\n", q);
b4eb6b3d
JH
19143}
19144EOCP
19145 set try
19146 if eval $compile; then
5440bc8e 19147 yyy=`$run ./try`
b4eb6b3d
JH
19148 case "$yyy" in
19149 12345678901)
2ef53570
JH
19150 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19151 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19152 echo "We will use the %lld style."
b4eb6b3d
JH
19153 ;;
19154 esac
19155 fi
19156fi
19157
19158if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19159 $cat >try.c <<EOCP
19160#include <sys/types.h>
19161#include <stdio.h>
19162int main() {
19163 $quadtype q = 12345678901;
19164 printf("%qd\n", q);
19165}
19166EOCP
19167 set try
19168 if eval $compile; then
5440bc8e 19169 yyy=`$run ./try`
b4eb6b3d
JH
19170 case "$yyy" in
19171 12345678901)
19172 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19173 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19174 echo "We will use %qd."
19175 ;;
19176 esac
19177 fi
19178fi
19179
19180if $test X"$sPRId64" = X; then
19181 echo "Cannot figure out how to print 64-bit integers." >&4
19182fi
19183
19184$rm -f try try.*
19185
19186fi
19187
19188case "$sPRId64" in
19189'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19190 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19191 ;;
19192*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19193 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19194 ;;
19195esac
19196
19197
19198echo " "
19199$echo "Checking the format strings to be used for Perl's internal types..." >&4
19200
19201if $test X"$ivsize" = X8; then
19202 ivdformat="$sPRId64"
19203 uvuformat="$sPRIu64"
19204 uvoformat="$sPRIo64"
19205 uvxformat="$sPRIx64"
19206 uvXUformat="$sPRIXU64"
19207else
19208 if $test X"$ivsize" = X"$longsize"; then
19209 ivdformat='"ld"'
19210 uvuformat='"lu"'
19211 uvoformat='"lo"'
19212 uvxformat='"lx"'
19213 uvXUformat='"lX"'
19214 else
19215 if $test X"$ivsize" = X"$intsize"; then
19216 ivdformat='"d"'
19217 uvuformat='"u"'
19218 uvoformat='"o"'
19219 uvxformat='"x"'
19220 uvXUformat='"X"'
19221 else
19222 : far out
19223 if $test X"$ivsize" = X"$shortsize"; then
19224 ivdformat='"hd"'
19225 uvuformat='"hu"'
19226 uvoformat='"ho"'
19227 uvxformat='"hx"'
19228 uvXUformat='"hX"'
19229 fi
19230 fi
19231 fi
19232fi
19233
19234if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19235 nveformat="$sPRIeldbl"
19236 nvfformat="$sPRIfldbl"
19237 nvgformat="$sPRIgldbl"
19238 nvEUformat="$sPRIEUldbl"
19239 nvFUformat="$sPRIFUldbl"
19240 nvGUformat="$sPRIGUldbl"
19241else
19242 nveformat='"e"'
19243 nvfformat='"f"'
19244 nvgformat='"g"'
19245 nvEUformat='"E"'
19246 nvFUformat='"F"'
19247 nvGUformat='"G"'
19248fi
19249
19250case "$ivdformat" in
3c728e00 19251'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
19252 exit 1
19253 ;;
19254esac
19255
19256
19257echo " "
19258$echo "Checking the format string to be used for gids..." >&4
19259
19260case "$gidsign" in
19261-1) if $test X"$gidsize" = X"$ivsize"; then
19262 gidformat="$ivdformat"
19263 else
19264 if $test X"$gidsize" = X"$longsize"; then
19265 gidformat='"ld"'
19266 else
19267 if $test X"$gidsize" = X"$intsize"; then
19268 gidformat='"d"'
19269 else
19270 if $test X"$gidsize" = X"$shortsize"; then
19271 gidformat='"hd"'
19272 fi
19273 fi
19274 fi
19275 fi
19276 ;;
19277*) if $test X"$gidsize" = X"$uvsize"; then
19278 gidformat="$uvuformat"
19279 else
19280 if $test X"$gidsize" = X"$longsize"; then
19281 gidformat='"lu"'
19282 else
19283 if $test X"$gidsize" = X"$intsize"; then
19284 gidformat='"u"'
19285 else
19286 if $test X"$gidsize" = X"$shortsize"; then
19287 gidformat='"hu"'
19288 fi
19289 fi
19290 fi
19291 fi
19292 ;;
19293esac
19294
19295: see if getgroups exists
19296set getgroups d_getgrps
19297eval $inlibc
19298
19299: see if setgroups exists
19300set setgroups d_setgrps
19301eval $inlibc
19302
19303
19304: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19305echo " "
19306case "$d_getgrps$d_setgrps" in
19307*define*)
19308 case "$groupstype" in
19309 '') dflt="$gidtype" ;;
19310 *) dflt="$groupstype" ;;
19311 esac
19312 $cat <<EOM
19313What type of pointer is the second argument to getgroups() and setgroups()?
19314Usually this is the same as group ids, $gidtype, but not always.
19315
19316EOM
19317 rp='What type pointer is the second argument to getgroups() and setgroups()?'
19318 . ./myread
19319 groupstype="$ans"
19320 ;;
19321*) groupstype="$gidtype";;
19322esac
19323
d620c7b3 19324
fd655d33
NC
19325if $test $patchlevel -lt 9; then
19326: MAD is not available in 5.8.x or earlier.
19327 ans=n;
19328else
19329 case "$mad" in
19330 $define|true|[yY]*) dflt='y' ;;
19331 *) dflt='n' ;;
19332 esac
19333 cat <<EOM
d620c7b3
MB
19334
19335Would you like to build with Misc Attribute Decoration? This is development
19336work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19337overhead on the interpreter.
19338
19339If this doesn't make any sense to you, just accept the default '$dflt'.
19340EOM
fd655d33
NC
19341 rp='Build Perl with MAD?'
19342 . ./myread
19343fi
d620c7b3 19344case "$ans" in
00e74f14
NC
19345y|Y) val="$define"
19346 madlyh='madly.h madly.act madly.tab'
19347 madlysrc='madly.c'
19348 madlyobj="madly$_o" ;;
19349*) val="$undef"
19350 madlyh=''
19351 madlysrc=''
19352 madlyobj='' ;;
d620c7b3
MB
19353esac
19354set mad
19355eval $setvar
19356
b4eb6b3d
JH
19357echo " "
19358echo "Checking if your $make program sets \$(MAKE)..." >&4
19359case "$make_set_make" in
19360'')
19361 $sed 's/^X //' > testmake.mak << 'EOF'
19362Xall:
19363X @echo 'maketemp="$(MAKE)"'
19364EOF
19365 case "`$make -f testmake.mak 2>/dev/null`" in
19366 *maketemp=*) make_set_make='#' ;;
19367 *) make_set_make="MAKE=$make" ;;
19368 esac
19369 $rm -f testmake.mak
19370 ;;
19371esac
19372case "$make_set_make" in
19373'#') echo "Yup, it does.";;
19374*) echo "Nope, it doesn't.";;
19375esac
19376
19377: see what type is used for mode_t
19378rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19379set mode_t modetype int stdio.h sys/types.h
19380eval $typedef_ask
19381
2cc61e15
DD
19382: see if we need va_copy
19383echo " "
19384case "$i_stdarg" in
19385"$define")
19386 $cat >try.c <<EOCP
19387#include <stdarg.h>
19388#include <stdio.h>
85c8a686
DD
19389#$i_stdlib I_STDLIB
19390#ifdef I_STDLIB
19391#include <stdlib.h>
19392#endif
19393#include <signal.h>
2cc61e15
DD
19394
19395int
19396ivfprintf(FILE *f, const char *fmt, va_list *valp)
19397{
19398 return vfprintf(f, fmt, *valp);
19399}
19400
19401int
19402myvfprintf(FILE *f, const char *fmt, va_list val)
19403{
19404 return ivfprintf(f, fmt, &val);
19405}
19406
19407int
19408myprintf(char *fmt, ...)
19409{
19410 va_list val;
19411 va_start(val, fmt);
19412 return myvfprintf(stdout, fmt, val);
19413}
19414
19415int
19416main(int ac, char **av)
19417{
85c8a686
DD
19418 signal(SIGSEGV, exit);
19419
2cc61e15
DD
19420 myprintf("%s%cs all right, then\n", "that", '\'');
19421 exit(0);
19422}
19423EOCP
19424 set try
5440bc8e
JH
19425 if eval $compile && $run ./try 2>&1 >/dev/null; then
19426 case "`$run ./try`" in
2cc61e15
DD
19427 "that's all right, then")
19428 okay=yes
19429 ;;
19430 esac
19431 fi
19432 case "$okay" in
19433 yes) echo "It seems that you don't need va_copy()." >&4
19434 need_va_copy="$undef"
19435 ;;
19436 *) echo "It seems that va_copy() or similar will be needed." >&4
19437 need_va_copy="$define"
19438 ;;
19439 esac
19440 $rm -f try.* core core.* *.core *.core.*
19441 ;;
19442*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19443 ;;
19444esac
19445
b4eb6b3d
JH
19446: see what type is used for size_t
19447rp="What is the type used for the length parameter for string functions?"
19448set size_t sizetype 'unsigned int' stdio.h sys/types.h
19449eval $typedef_ask
19450
19451: check for type of arguments to gethostbyaddr.
19452if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19453 case "$d_gethbyaddr" in
19454 $define)
19455 $cat <<EOM
19456
19457Checking to see what type of arguments are accepted by gethostbyaddr().
19458EOM
19459 hdrs="$define sys/types.h
19460 $d_socket sys/socket.h
19461 $i_niin netinet/in.h
19462 $i_netdb netdb.h
19463 $i_unistd unistd.h"
19464 : The first arg can 'char *' or 'void *'
19465 : The second arg is some of integral type
19466 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19467 for yyy in size_t long int; do
19468 case "$netdb_host_type" in
19469 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19470 if ./protochk "$try" $hdrs; then
19471 echo "Your system accepts $xxx for the first arg."
19472 echo "...and $yyy for the second arg."
19473 netdb_host_type="$xxx"
19474 netdb_hlen_type="$yyy"
19475 fi
19476 ;;
19477 esac
19478 done
19479 done
19480 : In case none of those worked, prompt the user.
19481 case "$netdb_host_type" in
19482 '') rp='What is the type for the 1st argument to gethostbyaddr?'
19483 dflt='char *'
19484 . ./myread
19485 netdb_host_type=$ans
19486 rp='What is the type for the 2nd argument to gethostbyaddr?'
19487 dflt="$sizetype"
19488 . ./myread
19489 netdb_hlen_type=$ans
19490 ;;
19491 esac
19492 ;;
19493 *) : no gethostbyaddr, so pick harmless defaults
19494 netdb_host_type='char *'
19495 netdb_hlen_type="$sizetype"
19496 ;;
19497 esac
19498 # Remove the "const" if needed. -- but then we'll have a
19499 # prototype clash!
19500 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19501fi
19502
19503: check for type of argument to gethostbyname.
19504if test "X$netdb_name_type" = X ; then
19505 case "$d_gethbyname" in
19506 $define)
19507 $cat <<EOM
19508
19509Checking to see what type of argument is accepted by gethostbyname().
19510EOM
19511 hdrs="$define sys/types.h
19512 $d_socket sys/socket.h
19513 $i_niin netinet/in.h
19514 $i_netdb netdb.h
19515 $i_unistd unistd.h"
19516 for xxx in "const char *" "char *"; do
19517 case "$netdb_name_type" in
19518 '') try="extern struct hostent *gethostbyname($xxx);"
19519 if ./protochk "$try" $hdrs; then
19520 echo "Your system accepts $xxx."
19521 netdb_name_type="$xxx"
19522 fi
19523 ;;
19524 esac
19525 done
19526 : In case none of those worked, prompt the user.
19527 case "$netdb_name_type" in
19528 '') rp='What is the type for the 1st argument to gethostbyname?'
19529 dflt='char *'
19530 . ./myread
19531 netdb_name_type=$ans
19532 ;;
19533 esac
19534 ;;
19535 *) : no gethostbyname, so pick harmless default
19536 netdb_name_type='char *'
19537 ;;
19538 esac
19539fi
19540
19541: check for type of 1st argument to getnetbyaddr.
19542if test "X$netdb_net_type" = X ; then
19543 case "$d_getnbyaddr" in
19544 $define)
19545 $cat <<EOM
19546
19547Checking to see what type of 1st argument is accepted by getnetbyaddr().
19548EOM
19549 hdrs="$define sys/types.h
19550 $d_socket sys/socket.h
19551 $i_niin netinet/in.h
19552 $i_netdb netdb.h
19553 $i_unistd unistd.h"
19554 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19555 case "$netdb_net_type" in
19556 '') try="extern struct netent *getnetbyaddr($xxx, int);"
19557 if ./protochk "$try" $hdrs; then
19558 echo "Your system accepts $xxx."
19559 netdb_net_type="$xxx"
19560 fi
19561 ;;
19562 esac
19563 done
19564 : In case none of those worked, prompt the user.
19565 case "$netdb_net_type" in
19566 '') rp='What is the type for the 1st argument to getnetbyaddr?'
19567 dflt='long'
19568 . ./myread
19569 netdb_net_type=$ans
19570 ;;
19571 esac
19572 ;;
19573 *) : no getnetbyaddr, so pick harmless default
19574 netdb_net_type='long'
19575 ;;
19576 esac
19577fi
19578: locate the preferred pager for this system
d604bb53 19579fn=f/
b4eb6b3d
JH
19580case "$pager" in
19581'')
19582 dflt=''
19583 case "$pg" in
19584 /*) dflt=$pg;;
19585 [a-zA-Z]:/*) dflt=$pg;;
19586 esac
19587 case "$more" in
19588 /*) dflt=$more;;
19589 [a-zA-Z]:/*) dflt=$more;;
19590 esac
19591 case "$less" in
19592 /*) dflt=$less;;
19593 [a-zA-Z]:/*) dflt=$less;;
19594 esac
19595 case "$dflt" in
19596 '') dflt=/usr/ucb/more;;
19597 esac
19598 ;;
d604bb53
JH
19599*) dflt="$pager"
19600 : Instruct ./getfile to trust the hinted or previous pager value,
19601 : even if it does not begin with a slash. For example, on os2,
19602 : pager might be cmd /c more. See comments in UU/getfile.
19603 fn="f/($pager)"
19604 ;;
b4eb6b3d
JH
19605esac
19606echo " "
b4eb6b3d
JH
19607rp='What pager is used on your system?'
19608. ./getfile
19609pager="$ans"
19610
19611: see what type pids are declared as in the kernel
19612rp="What is the type of process ids on this system?"
19613set pid_t pidtype int stdio.h sys/types.h
19614eval $typedef_ask
19615
b4eb6b3d
JH
19616: see if ar generates random libraries by itself
19617echo " "
19618echo "Checking how to generate random libraries on your machine..." >&4
19619echo 'int bar1() { return bar2(); }' > bar1.c
19620echo 'int bar2() { return 2; }' > bar2.c
55954f19
JH
19621$cat > foo.c <<EOP
19622#$i_stdlib I_STDLIB
19623#ifdef I_STDLIB
19624#include <stdlib.h>
19625#endif
b4eb6b3d
JH
19626int main() { printf("%d\n", bar1()); exit(0); }
19627EOP
19628$cc $ccflags -c bar1.c >/dev/null 2>&1
19629$cc $ccflags -c bar2.c >/dev/null 2>&1
19630$cc $ccflags -c foo.c >/dev/null 2>&1
19631$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 19632if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19633 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19634 echo "$ar appears to generate random libraries itself."
19635 orderlib=false
e39a9d84
LC
19636 if [ "X$ranlib" = "X" ]; then
19637 ranlib=":"
19638 fi
88d4d47b
PC
19639elif $ar s bar$_a >/dev/null 2>&1 &&
19640 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19641 $run ./foobar >/dev/null 2>&1; then
19642 echo "a table of contents needs to be added with '$ar s'."
19643 orderlib=false
19644 ranlib="$ar s"
b4eb6b3d 19645elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 19646 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19647 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19648 echo "a table of contents needs to be added with '$ar ts'."
19649 orderlib=false
19650 ranlib="$ar ts"
19651else
19652 case "$ranlib" in
19653 :) ranlib='';;
19654 '')
19655 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19656 $test -f $ranlib || ranlib=''
19657 ;;
19658 esac
19659 if $test -n "$ranlib"; then
19660 echo "your system has '$ranlib'; we'll use that."
19661 orderlib=false
19662 else
19663 echo "your system doesn't seem to support random libraries"
19664 echo "so we'll use lorder and tsort to order the libraries."
19665 orderlib=true
19666 ranlib=":"
19667 fi
19668fi
88d4d47b 19669$rm -f foo* bar*
b4eb6b3d
JH
19670
19671: check for type of arguments to select.
19672case "$selecttype" in
19673'') case "$d_select" in
19674 $define)
19675 echo " "
19676 $cat <<EOM
19677Checking to see what type of arguments are accepted by select().
19678EOM
19679 hdrs="$define sys/types.h
19680 $i_systime sys/time.h
19681 $i_sysselct sys/select.h
19682 $d_socket sys/socket.h"
19683 : The first arg can be int, unsigned, or size_t
19684 : The last arg may or may not be 'const'
19685 val=''
19686 : void pointer has been seen but using that
19687 : breaks the selectminbits test
19688 for xxx in 'fd_set *' 'int *'; do
19689 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19690 for tmo in 'struct timeval *' 'const struct timeval *'; do
19691 case "$val" in
19692 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19693 if ./protochk "$try" $hdrs; then
19694 echo "Your system accepts $xxx."
19695 val="$xxx"
19696 fi
19697 ;;
19698 esac
19699 done
19700 done
19701 done
19702 case "$val" in
19703 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19704 case "$d_fd_set" in
19705 $define) dflt="fd_set *" ;;
19706 *) dflt="int *" ;;
19707 esac
19708 . ./myread
19709 val=$ans
19710 ;;
19711 esac
19712 selecttype="$val"
19713 ;;
19714 *) : no select, so pick a harmless default
19715 selecttype='int *'
19716 ;;
19717 esac
19718 ;;
19719esac
19720
19721: check for the select 'width'
19722case "$selectminbits" in
e6e7e605
JH
19723'') safebits=`expr $ptrsize \* 8`
19724 case "$d_select" in
b4eb6b3d
JH
19725 $define)
19726 $cat <<EOM
19727
19728Checking to see on how many bits at a time your select() operates...
19729EOM
19730 $cat >try.c <<EOCP
19731#include <sys/types.h>
19732#$i_time I_TIME
19733#$i_systime I_SYS_TIME
19734#$i_systimek I_SYS_TIME_KERNEL
19735#ifdef I_TIME
19736# include <time.h>
19737#endif
19738#ifdef I_SYS_TIME
19739# ifdef I_SYS_TIME_KERNEL
19740# define KERNEL
19741# endif
19742# include <sys/time.h>
19743# ifdef I_SYS_TIME_KERNEL
19744# undef KERNEL
19745# endif
19746#endif
19747#$i_sysselct I_SYS_SELECT
19748#ifdef I_SYS_SELECT
19749#include <sys/select.h>
19750#endif
19751#$d_socket HAS_SOCKET
19752#ifdef HAS_SOCKET
19753# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19754#endif
19755#include <stdio.h>
d1daaddf
JH
19756#$i_stdlib I_STDLIB
19757#ifdef I_STDLIB
19758#include <stdlib.h>
19759#endif
b4eb6b3d
JH
19760$selecttype b;
19761#define S sizeof(*(b))
19762#define MINBITS 64
19763#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19764#define NBITS (NBYTES * 8)
19765int main() {
7090f861 19766 char *s = (char *)malloc(NBYTES);
b4eb6b3d
JH
19767 struct timeval t;
19768 int i;
19769 FILE* fp;
19770 int fd;
19771
e6e7e605
JH
19772 if (!s)
19773 exit(1);
b4eb6b3d
JH
19774 fclose(stdin);
19775 fp = fopen("try.c", "r");
19776 if (fp == 0)
e6e7e605 19777 exit(2);
b4eb6b3d
JH
19778 fd = fileno(fp);
19779 if (fd < 0)
e6e7e605 19780 exit(3);
b4eb6b3d
JH
19781 b = ($selecttype)s;
19782 for (i = 0; i < NBITS; i++)
19783 FD_SET(i, b);
19784 t.tv_sec = 0;
19785 t.tv_usec = 0;
19786 select(fd + 1, b, 0, 0, &t);
19787 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
e6e7e605 19788 free(s);
b4eb6b3d
JH
19789 printf("%d\n", i + 1);
19790 return 0;
19791}
19792EOCP
19793 set try
19794 if eval $compile_ok; then
5440bc8e 19795 selectminbits=`$run ./try`
b4eb6b3d
JH
19796 case "$selectminbits" in
19797 '') cat >&4 <<EOM
19798Cannot figure out on how many bits at a time your select() operates.
e6e7e605 19799I'll play safe and guess it is $safebits bits.
b4eb6b3d 19800EOM
e6e7e605
JH
19801 selectminbits=$safebits
19802 bits="$safebits bits"
b4eb6b3d
JH
19803 ;;
19804 1) bits="1 bit" ;;
19805 *) bits="$selectminbits bits" ;;
19806 esac
19807 echo "Your select() operates on $bits at a time." >&4
19808 else
19809 rp='What is the minimum number of bits your select() operates on?'
19810 case "$byteorder" in
e6e7e605
JH
19811 12345678) dflt=64 ;;
19812 1234) dflt=32 ;;
b4eb6b3d
JH
19813 *) dflt=1 ;;
19814 esac
19815 . ./myread
19816 val=$ans
19817 selectminbits="$val"
19818 fi
19819 $rm -f try.* try
19820 ;;
19821 *) : no select, so pick a harmless default
e6e7e605 19822 selectminbits=$safebits
b4eb6b3d
JH
19823 ;;
19824 esac
19825 ;;
19826esac
19827
19828: Trace out the files included by signal.h, then look for SIGxxx names.
19829: Remove SIGARRAYSIZE used by HPUX.
19830: Remove SIGSTKSIZE used by Linux.
19831: Remove SIGSTKSZ used by Posix.
19832: Remove SIGTYP void lines used by OS2.
19833: Some cpps, like os390, dont give the file name anywhere
19834if [ "X$fieldn" = X ]; then
19835 : Just make some guesses. We check them later.
19836 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19837else
19838 xxx=`echo '#include <signal.h>' |
19839 $cppstdin $cppminus $cppflags 2>/dev/null |
19840 $grep '^[ ]*#.*include' |
a938a3bb 19841 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
19842fi
19843: Check this list of files to be sure we have parsed the cpp output ok.
19844: This will also avoid potentially non-existent files, such
19845: as ../foo/bar.h
19846xxxfiles=''
19847for xx in $xxx /dev/null ; do
19848 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19849done
19850: If we have found no files, at least try signal.h
19851case "$xxxfiles" in
19852'') xxxfiles=`./findhdr signal.h` ;;
19853esac
19854xxx=`awk '
19855$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19856 print substr($2, 4, 20)
19857}
19858$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19859 print substr($3, 4, 20)
19860}' $xxxfiles`
19861: Append some common names just in case the awk scan failed.
19862xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19863xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19864xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19865xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19866xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19867
19868: generate a few handy files for later
55954f19 19869$cat > signal.c <<EOCP
b4eb6b3d
JH
19870#include <sys/types.h>
19871#include <signal.h>
55954f19
JH
19872#$i_stdlib I_STDLIB
19873#ifdef I_STDLIB
19874#include <stdlib.h>
19875#endif
b4eb6b3d
JH
19876#include <stdio.h>
19877int main() {
19878
19879/* Strange style to avoid deeply-nested #if/#else/#endif */
19880#ifndef NSIG
19881# ifdef _NSIG
19882# define NSIG (_NSIG)
19883# endif
19884#endif
19885
19886#ifndef NSIG
19887# ifdef SIGMAX
19888# define NSIG (SIGMAX+1)
19889# endif
19890#endif
19891
19892#ifndef NSIG
19893# ifdef SIG_MAX
19894# define NSIG (SIG_MAX+1)
19895# endif
19896#endif
19897
19898#ifndef NSIG
3609ea0d
JH
19899# ifdef _SIG_MAX
19900# define NSIG (_SIG_MAX+1)
19901# endif
19902#endif
19903
19904#ifndef NSIG
b4eb6b3d
JH
19905# ifdef MAXSIG
19906# define NSIG (MAXSIG+1)
19907# endif
19908#endif
19909
19910#ifndef NSIG
19911# ifdef MAX_SIG
19912# define NSIG (MAX_SIG+1)
19913# endif
19914#endif
19915
19916#ifndef NSIG
19917# ifdef SIGARRAYSIZE
3609ea0d 19918# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
b4eb6b3d
JH
19919# endif
19920#endif
19921
19922#ifndef NSIG
19923# ifdef _sys_nsig
19924# define NSIG (_sys_nsig) /* Solaris 2.5 */
19925# endif
19926#endif
19927
19928/* Default to some arbitrary number that's big enough to get most
19929 of the common signals.
19930*/
19931#ifndef NSIG
19932# define NSIG 50
19933#endif
19934
19935printf("NSIG %d\n", NSIG);
19936
19937#ifndef JUST_NSIG
19938
19939EOCP
19940
19941echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19942{
19943 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 19944 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
19945 printf $1; printf ");\n"
19946 printf "#endif\n"
19947}
19948END {
19949 printf "#endif /* JUST_NSIG */\n";
19950 printf "exit(0);\n}\n";
19951}
19952' >>signal.c
19953$cat >signal.awk <<'EOP'
19954BEGIN { ndups = 0 }
65197d93 19955$1 ~ /^NSIG$/ { nsig = $2 }
1ebe1ffb 19956($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
19957 if ($2 > maxsig) { maxsig = $2 }
19958 if (sig_name[$2]) {
19959 dup_name[ndups] = $1
19960 dup_num[ndups] = $2
b4eb6b3d
JH
19961 ndups++
19962 }
1ebe1ffb 19963 else {
65197d93
JH
19964 sig_name[$2] = $1
19965 sig_num[$2] = $2
b4eb6b3d
JH
19966 }
19967}
19968END {
19969 if (nsig == 0) {
19970 nsig = maxsig + 1
19971 }
19972 printf("NSIG %d\n", nsig);
19973 for (n = 1; n < nsig; n++) {
19974 if (sig_name[n]) {
19975 printf("%s %d\n", sig_name[n], sig_num[n])
19976 }
19977 else {
19978 printf("NUM%d %d\n", n, n)
19979 }
19980 }
19981 for (n = 0; n < ndups; n++) {
19982 printf("%s %d\n", dup_name[n], dup_num[n])
19983 }
19984}
19985EOP
19986$cat >signal_cmd <<EOS
19987$startsh
19988if $test -s signal.lst; then
19989 echo "Using your existing signal.lst file"
19990 exit 0
19991fi
19992xxx="$xxx"
19993EOS
19994$cat >>signal_cmd <<'EOS'
19995
19996set signal
19997if eval $compile_ok; then
1eb9ad5b 19998 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
19999else
20000 echo "(I can't seem be able to compile the whole test program)" >&4
20001 echo "(I'll try it in little pieces.)" >&4
20002 set signal -DJUST_NSIG
20003 if eval $compile_ok; then
5440bc8e 20004 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
20005 $cat signal.nsg
20006 else
20007 echo "I can't seem to figure out how many signals you have." >&4
20008 echo "Guessing 50." >&4
20009 echo 'NSIG 50' > signal.nsg
20010 fi
20011 : Now look at all the signal names, one at a time.
20012 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20013 $cat > signal.c <<EOCP
20014#include <sys/types.h>
20015#include <signal.h>
20016#include <stdio.h>
20017int main() {
20018printf("$xx %d\n", SIG${xx});
20019return 0;
20020}
20021EOCP
20022 set signal
20023 if eval $compile; then
20024 echo "SIG${xx} found."
5440bc8e 20025 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
20026 else
20027 echo "SIG${xx} NOT found."
20028 fi
20029 done
20030 if $test -s signal.ls1; then
20031 $cat signal.nsg signal.ls1 |
65197d93 20032 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20033 fi
20034
20035fi
20036if $test -s signal.lst; then
20037 :
20038else
20039 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20040 echo 'kill -l' >signal
20041 set X `csh -f <signal`
20042 $rm -f signal
20043 shift
20044 case $# in
20045 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20046 esac
20047 echo $@ | $tr ' ' $trnl | \
20048 $awk '{ printf "%s %d\n", $1, ++s; }
20049 END { printf "NSIG %d\n", ++s }' >signal.lst
20050fi
20051$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20052EOS
20053chmod a+x signal_cmd
20054$eunicefix signal_cmd
20055
20056: generate list of signal names
20057echo " "
20058case "$sig_name_init" in
20059'') doinit=yes ;;
20060*) case "$sig_num_init" in
20061 ''|*,*) doinit=yes ;;
20062 esac ;;
20063esac
20064case "$doinit" in
20065yes)
20066 echo "Generating a list of signal names and numbers..." >&4
20067 . ./signal_cmd
20068 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20069 sig_name=`$awk 'BEGIN { printf "ZERO " }
20070 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20071 sig_num=`$awk 'BEGIN { printf "0 " }
20072 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20073 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
20074 !/^NSIG/ { printf "\"%s\", ", $1 }
20075 END { printf "0\n" }' signal.lst`
20076 sig_num_init=`$awk 'BEGIN { printf "0, " }
20077 !/^NSIG/ { printf "%d, ", $2}
20078 END { printf "0\n"}' signal.lst`
20079 ;;
20080esac
20081echo "The following $sig_count signals are available:"
20082echo " "
20083echo $sig_name | $awk \
20084'BEGIN { linelen = 0 }
20085{
20086 for (i = 1; i <= NF; i++) {
20087 name = "SIG" $i " "
20088 linelen = linelen + length(name)
20089 if (linelen > 70) {
20090 printf "\n"
20091 linelen = length(name)
20092 }
20093 printf "%s", name
20094 }
20095 printf "\n"
20096}'
76d3c696 20097sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
20098$rm -f signal signal.c signal.awk signal.lst signal_cmd
20099
20100echo " "
20101case "$sizetype" in
20102*_t) zzz="$sizetype" ;;
20103*) zzz="filesize" ;;
20104esac
20105echo "Checking the size of $zzz..." >&4
20106cat > try.c <<EOCP
20107#include <sys/types.h>
20108#include <stdio.h>
d1daaddf
JH
20109#$i_stdlib I_STDLIB
20110#ifdef I_STDLIB
20111#include <stdlib.h>
20112#endif
b4eb6b3d
JH
20113int main() {
20114 printf("%d\n", (int)sizeof($sizetype));
20115 exit(0);
20116}
20117EOCP
20118set try
20119if eval $compile_ok; then
5440bc8e 20120 yyy=`$run ./try`
b4eb6b3d
JH
20121 case "$yyy" in
20122 '') sizesize=4
20123 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20124 ;;
20125 *) sizesize=$yyy
20126 echo "Your $zzz size is $sizesize bytes."
20127 ;;
20128 esac
20129else
20130 sizesize=4
20131 echo "(I can't compile the test program--guessing $sizesize.)" >&4
20132fi
20133
20134
20135: check for socklen_t
20136echo " "
20137echo "Checking to see if you have socklen_t..." >&4
20138$cat >try.c <<EOCP
20139#include <sys/types.h>
20140#$d_socket HAS_SOCKET
20141#ifdef HAS_SOCKET
20142#include <sys/socket.h>
20143#endif
20144int main() { socklen_t x = 16; }
20145EOCP
20146set try
20147if eval $compile; then
20148 val="$define"
20149 echo "You have socklen_t."
20150else
20151 val="$undef"
20152 echo "You do not have socklen_t."
20153 case "$sizetype" in
20154 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20155 esac
20156fi
20157$rm -f try try.*
20158set d_socklen_t
20159eval $setvar
20160
a7710f8d
JH
20161: see if this is a socks.h system
20162set socks.h i_socks
20163eval $inhdr
20164
b4eb6b3d
JH
20165: check for type of the size argument to socket calls
20166case "$d_socket" in
20167"$define")
20168 $cat <<EOM
20169
20170Checking to see what type is the last argument of accept().
20171EOM
b4eb6b3d
JH
20172 yyy=''
20173 case "$d_socklen_t" in
20174 "$define") yyy="$yyy socklen_t"
20175 esac
20176 yyy="$yyy $sizetype int long unsigned"
20177 for xxx in $yyy; do
20178 case "$socksizetype" in
20179 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
20180 case "$usesocks" in
20181 "$define")
20182 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20183 echo "Your system accepts '$xxx *' for the last argument of accept()."
20184 socksizetype="$xxx"
20185 fi
20186 ;;
20187 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
20188 echo "Your system accepts '$xxx *' for the last argument of accept()."
20189 socksizetype="$xxx"
20190 fi
20191 ;;
20192 esac
b4eb6b3d
JH
20193 ;;
20194 esac
20195 done
20196: In case none of those worked, prompt the user.
20197 case "$socksizetype" in
20198 '') rp='What is the type for socket address structure sizes?'
20199 dflt='int'
20200 . ./myread
20201 socksizetype=$ans
20202 ;;
20203 esac
20204 ;;
20205*) : no sockets, so pick relatively harmless default
20206 socksizetype='int'
20207 ;;
20208esac
20209
20210: see what type is used for signed size_t
20211set ssize_t ssizetype int stdio.h sys/types.h
20212eval $typedef
20213dflt="$ssizetype"
5440bc8e 20214$cat > try.c <<EOM
b4eb6b3d 20215#include <stdio.h>
d1daaddf
JH
20216#$i_stdlib I_STDLIB
20217#ifdef I_STDLIB
20218#include <stdlib.h>
20219#endif
b4eb6b3d
JH
20220#include <sys/types.h>
20221#define Size_t $sizetype
20222#define SSize_t $dflt
20223int main()
20224{
20225 if (sizeof(Size_t) == sizeof(SSize_t))
20226 printf("$dflt\n");
20227 else if (sizeof(Size_t) == sizeof(int))
20228 printf("int\n");
20229 else
20230 printf("long\n");
20231 exit(0);
20232}
20233EOM
20234echo " "
5440bc8e
JH
20235set try
20236if eval $compile_ok && $run ./try > /dev/null; then
20237 ssizetype=`$run ./try`
b4eb6b3d
JH
20238 echo "I'll be using $ssizetype for functions returning a byte count." >&4
20239else
20240 $cat >&4 <<EOM
20241Help! I can't compile and run the ssize_t test program: please enlighten me!
20242(This is probably a misconfiguration in your system or libraries, and
20243you really ought to fix it. Still, I'll try anyway.)
20244
20245I need a type that is the same size as $sizetype, but is guaranteed to
20246be signed. Common values are ssize_t, int and long.
20247
20248EOM
20249 rp="What signed type is the same size as $sizetype?"
20250 . ./myread
20251 ssizetype="$ans"
20252fi
5440bc8e 20253$rm -f try try.*
b4eb6b3d
JH
20254
20255: see what type of char stdio uses.
20256echo " "
359842a5
JH
20257echo '#include <stdio.h>' > stdio.c
20258$cppstdin $cppminus < stdio.c > stdioh
aa517f50 20259if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
20260 echo "Your stdio uses unsigned chars." >&4
20261 stdchar="unsigned char"
20262else
aa517f50
JH
20263 echo "Your stdio uses signed chars." >&4
20264 stdchar="char"
b4eb6b3d 20265fi
359842a5 20266$rm -f stdio.* stdioh
b4eb6b3d 20267
b4eb6b3d
JH
20268: see what type uids are declared as in the kernel
20269echo " "
20270echo "Looking for the type for user ids returned by getuid()."
20271set uid_t uidtype xxx stdio.h sys/types.h
20272eval $typedef
20273case "$uidtype" in
20274xxx)
20275 xxx=`./findhdr sys/user.h`
20276 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20277 case $1 in
20278 unsigned) dflt="$1 $2" ;;
20279 *) dflt="$1" ;;
20280 esac
20281 ;;
20282*) dflt="$uidtype";;
20283esac
20284case "$uidtype" in
20285uid_t) echo "uid_t found." ;;
20286*) rp="What is the type for user ids returned by getuid()?"
20287 . ./myread
20288 uidtype="$ans"
20289 ;;
20290esac
20291
20292echo " "
20293case "$uidtype" in
20294*_t) zzz="$uidtype" ;;
20295*) zzz="uid" ;;
20296esac
20297echo "Checking the size of $zzz..." >&4
20298cat > try.c <<EOCP
20299#include <sys/types.h>
20300#include <stdio.h>
d1daaddf
JH
20301#$i_stdlib I_STDLIB
20302#ifdef I_STDLIB
20303#include <stdlib.h>
20304#endif
b4eb6b3d
JH
20305int main() {
20306 printf("%d\n", (int)sizeof($uidtype));
20307 exit(0);
20308}
20309EOCP
20310set try
20311if eval $compile_ok; then
5440bc8e 20312 yyy=`$run ./try`
b4eb6b3d
JH
20313 case "$yyy" in
20314 '') uidsize=4
20315 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20316 ;;
20317 *) uidsize=$yyy
20318 echo "Your $zzz is $uidsize bytes long."
20319 ;;
20320 esac
20321else
20322 uidsize=4
20323 echo "(I can't compile the test program--guessing $uidsize.)" >&4
20324fi
20325
20326echo " "
20327case "$uidtype" in
20328*_t) zzz="$uidtype" ;;
20329*) zzz="uid" ;;
20330esac
20331echo "Checking the sign of $zzz..." >&4
20332cat > try.c <<EOCP
20333#include <sys/types.h>
20334#include <stdio.h>
20335int main() {
20336 $uidtype foo = -1;
20337 if (foo < 0)
20338 printf("-1\n");
20339 else
20340 printf("1\n");
20341}
20342EOCP
20343set try
20344if eval $compile; then
5440bc8e 20345 yyy=`$run ./try`
b4eb6b3d
JH
20346 case "$yyy" in
20347 '') uidsign=1
20348 echo "(I can't execute the test program--guessing unsigned.)" >&4
20349 ;;
20350 *) uidsign=$yyy
20351 case "$uidsign" in
20352 1) echo "Your $zzz is unsigned." ;;
20353 -1) echo "Your $zzz is signed." ;;
20354 esac
20355 ;;
20356 esac
20357else
20358 uidsign=1
20359 echo "(I can't compile the test program--guessing unsigned.)" >&4
20360fi
20361
20362
20363
20364echo " "
20365$echo "Checking the format string to be used for uids..." >&4
20366
20367case "$uidsign" in
20368-1) if $test X"$uidsize" = X"$ivsize"; then
20369 uidformat="$ivdformat"
20370 else
20371 if $test X"$uidsize" = X"$longsize"; then
20372 uidformat='"ld"'
20373 else
20374 if $test X"$uidsize" = X"$intsize"; then
20375 uidformat='"d"'
20376 else
20377 if $test X"$uidsize" = X"$shortsize"; then
20378 uidformat='"hd"'
20379 fi
20380 fi
20381 fi
20382 fi
20383 ;;
20384*) if $test X"$uidsize" = X"$uvsize"; then
20385 uidformat="$uvuformat"
20386 else
20387 if $test X"$uidsize" = X"$longsize"; then
20388 uidformat='"lu"'
20389 else
20390 if $test X"$uidsize" = X"$intsize"; then
20391 uidformat='"u"'
20392 else
20393 if $test X"$uidsize" = X"$shortsize"; then
20394 uidformat='"hu"'
20395 fi
20396 fi
20397 fi
20398 fi
20399 ;;
20400esac
20401
4afd418c
MB
20402
20403case "$usesitecustomize" in
20404 $define|true|[Yy]*)
20405 usesitecustomize="$define"
20406 ;;
20407 *)
20408 usesitecustomize="$undef"
20409 ;;
20410 esac
20411
3659ebf1
JH
20412: determine compiler compiler
20413case "$yacc" in
20414'')
20415 dflt=yacc;;
20416*)
20417 dflt="$yacc";;
20418esac
20419echo " "
20420comp='yacc'
3c728e00 20421if $test -f "$byacc$_exe"; then
3659ebf1
JH
20422 dflt="$byacc"
20423 comp="byacc or $comp"
20424fi
3c728e00 20425if $test -f "$bison$_exe"; then
3659ebf1
JH
20426 comp="$comp or bison -y"
20427fi
20428rp="Which compiler compiler ($comp) shall I use?"
20429. ./myread
20430yacc="$ans"
20431case "$yacc" in
20432*bis*)
20433 case "$yacc" in
20434 *-y*) ;;
20435 *)
20436 yacc="$yacc -y"
20437 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20438 ;;
20439 esac
20440 ;;
20441esac
20442
758a5d79
JH
20443: see if this is a fp.h system
20444set fp.h i_fp
20445eval $inhdr
20446
20447: see if this is a fp_class.h system
20448set fp_class.h i_fp_class
20449eval $inhdr
20450
13cfc98d
MB
20451: see if gdbm.h is available
20452set gdbm.h t_gdbm
20453eval $inhdr
20454case "$t_gdbm" in
20455$define)
20456 : see if gdbm_open exists
20457 set gdbm_open d_gdbm_open
20458 eval $inlibc
20459 case "$d_gdbm_open" in
20460 $undef)
20461 t_gdbm="$undef"
20462 echo "We won't be including <gdbm.h>"
20463 ;;
20464 esac
20465 ;;
20466esac
20467val="$t_gdbm"
20468set i_gdbm
20469eval $setvar
20470
b4eb6b3d 20471: see if this is a ieeefp.h system
b5b9f165
JH
20472case "$i_ieeefp" in
20473'' ) set ieeefp.h i_ieeefp
20474 eval $inhdr
20475 ;;
20476esac
b4eb6b3d
JH
20477
20478: see if this is a libutil.h system
20479set libutil.h i_libutil
20480eval $inhdr
20481
b4eb6b3d
JH
20482: see if mach cthreads are available
20483if test "X$usethreads" = "X$define"; then
20484 set mach/cthreads.h i_machcthr
20485 eval $inhdr
20486else
20487 i_machcthr="$undef"
20488fi
20489
20490
20491
b4eb6b3d
JH
20492: see if this is a mntent.h system
20493set mntent.h i_mntent
20494eval $inhdr
20495
20496: see if ndbm.h is available
20497set ndbm.h t_ndbm
20498eval $inhdr
1c6861ad
JS
20499
20500case "$t_ndbm" in
20501$undef)
20502 # Some Linux distributions such as RedHat 7.1 put the
20503 # ndbm.h header in /usr/include/gdbm/ndbm.h.
20504 if $test -f /usr/include/gdbm/ndbm.h; then
d11b91bf 20505 echo '<gdbm/ndbm.h> found.'
1c6861ad
JS
20506 ccflags="$ccflags -I/usr/include/gdbm"
20507 cppflags="$cppflags -I/usr/include/gdbm"
20508 t_ndbm=$define
20509 fi
20510 ;;
20511esac
20512
b4eb6b3d
JH
20513case "$t_ndbm" in
20514$define)
20515 : see if dbm_open exists
20516 set dbm_open d_dbm_open
20517 eval $inlibc
20518 case "$d_dbm_open" in
20519 $undef)
20520 t_ndbm="$undef"
20521 echo "We won't be including <ndbm.h>"
20522 ;;
20523 esac
20524 ;;
20525esac
20526val="$t_ndbm"
20527set i_ndbm
20528eval $setvar
20529
20530: see if net/errno.h is available
20531val=''
20532set net/errno.h val
20533eval $inhdr
20534
20535: Unfortunately, it causes problems on some systems. Arrgh.
20536case "$val" in
20537$define)
20538 cat > try.c <<'EOM'
20539#include <stdio.h>
20540#include <errno.h>
20541#include <net/errno.h>
20542int func()
20543{
20544 return ENOTSOCK;
20545}
20546EOM
20547 if $cc $ccflags -c try.c >/dev/null 2>&1; then
20548 echo "We'll be including <net/errno.h>." >&4
20549 else
20550 echo "We won't be including <net/errno.h>." >&4
20551 val="$undef"
20552 fi
20553 $rm -f try.* try
20554 ;;
20555esac
20556set i_neterrno
20557eval $setvar
20558
20559: see if netinet/tcp.h is available
20560set netinet/tcp.h i_netinettcp
20561eval $inhdr
20562
20563: see if this is a poll.h system
20564set poll.h i_poll
20565eval $inhdr
20566
20567: see if this is a prot.h system
20568set prot.h i_prot
20569eval $inhdr
20570
20571echo " "
ddfca5da 20572$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
b4eb6b3d
JH
20573$cat <<'EOSH' > Cppsym.know
20574a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20575AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
44c87379 20576alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
d46c9a2d
JH
20577ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20578BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
20579BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20580bull c cadmus clipper CMU COFF COMPILER_VERSION
20581concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
8b7d8421 20582CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
20583Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20584FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20585GLIBC GLIBC_MINOR
20586GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
20587H3050R H3050RX hbullx20 hcx host_mips
20588hp200 hp300 hp700 HP700 hp800 hp9000
20589hp9000s200 hp9000s300 hp9000s400 hp9000s500
20590hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20591i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 20592IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
20593INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20594LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20595LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20596Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20597LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20598M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20599M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20600M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20601MATH_HAS_NO_SIDE_EFFECTS
20602mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20603mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20604mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20605MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20606mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20607NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 20608news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
20609ns32016 ns32332 ns32k nsc32000
20610OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20611pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20612pc532 pdp11 PGC PIC plexus PORTAR posix
20613POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20614POSIX_C_SOURCE POSIX_SOURCE POWER
20615PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 20616riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
20617SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20618sony sony_news sonyrisc sparc sparclite spectrum
20619stardent stdc STDC_EXT stratos sun sun3 sun386
20620Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20621SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20622SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20623sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 20624TM3200 TM5400 TM5600
b4eb6b3d
JH
20625tower tower32 tower32_200 tower32_600 tower32_700
20626tower32_800 tower32_850 tss
20627u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20628ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
20629unix UNIX95 UNIX99 unixpc unos
20630USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20631USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20632USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20633USGr4 USGr4_2
44c87379 20634Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
b4eb6b3d
JH
20635XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20636XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20637z8000
20638EOSH
20639# Maybe put other stuff here too.
20640cat <<EOSH >>Cppsym.know
20641$osname
20642EOSH
20643./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20644./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20645$cat Cppsym.know > Cppsym.c
381aa1ff 20646$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
20647$rm -f Cppsym.a Cppsym.b Cppsym.c
20648cat <<EOSH > Cppsym
20649$startsh
20650if $test \$# -gt 0; then
20651 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20652 if $test -s Cppsym.got; then
20653 $rm -f Cppsym.got
20654 exit 0
20655 fi
20656 $rm -f Cppsym.got
20657 exit 1
20658else
20659 $tr " " "$trnl" | ./Cppsym.try
20660 exit 0
20661fi
20662EOSH
20663chmod +x Cppsym
20664$eunicefix Cppsym
20665cat <<EOSH > Cppsym.try
20666$startsh
20667cat <<'EOCP' > try.c
20668#include <stdio.h>
360321b3
YST
20669#if cpp_stuff == 1
20670#define STRINGIFY(a) "a"
20671#endif
20672#if cpp_stuff == 42
20673#define StGiFy(a) #a
20674#define STRINGIFY(a) StGiFy(a)
20675#endif
20676#if $cpp_stuff != 1 && $cpp_stuff != 42
20677# include "Bletch: How does this C preprocessor stringify macros?"
20678#endif
b4eb6b3d
JH
20679int main() {
20680EOCP
20681$awk \\
20682EOSH
20683cat <<'EOSH' >> Cppsym.try
20684'length($1) > 0 {
360321b3
YST
20685 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20686 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20687 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20688 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
b4eb6b3d 20689}' >> try.c
2ef53570 20690echo 'return 0;}' >> try.c
b4eb6b3d
JH
20691EOSH
20692cat <<EOSH >> Cppsym.try
20693ccflags="$ccflags"
20694case "$osname-$gccversion" in
20695irix-) ccflags="\$ccflags -woff 1178" ;;
20696os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20697esac
360321b3 20698$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
b4eb6b3d
JH
20699EOSH
20700chmod +x Cppsym.try
20701$eunicefix Cppsym.try
20702./Cppsym < Cppsym.know > Cppsym.true
ddfca5da 20703: Add in any linux cpp "predefined macros":
b6a7163e
MB
20704case "$osname::$gccversion" in
20705 *linux*::*.*)
20706 tHdrH=_tmpHdr
20707 rm -f $tHdrH'.h' $tHdrH
20708 touch $tHdrH'.h'
20709 if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20710 sed 's/#define[\ \ ]*//;s/[\ \ ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20711 if [ -s $tHdrH'_cppsym.real' ]; then
20712 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20713 fi
20714 fi
20715 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20716 ;;
20717esac
b4eb6b3d
JH
20718: now check the C compiler for additional symbols
20719postprocess_cc_v=''
20720case "$osname" in
20721aix) postprocess_cc_v="|$tr , ' '" ;;
20722esac
20723$cat >ccsym <<EOS
20724$startsh
20725$cat >tmp.c <<EOF
20726extern int foo;
20727EOF
20728for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20729do
20730 case "\$i" in
20731 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 20732 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
20733 esac
20734done
20735$rm -f try.c
20736EOS
20737postprocess_cc_v=''
20738chmod +x ccsym
20739$eunicefix ccsym
20740./ccsym > ccsym1.raw
20741if $test -s ccsym1.raw; then
20742 $sort ccsym1.raw | $uniq >ccsym.raw
20743else
20744 mv ccsym1.raw ccsym.raw
20745fi
20746
20747$awk '/\=/ { print $0; next }
20748 { print $0"=1" }' ccsym.raw >ccsym.list
360321b3
YST
20749$comm -13 Cppsym.true ccsym.list >ccsym.own
20750$comm -12 Cppsym.true ccsym.list >ccsym.com
20751$comm -23 Cppsym.true ccsym.list >ccsym.cpp
b4eb6b3d
JH
20752also=''
20753if $test -z ccsym.raw; then
20754 echo "Your C compiler doesn't seem to define any symbols!" >&4
20755 echo " "
20756 echo "However, your C preprocessor defines the following symbols:"
20757 $cat Cppsym.true
20758 ccsymbols=''
20759 cppsymbols=`$cat Cppsym.true`
20760 cppsymbols=`echo $cppsymbols`
20761 cppccsymbols="$cppsymbols"
20762else
20763 if $test -s ccsym.com; then
20764 echo "Your C compiler and pre-processor define these symbols:"
20765 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20766 also='also '
20767 symbols='ones'
20768 cppccsymbols=`$cat ccsym.com`
20769 cppccsymbols=`echo $cppccsymbols`
20770 $test "$silent" || sleep 1
20771 fi
20772 if $test -s ccsym.cpp; then
20773 $test "$also" && echo " "
20774 echo "Your C pre-processor ${also}defines the following symbols:"
20775 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20776 also='further '
20777 cppsymbols=`$cat ccsym.cpp`
20778 cppsymbols=`echo $cppsymbols`
20779 $test "$silent" || sleep 1
20780 fi
20781 if $test -s ccsym.own; then
20782 $test "$also" && echo " "
20783 echo "Your C compiler ${also}defines the following cpp symbols:"
20784 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20785 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20786 ccsymbols=`$cat ccsym.own`
20787 ccsymbols=`echo $ccsymbols`
20788 $test "$silent" || sleep 1
20789 fi
20790fi
b4eb6b3d
JH
20791
20792: see if this is a termio system
20793val="$undef"
20794val2="$undef"
20795val3="$undef"
20796if $test `./findhdr termios.h`; then
20797 set tcsetattr i_termios
20798 eval $inlibc
20799 val3="$i_termios"
20800fi
20801echo " "
20802case "$val3" in
20803"$define") echo "You have POSIX termios.h... good!" >&4;;
20804*) if ./Cppsym pyr; then
20805 case "`/bin/universe`" in
20806 ucb) if $test `./findhdr sgtty.h`; then
20807 val2="$define"
20808 echo "<sgtty.h> found." >&4
20809 else
20810 echo "System is pyramid with BSD universe."
20811 echo "<sgtty.h> not found--you could have problems." >&4
20812 fi;;
20813 *) if $test `./findhdr termio.h`; then
20814 val="$define"
20815 echo "<termio.h> found." >&4
20816 else
20817 echo "System is pyramid with USG universe."
20818 echo "<termio.h> not found--you could have problems." >&4
20819 fi;;
20820 esac
20821 elif ./usg; then
20822 if $test `./findhdr termio.h`; then
20823 echo "<termio.h> found." >&4
20824 val="$define"
20825 elif $test `./findhdr sgtty.h`; then
20826 echo "<sgtty.h> found." >&4
20827 val2="$define"
20828 else
20829echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20830 fi
20831 else
20832 if $test `./findhdr sgtty.h`; then
20833 echo "<sgtty.h> found." >&4
20834 val2="$define"
20835 elif $test `./findhdr termio.h`; then
20836 echo "<termio.h> found." >&4
20837 val="$define"
20838 else
20839echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20840 fi
20841 fi;;
20842esac
20843set i_termio; eval $setvar
20844val=$val2; set i_sgtty; eval $setvar
20845val=$val3; set i_termios; eval $setvar
20846
b4eb6b3d
JH
20847: see if stddef is available
20848set stddef.h i_stddef
20849eval $inhdr
923fc586 20850
b4eb6b3d
JH
20851: see if this is a sunmath.h system
20852set sunmath.h i_sunmath
20853eval $inhdr
5f80c64f 20854
b4eb6b3d
JH
20855: see if sys/access.h is available
20856set sys/access.h i_sysaccess
20857eval $inhdr
20858
20859: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20860set sys/filio.h i_sysfilio
20861eval $inhdr
20862echo " "
20863if $test `./findhdr sys/ioctl.h`; then
20864 val="$define"
20865 echo '<sys/ioctl.h> found.' >&4
20866else
20867 val="$undef"
20868 if $test $i_sysfilio = "$define"; then
20869 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 20870 else
b4eb6b3d
JH
20871 $test $i_sgtty = "$define" && xxx="sgtty.h"
20872 $test $i_termio = "$define" && xxx="termio.h"
20873 $test $i_termios = "$define" && xxx="termios.h"
20874echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20875 fi
20876fi
20877set i_sysioctl
20878eval $setvar
20879
49a78c82
JH
20880: see if socket ioctl defs are in sys/sockio.h
20881echo " "
20882xxx=`./findhdr sys/sockio.h`
20883if $test "$xxx"; then
20884 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20885 val="$define"
20886 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20887 else
20888 val="$undef"
20889 echo "No socket ioctls found in <sys/sockio.h>." >&4
20890 fi
20891else
20892 val="$undef"
20893 $cat <<EOM
20894<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20895EOM
20896fi
20897set i_syssockio
20898eval $setvar
20899
b4eb6b3d
JH
20900
20901: see if this is a syslog.h system
20902set syslog.h i_syslog
20903eval $inhdr
20904
20905
20906: see if this is a sys/mode.h system
20907set sys/mode.h i_sysmode
20908eval $inhdr
20909
20910: see if sys/resource.h has to be included
20911set sys/resource.h i_sysresrc
20912eval $inhdr
20913
20914: see if sys/security.h is available
20915set sys/security.h i_syssecrt
20916eval $inhdr
20917
20918: see if this is a sys/statvfs.h system
20919set sys/statvfs.h i_sysstatvfs
20920eval $inhdr
20921
b4eb6b3d
JH
20922: see if this is a sys/un.h system
20923set sys/un.h i_sysun
20924eval $inhdr
20925
20926
20927: see if this is a sys/utsname.h system
20928set sys/utsname.h i_sysutsname
20929eval $inhdr
20930
20931: see if this is a syswait system
20932set sys/wait.h i_syswait
20933eval $inhdr
20934
20935: see if this is a ustat.h system
20936set ustat.h i_ustat
20937eval $inhdr
20938
20939: see if this is an utime system
20940set utime.h i_utime
20941eval $inhdr
20942
20943: see if this is a values.h system
20944set values.h i_values
20945eval $inhdr
20946
20947: see if this is a vfork system
20948case "$d_vfork" in
20949"$define")
20950 set vfork.h i_vfork
20951 eval $inhdr
20952 ;;
20953*)
20954 i_vfork="$undef"
20955 ;;
20956esac
20957
b4eb6b3d
JH
20958echo " "
20959echo "Looking for extensions..." >&4
20960: If we are using the old config.sh, known_extensions may contain
20961: old or inaccurate or duplicate values.
20962known_extensions=''
20963nonxs_extensions=''
20964: We do not use find because it might not be available.
20965: We do not just use MANIFEST because the user may have dropped
20966: some additional extensions into the source tree and expect them
20967: to be built.
20968
20969: Function to recursively find available extensions, ignoring DynaLoader
20970: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20971find_extensions='
20972 for xxx in *; do
7c345082
RGS
20973 if $test "$1" = Compress/IO/ ; then
20974 nonxs_extensions="$nonxs_extensions IO/Compress/$xxx";
20975 else
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;
20994 fi
b4eb6b3d
JH
20995 done'
20996tdir=`pwd`
6904989c 20997cd "$rsrc/ext"
b4eb6b3d
JH
20998set X
20999shift
21000eval $find_extensions
4e1a6d26
AD
21001# Special case: Add in threads/shared since it is not picked up by the
21002# recursive find above (and adding in general recursive finding breaks
21003# SDBM_File/sdbm). A.D. 10/25/2001.
998b396c 21004known_extensions="$known_extensions threads/shared"
b4eb6b3d
JH
21005set X $nonxs_extensions
21006shift
21007nonxs_extensions="$*"
21008set X $known_extensions
21009shift
21010known_extensions="$*"
6904989c 21011cd "$tdir"
b4eb6b3d
JH
21012
21013: Now see which are supported on this system.
21014avail_ext=''
21015for xxx in $known_extensions ; do
21016 case "$xxx" in
21017 DB_File|db_file)
21018 case "$i_db" in
21019 $define) avail_ext="$avail_ext $xxx" ;;
21020 esac
21021 ;;
21022 GDBM_File|gdbm_fil)
7c345082 21023 case "$i_gdbm" in
b4eb6b3d
JH
21024 $define) avail_ext="$avail_ext $xxx" ;;
21025 esac
21026 ;;
1d59c593 21027 I18N/Langinfo|i18n_lan)
7c345082 21028 case "$i_langinfo$d_nl_langinfo" in
4bbcc6e8
JH
21029 $define$define) avail_ext="$avail_ext $xxx" ;;
21030 esac
21031 ;;
b4eb6b3d
JH
21032 NDBM_File|ndbm_fil)
21033 case "$i_ndbm" in
21034 $define)
21035 case "$osname-$use64bitint" in
0be9fa5d 21036 hpux-define)
b4eb6b3d
JH
21037 case "$libs" in
21038 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21039 esac
21040 ;;
21041 *) avail_ext="$avail_ext $xxx" ;;
21042 esac
21043 ;;
21044 esac
21045 ;;
7c345082 21046 ODBM_File|odbm_fil)
b4eb6b3d
JH
21047 case "${i_dbm}${i_rpcsvcdbm}" in
21048 *"${define}"*)
21049 case "$osname-$use64bitint" in
0be9fa5d 21050 hpux-define)
b4eb6b3d
JH
21051 case "$libs" in
21052 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21053 esac
21054 ;;
21055 *) avail_ext="$avail_ext $xxx" ;;
21056 esac
21057 ;;
21058 esac
21059 ;;
21060 POSIX|posix)
21061 case "$useposix" in
21062 true|define|y) avail_ext="$avail_ext $xxx" ;;
21063 esac
21064 ;;
21065 Opcode|opcode)
21066 case "$useopcode" in
21067 true|define|y) avail_ext="$avail_ext $xxx" ;;
21068 esac
21069 ;;
21070 Socket|socket)
7c345082 21071 case "$d_socket" in
4a9f028c
JH
21072 true|$define|y)
21073 case "$osname" in
21074 beos) ;; # not unless BONE
21075 *) avail_ext="$avail_ext $xxx" ;;
21076 esac
21077 ;;
b4eb6b3d
JH
21078 esac
21079 ;;
21080 Sys/Syslog|sys/syslog)
21081 : XXX syslog requires socket
7c345082 21082 case "$d_socket" in
b4eb6b3d
JH
21083 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21084 esac
21085 ;;
21086 Thread|thread)
b00ec89b
AB
21087 case "$usethreads" in
21088 true|$define|y)
21089 case "$useithreads" in
21090 $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
21091 esac
b4eb6b3d
JH
21092 esac
21093 ;;
f9b6ed1c
AD
21094 XS/APItest|xs/apitest)
21095 # This is just for testing. Skip it unless we have dynamic loading.
21096
21097 case "$usedl" in
21098 $define) avail_ext="$avail_ext $xxx" ;;
21099 esac
21100 ;;
21101 XS/Typemap|xs/typemap)
21102 # This is just for testing. Skip it unless we have dynamic loading.
21103 case "$usedl" in
21104 $define) avail_ext="$avail_ext $xxx" ;;
21105 esac
21106 ;;
7deadc5f 21107 threads|threads/shared)
73e09c8f
JH
21108 # threads and threads::shared are special cases.
21109 # To stop people from asking "Perl 5.8.0 was supposed
21110 # to have this new fancy threads implementation but my
21111 # perl doesn't have it" and from people trying to
21112 # (re)install the threads module using CPAN.pm and
21113 # CPAN.pm then offering to reinstall Perl 5.8.0,
21114 # the threads.pm and threads/shared.pm will always be
21115 # there, croaking informatively ("you need to rebuild
21116 # all of Perl with threads, sorry") when threads haven't
21117 # been compiled in.
21118 # --jhi
21119 avail_ext="$avail_ext $xxx"
1dca008a 21120 ;;
b4eb6b3d
JH
21121 IPC/SysV|ipc/sysv)
21122 : XXX Do we need a useipcsysv variable here
7c345082 21123 case "${d_msg}${d_sem}${d_shm}" in
b4eb6b3d
JH
21124 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21125 esac
21126 ;;
21127 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
21128 ;;
21129 esac
b4eb6b3d 21130done
5f80c64f 21131
b4eb6b3d
JH
21132set X $avail_ext
21133shift
21134avail_ext="$*"
5f80c64f 21135
ef0c5be8
JH
21136case "$onlyextensions" in
21137'') ;;
21138*) keepextensions=''
21139 echo "You have requested that only certains extensions be included..." >&4
21140 for i in $onlyextensions; do
21141 case " $avail_ext " in
21142 *" $i "*)
21143 echo "Keeping extension $i."
21144 keepextensions="$keepextensions $i"
21145 ;;
21146 *) echo "Ignoring extension $i." ;;
21147 esac
21148 done
21149 avail_ext="$keepextensions"
21150 ;;
21151esac
21152
21153case "$noextensions" in
21154'') ;;
21155*) keepextensions=''
21156 echo "You have requested that certain extensions be ignored..." >&4
21157 for i in $avail_ext; do
c3dadc13
AD
21158 case " $noextensions " in
21159 *" $i "*) echo "Ignoring extension $i." ;;
ef0c5be8
JH
21160 *) echo "Keeping extension $i.";
21161 keepextensions="$keepextensions $i"
21162 ;;
21163 esac
21164 done
21165 avail_ext="$keepextensions"
21166 ;;
21167esac
21168
b4eb6b3d
JH
21169: Now see which nonxs extensions are supported on this system.
21170: For now assume all are.
21171nonxs_ext=''
21172for xxx in $nonxs_extensions ; do
21173 case "$xxx" in
21174 *) nonxs_ext="$nonxs_ext $xxx"
21175 ;;
21176 esac
21177done
5f80c64f 21178
b4eb6b3d
JH
21179set X $nonxs_ext
21180shift
21181nonxs_ext="$*"
21182
21183case $usedl in
21184$define)
21185 $cat <<EOM
21186A number of extensions are supplied with $package. You may choose to
21187compile these extensions for dynamic loading (the default), compile
21188them into the $package executable (static loading), or not include
21189them at all. Answer "none" to include no extensions.
21190Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
21191
21192EOM
b4eb6b3d 21193 case "$dynamic_ext" in
736accd3
YST
21194 '')
21195 : Exclude those listed in static_ext
21196 dflt=''
21197 for xxx in $avail_ext; do
21198 case " $static_ext " in
21199 *" $xxx "*) ;;
21200 *) dflt="$dflt $xxx" ;;
21201 esac
21202 done
21203 set X $dflt
21204 shift
21205 dflt="$*"
21206 ;;
b4eb6b3d
JH
21207 *) dflt="$dynamic_ext"
21208 # Perhaps we are reusing an old out-of-date config.sh.
21209 case "$hint" in
21210 previous)
21211 if test X"$dynamic_ext" != X"$avail_ext"; then
21212 $cat <<EOM
7c345082
RGS
21213NOTICE: Your previous config.sh list may be incorrect.
21214The extensions now available to you are
b4eb6b3d
JH
21215 ${avail_ext}
21216but the default list from your previous config.sh is
7c345082 21217 ${dynamic_ext}
9c839522 21218
b4eb6b3d
JH
21219EOM
21220 fi
9c839522
PM
21221 ;;
21222 esac
b4eb6b3d
JH
21223 ;;
21224 esac
5f80c64f 21225 case "$dflt" in
b4eb6b3d
JH
21226 '') dflt=none;;
21227 esac
21228 rp="What extensions do you wish to load dynamically?"
21229 . ./myread
21230 case "$ans" in
21231 none) dynamic_ext=' ' ;;
21232 *) dynamic_ext="$ans" ;;
5f80c64f 21233 esac
5f80c64f 21234
b4eb6b3d
JH
21235 case "$static_ext" in
21236 '')
21237 : Exclude those already listed in dynamic linking
21238 dflt=''
21239 for xxx in $avail_ext; do
21240 case " $dynamic_ext " in
21241 *" $xxx "*) ;;
21242 *) dflt="$dflt $xxx" ;;
21243 esac
21244 done
21245 set X $dflt
21246 shift
21247 dflt="$*"
21248 ;;
7c345082 21249 *) dflt="$static_ext"
b4eb6b3d
JH
21250 ;;
21251 esac
9c839522 21252
b4eb6b3d
JH
21253 case "$dflt" in
21254 '') dflt=none;;
21255 esac
21256 rp="What extensions do you wish to load statically?"
21257 . ./myread
21258 case "$ans" in
21259 none) static_ext=' ' ;;
21260 *) static_ext="$ans" ;;
21261 esac
21262 ;;
21263*)
21264 $cat <<EOM
7c345082
RGS
21265A number of extensions are supplied with $package. Answer "none"
21266to include no extensions.
b4eb6b3d 21267Note that DynaLoader is always built and need not be mentioned here.
9c839522 21268
b4eb6b3d
JH
21269EOM
21270 case "$static_ext" in
21271 '') dflt="$avail_ext" ;;
21272 *) dflt="$static_ext"
21273 # Perhaps we are reusing an old out-of-date config.sh.
21274 case "$hint" in
21275 previous)
21276 if test X"$static_ext" != X"$avail_ext"; then
21277 $cat <<EOM
7c345082
RGS
21278NOTICE: Your previous config.sh list may be incorrect.
21279The extensions now available to you are
b4eb6b3d
JH
21280 ${avail_ext}
21281but the default list from your previous config.sh is
7c345082 21282 ${static_ext}
5f80c64f
JH
21283
21284EOM
b4eb6b3d
JH
21285 fi
21286 ;;
21287 esac
21288 ;;
21289 esac
21290 : Exclude those that are not xs extensions
21291 case "$dflt" in
21292 '') dflt=none;;
21293 esac
21294 rp="What extensions do you wish to include?"
21295 . ./myread
21296 case "$ans" in
21297 none) static_ext=' ' ;;
21298 *) static_ext="$ans" ;;
21299 esac
21300 ;;
5f80c64f 21301esac
7c345082 21302#
f1f6834f
AD
21303# Encode is a special case. If we are building Encode as a static
21304# extension, we need to explicitly list its subextensions as well.
21305# For other nested extensions, this is handled automatically by
21306# the appropriate Makefile.PL.
21307case " $static_ext " in
21308 *" Encode "*) # Add the subextensions of Encode
21309 cd "$rsrc/ext"
21310 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21311 static_ext="$static_ext Encode/$xxx"
21312 done
21313 cd "$tdir"
21314 ;;
21315esac
5f80c64f 21316
b4eb6b3d
JH
21317set X $dynamic_ext $static_ext $nonxs_ext
21318shift
21319extensions="$*"
21320
93a2cd18
AD
21321# Sanity check: We require an extension suitable for use with
21322# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
21323# should show up as failures in the test suite, but it's helpful to
21324# catch them now.) The 'extensions' list is normally sorted
21325# alphabetically, so we need to accept either
21326# DB_File ... Fcntl ... IO ....
21327# or something like
21328# Fcntl ... NDBM_File ... IO ....
42fde7b2
JH
21329case " $extensions" in
21330*"_File "*" Fcntl "*" IO "*) ;; # DB_File
21331*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21332*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
7a8675bc
JH
21333*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21334 echo "WARNING: The Perl you are building will be quite crippled." >& 4
21335 ;;
21336esac
21337
9c839522
PM
21338: Remove libraries needed only for extensions
21339: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
21340: The exception is SunOS 4.x, which needs them.
21341case "${osname}X${osvers}" in
21342sunos*X4*)
21343 perllibs="$libs"
21344 ;;
21345*) case "$usedl" in
21346 $define|true|[yY]*)
21347 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
21348 shift
21349 perllibs="$*"
21350 ;;
21351 *) perllibs="$libs"
21352 ;;
21353 esac
21354 ;;
9c839522 21355esac
5f80c64f
JH
21356
21357: Remove build directory name from cppstdin so it can be used from
21358: either the present location or the final installed location.
21359echo " "
21360: Get out of the UU directory to get correct path name.
21361cd ..
21362case "$cppstdin" in
21363`pwd`/cppstdin)
21364 echo "Stripping down cppstdin path name"
21365 cppstdin=cppstdin
21366 ;;
21367esac
21368cd UU
21369
21370: end of configuration questions
21371echo " "
21372echo "End of configuration questions."
21373echo " "
21374
21375: back to where it started
21376if test -d ../UU; then
21377 cd ..
21378fi
21379
48370efc
JH
21380: configuration may be patched via a 'config.arch' file
21381if $test -f config.arch; then
21382 echo "I see a config.arch file, loading it."
21383 . ./config.arch
21384fi
21385
5f80c64f
JH
21386: configuration may be patched via a 'config.over' file
21387if $test -f config.over; then
21388 echo " "
21389 dflt=y
21390 rp='I see a config.over file. Do you wish to load it?'
21391 . UU/myread
21392 case "$ans" in
21393 n*) echo "OK, I'll ignore it.";;
21394 *) . ./config.over
21395 echo "Configuration override changes have been loaded."
21396 ;;
21397 esac
21398fi
21399
21400: in case they want portability, strip down executable paths
21401case "$d_portable" in
21402"$define")
21403 echo " "
21404 echo "Stripping down executable paths..." >&4
21405 for file in $loclist $trylist; do
534ac15a
JH
21406 eval temp=\$$file
21407 eval $file=`basename $temp`
5f80c64f
JH
21408 done
21409 ;;
21410esac
21411
21412: create config.sh file
21413echo " "
21414echo "Creating config.sh..." >&4
21415$spitshell <<EOT >config.sh
21416$startsh
21417#
21418# This file was produced by running the Configure script. It holds all the
21419# definitions figured out by Configure. Should you modify one of these values,
21420# do not forget to propagate your changes by running "Configure -der". You may
21421# instead choose to run each of the .SH files by yourself, or "Configure -S".
21422#
21423
21424# Package name : $package
21425# Source directory : $src
21426# Configuration time: $cf_time
21427# Configured by : $cf_by
21428# Target system : $myuname
21429
21430Author='$Author'
21431Date='$Date'
21432Header='$Header'
21433Id='$Id'
21434Locker='$Locker'
21435Log='$Log'
21436Mcc='$Mcc'
21437RCSfile='$RCSfile'
21438Revision='$Revision'
21439Source='$Source'
21440State='$State'
21441_a='$_a'
21442_exe='$_exe'
21443_o='$_o'
b4eb6b3d 21444afs='$afs'
a6d26a0d 21445afsroot='$afsroot'
b4eb6b3d
JH
21446alignbytes='$alignbytes'
21447ansi2knr='$ansi2knr'
21448aphostname='$aphostname'
21449api_revision='$api_revision'
21450api_subversion='$api_subversion'
21451api_version='$api_version'
21452api_versionstring='$api_versionstring'
5f80c64f 21453ar='$ar'
b4eb6b3d
JH
21454archlib='$archlib'
21455archlibexp='$archlibexp'
21456archname64='$archname64'
21457archname='$archname'
5f80c64f 21458archobjs='$archobjs'
10bc17b6 21459asctime_r_proto='$asctime_r_proto'
5f80c64f 21460awk='$awk'
b4eb6b3d 21461baserev='$baserev'
5f80c64f 21462bash='$bash'
b4eb6b3d 21463bin='$bin'
b4eb6b3d 21464binexp='$binexp'
5f80c64f
JH
21465bison='$bison'
21466byacc='$byacc'
b4eb6b3d 21467byteorder='$byteorder'
5f80c64f 21468c='$c'
b4eb6b3d 21469castflags='$castflags'
5f80c64f
JH
21470cat='$cat'
21471cc='$cc'
21472cccdlflags='$cccdlflags'
21473ccdlflags='$ccdlflags'
21474ccflags='$ccflags'
b4eb6b3d 21475ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 21476ccname='$ccname'
b4eb6b3d 21477ccsymbols='$ccsymbols'
6b356c8e 21478ccversion='$ccversion'
5f80c64f 21479cf_by='$cf_by'
b4eb6b3d 21480cf_email='$cf_email'
5f80c64f 21481cf_time='$cf_time'
b4eb6b3d 21482charsize='$charsize'
5f80c64f
JH
21483chgrp='$chgrp'
21484chmod='$chmod'
21485chown='$chown'
b4eb6b3d 21486clocktype='$clocktype'
5f80c64f
JH
21487comm='$comm'
21488compress='$compress'
21489contains='$contains'
21490cp='$cp'
21491cpio='$cpio'
21492cpp='$cpp'
b4eb6b3d
JH
21493cpp_stuff='$cpp_stuff'
21494cppccsymbols='$cppccsymbols'
5f80c64f
JH
21495cppflags='$cppflags'
21496cpplast='$cpplast'
21497cppminus='$cppminus'
21498cpprun='$cpprun'
21499cppstdin='$cppstdin'
b4eb6b3d 21500cppsymbols='$cppsymbols'
10bc17b6 21501crypt_r_proto='$crypt_r_proto'
b4eb6b3d 21502cryptlib='$cryptlib'
5f80c64f 21503csh='$csh'
10bc17b6
JH
21504ctermid_r_proto='$ctermid_r_proto'
21505ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
21506d_Gconvert='$d_Gconvert'
21507d_PRIEUldbl='$d_PRIEUldbl'
21508d_PRIFUldbl='$d_PRIFUldbl'
21509d_PRIGUldbl='$d_PRIGUldbl'
21510d_PRIXU64='$d_PRIXU64'
21511d_PRId64='$d_PRId64'
21512d_PRIeldbl='$d_PRIeldbl'
21513d_PRIfldbl='$d_PRIfldbl'
21514d_PRIgldbl='$d_PRIgldbl'
21515d_PRIi64='$d_PRIi64'
21516d_PRIo64='$d_PRIo64'
21517d_PRIu64='$d_PRIu64'
21518d_PRIx64='$d_PRIx64'
21519d_SCNfldbl='$d_SCNfldbl'
74cac757 21520d__fwalk='$d__fwalk'
b4eb6b3d
JH
21521d_access='$d_access'
21522d_accessx='$d_accessx'
55954f19 21523d_aintl='$d_aintl'
b4eb6b3d
JH
21524d_alarm='$d_alarm'
21525d_archlib='$d_archlib'
10bc17b6 21526d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
21527d_atolf='$d_atolf'
21528d_atoll='$d_atoll'
0dbb1585
AL
21529d_attribute_format='$d_attribute_format'
21530d_attribute_malloc='$d_attribute_malloc'
21531d_attribute_nonnull='$d_attribute_nonnull'
21532d_attribute_noreturn='$d_attribute_noreturn'
21533d_attribute_pure='$d_attribute_pure'
21534d_attribute_unused='$d_attribute_unused'
21535d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
b4eb6b3d
JH
21536d_bcmp='$d_bcmp'
21537d_bcopy='$d_bcopy'
5f80c64f 21538d_bsd='$d_bsd'
b4eb6b3d
JH
21539d_bsdgetpgrp='$d_bsdgetpgrp'
21540d_bsdsetpgrp='$d_bsdsetpgrp'
635aebb7
AL
21541d_builtin_choose_expr='$d_builtin_choose_expr'
21542d_builtin_expect='$d_builtin_expect'
b4eb6b3d 21543d_bzero='$d_bzero'
a2d23ec2 21544d_c99_variadic_macros='$d_c99_variadic_macros'
b4eb6b3d
JH
21545d_casti32='$d_casti32'
21546d_castneg='$d_castneg'
21547d_charvspr='$d_charvspr'
21548d_chown='$d_chown'
21549d_chroot='$d_chroot'
21550d_chsize='$d_chsize'
758a5d79 21551d_class='$d_class'
b0a2e8e6 21552d_clearenv='$d_clearenv'
b4eb6b3d 21553d_closedir='$d_closedir'
4e0554ec 21554d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 21555d_const='$d_const'
55954f19 21556d_copysignl='$d_copysignl'
666ea192 21557d_cplusplus='$d_cplusplus'
b4eb6b3d 21558d_crypt='$d_crypt'
10bc17b6 21559d_crypt_r='$d_crypt_r'
b4eb6b3d 21560d_csh='$d_csh'
13cfc98d 21561d_ctermid='$d_ctermid'
10bc17b6
JH
21562d_ctermid_r='$d_ctermid_r'
21563d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
21564d_cuserid='$d_cuserid'
21565d_dbl_dig='$d_dbl_dig'
2ef53570 21566d_dbminitproto='$d_dbminitproto'
b4eb6b3d 21567d_difftime='$d_difftime'
de52168c 21568d_dir_dd_fd='$d_dir_dd_fd'
ae0e3d3b 21569d_dirfd='$d_dirfd'
b4eb6b3d
JH
21570d_dirnamlen='$d_dirnamlen'
21571d_dlerror='$d_dlerror'
5f80c64f 21572d_dlopen='$d_dlopen'
b4eb6b3d
JH
21573d_dlsymun='$d_dlsymun'
21574d_dosuid='$d_dosuid'
10bc17b6 21575d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
21576d_drand48proto='$d_drand48proto'
21577d_dup2='$d_dup2'
21578d_eaccess='$d_eaccess'
21579d_endgrent='$d_endgrent'
10bc17b6 21580d_endgrent_r='$d_endgrent_r'
b4eb6b3d 21581d_endhent='$d_endhent'
10bc17b6 21582d_endhostent_r='$d_endhostent_r'
b4eb6b3d 21583d_endnent='$d_endnent'
10bc17b6 21584d_endnetent_r='$d_endnetent_r'
b4eb6b3d 21585d_endpent='$d_endpent'
10bc17b6 21586d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 21587d_endpwent='$d_endpwent'
10bc17b6 21588d_endpwent_r='$d_endpwent_r'
b4eb6b3d 21589d_endsent='$d_endsent'
10bc17b6 21590d_endservent_r='$d_endservent_r'
b4eb6b3d 21591d_eofnblk='$d_eofnblk'
5f80c64f 21592d_eunice='$d_eunice'
15b61c98 21593d_faststdio='$d_faststdio'
b363b713 21594d_fchdir='$d_fchdir'
b4eb6b3d
JH
21595d_fchmod='$d_fchmod'
21596d_fchown='$d_fchown'
21597d_fcntl='$d_fcntl'
9d9004a9 21598d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
21599d_fd_macros='$d_fd_macros'
21600d_fd_set='$d_fd_set'
21601d_fds_bits='$d_fds_bits'
21602d_fgetpos='$d_fgetpos'
758a5d79
JH
21603d_finite='$d_finite'
21604d_finitel='$d_finitel'
b4eb6b3d
JH
21605d_flexfnam='$d_flexfnam'
21606d_flock='$d_flock'
2ef53570 21607d_flockproto='$d_flockproto'
b4eb6b3d 21608d_fork='$d_fork'
758a5d79 21609d_fp_class='$d_fp_class'
b4eb6b3d 21610d_fpathconf='$d_fpathconf'
758a5d79
JH
21611d_fpclass='$d_fpclass'
21612d_fpclassify='$d_fpclassify'
21613d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
21614d_fpos64_t='$d_fpos64_t'
21615d_frexpl='$d_frexpl'
21616d_fs_data_s='$d_fs_data_s'
21617d_fseeko='$d_fseeko'
21618d_fsetpos='$d_fsetpos'
21619d_fstatfs='$d_fstatfs'
21620d_fstatvfs='$d_fstatvfs'
411ab01c 21621d_fsync='$d_fsync'
b4eb6b3d
JH
21622d_ftello='$d_ftello'
21623d_ftime='$d_ftime'
dc814df1 21624d_futimes='$d_futimes'
b4eb6b3d
JH
21625d_getcwd='$d_getcwd'
21626d_getespwnam='$d_getespwnam'
21627d_getfsstat='$d_getfsstat'
21628d_getgrent='$d_getgrent'
10bc17b6
JH
21629d_getgrent_r='$d_getgrent_r'
21630d_getgrgid_r='$d_getgrgid_r'
21631d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
21632d_getgrps='$d_getgrps'
21633d_gethbyaddr='$d_gethbyaddr'
21634d_gethbyname='$d_gethbyname'
21635d_gethent='$d_gethent'
21636d_gethname='$d_gethname'
10bc17b6
JH
21637d_gethostbyaddr_r='$d_gethostbyaddr_r'
21638d_gethostbyname_r='$d_gethostbyname_r'
21639d_gethostent_r='$d_gethostent_r'
b4eb6b3d 21640d_gethostprotos='$d_gethostprotos'
4e0554ec 21641d_getitimer='$d_getitimer'
b4eb6b3d 21642d_getlogin='$d_getlogin'
10bc17b6 21643d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
21644d_getmnt='$d_getmnt'
21645d_getmntent='$d_getmntent'
21646d_getnbyaddr='$d_getnbyaddr'
21647d_getnbyname='$d_getnbyname'
21648d_getnent='$d_getnent'
10bc17b6
JH
21649d_getnetbyaddr_r='$d_getnetbyaddr_r'
21650d_getnetbyname_r='$d_getnetbyname_r'
21651d_getnetent_r='$d_getnetent_r'
b4eb6b3d 21652d_getnetprotos='$d_getnetprotos'
0c0643d0 21653d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
21654d_getpbyname='$d_getpbyname'
21655d_getpbynumber='$d_getpbynumber'
21656d_getpent='$d_getpent'
21657d_getpgid='$d_getpgid'
21658d_getpgrp2='$d_getpgrp2'
21659d_getpgrp='$d_getpgrp'
21660d_getppid='$d_getppid'
21661d_getprior='$d_getprior'
10bc17b6
JH
21662d_getprotobyname_r='$d_getprotobyname_r'
21663d_getprotobynumber_r='$d_getprotobynumber_r'
21664d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
21665d_getprotoprotos='$d_getprotoprotos'
21666d_getprpwnam='$d_getprpwnam'
21667d_getpwent='$d_getpwent'
10bc17b6
JH
21668d_getpwent_r='$d_getpwent_r'
21669d_getpwnam_r='$d_getpwnam_r'
21670d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
21671d_getsbyname='$d_getsbyname'
21672d_getsbyport='$d_getsbyport'
21673d_getsent='$d_getsent'
10bc17b6
JH
21674d_getservbyname_r='$d_getservbyname_r'
21675d_getservbyport_r='$d_getservbyport_r'
21676d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
21677d_getservprotos='$d_getservprotos'
21678d_getspnam='$d_getspnam'
10bc17b6 21679d_getspnam_r='$d_getspnam_r'
b4eb6b3d 21680d_gettimeod='$d_gettimeod'
10bc17b6 21681d_gmtime_r='$d_gmtime_r'
5f80c64f 21682d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
21683d_grpasswd='$d_grpasswd'
21684d_hasmntopt='$d_hasmntopt'
21685d_htonl='$d_htonl'
55954f19 21686d_ilogbl='$d_ilogbl'
f3f1a2d8 21687d_inc_version_list='$d_inc_version_list'
b4eb6b3d
JH
21688d_index='$d_index'
21689d_inetaton='$d_inetaton'
21690d_int64_t='$d_int64_t'
21691d_isascii='$d_isascii'
758a5d79
JH
21692d_isfinite='$d_isfinite'
21693d_isinf='$d_isinf'
b4eb6b3d
JH
21694d_isnan='$d_isnan'
21695d_isnanl='$d_isnanl'
21696d_killpg='$d_killpg'
21697d_lchown='$d_lchown'
21698d_ldbl_dig='$d_ldbl_dig'
0a0abfba 21699d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 21700d_link='$d_link'
10bc17b6 21701d_localtime_r='$d_localtime_r'
8572b25d 21702d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
b4eb6b3d
JH
21703d_locconv='$d_locconv'
21704d_lockf='$d_lockf'
21705d_longdbl='$d_longdbl'
21706d_longlong='$d_longlong'
21707d_lseekproto='$d_lseekproto'
21708d_lstat='$d_lstat'
21709d_madvise='$d_madvise'
7dd121ae
MB
21710d_malloc_good_size='$d_malloc_good_size'
21711d_malloc_size='$d_malloc_size'
b4eb6b3d
JH
21712d_mblen='$d_mblen'
21713d_mbstowcs='$d_mbstowcs'
21714d_mbtowc='$d_mbtowc'
21715d_memchr='$d_memchr'
21716d_memcmp='$d_memcmp'
21717d_memcpy='$d_memcpy'
21718d_memmove='$d_memmove'
21719d_memset='$d_memset'
21720d_mkdir='$d_mkdir'
21721d_mkdtemp='$d_mkdtemp'
21722d_mkfifo='$d_mkfifo'
21723d_mkstemp='$d_mkstemp'
21724d_mkstemps='$d_mkstemps'
21725d_mktime='$d_mktime'
21726d_mmap='$d_mmap'
21727d_modfl='$d_modfl'
e67aeab1 21728d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 21729d_modflproto='$d_modflproto'
b4eb6b3d
JH
21730d_mprotect='$d_mprotect'
21731d_msg='$d_msg'
21732d_msg_ctrunc='$d_msg_ctrunc'
21733d_msg_dontroute='$d_msg_dontroute'
21734d_msg_oob='$d_msg_oob'
21735d_msg_peek='$d_msg_peek'
21736d_msg_proxy='$d_msg_proxy'
21737d_msgctl='$d_msgctl'
21738d_msgget='$d_msgget'
4e0554ec 21739d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
21740d_msgrcv='$d_msgrcv'
21741d_msgsnd='$d_msgsnd'
21742d_msync='$d_msync'
21743d_munmap='$d_munmap'
21744d_mymalloc='$d_mymalloc'
21745d_nice='$d_nice'
2765b840 21746d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 21747d_nv_preserves_uv='$d_nv_preserves_uv'
f607920a 21748d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
b4eb6b3d
JH
21749d_off64_t='$d_off64_t'
21750d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21751d_oldpthreads='$d_oldpthreads'
21752d_oldsock='$d_oldsock'
21753d_open3='$d_open3'
21754d_pathconf='$d_pathconf'
21755d_pause='$d_pause'
21756d_perl_otherlibdirs='$d_perl_otherlibdirs'
21757d_phostname='$d_phostname'
21758d_pipe='$d_pipe'
21759d_poll='$d_poll'
5f80c64f 21760d_portable='$d_portable'
dcb594bc 21761d_printf_format_null='$d_printf_format_null'
c7aff470 21762d_procselfexe='$d_procselfexe'
d6483fcc 21763d_pthread_atfork='$d_pthread_atfork'
58d975c3 21764d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
21765d_pthread_yield='$d_pthread_yield'
21766d_pwage='$d_pwage'
21767d_pwchange='$d_pwchange'
21768d_pwclass='$d_pwclass'
21769d_pwcomment='$d_pwcomment'
21770d_pwexpire='$d_pwexpire'
21771d_pwgecos='$d_pwgecos'
21772d_pwpasswd='$d_pwpasswd'
21773d_pwquota='$d_pwquota'
21774d_qgcvt='$d_qgcvt'
21775d_quad='$d_quad'
10bc17b6
JH
21776d_random_r='$d_random_r'
21777d_readdir64_r='$d_readdir64_r'
b4eb6b3d 21778d_readdir='$d_readdir'
10bc17b6 21779d_readdir_r='$d_readdir_r'
b4eb6b3d 21780d_readlink='$d_readlink'
4e0554ec
JH
21781d_readv='$d_readv'
21782d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
21783d_rename='$d_rename'
21784d_rewinddir='$d_rewinddir'
21785d_rmdir='$d_rmdir'
21786d_safebcpy='$d_safebcpy'
21787d_safemcpy='$d_safemcpy'
21788d_sanemcmp='$d_sanemcmp'
ef9f17be 21789d_sbrkproto='$d_sbrkproto'
55954f19 21790d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
21791d_sched_yield='$d_sched_yield'
21792d_scm_rights='$d_scm_rights'
21793d_seekdir='$d_seekdir'
21794d_select='$d_select'
21795d_sem='$d_sem'
21796d_semctl='$d_semctl'
21797d_semctl_semid_ds='$d_semctl_semid_ds'
21798d_semctl_semun='$d_semctl_semun'
21799d_semget='$d_semget'
21800d_semop='$d_semop'
4e0554ec 21801d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
21802d_setegid='$d_setegid'
21803d_seteuid='$d_seteuid'
21804d_setgrent='$d_setgrent'
10bc17b6 21805d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
21806d_setgrps='$d_setgrps'
21807d_sethent='$d_sethent'
10bc17b6 21808d_sethostent_r='$d_sethostent_r'
4e0554ec 21809d_setitimer='$d_setitimer'
b4eb6b3d
JH
21810d_setlinebuf='$d_setlinebuf'
21811d_setlocale='$d_setlocale'
10bc17b6 21812d_setlocale_r='$d_setlocale_r'
b4eb6b3d 21813d_setnent='$d_setnent'
10bc17b6 21814d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
21815d_setpent='$d_setpent'
21816d_setpgid='$d_setpgid'
21817d_setpgrp2='$d_setpgrp2'
21818d_setpgrp='$d_setpgrp'
21819d_setprior='$d_setprior'
21820d_setproctitle='$d_setproctitle'
10bc17b6 21821d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 21822d_setpwent='$d_setpwent'
10bc17b6 21823d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
21824d_setregid='$d_setregid'
21825d_setresgid='$d_setresgid'
21826d_setresuid='$d_setresuid'
21827d_setreuid='$d_setreuid'
21828d_setrgid='$d_setrgid'
21829d_setruid='$d_setruid'
21830d_setsent='$d_setsent'
10bc17b6 21831d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
21832d_setsid='$d_setsid'
21833d_setvbuf='$d_setvbuf'
21834d_sfio='$d_sfio'
21835d_shm='$d_shm'
21836d_shmat='$d_shmat'
21837d_shmatprototype='$d_shmatprototype'
21838d_shmctl='$d_shmctl'
21839d_shmdt='$d_shmdt'
21840d_shmget='$d_shmget'
21841d_sigaction='$d_sigaction'
983dbef6 21842d_sigprocmask='$d_sigprocmask'
b4eb6b3d 21843d_sigsetjmp='$d_sigsetjmp'
c95d0e17 21844d_sitearch='$d_sitearch'
4f5da3e9 21845d_snprintf='$d_snprintf'
49a78c82 21846d_sockatmark='$d_sockatmark'
2ef53570 21847d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
21848d_socket='$d_socket'
21849d_socklen_t='$d_socklen_t'
21850d_sockpair='$d_sockpair'
21851d_socks5_init='$d_socks5_init'
360321b3 21852d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
b4eb6b3d 21853d_sqrtl='$d_sqrtl'
10bc17b6
JH
21854d_srand48_r='$d_srand48_r'
21855d_srandom_r='$d_srandom_r'
eef837ea 21856d_sresgproto='$d_sresgproto'
640374d0 21857d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
21858d_statblks='$d_statblks'
21859d_statfs_f_flags='$d_statfs_f_flags'
21860d_statfs_s='$d_statfs_s'
21861d_statvfs='$d_statvfs'
21862d_stdio_cnt_lval='$d_stdio_cnt_lval'
21863d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
21864d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21865d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
21866d_stdio_stream_array='$d_stdio_stream_array'
21867d_stdiobase='$d_stdiobase'
21868d_stdstdio='$d_stdstdio'
21869d_strchr='$d_strchr'
21870d_strcoll='$d_strcoll'
21871d_strctcpy='$d_strctcpy'
21872d_strerrm='$d_strerrm'
21873d_strerror='$d_strerror'
10bc17b6 21874d_strerror_r='$d_strerror_r'
b3c85772 21875d_strftime='$d_strftime'
08c92000
MB
21876d_strlcat='$d_strlcat'
21877d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
21878d_strtod='$d_strtod'
21879d_strtol='$d_strtol'
21880d_strtold='$d_strtold'
21881d_strtoll='$d_strtoll'
28e5dec8 21882d_strtoq='$d_strtoq'
b4eb6b3d
JH
21883d_strtoul='$d_strtoul'
21884d_strtoull='$d_strtoull'
21885d_strtouq='$d_strtouq'
21886d_strxfrm='$d_strxfrm'
21887d_suidsafe='$d_suidsafe'
21888d_symlink='$d_symlink'
21889d_syscall='$d_syscall'
2ef53570 21890d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
21891d_sysconf='$d_sysconf'
21892d_sysernlst='$d_sysernlst'
21893d_syserrlst='$d_syserrlst'
21894d_system='$d_system'
21895d_tcgetpgrp='$d_tcgetpgrp'
21896d_tcsetpgrp='$d_tcsetpgrp'
21897d_telldir='$d_telldir'
21898d_telldirproto='$d_telldirproto'
21899d_time='$d_time'
21900d_times='$d_times'
14b90194
JH
21901d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21902d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 21903d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 21904d_truncate='$d_truncate'
10bc17b6 21905d_ttyname_r='$d_ttyname_r'
b4eb6b3d 21906d_tzname='$d_tzname'
4e0554ec
JH
21907d_u32align='$d_u32align'
21908d_ualarm='$d_ualarm'
b4eb6b3d
JH
21909d_umask='$d_umask'
21910d_uname='$d_uname'
21911d_union_semun='$d_union_semun'
758a5d79 21912d_unordered='$d_unordered'
bdf33aa7 21913d_unsetenv='$d_unsetenv'
4e0554ec 21914d_usleep='$d_usleep'
2ef53570 21915d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
21916d_ustat='$d_ustat'
21917d_vendorarch='$d_vendorarch'
21918d_vendorbin='$d_vendorbin'
21919d_vendorlib='$d_vendorlib'
6e1038e0 21920d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
21921d_vfork='$d_vfork'
21922d_void_closedir='$d_void_closedir'
21923d_voidsig='$d_voidsig'
21924d_voidtty='$d_voidtty'
21925d_volatile='$d_volatile'
21926d_vprintf='$d_vprintf'
4f5da3e9 21927d_vsnprintf='$d_vsnprintf'
b4eb6b3d
JH
21928d_wait4='$d_wait4'
21929d_waitpid='$d_waitpid'
21930d_wcstombs='$d_wcstombs'
21931d_wctomb='$d_wctomb'
4e0554ec 21932d_writev='$d_writev'
5f80c64f
JH
21933d_xenix='$d_xenix'
21934date='$date'
b4eb6b3d
JH
21935db_hashtype='$db_hashtype'
21936db_prefixtype='$db_prefixtype'
640374d0
JH
21937db_version_major='$db_version_major'
21938db_version_minor='$db_version_minor'
21939db_version_patch='$db_version_patch'
b4eb6b3d
JH
21940defvoidused='$defvoidused'
21941direntrytype='$direntrytype'
21942dlext='$dlext'
5f80c64f 21943dlsrc='$dlsrc'
b4eb6b3d
JH
21944doublesize='$doublesize'
21945drand01='$drand01'
10bc17b6 21946drand48_r_proto='$drand48_r_proto'
b4eb6b3d
JH
21947dynamic_ext='$dynamic_ext'
21948eagain='$eagain'
21949ebcdic='$ebcdic'
5f80c64f
JH
21950echo='$echo'
21951egrep='$egrep'
21952emacs='$emacs'
10bc17b6
JH
21953endgrent_r_proto='$endgrent_r_proto'
21954endhostent_r_proto='$endhostent_r_proto'
21955endnetent_r_proto='$endnetent_r_proto'
21956endprotoent_r_proto='$endprotoent_r_proto'
21957endpwent_r_proto='$endpwent_r_proto'
21958endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
21959eunicefix='$eunicefix'
21960exe_ext='$exe_ext'
21961expr='$expr'
b4eb6b3d 21962extensions='$extensions'
6fcddf3b 21963extras='$extras'
b4eb6b3d
JH
21964fflushNULL='$fflushNULL'
21965fflushall='$fflushall'
5f80c64f
JH
21966find='$find'
21967firstmakefile='$firstmakefile'
21968flex='$flex'
b4eb6b3d
JH
21969fpossize='$fpossize'
21970fpostype='$fpostype'
21971freetype='$freetype'
5440bc8e 21972from='$from'
b4eb6b3d
JH
21973full_ar='$full_ar'
21974full_csh='$full_csh'
21975full_sed='$full_sed'
2d736872 21976gccansipedantic='$gccansipedantic'
5b463ca7 21977gccosandvers='$gccosandvers'
5f80c64f 21978gccversion='$gccversion'
10bc17b6
JH
21979getgrent_r_proto='$getgrent_r_proto'
21980getgrgid_r_proto='$getgrgid_r_proto'
21981getgrnam_r_proto='$getgrnam_r_proto'
21982gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21983gethostbyname_r_proto='$gethostbyname_r_proto'
21984gethostent_r_proto='$gethostent_r_proto'
21985getlogin_r_proto='$getlogin_r_proto'
21986getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21987getnetbyname_r_proto='$getnetbyname_r_proto'
21988getnetent_r_proto='$getnetent_r_proto'
21989getprotobyname_r_proto='$getprotobyname_r_proto'
21990getprotobynumber_r_proto='$getprotobynumber_r_proto'
21991getprotoent_r_proto='$getprotoent_r_proto'
21992getpwent_r_proto='$getpwent_r_proto'
21993getpwnam_r_proto='$getpwnam_r_proto'
21994getpwuid_r_proto='$getpwuid_r_proto'
21995getservbyname_r_proto='$getservbyname_r_proto'
21996getservbyport_r_proto='$getservbyport_r_proto'
21997getservent_r_proto='$getservent_r_proto'
21998getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
21999gidformat='$gidformat'
22000gidsign='$gidsign'
22001gidsize='$gidsize'
22002gidtype='$gidtype'
5f80c64f 22003glibpth='$glibpth'
3c728e00 22004gmake='$gmake'
10bc17b6 22005gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 22006gnulibc_version='$gnulibc_version'
5f80c64f 22007grep='$grep'
b4eb6b3d
JH
22008groupcat='$groupcat'
22009groupstype='$groupstype'
5f80c64f 22010gzip='$gzip'
b4eb6b3d
JH
22011h_fcntl='$h_fcntl'
22012h_sysfile='$h_sysfile'
5f80c64f 22013hint='$hint'
b4eb6b3d 22014hostcat='$hostcat'
6e1038e0
MB
22015html1dir='$html1dir'
22016html1direxp='$html1direxp'
22017html3dir='$html3dir'
22018html3direxp='$html3direxp'
b4eb6b3d
JH
22019i16size='$i16size'
22020i16type='$i16type'
22021i32size='$i32size'
22022i32type='$i32type'
22023i64size='$i64size'
22024i64type='$i64type'
22025i8size='$i8size'
22026i8type='$i8type'
22027i_arpainet='$i_arpainet'
22028i_bsdioctl='$i_bsdioctl'
10bc17b6 22029i_crypt='$i_crypt'
b4eb6b3d
JH
22030i_db='$i_db'
22031i_dbm='$i_dbm'
22032i_dirent='$i_dirent'
5f80c64f 22033i_dld='$i_dld'
b4eb6b3d
JH
22034i_dlfcn='$i_dlfcn'
22035i_fcntl='$i_fcntl'
22036i_float='$i_float'
758a5d79
JH
22037i_fp='$i_fp'
22038i_fp_class='$i_fp_class'
b4eb6b3d
JH
22039i_gdbm='$i_gdbm'
22040i_grp='$i_grp'
b4eb6b3d
JH
22041i_ieeefp='$i_ieeefp'
22042i_inttypes='$i_inttypes'
2765b840 22043i_langinfo='$i_langinfo'
b4eb6b3d
JH
22044i_libutil='$i_libutil'
22045i_limits='$i_limits'
22046i_locale='$i_locale'
22047i_machcthr='$i_machcthr'
22048i_malloc='$i_malloc'
22049i_math='$i_math'
22050i_memory='$i_memory'
22051i_mntent='$i_mntent'
22052i_ndbm='$i_ndbm'
22053i_netdb='$i_netdb'
22054i_neterrno='$i_neterrno'
22055i_netinettcp='$i_netinettcp'
22056i_niin='$i_niin'
22057i_poll='$i_poll'
22058i_prot='$i_prot'
22059i_pthread='$i_pthread'
22060i_pwd='$i_pwd'
22061i_rpcsvcdbm='$i_rpcsvcdbm'
22062i_sfio='$i_sfio'
22063i_sgtty='$i_sgtty'
22064i_shadow='$i_shadow'
22065i_socks='$i_socks'
22066i_stdarg='$i_stdarg'
22067i_stddef='$i_stddef'
22068i_stdlib='$i_stdlib'
22069i_string='$i_string'
22070i_sunmath='$i_sunmath'
22071i_sysaccess='$i_sysaccess'
22072i_sysdir='$i_sysdir'
22073i_sysfile='$i_sysfile'
22074i_sysfilio='$i_sysfilio'
22075i_sysin='$i_sysin'
22076i_sysioctl='$i_sysioctl'
22077i_syslog='$i_syslog'
22078i_sysmman='$i_sysmman'
22079i_sysmode='$i_sysmode'
22080i_sysmount='$i_sysmount'
22081i_sysndir='$i_sysndir'
22082i_sysparam='$i_sysparam'
22083i_sysresrc='$i_sysresrc'
22084i_syssecrt='$i_syssecrt'
22085i_sysselct='$i_sysselct'
22086i_syssockio='$i_syssockio'
22087i_sysstat='$i_sysstat'
22088i_sysstatfs='$i_sysstatfs'
22089i_sysstatvfs='$i_sysstatvfs'
22090i_systime='$i_systime'
22091i_systimek='$i_systimek'
22092i_systimes='$i_systimes'
22093i_systypes='$i_systypes'
22094i_sysuio='$i_sysuio'
22095i_sysun='$i_sysun'
22096i_sysutsname='$i_sysutsname'
22097i_sysvfs='$i_sysvfs'
22098i_syswait='$i_syswait'
22099i_termio='$i_termio'
22100i_termios='$i_termios'
22101i_time='$i_time'
22102i_unistd='$i_unistd'
22103i_ustat='$i_ustat'
22104i_utime='$i_utime'
22105i_values='$i_values'
22106i_varargs='$i_varargs'
22107i_varhdr='$i_varhdr'
22108i_vfork='$i_vfork'
5f80c64f 22109ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
22110inc_version_list='$inc_version_list'
22111inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
22112incpath='$incpath'
22113inews='$inews'
f3f1a2d8 22114initialinstalllocation='$initialinstalllocation'
b4eb6b3d
JH
22115installarchlib='$installarchlib'
22116installbin='$installbin'
6e1038e0
MB
22117installhtml1dir='$installhtml1dir'
22118installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
22119installman1dir='$installman1dir'
22120installman3dir='$installman3dir'
22121installprefix='$installprefix'
22122installprefixexp='$installprefixexp'
22123installprivlib='$installprivlib'
22124installscript='$installscript'
22125installsitearch='$installsitearch'
22126installsitebin='$installsitebin'
8d2cbf27
JH
22127installsitehtml1dir='$installsitehtml1dir'
22128installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 22129installsitelib='$installsitelib'
91e123a8
JH
22130installsiteman1dir='$installsiteman1dir'
22131installsiteman3dir='$installsiteman3dir'
6e1038e0 22132installsitescript='$installsitescript'
b4eb6b3d
JH
22133installstyle='$installstyle'
22134installusrbinperl='$installusrbinperl'
22135installvendorarch='$installvendorarch'
22136installvendorbin='$installvendorbin'
8d2cbf27
JH
22137installvendorhtml1dir='$installvendorhtml1dir'
22138installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 22139installvendorlib='$installvendorlib'
91e123a8
JH
22140installvendorman1dir='$installvendorman1dir'
22141installvendorman3dir='$installvendorman3dir'
6e1038e0 22142installvendorscript='$installvendorscript'
b4eb6b3d 22143intsize='$intsize'
4b661809 22144issymlink='$issymlink'
b4eb6b3d
JH
22145ivdformat='$ivdformat'
22146ivsize='$ivsize'
22147ivtype='$ivtype'
22148known_extensions='$known_extensions'
5f80c64f 22149ksh='$ksh'
5f80c64f
JH
22150ld='$ld'
22151lddlflags='$lddlflags'
22152ldflags='$ldflags'
b4eb6b3d
JH
22153ldflags_uselargefiles='$ldflags_uselargefiles'
22154ldlibpthname='$ldlibpthname'
5f80c64f
JH
22155less='$less'
22156lib_ext='$lib_ext'
22157libc='$libc'
b4eb6b3d 22158libperl='$libperl'
5f80c64f
JH
22159libpth='$libpth'
22160libs='$libs'
43999f95
JH
22161libsdirs='$libsdirs'
22162libsfiles='$libsfiles'
22163libsfound='$libsfound'
13b3f787 22164libspath='$libspath'
5f80c64f 22165libswanted='$libswanted'
b4eb6b3d 22166libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
22167line='$line'
22168lint='$lint'
22169lkflags='$lkflags'
22170ln='$ln'
22171lns='$lns'
10bc17b6 22172localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
22173locincpth='$locincpth'
22174loclibpth='$loclibpth'
b4eb6b3d
JH
22175longdblsize='$longdblsize'
22176longlongsize='$longlongsize'
22177longsize='$longsize'
5f80c64f
JH
22178lp='$lp'
22179lpr='$lpr'
22180ls='$ls'
b4eb6b3d
JH
22181lseeksize='$lseeksize'
22182lseektype='$lseektype'
a724edfe 22183mad='$mad'
f3f1a2d8
MB
22184madlyh='$madlyh'
22185madlyobj='$madlyobj'
22186madlysrc='$madlysrc'
5f80c64f
JH
22187mail='$mail'
22188mailx='$mailx'
22189make='$make'
22190make_set_make='$make_set_make'
b4eb6b3d
JH
22191mallocobj='$mallocobj'
22192mallocsrc='$mallocsrc'
22193malloctype='$malloctype'
22194man1dir='$man1dir'
22195man1direxp='$man1direxp'
22196man1ext='$man1ext'
22197man3dir='$man3dir'
22198man3direxp='$man3direxp'
22199man3ext='$man3ext'
5f80c64f 22200mips_type='$mips_type'
5129fff4 22201mistrustnm='$mistrustnm'
5f80c64f 22202mkdir='$mkdir'
b4eb6b3d
JH
22203mmaptype='$mmaptype'
22204modetype='$modetype'
5f80c64f 22205more='$more'
b4eb6b3d 22206multiarch='$multiarch'
5f80c64f 22207mv='$mv'
b4eb6b3d
JH
22208myarchname='$myarchname'
22209mydomain='$mydomain'
22210myhostname='$myhostname'
5f80c64f
JH
22211myuname='$myuname'
22212n='$n'
2cc61e15 22213need_va_copy='$need_va_copy'
b4eb6b3d
JH
22214netdb_hlen_type='$netdb_hlen_type'
22215netdb_host_type='$netdb_host_type'
22216netdb_name_type='$netdb_name_type'
22217netdb_net_type='$netdb_net_type'
5f80c64f
JH
22218nm='$nm'
22219nm_opt='$nm_opt'
22220nm_so_opt='$nm_so_opt'
b4eb6b3d 22221nonxs_ext='$nonxs_ext'
5f80c64f 22222nroff='$nroff'
b4eb6b3d
JH
22223nvEUformat='$nvEUformat'
22224nvFUformat='$nvFUformat'
22225nvGUformat='$nvGUformat'
53133ed1 22226nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
22227nveformat='$nveformat'
22228nvfformat='$nvfformat'
22229nvgformat='$nvgformat'
22230nvsize='$nvsize'
22231nvtype='$nvtype'
22232o_nonblock='$o_nonblock'
5f80c64f 22233obj_ext='$obj_ext'
b4eb6b3d 22234old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 22235optimize='$optimize'
b4eb6b3d 22236orderlib='$orderlib'
5f80c64f
JH
22237osname='$osname'
22238osvers='$osvers'
b4eb6b3d 22239otherlibdirs='$otherlibdirs'
5f80c64f 22240package='$package'
b4eb6b3d
JH
22241pager='$pager'
22242passcat='$passcat'
22243patchlevel='$patchlevel'
5f80c64f 22244path_sep='$path_sep'
b4eb6b3d 22245perl5='$perl5'
5f80c64f 22246perl='$perl'
151e6568 22247perl_patchlevel='$perl_patchlevel'
b4eb6b3d 22248perladmin='$perladmin'
9c839522 22249perllibs='$perllibs'
b4eb6b3d 22250perlpath='$perlpath'
5f80c64f 22251pg='$pg'
b4eb6b3d
JH
22252phostname='$phostname'
22253pidtype='$pidtype'
5f80c64f
JH
22254plibpth='$plibpth'
22255pmake='$pmake'
22256pr='$pr'
b4eb6b3d
JH
22257prefix='$prefix'
22258prefixexp='$prefixexp'
22259privlib='$privlib'
22260privlibexp='$privlibexp'
f24dbf84 22261procselfexe='$procselfexe'
b4eb6b3d
JH
22262prototype='$prototype'
22263ptrsize='$ptrsize'
22264quadkind='$quadkind'
22265quadtype='$quadtype'
22266randbits='$randbits'
22267randfunc='$randfunc'
10bc17b6 22268random_r_proto='$random_r_proto'
b4eb6b3d
JH
22269randseedtype='$randseedtype'
22270ranlib='$ranlib'
22271rd_nodata='$rd_nodata'
10bc17b6
JH
22272readdir64_r_proto='$readdir64_r_proto'
22273readdir_r_proto='$readdir_r_proto'
b4eb6b3d 22274revision='$revision'
5f80c64f
JH
22275rm='$rm'
22276rmail='$rmail'
5440bc8e 22277run='$run'
5f80c64f 22278runnm='$runnm'
b4eb6b3d
JH
22279sPRIEUldbl='$sPRIEUldbl'
22280sPRIFUldbl='$sPRIFUldbl'
22281sPRIGUldbl='$sPRIGUldbl'
22282sPRIXU64='$sPRIXU64'
22283sPRId64='$sPRId64'
22284sPRIeldbl='$sPRIeldbl'
22285sPRIfldbl='$sPRIfldbl'
22286sPRIgldbl='$sPRIgldbl'
22287sPRIi64='$sPRIi64'
22288sPRIo64='$sPRIo64'
22289sPRIu64='$sPRIu64'
22290sPRIx64='$sPRIx64'
22291sSCNfldbl='$sSCNfldbl'
22292sched_yield='$sched_yield'
22293scriptdir='$scriptdir'
22294scriptdirexp='$scriptdirexp'
5f80c64f 22295sed='$sed'
b4eb6b3d
JH
22296seedfunc='$seedfunc'
22297selectminbits='$selectminbits'
22298selecttype='$selecttype'
5f80c64f 22299sendmail='$sendmail'
10bc17b6
JH
22300setgrent_r_proto='$setgrent_r_proto'
22301sethostent_r_proto='$sethostent_r_proto'
22302setlocale_r_proto='$setlocale_r_proto'
22303setnetent_r_proto='$setnetent_r_proto'
22304setprotoent_r_proto='$setprotoent_r_proto'
22305setpwent_r_proto='$setpwent_r_proto'
22306setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
22307sh='$sh'
22308shar='$shar'
22309sharpbang='$sharpbang'
b4eb6b3d
JH
22310shmattype='$shmattype'
22311shortsize='$shortsize'
22312shrpenv='$shrpenv'
5f80c64f 22313shsharp='$shsharp'
b4eb6b3d
JH
22314sig_count='$sig_count'
22315sig_name='$sig_name'
22316sig_name_init='$sig_name_init'
22317sig_num='$sig_num'
22318sig_num_init='$sig_num_init'
76d3c696 22319sig_size='$sig_size'
b4eb6b3d
JH
22320signal_t='$signal_t'
22321sitearch='$sitearch'
22322sitearchexp='$sitearchexp'
22323sitebin='$sitebin'
22324sitebinexp='$sitebinexp'
8d2cbf27
JH
22325sitehtml1dir='$sitehtml1dir'
22326sitehtml1direxp='$sitehtml1direxp'
22327sitehtml3dir='$sitehtml3dir'
22328sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
22329sitelib='$sitelib'
22330sitelib_stem='$sitelib_stem'
22331sitelibexp='$sitelibexp'
91e123a8
JH
22332siteman1dir='$siteman1dir'
22333siteman1direxp='$siteman1direxp'
22334siteman3dir='$siteman3dir'
22335siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
22336siteprefix='$siteprefix'
22337siteprefixexp='$siteprefixexp'
6e1038e0
MB
22338sitescript='$sitescript'
22339sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
22340sizesize='$sizesize'
22341sizetype='$sizetype'
5f80c64f
JH
22342sleep='$sleep'
22343smail='$smail'
5f80c64f 22344so='$so'
b4eb6b3d
JH
22345sockethdr='$sockethdr'
22346socketlib='$socketlib'
22347socksizetype='$socksizetype'
5f80c64f
JH
22348sort='$sort'
22349spackage='$spackage'
22350spitshell='$spitshell'
10bc17b6
JH
22351srand48_r_proto='$srand48_r_proto'
22352srandom_r_proto='$srandom_r_proto'
5f80c64f 22353src='$src'
b4eb6b3d
JH
22354ssizetype='$ssizetype'
22355startperl='$startperl'
5f80c64f 22356startsh='$startsh'
b4eb6b3d
JH
22357static_ext='$static_ext'
22358stdchar='$stdchar'
22359stdio_base='$stdio_base'
22360stdio_bufsiz='$stdio_bufsiz'
22361stdio_cnt='$stdio_cnt'
22362stdio_filbuf='$stdio_filbuf'
22363stdio_ptr='$stdio_ptr'
22364stdio_stream_array='$stdio_stream_array'
10bc17b6 22365strerror_r_proto='$strerror_r_proto'
b4eb6b3d 22366strings='$strings'
5f80c64f 22367submit='$submit'
b4eb6b3d
JH
22368subversion='$subversion'
22369sysman='$sysman'
5f80c64f
JH
22370tail='$tail'
22371tar='$tar'
5440bc8e 22372targetarch='$targetarch'
5f80c64f
JH
22373tbl='$tbl'
22374tee='$tee'
22375test='$test'
b4eb6b3d
JH
22376timeincl='$timeincl'
22377timetype='$timetype'
10bc17b6 22378tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 22379to='$to'
5f80c64f
JH
22380touch='$touch'
22381tr='$tr'
22382trnl='$trnl'
22383troff='$troff'
10bc17b6 22384ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
22385u16size='$u16size'
22386u16type='$u16type'
22387u32size='$u32size'
22388u32type='$u32type'
22389u64size='$u64size'
22390u64type='$u64type'
22391u8size='$u8size'
22392u8type='$u8type'
22393uidformat='$uidformat'
22394uidsign='$uidsign'
22395uidsize='$uidsize'
22396uidtype='$uidtype'
5f80c64f
JH
22397uname='$uname'
22398uniq='$uniq'
b4eb6b3d
JH
22399uquadtype='$uquadtype'
22400use5005threads='$use5005threads'
22401use64bitall='$use64bitall'
22402use64bitint='$use64bitint'
5440bc8e 22403usecrosscompile='$usecrosscompile'
5f80c64f 22404usedl='$usedl'
15b61c98 22405usefaststdio='$usefaststdio'
b4eb6b3d
JH
22406useithreads='$useithreads'
22407uselargefiles='$uselargefiles'
22408uselongdouble='$uselongdouble'
19a100ff 22409usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
22410usemorebits='$usemorebits'
22411usemultiplicity='$usemultiplicity'
22412usemymalloc='$usemymalloc'
5f80c64f 22413usenm='$usenm'
b4eb6b3d
JH
22414useopcode='$useopcode'
22415useperlio='$useperlio'
22416useposix='$useposix'
9514c62b 22417usereentrant='$usereentrant'
d51aaa9d 22418userelocatableinc='$userelocatableinc'
b4eb6b3d
JH
22419usesfio='$usesfio'
22420useshrplib='$useshrplib'
5f106f9c 22421usesitecustomize='$usesitecustomize'
29209bc5 22422usesocks='$usesocks'
b4eb6b3d
JH
22423usethreads='$usethreads'
22424usevendorprefix='$usevendorprefix'
22425usevfork='$usevfork'
5f80c64f
JH
22426usrinc='$usrinc'
22427uuname='$uuname'
b4eb6b3d
JH
22428uvXUformat='$uvXUformat'
22429uvoformat='$uvoformat'
22430uvsize='$uvsize'
22431uvtype='$uvtype'
22432uvuformat='$uvuformat'
22433uvxformat='$uvxformat'
22434vendorarch='$vendorarch'
22435vendorarchexp='$vendorarchexp'
22436vendorbin='$vendorbin'
22437vendorbinexp='$vendorbinexp'
8d2cbf27
JH
22438vendorhtml1dir='$vendorhtml1dir'
22439vendorhtml1direxp='$vendorhtml1direxp'
22440vendorhtml3dir='$vendorhtml3dir'
22441vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
22442vendorlib='$vendorlib'
22443vendorlib_stem='$vendorlib_stem'
22444vendorlibexp='$vendorlibexp'
91e123a8
JH
22445vendorman1dir='$vendorman1dir'
22446vendorman1direxp='$vendorman1direxp'
22447vendorman3dir='$vendorman3dir'
22448vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
22449vendorprefix='$vendorprefix'
22450vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
22451vendorscript='$vendorscript'
22452vendorscriptexp='$vendorscriptexp'
b4eb6b3d 22453version='$version'
861eb78d 22454version_patchlevel_string='$version_patchlevel_string'
d56c5707 22455versiononly='$versiononly'
5f80c64f 22456vi='$vi'
b4eb6b3d 22457voidflags='$voidflags'
5f80c64f 22458xlibpth='$xlibpth'
3659ebf1
JH
22459yacc='$yacc'
22460yaccflags='$yaccflags'
5f80c64f
JH
22461zcat='$zcat'
22462zip='$zip'
22463EOT
22464
22465: Add in command line options if available
22466$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22467
22468: add special variables
22469$test -f $src/patchlevel.h && \
d00b958f 22470awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 22471echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 22472echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
22473
22474: propagate old symbols
22475if $test -f UU/config.sh; then
381aa1ff 22476 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 22477 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 22478 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
22479 set X `cat UU/oldsyms`
22480 shift
22481 case $# in
22482 0) ;;
22483 *)
22484 cat <<EOM
22485Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22486EOM
22487 echo "# Variables propagated from previous config.sh file." >>config.sh
22488 for sym in `cat UU/oldsyms`; do
22489 echo " Propagating $hint variable "'$'"$sym..."
22490 eval 'tmp="$'"${sym}"'"'
22491 echo "$tmp" | \
22492 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22493 done
22494 ;;
22495 esac
22496fi
22497
22498: Finish up by extracting the .SH files
22499case "$alldone" in
22500exit)
22501 $rm -rf UU
24ccb310 22502 echo "Extraction done."
5f80c64f
JH
22503 exit 0
22504 ;;
22505cont)
22506 ;;
22507'')
22508 dflt=''
22509 nostick=true
22510 $cat <<EOM
22511
22512If you'd like to make any changes to the config.sh file before I begin
22513to configure things, do it as a shell escape now (e.g. !vi config.sh).
22514
22515EOM
22516 rp="Press return or use a shell escape to edit config.sh:"
22517 . UU/myread
22518 nostick=''
22519 case "$ans" in
22520 '') ;;
22521 *) : in case they cannot read
22522 sh 1>&4 -c "$ans";;
22523 esac
22524 ;;
22525esac
22526
22527: if this fails, just run all the .SH files by hand
22528. ./config.sh
22529
22530echo " "
22531exec 1>&4
a43e8593 22532pwd=`pwd`
5f80c64f 22533. ./UU/extract
6904989c 22534cd "$pwd"
5f80c64f
JH
22535
22536if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22537 dflt=y
22538 case "$silent" in
22539 true) ;;
22540 *)
22541 $cat <<EOM
22542
22543Now you need to generate make dependencies by running "$make depend".
22544You might prefer to run it in background: "$make depend > makedepend.out &"
22545It can take a while, so you might not want to run it right now.
22546
22547EOM
22548 ;;
22549 esac
22550 rp="Run $make depend now?"
22551 . UU/myread
22552 case "$ans" in
22553 y*)
3d5d58b1 22554 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
22555 ;;
22556 *)
22557 echo "You must run '$make depend' then '$make'."
22558 ;;
22559 esac
22560elif test -f [Mm]akefile; then
22561 echo " "
22562 echo "Now you must run a $make."
22563else
24ccb310 22564 echo "Configure done."
5f80c64f
JH
22565fi
22566
22567if $test -f Policy.sh; then
22568 $cat <<EOM
22569
22570If you compile $package on a different machine or from a different object
22571directory, copy the Policy.sh file from this object directory to the
22572new one before you run Configure -- this will help you with most of
22573the policy defaults.
22574
22575EOM
22576fi
22577if $test -f config.msg; then
22578 echo "Hmm. I also noted the following information while running:"
22579 echo " "
22580 $cat config.msg >&4
22581 $rm -f config.msg
22582fi
22583$rm -f kit*isdone ark*isdone
22584$rm -rf UU
22585
22586: End of Configure
22587