This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
C++ compilation fix by Steve Peters
[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#
15fcae63 29# Generated on Fri Mar 9 20:00:14 CET 2007 [metaconfig 3.0 PL70]
7f2de2d2 30# (with additional metaconfig patches by perlbug@perl.org)
2304df62 31
283fdd21 32cat >c1$$ <<EOF
2304df62
AD
33ARGGGHHHH!!!!!
34
35SCO csh still thinks true is false. Write to SCO today and tell them that next
36year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
39we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41[End of diatribe. We now return you to your regularly scheduled programming...]
42EOF
283fdd21 43cat >c2$$ <<EOF
2304df62
AD
44
45OOPS! You naughty creature! You didn't run Configure with sh!
46I will attempt to remedy the situation by running sh for you...
47EOF
48
283fdd21 49true || cat c1$$ c2$$
2304df62
AD
50true || exec sh $0 $argv:q
51
283fdd21 52(exit $?0) || cat c2$$
2304df62 53(exit $?0) || exec sh $0 $argv:q
283fdd21 54rm -f c1$$ c2$$
2304df62 55
f6538904 56if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
cbee2ce6
JH
57 cat >&4 <<EOF
58***
59*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60*** Configure that well. (Plan 9 is close to UNIX but not close enough.)
61*** Please read the README.plan9 for further instructions.
62*** Cannot continue, aborting.
63***
64EOF
65 exit 1
66fi
67
f8e2af1d
MC
68if test ! -c /dev/null ; then
69 cat >&4 <<EOF
70***
71*** I'm sorry, but /dev/null appears to be a file rather than a device.
72*** Please consult your operating sytem's notes for making a device
73*** in /dev.
74*** Cannot continue, aborting.
75***
76EOF
77 exit 1
78fi
79
a0d0e21e
LW
80: compute my invocation name
81me=$0
82case "$0" in
83*/*)
84 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
85 test "$me" || me=$0
86 ;;
87esac
88
dfe9444c 89: Proper separator for the PATH environment variable
8e07c86e
AD
90p_=:
91: On OS/2 this directory should exist if this is not floppy only system :-]
5c728af0 92if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
dfe9444c
AD
93 if test -n "$OS2_SHELL"; then
94 p_=\;
95 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
96 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
5c728af0 97 is_os2=yes
c4f23d77 98 elif test -n "$DJGPP"; then
495e2cbe
MB
99 case "X${MACHTYPE:-nonesuchmach}" in
100 *cygwin) ;;
101 *) p_=\; ;;
102 esac
dfe9444c 103 fi
39e571d4 104fi
a0d0e21e
LW
105
106: Proper PATH setting
107paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 108paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 109paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 110paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e 111paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
87bdd940 112paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
232e078e
AD
113paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
114paths="$paths /sbin /usr/sbin /usr/libexec"
3c728e00 115paths="$paths /system/gnu_library/bin"
a0d0e21e
LW
116
117for p in $paths
118do
8e07c86e
AD
119 case "$p_$PATH$p_" in
120 *$p_$p$p_*) ;;
121 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
122 esac
123done
124
8e07c86e 125PATH=.$p_$PATH
2304df62
AD
126export PATH
127
dfe9444c
AD
128: shall we be using ksh?
129inksh=''
130needksh=''
131avoidksh=''
132newsh=/bin/ksh
133changesh=''
ff0cee69 134if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
135 inksh=true
136fi
137if test -f /hp-ux -a -f /bin/ksh; then
138 needksh='to avoid sh bug in "here document" expansion'
139fi
140if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
141 if test X`/usr/bin/uname -v` = X4; then
142 avoidksh="to avoid AIX 4's /bin/sh"
143 newsh=/usr/bin/bsh
2304df62 144 fi
dfe9444c 145fi
cf04f91f
JH
146if test -f /osf_boot -a -f /usr/sbin/setld; then
147 if test X`/usr/bin/uname -s` = XOSF1; then
148 avoidksh="to avoid Digital UNIX' ksh"
149 newsh=/bin/sh
150 unset BIN_SH # if this is 'xpg4' sh will start up ksh
151 fi
152fi
dfe9444c
AD
153case "$inksh/$needksh" in
154/[a-z]*)
c4f23d77 155 ENV=''
dfe9444c
AD
156 changesh=true
157 reason="$needksh"
158 ;;
159esac
160case "$inksh/$avoidksh" in
161true/[a-z]*)
162 changesh=true
163 reason="$avoidksh"
164 ;;
165esac
166case "$inksh/$needksh-$avoidksh-" in
167true/--)
a0d0e21e
LW
168 cat <<EOM
169(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 170mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 171EOM
dfe9444c
AD
172 ;;
173esac
174case "$changesh" in
175true)
2e2a97a6 176 export newsh
dfe9444c
AD
177 echo "(Feeding myself to $newsh $reason.)"
178 case "$0" in
179 Configure|*/Configure) exec $newsh $0 "$@";;
180 *) exec $newsh Configure "$@";;
181 esac
182 ;;
183esac
2304df62 184
bfb7748a
AD
185: if needed set CDPATH to a harmless value that is not chatty
186: avoid bash 2.02 problems with empty CDPATH.
187case "$CDPATH" in
188'') ;;
189*) case "$SHELL" in
190 *bash*) CDPATH='.' ;;
191 *) CDPATH='' ;;
192 esac
193 ;;
194esac
2304df62
AD
195: Configure runs within the UU subdirectory
196test -d UU || mkdir UU
8e07c86e 197cd UU && rm -f ./*
2304df62 198
6b356c8e
JH
199ccname=''
200ccversion=''
b4eb6b3d
JH
201ccsymbols=''
202cppccsymbols=''
203cppsymbols=''
5440bc8e
JH
204from=''
205run=''
206targetarch=''
207to=''
208usecrosscompile=''
6b34ded5 209mistrustnm=''
9c839522 210perllibs=''
b4eb6b3d
JH
211dynamic_ext=''
212extensions=''
213known_extensions=''
214nonxs_ext=''
215static_ext=''
216useopcode=''
217useposix=''
6fcddf3b 218extras=''
ecfc5424 219d_bsd=''
40a7a20a 220d_eunice=''
2304df62
AD
221d_xenix=''
222eunicefix=''
223Mcc=''
dfe9444c 224ar=''
2304df62
AD
225awk=''
226bash=''
227bison=''
228byacc=''
229cat=''
230chgrp=''
231chmod=''
232chown=''
ecfc5424 233comm=''
2304df62
AD
234compress=''
235cp=''
236cpio=''
237cpp=''
238csh=''
239date=''
240echo=''
241egrep=''
242emacs=''
243expr=''
244find=''
245flex=''
3c728e00 246gmake=''
2304df62 247grep=''
8ff267be 248gzip=''
2304df62
AD
249inews=''
250ksh=''
251less=''
252line=''
253lint=''
254ln=''
255lp=''
256lpr=''
257ls=''
258mail=''
259mailx=''
dfe9444c 260make=''
2304df62
AD
261mkdir=''
262more=''
263mv=''
693762b4 264nm=''
2304df62
AD
265nroff=''
266perl=''
267pg=''
268pmake=''
269pr=''
270rm=''
271rmail=''
272sed=''
273sendmail=''
2304df62
AD
274shar=''
275sleep=''
276smail=''
277sort=''
278submit=''
279tail=''
280tar=''
281tbl=''
693762b4 282tee=''
2304df62
AD
283test=''
284touch=''
285tr=''
286troff=''
287uname=''
288uniq=''
289uuname=''
290vi=''
291zcat=''
8ff267be 292zip=''
b4eb6b3d
JH
293full_ar=''
294full_sed=''
a0d0e21e 295libswanted=''
2304df62
AD
296hint=''
297myuname=''
85e6fe83
LW
298osname=''
299osvers=''
2304df62
AD
300Author=''
301Date=''
302Header=''
303Id=''
304Locker=''
305Log=''
306RCSfile=''
307Revision=''
308Source=''
309State=''
dfe9444c
AD
310_a=''
311_exe=''
312_o=''
4633a7c4
LW
313archobjs=''
314exe_ext=''
315firstmakefile=''
316lib_ext=''
317obj_ext=''
318path_sep=''
b4eb6b3d 319afs=''
a6d26a0d 320afsroot=''
b4eb6b3d
JH
321alignbytes=''
322ansi2knr=''
323archlib=''
324archlibexp=''
325d_archlib=''
326installarchlib=''
327archname=''
328myarchname=''
329d_atolf=''
330d_atoll=''
331baserev=''
332bin=''
333binexp=''
f3f1a2d8 334initialinstalllocation=''
b4eb6b3d 335installbin=''
f3f1a2d8 336userelocatableinc=''
b4eb6b3d 337byteorder=''
2304df62 338cc=''
2304df62
AD
339ccflags=''
340cppflags=''
341ldflags=''
342lkflags=''
8e07c86e 343locincpth=''
2304df62 344optimize=''
b4eb6b3d 345cf_email=''
2304df62
AD
346cf_by=''
347cf_time=''
b4eb6b3d 348charsize=''
2304df62 349contains=''
b4eb6b3d 350cpp_stuff=''
2304df62
AD
351cpplast=''
352cppminus=''
353cpprun=''
354cppstdin=''
74cac757 355d__fwalk=''
b4eb6b3d
JH
356d_access=''
357d_accessx=''
55954f19 358d_aintl=''
b4eb6b3d 359d_alarm=''
10bc17b6
JH
360asctime_r_proto=''
361d_asctime_r=''
0dbb1585
AL
362d_attribute_format=''
363d_attribute_malloc=''
364d_attribute_nonnull=''
365d_attribute_noreturn=''
366d_attribute_pure=''
367d_attribute_unused=''
368d_attribute_warn_unused_result=''
dcb594bc 369d_printf_format_null=''
b4eb6b3d
JH
370d_bcmp=''
371d_bcopy=''
635aebb7
AL
372d_builtin_choose_expr=''
373d_builtin_expect=''
b4eb6b3d 374d_bzero=''
a2d23ec2 375d_c99_variadic_macros=''
b4eb6b3d
JH
376d_casti32=''
377castflags=''
378d_castneg=''
379d_chown=''
380d_chroot=''
381d_chsize=''
758a5d79 382d_class=''
b0a2e8e6 383d_clearenv=''
b4eb6b3d
JH
384d_closedir=''
385d_void_closedir=''
4e0554ec 386d_cmsghdr_s=''
b4eb6b3d 387d_const=''
36adc09b 388d_copysignl=''
666ea192 389d_cplusplus=''
b4eb6b3d
JH
390cryptlib=''
391d_crypt=''
10bc17b6
JH
392crypt_r_proto=''
393d_crypt_r=''
b4eb6b3d
JH
394d_csh=''
395full_csh=''
13cfc98d 396d_ctermid=''
10bc17b6
JH
397ctermid_r_proto=''
398d_ctermid_r=''
399ctime_r_proto=''
400d_ctime_r=''
b4eb6b3d
JH
401d_cuserid=''
402d_dbl_dig=''
2ef53570 403d_dbminitproto=''
b4eb6b3d 404d_difftime=''
de52168c 405d_dir_dd_fd=''
ae0e3d3b 406d_dirfd=''
b4eb6b3d 407d_dlerror=''
a0d0e21e 408d_dlopen=''
b4eb6b3d
JH
409d_dlsymun=''
410d_dosuid=''
411d_suidsafe=''
10bc17b6
JH
412d_drand48_r=''
413drand48_r_proto=''
b4eb6b3d
JH
414d_drand48proto=''
415d_dup2=''
416d_eaccess=''
417d_endgrent=''
10bc17b6
JH
418d_endgrent_r=''
419endgrent_r_proto=''
b4eb6b3d 420d_endhent=''
10bc17b6
JH
421d_endhostent_r=''
422endhostent_r_proto=''
b4eb6b3d 423d_endnent=''
10bc17b6
JH
424d_endnetent_r=''
425endnetent_r_proto=''
b4eb6b3d 426d_endpent=''
10bc17b6
JH
427d_endprotoent_r=''
428endprotoent_r_proto=''
b4eb6b3d 429d_endpwent=''
10bc17b6
JH
430d_endpwent_r=''
431endpwent_r_proto=''
b4eb6b3d 432d_endsent=''
10bc17b6
JH
433d_endservent_r=''
434endservent_r_proto=''
15b61c98 435d_faststdio=''
b363b713 436d_fchdir=''
b4eb6b3d
JH
437d_fchmod=''
438d_fchown=''
439d_fcntl=''
9d9004a9 440d_fcntl_can_lock=''
b4eb6b3d
JH
441d_fd_macros=''
442d_fd_set=''
443d_fds_bits=''
444d_fgetpos=''
758a5d79
JH
445d_finite=''
446d_finitel=''
b4eb6b3d
JH
447d_flexfnam=''
448d_flock=''
2ef53570 449d_flockproto=''
b4eb6b3d 450d_fork=''
758a5d79
JH
451d_fp_class=''
452d_fpclass=''
453d_fpclassify=''
454d_fpclassl=''
b4eb6b3d
JH
455d_fpos64_t=''
456d_frexpl=''
457d_fs_data_s=''
458d_fseeko=''
459d_fsetpos=''
460d_fstatfs=''
411ab01c 461d_fsync=''
b4eb6b3d
JH
462d_ftello=''
463d_ftime=''
464d_gettimeod=''
dc814df1 465d_futimes=''
b4eb6b3d
JH
466d_Gconvert=''
467d_getcwd=''
468d_getespwnam=''
469d_getfsstat=''
470d_getgrent=''
10bc17b6
JH
471d_getgrent_r=''
472getgrent_r_proto=''
473d_getgrgid_r=''
474getgrgid_r_proto=''
475d_getgrnam_r=''
476getgrnam_r_proto=''
b4eb6b3d
JH
477d_getgrps=''
478d_gethbyaddr=''
479d_gethbyname=''
480d_gethent=''
481aphostname=''
482d_gethname=''
483d_phostname=''
484d_uname=''
10bc17b6
JH
485d_gethostbyaddr_r=''
486gethostbyaddr_r_proto=''
487d_gethostbyname_r=''
488gethostbyname_r_proto=''
489d_gethostent_r=''
490gethostent_r_proto=''
b4eb6b3d 491d_gethostprotos=''
4e0554ec 492d_getitimer=''
b4eb6b3d 493d_getlogin=''
10bc17b6
JH
494d_getlogin_r=''
495getlogin_r_proto=''
b4eb6b3d
JH
496d_getmnt=''
497d_getmntent=''
498d_getnbyaddr=''
499d_getnbyname=''
500d_getnent=''
10bc17b6
JH
501d_getnetbyaddr_r=''
502getnetbyaddr_r_proto=''
503d_getnetbyname_r=''
504getnetbyname_r_proto=''
505d_getnetent_r=''
506getnetent_r_proto=''
b4eb6b3d 507d_getnetprotos=''
0c0643d0 508d_getpagsz=''
b4eb6b3d
JH
509d_getpent=''
510d_getpgid=''
511d_getpgrp2=''
512d_bsdgetpgrp=''
513d_getpgrp=''
514d_getppid=''
515d_getprior=''
516d_getpbyname=''
517d_getpbynumber=''
10bc17b6
JH
518d_getprotobyname_r=''
519getprotobyname_r_proto=''
520d_getprotobynumber_r=''
521getprotobynumber_r_proto=''
522d_getprotoent_r=''
523getprotoent_r_proto=''
b4eb6b3d
JH
524d_getprotoprotos=''
525d_getprpwnam=''
526d_getpwent=''
10bc17b6
JH
527d_getpwent_r=''
528getpwent_r_proto=''
529d_getpwnam_r=''
530getpwnam_r_proto=''
531d_getpwuid_r=''
532getpwuid_r_proto=''
b4eb6b3d 533d_getsent=''
10bc17b6
JH
534d_getservbyname_r=''
535getservbyname_r_proto=''
536d_getservbyport_r=''
537getservbyport_r_proto=''
538d_getservent_r=''
539getservent_r_proto=''
b4eb6b3d
JH
540d_getservprotos=''
541d_getspnam=''
10bc17b6
JH
542d_getspnam_r=''
543getspnam_r_proto=''
b4eb6b3d
JH
544d_getsbyname=''
545d_getsbyport=''
10bc17b6
JH
546d_gmtime_r=''
547gmtime_r_proto=''
a4f3eea9 548d_gnulibc=''
5f6e0ee4 549gnulibc_version=''
b4eb6b3d
JH
550d_hasmntopt=''
551d_htonl=''
55954f19 552d_ilogbl=''
b4eb6b3d
JH
553d_inetaton=''
554d_int64_t=''
555d_isascii=''
758a5d79
JH
556d_isfinite=''
557d_isinf=''
b4eb6b3d
JH
558d_isnan=''
559d_isnanl=''
560d_killpg=''
561d_lchown=''
562d_ldbl_dig=''
0a0abfba 563d_libm_lib_version=''
b4eb6b3d 564d_link=''
10bc17b6 565d_localtime_r=''
8572b25d 566d_localtime_r_needs_tzset=''
10bc17b6 567localtime_r_proto=''
b4eb6b3d
JH
568d_locconv=''
569d_lockf=''
570d_longdbl=''
571longdblsize=''
572d_longlong=''
573longlongsize=''
574d_lseekproto=''
575d_lstat=''
576d_madvise=''
7dd121ae
MB
577d_malloc_good_size=''
578d_malloc_size=''
b4eb6b3d
JH
579d_mblen=''
580d_mbstowcs=''
581d_mbtowc=''
582d_memchr=''
583d_memcmp=''
584d_memcpy=''
585d_memmove=''
586d_memset=''
587d_mkdir=''
588d_mkdtemp=''
589d_mkfifo=''
590d_mkstemp=''
591d_mkstemps=''
592d_mktime=''
593d_mmap=''
594mmaptype=''
595d_modfl=''
e67aeab1 596d_modfl_pow32_bug=''
bc9a1b2c 597d_modflproto=''
b4eb6b3d
JH
598d_mprotect=''
599d_msg=''
600d_msgctl=''
601d_msgget=''
4e0554ec 602d_msghdr_s=''
b4eb6b3d
JH
603d_msgrcv=''
604d_msgsnd=''
605d_msync=''
606d_munmap=''
607d_nice=''
2765b840 608d_nl_langinfo=''
b4eb6b3d
JH
609d_off64_t=''
610d_open3=''
611d_fpathconf=''
612d_pathconf=''
613d_pause=''
614d_pipe=''
615d_poll=''
2304df62 616d_portable=''
a33c94aa 617d_procselfexe=''
f24dbf84 618procselfexe=''
b4eb6b3d
JH
619d_old_pthread_create_joinable=''
620old_pthread_create_joinable=''
d6483fcc 621d_pthread_atfork=''
58d975c3 622d_pthread_attr_setscope=''
b4eb6b3d
JH
623d_pthread_yield=''
624d_sched_yield=''
625sched_yield=''
626d_qgcvt=''
10bc17b6
JH
627d_random_r=''
628random_r_proto=''
629d_readdir64_r=''
630readdir64_r_proto=''
b4eb6b3d
JH
631d_readdir=''
632d_rewinddir=''
633d_seekdir=''
634d_telldir=''
10bc17b6
JH
635d_readdir_r=''
636readdir_r_proto=''
b4eb6b3d 637d_readlink=''
4e0554ec
JH
638d_readv=''
639d_recvmsg=''
b4eb6b3d
JH
640d_rename=''
641d_rmdir=''
642d_safebcpy=''
643d_safemcpy=''
644d_sanemcmp=''
ef9f17be 645d_sbrkproto=''
55954f19 646d_scalbnl=''
b4eb6b3d
JH
647d_select=''
648d_sem=''
649d_semctl=''
650d_semget=''
651d_semop=''
4e0554ec 652d_sendmsg=''
b4eb6b3d
JH
653d_setegid=''
654d_seteuid=''
655d_setgrent=''
10bc17b6
JH
656d_setgrent_r=''
657setgrent_r_proto=''
b4eb6b3d
JH
658d_setgrps=''
659d_sethent=''
10bc17b6
JH
660d_sethostent_r=''
661sethostent_r_proto=''
4e0554ec 662d_setitimer=''
b4eb6b3d
JH
663d_setlinebuf=''
664d_setlocale=''
10bc17b6
JH
665d_setlocale_r=''
666setlocale_r_proto=''
b4eb6b3d 667d_setnent=''
10bc17b6
JH
668d_setnetent_r=''
669setnetent_r_proto=''
b4eb6b3d
JH
670d_setpent=''
671d_setpgid=''
672d_setpgrp2=''
673d_bsdsetpgrp=''
674d_setpgrp=''
675d_setprior=''
676d_setproctitle=''
10bc17b6
JH
677d_setprotoent_r=''
678setprotoent_r_proto=''
b4eb6b3d 679d_setpwent=''
10bc17b6
JH
680d_setpwent_r=''
681setpwent_r_proto=''
b4eb6b3d
JH
682d_setregid=''
683d_setresgid=''
684d_setresuid=''
685d_setreuid=''
686d_setrgid=''
687d_setruid=''
688d_setsent=''
10bc17b6
JH
689d_setservent_r=''
690setservent_r_proto=''
b4eb6b3d
JH
691d_setsid=''
692d_setvbuf=''
693d_sfio=''
694usesfio=''
695d_shm=''
696d_shmat=''
697d_shmatprototype=''
698shmattype=''
699d_shmctl=''
700d_shmdt=''
701d_shmget=''
702d_sigaction=''
ed140128 703d_signbit=''
983dbef6 704d_sigprocmask=''
b4eb6b3d 705d_sigsetjmp=''
5f106f9c 706usesitecustomize=''
4f5da3e9
SP
707d_snprintf=''
708d_vsnprintf=''
49a78c82 709d_sockatmark=''
2ef53570 710d_sockatmarkproto=''
b4eb6b3d
JH
711d_msg_ctrunc=''
712d_msg_dontroute=''
713d_msg_oob=''
714d_msg_peek=''
715d_msg_proxy=''
716d_oldsock=''
717d_scm_rights=''
718d_socket=''
719d_sockpair=''
720sockethdr=''
721socketlib=''
722d_socklen_t=''
723d_socks5_init=''
360321b3 724d_sprintf_returns_strlen=''
b4eb6b3d 725d_sqrtl=''
10bc17b6
JH
726d_srand48_r=''
727srand48_r_proto=''
728d_srandom_r=''
729srandom_r_proto=''
eef837ea 730d_sresgproto=''
640374d0 731d_sresuproto=''
b4eb6b3d
JH
732d_statblks=''
733d_statfs_f_flags=''
734d_statfs_s=''
735d_fstatvfs=''
736d_statvfs=''
737d_stdio_cnt_lval=''
738d_stdio_ptr_lval=''
a7ffa9b9
NC
739d_stdio_ptr_lval_nochange_cnt=''
740d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
741d_stdiobase=''
742d_stdstdio=''
743stdio_base=''
744stdio_bufsiz=''
745stdio_cnt=''
746stdio_filbuf=''
747stdio_ptr=''
748d_index=''
749d_strchr=''
750d_strcoll=''
751d_strctcpy=''
752d_strerrm=''
753d_strerror=''
754d_sysernlst=''
755d_syserrlst=''
10bc17b6
JH
756d_strerror_r=''
757strerror_r_proto=''
b3c85772 758d_strftime=''
08c92000
MB
759d_strlcat=''
760d_strlcpy=''
b4eb6b3d
JH
761d_strtod=''
762d_strtol=''
763d_strtold=''
764d_strtoll=''
28e5dec8 765d_strtoq=''
b4eb6b3d
JH
766d_strtoul=''
767d_strtoull=''
768d_strtouq=''
769d_strxfrm=''
770d_symlink=''
771d_syscall=''
2ef53570 772d_syscallproto=''
b4eb6b3d
JH
773d_sysconf=''
774d_system=''
775d_tcgetpgrp=''
776d_tcsetpgrp=''
777d_telldirproto=''
778d_time=''
779timetype=''
780clocktype=''
781d_times=''
10bc17b6
JH
782d_tmpnam_r=''
783tmpnam_r_proto=''
b4eb6b3d 784d_truncate=''
10bc17b6
JH
785d_ttyname_r=''
786ttyname_r_proto=''
b4eb6b3d 787d_tzname=''
4e0554ec
JH
788d_u32align=''
789d_ualarm=''
b4eb6b3d
JH
790d_umask=''
791d_semctl_semid_ds=''
792d_semctl_semun=''
793d_union_semun=''
758a5d79 794d_unordered=''
bdf33aa7 795d_unsetenv=''
4e0554ec 796d_usleep=''
2ef53570 797d_usleepproto=''
b4eb6b3d 798d_ustat=''
233e16ce 799d_pseudofork=''
b4eb6b3d
JH
800d_vfork=''
801usevfork=''
802d_voidsig=''
803signal_t=''
804d_volatile=''
805d_charvspr=''
806d_vprintf=''
807d_wait4=''
808d_waitpid=''
809d_wcstombs=''
810d_wctomb=''
4e0554ec 811d_writev=''
b4eb6b3d 812dlext=''
85e6fe83
LW
813cccdlflags=''
814ccdlflags=''
2304df62 815dlsrc=''
232e078e 816ld=''
85e6fe83 817lddlflags=''
2304df62 818usedl=''
b4eb6b3d
JH
819doublesize=''
820ebcdic=''
821fflushNULL=''
822fflushall=''
823fpossize=''
824fpostype=''
2d736872 825gccansipedantic=''
5b463ca7 826gccosandvers=''
8a27cf78 827gccversion=''
b4eb6b3d
JH
828gidformat=''
829gidsign=''
830gidsize=''
831gidtype=''
832groupstype=''
833h_fcntl=''
834h_sysfile=''
6e1038e0
MB
835html1dir=''
836html1direxp=''
837installhtml1dir=''
838html3dir=''
839html3direxp=''
840installhtml3dir=''
b4eb6b3d 841i_arpainet=''
10bc17b6 842i_crypt=''
b4eb6b3d
JH
843db_hashtype=''
844db_prefixtype=''
640374d0
JH
845db_version_major=''
846db_version_minor=''
847db_version_patch=''
b4eb6b3d
JH
848i_db=''
849i_dbm=''
850i_rpcsvcdbm=''
851d_dirnamlen=''
852direntrytype=''
853i_dirent=''
a0d0e21e 854i_dld=''
b4eb6b3d
JH
855i_dlfcn=''
856i_fcntl=''
857i_float=''
758a5d79
JH
858i_fp=''
859i_fp_class=''
b4eb6b3d
JH
860i_gdbm=''
861d_grpasswd=''
862i_grp=''
b4eb6b3d
JH
863i_ieeefp=''
864i_inttypes=''
2765b840 865i_langinfo=''
b4eb6b3d
JH
866i_libutil=''
867i_limits=''
868i_locale=''
869i_machcthr=''
870i_malloc=''
871i_math=''
872i_memory=''
873i_mntent=''
874i_ndbm=''
875i_netdb=''
876i_neterrno=''
877i_netinettcp=''
878i_niin=''
879i_sysin=''
880i_poll=''
881i_prot=''
882i_pthread=''
883d_pwage=''
884d_pwchange=''
885d_pwclass=''
886d_pwcomment=''
887d_pwexpire=''
888d_pwgecos=''
889d_pwpasswd=''
890d_pwquota=''
891i_pwd=''
892i_sfio=''
893i_shadow=''
894i_socks=''
895i_stddef=''
896i_stdlib=''
897i_string=''
898strings=''
899i_sunmath=''
900i_sysaccess=''
901i_sysdir=''
902i_sysfile=''
903d_voidtty=''
904i_bsdioctl=''
905i_sysfilio=''
906i_sysioctl=''
907i_syssockio=''
908i_syslog=''
909i_sysmman=''
910i_sysmode=''
911i_sysmount=''
912i_sysndir=''
913i_sysparam=''
914i_sysresrc=''
915i_syssecrt=''
916i_sysselct=''
917i_sysstat=''
918i_sysstatfs=''
919i_sysstatvfs=''
920i_systimes=''
921i_systypes=''
922i_sysuio=''
923i_sysun=''
924i_sysutsname=''
925i_sysvfs=''
926i_syswait=''
927i_sgtty=''
928i_termio=''
929i_termios=''
14b90194
JH
930d_tm_tm_gmtoff=''
931d_tm_tm_zone=''
b4eb6b3d
JH
932i_systime=''
933i_systimek=''
934i_time=''
935timeincl=''
936i_unistd=''
937i_ustat=''
938i_utime=''
939i_values=''
940i_stdarg=''
941i_varargs=''
942i_varhdr=''
943i_vfork=''
f3f1a2d8 944d_inc_version_list=''
b4eb6b3d
JH
945inc_version_list=''
946inc_version_list_init=''
947installprefix=''
948installprefixexp=''
949installstyle=''
950installusrbinperl=''
951intsize=''
952longsize=''
953shortsize=''
4b661809 954issymlink=''
2304df62 955libc=''
b4eb6b3d
JH
956ldlibpthname=''
957libperl=''
958shrpenv=''
959useshrplib=''
a0d0e21e 960glibpth=''
2304df62 961libpth=''
8e07c86e 962loclibpth=''
2304df62
AD
963plibpth=''
964xlibpth=''
1cfa4ec7 965ignore_versioned_solibs=''
2304df62 966libs=''
43999f95
JH
967libsdirs=''
968libsfiles=''
969libsfound=''
13b3f787 970libspath=''
85e6fe83 971lns=''
b4eb6b3d
JH
972d_PRIEUldbl=''
973d_PRIFUldbl=''
974d_PRIGUldbl=''
975d_PRIeldbl=''
976d_PRIfldbl=''
977d_PRIgldbl=''
978d_SCNfldbl=''
979sPRIEUldbl=''
980sPRIFUldbl=''
981sPRIGUldbl=''
982sPRIeldbl=''
983sPRIfldbl=''
984sPRIgldbl=''
985sSCNfldbl=''
986lseeksize=''
987lseektype=''
d620c7b3 988mad=''
00e74f14
NC
989madlyh=''
990madlyobj=''
991madlysrc=''
f3f1a2d8
MB
992make_set_make=''
993d_mymalloc=''
994freetype=''
b4eb6b3d
JH
995mallocobj=''
996mallocsrc=''
997malloctype=''
9df442c2 998usemallocwrap=''
b4eb6b3d
JH
999usemymalloc=''
1000installman1dir=''
1001man1dir=''
1002man1direxp=''
1003man1ext=''
1004installman3dir=''
1005man3dir=''
1006man3direxp=''
1007man3ext=''
1008modetype=''
1009multiarch=''
1010mydomain=''
1011myhostname=''
1012phostname=''
2304df62
AD
1013c=''
1014n=''
b4eb6b3d
JH
1015d_eofnblk=''
1016eagain=''
1017o_nonblock=''
1018rd_nodata=''
2cc61e15 1019need_va_copy=''
b4eb6b3d
JH
1020netdb_hlen_type=''
1021netdb_host_type=''
1022netdb_name_type=''
1023netdb_net_type=''
1024groupcat=''
1025hostcat=''
1026passcat=''
1027orderlib=''
1028ranlib=''
1029d_perl_otherlibdirs=''
1030otherlibdirs=''
2304df62
AD
1031package=''
1032spackage=''
b4eb6b3d
JH
1033pager=''
1034api_revision=''
1035api_subversion=''
1036api_version=''
1037api_versionstring=''
1038patchlevel=''
151e6568 1039perl_patchlevel=''
b4eb6b3d
JH
1040revision=''
1041subversion=''
1042version=''
861eb78d 1043version_patchlevel_string=''
b4eb6b3d
JH
1044perl5=''
1045perladmin=''
1046perlpath=''
1047d_nv_preserves_uv=''
f607920a 1048d_nv_zero_is_allbits_zero=''
b4eb6b3d
JH
1049i16size=''
1050i16type=''
1051i32size=''
1052i32type=''
1053i64size=''
1054i64type=''
1055i8size=''
1056i8type=''
1057ivsize=''
1058ivtype=''
53133ed1 1059nv_preserves_uv_bits=''
b4eb6b3d
JH
1060nvsize=''
1061nvtype=''
1062u16size=''
1063u16type=''
1064u32size=''
1065u32type=''
1066u64size=''
1067u64type=''
1068u8size=''
1069u8type=''
1070uvsize=''
1071uvtype=''
1072ivdformat=''
1073nvEUformat=''
1074nvFUformat=''
1075nvGUformat=''
1076nveformat=''
1077nvfformat=''
1078nvgformat=''
1079uvXUformat=''
1080uvoformat=''
1081uvuformat=''
1082uvxformat=''
1083pidtype=''
1084prefix=''
1085prefixexp=''
1086installprivlib=''
1087privlib=''
1088privlibexp=''
1089prototype=''
1090ptrsize=''
1091d_PRIXU64=''
1092d_PRId64=''
1093d_PRIi64=''
1094d_PRIo64=''
1095d_PRIu64=''
1096d_PRIx64=''
1097sPRIXU64=''
1098sPRId64=''
1099sPRIi64=''
1100sPRIo64=''
1101sPRIu64=''
1102sPRIx64=''
1103d_quad=''
1104quadkind=''
1105quadtype=''
1106uquadtype=''
1107drand01=''
1108randbits=''
1109randfunc=''
1110randseedtype=''
1111seedfunc=''
1112installscript=''
1113scriptdir=''
1114scriptdirexp=''
1115selectminbits=''
1116selecttype=''
8ff267be 1117sh=''
b4eb6b3d
JH
1118sig_count=''
1119sig_name=''
1120sig_name_init=''
1121sig_num=''
1122sig_num_init=''
76d3c696 1123sig_size=''
f3f1a2d8 1124d_sitearch=''
b4eb6b3d
JH
1125installsitearch=''
1126sitearch=''
1127sitearchexp=''
1128installsitebin=''
1129sitebin=''
1130sitebinexp=''
8d2cbf27
JH
1131installsitehtml1dir=''
1132sitehtml1dir=''
1133sitehtml1direxp=''
1134installsitehtml3dir=''
1135sitehtml3dir=''
1136sitehtml3direxp=''
b4eb6b3d
JH
1137installsitelib=''
1138sitelib=''
1139sitelib_stem=''
1140sitelibexp=''
91e123a8
JH
1141installsiteman1dir=''
1142siteman1dir=''
1143siteman1direxp=''
1144installsiteman3dir=''
1145siteman3dir=''
1146siteman3direxp=''
b4eb6b3d
JH
1147siteprefix=''
1148siteprefixexp=''
6e1038e0
MB
1149installsitescript=''
1150sitescript=''
1151sitescriptexp=''
b4eb6b3d
JH
1152sizesize=''
1153sizetype=''
a0d0e21e 1154so=''
b4eb6b3d 1155socksizetype=''
2304df62
AD
1156sharpbang=''
1157shsharp=''
1158spitshell=''
dfe9444c 1159src=''
b4eb6b3d
JH
1160ssizetype=''
1161startperl=''
2304df62 1162startsh=''
b4eb6b3d
JH
1163stdchar=''
1164d_stdio_stream_array=''
1165stdio_stream_array=''
1166sysman=''
5ff3f7a4 1167trnl=''
b4eb6b3d
JH
1168uidformat=''
1169uidsign=''
1170uidsize=''
1171uidtype=''
1172archname64=''
1173use64bitall=''
1174use64bitint=''
15b61c98 1175usefaststdio=''
b4eb6b3d
JH
1176ccflags_uselargefiles=''
1177ldflags_uselargefiles=''
1178libswanted_uselargefiles=''
1179uselargefiles=''
1180uselongdouble=''
1181usemorebits=''
1182usemultiplicity=''
2304df62 1183nm_opt=''
40a7a20a 1184nm_so_opt=''
2304df62
AD
1185runnm=''
1186usenm=''
b4eb6b3d 1187useperlio=''
29209bc5 1188usesocks=''
b4eb6b3d
JH
1189d_oldpthreads=''
1190use5005threads=''
1191useithreads=''
9514c62b 1192usereentrant=''
b4eb6b3d 1193usethreads=''
2304df62 1194incpath=''
2304df62
AD
1195mips_type=''
1196usrinc=''
b4eb6b3d
JH
1197d_vendorarch=''
1198installvendorarch=''
1199vendorarch=''
1200vendorarchexp=''
1201d_vendorbin=''
1202installvendorbin=''
1203vendorbin=''
1204vendorbinexp=''
8d2cbf27
JH
1205installvendorhtml1dir=''
1206vendorhtml1dir=''
1207vendorhtml1direxp=''
1208installvendorhtml3dir=''
1209vendorhtml3dir=''
1210vendorhtml3direxp=''
b4eb6b3d
JH
1211d_vendorlib=''
1212installvendorlib=''
1213vendorlib=''
1214vendorlib_stem=''
1215vendorlibexp=''
91e123a8
JH
1216installvendorman1dir=''
1217vendorman1dir=''
1218vendorman1direxp=''
1219installvendorman3dir=''
1220vendorman3dir=''
1221vendorman3direxp=''
b4eb6b3d
JH
1222usevendorprefix=''
1223vendorprefix=''
1224vendorprefixexp=''
6e1038e0
MB
1225d_vendorscript=''
1226installvendorscript=''
1227vendorscript=''
1228vendorscriptexp=''
d56c5707 1229versiononly=''
b4eb6b3d
JH
1230defvoidused=''
1231voidflags=''
3659ebf1
JH
1232yacc=''
1233yaccflags=''
2304df62
AD
1234CONFIG=''
1235
ecfc5424
AD
1236define='define'
1237undef='undef'
1238smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1239rmlist=''
1240
1241: We must find out about Eunice early
1242eunicefix=':'
1243if test -f /etc/unixtovms; then
1244 eunicefix=/etc/unixtovms
1245fi
1246if test -f /etc/unixtovms.exe; then
1247 eunicefix=/etc/unixtovms.exe
1248fi
1249
cfb04860 1250: Set executable suffix now -- needed before hints available
6153ba32
PG
1251if test -f "/libs/version.library"; then
1252: Amiga OS
1253 _exe=""
1254elif test -f "/system/gnu_library/bin/ar.pm"; then
1255: Stratus VOS
cfb04860 1256 _exe=".pm"
6153ba32
PG
1257elif test -n "$DJGPP"; then
1258: DOS DJGPP
cfb04860 1259 _exe=".exe"
5c728af0 1260elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1261: OS/2 or cygwin
ba863942
JH
1262 _exe=".exe"
1263fi
868439a2 1264
b4eb6b3d 1265i_whoami=''
9da7673b
MB
1266: Trailing extension. Override this in a hint file, if needed.
1267: Extra object files, if any, needed on this platform.
1268archobjs=''
1269archname=''
b4eb6b3d 1270groupstype=''
64615a5e 1271libnames=''
732c9516
JH
1272: change the next line if compiling for Xenix/286 on Xenix/386
1273xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1274: Possible local library directories to search.
1275loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1276loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1277
1278: general looking path for locating libraries
5869b1f1 1279glibpth="/lib /usr/lib $xlibpth"
732c9516 1280glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1281test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1282test -f /shlib/libc.so && glibpth="/shlib $glibpth"
faae14e6 1283test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
732c9516
JH
1284
1285: Private path used by Configure to find libraries. Its value
1286: is prepended to libpth. This variable takes care of special
1287: machines, like the mips. Usually, it should be empty.
1288plibpth=''
1289
1cfa4ec7
GS
1290: default library list
1291libswanted=''
921b2963 1292: some systems want to use only the non-versioned libso:s
1cfa4ec7 1293ignore_versioned_solibs=''
9da7673b
MB
1294siteman1dir=''
1295siteman3dir=''
1296sitescript=''
ed140128
AD
1297: set usethreads on the Configure command line to enable threads.
1298usereentrant='undef'
1299: full support for void wanted by default
1300defvoidused=15
1301
1302: Possible local include directories to search.
1303: Set locincpth to "" in a hint file to defeat local include searches.
1304locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1305locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1306:
1307: no include file wanted by default
1308inclwanted=''
1309
1310: Enable -DEBUGGING and -DDEBUGGING from the command line
1311EBUGGING=''
1312DEBUGGING=old
1313
1314ccname=''
1315ccversion=''
1316perllibs=''
1317: set useposix=false in your hint file to disable the POSIX extension.
1318useposix=true
1319: set useopcode=false in your hint file to disable the Opcode extension.
1320useopcode=true
b4eb6b3d
JH
1321archname64=''
1322ccflags_uselargefiles=''
1323ldflags_uselargefiles=''
1324libswanted_uselargefiles=''
1325: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1326: set usesocks on the Configure command line to enable socks.
ecfc5424 1327: List of libraries we want.
15431986 1328: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef
AB
1329libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1330libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1331: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1332: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1333glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1334glibpth="/usr/shlib $glibpth"
1335: Do not use vfork unless overridden by a hint file.
1336usevfork=false
1337
8ff267be 1338: Find the basic shell for Bourne shell scripts
1339case "$sh" in
1340'')
8ff267be 1341 case "$SYSTYPE" in
1342 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1343 *) xxx='/bin/sh';;
1344 esac
1345 if test -f "$xxx"; then
1346 sh="$xxx"
1347 else
1348 : Build up a list and do a single loop so we can 'break' out.
1349 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1350 for xxx in sh bash ksh pdksh ash; do
1351 for p in $pth; do
1352 try="$try ${p}/${xxx}"
1353 done
1354 done
1355 for xxx in $try; do
1356 if test -f "$xxx"; then
1357 sh="$xxx";
8ff267be 1358 break
a5a94ea5
JH
1359 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1360 sh="$xxx";
1361 break
8ff267be 1362 elif test -f "$xxx.exe"; then
1363 sh="$xxx";
8ff267be 1364 break
1365 fi
1366 done
1367 fi
1368 ;;
1369esac
1370
1371case "$sh" in
a33c94aa 1372'') cat >&2 <<EOM
8ff267be 1373$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1374
8ff267be 1375Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1376Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1377we'll try to straighten this all out.
8ff267be 1378EOM
1379 exit 1
1380 ;;
1381esac
1382
760ac839 1383: see if sh knows # comments
73614538 1384if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1385 shsharp=true
1386 spitshell=cat
760ac839 1387 xcat=/bin/cat
a931254c
JH
1388 test -f $xcat$_exe || xcat=/usr/bin/cat
1389 if test ! -f $xcat$_exe; then
4bdb8fb5 1390 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1391 if test -f $p/cat$_exe; then
1deb0a86 1392 xcat=$p/cat
3c728e00
JH
1393 break
1394 fi
1395 done
1deb0a86
JH
1396 if test ! -f $xcat$_exe; then
1397 echo "Can't find cat anywhere!"
3c728e00
JH
1398 exit 1
1399 fi
1400 fi
5440bc8e
JH
1401 echo "#!$xcat" >sharp
1402 $eunicefix sharp
1403 chmod +x sharp
1404 ./sharp > today
760ac839 1405 if test -s today; then
760ac839
LW
1406 sharpbang='#!'
1407 else
5440bc8e
JH
1408 echo "#! $xcat" > sharp
1409 $eunicefix sharp
1410 chmod +x sharp
1411 ./sharp > today
760ac839 1412 if test -s today; then
760ac839
LW
1413 sharpbang='#! '
1414 else
760ac839
LW
1415 sharpbang=': use '
1416 fi
1417 fi
1418else
dfe9444c 1419 echo " "
8ff267be 1420 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1421 shsharp=false
1422 cd ..
1423 echo "exec grep -v '^[ ]*#'" >spitshell
1424 chmod +x spitshell
1425 $eunicefix spitshell
1426 spitshell=`pwd`/spitshell
1427 cd UU
1428 echo "I presume that if # doesn't work, #! won't work either!"
1429 sharpbang=': use '
1430fi
5440bc8e 1431rm -f sharp today
760ac839
LW
1432
1433: figure out how to guarantee sh startup
8ff267be 1434case "$startsh" in
1435'') startsh=${sharpbang}${sh} ;;
1436*)
760ac839 1437esac
5440bc8e 1438cat >sharp <<EOSS
760ac839
LW
1439$startsh
1440set abc
1441test "$?abc" != 1
1442EOSS
1443
5440bc8e
JH
1444chmod +x sharp
1445$eunicefix sharp
1446if ./sharp; then
8ff267be 1447 : echo "Yup, it does."
760ac839 1448else
dfe9444c
AD
1449 echo "Hmm... '$startsh' does not guarantee sh startup..."
1450 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1451fi
5440bc8e 1452rm -f sharp
760ac839 1453
aebf16e7
AD
1454
1455: Save command line options in file UU/cmdline.opt for later use in
1456: generating config.sh.
1457cat > cmdline.opt <<EOSH
1458# Configure command line arguments.
1459config_arg0='$0'
1460config_args='$*'
1461config_argc=$#
1462EOSH
1463argn=1
ee45ea83
IZ
1464args_exp=''
1465args_sep=''
aebf16e7
AD
1466for arg in "$@"; do
1467 cat >>cmdline.opt <<EOSH
1468config_arg$argn='$arg'
1469EOSH
ee45ea83
IZ
1470 # Extreme backslashitis: replace each ' by '"'"'
1471 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1472$arg
1473EOC
1474 arg_exp=`cat cmdl.opt`
1475 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1476 argn=`expr $argn + 1`
ee45ea83 1477 args_sep=' '
aebf16e7 1478done
ee45ea83
IZ
1479# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1480# used by ./hints/os2.sh
1481rm -f cmdl.opt
aebf16e7 1482
2304df62
AD
1483: produce awk script to parse command line options
1484cat >options.awk <<'EOF'
1485BEGIN {
02e93a22 1486 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1487
1488 len = length(optstr);
1489 for (i = 1; i <= len; i++) {
1490 c = substr(optstr, i, 1);
1491 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1492 if (a == ":") {
1493 arg[c] = 1;
1494 i++;
1495 }
1496 opt[c] = 1;
1497 }
1498}
1499{
1500 expect = 0;
1501 str = $0;
1502 if (substr(str, 1, 1) != "-") {
1503 printf("'%s'\n", str);
1504 next;
1505 }
1506 len = length($0);
1507 for (i = 2; i <= len; i++) {
1508 c = substr(str, i, 1);
1509 if (!opt[c]) {
1510 printf("-%s\n", substr(str, i));
1511 next;
1512 }
1513 printf("-%s\n", c);
1514 if (arg[c]) {
1515 if (i < len)
1516 printf("'%s'\n", substr(str, i + 1));
1517 else
1518 expect = 1;
1519 next;
1520 }
1521 }
1522}
1523END {
1524 if (expect)
1525 print "?";
1526}
1527EOF
1528
1529: process the command line options
4633a7c4
LW
1530set X `for arg in "$@"; do echo "X$arg"; done |
1531 sed -e s/X// | awk -f options.awk`
2304df62
AD
1532eval "set $*"
1533shift
1534rm -f options.awk
1535
1536: set up default values
1537fastread=''
1538reuseval=false
1539config_sh=''
1540alldone=''
1541error=''
1542silent=''
1543extractsh=''
ecfc5424 1544override=''
16d20bd9 1545knowitall=''
02e93a22 1546rm -f optdef.sh posthint.sh
28757baa 1547cat >optdef.sh <<EOS
1548$startsh
1549EOS
2304df62 1550
dfe9444c 1551
2304df62
AD
1552: option parsing
1553while test $# -gt 0; do
1554 case "$1" in
1555 -d) shift; fastread=yes;;
1556 -e) shift; alldone=cont;;
1557 -f)
1558 shift
1559 cd ..
1560 if test -r "$1"; then
1561 config_sh="$1"
1562 else
a0d0e21e 1563 echo "$me: cannot read config file $1." >&2
2304df62
AD
1564 error=true
1565 fi
1566 cd UU
1567 shift;;
1568 -h) shift; error=true;;
1569 -r) shift; reuseval=true;;
dfe9444c 1570 -s) shift; silent=true; realsilent=true;;
2304df62 1571 -E) shift; alldone=exit;;
16d20bd9 1572 -K) shift; knowitall=true;;
ecfc5424 1573 -O) shift; override=true;;
dfe9444c 1574 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1575 -D)
1576 shift
1577 case "$1" in
1578 *=)
1579 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1580 echo "$me: ignoring -D $1" >&2
1581 ;;
ecfc5424 1582 *=*) echo "$1" | \
1aef975c
AD
1583 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1584 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1585 esac
1586 shift
1587 ;;
1588 -U)
1589 shift
1590 case "$1" in
1aef975c 1591 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1592 *=*)
1593 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1594 echo "$me: ignoring -U $1" >&2
1595 ;;
1aef975c 1596 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1597 esac
1598 shift
1599 ;;
02e93a22
JH
1600 -A)
1601 shift
1602 xxx=''
1603 yyy="$1"
02e93a22 1604 zzz=''
5f83a3e9 1605 uuu=undef
02e93a22 1606 case "$yyy" in
f7c31117 1607 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1608 case "$zzz" in
1609 *:*) zzz='' ;;
1610 *) xxx=append
f7c31117
JH
1611 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1612 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1613 esac
1614 ;;
1615 esac
1616 case "$xxx" in
1617 '') case "$yyy" in
f7c31117
JH
1618 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1619 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1620 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1621 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1622 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1623 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9
JH
1624 esac
1625 ;;
1626 esac
02e93a22
JH
1627 case "$xxx" in
1628 append)
5f83a3e9 1629 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1630 clear)
5f83a3e9 1631 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1632 define)
1633 case "$zzz" in
1634 '') zzz=define ;;
1635 esac
5f83a3e9 1636 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1637 eval)
5f83a3e9 1638 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1639 prepend)
5f83a3e9 1640 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1641 undef)
1642 case "$zzz" in
1643 '') zzz="$uuu" ;;
1644 esac
5f83a3e9
JH
1645 echo "$yyy=$zzz" >> posthint.sh ;;
1646 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1647 esac
bde6b06b 1648 shift
02e93a22 1649 ;;
dfe9444c 1650 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1651 exit 0;;
2304df62 1652 --) break;;
a0d0e21e 1653 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1654 *) break;;
1655 esac
1656done
1657
1658case "$error" in
1659true)
1660 cat >&2 <<EOM
2afac517 1661Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1662 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1663 -d : use defaults for all answers.
1664 -e : go on without questioning past the production of config.sh.
1665 -f : specify an alternate default configuration file.
1666 -h : print this help message and exit (with an error status).
1667 -r : reuse C symbols value if possible (skips costly nm extraction).
1668 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1669 -D : define symbol to have some value:
1670 -D symbol symbol gets the value 'define'
1671 -D symbol=value symbol gets the value 'value'
2304df62 1672 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1673 -K : do not use unless you know what you are doing.
ecfc5424 1674 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1675 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1676 -U : undefine symbol:
1677 -U symbol symbol gets the value 'undef'
1678 -U symbol= symbol gets completely empty
02e93a22 1679 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1680 -A symbol=value append " "value to symbol
02e93a22
JH
1681 -A append:symbol=value append value to symbol
1682 -A define:symbol=value define symbol to have value
02e93a22
JH
1683 -A clear:symbol define symbol to be ''
1684 -A define:symbol define symbol to be 'define'
1685 -A eval:symbol=value define symbol to be eval of value
1686 -A prepend:symbol=value prepend value to symbol
1687 -A undef:symbol define symbol to be 'undef'
1688 -A undef:symbol= define symbol to be ''
2304df62
AD
1689 -V : print version number and exit (with a zero status).
1690EOM
1691 exit 1
1692 ;;
1693esac
1694
dfe9444c
AD
1695: Sanity checks
1696case "$fastread$alldone" in
1697yescont|yesexit) ;;
1698*)
aaeb8e51
GS
1699 case "$extractsh" in
1700 true) ;;
1701 *)
1702 if test ! -t 0; then
1703 echo "Say 'sh Configure', not 'sh <Configure'"
1704 exit 1
1705 fi
1706 ;;
1707 esac
dfe9444c
AD
1708 ;;
1709esac
1710
2304df62
AD
1711exec 4>&1
1712case "$silent" in
1713true) exec 1>/dev/null;;
1714esac
1715
ecfc5424 1716: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1717touch optdef.sh
1718. ./optdef.sh
02e93a22
JH
1719: create the posthint manipulation script and leave the file out there...
1720touch posthint.sh
a0d0e21e 1721
2304df62 1722: set package name
85e6fe83 1723package=perl5
b4eb6b3d
JH
1724first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1725last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1726case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1727ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1728*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1729esac
2304df62 1730
2304df62
AD
1731: Some greps do not return status, grrr.
1732echo "grimblepritz" >grimble
1733if grep blurfldyick grimble >/dev/null 2>&1 ; then
1734 contains=contains
1735elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1736 contains=grep
1737else
1738 contains=contains
1739fi
1740rm -f grimble
1741: the following should work in any shell
1742case "$contains" in
1743contains*)
1744 echo " "
1745 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1746 cat >contains <<'EOSS'
1747grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1748EOSS
1749chmod +x contains
1750esac
1751
dfe9444c
AD
1752: Find the path to the source tree
1753case "$src" in
1754'') case "$0" in
b233458b
JH
1755 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1756 case "$src" in
1757 /*) ;;
8504afb7 1758 .) ;;
b233458b
JH
1759 *) src=`cd ../$src && pwd` ;;
1760 esac
1761 ;;
dfe9444c
AD
1762 *) src='.';;
1763 esac;;
1764esac
1765case "$src" in
1766'') src=/
1767 rsrc=/
1768 ;;
1769/*) rsrc="$src";;
1770*) rsrc="../$src";;
1771esac
1772if test -f $rsrc/Configure && \
1773 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1774then
1775 : found it, so we are ok.
1776else
1777 rsrc=''
1778 for src in . .. ../.. ../../.. ../../../..; do
1779 if test -f ../$src/Configure && \
1780 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1781 then
1782 rsrc=../$src
1783 break
1784 fi
1785 done
1786fi
1787case "$rsrc" in
1788'')
1789 cat <<EOM >&4
1790
1791Sorry, I can't seem to locate the source dir for $package. Please start
1792Configure with an explicit path -- i.e. /some/path/Configure.
1793
1794EOM
1795 exit 1
1796 ;;
1797../.) rsrc='..';;
1798*)
1799 echo " "
1800 echo "Sources for $package found in \"$src\"." >&4
1801 ;;
1802esac
1803
1804: script used to extract .SH files with variable substitutions
1805cat >extract <<'EOS'
a02608de 1806PERL_CONFIG_SH=true
dfe9444c 1807echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1808if test -f MANIFEST; then
1809 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1810else
1811 echo "(Looking for .SH files under the source directory.)"
6904989c 1812 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1813fi
1814shift
1815case $# in
6904989c 18160) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1817esac
6904989c 1818if test ! -f "$src/$1"; then
dfe9444c
AD
1819 shift
1820fi
1821mkdir_p='
1822name=$1;
1823create="";
1824while test $name; do
1825 if test ! -d "$name"; then
1826 create="$name $create";
1827 name=`echo $name | sed -e "s|^[^/]*$||"`;
1828 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1829 else
1830 name="";
1831 fi;
1832done;
1833for file in $create; do
1834 mkdir $file;
1835done
1836'
1837for file in $*; do
1838 case "$src" in
1839 ".")
1840 case "$file" in
1841 */*)
1842 dir=`expr X$file : 'X\(.*\)/'`
1843 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1844 (cd "$dir" && . ./$file)
dfe9444c
AD
1845 ;;
1846 *)
1847 . ./$file
1848 ;;
1849 esac
1850 ;;
1851 *)
1852 case "$file" in
1853 */*)
1854 dir=`expr X$file : 'X\(.*\)/'`
1855 file=`expr X$file : 'X.*/\(.*\)'`
1856 (set x $dir; shift; eval $mkdir_p)
6904989c 1857 sh <"$src/$dir/$file"
dfe9444c
AD
1858 ;;
1859 *)
6904989c 1860 sh <"$src/$file"
dfe9444c
AD
1861 ;;
1862 esac
1863 ;;
1864 esac
1865done
6904989c 1866if test -f "$src/config_h.SH"; then
dfe9444c
AD
1867 if test ! -f config.h; then
1868 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1869 . "$src/config_h.SH"
dfe9444c
AD
1870 fi
1871fi
1872EOS
1873
1874: extract files and exit if asked to do so
1875case "$extractsh" in
1876true)
1877 case "$realsilent" in
1878 true) ;;
1879 *) exec 1>&4;;
1880 esac
1881 case "$config_sh" in
1882 '') config_sh='config.sh';;
1883 esac
1884 echo " "
1885 echo "Fetching answers from $config_sh..."
1886 cd ..
1887 . $config_sh
1888 test "$override" && . ./optdef.sh
1889 echo " "
1890 . UU/extract
1891 rm -rf UU
24ccb310 1892 echo "Extraction done."
dfe9444c
AD
1893 exit 0
1894 ;;
1895esac
1896
1897: Eunice requires " " instead of "", can you believe it
1898echo " "
1899: Here we go...
1900echo "Beginning of configuration questions for $package."
1901
1902trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1903
2304df62
AD
1904: first determine how to suppress newline on echo command
1905echo " "
1906echo "Checking echo to see how to suppress newlines..."
1907(echo "hi there\c" ; echo " ") >.echotmp
1908if $contains c .echotmp >/dev/null 2>&1 ; then
1909 echo "...using -n."
1910 n='-n'
1911 c=''
1912else
1913 cat <<'EOM'
1914...using \c
1915EOM
1916 n=''
1917 c='\c'
1918fi
1919echo $n "The star should be here-->$c"
1920echo '*'
1921rm -f .echotmp
1922
1923: Now test for existence of everything in MANIFEST
1924echo " "
6904989c 1925if test -f "$rsrc/MANIFEST"; then
2304df62 1926 echo "First let's make sure your kit is complete. Checking..." >&4
4242830c 1927 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
2304df62 1928 rm -f missing
dfe9444c 1929 tmppwd=`pwd`
2304df62 1930 for filelist in x??; do
6904989c 1931 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1932 done
1933 if test -s missing; then
1934 cat missing >&4
1935 cat >&4 <<'EOM'
1936
1937THIS PACKAGE SEEMS TO BE INCOMPLETE.
1938
1939You have the option of continuing the configuration process, despite the
1940distinct possibility that your kit is damaged, by typing 'y'es. If you
1941do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1942and contact the author (perlbug@perl.org).
2304df62
AD
1943
1944EOM
1945 echo $n "Continue? [n] $c" >&4
1946 read ans
1947 case "$ans" in
1948 y*)
1949 echo "Continuing..." >&4
1950 rm -f missing
1951 ;;
1952 *)
1953 echo "ABORTING..." >&4
1954 kill $$
1955 ;;
1956 esac
1957 else
dfe9444c 1958 echo "Looks good..."
2304df62
AD
1959 fi
1960else
1961 echo "There is no MANIFEST file. I hope your kit is complete !"
1962fi
1963rm -f missing x??
1964
5ff3f7a4
GS
1965echo " "
1966: Find the appropriate value for a newline for tr
1967if test -n "$DJGPP"; then
1968 trnl='\012'
1969fi
1970if test X"$trnl" = X; then
1971 case "`echo foo|tr '\n' x 2>/dev/null`" in
1972 foox) trnl='\n' ;;
1973 esac
1974fi
1975if test X"$trnl" = X; then
1976 case "`echo foo|tr '\012' x 2>/dev/null`" in
1977 foox) trnl='\012' ;;
1978 esac
1979fi
1980if test X"$trnl" = X; then
8be2c24c
JH
1981 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1982 fooxy) trnl='\n\r' ;;
1983 esac
1984fi
1985if test X"$trnl" = X; then
5ff3f7a4
GS
1986 cat <<EOM >&2
1987
1988$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1989
1990EOM
1991 exit 1
1992fi
1993
2304df62
AD
1994: compute the number of columns on the terminal for proper question formatting
1995case "$COLUMNS" in
1996'') COLUMNS='80';;
1997esac
1998
1999: set up the echo used in my read
2000myecho="case \"\$xxxm\" in
2001'') echo $n \"\$rp $c\" >&4;;
2002*) case \"\$rp\" in
2003 '') echo $n \"[\$xxxm] $c\";;
2004 *)
2005 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
2006 echo \"\$rp\" >&4
2007 echo $n \"[\$xxxm] $c\" >&4
2008 else
2009 echo $n \"\$rp [\$xxxm] $c\" >&4
2010 fi
2011 ;;
2012 esac;;
2013esac"
2014
2015: now set up to do reads with possible shell escape and default assignment
2016cat <<EOSC >myread
28757baa 2017$startsh
2304df62
AD
2018xxxm=\$dflt
2019$myecho
2020ans='!'
2021case "\$fastread" in
2022yes) case "\$dflt" in
2023 '') ;;
2024 *) ans='';
2025 case "\$silent-\$rp" in
2026 true-) ;;
2027 *) echo " " >&4;;
2028 esac;;
2029 esac;;
2030*) case "\$silent" in
2031 true) case "\$rp" in
2032 '') ans='';;
2033 esac;;
2034 esac;;
2035esac
2036while expr "X\$ans" : "X!" >/dev/null; do
2037 read answ
2038 set x \$xxxm
2039 shift
dfe9444c 2040 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 2041 case "\$answ" in
dfe9444c
AD
2042 "!")
2043 sh 1>&4
2044 echo " "
2045 $myecho
2046 ;;
2047 !*)
2048 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2049 shift
2050 sh 1>&4 -c "\$*"
2051 echo " "
2052 $myecho
2053 ;;
2304df62
AD
2054 "\$ans")
2055 case "\$ans" in
ecfc5424
AD
2056 \\&*)
2057 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2058 shift
2059 case "\$1" in
2060 -d)
2061 fastread=yes
40a7a20a 2062 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2063 ;;
2064 -*)
40a7a20a 2065 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2066 ;;
2067 esac
2068 $myecho
2069 ans=!
2070 ;;
2304df62
AD
2071 esac;;
2072 *)
2073 case "\$aok" in
2074 y)
2075 echo "*** Substitution done -- please confirm."
2076 xxxm="\$ans"
c9795ab7 2077 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2078 xxxm="\$ans"
2079 ans=!
2080 ;;
2081 *)
2082 echo "*** Error -- try again."
2083 ans=!
2084 ;;
2085 esac
2086 $myecho
2087 ;;
2088 esac
2089 case "\$ans\$xxxm\$nostick" in
2090 '')
2091 ans=!
2092 $myecho
2093 ;;
2094 esac
2095done
2096case "\$ans" in
2097'') ans="\$xxxm";;
2098esac
2099EOSC
2100
2101: create .config dir to save info across Configure sessions
2102test -d ../.config || mkdir ../.config
2103cat >../.config/README <<EOF
2104This directory created by Configure to save information that should
dfe9444c 2105persist across sessions for $package.
2304df62
AD
2106
2107You may safely delete it if you wish.
2108EOF
2109
9507cadf 2110xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2111case "$usedevel" in
0107c034 2112$define|true|[yY]*) ;;
9507cadf 2113*) case "$xversion" in
0107c034
JH
2114 *[13579])
2115 cat >&4 <<EOH
2116*** WHOA THERE!!! ***
2117
2118 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2119 The version of this $package distribution is $xversion, that is, odd,
2120 (as opposed to even) and that signifies a development release.
3d5d58b1 2121 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2122
2123 Do ***NOT*** install this into production use.
2124 Data corruption and crashes are possible.
2125
2126 It is most seriously suggested that you do not continue any further
2127 unless you want to help in developing and debugging Perl.
2128
6adc6a45
JH
2129 If you *still* want to build perl, you can answer 'y' now,
2130 or pass -Dusedevel to Configure.
2131
0107c034
JH
2132EOH
2133 rp='Do you really want to continue?'
2134 dflt='n'
2135 . ./myread
2136 case "$ans" in
8feeef0e
JH
2137 [yY]) echo >&4 "Okay, continuing."
2138 usedevel="$define" ;;
0107c034
JH
2139 *) echo >&4 "Okay, bye."
2140 exit 1
2141 ;;
2142 esac
2143 ;;
2144 esac
2145 ;;
2146esac
8feeef0e
JH
2147case "$usedevel" in
2148$define|true|[yY]*)
2149 case "$versiononly" in
2150 '') versiononly="$define" ;;
2151 esac
2152 case "$installusrbinperl" in
2153 '') installusrbinperl="$undef" ;;
2154 esac
2155 ;;
2156esac
0107c034 2157
2304df62
AD
2158: general instructions
2159needman=true
2160firsttime=true
760ac839 2161user=`(logname) 2>/dev/null`
dfe9444c
AD
2162case "$user" in
2163'') user=`whoami 2>&1`;;
760ac839 2164esac
2304df62
AD
2165if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2166 firsttime=false
2167 echo " "
2168 rp='Would you like to see the instructions?'
2169 dflt=n
2170 . ./myread
2171 case "$ans" in
2172 [yY]*) ;;
2173 *) needman=false;;
2174 esac
2175fi
2176if $needman; then
2177 cat <<EOH
4e2a5f63 2178
2304df62 2179This installation shell script will examine your system and ask you questions
a0d0e21e 2180to determine how the perl5 package should be installed. If you get
2304df62
AD
2181stuck on a question, you may use a ! shell escape to start a subshell or
2182execute a command. Many of the questions will have default answers in square
2183brackets; typing carriage return will give you the default.
2184
2185On some of the questions which ask for file or directory names you are allowed
2186to use the ~name construct to specify the login directory belonging to "name",
2187even if you don't have a shell which knows about that. Questions where this is
2188allowed will be marked "(~name ok)".
2189
2190EOH
2191 rp=''
2192 dflt='Type carriage return to continue'
2193 . ./myread
2194 cat <<'EOH'
2195
2196The prompter used in this script allows you to use shell variables and
2197backticks in your answers. You may use $1, $2, etc... to refer to the words
2198in the default answer, as if the default line was a set of arguments given to a
2199script shell. This means you may also use $* to repeat the whole default line,
2200so you do not have to re-type everything to add something to the default.
2201
2202Everytime there is a substitution, you will have to confirm. If there is an
2203error (e.g. an unmatched backtick), the default answer will remain unchanged
2204and you will be prompted again.
2205
2206If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2207the questions and use the computed defaults (or the previous answers if there
2208was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2209You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2210on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2211
2212EOH
2213 . ./myread
2214 cat <<EOH
2215
2216Much effort has been expended to ensure that this shell script will run on any
2217Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2218Configure and run it again. If you can't run Configure for some reason,
2219you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2220have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2221
2222This installation script affects things in two ways:
2223
22241) it may do direct variable substitutions on some of the files included
2225 in this kit.
22262) it builds a config.h file for inclusion in C programs. You may edit
2227 any of these files as the need arises after running this script.
2228
2229If you make a mistake on a question, there is no easy way to back up to it
2230currently. The easiest thing to do is to edit config.sh and rerun all the SH
2231files. Configure will offer to let you do this before it runs the SH files.
2232
2233EOH
2234 dflt='Type carriage return to continue'
2235 . ./myread
2236 case "$firsttime" in
2237 true) echo $user >>../.config/instruct;;
2238 esac
2239fi
2240
2304df62
AD
2241: find out where common programs are
2242echo " "
2243echo "Locating common programs..." >&4
2244cat <<EOSC >loc
2245$startsh
2246case \$# in
22470) exit 1;;
2248esac
2249thing=\$1
2250shift
2251dflt=\$1
2252shift
2253for dir in \$*; do
2254 case "\$thing" in
2255 .)
2256 if test -d \$dir/\$thing; then
2257 echo \$dir
2258 exit 0
2259 fi
2260 ;;
2261 *)
a0d0e21e 2262 for thisthing in \$dir/\$thing; do
ecfc5424 2263 : just loop through to pick last item
a0d0e21e 2264 done
25f94b33 2265 if test -f \$thisthing; then
a0d0e21e 2266 echo \$thisthing
2304df62 2267 exit 0
a5a94ea5
JH
2268 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2269 echo \$thisthing
2270 exit 0
2304df62 2271 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2272 if test -n "$DJGPP"; then
2273 echo \$dir/\$thing.exe
b921d661 2274 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2275 : on Eunice apparently
2276 echo \$dir/\$thing
b921d661 2277 exit 0
c4f23d77 2278 fi
2d736872 2279 exit 0
2304df62
AD
2280 fi
2281 ;;
2282 esac
2283done
2284echo \$dflt
2285exit 1
2286EOSC
2287chmod +x loc
2288$eunicefix loc
2289loclist="
2290awk
2291cat
f8006fac 2292chmod
b4eb6b3d
JH
2293comm
2294cp
2304df62
AD
2295echo
2296expr
2297grep
a0d0e21e 2298ls
b4eb6b3d 2299mkdir
2304df62
AD
2300rm
2301sed
b4eb6b3d 2302sort
85e6fe83 2303touch
2304df62 2304tr
b4eb6b3d 2305uniq
2304df62
AD
2306"
2307trylist="
2308Mcc
dfe9444c 2309ar
3659ebf1 2310bison
b4eb6b3d 2311byacc
2304df62 2312cpp
b4eb6b3d 2313csh
2304df62
AD
2314date
2315egrep
1fef16b3 2316gmake
8ff267be 2317gzip
b4eb6b3d 2318less
8ff267be 2319ln
3c728e00 2320make
b4eb6b3d 2321more
693762b4 2322nm
b4eb6b3d
JH
2323nroff
2324pg
2304df62
AD
2325test
2326uname
8ff267be 2327zip
2304df62 2328"
8e07c86e 2329pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2330pth="$pth /lib /usr/lib"
2331for file in $loclist; do
dfe9444c
AD
2332 eval xxx=\$$file
2333 case "$xxx" in
2334 /*|?:[\\/]*)
2335 if test -f "$xxx"; then
2336 : ok
2337 else
2338 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2339 xxx=`./loc $file $file $pth`
2340 fi
2341 ;;
2342 '') xxx=`./loc $file $file $pth`;;
2343 *) xxx=`./loc $xxx $xxx $pth`;;
2344 esac
a5a94ea5 2345 eval $file=$xxx$_exe
2304df62
AD
2346 eval _$file=$xxx
2347 case "$xxx" in
2348 /*)
2349 echo $file is in $xxx.
2350 ;;
8e07c86e
AD
2351 ?:[\\/]*)
2352 echo $file is in $xxx.
2353 ;;
2304df62 2354 *)
25f94b33
AD
2355 echo "I don't know where '$file' is, and my life depends on it." >&4
2356 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2357 exit 1
2304df62
AD
2358 ;;
2359 esac
2360done
2361echo " "
2362echo "Don't worry if any of the following aren't found..."
2363say=offhand
2364for file in $trylist; do
dfe9444c
AD
2365 eval xxx=\$$file
2366 case "$xxx" in
2367 /*|?:[\\/]*)
2368 if test -f "$xxx"; then
2369 : ok
2370 else
2371 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2372 xxx=`./loc $file $file $pth`
2373 fi
2374 ;;
2375 '') xxx=`./loc $file $file $pth`;;
2376 *) xxx=`./loc $xxx $xxx $pth`;;
2377 esac
306a8474 2378 eval $file=$xxx$_exe
2304df62
AD
2379 eval _$file=$xxx
2380 case "$xxx" in
2381 /*)
2382 echo $file is in $xxx.
2383 ;;
8e07c86e
AD
2384 ?:[\\/]*)
2385 echo $file is in $xxx.
2386 ;;
2304df62
AD
2387 *)
2388 echo "I don't see $file out there, $say."
2389 say=either
2390 ;;
2391 esac
2392done
2393case "$egrep" in
1fef16b3 2394egrep)
2304df62
AD
2395 echo "Substituting grep for egrep."
2396 egrep=$grep
868439a2 2397 _egrep=$grep
2304df62
AD
2398 ;;
2399esac
8ff267be 2400case "$ln" in
1fef16b3 2401ln)
8ff267be 2402 echo "Substituting cp for ln."
2403 ln=$cp
868439a2 2404 _ln=$cp
8ff267be 2405 ;;
2406esac
2e26f1d5
JH
2407case "$make" in
2408make)
2409 case "$gmake" in
2410 gmake)
2411 echo "I can't find make or gmake, and my life depends on it." >&4
2412 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2413 exit 1
2414 ;;
2415 esac
2416 ;;
2417esac
2418case "$gmake" in
2419gmake) ;;
2420*) # We can't have osname yet.
1fef16b3
JH
2421 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2422 # Assume that gmake, if found, is definitely GNU make
2423 # and prefer it over the system make.
2424 echo "Substituting gmake for make."
2425 make=$gmake
868439a2 2426 _make=$gmake
1fef16b3
JH
2427 fi
2428 ;;
a5a94ea5 2429esac
2304df62
AD
2430case "$test" in
2431test)
2432 echo "Hopefully test is built into your sh."
2433 ;;
2434*)
73614538 2435 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2436 echo "Using the test built into your sh."
2304df62
AD
2437 test=test
2438 _test=test
2439 fi
2440 ;;
2441esac
2442case "$echo" in
2443echo)
2444 echo "Hopefully echo is built into your sh."
2445 ;;
2446'') ;;
2447*)
2448 echo " "
2449echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2450 $echo $n "hi there$c" >foo1
2451 echo $n "hi there$c" >foo2
2452 if cmp foo1 foo2 >/dev/null 2>&1; then
2453 echo "They are compatible. In fact, they may be identical."
2454 else
2455 case "$n" in
2456 '-n') n='' c='\c';;
2457 *) n='-n' c='';;
2458 esac
2459 cat <<FOO
2460They are not compatible! You are probably running ksh on a non-USG system.
2461I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2462have echo built in and we may have to run some Bourne shell scripts. That
2463means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2464
2465FOO
2466 $echo $n "The star should be here-->$c"
2467 $echo "*"
2468 fi
2469 $rm -f foo1 foo2
2470 ;;
2471esac
2472
6b769f8f 2473cat <<EOS >trygcc
2573c5f9
JH
2474$startsh
2475EOS
6b769f8f 2476cat <<'EOSC' >>trygcc
2573c5f9
JH
2477case "$cc" in
2478'') ;;
2479*) $rm -f try try.*
2480 $cat >try.c <<EOM
2481int main(int argc, char *argv[]) {
2482 return 0;
2483}
2484EOM
e4778687 2485 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2486 :
2487 else
2488 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2489 despair=yes
2490 trygcc=yes
2491 case "$cc" in
2492 *gcc*) trygcc=no ;;
2493 esac
2494 case "`$cc -v -c try.c 2>&1`" in
2495 *gcc*) trygcc=no ;;
2496 esac
2497 if $test X"$trygcc" = Xyes; then
2498 if gcc -o try -c try.c; then
2499 echo " "
2500 echo "You seem to have a working gcc, though." >&4
2501 rp="Would you like to use it?"
2502 dflt=y
2503 if $test -f myread; then
2504 . ./myread
2505 else
2506 if $test -f UU/myread; then
2507 . ./UU/myread
2508 else
2509 echo "Cannot find myread, sorry. Aborting." >&2
2510 exit 1
2511 fi
2512 fi
2513 case "$ans" in
6371411c
RB
2514 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2515 if $test -f usethreads.cbu; then
2516 $cat >&4 <<EOM
2517
2518*** However, any setting of the C compiler flags (e.g. for thread support)
2519*** has been lost. It may be necessary to pass -Dcc=gcc to Configure
2520*** (together with e.g. -Dusethreads).
2521
2522EOM
2523 fi;;
2573c5f9
JH
2524 esac
2525 fi
2526 fi
6b769f8f
RB
2527 fi
2528 $rm -f try try.*
2529 ;;
2530esac
2531EOSC
2532
2533cat <<EOS >checkcc
2534$startsh
2535EOS
2536cat <<'EOSC' >>checkcc
2537case "$cc" in
2538'') ;;
2539*) $rm -f try try.*
2540 $cat >try.c <<EOM
2541int main(int argc, char *argv[]) {
2542 return 0;
2543}
2544EOM
2545 if $cc -o try $ccflags $ldflags try.c; then
2546 :
2547 else
2573c5f9 2548 if $test X"$despair" = Xyes; then
6b769f8f
RB
2549 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2550 fi
2551 $cat >&4 <<EOM
5dd4fbdf
MB
2552You need to find a working C compiler.
2553Either (purchase and) install the C compiler supplied by your OS vendor,
2554or for a free C compiler try http://gcc.gnu.org/
2555I cannot continue any further, aborting.
2556EOM
6b769f8f 2557 exit 1
2573c5f9
JH
2558 fi
2559 $rm -f try try.*
2560 ;;
2561esac
2562EOSC
2563
a0d0e21e
LW
2564: determine whether symbolic links are supported
2565echo " "
2566$touch blurfl
2567if $ln -s blurfl sym > /dev/null 2>&1 ; then
2568 echo "Symbolic links are supported." >&4
818f00be 2569 lns="$ln -s"
a0d0e21e
LW
2570else
2571 echo "Symbolic links are NOT supported." >&4
2572 lns="$ln"
2573fi
2574$rm -f blurfl sym
2575
dafca956
JH
2576: determine whether symbolic links are supported
2577echo " "
2578case "$lns" in
18ea2752 2579*"ln"*" -s")
dafca956
JH
2580 echo "Checking how to test for symbolic links..." >&4
2581 $lns blurfl sym
4b661809 2582 if $test "X$issymlink" = X; then
2e2a97a6
JH
2583 case "$newsh" in
2584 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2585 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2586 esac
5d644a95
MB
2587 if test $? = 0; then
2588 issymlink="test -h"
2e2a97a6
JH
2589 else
2590 echo "Your builtin 'test -h' may be broken." >&4
2591 case "$test" in
2592 /*) ;;
2593 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2594 for p in $pth
2595 do
2596 if test -f "$p/$test"; then
2597 test="$p/$test"
2598 break
2599 fi
2600 done
2601 ;;
2602 esac
2603 case "$test" in
2604 /*)
2605 echo "Trying external '$test -h'." >&4
2606 issymlink="$test -h"
2607 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2608 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2609 issymlink=''
2610 fi
2611 ;;
2612 *) issymlink='' ;;
2613 esac
5d644a95
MB
2614 fi
2615 fi
4b661809 2616 if $test "X$issymlink" = X; then
dafca956 2617 if $test -L sym 2>/dev/null; then
5d644a95 2618 issymlink="$test -L"
2e2a97a6 2619 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2620 fi
2621 fi
4b661809 2622 if $test "X$issymlink" != X; then
5d644a95 2623 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2624 else
2625 echo "I do not know how you can test for symbolic links." >&4
2626 fi
2627 $rm -f blurfl sym
2628 ;;
2629*) echo "No symbolic links, so not testing for their testing..." >&4
2630 ;;
2631esac
2632echo " "
2633
2634
2635case "$mksymlinks" in
2636$define|true|[yY]*)
2637 case "$src" in
2638 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2639 exit 1
2640 ;;
4b661809 2641 *) case "$lns:$issymlink" in
f314eb9f 2642 *"ln"*" -s:"*"test -"?)
dafca956
JH
2643 echo "Creating the symbolic links..." >&4
2644 echo "(First creating the subdirectories...)" >&4
2645 cd ..
2646 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2647 read directory
2648 test -z "$directory" && break
2649 mkdir -p $directory
2650 done
2651 # Sanity check 1.
2652 if test ! -d t/base; then
2653 echo "Failed to create the subdirectories. Aborting." >&4
2654 exit 1
2655 fi
2656 echo "(Then creating the symlinks...)" >&4
2657 awk '{print $1}' $src/MANIFEST | while true; do
2658 read filename
2659 test -z "$filename" && break
2660 if test -f $filename; then
5d644a95 2661 if $issymlink $filename; then
dafca956
JH
2662 rm -f $filename
2663 fi
2664 fi
2665 if test -f $filename; then
2666 echo "$filename already exists, not symlinking."
2667 else
2668 ln -s $src/$filename $filename
2669 fi
2670 done
2671 # Sanity check 2.
a0d24b8a
JH
2672 if test ! -f t/base/lex.t; then
2673 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2674 exit 1
2675 fi
2676 cd UU
2677 ;;
2678 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2679 ;;
2680 esac
2681 ;;
2682 esac
2683 ;;
2684esac
2685
5440bc8e
JH
2686
2687case "$usecrosscompile" in
2688$define|true|[yY]*)
93bc48fa 2689 $echo "Cross-compiling..."
5440bc8e
JH
2690 croak=''
2691 case "$cc" in
2692 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2693 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2694 ar=$targetarch-ar
2695 # leave out ld, choosing it is more complex
2696 nm=$targetarch-nm
2697 ranlib=$targetarch-ranlib
93bc48fa 2698 $echo 'extern int foo;' > try.c
f8006fac 2699 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2700 shift
2701 if $test $# -gt 0; then
2702 incpth="$incpth $*"
f8006fac
JH
2703 incpth="`$echo $incpth|$sed 's/^ //'`"
2704 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2705 for i in $*; do
f8006fac 2706 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2707 if $test -d $j; then
2708 libpth="$libpth $j"
2709 fi
2710 done
f8006fac
JH
2711 libpth="`$echo $libpth|$sed 's/^ //'`"
2712 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2713 fi
2714 $rm -f try.c
5440bc8e
JH
2715 ;;
2716 esac
2717 case "$targetarch" in
93bc48fa
JH
2718 '') echo "Targetarch not defined." >&4; croak=y ;;
2719 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2720 esac
2721 case "$incpth" in
93bc48fa 2722 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2723 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2724 esac
2725 case "$libpth" in
93bc48fa 2726 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2727 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2728 esac
93bc48fa
JH
2729 case "$usrinc" in
2730 '') for i in $incpth; do
2731 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2732 usrinc=$i
2733 echo "Guessing usrinc $usrinc." >&4
2734 break
2735 fi
2736 done
2737 case "$usrinc" in
2738 '') echo "Usrinc not defined." >&4; croak=y ;;
2739 esac
2740 ;;
2741 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2742 esac
93bc48fa
JH
2743 case "$targethost" in
2744 '') echo "Targethost not defined." >&4; croak=y ;;
2745 *) echo "Using targethost $targethost." >&4
5440bc8e 2746 esac
93bc48fa
JH
2747 locincpth=' '
2748 loclibpth=' '
5440bc8e 2749 case "$croak" in
93bc48fa 2750 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2751 esac
2752 case "$src" in
2753 /*) run=$src/Cross/run
93c0359c 2754 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2755 to=$src/Cross/to
2756 from=$src/Cross/from
2757 ;;
93bc48fa 2758 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2759 run=$pwd/Cross/run
f8006fac 2760 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2761 to=$pwd/Cross/to
2762 from=$pwd/Cross/from
2763 ;;
2764 esac
2765 case "$targetrun" in
2766 '') targetrun=ssh ;;
2767 esac
2768 case "$targetto" in
2769 '') targetto=scp ;;
2770 esac
2771 case "$targetfrom" in
2772 '') targetfrom=scp ;;
2773 esac
2774 run=$run-$targetrun
2775 to=$to-$targetto
2776 from=$from-$targetfrom
93bc48fa
JH
2777 case "$targetdir" in
2778 '') targetdir=/tmp
2779 echo "Guessing targetdir $targetdir." >&4
2780 ;;
2781 esac
5440bc8e 2782 case "$targetuser" in
93bc48fa
JH
2783 '') targetuser=root
2784 echo "Guessing targetuser $targetuser." >&4
2785 ;;
5440bc8e
JH
2786 esac
2787 case "$targetfrom" in
2788 scp) q=-q ;;
2789 *) q='' ;;
2790 esac
2791 case "$targetrun" in
2792 ssh|rsh)
2793 cat >$run <<EOF
2794#!/bin/sh
93c0359c
JH
2795case "\$1" in
2796-cwd)
2797 shift
2798 cwd=\$1
2799 shift
2800 ;;
2801esac
2802case "\$cwd" in
2803'') cwd=$targetdir ;;
2804esac
5440bc8e
JH
2805exe=\$1
2806shift
93c0359c
JH
2807if $test ! -f \$exe.xok; then
2808 $to \$exe
2809 $touch \$exe.xok
2810fi
2811$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2812EOF
2813 ;;
93bc48fa 2814 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2815 exit 1
2816 ;;
2817 esac
93c0359c
JH
2818 case "$targetmkdir" in
2819 */Cross/mkdir)
2820 cat >$targetmkdir <<EOF
2821#!/bin/sh
2822$targetrun -l $targetuser $targethost "mkdir -p \$@"
2823EOF
f8006fac 2824 $chmod a+rx $targetmkdir
93c0359c
JH
2825 ;;
2826 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2827 exit 1
2828 ;;
2829 esac
5440bc8e
JH
2830 case "$targetto" in
2831 scp|rcp)
2832 cat >$to <<EOF
2833#!/bin/sh
2834for f in \$@
2835do
93c0359c
JH
2836 case "\$f" in
2837 /*)
2838 $targetmkdir \`dirname \$f\`
2839 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2840 ;;
2841 *)
2842 $targetmkdir $targetdir/\`dirname \$f\`
2843 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2844 ;;
2845 esac
5440bc8e
JH
2846done
2847exit 0
2848EOF
2849 ;;
2850 cp) cat >$to <<EOF
2851#!/bin/sh
93c0359c
JH
2852for f in \$@
2853do
2854 case "\$f" in
2855 /*)
2856 $mkdir -p $targetdir/\`dirname \$f\`
2857 $cp \$f $targetdir/\$f || exit 1
2858 ;;
2859 *)
2860 $targetmkdir $targetdir/\`dirname \$f\`
2861 $cp \$f $targetdir/\$f || exit 1
2862 ;;
2863 esac
2864done
2865exit 0
5440bc8e
JH
2866EOF
2867 ;;
93bc48fa 2868 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2869 exit 1
2870 ;;
2871 esac
2872 case "$targetfrom" in
2873 scp|rcp)
2874 cat >$from <<EOF
2875#!/bin/sh
2876for f in \$@
2877do
93c0359c 2878 $rm -f \$f
5440bc8e
JH
2879 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2880done
2881exit 0
2882EOF
2883 ;;
2884 cp) cat >$from <<EOF
2885#!/bin/sh
2886for f in \$@
2887do
93c0359c 2888 $rm -f \$f
5440bc8e
JH
2889 cp $targetdir/\$f . || exit 1
2890done
2891exit 0
2892EOF
2893 ;;
93bc48fa 2894 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2895 exit 1
2896 ;;
2897 esac
93bc48fa
JH
2898 if $test ! -f $run; then
2899 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2900 else
f8006fac 2901 $chmod a+rx $run
5440bc8e 2902 fi
93bc48fa
JH
2903 if $test ! -f $to; then
2904 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2905 else
f8006fac 2906 $chmod a+rx $to
5440bc8e 2907 fi
93bc48fa
JH
2908 if $test ! -f $from; then
2909 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2910 else
f8006fac 2911 $chmod a+rx $from
5440bc8e 2912 fi
93bc48fa 2913 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2914 exit 1
2915 fi
2916 cat >&4 <<EOF
f8006fac
JH
2917Using '$run' for remote execution,
2918and '$from' and '$to'
93bc48fa 2919for remote file transfer.
5440bc8e
JH
2920EOF
2921 ;;
2922*) run=''
2923 to=:
2924 from=:
2925 usecrosscompile='undef'
2926 targetarch=''
2927 ;;
2928esac
2929
ecfc5424
AD
2930: see whether [:lower:] and [:upper:] are supported character classes
2931echo " "
ecfc5424
AD
2932case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2933ABYZ)
2934 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2935 up='[:upper:]'
2936 low='[:lower:]'
2937 ;;
416d0bea
MB
2938*) # There is a discontinuity in EBCDIC between 'R' and 'S'
2939 # (0xd9 and 0xe2), therefore that is a nice testing point.
2940 if test "X$up" = X -o "X$low" = X; then
2941 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2942 rs) up='[A-Z]'
2943 low='[a-z]'
28e8609d
JH
2944 ;;
2945 esac
416d0bea 2946 fi
28e8609d 2947 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2948 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2949 rs) up='A-Z'
28e8609d
JH
2950 low='a-z'
2951 ;;
2952 esac
416d0bea 2953 fi
28e8609d 2954 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2955 case "`echo RS | od -x 2>/dev/null`" in
2956 *D9E2*|*d9e2*)
28e8609d
JH
2957 echo "Hey, this might be EBCDIC." >&4
2958 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2959 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2960 rs) up='[A-IJ-RS-Z]'
2961 low='[a-ij-rs-z]'
28e8609d
JH
2962 ;;
2963 esac
2964 fi
2965 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2966 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2967 rs) up='A-IJ-RS-Z'
2968 low='a-ij-rs-z'
28e8609d
JH
2969 ;;
2970 esac
2971 fi
2972 ;;
2973 esac
2974 fi
2975esac
416d0bea
MB
2976case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2977rs)
28e8609d
JH
2978 echo "Using $up and $low to convert case." >&4
2979 ;;
ecfc5424 2980*)
28e8609d
JH
2981 echo "I don't know how to translate letters from upper to lower case." >&4
2982 echo "Your tr is not acting any way I know of." >&4
2983 exit 1
2984 ;;
ecfc5424
AD
2985esac
2986: set up the translation script tr, must be called with ./tr of course
2987cat >tr <<EOSC
2988$startsh
2989case "\$1\$2" in
2990'[A-Z][a-z]') exec $tr '$up' '$low';;
2991'[a-z][A-Z]') exec $tr '$low' '$up';;
2992esac
2993exec $tr "\$@"
2994EOSC
2995chmod +x tr
2996$eunicefix tr
2997
2304df62
AD
2998: Try to determine whether config.sh was made on this system
2999case "$config_sh" in
3000'')
43999f95
JH
3001myuname=`$uname -a 2>/dev/null`
3002$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
3003# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3004# because the A-Z/a-z are not consecutive.
a0d0e21e 3005myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 3006 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 3007newmyuname="$myuname"
2304df62 3008dflt=n
16d20bd9
AD
3009case "$knowitall" in
3010'')
3011 if test -f ../config.sh; then
3012 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3013 eval "`grep myuname= ../config.sh`"
3014 fi
3015 if test "X$myuname" = "X$newmyuname"; then
3016 dflt=y
3017 fi
2304df62 3018 fi
16d20bd9
AD
3019 ;;
3020*) dflt=y;;
3021esac
2304df62
AD
3022
3023: Get old answers from old config file if Configure was run on the
3024: same system, otherwise use the hints.
3025hint=default
3026cd ..
3027if test -f config.sh; then
16d20bd9
AD
3028 echo " "
3029 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
3030 . UU/myread
3031 case "$ans" in
f83701cd
AD
3032 n*|N*) echo "OK, I'll ignore it."
3033 mv config.sh config.sh.old
3034 myuname="$newmyuname"
3035 ;;
2304df62 3036 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
3037 tmp_n="$n"
3038 tmp_c="$c"
85cad39c 3039 tmp_sh="$sh"
2304df62
AD
3040 . ./config.sh
3041 cp config.sh UU
ecfc5424
AD
3042 n="$tmp_n"
3043 c="$tmp_c"
85cad39c 3044 : Older versions did not always set $sh. Catch re-use of such
3045 : an old config.sh.
3046 case "$sh" in
3047 '') sh="$tmp_sh" ;;
3048 esac
2304df62
AD
3049 hint=previous
3050 ;;
3051 esac
3052fi
2573c5f9 3053. ./UU/checkcc
2304df62
AD
3054if test ! -f config.sh; then
3055 $cat <<EOM
3056
4e2a5f63
AD
3057First time through, eh? I have some defaults handy for some systems
3058that need some extra help getting the Configure answers right:
2304df62
AD
3059
3060EOM
dfe9444c 3061 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3062 dflt=''
3063 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3064 : tests or hints, please send them to perlbug@perl.org
2304df62 3065 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3066 $test -f /irix && osname=irix
85e6fe83
LW
3067 $test -f /xenix && osname=sco_xenix
3068 $test -f /dynix && osname=dynix
3069 $test -f /dnix && osname=dnix
5f05dabc 3070 $test -f /lynx.os && osname=lynxos
3071 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3072 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3073 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3074 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3075 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3076 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3077 $test -d /usr/apollo/bin && osname=apollo
3078 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3079 $test -d /usr/include/minix && osname=minix
d54344fc 3080 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3081 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3082 osname=machten
4633a7c4 3083 if $test -x /sbin/version; then
dfe9444c 3084 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3085 $sed -e 's/[A-Za-z]$//'`
3086 elif $test -x /usr/etc/version; then
dfe9444c 3087 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3088 $sed -e 's/[A-Za-z]$//'`
3089 else
3090 osvers="$2.$3"
3091 fi
3092 fi
aaacdc8b
GS
3093
3094 $test -f /sys/posix.dll &&
3095 $test -f /usr/bin/what &&
3096 set X `/usr/bin/what /sys/posix.dll` &&
3097 $test "$3" = UWIN &&
3098 osname=uwin &&
3099 osvers="$5"
3100
2304df62
AD
3101 if $test -f $uname; then
3102 set X $myuname
3103 shift
3104
2304df62 3105 case "$5" in
85e6fe83 3106 fps*) osname=fps ;;
2304df62
AD
3107 mips*)
3108 case "$4" in
85e6fe83
LW
3109 umips) osname=umips ;;
3110 *) osname=mips ;;
2304df62 3111 esac;;
85e6fe83
LW
3112 [23]100) osname=mips ;;
3113 next*) osname=next ;;
ecfc5424 3114 i386*)
c6912327
JH
3115 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3116 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3117 osname='sco'
3118 osvers=$tmp
3119 elif $test -f /etc/kconfig; then
ecfc5424 3120 osname=isc
bd628c73 3121 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3122 osvers=4
3123 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3124 osvers=3
2304df62 3125 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3126 osvers=2
ecfc5424
AD
3127 fi
3128 fi
2000072c 3129 tmp=''
ecfc5424 3130 ;;
c4f23d77
AD
3131 pc*)
3132 if test -n "$DJGPP"; then
3133 osname=dos
3134 osvers=djgpp
3135 fi
3136 ;;
2304df62
AD
3137 esac
3138
3139 case "$1" in
a0d0e21e
LW
3140 aix) osname=aix
3141 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3142 case "$tmp" in
e81c5c2a
NC
3143 # oslevel can fail with:
3144 # oslevel: Unable to acquire lock.
3145 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3146 '<3240'|'<>3240') osvers=3.2.0 ;;
3147 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3148 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3149 *) osvers=$tmp;;
a0d0e21e
LW
3150 esac
3151 ;;
aaacdc8b
GS
3152 bsd386) osname=bsd386
3153 osvers=`$uname -r`
3154 ;;
3155 cygwin*) osname=cygwin
3156 osvers="$3"
3157 ;;
23f87696
SZ
3158 *dc.osx) osname=dcosx
3159 osvers="$3"
3160 ;;
a0d0e21e
LW
3161 dnix) osname=dnix
3162 osvers="$3"
3163 ;;
3164 domainos) osname=apollo
3165 osvers="$3"
3166 ;;
a774dfe6
RSG
3167 dgux) osname=dgux
3168 osvers="$3"
3169 ;;
3170 dragonfly) osname=dragonfly
a0d0e21e
LW
3171 osvers="$3"
3172 ;;
760ac839 3173 dynixptx*) osname=dynixptx
e58e581d 3174 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3175 ;;
a774dfe6 3176 freebsd) osname=freebsd
a0d0e21e 3177 osvers="$3" ;;
761ee4e8
BD
3178 genix) osname=genix ;;
3179 gnu) osname=gnu
3180 osvers="$3" ;;
a774dfe6 3181 hp*) osname=hpux
bfb7748a 3182 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3183 ;;
761ee4e8 3184 irix*) osname=irix
a0d0e21e
LW
3185 case "$3" in
3186 4*) osvers=4 ;;
3187 5*) osvers=5 ;;
ecfc5424 3188 *) osvers="$3" ;;
a0d0e21e
LW
3189 esac
3190 ;;
761ee4e8 3191 linux) osname=linux
a0d0e21e 3192 case "$3" in
a0d0e21e
LW
3193 *) osvers="$3" ;;
3194 esac
3195 ;;
761ee4e8 3196 MiNT) osname=mint
28e8609d
JH
3197 ;;
3198 netbsd*) osname=netbsd
ecfc5424
AD
3199 osvers="$3"
3200 ;;
4e81affe
MM
3201 news-os) osvers="$3"
3202 case "$3" in
3203 4*) osname=newsos4 ;;
3204 *) osname=newsos ;;
3205 esac
3206 ;;
aaacdc8b 3207 next*) osname=next ;;
28bb1e2c 3208 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3209 openbsd) osname=openbsd
3210 osvers="$3"
3211 ;;
5c728af0
IZ
3212 os2) osname=os2
3213 osvers="$4"
3214 ;;
aaacdc8b
GS
3215 POSIX-BC | posix-bc ) osname=posix-bc
3216 osvers="$3"
a0d0e21e 3217 ;;
ae3afa4e
TH
3218 powerux | power_ux | powermax_os | powermaxos | \
3219 powerunix | power_unix) osname=powerux
3220 osvers="$3"
3221 ;;
aaacdc8b
GS
3222 qnx) osname=qnx
3223 osvers="$4"
3224 ;;
a0d0e21e
LW
3225 solaris) osname=solaris
3226 case "$3" in
3227 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3228 *) osvers="$3" ;;
a0d0e21e
LW
3229 esac
3230 ;;
85e6fe83
LW
3231 sunos) osname=sunos
3232 case "$3" in
85e6fe83
LW
3233 5*) osname=solaris
3234 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3235 *) osvers="$3" ;;
2304df62
AD
3236 esac
3237 ;;
a0d0e21e 3238 titanos) osname=titanos
85e6fe83 3239 case "$3" in
a0d0e21e
LW
3240 1*) osvers=1 ;;
3241 2*) osvers=2 ;;
3242 3*) osvers=3 ;;
3243 4*) osvers=4 ;;
ecfc5424 3244 *) osvers="$3" ;;
2304df62
AD
3245 esac
3246 ;;
85e6fe83 3247 ultrix) osname=ultrix
ecfc5424 3248 osvers="$3"
2304df62 3249 ;;
28757baa 3250 osf1|mls+) case "$5" in
fed7345c
AD
3251 alpha)
3252 osname=dec_osf
fdd85a03 3253 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3254 case "$osvers" in
3255 [1-9].[0-9]*) ;;
3256 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3257 esac
ecfc5424
AD
3258 ;;
3259 hp*) osname=hp_osf1 ;;
3260 mips) osname=mips_osf1 ;;
85e6fe83
LW
3261 esac
3262 ;;
af1ff193 3263 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3264 openunix|unixware) osname=svr5
0337d152
BG
3265 osvers="$4"
3266 ;;
3c728e00 3267 uts) osname=uts
a0d0e21e
LW
3268 osvers="$3"
3269 ;;
3c728e00
JH
3270 vos) osvers="$3"
3271 ;;
85e6fe83 3272 $2) case "$osname" in
2304df62 3273 *isc*) ;;
a0d0e21e 3274 *freebsd*) ;;
5f05dabc 3275 svr*)
a0d0e21e 3276 : svr4.x or possibly later
a774dfe6 3277 case "svr$3" in
a0d0e21e
LW
3278 ${osname}*)
3279 osname=svr$3
3280 osvers=$4
3281 ;;
3282 esac
3283 case "$osname" in
3284 svr4.0)
3285 : Check for ESIX
3286 if test -f /stand/boot ; then
3287 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3288 if test -n "$INITPROG" -a -f "$INITPROG"; then
3289 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3290 if test -n "$isesix"; then
a0d0e21e
LW
3291 osname=esix4
3292 fi
3293 fi
3294 fi
3295 ;;
3296 esac
3297 ;;
2304df62 3298 *) if test -f /etc/systemid; then
a0d0e21e
LW
3299 osname=sco
3300 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3301 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3302 osvers=$1.$2.$3
c4f23d77 3303 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3304 osvers=$1.$2
c4f23d77 3305 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3306 osvers=$1
2304df62 3307 fi
a0d0e21e
LW
3308 else
3309 case "$osname" in
3310 '') : Still unknown. Probably a generic Sys V.
3311 osname="sysv"
3312 osvers="$3"
3313 ;;
3314 esac
2304df62
AD
3315 fi
3316 ;;
3317 esac
3318 ;;
a0d0e21e
LW
3319 *) case "$osname" in
3320 '') : Still unknown. Probably a generic BSD.
3321 osname="$1"
3322 osvers="$3"
3323 ;;
3324 esac
3325 ;;
2304df62
AD
3326 esac
3327 else
dfe9444c
AD
3328 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3329 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3330 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3331 osname=news_os
2304df62 3332 fi
dfe9444c 3333 $rm -f UU/kernel.what
5c728af0 3334 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3335 set X $myuname
3336 osname=os2
3337 osvers="$5"
2304df62
AD
3338 fi
3339 fi
a774dfe6 3340
5440bc8e
JH
3341 case "$targetarch" in
3342 '') ;;
3343 *) hostarch=$osname
3344 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3345 osvers=''
3346 ;;
3347 esac
3348
a0d0e21e
LW
3349 : Now look for a hint file osname_osvers, unless one has been
3350 : specified already.
3351 case "$hintfile" in
3352 ''|' ')
1e127011 3353 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3354 : Also try without trailing minor version numbers.
1e127011
DD
3355 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3356 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3357 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3358 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3359 case "$file" in
3360 '') dflt=none ;;
3361 *) case "$osvers" in
3362 '') dflt=$file
3363 ;;
dfe9444c 3364 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3365 dflt=$file
dfe9444c 3366 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3367 dflt=$xfile
dfe9444c 3368 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3369 dflt=$xxfile
dfe9444c 3370 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3371 dflt=$xxxfile
dfe9444c 3372 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3373 dflt=$xxxxfile
dfe9444c 3374 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3375 dflt="${osname}"
3376 else
3377 dflt=none
3378 fi
3379 ;;
3380 esac
85e6fe83
LW
3381 ;;
3382 esac
4e2a5f63
AD
3383 if $test -f Policy.sh ; then
3384 case "$dflt" in
3385 *Policy*) ;;
3386 none) dflt="Policy" ;;
3387 *) dflt="Policy $dflt" ;;
3388 esac
3389 fi
85e6fe83 3390 ;;
a0d0e21e 3391 *)
ecfc5424 3392 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3393 ;;
2304df62 3394 esac
1aef975c 3395
4e2a5f63
AD
3396 if $test -f Policy.sh ; then
3397 $cat <<EOM
3398
3399There's also a Policy hint file available, which should make the
3400site-specific (policy) questions easier to answer.
3401EOM
3402
3403 fi
3404
2304df62
AD
3405 $cat <<EOM
3406
3407You may give one or more space-separated answers, or "none" if appropriate.
a2d23ec2
MB
3408If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3409previous run of Configure, you may specify it as well as or instead of
3410OS-specific hints. If hints are provided for your OS, you should use them:
3411although Perl can probably be built without hints on many platforms, using
3412hints often improve performance and may enable features that Configure can't
3413set up on its own. If there are no hints that match your OS, specify "none";
3414DO NOT give a wrong version or a wrong OS.
2304df62
AD
3415
3416EOM
4e2a5f63 3417
2304df62 3418 rp="Which of these apply, if any?"
dfe9444c 3419 . UU/myread
85e6fe83
LW
3420 tans=$ans
3421 for file in $tans; do
4e2a5f63
AD
3422 if $test X$file = XPolicy -a -f Policy.sh; then
3423 . Policy.sh
3424 $cat Policy.sh >> UU/config.sh
3425 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3426 . $src/hints/$file.sh
3427 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3428 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3429 : nothing
3430 else
85e6fe83
LW
3431 : Give one chance to correct a possible typo.
3432 echo "$file.sh does not exist"
3433 dflt=$file
3434 rp="hint to use instead?"
dfe9444c 3435 . UU/myread
85e6fe83 3436 for file in $ans; do
dfe9444c
AD
3437 if $test -f "$src/hints/$file.sh"; then
3438 . $src/hints/$file.sh
3439 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3440 elif $test X$ans = X -o X$ans = Xnone ; then
3441 : nothing
3442 else
3443 echo "$file.sh does not exist -- ignored."
3444 fi
3445 done
2304df62
AD
3446 fi
3447 done
85e6fe83 3448
2304df62 3449 hint=recommended
85e6fe83 3450 : Remember our hint file for later.
dfe9444c 3451 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3452 hintfile="$file"
85e6fe83 3453 else
a0d0e21e 3454 hintfile=''
85e6fe83 3455 fi
2304df62
AD
3456fi
3457cd UU
3458;;
3459*)
3460 echo " "
3461 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3462 tmp_n="$n"
3463 tmp_c="$c"
2304df62
AD
3464 cd ..
3465 cp $config_sh config.sh 2>/dev/null
a78b0d02 3466 chmod +w config.sh
2304df62
AD
3467 . ./config.sh
3468 cd UU
3469 cp ../config.sh .
ecfc5424
AD
3470 n="$tmp_n"
3471 c="$tmp_c"
2304df62
AD
3472 hint=previous
3473 ;;
3474esac
1aef975c 3475test "$override" && . ./optdef.sh
2304df62
AD
3476
3477: Restore computed paths
3478for file in $loclist $trylist; do
3479 eval $file="\$_$file"
3480done
3481
85e6fe83 3482cat << EOM
a0d0e21e 3483
85e6fe83 3484Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3485The default value is probably right if the name rings a bell. Otherwise,
3486since spelling matters for me, either accept the default or answer "none"
3487to leave it blank.
a0d0e21e 3488
85e6fe83 3489EOM
85e6fe83 3490case "$osname" in
a0d0e21e 3491 ''|' ')
85e6fe83 3492 case "$hintfile" in
a0d0e21e 3493 ''|' '|none) dflt=none ;;
ecfc5424 3494 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3495 esac
3496 ;;
3497 *) dflt="$osname" ;;
3498esac
3499rp="Operating system name?"
3500. ./myread
3501case "$ans" in
ecfc5424
AD
3502none) osname='' ;;
3503*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3504esac
8ff267be 3505echo " "
3506case "$osvers" in
3507 ''|' ')
3508 case "$hintfile" in
3509 ''|' '|none) dflt=none ;;
3510 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3511 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3512 case "$dflt" in
3513 ''|' ') dflt=none ;;
3514 esac
3515 ;;
3516 esac
3517 ;;
3518 *) dflt="$osvers" ;;
3519esac
3520rp="Operating system version?"
3521. ./myread
3522case "$ans" in
3523none) osvers='' ;;
3524*) osvers="$ans" ;;
3525esac
3526
02e93a22
JH
3527
3528. ./posthint.sh
3529
2304df62 3530: who configured the system
59b83a6f 3531cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3532case "$cf_by" in
3533"")
7c04078e 3534 cf_by=`(logname) 2>/dev/null`
dfe9444c 3535 case "$cf_by" in
7c04078e
GA
3536 "")
3537 cf_by=`(whoami) 2>/dev/null`
3538 case "$cf_by" in
3539 "") cf_by=unknown ;;
3540 esac ;;
8ff267be 3541 esac ;;
3542esac
2304df62 3543
f3f1a2d8
MB
3544: decide how portable to be. Allow command line overrides.
3545case "$d_portable" in
3546"$undef") ;;
3547*) d_portable="$define" ;;
b4eb6b3d 3548esac
b4eb6b3d 3549
f3f1a2d8
MB
3550: set up shell script to do ~ expansion
3551cat >filexp <<EOSS
3552$startsh
3553: expand filename
3554case "\$1" in
3555 ~/*|~)
3556 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3557 ;;
3558 ~*)
3559 if $test -f /bin/csh; then
3560 /bin/csh -f -c "glob \$1"
3561 failed=\$?
3562 echo ""
3563 exit \$failed
3564 else
3565 name=\`$expr x\$1 : '..\([^/]*\)'\`
3566 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3567 if $test ! -d "\$dir"; then
3568 me=\`basename \$0\`
3569 echo "\$me: can't locate home directory for: \$name" >&2
3570 exit 1
3571 fi
3572 case "\$1" in
3573 */*)
3574 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3575 ;;
3576 *)
3577 echo \$dir
3578 ;;
3579 esac
3580 fi
3581 ;;
3582*)
3583 echo \$1
3584 ;;
b29b105d 3585esac
f3f1a2d8
MB
3586EOSS
3587chmod +x filexp
3588$eunicefix filexp
b29b105d 3589
f3f1a2d8
MB
3590: now set up to get a file name
3591cat <<EOS >getfile
3592$startsh
3593EOS
3594cat <<'EOSC' >>getfile
3595tilde=''
3596fullpath=''
3597already=''
3598skip=''
3599none_ok=''
3600exp_file=''
3601nopath_ok=''
3602orig_rp="$rp"
3603orig_dflt="$dflt"
3604case "$gfpth" in
3605'') gfpth='.' ;;
b29b105d 3606esac
b29b105d 3607
f3f1a2d8
MB
3608case "$fn" in
3609*\(*)
3610 : getfile will accept an answer from the comma-separated list
3611 : enclosed in parentheses even if it does not meet other criteria.
3612 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3613 fn=`echo $fn | sed 's/(.*)//'`
3614 ;;
b29b105d
JH
3615esac
3616
f3f1a2d8
MB
3617case "$fn" in
3618*:*)
3619 loc_file=`expr $fn : '.*:\(.*\)'`
3620 fn=`expr $fn : '\(.*\):.*'`
3621 ;;
b29b105d 3622esac
b29b105d 3623
f3f1a2d8
MB
3624case "$fn" in
3625*~*) tilde=true;;
3626esac
3627case "$fn" in
3628*/*) fullpath=true;;
3629esac
3630case "$fn" in
3631*+*) skip=true;;
3632esac
3633case "$fn" in
3634*n*) none_ok=true;;
3635esac
3636case "$fn" in
3637*e*) exp_file=true;;
3638esac
3639case "$fn" in
3640*p*) nopath_ok=true;;
b29b105d 3641esac
b29b105d 3642
f3f1a2d8
MB
3643case "$fn" in
3644*f*) type='File';;
3645*d*) type='Directory';;
3646*l*) type='Locate';;
3647esac
b29b105d 3648
f3f1a2d8
MB
3649what="$type"
3650case "$what" in
3651Locate) what='File';;
3652esac
b29b105d 3653
f3f1a2d8
MB
3654case "$exp_file" in
3655'')
3656 case "$d_portable" in
3657 "$define") ;;
3658 *) exp_file=true;;
b29b105d
JH
3659 esac
3660 ;;
3661esac
3662
f3f1a2d8
MB
3663cd ..
3664while test "$type"; do
3665 redo=''
3666 rp="$orig_rp"
3667 dflt="$orig_dflt"
3668 case "$tilde" in
3669 true) rp="$rp (~name ok)";;
3670 esac
3671 . UU/myread
3672 if test -f UU/getfile.ok && \
3673 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3674 then
3675 value="$ans"
3676 ansexp="$ans"
3677 break
3678 fi
3679 case "$ans" in
3680 none)
3681 value=''
3682 ansexp=''
3683 case "$none_ok" in
3684 true) type='';;
b29b105d
JH
3685 esac
3686 ;;
f3f1a2d8
MB
3687 *)
3688 case "$tilde" in
3689 '') value="$ans"
3690 ansexp="$ans";;
3691 *)
3692 value=`UU/filexp $ans`
3693 case $? in
3694 0)
3695 if test "$ans" != "$value"; then
3696 echo "(That expands to $value on this system.)"
3697 fi
3698 ;;
3699 *) value="$ans";;
3700 esac
3701 ansexp="$value"
3702 case "$exp_file" in
3703 '') value="$ans";;
3704 esac
3705 ;;
3706 esac
3707 case "$fullpath" in
3708 true)
3709 case "$ansexp" in
3710 /*) value="$ansexp" ;;
3711 [a-zA-Z]:/*) value="$ansexp" ;;
3712 *)
3713 redo=true
3714 case "$already" in
3715 true)
3716 echo "I shall only accept a full path name, as in /bin/ls." >&4
3717 echo "Use a ! shell escape if you wish to check pathnames." >&4
3718 ;;
3719 *)
3720 echo "Please give a full path name, starting with slash." >&4
3721 case "$tilde" in
3722 true)
3723 echo "Note that using ~name is ok provided it expands well." >&4
3724 already=true
3725 ;;
3726 esac
3727 esac
3728 ;;
3729 esac
3730 ;;
3731 esac
3732 case "$redo" in
3733 '')
3734 case "$type" in
3735 File)
3736 for fp in $gfpth; do
3737 if test "X$fp" = X.; then
3738 pf="$ansexp"
3739 else
3740 pf="$fp/$ansexp"
3741 fi
3742 if test -f "$pf"; then
3743 type=''
3744 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3745 then
3746 echo "($value is not a plain file, but that's ok.)"
3747 type=''
3748 fi
3749 if test X"$type" = X; then
3750 value="$pf"
3751 break
3752 fi
3753 done
3754 ;;
3755 Directory)
3756 for fp in $gfpth; do
3757 if test "X$fp" = X.; then
3758 dir="$ans"
3759 direxp="$ansexp"
3760 else
3761 dir="$fp/$ansexp"
3762 direxp="$fp/$ansexp"
3763 fi
3764 if test -d "$direxp"; then
3765 type=''
3766 value="$dir"
3767 break
3768 fi
3769 done
3770 ;;
3771 Locate)
3772 if test -d "$ansexp"; then
3773 echo "(Looking for $loc_file in directory $value.)"
3774 value="$value/$loc_file"
3775 ansexp="$ansexp/$loc_file"
3776 fi
3777 if test -f "$ansexp"; then
3778 type=''
3779 fi
3780 case "$nopath_ok" in
3781 true) case "$value" in
3782 */*) ;;
3783 *) echo "Assuming $value will be in people's path."
3784 type=''
3785 ;;
3786 esac
3787 ;;
3788 esac
3789 ;;
3790 esac
b4eb6b3d 3791
f3f1a2d8
MB
3792 case "$skip" in
3793 true) type='';
3794 esac
3795
3796 case "$type" in
3797 '') ;;
3798 *)
3799 if test "$fastread" = yes; then
3800 dflt=y
3801 else
3802 dflt=n
3803 fi
3804 rp="$what $value doesn't exist. Use that name anyway?"
3805 . UU/myread
3806 dflt=''
3807 case "$ans" in
3808 y*) type='';;
3809 *) echo " ";;
3810 esac
3811 ;;
3812 esac
3813 ;;
3814 esac
3815 ;;
b4eb6b3d 3816 esac
f3f1a2d8
MB
3817done
3818cd UU
3819ans="$value"
3820rp="$orig_rp"
3821dflt="$orig_dflt"
3822rm -f getfile.ok
3823test "X$gfpthkeep" != Xy && gfpth=""
3824EOSC
3825
3826: determine root of directory hierarchy where package will be installed.
3827case "$prefix" in
3828'')
3829 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3830 ;;
3831*?/)
3832 dflt=`echo "$prefix" | sed 's/.$//'`
b4eb6b3d
JH
3833 ;;
3834*)
f3f1a2d8 3835 dflt="$prefix"
b4eb6b3d
JH
3836 ;;
3837esac
f3f1a2d8 3838$cat <<EOM
b4eb6b3d 3839
f3f1a2d8
MB
3840By default, $package will be installed in $dflt/bin, manual pages
3841under $dflt/man, etc..., i.e. with $dflt as prefix for all
3842installation directories. Typically this is something like /usr/local.
3843If you wish to have binaries under /usr/bin but other parts of the
3844installation under /usr/local, that's ok: you will be prompted
3845separately for each of the installation directories, the prefix being
3846only used to set the defaults.
c915ce7f
JH
3847
3848EOM
f3f1a2d8
MB
3849fn=d~
3850rp='Installation prefix to use?'
3851. ./getfile
3852oldprefix=''
3853case "$prefix" in
3854'') ;;
3855*)
3856 case "$ans" in
3857 "$prefix") ;;
3858 *) oldprefix="$prefix";;
3859 esac
c915ce7f
JH
3860 ;;
3861esac
f3f1a2d8
MB
3862prefix="$ans"
3863prefixexp="$ansexp"
c915ce7f 3864
f3f1a2d8
MB
3865case "$afsroot" in
3866'') afsroot=/afs ;;
3867*) afsroot=$afsroot ;;
b4eb6b3d 3868esac
b4eb6b3d 3869
f3f1a2d8
MB
3870: is AFS running?
3871echo " "
3872case "$afs" in
3873$define|true) afs=true ;;
3874$undef|false) afs=false ;;
3875*) if test -d $afsroot; then
3876 afs=true
3877 else
3878 afs=false
3879 fi
b4eb6b3d 3880 ;;
f3f1a2d8
MB
3881esac
3882if $afs; then
3883 echo "AFS may be running... I'll be extra cautious then..." >&4
3884else
3885 echo "AFS does not seem to be running..." >&4
9da7673b 3886fi
b4eb6b3d 3887
f3f1a2d8
MB
3888: determine installation prefix for where package is to be installed.
3889if $afs; then
3890$cat <<EOM
3891
3892Since you are running AFS, I need to distinguish the directory in which
3893files will reside from the directory in which they are installed (and from
3894which they are presumably copied to the former directory by occult means).
b4eb6b3d 3895
b4eb6b3d 3896EOM
f3f1a2d8
MB
3897 case "$installprefix" in
3898 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3899 *) dflt="$installprefix";;
3900 esac
3901else
3902$cat <<EOM
b4eb6b3d 3903
f3f1a2d8
MB
3904In some special cases, particularly when building $package for distribution,
3905it is convenient to distinguish the directory in which files should be
3906installed from the directory ($prefix) in which they will
3907eventually reside. For most users, these two directories are the same.
3908
3909EOM
3910 case "$installprefix" in
3911 '') dflt=$prefix ;;
3912 *) dflt=$installprefix;;
3913 esac
3914fi
3915fn=d~
3916rp='What installation prefix should I use for installing files?'
3917. ./getfile
3918installprefix="$ans"
3919installprefixexp="$ansexp"
3920
3921: Perform the prefixexp/installprefixexp correction if necessary
3922cat <<EOS >installprefix
3923$startsh
3924EOS
3925cat <<'EOSC' >>installprefix
3926: Change installation prefix, if necessary.
3927if $test X"$prefix" != X"$installprefix"; then
3928 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3929else
3930 eval "install${prefixvar}=\"\$${prefixvar}exp\""
3931fi
3932EOSC
3933chmod +x installprefix
3934$eunicefix installprefix
3935
3936: Set variables such as privlib and privlibexp from the output of ./getfile
3937: performing the prefixexp/installprefixexp correction if necessary.
3938cat <<EOS >setprefixvar
3939$startsh
3940EOS
3941cat <<'EOSC' >>setprefixvar
3942eval "${prefixvar}=\"\$ans\""
3943eval "${prefixvar}exp=\"\$ansexp\""
3944. ./installprefix
3945EOSC
3946chmod +x setprefixvar
3947$eunicefix setprefixvar
3948
3949: set up the script used to warn in case of inconsistency
3950cat <<EOS >whoa
3951$startsh
3952EOS
3953cat <<'EOSC' >>whoa
3954dflt=y
dcb594bc
MB
3955case "$hint" in
3956 recommended)
3957 case "$hintfile" in
3958 '') echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3959 ;;
3960 *) echo "Hmm. Based on the hints in hints/$hintfile.sh, " >&4
3961 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
3962 ;;
3963 esac
3964 ;;
3965 *) echo " "
3966 echo "*** WHOA THERE!!! ***" >&4
3967 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3968 ;;
3969esac
f3f1a2d8
MB
3970rp=" Keep the $hint value?"
3971. ./myread
3972case "$ans" in
3973y) td=$was; tu=$was;;
3974esac
3975EOSC
3976
3977: function used to set $1 to $val
3978setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3979case "$val$was" in
3980$define$undef) . ./whoa; eval "$var=\$td";;
3981$undef$define) . ./whoa; eval "$var=\$tu";;
3982*) eval "$var=$val";;
3983esac'
3984
3985case "$usesocks" in
3986$define|true|[yY]*) dflt='y';;
3987*) dflt='n';;
3988esac
3989cat <<EOM
3990
3991Perl can be built to use the SOCKS proxy protocol library. To do so,
3992Configure must be run with -Dusesocks. If you use SOCKS you also need
3993to use the PerlIO abstraction layer, this will be implicitly selected.
3994
3995If this doesn't make any sense to you, just accept the default '$dflt'.
3996EOM
3997rp='Build Perl for SOCKS?'
3998. ./myread
3999case "$ans" in
4000y|Y) val="$define" ;;
4001*) val="$undef" ;;
4002esac
4003set usesocks
4004eval $setvar
4005
4006case "$usesocks" in
4007$define|true|[yY]*) useperlio="$define";;
4008esac
4009
4010case "$useperlio" in
4011$define|true|[yY]*|'') dflt='y';;
4012*) dflt='n';;
4013esac
4014cat <<EOM
4015
4016Previous version of $package used the standard IO mechanisms as
4017defined in <stdio.h>. Versions 5.003_02 and later of $package allow
4018alternate IO mechanisms via the PerlIO abstraction layer, but the
4019stdio mechanism is still available if needed. The abstraction layer
4020can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4021Using PerlIO with sfio may cause problems with some extension modules.
4022
4023If this doesn't make any sense to you, just accept the default '$dflt'.
b4eb6b3d 4024EOM
f3f1a2d8
MB
4025rp='Use the PerlIO abstraction layer?'
4026. ./myread
4027case "$ans" in
4028y|Y)
b4eb6b3d
JH
4029 val="$define"
4030 ;;
f3f1a2d8
MB
4031*)
4032 echo "Ok, doing things the stdio way."
4033 val="$undef"
4034 ;;
4035esac
4036set useperlio
4037eval $setvar
4038
4039case "$usesocks" in
4040$define|true|[yY]*)
4041 case "$useperlio" in
4042 $define|true|[yY]*) ;;
4043 *) cat >&4 <<EOM
4044
4045You are using the SOCKS proxy protocol library which means that you
4046should also use the PerlIO layer. You may be headed for trouble.
4047
4048EOM
4049 ;;
b4eb6b3d 4050 esac
f3f1a2d8
MB
4051 ;;
4052esac
4053
4054
5c40187f
MB
4055: get the patchlevel
4056echo " "
4057echo "Getting the current patchlevel..." >&4
4058if $test -r $rsrc/patchlevel.h;then
4059 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4060 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4061 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4062 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4063 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4064 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4065 perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
4066else
4067 revision=0
4068 patchlevel=0
4069 subversion=0
4070 api_revision=0
4071 api_version=0
4072 api_subversion=0
4073 perl_patchlevel=0
4074 $echo "(You do not have patchlevel.h. Eek.)"
4075fi
4076if $test -r $rsrc/.patch ; then
4077 if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4078 perl_patchlevel=`cat $rsrc/.patch`
4079 fi
4080fi
4081: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4082version_patchlevel_string="version $patchlevel subversion $subversion"
4083case "$perl_patchlevel" in
40840|'') ;;
4085*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4086esac
4087
4088$echo "(You have $package $version_patchlevel_string.)"
4089
4090case "$osname" in
4091dos|vms)
4092 : XXX Should be a Configure test for double-dots in filenames.
4093 version=`echo $revision $patchlevel $subversion | \
4094 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4095 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4096 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4097 ;;
4098*)
4099 version=`echo $revision $patchlevel $subversion | \
4100 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4101 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4102 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4103 ;;
4104esac
4105: Special case the 5.005_xx maintenance series, which used 5.005
4106: without any subversion label as a subdirectory in $sitelib
4107if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4108 api_versionstring='5.005'
4109fi
4110
f3f1a2d8
MB
4111case "$usethreads" in
4112$define|true|[yY]*) dflt='y';;
4113*) # Catch case where user specified ithreads or 5005threads but
4114 # forgot -Dusethreads (A.D. 4/2002)
4115 case "$useithreads$use5005threads" in
4116 *$define*)
4117 case "$useperlio" in
4118 "$define") dflt='y' ;;
4119 *) dflt='n' ;;
4120 esac
4121 ;;
4122 *) dflt='n';;
4123 esac
4124 ;;
4125esac
4126cat <<EOM
4127
4128Perl can be built to take advantage of threads on some systems.
4129To do so, Configure can be run with -Dusethreads.
4130
4131Note that Perl built with threading support runs slightly slower
4132and uses more memory than plain Perl. The current implementation
4133is believed to be stable, but it is fairly new, and so should be
4134treated with caution.
4135
4136If this doesn't make any sense to you, just accept the default '$dflt'.
4137EOM
4138rp='Build a threading Perl?'
4139. ./myread
4140case "$ans" in
4141y|Y) val="$define" ;;
4142*) val="$undef" ;;
4143esac
4144set usethreads
4145eval $setvar
4146
5c40187f
MB
4147if $test $patchlevel -lt 9; then
4148 case "$usethreads" in
4149 $define)
f3f1a2d8
MB
4150 $cat <<EOM
4151
4152Since release 5.6, Perl has had two different threading implementations,
4153the newer interpreter-based version (ithreads) with one interpreter per
4154thread, and the older 5.005 version (5005threads).
4155The 5005threads version is effectively unmaintained and will probably be
4156removed in Perl 5.10, so there should be no need to build a Perl using it
4157unless needed for backwards compatibility with some existing 5.005threads
4158code.
4159
4160EOM
4161 : Default to ithreads unless overridden on command line or with
4162 : old config.sh
4163 dflt='y'
4164 case "$use5005threads" in
4165 $define|true|[yY]*) dflt='n';;
4166 esac
4167 case "$useithreads" in
4168 $undef|false|[nN]*) dflt='n';;
4169 esac
4170 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
4171 . ./myread
4172 case "$ans" in
f3f1a2d8 4173 y|Y) val="$define" ;;
b4eb6b3d
JH
4174 *) val="$undef" ;;
4175 esac
f3f1a2d8
MB
4176 set useithreads
4177 eval $setvar
4178 : Now set use5005threads to the opposite value.
4179 case "$useithreads" in
4180 $define) val="$undef" ;;
4181 *) val="$define" ;;
4182 esac
4183 set use5005threads
4184 eval $setvar
4185 ;;
5c40187f 4186 *)
f3f1a2d8
MB
4187 useithreads="$undef"
4188 use5005threads="$undef"
b4eb6b3d 4189 ;;
5c40187f 4190 esac
b4eb6b3d 4191
5c40187f
MB
4192 case "$useithreads$use5005threads" in
4193 "$define$define")
f3f1a2d8 4194 $cat >&4 <<EOM
96056487 4195
f3f1a2d8
MB
4196You cannot have both the ithreads and the 5.005 threads enabled
4197at the same time. Disabling the 5.005 threads since they are
4198much less stable than the ithreads.
4199
4200EOM
4201 use5005threads="$undef"
96056487 4202 ;;
5c40187f
MB
4203 esac
4204
4205else
4206: perl-5.9.x and later
4207
4208 use5005threads="$undef"
4209 case "$usethreads" in
4210 $define)
4211 : Default to ithreads unless overridden on command line or with
4212 : old config.sh
4213 dflt='y'
4214 case "$useithreads" in
4215 $undef|false|[nN]*) dflt='n';;
4216 esac
4217 rp='Use the newer interpreter-based ithreads?'
4218 . ./myread
4219 case "$ans" in
4220 y|Y) val="$define" ;;
4221 *) val="$undef" ;;
4222 esac
4223 set useithreads
4224 eval $setvar
4225 ;;
4226 *)
4227 useithreads="$undef"
4228 ;;
4229 esac
4230
4231fi
96056487 4232
f3f1a2d8
MB
4233if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4234 cat >&4 <<EOF
4235***
4236*** To build with ithreads you must also use the PerlIO layer.
4237*** Cannot continue, aborting.
4238***
4239EOF
4240 exit 1
4241fi
4242
4243case "$d_oldpthreads" in
4244'') : Configure tests would be welcome here. For now, assume undef.
4245 val="$undef" ;;
4246*) val="$d_oldpthreads" ;;
4247esac
4248set d_oldpthreads
4249eval $setvar
4250
4251
4252: Look for a hint-file generated 'call-back-unit'. If the
4253: user has specified that a threading perl is to be built,
4254: we may need to set or change some other defaults.
4255if $test -f usethreads.cbu; then
4256 echo "Your platform has some specific hints regarding threaded builds, using them..."
4257 . ./usethreads.cbu
4258else
4259 case "$usethreads" in
4260 "$define"|true|[yY]*)
4261 $cat <<EOM
4262(Your platform does not have any specific hints for threaded builds.
4263 Assuming POSIX threads, then.)
4264EOM
4265 ;;
4266 esac
4267fi
4268
4269cat <<EOM
4270
4271Perl can be built so that multiple Perl interpreters can coexist
4272within the same Perl executable.
4273EOM
4274
4275case "$useithreads" in
4276$define)
4277 cat <<EOM
4278This multiple interpreter support is required for interpreter-based threads.
4279EOM
4280 val="$define"
4281 ;;
4282*) case "$usemultiplicity" in
4283 $define|true|[yY]*) dflt='y';;
4284 *) dflt='n';;
4285 esac
4286 echo " "
4287 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4288 rp='Build Perl for multiplicity?'
4289 . ./myread
4290 case "$ans" in
4291 y|Y) val="$define" ;;
4292 *) val="$undef" ;;
4293 esac
4294 ;;
4295esac
4296set usemultiplicity
4297eval $setvar
4298
4299
4300case "$usemorebits" in
4301"$define"|true|[yY]*)
4302 use64bitint="$define"
4303 uselongdouble="$define"
4304 usemorebits="$define"
4305 ;;
4306*) usemorebits="$undef"
4307 ;;
4308esac
4309
4310: make some quick guesses about what we are up against
4311echo " "
4312$echo $n "Hmm... $c"
4313echo exit 1 >bsd
4314echo exit 1 >usg
4315echo exit 1 >v7
4316echo exit 1 >osf1
4317echo exit 1 >eunice
4318echo exit 1 >xenix
4319echo exit 1 >venix
4320echo exit 1 >os2
4321d_bsd="$undef"
4322$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4323if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
e5e20432
JH
4324then
4325 echo "Looks kind of like an OSF/1 system, but we'll see..."
4326 echo exit 0 >osf1
381aa1ff 4327elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
4328 xxx=`./loc addbib blurfl $pth`
4329 if $test -f $xxx; then
4330 echo "Looks kind of like a USG system with BSD features, but we'll see..."
4331 echo exit 0 >bsd
4332 echo exit 0 >usg
4333 else
4334 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4335 echo "Looks kind of like an extended USG system, but we'll see..."
4336 else
4337 echo "Looks kind of like a USG system, but we'll see..."
4338 fi
4339 echo exit 0 >usg
4340 fi
4341elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4342 echo "Looks kind of like a BSD system, but we'll see..."
4343 d_bsd="$define"
4344 echo exit 0 >bsd
4345else
4346 echo "Looks kind of like a Version 7 system, but we'll see..."
4347 echo exit 0 >v7
4348fi
4349case "$eunicefix" in
4350*unixtovms*)
4351 $cat <<'EOI'
4352There is, however, a strange, musty smell in the air that reminds me of
4353something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4354EOI
4355 echo exit 0 >eunice
4356 d_eunice="$define"
4357: it so happens the Eunice I know will not run shell scripts in Unix format
4358 ;;
4359*)
4360 echo " "
4361 echo "Congratulations. You aren't running Eunice."
4362 d_eunice="$undef"
4363 ;;
4364esac
4365: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
4366: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4367: semicolon as a patch separator
e5e20432
JH
4368case "$p_" in
4369:) ;;
4370*)
4371 $cat <<'EOI'
4372I have the feeling something is not exactly right, however...don't tell me...
4373lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 4374(Or you may be running DOS with DJGPP.)
e5e20432
JH
4375EOI
4376 echo exit 0 >os2
4377 ;;
4378esac
4379if test -f /xenix; then
4380 echo "Actually, this looks more like a XENIX system..."
4381 echo exit 0 >xenix
4382 d_xenix="$define"
4383else
4384 echo " "
4385 echo "It's not Xenix..."
4386 d_xenix="$undef"
4387fi
4388chmod +x xenix
4389$eunicefix xenix
4390if test -f /venix; then
4391 echo "Actually, this looks more like a VENIX system..."
4392 echo exit 0 >venix
4393else
4394 echo " "
4395 if ./xenix; then
4396 : null
4397 else
4398 echo "Nor is it Venix..."
4399 fi
4400fi
4401chmod +x bsd usg v7 osf1 eunice xenix venix os2
4402$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4403$rm -f foo
4404
5869b1f1
JH
4405case "$cc" in
4406'') dflt=cc;;
4407*) dflt="$cc";;
4408esac
4409rp="Use which C compiler?"
4410. ./myread
4411cc="$ans"
6b769f8f
RB
4412
4413: See if they have not cc but they do have gcc
4414. ./trygcc
e5e20432
JH
4415: Look for a hint-file generated 'call-back-unit'. Now that the
4416: user has specified the compiler, we may need to set or change some
4417: other defaults.
4418if $test -f cc.cbu; then
4419 . ./cc.cbu
4420fi
2573c5f9 4421. ./checkcc
8a27cf78 4422
e5e20432
JH
4423echo " "
4424echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 4425$cat >try.c <<EOM
e5e20432
JH
4426#include <stdio.h>
4427int main() {
7686528e 4428#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
e5e20432
JH
4429#ifdef __VERSION__
4430 printf("%s\n", __VERSION__);
4431#else
4432 printf("%s\n", "1");
4433#endif
4434#endif
073b6de5 4435 return(0);
e5e20432
JH
4436}
4437EOM
5440bc8e
JH
4438if $cc -o try $ccflags $ldflags try.c; then
4439 gccversion=`$run ./try`
f3f1a2d8
MB
4440 case "$gccversion" in
4441 '') echo "You are not using GNU cc." ;;
4442 *) echo "You are using GNU cc $gccversion."
4443 ccname=gcc
4444 ;;
4445 esac
4446else
4447 echo " "
4448 echo "*** WHOA THERE!!! ***" >&4
4449 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
4450 case "$knowitall" in
4451 '')
4452 echo " You'd better start hunting for one and let me know about it." >&4
4453 exit 1
2304df62
AD
4454 ;;
4455 esac
f3f1a2d8
MB
4456fi
4457$rm -f try try.*
4458case "$gccversion" in
44591*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4460esac
4461case "$gccversion" in
4462'') gccosandvers='' ;;
4463*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4464 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4465 gccshortvers=''
4466 case "$gccosandvers" in
4467 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4468 $osname$osvers) ;; # looking good
4469 $osname*) cat <<EOM >&4
4470
4471*** WHOA THERE!!! ***
4472
4473 Your gcc has not been compiled for the exact release of
4474 your operating system ($gccosandvers versus $osname$osvers).
4475
4476 In general it is a good idea to keep gcc synchronized with
4477 the operating system because otherwise serious problems
4478 may ensue when trying to compile software, like Perl.
4479
4480 I'm trying to be optimistic here, though, and will continue.
4481 If later during the configuration and build icky compilation
4482 problems appear (headerfile conflicts being the most common
4483 manifestation), I suggest reinstalling the gcc to match
4484 your operating system release.
4485
4486EOM
4487 ;;
4488 *) gccosandvers='' ;; # failed to parse, better be silent
4489 esac
4490 ;;
4491esac
4492case "$ccname" in
4493'') ccname="$cc" ;;
4494esac
4495
4496# gcc 3.* complain about adding -Idirectories that they already know about,
4497# so we will take those off from locincpth.
4498case "$gccversion" in
44993*)
4500 echo "main(){}">try.c
4501 for incdir in $locincpth; do
4502 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4503 grep '^c[cp]p*[01]: warning: changing search order '`
4504 if test "X$warn" != X; then
4505 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4506 fi
4507 done
4508 $rm -f try try.*
4509esac
2304df62 4510
bd9b35c9
JH
4511: What should the include directory be ?
4512echo " "
4513$echo $n "Hmm... $c"
4514dflt='/usr/include'
4515incpath=''
4516mips_type=''
4517if $test -f /bin/mips && /bin/mips; then
4518 echo "Looks like a MIPS system..."
4519 $cat >usr.c <<'EOCP'
4520#ifdef SYSTYPE_BSD43
4521/bsd43
4522#endif
4523EOCP
8a27cf78 4524 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4525 dflt='/bsd43/usr/include'
4526 incpath='/bsd43'
4527 mips_type='BSD 4.3'
4528 else
4529 mips_type='System V'
4530 fi
4531 $rm -f usr.c usr.out
4532 echo "and you're compiling with the $mips_type compiler and libraries."
4533 xxx_prompt=y
4534 echo "exit 0" >mips
4535else
4536 echo "Doesn't look like a MIPS system."
4537 xxx_prompt=n
4538 echo "exit 1" >mips
4539fi
4540chmod +x mips
4541$eunicefix mips
4542case "$usrinc" in
4543'') ;;
4544*) dflt="$usrinc";;
4545esac
4546case "$xxx_prompt" in
4547y) fn=d/
4548 echo " "
4549 rp='Where are the include files you want to use?'
4550 . ./getfile
4551 usrinc="$ans"
8e07c86e 4552 ;;
bd9b35c9 4553*) usrinc="$dflt"
8e07c86e
AD
4554 ;;
4555esac
2304df62 4556
96056487
JH
4557: see how we invoke the C preprocessor
4558echo " "
4559echo "Now, how can we feed standard input to your C preprocessor..." >&4
4560cat <<'EOT' >testcpp.c
4561#define ABC abc
4562#define XYZ xyz
4563ABC.XYZ
4564EOT
4565cd ..
4566if test ! -f cppstdin; then
4567 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4568 # AIX cc -E doesn't show the absolute headerfile
4569 # locations but we'll cheat by using the -M flag.
4570 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
4571 else
4572 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4573 fi
4574else
4575 echo "Keeping your $hint cppstdin wrapper."
4576fi
4577chmod 755 cppstdin
4578wrapper=`pwd`/cppstdin
4579ok='false'
4580cd UU
4581
4582if $test "X$cppstdin" != "X" && \
4583 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4584 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4585then
4586 echo "You used to use $cppstdin $cppminus so we'll use that again."
4587 case "$cpprun" in
4588 '') echo "But let's see if we can live without a wrapper..." ;;
4589 *)
4590 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4591 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4592 then
4593 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4594 ok='true'
4595 else
4596 echo "(However, $cpprun $cpplast does not work, let's see...)"
4597 fi
4598 ;;
4599 esac
4600else
4601 case "$cppstdin" in
4602 '') ;;
4603 *)
4604 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4605 ;;
4606 esac
4607fi
4608
4609if $ok; then
4610 : nothing
4611elif echo 'Maybe "'"$cc"' -E" will work...'; \
4612 $cc -E <testcpp.c >testcpp.out 2>&1; \
4613 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4614 echo "Yup, it does."
4615 x_cpp="$cc -E"
4616 x_minus='';
4617elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4618 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4619 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4620 echo "Yup, it does."
4621 x_cpp="$cc -E"
4622 x_minus='-';
4623elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4624 $cc -P <testcpp.c >testcpp.out 2>&1; \
4625 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4626 echo "Yipee, that works!"
4627 x_cpp="$cc -P"
4628 x_minus='';
4629elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4630 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4631 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4632 echo "At long last!"
4633 x_cpp="$cc -P"
4634 x_minus='-';
4635elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4636 $cpp <testcpp.c >testcpp.out 2>&1; \
4637 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4638 echo "It works!"
4639 x_cpp="$cpp"
4640 x_minus='';
4641elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4642 $cpp - <testcpp.c >testcpp.out 2>&1; \
4643 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4644 echo "Hooray, it works! I was beginning to wonder."
4645 x_cpp="$cpp"
4646 x_minus='-';
4647elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4648 $wrapper <testcpp.c >testcpp.out 2>&1; \
4649 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4650 x_cpp="$wrapper"
4651 x_minus=''
4652 echo "Eureka!"
4653else
4654 dflt=''
4655 rp="No dice. I can't find a C preprocessor. Name one:"
4656 . ./myread
4657 x_cpp="$ans"
4658 x_minus=''
4659 $x_cpp <testcpp.c >testcpp.out 2>&1
4660 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4661 echo "OK, that will do." >&4
4662 else
4663echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4664 exit 1
4665 fi
4666fi
4667
4668case "$ok" in
4669false)
4670 cppstdin="$x_cpp"
4671 cppminus="$x_minus"
4672 cpprun="$x_cpp"
4673 cpplast="$x_minus"
4674 set X $x_cpp
4675 shift
4676 case "$1" in
4677 "$cpp")
4678 echo "Perhaps can we force $cc -E using a wrapper..."
4679 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4680 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4681 then
4682 echo "Yup, we can."
4683 cppstdin="$wrapper"
4684 cppminus='';
4685 else
4686 echo "Nope, we'll have to live without it..."
4687 fi
4688 ;;
4689 esac
4690 case "$cpprun" in
4691 "$wrapper")
4692 cpprun=''
4693 cpplast=''
4694 ;;
4695 esac
4696 ;;
4697esac
4698
4699case "$cppstdin" in
4700"$wrapper"|'cppstdin') ;;
4701*) $rm -f $wrapper;;
4702esac
4703$rm -f testcpp.c testcpp.out
4704
bd9b35c9
JH
4705: Set private lib path
4706case "$plibpth" in
4707'') if ./mips; then
4708 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4709 fi;;
4710esac
4711case "$libpth" in
4712' ') dlist='';;
4713'') dlist="$loclibpth $plibpth $glibpth";;
4714*) dlist="$libpth";;
4715esac
4716
4717: Now check and see which directories actually exist, avoiding duplicates
4718libpth=''
4719for xxx in $dlist
4720do
4721 if $test -d $xxx; then
4722 case " $libpth " in
4723 *" $xxx "*) ;;
4724 *) libpth="$libpth $xxx";;
4725 esac
4726 fi
4727done
4728$cat <<'EOM'
4729
4730Some systems have incompatible or broken versions of libraries. Among
4731the directories listed in the question below, please remove any you
4732know not to be holding relevant libraries, and add any that are needed.
4733Say "none" for none.
8e07c86e
AD
4734
4735EOM
bd9b35c9
JH
4736case "$libpth" in
4737'') dflt='none';;
8e07c86e 4738*)
bd9b35c9
JH
4739 set X $libpth
4740 shift
4741 dflt=${1+"$@"}
8e07c86e 4742 ;;
a0d0e21e 4743esac
bd9b35c9
JH
4744rp="Directories to use for library searches?"
4745. ./myread
4746case "$ans" in
4747none) libpth=' ';;
4748*) libpth="$ans";;
4749esac
a0d0e21e 4750
bd9b35c9
JH
4751: compute shared library extension
4752case "$so" in
4753'')
4754 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4755 dflt='sl'
dd4e71fd 4756 else
bd9b35c9 4757 dflt='so'
dd4e71fd
JH
4758 fi
4759 ;;
bd9b35c9 4760*) dflt="$so";;
dd4e71fd 4761esac
dd4e71fd
JH
4762$cat <<EOM
4763
bd9b35c9 4764On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4765you want to suppress searching of shared libraries for the remainder
bd9b35c9 4766of this configuration.
dd4e71fd
JH
4767
4768EOM
bd9b35c9
JH
4769rp='What is the file extension used for shared libraries?'
4770. ./myread
4771so="$ans"
dd4e71fd 4772
bd9b35c9
JH
4773: Define several unixisms.
4774: Hints files or command line option can be used to override them.
4775: The convoluted testing is in case hints files set either the old
4776: or the new name.
4777case "$_exe" in
4778'') case "$exe_ext" in
1fef16b3 4779 '') ;;
bd9b35c9 4780 *) _exe="$exe_ext" ;;
dd4e71fd 4781 esac
bd9b35c9 4782 ;;
bfb7748a 4783esac
bd9b35c9
JH
4784case "$_a" in
4785'') case "$lib_ext" in
4786 '') _a='.a';;
4787 *) _a="$lib_ext" ;;
dd4e71fd
JH
4788 esac
4789 ;;
dd4e71fd 4790esac
bd9b35c9
JH
4791case "$_o" in
4792'') case "$obj_ext" in
4793 '') _o='.o';;
4794 *) _o="$obj_ext";;
4795 esac
4796 ;;
4797esac
4798case "$p_" in
4799'') case "$path_sep" in
4800 '') p_=':';;
4801 *) p_="$path_sep";;
4802 esac
4803 ;;
4804esac
4805exe_ext=$_exe
4806lib_ext=$_a
4807obj_ext=$_o
4808path_sep=$p_
dd4e71fd 4809
b4eb6b3d
JH
4810: Which makefile gets called first. This is used by make depend.
4811case "$firstmakefile" in
4812'') firstmakefile='makefile';;
4633a7c4 4813esac
4633a7c4 4814
1f603089
JH
4815case "$ccflags" in
4816*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4817esac
4818
4819case "$uselongdouble" in
4820$define|true|[yY]*) dflt='y';;
4821*) dflt='n';;
4822esac
4823cat <<EOM
4824
4825Perl can be built to take advantage of long doubles which
4826(if available) may give more accuracy and range for floating point numbers.
4827
4828If this doesn't make any sense to you, just accept the default '$dflt'.
4829EOM
4830rp='Try to use long doubles if available?'
4831. ./myread
4832case "$ans" in
4833y|Y) val="$define" ;;
4834*) val="$undef" ;;
4835esac
4836set uselongdouble
4837eval $setvar
4838
4839case "$uselongdouble" in
4840true|[yY]*) uselongdouble="$define" ;;
4841esac
4842
1f603089
JH
4843: Look for a hint-file generated 'call-back-unit'. If the
4844: user has specified that long doubles should be used,
4845: we may need to set or change some other defaults.
9da7673b
MB
4846if $test -f uselongdouble.cbu; then
4847 echo "Your platform has some specific hints regarding long doubles, using them..."
4848 . ./uselongdouble.cbu
4849else
4850 case "$uselongdouble" in
4851 $define)
1f603089 4852 $cat <<EOM
9da7673b 4853(Your platform does not have any specific hints for long doubles.)
1f603089 4854EOM
1f603089 4855 ;;
9da7673b
MB
4856 esac
4857fi
1f603089 4858
bd9b35c9
JH
4859: Looking for optional libraries
4860echo " "
4861echo "Checking for optional libraries..." >&4
4862case "$libs" in
4863' '|'') dflt='';;
4864*) dflt="$libs";;
4865esac
4866case "$libswanted" in
4867'') libswanted='c_s';;
4868esac
4869case "$usesocks" in
923fc586 4870"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4871esac
68435ea7
JH
4872libsfound=''
4873libsfiles=''
4874libsdirs=''
13b3f787
JH
4875libspath=''
4876for thisdir in $libpth $xlibpth; do
4877 test -d $thisdir && libspath="$libspath $thisdir"
4878done
bd9b35c9 4879for thislib in $libswanted; do
13b3f787 4880 for thisdir in $libspath; do
f7dd4e7f
JH
4881 xxx=''
4882 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4883 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4884 $test -f "$xxx" && eval $libscheck
4885 $test -f "$xxx" && libstyle=shared
4886 fi
4887 if test ! -f "$xxx"; then
4888 xxx=$thisdir/lib$thislib.$so
4889 $test -f "$xxx" && eval $libscheck
4890 $test -f "$xxx" && libstyle=shared
4891 fi
4892 if test ! -f "$xxx"; then
4893 xxx=$thisdir/lib$thislib$_a
4894 $test -f "$xxx" && eval $libscheck
4895 $test -f "$xxx" && libstyle=static
4896 fi
4897 if test ! -f "$xxx"; then
4898 xxx=$thisdir/$thislib$_a
4899 $test -f "$xxx" && eval $libscheck
4900 $test -f "$xxx" && libstyle=static
4901 fi
4902 if test ! -f "$xxx"; then
4903 xxx=$thisdir/lib${thislib}_s$_a
4904 $test -f "$xxx" && eval $libscheck
4905 $test -f "$xxx" && libstyle=static
09ea5ba9 4906 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4907 fi
4908 if test ! -f "$xxx"; then
4909 xxx=$thisdir/Slib$thislib$_a
4910 $test -f "$xxx" && eval $libscheck
4911 $test -f "$xxx" && libstyle=static
4912 fi
4913 if $test -f "$xxx"; then
43999f95 4914 case "$libstyle" in
f7dd4e7f
JH
4915 shared) echo "Found -l$thislib (shared)." ;;
4916 static) echo "Found -l$thislib." ;;
4917 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4918 esac
bd9b35c9
JH
4919 case " $dflt " in
4920 *"-l$thislib "*);;
f7dd4e7f 4921 *) dflt="$dflt -l$thislib"
43999f95
JH
4922 libsfound="$libsfound $xxx"
4923 yyy=`basename $xxx`
4924 libsfiles="$libsfiles $yyy"
1e127011 4925 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4926 case " $libsdirs " in
4927 *" $yyy "*) ;;
4928 *) libsdirs="$libsdirs $yyy" ;;
4929 esac
4930 ;;
bd9b35c9 4931 esac
f7dd4e7f
JH
4932 break
4933 fi
4934 done
4935 if $test ! -f "$xxx"; then
4936 echo "No -l$thislib."
bd9b35c9
JH
4937 fi
4938done
4939set X $dflt
4940shift
4941dflt="$*"
4942case "$libs" in
4943'') dflt="$dflt";;
4944*) dflt="$libs";;
4945esac
4946case "$dflt" in
4947' '|'') dflt='none';;
4948esac
4633a7c4 4949
bd9b35c9 4950$cat <<EOM
4633a7c4 4951
bd9b35c9
JH
4952In order to compile $package on your machine, a number of libraries
4953are usually needed. Include any other special libraries here as well.
4954Say "none" for none. The default list is almost always right.
8e07c86e 4955EOM
8e07c86e 4956
bd9b35c9
JH
4957echo " "
4958rp="What libraries to use?"
4959. ./myread
4960case "$ans" in
4961none) libs=' ';;
4962*) libs="$ans";;
4963esac
d71b2b6b 4964
bd9b35c9
JH
4965: determine optimization, if desired, or use for debug flag also
4966case "$optimize" in
4967' '|$undef) dflt='none';;
4968'') dflt='-O';;
4969*) dflt="$optimize";;
4970esac
4971$cat <<EOH
d71b2b6b 4972
bd9b35c9
JH
4973By default, $package compiles with the -O flag to use the optimizer.
4974Alternately, you might want to use the symbolic debugger, which uses
4975the -g flag (on traditional Unix systems). Either flag can be
4976specified here. To use neither flag, specify the word "none".
d71b2b6b 4977
bd9b35c9
JH
4978EOH
4979rp="What optimizer/debugger flag should be used?"
4980. ./myread
4981optimize="$ans"
4982case "$optimize" in
4983'none') optimize=" ";;
4984esac
4985
eaf812ae
MB
4986: Check what DEBUGGING is required from the command line
4987: -DEBUGGING or -DDEBUGGING or
4988: -DEBUGGING=both = -g + -DDEBUGGING
4989: -DEBUGGING=-g or -Doptimize=-g = -g
4990: -DEBUGGING=none or -UDEBUGGING =
4991: -DEBUGGING=old or -DEBUGGING=default = ? $optimize
4992case "$EBUGGING" in
4993'') ;;
4994*) DEBUGGING=$EBUGGING ;;
4995esac
4996
4997case "$DEBUGGING" in
5a7c70d6 4998-g|both|$define)
eaf812ae
MB
4999 case "$optimize" in
5000 *-g*) ;;
5001 *) optimize="$optimize -g" ;;
5002 esac ;;
5003none|$undef)
5004 case "$optimize" in
5005 *-g*) set `echo "X $optimize " | sed 's/ -g / /'`
5006 shift
5007 optimize="$*"
5008 ;;
5009 esac ;;
5010esac
5011
bd9b35c9 5012dflt=''
eaf812ae
MB
5013case "$DEBUGGING" in
5014both|$define) dflt='-DDEBUGGING'
5015esac
5016
bd9b35c9
JH
5017: We will not override a previous value, but we might want to
5018: augment a hint file
5019case "$hint" in
5020default|recommended)
5021 case "$gccversion" in
eaf812ae 5022 1*) dflt="$dflt -fpcc-struct-return" ;;
d71b2b6b 5023 esac
eaf812ae
MB
5024 case "$optimize:$DEBUGGING" in
5025 *-g*:old) dflt="$dflt -DDEBUGGING";;
d71b2b6b 5026 esac
bd9b35c9
JH
5027 case "$gccversion" in
5028 2*) if test -d /etc/conf/kconfig.d &&
5029 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5030 then
00e89ad4 5031 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
5032 dflt="$dflt -posix"
5033 fi
f0d04425 5034 ;;
bd9b35c9
JH
5035 esac
5036 case "$gccversion" in
5037 1*) ;;
5038 2.[0-8]*) ;;
5039 ?*) echo " "
5040 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
5041 echo 'int main(void) { return 0; }' > gcctest.c
5042 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
5043 echo "Yes, it does." 2>&1
5044 case "$ccflags" in
00e89ad4 5045 *strict-aliasing*)
bd9b35c9
JH
5046 echo "Leaving current flags $ccflags alone." 2>&1
5047 ;;
5048 *) dflt="$dflt -fno-strict-aliasing" ;;
5049 esac
5050 else
5051 echo "Nope, it doesn't, but that's ok." 2>&1
5052 fi
f0d04425 5053 ;;
e5e20432 5054 esac
00e89ad4
AD
5055 # For gcc, adding -pipe speeds up compilations for some, but apparently
5056 # some assemblers can't read from stdin. (It also slows down compilations
5057 # in other cases, but those are apparently rarer these days.) AD 5/2004.
5058 case "$gccversion" in
5059 ?*) echo " "
5060 echo "Checking if your compiler accepts -pipe" 2>&1
5061 echo 'int main(void) { return 0; }' > gcctest.c
6347b5be 5062 if $cc -pipe -o gcctest gcctest.c; then
00e89ad4
AD
5063 echo "Yes, it does." 2>&1
5064 case "$ccflags" in
5065 *-pipe*)
5066 echo "Leaving current flags $ccflags alone." 2>&1
5067 ;;
5068 *) dflt="$dflt -pipe" ;;
5069 esac
5070 else
5071 echo "Nope, it doesn't, but that's ok." 2>&1
5072 fi
5073 ;;
5074 esac
e5e20432
JH
5075 ;;
5076esac
5077
bd9b35c9
JH
5078case "$mips_type" in
5079*BSD*|'') inclwanted="$locincpth $usrinc";;
5080*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5081esac
5082for thisincl in $inclwanted; do
5083 if $test -d $thisincl; then
5084 if $test x$thisincl != x$usrinc; then
5085 case "$dflt" in
00e89ad4
AD
5086 *" -I$thisincl "*);;
5087 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
5088 esac
5089 fi
5090 fi
5091done
40a7a20a 5092
bd9b35c9
JH
5093inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5094 xxx=true;
5095elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5096 xxx=true;
5097else
5098 xxx=false;
5099fi;
5100if $xxx; then
5101 case "$dflt" in
5102 *$2*);;
5103 *) dflt="$dflt -D$2";;
5104 esac;
5105fi'
40a7a20a 5106
bd9b35c9 5107set signal.h LANGUAGE_C; eval $inctest
40a7a20a 5108
bd9b35c9
JH
5109case "$usesocks" in
5110$define)
5111 ccflags="$ccflags -DSOCKS"
5112 ;;
5113esac
40a7a20a 5114
bd9b35c9
JH
5115case "$hint" in
5116default|recommended) dflt="$ccflags $dflt" ;;
5117*) dflt="$ccflags";;
5118esac
40a7a20a 5119
bd9b35c9
JH
5120case "$dflt" in
5121''|' ') dflt=none;;
5122esac
422af00a 5123
bd9b35c9 5124$cat <<EOH
40a7a20a 5125
bd9b35c9
JH
5126Your C compiler may want other flags. For this question you should include
5127-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5128but you should NOT include libraries or ld flags like -lwhatever. If you
5129want $package to honor its debug switch, you should include -DDEBUGGING here.
5130Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 5131
bd9b35c9 5132To use no flags, specify the word "none".
40a7a20a 5133
bd9b35c9
JH
5134EOH
5135set X $dflt
5136shift
5137dflt=${1+"$@"}
5138rp="Any additional cc flags?"
5139. ./myread
5140case "$ans" in
5141none) ccflags='';;
5142*) ccflags="$ans";;
5143esac
8e07c86e 5144
bd9b35c9 5145: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
5146case "$cppflags" in
5147'') cppflags="$ccflags" ;;
5148*) cppflags="$cppflags $ccflags" ;;
5149esac
bd9b35c9
JH
5150case "$gccversion" in
51511*) cppflags="$cppflags -D__GNUC__"
4633a7c4 5152esac
bd9b35c9
JH
5153case "$mips_type" in
5154'');;
5155*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5156esac
5157case "$cppflags" in
5158'');;
5159*)
5160 echo " "
5161 echo "Let me guess what the preprocessor flags are..." >&4
5162 set X $cppflags
5163 shift
5164 cppflags=''
5165 $cat >cpp.c <<'EOM'
5166#define BLURFL foo
8e07c86e 5167
bd9b35c9
JH
5168BLURFL xx LFRULB
5169EOM
5170 previous=''
5171 for flag in $*
5172 do
5173 case "$flag" in
5174 -*) ftry="$flag";;
5175 *) ftry="$previous $flag";;
5176 esac
5177 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5178 >cpp1.out 2>/dev/null && \
5179 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5180 >cpp2.out 2>/dev/null && \
5181 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5182 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5183 then
5184 cppflags="$cppflags $ftry"
5185 previous=''
5186 else
5187 previous="$flag"
5188 fi
5189 done
5190 set X $cppflags
5191 shift
5192 cppflags=${1+"$@"}
5193 case "$cppflags" in
5194 *-*) echo "They appear to be: $cppflags";;
5195 esac
5196 $rm -f cpp.c cpp?.out
2afac517 5197 ;;
5198esac
8e07c86e 5199
bd9b35c9
JH
5200: flags used in final linking phase
5201case "$ldflags" in
5202'') if ./venix; then
5203 dflt='-i -z'
10a23457 5204 else
bd9b35c9 5205 dflt=''
10a23457 5206 fi
bd9b35c9
JH
5207 case "$ccflags" in
5208 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 5209 esac
bd9b35c9
JH
5210 ;;
5211*) dflt="$ldflags";;
5212esac
5213
5214: Try to guess additional flags to pick up local libraries.
5215for thislibdir in $libpth; do
5216 case " $loclibpth " in
5217 *" $thislibdir "*)
00e89ad4 5218 case "$dflt " in
bd9b35c9
JH
5219 *"-L$thislibdir "*) ;;
5220 *) dflt="$dflt -L$thislibdir" ;;
5221 esac
c4f23d77
AD
5222 ;;
5223 esac
bd9b35c9 5224done
c4f23d77 5225
bd9b35c9
JH
5226case "$dflt" in
5227'') dflt='none' ;;
5228esac
c4f23d77 5229
bd9b35c9
JH
5230$cat <<EOH
5231
5232Your C linker may need flags. For this question you should
5233include -L/whatever and any other flags used by the C linker, but you
5234should NOT include libraries like -lwhatever.
5235
5236Make sure you include the appropriate -L/path flags if your C linker
5237does not normally search all of the directories you specified above,
5238namely
5239 $libpth
5240To use no flags, specify the word "none".
5241
5242EOH
5243
5244rp="Any additional ld flags (NOT including libraries)?"
5245. ./myread
5246case "$ans" in
5247none) ldflags='';;
5248*) ldflags="$ans";;
5249esac
5250rmlist="$rmlist pdp11"
5251
5252: coherency check
5253echo " "
5254echo "Checking your choice of C compiler and flags for coherency..." >&4
5255$cat > try.c <<'EOF'
5256#include <stdio.h>
55954f19 5257int main() { printf("Ok\n"); return(0); }
bd9b35c9 5258EOF
7a282f6d 5259set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
5260shift
5261$cat >try.msg <<'EOM'
5262I've tried to compile and run the following simple program:
5263
5264EOM
5265$cat try.c >> try.msg
5266
5267$cat >> try.msg <<EOM
5268
5269I used the command:
5270
5271 $*
5440bc8e 5272 $run ./try
bd9b35c9
JH
5273
5274and I got the following output:
5275
5276EOM
5277dflt=y
73614538 5278if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5440bc8e
JH
5279 if $sh -c "$run ./try" >>try.msg 2>&1; then
5280 xxx=`$run ./try`
bd9b35c9
JH
5281 case "$xxx" in
5282 "Ok") dflt=n ;;
5283 *) echo 'The program compiled OK, but produced no output.' >> try.msg
5284 case " $libs " in
5285 *" -lsfio "*)
5286 cat >> try.msg <<'EOQS'
5287If $libs contains -lsfio, and sfio is mis-configured, then it
5288sometimes (apparently) runs and exits with a 0 status, but with no
5289output! It may have to do with sfio's use of _exit vs. exit.
5290
5291EOQS
5292 rp="You have a big problem. Shall I abort Configure"
5293 dflt=y
5294 ;;
5295 esac
5296 ;;
5297 esac
5298 else
5299 echo "The program compiled OK, but exited with status $?." >>try.msg
5300 rp="You have a problem. Shall I abort Configure"
5301 dflt=y
5302 fi
5303else
5304 echo "I can't compile the test program." >>try.msg
5305 rp="You have a BIG problem. Shall I abort Configure"
5306 dflt=y
5307fi
5308case "$dflt" in
5309y)
5310 $cat try.msg >&4
5311 case "$knowitall" in
5312 '')
5313 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5314 ;;
bd9b35c9 5315 *) dflt=n;;
c4f23d77 5316 esac
bd9b35c9
JH
5317 echo " "
5318 . ./myread
5319 case "$ans" in
5320 n*|N*) ;;
5321 *) echo "Ok. Stopping Configure." >&4
5322 exit 1
c4f23d77
AD
5323 ;;
5324 esac
5325 ;;
bd9b35c9 5326n) echo "OK, that should do.";;
c4f23d77 5327esac
bd9b35c9 5328$rm -f try try.* core
c4f23d77 5329
bd9b35c9
JH
5330: define a shorthand compile call
5331compile='
5332mc_file=$1;
5333shift;
08413ebc 5334$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5335: define a shorthand compile call for compilations that should be ok.
5336compile_ok='
5337mc_file=$1;
5338shift;
7a282f6d 5339$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5340
8dfa8df9
JH
5341: determine filename position in cpp output
5342echo " "
5343echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5344case "$osname" in
5345vos) testaccess=-e ;;
5346*) testaccess=-r ;;
5347esac
8dfa8df9
JH
5348echo '#include <stdio.h>' > foo.c
5349$cat >fieldn <<EOF
5350$startsh
5351$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5352$grep '^[ ]*#.*stdio\.h' | \
5353while read cline; do
5354 pos=1
5355 set \$cline
5356 while $test \$# -gt 0; do
a5a94ea5 5357 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5358 echo "\$pos"
5359 exit 0
5360 fi
5361 shift
5362 pos=\`expr \$pos + 1\`
5363 done
5364done
5365EOF
5366chmod +x fieldn
5367fieldn=`./fieldn`
5368$rm -f foo.c fieldn
5369case $fieldn in
5370'') pos='???';;
53711) pos=first;;
53722) pos=second;;
53733) pos=third;;
5374*) pos="${fieldn}th";;
5375esac
5376echo "Your cpp writes the filename in the $pos field of the line."
5377
3c728e00
JH
5378case "$osname" in
5379vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5c728af0 5380os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5381*) cppfilter='' ;;
5382esac
8dfa8df9
JH
5383: locate header file
5384$cat >findhdr <<EOF
5385$startsh
5386wanted=\$1
5387name=''
5388for usrincdir in $usrinc
5389do
5390 if test -f \$usrincdir/\$wanted; then
5391 echo "\$usrincdir/\$wanted"
5392 exit 0
5393 fi
5394done
5395awkprg='{ print \$$fieldn }'
5396echo "#include <\$wanted>" > foo\$\$.c
5397$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5398$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5399while read cline; do
5400 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5401 case "\$name" in
5402 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5403 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5404 *) exit 2;;
5405 esac;
5406done;
5407#
5408# status = 0: grep returned 0 lines, case statement not executed
5409# status = 1: headerfile found
5410# status = 2: while loop executed, no headerfile found
5411#
5412status=\$?
5413$rm -f foo\$\$.c;
5414if test \$status -eq 1; then
5415 exit 0;
5416fi
5417exit 1
5418EOF
5419chmod +x findhdr
5420
5421: define an alternate in-header-list? function
5422inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5423cont=true; xxf="echo \"<\$1> found.\" >&4";
5424case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5425*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5426esac;
5427case $# in 4) instead=instead;; *) instead="at last";; esac;
5428while $test "$cont"; do
5429 xxx=`./findhdr $1`
5430 var=$2; eval "was=\$$2";
5431 if $test "$xxx" && $test -r "$xxx";
5432 then eval $xxf;
5433 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5434 cont="";
5435 else eval $xxnf;
5436 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5437 set $yyy; shift; shift; yyy=$@;
5438 case $# in 0) cont="";;
5439 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5440 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5441 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5442 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5443 esac;
5444done;
5445while $test "$yyy";
5446do set $yyy; var=$2; eval "was=\$$2";
5447 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5448 set $yyy; shift; shift; yyy=$@;
5449done'
5450
d1daaddf
JH
5451: see if stdlib is available
5452set stdlib.h i_stdlib
5453eval $inhdr
5454
5455: check for lengths of integral types
5456echo " "
5457case "$intsize" in
5458'')
5459 echo "Checking to see how big your integers are..." >&4
c63dfae1 5460 $cat >try.c <<EOCP
d1daaddf
JH
5461#include <stdio.h>
5462#$i_stdlib I_STDLIB
5463#ifdef I_STDLIB
5464#include <stdlib.h>
5465#endif
5466int main()
5467{
5468 printf("intsize=%d;\n", (int)sizeof(int));
5469 printf("longsize=%d;\n", (int)sizeof(long));
5470 printf("shortsize=%d;\n", (int)sizeof(short));
5471 exit(0);
5472}
5473EOCP
5474 set try
5475 if eval $compile_ok && $run ./try > /dev/null; then
5476 eval `$run ./try`
5477 echo "Your integers are $intsize bytes long."
5478 echo "Your long integers are $longsize bytes long."
5479 echo "Your short integers are $shortsize bytes long."
5480 else
5481 $cat >&4 <<EOM
5482!
5483Help! I can't compile and run the intsize test program: please enlighten me!
5484(This is probably a misconfiguration in your system or libraries, and
5485you really ought to fix it. Still, I'll try anyway.)
5486!
5487EOM
5488 dflt=4
5489 rp="What is the size of an integer (in bytes)?"
5490 . ./myread
5491 intsize="$ans"
5492 dflt=$intsize
5493 rp="What is the size of a long integer (in bytes)?"
5494 . ./myread
5495 longsize="$ans"
5496 dflt=2
5497 rp="What is the size of a short integer (in bytes)?"
5498 . ./myread
5499 shortsize="$ans"
5500 fi
5501 ;;
5502esac
5503$rm -f try try.*
5504
5505: check for long long
5506echo " "
5507echo "Checking to see if you have long long..." >&4
5508echo 'int main() { long long x = 7; return 0; }' > try.c
5509set try
5510if eval $compile; then
5511 val="$define"
5512 echo "You have long long."
5513else
5514 val="$undef"
5515 echo "You do not have long long."
5516fi
5517$rm try.*
5518set d_longlong
5519eval $setvar
5520
5521: check for length of long long
5522case "${d_longlong}${longlongsize}" in
5523$define)
5524 echo " "
5525 echo "Checking to see how big your long longs are..." >&4
5526 $cat >try.c <<'EOCP'
5527#include <stdio.h>
5528int main()
5529{
5530 printf("%d\n", (int)sizeof(long long));
5531 return(0);
5532}
5533EOCP
5534 set try
5535 if eval $compile_ok; then
5536 longlongsize=`$run ./try`
5537 echo "Your long longs are $longlongsize bytes long."
5538 else
5539 dflt='8'
5540 echo " "
5541 echo "(I can't seem to compile the test program. Guessing...)"
5542 rp="What is the size of a long long (in bytes)?"
5543 . ./myread
5544 longlongsize="$ans"
5545 fi
5546 if $test "X$longsize" = "X$longlongsize"; then
5547 echo "(That isn't any different from an ordinary long.)"
5548 fi
5549 ;;
5550esac
5551$rm -f try.* try
5552
8dfa8df9
JH
5553: see if inttypes.h is available
5554: we want a real compile instead of Inhdr because some systems
5555: have an inttypes.h which includes non-existent headers
5556echo " "
5557$cat >try.c <<EOCP
5558#include <inttypes.h>
5559int main() {
5560 static int32_t foo32 = 0x12345678;
5561}
5562EOCP
5563set try
5564if eval $compile; then
5565 echo "<inttypes.h> found." >&4
5566 val="$define"
5567else
5568 echo "<inttypes.h> NOT found." >&4
5569 val="$undef"
5570fi
5571$rm -f try.c try
5572set i_inttypes
5573eval $setvar
5574
5575: check for int64_t
5576echo " "
5577echo "Checking to see if you have int64_t..." >&4
5578$cat >try.c <<EOCP
5579#include <sys/types.h>
5580#$i_inttypes I_INTTYPES
5581#ifdef I_INTTYPES
5582#include <inttypes.h>
5583#endif
5584int main() { int64_t x = 7; }
5585EOCP
5586set try
5587if eval $compile; then
5588 val="$define"
5589 echo "You have int64_t."
5590else
5591 val="$undef"
5592 echo "You do not have int64_t."
5593fi
5594$rm -f try try.*
5595set d_int64_t
5596eval $setvar
5597
5598
5599echo " "
5600echo "Checking which 64-bit integer type we could use..." >&4
5601
5602case "$intsize" in
56038) val=int
5604 set quadtype
5605 eval $setvar
5606 val='"unsigned int"'
5607 set uquadtype
5608 eval $setvar
5609 quadkind=1
5610 ;;
5611*) case "$longsize" in
5612 8) val=long
5613 set quadtype
5614 eval $setvar
5615 val='"unsigned long"'
5616 set uquadtype
5617 eval $setvar
5618 quadkind=2
5619 ;;
5620 *) case "$d_longlong:$longlongsize" in
5621 define:8)
5622 val='"long long"'
5623 set quadtype
5624 eval $setvar
5625 val='"unsigned long long"'
5626 set uquadtype
5627 eval $setvar
5628 quadkind=3
5629 ;;
5630 *) case "$d_int64_t" in
5631 define)
5632 val=int64_t
5633 set quadtype
5634 eval $setvar
5635 val=uint64_t
5636 set uquadtype
5637 eval $setvar
5638 quadkind=4
5639 ;;
5640 esac
5641 ;;
5642 esac
5643 ;;
5644 esac
5645 ;;
5646esac
5647
5648case "$quadtype" in
5649'') echo "Alas, no 64-bit integer types in sight." >&4
5650 d_quad="$undef"
5651 ;;
5652*) echo "We could use '$quadtype' for 64-bit integers." >&4
5653 d_quad="$define"
5654 ;;
5655esac
5656
b4eb6b3d
JH
5657
5658case "$uselonglong" in
5659"$define"|true|[yY]*)
5660 cat <<EOM >&4
5661
5662*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5663EOM
5664 use64bitint="$define"
5665 ;;
5666esac
5667case "$use64bits" in
5668"$define"|true|[yY]*)
5669 cat <<EOM >&4
5670
5671*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5672EOM
5673 use64bitint="$define"
5674 ;;
5675esac
5676case "$use64bitints" in
5677"$define"|true|[yY]*)
5678 cat <<EOM >&4
5679
5680*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5681EOM
5682 use64bitint="$define"
5683 ;;
5684esac
5685case "$use64bitsint" in
5686"$define"|true|[yY]*)
5687 cat <<EOM >&4
5688
5689*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5690EOM
5691 use64bitint="$define"
5692 ;;
5693esac
5694case "$uselonglongs" in
5695"$define"|true|[yY]*)
5696 cat <<EOM >&4
5697
5698*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5699EOM
5700 use64bitint="$define"
5701 ;;
5702esac
5703case "$use64bitsall" in
5704"$define"|true|[yY]*)
5705 cat <<EOM >&4
5706
5707*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5708EOM
5709 use64bitall="$define"
5710 ;;
5711esac
5712
5713case "$ccflags" in
5714*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5715esac
5716case "$use64bitall" in
5717"$define"|true|[yY]*) use64bitint="$define" ;;
5718esac
5719
5720case "$longsize" in
57218) cat <<EOM
5722
5723You have natively 64-bit long integers.
5724EOM
5725 val="$define"
5726 ;;
5727*) case "$use64bitint" in
5728 "$define"|true|[yY]*) dflt='y';;
5729 *) dflt='n';;
5730 esac
8dfa8df9
JH
5731 case "$d_quad" in
5732 "$define") ;;
5733 *) dflt='n' ;;
5734 esac
b4eb6b3d
JH
5735 cat <<EOM
5736
5737Perl can be built to take advantage of 64-bit integer types
5738on some systems. To do so, Configure can be run with -Duse64bitint.
5739Choosing this option will most probably introduce binary incompatibilities.
5740
5741If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5742(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5743EOM
5744 rp='Try to use 64-bit integers, if available?'
5745 . ./myread
5746 case "$ans" in
5747 [yY]*) val="$define" ;;
5748 *) val="$undef" ;;
5749 esac
5750 ;;
5751esac
5752set use64bitint
5753eval $setvar
5754
5755case "$use64bitall" in
5756"$define"|true|[yY]*) dflt='y' ;;
5757*) case "$longsize" in
5758 8) dflt='y' ;;
5759 *) dflt='n' ;;
5760 esac
5761 ;;
5762esac
5763cat <<EOM
5764
5765You may also choose to try maximal 64-bitness. It means using as much
576664-bitness as possible on the platform. This in turn means even more
5767binary incompatibilities. On the other hand, your platform may not
5768have any more 64-bitness available than what you already have chosen.
5769
5770If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5771(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5772EOM
5773rp='Try to use maximal 64-bit support, if available?'
5774. ./myread
5775case "$ans" in
5776[yY]*) val="$define" ;;
5777*) val="$undef" ;;
5778esac
5779set use64bitall
5780eval $setvar
5781case "$use64bitall" in
5782"$define")
5783 case "$use64bitint" in
5784 "$undef")
5785 cat <<EOM
5786
5787Since you have chosen a maximally 64-bit build, I'm also turning on
5788the use of 64-bit integers.
5789EOM
5790 use64bitint="$define" ;;
5791 esac
5792 ;;
5793esac
5794
b4eb6b3d
JH
5795: Look for a hint-file generated 'call-back-unit'. If the
5796: user has specified that a 64-bit perl is to be built,
5797: we may need to set or change some other defaults.
19a100ff 5798if $test -f use64bitint.cbu; then
9da7673b 5799 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
19a100ff
MB
5800 . ./use64bitint.cbu
5801fi
9da7673b
MB
5802case "$use64bitint" in
5803"$define"|true|[yY]*)
b4eb6b3d
JH
5804 case "$longsize" in
5805 4) case "$archname64" in
5806 '') archname64=64int ;;
5807 esac
5808 ;;
5809 esac
5810 ;;
5811esac
5812
b4eb6b3d
JH
5813: Look for a hint-file generated 'call-back-unit'. If the
5814: user has specified that a maximally 64-bit perl is to be built,
5815: we may need to set or change some other defaults.
19a100ff 5816if $test -f use64bitall.cbu; then
9da7673b 5817 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
19a100ff
MB
5818 . ./use64bitall.cbu
5819fi
9da7673b
MB
5820case "$use64bitall" in
5821"$define"|true|[yY]*)
b4eb6b3d
JH
5822 case "$longsize" in
5823 4) case "$archname64" in
5824 ''|64int) archname64=64all ;;
5825 esac
5826 ;;
5827 esac
5828 ;;
5829esac
5830
1911a026
JH
5831case "$d_quad:$use64bitint" in
5832$undef:$define)
5833 cat >&4 <<EOF
5834
5835*** You have chosen to use 64-bit integers,
19a100ff 5836*** but none can be found.
09b58c7b 5837*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
1911a026
JH
5838*** Cannot continue, aborting.
5839
5840EOF
5841 exit 1
5842 ;;
5843esac
5844
36adc09b
JH
5845: check for length of double
5846echo " "
5847case "$doublesize" in
5848'')
5849 echo "Checking to see how big your double precision numbers are..." >&4
5850 $cat >try.c <<EOCP
5851#include <stdio.h>
1911a026
JH
5852#$i_stdlib I_STDLIB
5853#ifdef I_STDLIB
5854#include <stdlib.h>
5855#endif
36adc09b
JH
5856int main()
5857{
5858 printf("%d\n", (int)sizeof(double));
1911a026 5859 exit(0);
36adc09b
JH
5860}
5861EOCP
5862 set try
5863 if eval $compile_ok; then
5864 doublesize=`$run ./try`
5865 echo "Your double is $doublesize bytes long."
5866 else
5867 dflt='8'
5868 echo "(I can't seem to compile the test program. Guessing...)"
5869 rp="What is the size of a double precision number (in bytes)?"
5870 . ./myread
5871 doublesize="$ans"
5872 fi
5873 ;;
5874esac
5875$rm -f try.c try
5876
5877: check for long doubles
5878echo " "
5879echo "Checking to see if you have long double..." >&4
5880echo 'int main() { long double x = 7.0; }' > try.c
5881set try
5882if eval $compile; then
5883 val="$define"
5884 echo "You have long double."
5885else
5886 val="$undef"
5887 echo "You do not have long double."
5888fi
5889$rm try.*
5890set d_longdbl
5891eval $setvar
5892
5893: check for length of long double
5894case "${d_longdbl}${longdblsize}" in
5895$define)
5896 echo " "
5897 echo "Checking to see how big your long doubles are..." >&4
5898 $cat >try.c <<'EOCP'
5899#include <stdio.h>
5900int main()
5901{
5902 printf("%d\n", sizeof(long double));
5903}
5904EOCP
5905 set try
5906 set try
5907 if eval $compile; then
5908 longdblsize=`$run ./try`
5909 echo "Your long doubles are $longdblsize bytes long."
5910 else
5911 dflt='8'
5912 echo " "
5913 echo "(I can't seem to compile the test program. Guessing...)" >&4
5914 rp="What is the size of a long double (in bytes)?"
5915 . ./myread
5916 longdblsize="$ans"
5917 fi
5918 if $test "X$doublesize" = "X$longdblsize"; then
7ad90562
AD
5919 echo "That isn't any different from an ordinary double."
5920 echo "I'll keep your setting anyway, but you may see some"
5921 echo "harmless compilation warnings."
36adc09b
JH
5922 fi
5923 ;;
5924esac
5925$rm -f try.* try
5926
89ce900e 5927: determine the architecture name
b4eb6b3d 5928echo " "
89ce900e
JH
5929if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5930 tarch=`arch`"-$osname"
5931elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5932 if uname -m > tmparch 2>&1 ; then
5933 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5934 -e 's/$/'"-$osname/" tmparch`
5935 else
5936 tarch="$osname"
5937 fi
5938 $rm -f tmparch
b4eb6b3d 5939else
89ce900e 5940 tarch="$osname"
b4eb6b3d 5941fi
89ce900e
JH
5942case "$myarchname" in
5943''|"$tarch") ;;
5944*)
5945 echo "(Your architecture name used to be $myarchname.)"
5946 archname=''
5947 ;;
5948esac
5949case "$targetarch" in
5950'') ;;
5951*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5952esac
5953myarchname="$tarch"
5954case "$archname" in
5955'') dflt="$tarch";;
5956*) dflt="$archname";;
5957esac
5958rp='What is your architecture name'
5959. ./myread
5960archname="$ans"
5961case "$usethreads" in
5962$define)
5963 echo "Threads selected." >&4
5964 case "$archname" in
5965 *-thread*) echo "...and architecture name already has -thread." >&4
5966 ;;
5967 *) archname="$archname-thread"
5968 echo "...setting architecture name to $archname." >&4
5969 ;;
5970 esac
5971 ;;
5972esac
5973case "$usemultiplicity" in
5974$define)
5975 echo "Multiplicity selected." >&4
5976 case "$archname" in
5977 *-multi*) echo "...and architecture name already has -multi." >&4
5978 ;;
5979 *) archname="$archname-multi"
5980 echo "...setting architecture name to $archname." >&4
5981 ;;
5982 esac
5983 ;;
5984esac
5985case "$use64bitint$use64bitall" in
5986*"$define"*)
5987 case "$archname64" in
5988 '')
5989 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
bd9b35c9 5990 ;;
89ce900e
JH
5991 *)
5992 case "$use64bitint" in
5993 "$define") echo "64 bit integers selected." >&4 ;;
5994 esac
5995 case "$use64bitall" in
5996 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5997 esac
5998 case "$archname" in
5999 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6000 ;;
6001 *) archname="$archname-$archname64"
6002 echo "...setting architecture name to $archname." >&4
6003 ;;
6004 esac
c1a7f87b
JH
6005 ;;
6006 esac
89ce900e
JH
6007esac
6008case "$uselongdouble" in
6009$define)
6010 echo "Long doubles selected." >&4
6011 case "$longdblsize" in
6012 $doublesize)
6013 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6014 ;;
6015 *)
6016 case "$archname" in
6017 *-ld*) echo "...and architecture name already has -ld." >&4
6018 ;;
6019 *) archname="$archname-ld"
6020 echo "...setting architecture name to $archname." >&4
6021 ;;
6022 esac
bd9b35c9
JH
6023 ;;
6024 esac
bd9b35c9 6025 ;;
89ce900e
JH
6026esac
6027case "$useperlio" in
6028$define)
6029 echo "Perlio selected." >&4
6030 ;;
bd9b35c9 6031*)
89ce900e
JH
6032 echo "Perlio not selected, using stdio." >&4
6033 case "$archname" in
6034 *-stdio*) echo "...and architecture name already has -stdio." >&4
6035 ;;
6036 *) archname="$archname-stdio"
6037 echo "...setting architecture name to $archname." >&4
6038 ;;
6039 esac
bd9b35c9
JH
6040 ;;
6041esac
d2e0c6f7
JH
6042if $test -f archname.cbu; then
6043 echo "Your platform has some specific hints for architecture name, using them..."
6044 . ./archname.cbu
6045fi
bd9b35c9 6046
b4eb6b3d
JH
6047: set the prefixit variable, to compute a suitable default value
6048prefixit='case "$3" in
6049""|none)
6050 case "$oldprefix" in
6051 "") eval "$1=\"\$$2\"";;
6052 *)
6053 case "$3" in
6054 "") eval "$1=";;
6055 none)
6056 eval "tp=\"\$$2\"";
6057 case "$tp" in
6058 ""|" ") eval "$1=\"\$$2\"";;
6059 *) eval "$1=";;
6060 esac;;
6061 esac;;
6062 esac;;
6063*)
6064 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6065 case "$tp" in
6066 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6067 /*-$oldprefix/*|\~*-$oldprefix/*)
6068 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6069 *) eval "$1=\"\$$2\"";;
6070 esac;;
6071esac'
6072
f3f1a2d8
MB
6073: determine installation style
6074: For now, try to deduce it from prefix unless it is already set.
6075: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6076case "$installstyle" in
6077'') case "$prefix" in
6078 *perl*) dflt='lib';;
6079 *) dflt='lib/perl5' ;;
6080 esac
6081 ;;
6082*) dflt="$installstyle" ;;
4d20abad 6083esac
f3f1a2d8
MB
6084: Probably not worth prompting for this since we prompt for all
6085: the directories individually, and the prompt would be too long and
6086: confusing anyway.
6087installstyle=$dflt
4d20abad 6088
eaf812ae
MB
6089: determine where public executables go
6090echo " "
6091set dflt bin bin
6092eval $prefixit
6093fn=d~
6094rp='Pathname where the public executables will reside?'
6095. ./getfile
6096if $test "X$ansexp" != "X$binexp"; then
6097 installbin=''
6098fi
6099prefixvar=bin
6100: XXX Bug? -- ignores Configure -Dinstallprefix setting.
d0e36aa9 6101: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
a2d23ec2 6102: this via initialinstalllocation
eaf812ae
MB
6103. ./setprefixvar
6104
6105case "$userelocatableinc" in
6106$define|true|[yY]*) dflt='y' ;;
6107*) dflt='n' ;;
6108esac
6109cat <<EOM
6110
6111Would you like to build Perl so that the installation is relocatable, so that
6112library paths in @INC are determined relative to the path of the perl binary?
6113This is not advised for system Perl installs, or if you need to run setid
6114scripts or scripts under taint mode.
6115
6116If this doesn't make any sense to you, just accept the default '$dflt'.
6117EOM
6118rp='Use relocatable @INC?'
6119. ./myread
6120case "$ans" in
6121y|Y) val="$define" ;;
6122*) val="$undef" ;;
6123esac
6124set userelocatableinc
6125eval $setvar
6126
ea7d701d 6127initialinstalllocation="$binexp"
eaf812ae
MB
6128: Default prefix is now "up one level from where the binaries are"
6129case "$userelocatableinc" in
6130$define|true|[yY]*)
eaf812ae
MB
6131 bin=".../"
6132 binexp=".../"
6133 prefix=".../.."
6134 prefixexp=".../.."
6135 installprefixexp=".../.."
6136 ;;
6137esac
6138
b4eb6b3d
JH
6139: determine where private library files go
6140: Usual default is /usr/local/lib/perl5/$version.
f3f1a2d8 6141: Also allow things like /opt/perl/lib/$version, since
b4eb6b3d
JH
6142: /opt/perl/lib/perl5... would be redundant.
6143: The default "style" setting is made in installstyle.U
6144case "$installstyle" in
6145*lib/perl5*) set dflt privlib lib/$package/$version ;;
6146*) set dflt privlib lib/$version ;;
6147esac
6148eval $prefixit
6149$cat <<EOM
6150
6151There are some auxiliary files for $package that need to be put into a
6152private library directory that is accessible by everyone.
6153
6154EOM
eaf812ae 6155fn=$binexp
b4eb6b3d
JH
6156fn=d~+
6157rp='Pathname where the private library files will reside?'
6158. ./getfile
79522dd2
NC
6159prefixvar=privlib
6160. ./setprefixvar
b4eb6b3d
JH
6161
6162: set the prefixup variable, to restore leading tilda escape
6163prefixup='case "$prefixexp" in
6164"$prefix") ;;
6165*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6166esac'
6167
6168: determine where public architecture dependent libraries go
6169set archlib archlib
6170eval $prefixit
6171: privlib default is /usr/local/lib/$package/$version
6172: archlib default is /usr/local/lib/$package/$version/$archname
6173: privlib may have an optional trailing /share.
6174tdflt=`echo $privlib | $sed 's,/share$,,'`
6175tdflt=$tdflt/$archname
6176case "$archlib" in
6177'') dflt=$tdflt
6178 ;;
6179*) dflt="$archlib"
6180 ;;
6181esac
6182$cat <<EOM
6183
6184$spackage contains architecture-dependent library files. If you are
6185sharing libraries in a heterogeneous environment, you might store
6186these files in a separate location. Otherwise, you can just include
6187them with the rest of the public library files.
6188
6189EOM
eaf812ae 6190fn=$binexp
b4eb6b3d
JH
6191fn=d+~
6192rp='Where do you want to put the public architecture-dependent libraries?'
6193. ./getfile
79522dd2
NC
6194prefixvar=archlib
6195. ./setprefixvar
b4eb6b3d
JH
6196if $test X"$archlib" = X"$privlib"; then
6197 d_archlib="$undef"
6198else
6199 d_archlib="$define"
6200fi
b4eb6b3d 6201
b4eb6b3d
JH
6202: see if setuid scripts can be secure
6203$cat <<EOM
6204
6205Some kernels have a bug that prevents setuid #! scripts from being
6206secure. Some sites have disabled setuid #! scripts because of this.
6207
6208First let's decide if your kernel supports secure setuid #! scripts.
6209(If setuid #! scripts would be secure but have been disabled anyway,
6210don't say that they are secure if asked.)
6211
6212EOM
6213
6214val="$undef"
6215if $test -d /dev/fd; then
6216 echo "#!$ls" >reflect
6217 chmod +x,u+s reflect
6218 ./reflect >flect 2>&1
6219 if $contains "/dev/fd" flect >/dev/null; then
6220 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6221 val="$define"
6222 else
6223 $cat <<EOM
6224If you are not sure if they are secure, I can check but I'll need a
6225username and password different from the one you are using right now.
6226If you don't have such a username or don't want me to test, simply
6227enter 'none'.
6228
6229EOM
6230 rp='Other username to test security of setuid scripts with?'
6231 dflt='none'
6232 . ./myread
6233 case "$ans" in
6234 n|none)
6235 case "$d_suidsafe" in
6236 '') echo "I'll assume setuid scripts are *not* secure." >&4
6237 dflt=n;;
6238 "$undef")
6239 echo "Well, the $hint value is *not* secure." >&4
6240 dflt=n;;
6241 *) echo "Well, the $hint value *is* secure." >&4
6242 dflt=y;;
6243 esac
c1a7f87b 6244 ;;
b4eb6b3d
JH
6245 *)
6246 $rm -f reflect flect
6247 echo "#!$ls" >reflect
6248 chmod +x,u+s reflect
6249 echo >flect
6250 chmod a+w flect
6251 echo '"su" will (probably) prompt you for '"$ans's password."
6252 su $ans -c './reflect >flect'
6253 if $contains "/dev/fd" flect >/dev/null; then
6254 echo "Okay, it looks like setuid scripts are secure." >&4
6255 dflt=y
6256 else
6257 echo "I don't think setuid scripts are secure." >&4
6258 dflt=n
6259 fi
6260 ;;
6261 esac
6262 rp='Does your kernel have *secure* setuid scripts?'
6263 . ./myread
6264 case "$ans" in
6265 [yY]*) val="$define";;
6266 *) val="$undef";;
6267 esac
6268 fi
6269else
6270 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6271 echo "(That's for file descriptors, not floppy disks.)"
6272 val="$undef"
6273fi
6274set d_suidsafe
6275eval $setvar
6276
6277$rm -f reflect flect
6278
6279: now see if they want to do setuid emulation
6280echo " "
6281val="$undef"
6282case "$d_suidsafe" in
6283"$define")
6284 val="$undef"
3c728e00 6285 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d 6286 ;;
f3f1a2d8
MB
6287*)
6288 $cat <<EOM
6289Some systems have disabled setuid scripts, especially systems where
6290setuid scripts cannot be secure. On systems where setuid scripts have
6291been disabled, the setuid/setgid bits on scripts are currently
6292useless. It is possible for $package to detect those bits and emulate
6293setuid/setgid in a secure fashion. This emulation will only work if
6294setuid scripts have been disabled in your kernel.
6295
6296EOM
6297 case "$d_dosuid" in
6298 "$define") dflt=y ;;
6299 *) dflt=n ;;
6300 esac
6301 rp="Do you want to do setuid/setgid emulation?"
6302 . ./myread
6303 case "$ans" in
6304 [yY]*) val="$define";;
6305 *) val="$undef";;
6306 esac
6307 ;;
6308esac
6309set d_dosuid
6310eval $setvar
6311
f3f1a2d8
MB
6312: Find perl5.005 or later.
6313echo "Looking for a previously installed perl5.005 or later... "
6314case "$perl5" in
6315'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6316 : Check if this perl is recent and can load a simple module
6317 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6318 perl5=$tdir/perl
6319 break;
6320 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6321 perl5=$tdir/perl5
6322 break;
6323 fi
6324 done
6325 ;;
6326*) perl5="$perl5"
6327 ;;
6328esac
6329case "$perl5" in
6330'') echo "None found. That's ok.";;
6331*) echo "Using $perl5." ;;
6332esac
6333
6334$cat <<EOM
6335
6336After $package is installed, you may wish to install various
6337add-on modules and utilities. Typically, these add-ons will
6338be installed under $prefix with the rest
6339of this package. However, you may wish to install such add-ons
6340elsewhere under a different prefix.
6341
6342If you do not wish to put everything under a single prefix, that's
6343ok. You will be prompted for the individual locations; this siteprefix
6344is only used to suggest the defaults.
6345
6346The default should be fine for most people.
6347
6348EOM
6349fn=d~+
6350rp='Installation prefix to use for add-on modules and utilities?'
6351: XXX Here might be another good place for an installstyle setting.
6352case "$siteprefix" in
6353'') dflt=$prefix ;;
6354*) dflt=$siteprefix ;;
6355esac
6356. ./getfile
6357: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6358oldsiteprefix=''
6359case "$siteprefix" in
6360'') ;;
6361*) case "$ans" in
6362 "$prefix") ;;
6363 *) oldsiteprefix="$prefix";;
6364 esac
6365 ;;
6366esac
6367siteprefix="$ans"
6368siteprefixexp="$ansexp"
6369
6370: determine where site specific libraries go.
6371: Usual default is /usr/local/lib/perl5/site_perl/$version
6372: The default "style" setting is made in installstyle.U
6373: XXX No longer works with Prefixit stuff.
6374prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6375case "$sitelib" in
6376'') case "$installstyle" in
6377 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6378 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6379 esac
6380 ;;
6381*) dflt="$sitelib"
6382 ;;
6383esac
6384$cat <<EOM
6385
6386The installation process will create a directory for
6387site-specific extensions and modules. Most users find it convenient
6388to place all site-specific files in this directory rather than in the
6389main distribution directory.
6390
6391EOM
6392fn=d~+
6393rp='Pathname for the site-specific library files?'
6394. ./getfile
6395prefixvar=sitelib
6396. ./setprefixvar
6397sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6398
6399: Determine list of previous versions to include in @INC
6400$cat > getverlist <<EOPL
6401#!$perl5 -w
6402use File::Basename;
6403\$api_versionstring = "$api_versionstring";
6404\$version = "$version";
6405\$stem = "$sitelib_stem";
6406\$archname = "$archname";
6407EOPL
6408 $cat >> getverlist <<'EOPL'
13cfc98d
MB
6409# The list found is store twice for each entry: the original name, and
6410# the binary broken down version as pack "sss", so sorting is easy and
6411# unambiguous. This will work for all versions that have a maximum of
6412# three digit groups, separate by '.'s or '_'s. Names are extended with
6413# ".0.0" to ensure at least three elements for the pack.
6414# -- H.Merijn Brand (m)'06 23-10-2006
6415
f3f1a2d8
MB
6416# Can't have leading @ because metaconfig interprets it as a command!
6417;@inc_version_list=();
6418# XXX Redo to do opendir/readdir?
6419if (-d $stem) {
6420 chdir($stem);
13cfc98d
MB
6421 ;@candidates = map {
6422 [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
f3f1a2d8
MB
6423}
6424else {
6425 ;@candidates = ();
6426}
6427
13cfc98d
MB
6428($pversion, $aversion, $vsn5005) = map {
6429 pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
f3f1a2d8 6430foreach $d (@candidates) {
13cfc98d
MB
6431 if ($d->[1] lt $pversion) {
6432 if ($d->[1] ge $aversion) {
6433 unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
f3f1a2d8 6434 }
13cfc98d
MB
6435 elsif ($d->[1] ge $vsn5005) {
6436 unshift(@inc_version_list, grep { -d } $d->[0]);
f3f1a2d8
MB
6437 }
6438 }
6439 else {
6440 # Skip newer version. I.e. don't look in
6441 # 5.7.0 if we're installing 5.6.1.
6442 }
6443}
6444
6445if (@inc_version_list) {
6446 print join(' ', @inc_version_list);
6447}
6448else {
6449 # Blank space to preserve value for next Configure run.
6450 print " ";
6451}
6452EOPL
6453chmod +x getverlist
6454case "$inc_version_list" in
6455'') if test -x "$perl5$exe_ext"; then
6456 dflt=`$perl5 getverlist`
6457 else
6458 dflt='none'
6459 fi
6460 ;;
6461$undef) dflt='none' ;;
6462*) eval dflt=\"$inc_version_list\" ;;
6463esac
6464case "$dflt" in
6465''|' ') dflt=none ;;
6466esac
6467case "$dflt" in
64685.005) dflt=none ;;
6469esac
6470$cat <<EOM
6471
6472In order to ease the process of upgrading, this version of perl
6473can be configured to use modules built and installed with earlier
6474versions of perl that were installed under $prefix. Specify here
6475the list of earlier versions that this version of perl should check.
6476If Configure detected no earlier versions of perl installed under
6477$prefix, then the list will be empty. Answer 'none' to tell perl
6478to not search earlier versions.
b4eb6b3d 6479
f3f1a2d8
MB
6480The default should almost always be sensible, so if you're not sure,
6481just accept the default.
b4eb6b3d 6482EOM
f3f1a2d8
MB
6483
6484rp='List of earlier versions to include in @INC?'
6485. ./myread
6486case "$ans" in
6487[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6488*) inc_version_list="$ans" ;;
6489esac
6490case "$inc_version_list" in
6491''|' ')
6492 inc_version_list_init='0'
6493 d_inc_version_list="$undef"
6494 ;;
6495*) inc_version_list_init=`echo $inc_version_list |
6496 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6497 d_inc_version_list="$define"
b4eb6b3d
JH
6498 ;;
6499esac
f3f1a2d8 6500$rm -f getverlist
b4eb6b3d 6501
b4eb6b3d 6502: see if this is a malloc.h system
01d07975
YST
6503: we want a real compile instead of Inhdr because some systems have a
6504: malloc.h that just gives a compile error saying to use stdlib.h instead
6505echo " "
6506$cat >try.c <<EOCP
6507#include <stdlib.h>
6508#include <malloc.h>
6509int main () { return 0; }
6510EOCP
6511set try
6512if eval $compile; then
6513 echo "<malloc.h> found." >&4
6514 val="$define"
6515else
6516 echo "<malloc.h> NOT found." >&4
6517 val="$undef"
6518fi
6519$rm -f try.c try
6520set i_malloc
6521eval $setvar
b4eb6b3d 6522
c8b93cf9
JH
6523: check for void type
6524echo " "
6525echo "Checking to see how well your C compiler groks the void type..." >&4
6526case "$voidflags" in
6527'')
c727eafa 6528 $cat >try.c <<EOCP
d1daaddf
JH
6529#$i_stdlib I_STDLIB
6530#ifdef I_STDLIB
6531#include <stdlib.h>
6532#endif
c8b93cf9
JH
6533#if TRY & 1
6534void sub() {
6535#else
6536sub() {
6537#endif
6538 extern void moo(); /* function returning void */
6539 void (*goo)(); /* ptr to func returning void */
6540#if TRY & 8
6541 void *hue; /* generic ptr */
6542#endif
6543#if TRY & 2
6544 void (*foo[10])();
6545#endif
6546
6547#if TRY & 4
6548 if(goo == moo) {
6549 exit(0);
6550 }
6551#endif
6552 exit(0);
6553}
6554int main() { sub(); }
6555EOCP
6556 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6557 voidflags=$defvoidused
6558 echo "Good. It appears to support void to the level $package wants.">&4
6559 if $contains warning .out >/dev/null 2>&1; then
6560 echo "However, you might get some warnings that look like this:"
6561 $cat .out
6562 fi
6563 else
6564echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6565 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6566 echo "It supports 1..."
6567 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6568 echo "It also supports 2..."
6569 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6570 voidflags=7
6571 echo "And it supports 4 but not 8 definitely."
6572 else
6573 echo "It doesn't support 4..."
6574 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6575 voidflags=11
6576 echo "But it supports 8."
6577 else
6578 voidflags=3
6579 echo "Neither does it support 8."
6580 fi
6581 fi
6582 else
6583 echo "It does not support 2..."
6584 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6585 voidflags=13
6586 echo "But it supports 4 and 8."
6587 else
6588 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6589 voidflags=5
6590 echo "And it supports 4 but has not heard about 8."
6591 else
6592 echo "However it supports 8 but not 4."
6593 fi
6594 fi
6595 fi
6596 else
6597 echo "There is no support at all for void."
6598 voidflags=0
6599 fi
6600 fi
6601esac
6602case "$voidflags" in
6603"$defvoidused") ;;
6604*) $cat >&4 <<'EOM'
6605 Support flag bits are:
6606 1: basic void declarations.
6607 2: arrays of pointers to functions returning void.
6608 4: operations between pointers to and addresses of void functions.
6609 8: generic void pointers.
6610EOM
6611 dflt="$voidflags";
6612 rp="Your void support flags add up to what?"
6613 . ./myread
6614 voidflags="$ans"
6615 ;;
6616esac
6617$rm -f try.* .out
6618
6619: check for length of pointer
6620echo " "
6621case "$ptrsize" in
6622'')
6623 echo "Checking to see how big your pointers are..." >&4
6624 if test "$voidflags" -gt 7; then
6625 echo '#define VOID_PTR char *' > try.c
6626 else
6627 echo '#define VOID_PTR void *' > try.c
6628 fi
74d00865 6629 $cat >>try.c <<EOCP
c8b93cf9 6630#include <stdio.h>
d1daaddf
JH
6631#$i_stdlib I_STDLIB
6632#ifdef I_STDLIB
6633#include <stdlib.h>
6634#endif
c8b93cf9
JH
6635int main()
6636{
6637 printf("%d\n", (int)sizeof(VOID_PTR));
6638 exit(0);
6639}
6640EOCP
6641 set try
6642 if eval $compile_ok; then
6643 ptrsize=`$run ./try`
6644 echo "Your pointers are $ptrsize bytes long."
6645 else
6646 dflt='4'
6647 echo "(I can't seem to compile the test program. Guessing...)" >&4
6648 rp="What is the size of a pointer (in bytes)?"
6649 . ./myread
6650 ptrsize="$ans"
6651 fi
6652 ;;
6653esac
6654$rm -f try.c try
6655case "$use64bitall" in
6656"$define"|true|[yY]*)
6657 case "$ptrsize" in
6658 4) cat <<EOM >&4
6659
1911a026
JH
6660*** You have chosen a maximally 64-bit build,
6661*** but your pointers are only 4 bytes wide.
09b58c7b
JH
6662*** Please rerun Configure without -Duse64bitall.
6663EOM
6664 case "$d_quad" in
6665 define)
6666 cat <<EOM >&4
6667*** Since you have quads, you could possibly try with -Duse64bitint.
6668EOM
6669 ;;
6670 esac
6671 cat <<EOM >&4
1911a026 6672*** Cannot continue, aborting.
c8b93cf9
JH
6673
6674EOM
09b58c7b 6675
1911a026 6676 exit 1
c8b93cf9
JH
6677 ;;
6678 esac
6679 ;;
6680esac
6681
19a100ff 6682
9df442c2
NC
6683: determine whether to use malloc wrapping
6684echo " "
6685case "$usemallocwrap" in
6686[yY]*|true|$define) dflt='y' ;;
6687[nN]*|false|$undef) dflt='n' ;;
6688*) case "$usedevel" in
6689 [yY]*|true|$define) dflt='y' ;;
6690 *) dflt='n' ;;
6691 esac
6692 ;;
6693esac
6694rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6695. ./myread
6696usemallocwrap="$ans"
6697case "$ans" in
6698y*|true)
6699 usemallocwrap="$define" ;;
6700*)
6701 usemallocwrap="$undef" ;;
6702esac
c8b93cf9 6703
b4eb6b3d
JH
6704: determine which malloc to compile in
6705echo " "
6706case "$usemymalloc" in
c4163172
JH
6707[yY]*|true|$define) dflt='y' ;;
6708[nN]*|false|$undef) dflt='n' ;;
6709*) case "$ptrsize" in
6710 4) dflt='y' ;;
6711 *) dflt='n' ;;
6712 esac
6713 ;;
8dfa8df9 6714esac
b4eb6b3d
JH
6715rp="Do you wish to attempt to use the malloc that comes with $package?"
6716. ./myread
6717usemymalloc="$ans"
6718case "$ans" in
6719y*|true)
6720 usemymalloc='y'
6721 mallocsrc='malloc.c'
6722 mallocobj="malloc$_o"
6723 d_mymalloc="$define"
6724 case "$libs" in
6725 *-lmalloc*)
6726 : Remove malloc from list of libraries to use
6727 echo "Removing unneeded -lmalloc from library list" >&4
6728 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6729 shift
6730 libs="$*"
6731 echo "libs = $libs" >&4
6732 ;;
6733 esac
6734 ;;
6735*)
6736 usemymalloc='n'
6737 mallocsrc=''
6738 mallocobj=''
6739 d_mymalloc="$undef"
6740 ;;
6741esac
6742
6743: compute the return types of malloc and free
6744echo " "
6745$cat >malloc.c <<END
6746#$i_malloc I_MALLOC
6747#$i_stdlib I_STDLIB
6748#include <stdio.h>
6749#include <sys/types.h>
6750#ifdef I_MALLOC
6751#include <malloc.h>
6752#endif
6753#ifdef I_STDLIB
6754#include <stdlib.h>
6755#endif
6756#ifdef TRY_MALLOC
6757void *malloc();
6758#endif
6759#ifdef TRY_FREE
6760void free();
6761#endif
6762END
6763case "$malloctype" in
6764'')
6765 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6766 malloctype='void *'
6767 else
6768 malloctype='char *'
6769 fi
6770 ;;
6771esac
6772echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6773
6774case "$freetype" in
6775'')
6776 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6777 freetype='void'
6778 else
6779 freetype='int'
6780 fi
6781 ;;
6782esac
6783echo "Your system uses $freetype free(), it would seem." >&4
6784$rm -f malloc.[co]
b4eb6b3d
JH
6785: determine where site specific architecture-dependent libraries go.
6786: sitelib default is /usr/local/lib/perl5/site_perl/$version
6787: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6788: sitelib may have an optional trailing /share.
6789case "$sitearch" in
6790'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6791 dflt="$dflt/$archname"
6792 ;;
6793*) dflt="$sitearch"
6794 ;;
6795esac
6796set sitearch sitearch none
6797eval $prefixit
6798$cat <<EOM
6799
6800The installation process will also create a directory for
6801architecture-dependent site-specific extensions and modules.
6802
6803EOM
6804fn=d~+
6805rp='Pathname for the site-specific architecture-dependent library files?'
6806. ./getfile
79522dd2
NC
6807prefixvar=sitearch
6808. ./setprefixvar
c95d0e17
GA
6809if $test X"$sitearch" = X"$sitelib"; then
6810 d_sitearch="$undef"
6811else
6812 d_sitearch="$define"
6813fi
b4eb6b3d
JH
6814
6815$cat <<EOM
6816
6817The installation process will also create a directory for
6818vendor-supplied add-ons. Vendors who supply perl with their system
6819may find it convenient to place all vendor-supplied files in this
6820directory rather than in the main distribution directory. This will
6821ease upgrades between binary-compatible maintenance versions of perl.
6822
6823Of course you may also use these directories in whatever way you see
6824fit. For example, you might use them to access modules shared over a
6825company-wide network.
6826
6827The default answer should be fine for most people.
6828This causes further questions about vendor add-ons to be skipped
6829and no vendor-specific directories will be configured for perl.
6830
6831EOM
6832rp='Do you want to configure vendor-specific add-on directories?'
6833case "$usevendorprefix" in
6834define|true|[yY]*) dflt=y ;;
6835*) : User may have set vendorprefix directly on Configure command line.
6836 case "$vendorprefix" in
6837 ''|' ') dflt=n ;;
6838 *) dflt=y ;;
6839 esac
6840 ;;
6841esac
6842. ./myread
6843case "$ans" in
6844[yY]*) fn=d~+
6845 rp='Installation prefix to use for vendor-supplied add-ons?'
6846 case "$vendorprefix" in
6847 '') dflt='' ;;
6848 *) dflt=$vendorprefix ;;
6849 esac
6850 . ./getfile
6851 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6852 oldvendorprefix=''
6853 case "$vendorprefix" in
6854 '') ;;
6855 *) case "$ans" in
6856 "$prefix") ;;
6857 *) oldvendorprefix="$prefix";;
6858 esac
6859 ;;
6860 esac
6861 usevendorprefix="$define"
6862 vendorprefix="$ans"
6863 vendorprefixexp="$ansexp"
6864 ;;
6865*) usevendorprefix="$undef"
6866 vendorprefix=''
6867 vendorprefixexp=''
6868 ;;
6869esac
6870
6871case "$vendorprefix" in
6872'') d_vendorlib="$undef"
6873 vendorlib=''
6874 vendorlibexp=''
6875 ;;
6876*) d_vendorlib="$define"
6877 : determine where vendor-supplied modules go.
6878 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6879 case "$vendorlib" in
6880 '')
6881 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6882 case "$installstyle" in
6883 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6884 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6885 esac
6886 ;;
6887 *) dflt="$vendorlib"
6888 ;;
6889 esac
6890 fn=d~+
6891 rp='Pathname for the vendor-supplied library files?'
6892 . ./getfile
6893 vendorlib="$ans"
6894 vendorlibexp="$ansexp"
6895 ;;
6896esac
6897vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
a092d240
NC
6898prefixvar=vendorlib
6899. ./installprefix
b4eb6b3d
JH
6900
6901case "$vendorprefix" in
6902'') d_vendorarch="$undef"
6903 vendorarch=''
6904 vendorarchexp=''
6905 ;;
6906*) d_vendorarch="$define"
6907 : determine where vendor-supplied architecture-dependent libraries go.
6908 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6909 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6910 : vendorlib may have an optional trailing /share.
6911 case "$vendorarch" in
6912 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6913 dflt="$dflt/$archname"
6914 ;;
6915 *) dflt="$vendorarch" ;;
6916 esac
6917 fn=d~+
6918 rp='Pathname for vendor-supplied architecture-dependent files?'
6919 . ./getfile
6920 vendorarch="$ans"
6921 vendorarchexp="$ansexp"
6922 ;;
6923esac
a092d240
NC
6924prefixvar=vendorarch
6925. ./installprefix
b4eb6b3d
JH
6926
6927: Final catch-all directories to search
6928$cat <<EOM
6929
6930Lastly, you can have perl look in other directories for extensions and
6931modules in addition to those already specified.
6932These directories will be searched after
6933 $sitearch
6934 $sitelib
6935EOM
6936test X"$vendorlib" != "X" && echo ' ' $vendorlib
6937test X"$vendorarch" != "X" && echo ' ' $vendorarch
6938echo ' '
6939case "$otherlibdirs" in
6940''|' ') dflt='none' ;;
6941*) dflt="$otherlibdirs" ;;
6942esac
6943$cat <<EOM
6944Enter a colon-separated set of extra paths to include in perl's @INC
6945search path, or enter 'none' for no extra paths.
6946
6947EOM
6948
6949rp='Colon-separated list of additional directories for perl to search?'
6950. ./myread
6951case "$ans" in
6952' '|''|none) otherlibdirs=' ' ;;
6953*) otherlibdirs="$ans" ;;
6954esac
6955case "$otherlibdirs" in
6956' ') val=$undef ;;
6957*) val=$define ;;
6958esac
6959set d_perl_otherlibdirs
6960eval $setvar
6961
6962: Cruising for prototypes
6963echo " "
6964echo "Checking out function prototypes..." >&4
55954f19
JH
6965$cat >prototype.c <<EOCP
6966#$i_stdlib I_STDLIB
6967#ifdef I_STDLIB
6968#include <stdlib.h>
6969#endif
b4eb6b3d
JH
6970int main(int argc, char *argv[]) {
6971 exit(0);}
6972EOCP
6973if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6974 echo "Your C compiler appears to support function prototypes."
6975 val="$define"
6976else
6977 echo "Your C compiler doesn't seem to understand function prototypes."
6978 val="$undef"
6979fi
6980set prototype
6981eval $setvar
6982$rm -f prototype*
6983
6984case "$prototype" in
6985"$define") ;;
6986*) ansi2knr='ansi2knr'
6987 echo " "
6988 cat <<EOM >&4
6989
6990$me: FATAL ERROR:
6991This version of $package can only be compiled by a compiler that
6992understands function prototypes. Unfortunately, your C compiler
6993 $cc $ccflags
6994doesn't seem to understand them. Sorry about that.
6995
6996If GNU cc is available for your system, perhaps you could try that instead.
6997
6998Eventually, we hope to support building Perl with pre-ANSI compilers.
6999If you would like to help in that effort, please contact <perlbug@perl.org>.
7000
7001Aborting Configure now.
7002EOM
7003 exit 2
7004 ;;
7005esac
7006
6fcddf3b 7007echo " "
6fcddf3b 7008case "$extras" in
bf35c3f6
JH
7009'') dflt='n';;
7010*) dflt='y';;
6fcddf3b
JH
7011esac
7012cat <<EOM
7013Perl can be built with extra modules or bundles of modules which
7014will be fetched from the CPAN and installed alongside Perl.
7015
7016Notice that you will need access to the CPAN; either via the Internet,
7017or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
7018be asked later to configure the CPAN.pm module which will in turn do
7019the installation of the rest of the extra modules or bundles.)
7020
7021Notice also that if the modules require any external software such as
dd2de242
JH
7022libraries and headers (the libz library and the zlib.h header for the
7023Compress::Zlib module, for example) you MUST have any such software
7024already installed, this configuration process will NOT install such
7025things for you.
6fcddf3b
JH
7026
7027If this doesn't make any sense to you, just accept the default '$dflt'.
7028EOM
dd2de242 7029rp='Install any extra modules (y or n)?'
6fcddf3b
JH
7030. ./myread
7031case "$ans" in
7032y|Y)
7033 cat <<EOM
7034
7035Please list any extra modules or bundles to be installed from CPAN,
7036with spaces between the names. The names can be in any format the
dd2de242
JH
7037'install' command of CPAN.pm will understand. (Answer 'none',
7038without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
7039EOM
7040 rp='Extras?'
7041 dflt="$extras"
7042 . ./myread
7043 extras="$ans"
7044esac
7045case "$extras" in
7046''|'none')
7047 val=''
7048 $rm -f ../extras.lst
7049 ;;
7050*) echo "(Saving the list of extras for later...)"
dd2de242
JH
7051 echo "$extras" > ../extras.lst
7052 val="'$extras'"
6fcddf3b
JH
7053 ;;
7054esac
7055set extras
7056eval $setvar
7057echo " "
7058
6e1038e0
MB
7059: determine where html pages for programs go
7060set html1dir html1dir none
7061eval $prefixit
7062$cat <<EOM
7063
f3f1a2d8 7064If you wish to install html files for programs in $spackage, indicate
6e1038e0
MB
7065the appropriate directory here. To skip installing html files,
7066answer "none".
7067EOM
7068case "$html1dir" in
7069''|none|$undef|' ') dflt=none ;;
7070*) dflt=$html1dir ;;
7071esac
7072fn=dn+~
7073rp="Directory for the main $spackage html pages?"
7074. ./getfile
79522dd2
NC
7075prefixvar=html1dir
7076. ./setprefixvar
6e1038e0
MB
7077: Use ' ' for none so value is preserved next time through Configure
7078$test X"$html1dir" = "X" && html1dir=' '
6e1038e0
MB
7079
7080: determine where html pages for libraries and modules go
7081set html3dir html3dir none
7082eval $prefixit
7083$cat <<EOM
7084
7085If you wish to install html files for modules associated with $spackage,
7086indicate the appropriate directory here. To skip installing html files,
7087answer "none".
7088EOM
7089: There is no obvious default. If they have specified html1dir, then
7090: try to key off that, possibly changing .../html1 into .../html3.
7091case "$html3dir" in
7092'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7093*) dflt=$html3dir ;;
7094esac
7095fn=dn+~
7096rp="Directory for the $spackage module html pages?"
7097. ./getfile
79522dd2
NC
7098prefixvar=html3dir
7099. ./setprefixvar
6e1038e0
MB
7100: Use ' ' for none so value is preserved next time through Configure
7101$test X"$html3dir" = "X" && html3dir=' '
6e1038e0 7102
89ce900e
JH
7103: determine whether to install perl also as /usr/bin/perl
7104
7105echo " "
7106if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7107 $cat <<EOM
7108Many scripts expect perl to be installed as /usr/bin/perl.
7109
7110If you want to, I can install the perl you are about to compile
7111as /usr/bin/perl (in addition to $bin/perl).
7112EOM
7113 if test -f /usr/bin/perl; then
7114 $cat <<EOM
7115
7116However, please note that because you already have a /usr/bin/perl,
7117overwriting that with a new Perl would very probably cause problems.
7118Therefore I'm assuming you don't want to do that (unless you insist).
7119
7120EOM
7121 case "$installusrbinperl" in
7122 "$define"|[yY]*) dflt='y';;
7123 *) dflt='n';;
7124 esac
7125 else
7126 $cat <<EOM
7127
7128Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7129
7130EOM
7131 case "$installusrbinperl" in
7132 "$undef"|[nN]*) dflt='n';;
7133 *) dflt='y';;
7134 esac
7135 fi
7136 rp="Do you want to install perl as /usr/bin/perl?"
7137 . ./myread
7138 case "$ans" in
7139 [yY]*) val="$define";;
7140 *) val="$undef" ;;
7141 esac
7142else
7143 val="$undef"
7144fi
7145set installusrbinperl
7146eval $setvar
7147
7148echo " "
7149echo "Checking for GNU C Library..." >&4
7150cat >try.c <<'EOCP'
7151/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7152 alone are insufficient to distinguish different versions, such as
7153 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7154 libc version 2.1.0. A. Dougherty, June 3, 2002.
7155*/
7156#include <stdio.h>
7157int main(void)
7158{
7159#ifdef __GLIBC__
7160# ifdef __GLIBC_MINOR__
4fb7dc7d 7161# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
89ce900e
JH
7162# include <gnu/libc-version.h>
7163 printf("%s\n", gnu_get_libc_version());
7164# else
7165 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7166# endif
7167# else
7168 printf("%d\n", __GLIBC__);
7169# endif
7170 return 0;
7171#else
7172 return 1;
7173#endif
7174}
7175EOCP
7176set try
7177if eval $compile_ok && $run ./try > glibc.ver; then
7178 val="$define"
7179 gnulibc_version=`$cat glibc.ver`
7180 echo "You are using the GNU C Library version $gnulibc_version"
7181else
7182 val="$undef"
7183 gnulibc_version=''
7184 echo "You are not using the GNU C Library"
7185fi
7186$rm -f try try.* glibc.ver
7187set d_gnulibc
7188eval $setvar
7189
7190: see if nm is to be used to determine whether a symbol is defined or not
7191case "$usenm" in
7192'')
7193 dflt=''
7194 case "$d_gnulibc" in
7195 "$define")
7196 echo " "
7197 echo "nm probably won't work on the GNU C Library." >&4
7198 dflt=n
7199 ;;
7200 esac
7201 case "$dflt" in
7202 '')
7203 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7204 echo " "
7205 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7206 echo "'nm' won't be sufficient on this sytem." >&4
7207 dflt=n
7208 fi
7209 ;;
7210 esac
7211 case "$dflt" in
7212 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7213 if $test $dflt -gt 20; then
7214 dflt=y
7215 else
7216 dflt=n
7217 fi
7218 ;;
7219 esac
b4eb6b3d 7220 ;;
89ce900e
JH
7221*)
7222 case "$usenm" in
7223 true|$define) dflt=y;;
7224 *) dflt=n;;
7225 esac
b4eb6b3d
JH
7226 ;;
7227esac
89ce900e 7228$cat <<EOM
b4eb6b3d 7229
89ce900e
JH
7230I can use $nm to extract the symbols from your C libraries. This
7231is a time consuming task which may generate huge output on the disk (up
7232to 3 megabytes) but that should make the symbols extraction faster. The
7233alternative is to skip the 'nm' extraction part and to compile a small
7234test program instead to determine whether each symbol is present. If
7235you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7236this may be the best solution.
b4eb6b3d 7237
89ce900e 7238You probably shouldn't let me use 'nm' if you are using the GNU C Library.
b4eb6b3d 7239
89ce900e
JH
7240EOM
7241rp="Shall I use $nm to extract C symbols from the libraries?"
7242. ./myread
7243case "$ans" in
7244[Nn]*) usenm=false;;
7245*) usenm=true;;
b4eb6b3d 7246esac
89ce900e
JH
7247
7248runnm=$usenm
7249case "$reuseval" in
7250true) runnm=false;;
b4eb6b3d 7251esac
b4eb6b3d 7252
89ce900e
JH
7253: nm options which may be necessary
7254case "$nm_opt" in
7255'') if $test -f /mach_boot; then
7256 nm_opt='' # Mach
7257 elif $test -d /usr/ccs/lib; then
7258 nm_opt='-p' # Solaris (and SunOS?)
7259 elif $test -f /dgux; then
7260 nm_opt='-p' # DG-UX
7261 elif $test -f /lib64/rld; then
7262 nm_opt='-p' # 64-bit Irix
7263 else
7264 nm_opt=''
7265 fi;;
7266esac
b4eb6b3d 7267
89ce900e
JH
7268: nm options which may be necessary for shared libraries but illegal
7269: for archive libraries. Thank you, Linux.
7270case "$nm_so_opt" in
7271'') case "$myuname" in
fb2e1bc0 7272 *linux*|gnu*)
89ce900e
JH
7273 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7274 nm_so_opt='--dynamic'
7275 fi
7276 ;;
7277 esac
7278 ;;
7279esac
b4eb6b3d 7280
89ce900e
JH
7281case "$runnm" in
7282true)
7283: get list of predefined functions in a handy place
7284echo " "
7285case "$libc" in
7286'') libc=unknown
7287 case "$libs" in
7288 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7289 esac
7290 ;;
b4eb6b3d 7291esac
89ce900e
JH
7292case "$libs" in
7293'') ;;
7294*) for thislib in $libs; do
7295 case "$thislib" in
7296 -lc|-lc_s)
7297 : Handle C library specially below.
7298 ;;
7299 -l*)
7300 thislib=`echo $thislib | $sed -e 's/^-l//'`
7301 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7302 :
7303 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7304 :
7305 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7306 :
7307 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7308 :
7309 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7310 :
7311 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7312 :
7313 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7314 :
7315 else
7316 try=''
7317 fi
7318 libnames="$libnames $try"
7319 ;;
7320 *) libnames="$libnames $thislib" ;;
7321 esac
7322 done
b4eb6b3d
JH
7323 ;;
7324esac
89ce900e
JH
7325xxx=normal
7326case "$libc" in
7327unknown)
7328 set /lib/libc.$so
7329 for xxx in $libpth; do
7330 $test -r $1 || set $xxx/libc.$so
7331 : The messy sed command sorts on library version numbers.
7332 $test -r $1 || \
7333 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7334 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7335 h
7336 s/[0-9][0-9]*/0000&/g
7337 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7338 G
7339 s/\n/ /' | \
7340 $sort | $sed -e 's/^.* //'`
7341 eval set \$$#
7342 done
7343 $test -r $1 || set /usr/ccs/lib/libc.$so
7344 $test -r $1 || set /lib/libsys_s$_a
7345 ;;
7346*)
7347 set blurfl
7348 ;;
7349esac
7350if $test -r "$1"; then
7351 echo "Your (shared) C library seems to be in $1."
7352 libc="$1"
7353elif $test -r /lib/libc && $test -r /lib/clib; then
7354 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7355 xxx=apollo
7356 libc='/lib/clib /lib/libc'
7357 if $test -r /lib/syslib; then
7358 echo "(Your math library is in /lib/syslib.)"
7359 libc="$libc /lib/syslib"
7360 fi
7361elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7362 echo "Your C library seems to be in $libc, as you said before."
7363elif $test -r $incpath/usr/lib/libc$_a; then
7364 libc=$incpath/usr/lib/libc$_a;
7365 echo "Your C library seems to be in $libc. That's fine."
7366elif $test -r /lib/libc$_a; then
7367 libc=/lib/libc$_a;
7368 echo "Your C library seems to be in $libc. You're normal."
7369else
7370 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7371 :
7372 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7373 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7374 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7375 :
7376 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7377 :
7378 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7379 :
7380 else
7381 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7382 fi
7383 if $test -r "$tans"; then
7384 echo "Your C library seems to be in $tans, of all places."
7385 libc=$tans
7386 else
7387 libc='blurfl'
7388 fi
7389fi
7390if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7391 dflt="$libc"
7392 cat <<EOM
b4eb6b3d 7393
89ce900e
JH
7394If the guess above is wrong (which it might be if you're using a strange
7395compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7396
89ce900e
JH
7397EOM
7398else
7399 dflt=''
7400 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7401 cat >&4 <<EOM
7402I can't seem to find your C library. I've looked in the following places:
5e366f65 7403
b4eb6b3d 7404EOM
89ce900e
JH
7405 $sed 's/^/ /' libpath
7406 cat <<EOM
5e366f65 7407
89ce900e 7408None of these seems to contain your C library. I need to get its name...
5e366f65
JH
7409
7410EOM
89ce900e
JH
7411fi
7412fn=f
7413rp='Where is your C library?'
7414. ./getfile
7415libc="$ans"
5e366f65 7416
89ce900e
JH
7417echo " "
7418echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7419set X `cat libnames`
7420shift
7421xxx=files
7422case $# in 1) xxx=file; esac
7423echo "Extracting names from the following $xxx for later perusal:" >&4
7424echo " "
7425$sed 's/^/ /' libnames >&4
7426echo " "
7427$echo $n "This may take a while...$c" >&4
5e366f65 7428
89ce900e
JH
7429for file in $*; do
7430 case $file in
7431 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7432 *) $nm $nm_opt $file 2>/dev/null;;
b4eb6b3d 7433 esac
89ce900e
JH
7434done >libc.tmp
7435
7436$echo $n ".$c"
7437$grep fprintf libc.tmp > libc.ptf
7438xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7439xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7440xxx='[ADTSIW]'
ab900c53 7441if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
89ce900e
JH
7442 eval $xscan;\
7443 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7444 eval $xrun
7445elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7446 eval $xscan;\
7447 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7448 eval $xrun
7449elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7450 eval $xscan;\
7451 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7452 eval $xrun
7453elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7454 eval $xscan;\
7455 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7456 eval $xrun
7457elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7458 eval $xscan;\
7459 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7460 eval $xrun
7461elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7462 eval $xscan;\
7463 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7464 eval $xrun
7465elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7466 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7467 eval $xscan;\
7468 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7469 eval $xrun
7470elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7471 eval $xscan;\
7472 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7473 eval $xrun
7474elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7475 eval $xscan;\
7476 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7477 eval $xrun
7478elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7479 eval $xscan;\
7480 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7481 eval $xrun
7482elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7483 eval $xscan;\
7484 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7485 eval $xrun
7486elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7487 eval $xscan;\
7488 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7489 eval $xrun
7490elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7491 eval $xscan;\
7492 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7493 eval $xrun
7494elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7495 eval $xscan;\
7496 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7497 eval $xrun
b4eb6b3d 7498else
89ce900e
JH
7499 $nm -p $* 2>/dev/null >libc.tmp
7500 $grep fprintf libc.tmp > libc.ptf
7501 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7502 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7503 then
7504 nm_opt='-p'
7505 eval $xrun
7506 else
7507 echo " "
7508 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7509 com=''
7510 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7511 for thisname in $libnames $libc; do
7512 $ar t $thisname >>libc.tmp
7513 done
7514 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7515 echo "Ok." >&4
7516 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7517 # Repeat libc to extract forwarders to DLL entries too
7518 for thisname in $libnames $libc; do
7519 $ar tv $thisname >>libc.tmp
7520 # Revision 50 of EMX has bug in $ar.
7521 # it will not extract forwarders to DLL entries
7522 # Use emximp which will extract exactly them.
7523 emximp -o tmp.imp $thisname \
7524 2>/dev/null && \
7525 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7526 < tmp.imp >>libc.tmp
7527 $rm tmp.imp
7528 done
7529 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7530 echo "Ok." >&4
7531 else
7532 echo "$ar didn't seem to work right." >&4
7533 echo "Maybe this is a Cray...trying bld instead..." >&4
7534 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7535 then
7536 for thisname in $libnames; do
7537 bld t $libnames | \
7538 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7539 $ar t $thisname >>libc.tmp
7540 done
7541 echo "Ok." >&4
7542 else
7543 echo "That didn't work either. Giving up." >&4
7544 exit 1
7545 fi
7546 fi
7547 fi
b4eb6b3d 7548fi
89ce900e
JH
7549nm_extract="$com"
7550case "$PASE" in
7551define)
7552 echo " "
7553 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7554 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7555 ;;
7556*) if $test -f /lib/syscalls.exp; then
7557 echo " "
7558 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7559 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' /lib/syscalls.exp >>libc.list
7560 fi
7561 ;;
7562esac
7563;;
7564esac
7565$rm -f libnames libpath
b4eb6b3d
JH
7566
7567: see if dld is available
7568set dld.h i_dld
7569eval $inhdr
7570
89ce900e
JH
7571: is a C symbol defined?
7572csym='tlook=$1;
7573case "$3" in
373dfab3
JH
7574-v) tf=libc.tmp; tdc="";;
7575-a) tf=libc.tmp; tdc="[]";;
7576*) tlook="^$1\$"; tf=libc.list; tdc="()";;
89ce900e
JH
7577esac;
7578tx=yes;
7579case "$reuseval-$4" in
7580true-) ;;
7581true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7582esac;
7583case "$tx" in
7584yes)
ab900c53 7585 tval=false;
5129fff4
JH
7586 if $test "$runnm" = true; then
7587 if $contains $tlook $tf >/dev/null 2>&1; then
ab900c53 7588 tval=true;
5129fff4 7589 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
373dfab3 7590 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7591 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
373dfab3
JH
7592 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7593 $rm -f try$_exe try.c core core.* try.core;
89ce900e 7594 fi;
5129fff4 7595 else
373dfab3 7596 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7597 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
373dfab3 7598 $rm -f try$_exe try.c;
ab900c53
AB
7599 fi;
7600 ;;
89ce900e
JH
7601*)
7602 case "$tval" in
7603 $define) tval=true;;
7604 *) tval=false;;
ab900c53
AB
7605 esac;
7606 ;;
89ce900e
JH
7607esac;
7608eval "$2=$tval"'
7609
7610: define an is-in-libc? function
7611inlibc='echo " "; td=$define; tu=$undef;
7612sym=$1; var=$2; eval "was=\$$2";
7613tx=yes;
7614case "$reuseval$was" in
7615true) ;;
7616true*) tx=no;;
7617esac;
7618case "$tx" in
7619yes)
7620 set $sym tres -f;
7621 eval $csym;
7622 case "$tres" in
7623 true)
7624 echo "$sym() found." >&4;
7625 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7626 *)
7627 echo "$sym() NOT found." >&4;
7628 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7629 esac;;
7630*)
7631 case "$was" in
7632 $define) echo "$sym() found." >&4;;
7633 *) echo "$sym() NOT found." >&4;;
7634 esac;;
7635esac'
7636
f244a502
JH
7637
7638echo " "
7639echo "Checking for C++..." >&4
7640cat >try.c <<'EOCP'
7641#include <stdio.h>
7642int main(void)
7643{
7644#ifdef __cplusplus
7645 printf("define\n");
7646#else
7647 printf("undef\n");
7648#endif
7649 return 0;
7650}
7651EOCP
7652set try
7653if eval $compile_ok && $run ./try >cplusplus$$; then
7654 val=`$cat cplusplus$$`
7655 echo "You are using a C++ compiler."
7656else
7657 val="$undef"
7658 echo "You are not using a C++ compiler."
7659fi
7660$rm -f try try.* cplusplus$$
7661set d_cplusplus
7662eval $setvar
7663
b4eb6b3d
JH
7664: see if dlopen exists
7665xxx_runnm="$runnm"
666ea192 7666xxx_ccflags="$ccflags"
b4eb6b3d 7667runnm=false
666ea192
JH
7668: with g++ one needs -shared to get is-in-libc to work for dlopen
7669case "$gccversion" in
7670'') ;;
7671*) case "$d_cplusplus" in
7672 "$define") ccflags="$ccflags -shared" ;;
7673 esac
7674 ;;
7675esac
b4eb6b3d
JH
7676set dlopen d_dlopen
7677eval $inlibc
7678runnm="$xxx_runnm"
666ea192 7679ccflags="$xxx_ccflags"
b4eb6b3d 7680
4fb7dc7d
JH
7681: see if this is a unistd.h system
7682set unistd.h i_unistd
7683eval $inhdr
7684
b4eb6b3d
JH
7685: determine which dynamic loading, if any, to compile in
7686echo " "
7687dldir="ext/DynaLoader"
7688case "$usedl" in
7689$define|y|true)
7690 dflt='y'
7691 usedl="$define"
7692 ;;
7693$undef|n|false)
7694 dflt='n'
7695 usedl="$undef"
7696 ;;
7697*)
7698 dflt='n'
7699 case "$d_dlopen" in
7700 $define) dflt='y' ;;
7701 esac
7702 case "$i_dld" in
7703 $define) dflt='y' ;;
7704 esac
7705 : Does a dl_xxx.xs file exist for this operating system
7706 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7707 ;;
7708esac
7709rp="Do you wish to use dynamic loading?"
7710. ./myread
7711usedl="$ans"
7712case "$ans" in
7713y*) usedl="$define"
7714 case "$dlsrc" in
7715 '')
7716 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7717 dflt="$dldir/dl_${osname}.xs"
7718 elif $test "$d_dlopen" = "$define" ; then
7719 dflt="$dldir/dl_dlopen.xs"
7720 elif $test "$i_dld" = "$define" ; then
7721 dflt="$dldir/dl_dld.xs"
7722 else
7723 dflt=''
7724 fi
7725 ;;
7726 *) dflt="$dldir/$dlsrc"
7727 ;;
7728 esac
7729 echo "The following dynamic loading files are available:"
7730 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7731 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7732 rp="Source file to use for dynamic loading"
7733 fn="fne"
7734 gfpth="$src"
7735 . ./getfile
7736 usedl="$define"
7737 : emulate basename
7738 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7739
7740 $cat << EOM
7741
7742Some systems may require passing special flags to $cc -c to
7743compile modules that will be used to create a shared library.
7744To use no flags, say "none".
7745
7746EOM
7747 case "$cccdlflags" in
7748 '') case "$gccversion" in
7749 '') case "$osname" in
7750 hpux) dflt='+z' ;;
7751 next) dflt='none' ;;
7752 irix*) dflt='-KPIC' ;;
48bcfe03 7753 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7754 sunos) dflt='-pic' ;;
7755 *) dflt='none' ;;
7756 esac
7757 ;;
7758 *) case "$osname" in
b6cc0f4c 7759 darwin) dflt='none' ;;
15fcae63 7760 linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7761 *) dflt='-fpic' ;;
7762 esac ;;
7763 esac ;;
7764 ' ') dflt='none' ;;
7765 *) dflt="$cccdlflags" ;;
7766 esac
7767 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7768 . ./myread
7769 case "$ans" in
7770 none) cccdlflags=' ' ;;
7771 *) cccdlflags="$ans" ;;
7772 esac
7773
7774 cat << EOM
7775
7776Some systems use ld to create libraries that can be dynamically loaded,
7777while other systems (such as those using ELF) use $cc.
7778
7779EOM
7780 case "$ld" in
55954f19 7781 '') $cat >try.c <<EOM
b4eb6b3d
JH
7782/* Test for whether ELF binaries are produced */
7783#include <fcntl.h>
55954f19
JH
7784#$i_stdlib I_STDLIB
7785#ifdef I_STDLIB
b4eb6b3d 7786#include <stdlib.h>
55954f19 7787#endif
4fb7dc7d
JH
7788#$i_unistd I_UNISTD
7789#ifdef I_UNISTD
7790#include <unistd.h>
7791#endif
b4eb6b3d
JH
7792int main() {
7793 char b[4];
7794 int i = open("a.out",O_RDONLY);
7795 if(i == -1)
7796 exit(1); /* fail */
7797 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7798 exit(0); /* succeed (yes, it's ELF) */
7799 else
7800 exit(1); /* fail */
7801}
7802EOM
5440bc8e 7803 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7804 cat <<EOM
7805You appear to have ELF support. I'll use $cc to build dynamic libraries.
7806EOM
7807 dflt="$cc"
7808 else
7809 echo "I'll use ld to build dynamic libraries."
7810 dflt='ld'
7811 fi
7812 rm -f try.c a.out
7813 ;;
7814 *) dflt="$ld"
7815 ;;
7816 esac
7817
7818 rp="What command should be used to create dynamic libraries?"
7819 . ./myread
7820 ld="$ans"
7821
7822 cat << EOM
7823
7824Some systems may require passing special flags to $ld to create a
7825library that can be dynamically loaded. If your ld flags include
7826-L/other/path options to locate libraries outside your loader's normal
7827search path, you may need to specify those -L options here as well. To
7828use no flags, say "none".
7829
7830EOM
7831 case "$lddlflags" in
7832 '') case "$osname" in
7833 beos) dflt='-nostart' ;;
7834 hpux) dflt='-b';
7835 case "$gccversion" in
7836 '') dflt="$dflt +vnocompatwarnings" ;;
7837 esac
7838 ;;
15fcae63 7839 linux|irix*|gnu*) dflt="-shared $optimize" ;;
b4eb6b3d
JH
7840 next) dflt='none' ;;
7841 solaris) dflt='-G' ;;
7842 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 7843 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
7844 *) dflt='none' ;;
7845 esac
7846 ;;
7847 *) dflt="$lddlflags" ;;
7848 esac
7849
7850 : Try to guess additional flags to pick up local libraries.
7851 : Be careful not to append to a plain 'none'
7852 case "$dflt" in
7853 none) dflt='' ;;
7854 esac
7855 for thisflag in $ldflags; do
7856 case "$thisflag" in
b5b9f165 7857 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
7858 case " $dflt " in
7859 *" $thisflag "*) ;;
7860 *) dflt="$dflt $thisflag" ;;
7861 esac
7862 ;;
7863 esac
7864 done
7865
7866 case "$dflt" in
7867 ''|' ') dflt='none' ;;
7868 esac
7869
7870 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7871 . ./myread
7872 case "$ans" in
7873 none) lddlflags=' ' ;;
7874 *) lddlflags="$ans" ;;
7875 esac
7876
7877 cat <<EOM
7878
7879Some systems may require passing special flags to $cc to indicate that
7880the resulting executable will use dynamic linking. To use no flags,
7881say "none".
7882
7883EOM
7884 case "$ccdlflags" in
7885 '') case "$osname" in
fb2e1bc0 7886 linux|hpux|gnu*) dflt='-Wl,-E' ;;
91fc0aa5
AH
7887 next|sunos) dflt='none' ;;
7888 *) dflt='none' ;;
b4eb6b3d
JH
7889 esac ;;
7890 ' ') dflt='none' ;;
7891 *) dflt="$ccdlflags" ;;
7892 esac
7893 rp="Any special flags to pass to $cc to use dynamic linking?"
7894 . ./myread
7895 case "$ans" in
7896 none) ccdlflags=' ' ;;
7897 *) ccdlflags="$ans" ;;
7898 esac
7899 ;;
7900*) usedl="$undef"
7901 ld='ld'
7902 dlsrc='dl_none.xs'
7903 lddlflags=''
7904 ccdlflags=''
7905 ;;
7906esac
7907
7908also=''
7909case "$usedl" in
7910$undef)
7911 # No dynamic loading being used, so don't bother even to prompt.
7912 useshrplib='false'
7913 ;;
7914*) case "$useshrplib" in
7915 '') case "$osname" in
48bcfe03 7916 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7917 dflt=y
7918 also='Building a shared libperl is required for dynamic loading to work on your system.'
7919 ;;
7920 next*)
7921 case "$osvers" in
7922 4*) dflt=y
7923 also='Building a shared libperl is needed for MAB support.'
7924 ;;
7925 *) dflt=n
7926 ;;
7927 esac
7928 ;;
7929 *) dflt=n
7930 ;;
7931 esac
7932 ;;
7933 $define|true|[Yy]*)
7934 dflt=y
7935 ;;
7936 *) dflt=n
7937 ;;
7938 esac
7939 $cat << EOM
7940
7941The perl executable is normally obtained by linking perlmain.c with
7942libperl${_a}, any static extensions (usually just DynaLoader), and
7943any other libraries needed on this system (such as -lm, etc.). Since
7944your system supports dynamic loading, it is probably possible to build
7945a shared libperl.$so. If you will have more than one executable linked
7946to libperl.$so, this will significantly reduce the size of each
5cadb3f3 7947executable, but it may have a noticeable effect on performance. The
b4eb6b3d
JH
7948default is probably sensible for your system.
7949$also
7950
7951EOM
7952 rp="Build a shared libperl.$so (y/n)"
7953 . ./myread
7954 case "$ans" in
7955 true|$define|[Yy]*)
7956 useshrplib='true' ;;
7957 *) useshrplib='false' ;;
7958 esac
7959 ;;
7960esac
7961
7962case "$useshrplib" in
7963true)
7964 case "$libperl" in
7965 '')
7966 # Figure out a good name for libperl.so. Since it gets stored in
7967 # a version-specific architecture-dependent library, the version
7968 # number isn't really that important, except for making cc/ld happy.
7969 #
7970 # A name such as libperl.so.3.1
7971 majmin="libperl.$so.$patchlevel.$subversion"
7972 # A name such as libperl.so.301
7973 majonly=`echo $patchlevel $subversion |
7974 $awk '{printf "%d%02d", $1, $2}'`
7975 majonly=libperl.$so.$majonly
7976 # I'd prefer to keep the os-specific stuff here to a minimum, and
7977 # rely on figuring it out from the naming of libc.
7978 case "${osname}${osvers}" in
7979 next4*)
7980 dflt=libperl.5.$so
7981 # XXX How handle the --version stuff for MAB?
7982 ;;
fb2e1bc0 7983 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
7984 dflt=libperl.$so
7985 ;;
b53432e4
GH
7986 cygwin*) # ld links against an importlib
7987 dflt=libperl$lib_ext
b4eb6b3d
JH
7988 ;;
7989 *) # Try to guess based on whether libc has major.minor.
7990 case "$libc" in
7991 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7992 *libc.$so.[0-9]*) dflt=$majonly ;;
7993 *) dflt=libperl.$so ;;
7994 esac
7995 ;;
7996 esac
7997 ;;
7998 *) dflt=$libperl
7999 ;;
8000 esac
8001 cat << EOM
8002
8003I need to select a good name for the shared libperl. If your system uses
8004library names with major and minor numbers, then you might want something
8005like $majmin. Alternatively, if your system uses a single version
8006number for shared libraries, then you might want to use $majonly.
8007Or, your system might be quite happy with a simple libperl.$so.
8008
8009Since the shared libperl will get installed into a version-specific
8010architecture-dependent directory, the version number of the shared perl
8011library probably isn't important, so the default should be o.k.
8012
8013EOM
8014 rp='What name do you want to give to the shared libperl?'
8015 . ./myread
8016 libperl=$ans
8017 echo "Ok, I'll use $libperl"
8018 ;;
8019*)
8020 libperl="libperl${_a}"
8021 ;;
8022esac
8023
8024# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8025case "$shrpdir" in
8026'') ;;
8027*) $cat >&4 <<EOM
8028WARNING: Use of the shrpdir variable for the installation location of
8029the shared $libperl is not supported. It was never documented and
8030will not work in this version. Let me (perlbug@perl.org)
8031know of any problems this may cause.
8032
8033EOM
8034 case "$shrpdir" in
8035 "$archlibexp/CORE")
8036 $cat >&4 <<EOM
8037But your current setting of $shrpdir is
8038the default anyway, so it's harmless.
8039EOM
8040 ;;
8041 *)
8042 $cat >&4 <<EOM
8043Further, your current attempted setting of $shrpdir
8044conflicts with the value of $archlibexp/CORE
8045that installperl will use.
8046EOM
8047 ;;
8048 esac
8049 ;;
8050esac
8051
8052# How will the perl executable find the installed shared $libperl?
8053# Add $xxx to ccdlflags.
8054# If we can't figure out a command-line option, use $shrpenv to
8055# set env LD_RUN_PATH. The main perl makefile uses this.
8056shrpdir=$archlibexp/CORE
8057xxx=''
8058tmp_shrpenv=''
8059if "$useshrplib"; then
8060 case "$osname" in
8061 aix)
8062 # We'll set it in Makefile.SH...
8063 ;;
b5b9f165 8064 solaris)
b4eb6b3d
JH
8065 xxx="-R $shrpdir"
8066 ;;
a774dfe6 8067 freebsd|netbsd|openbsd|interix|dragonfly)
b4eb6b3d
JH
8068 xxx="-Wl,-R$shrpdir"
8069 ;;
fb2e1bc0 8070 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
8071 xxx="-Wl,-rpath,$shrpdir"
8072 ;;
8073 next)
8074 # next doesn't like the default...
8075 ;;
8076 beos)
8077 # beos doesn't like the default, either.
8078 ;;
8079 hpux*)
8080 # hpux doesn't like the default, either.
8081 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8082 ;;
8083 *)
8084 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8085 ;;
8086 esac
8087 case "$xxx" in
8088 '') ;;
8089 *)
8090 # Only add $xxx if it isn't already in ccdlflags.
8091 case " $ccdlflags " in
8092 *" $xxx "*) ;;
8093 *) ccdlflags="$ccdlflags $xxx"
8094 cat <<EOM >&4
8095
8096Adding $xxx to the flags
8097passed to $ld so that the perl executable will find the
8098installed shared $libperl.
8099
8100EOM
8101 ;;
8102 esac
8103 ;;
8104 esac
8105fi
8106# Fix ccdlflags in AIX for building external extensions.
8107# (For building Perl itself bare -bE:perl.exp is needed,
8108# Makefile.SH takes care of this.)
8109case "$osname" in
8110aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8111esac
8112# Respect a hint or command-line value.
8113case "$shrpenv" in
8114'') shrpenv="$tmp_shrpenv" ;;
8115esac
8116case "$ldlibpthname" in
8117'') ldlibpthname=LD_LIBRARY_PATH ;;
8118none) ldlibpthname='' ;;
8119esac
8120
8121: determine where manual pages are on this system
8122echo " "
8123case "$sysman" in
8124'')
4a0a3829
SD
8125 syspath='/usr/share/man/man1 /usr/man/man1'
8126 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8127 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
8128 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8129 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8130 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8131 sysman=`./loc . /usr/man/man1 $syspath`
8132 ;;
8133esac
8134if $test -d "$sysman"; then
8135 echo "System manual is in $sysman." >&4
8136else
8137 echo "Could not find manual pages in source form." >&4
8138fi
8139
8140: determine where manual pages go
8141set man1dir man1dir none
8142eval $prefixit
8143$cat <<EOM
8144
8145$spackage has manual pages available in source form.
8146EOM
8147case "$nroff" in
8148nroff)
8149 echo "However, you don't have nroff, so they're probably useless to you."
8150 case "$man1dir" in
8151 '') man1dir="none";;
8152 esac;;
8153esac
8154echo "If you don't want the manual sources installed, answer 'none'."
8155case "$man1dir" in
8156' ') dflt=none
8157 ;;
8158'')
4a0a3829
SD
8159 lookpath="$prefixexp/share/man/man1"
8160 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
8161 lookpath="$lookpath $prefixexp/man/p_man/man1"
8162 lookpath="$lookpath $prefixexp/man/u_man/man1"
8163 lookpath="$lookpath $prefixexp/man/man.1"
8164 case "$sysman" in
8165 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8166 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8167 esac
8168 set dflt
8169 eval $prefixup
8170 ;;
8171*) dflt="$man1dir"
8172 ;;
8173esac
8174echo " "
8175fn=dn+~
8176rp="Where do the main $spackage manual pages (source) go?"
8177. ./getfile
8178if $test "X$man1direxp" != "X$ansexp"; then
8179 installman1dir=''
8180fi
79522dd2
NC
8181prefixvar=man1dir
8182. ./setprefixvar
8183
477140ee
NC
8184case "$man1dir" in
8185'') man1dir=' '
8186 installman1dir='';;
8187esac
b4eb6b3d
JH
8188
8189: What suffix to use on installed man pages
8190
8191case "$man1dir" in
8192' ')
8193 man1ext='0'
8194 ;;
8195*)
8196 rp="What suffix should be used for the main $spackage man pages?"
8197 case "$man1ext" in
8198 '') case "$man1dir" in
8199 *1) dflt=1 ;;
8200 *1p) dflt=1p ;;
8201 *1pm) dflt=1pm ;;
8202 *l) dflt=l;;
8203 *n) dflt=n;;
8204 *o) dflt=o;;
8205 *p) dflt=p;;
8206 *C) dflt=C;;
8207 *L) dflt=L;;
8208 *L1) dflt=L1;;
8209 *) dflt=1;;
8210 esac
8211 ;;
8212 *) dflt="$man1ext";;
8213 esac
8214 . ./myread
8215 man1ext="$ans"
8216 ;;
8217esac
8218
8219: see if we can have long filenames
8220echo " "
8221first=123456789abcdef
8222$rm -f $first
8223if (echo hi >$first) 2>/dev/null; then
8224 if $test -f 123456789abcde; then
8225 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8226 val="$undef"
8227 else
8228 echo 'You can have filenames longer than 14 characters.'>&4
8229 val="$define"
8230 fi
8231else
8232 $cat <<'EOM'
8233You can't have filenames longer than 14 chars.
8234You can't even think about them!
8235EOM
8236 val="$undef"
8237fi
8238set d_flexfnam
8239eval $setvar
8240$rm -rf 123456789abcde*
8241
8242: determine where library module manual pages go
8243set man3dir man3dir none
8244eval $prefixit
8245$cat <<EOM
8246
8247$spackage has manual pages for many of the library modules.
8248EOM
8249
8250case "$nroff" in
8251nroff)
8252 $cat <<'EOM'
8253However, you don't have nroff, so they're probably useless to you.
8254EOM
8255 case "$man3dir" in
8256 '') man3dir="none";;
8257 esac;;
8258esac
8259
8260case "$d_flexfnam" in
8261undef)
8262 $cat <<'EOM'
f3f1a2d8 8263However, your system can't handle the long file names like File::Basename.3.
b4eb6b3d
JH
8264EOM
8265 case "$man3dir" in
8266 '') man3dir="none";;
8267 esac;;
8268esac
8269
8270echo "If you don't want the manual sources installed, answer 'none'."
8271prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8272case "$man3dir" in
8273'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8274 if $test -d "$privlib/man/man3"; then
8275 cat <<EOM >&4
8276
8277WARNING: Previous versions of perl installed man3 pages into
f3f1a2d8
MB
8278$privlib/man/man3. This version will suggest a
8279new default of $dflt.
b4eb6b3d
JH
8280EOM
8281 tdflt=$dflt
8282 dflt='n'
8283 rp='Do you wish to preserve the old behavior?(y/n)'
8284 . ./myread
8285 case "$ans" in
8286 y*) dflt="$privlib/man/man3" ;;
8287 *) dflt=$tdflt ;;
8288 esac
8289 fi
8290 ;;
8291*) dflt="$man3dir" ;;
8292esac
8293case "$dflt" in
8294' ') dflt=none ;;
8295esac
8296echo " "
8297fn=dn+~
8298rp="Where do the $package library man pages (source) go?"
8299. ./getfile
79522dd2
NC
8300prefixvar=man3dir
8301. ./setprefixvar
8302
477140ee
NC
8303case "$man3dir" in
8304'') man3dir=' '
8305 installman3dir='';;
8306esac
b4eb6b3d
JH
8307
8308: What suffix to use on installed man pages
8309case "$man3dir" in
8310' ')
8311 man3ext='0'
8312 ;;
8313*)
8314 rp="What suffix should be used for the $package library man pages?"
8315 case "$man3ext" in
8316 '') case "$man3dir" in
8317 *3) dflt=3 ;;
8318 *3p) dflt=3p ;;
8319 *3pm) dflt=3pm ;;
8320 *l) dflt=l;;
8321 *n) dflt=n;;
8322 *o) dflt=o;;
8323 *p) dflt=p;;
8324 *C) dflt=C;;
8325 *L) dflt=L;;
8326 *L3) dflt=L3;;
8327 *) dflt=3;;
8328 esac
8329 ;;
8330 *) dflt="$man3ext";;
8331 esac
8332 . ./myread
8333 man3ext="$ans"
8334 ;;
8335esac
8336
8337: see if we have to deal with yellow pages, now NIS.
0384a54a 8338if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8339 if $test -f /usr/etc/nibindd; then
8340 echo " "
8341 echo "I'm fairly confident you're on a NeXT."
8342 echo " "
8343 rp='Do you get the hosts file via NetInfo?'
8344 dflt=y
8345 case "$hostcat" in
8346 nidump*) ;;
8347 '') ;;
8348 *) dflt=n;;
8349 esac
8350 . ./myread
8351 case "$ans" in
8352 y*) hostcat='nidump hosts .';;
8353 *) case "$hostcat" in
8354 nidump*) hostcat='';;
8355 esac
8356 ;;
8357 esac
8358 fi
8359 case "$hostcat" in
8360 nidump*) ;;
8361 *)
8362 case "$hostcat" in
8363 *ypcat*) dflt=y;;
8364 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8365 dflt=y
8366 else
8367 dflt=n
8368 fi;;
8369 *) dflt=n;;
8370 esac
8371 echo " "
8372 rp='Are you getting the hosts file via yellow pages?'
8373 . ./myread
8374 case "$ans" in
8375 y*) hostcat='ypcat hosts';;
8376 *) hostcat='cat /etc/hosts';;
8377 esac
8378 ;;
8379 esac
8380fi
8381case "$hostcat" in
8382'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8383esac
8384case "$groupcat" in
8385'') test -f /etc/group && groupcat='cat /etc/group';;
8386esac
8387case "$passcat" in
8388'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8389esac
8390
8391: now get the host name
8392echo " "
8393echo "Figuring out host name..." >&4
8394case "$myhostname" in
8395'') cont=true
8396 echo 'Maybe "hostname" will work...'
73614538 8397 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8398 myhostname=$tans
8399 phostname=hostname
8400 cont=''
8401 fi
8402 ;;
8403*) cont='';;
8404esac
8405if $test "$cont"; then
8406 if ./xenix; then
8407 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8408 if tans=`cat /etc/systemid 2>&1` ; then
8409 myhostname=$tans
8410 phostname='cat /etc/systemid'
8411 echo "Whadyaknow. Xenix always was a bit strange..."
8412 cont=''
8413 fi
8414 elif $test -r /etc/systemid; then
8415 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8416 fi
8417fi
8418if $test "$cont"; then
8419 echo 'No, maybe "uuname -l" will work...'
73614538 8420 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8421 myhostname=$tans
8422 phostname='uuname -l'
8423 else
8424 echo 'Strange. Maybe "uname -n" will work...'
73614538 8425 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8426 myhostname=$tans
8427 phostname='uname -n'
8428 else
8429 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8430 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8431 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8432 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8433 else
8434 case "$myhostname" in
8435 '') echo "Does this machine have an identity crisis or something?"
8436 phostname='';;
8437 *)
8438 echo "Well, you said $myhostname before..."
8439 phostname='echo $myhostname';;
8440 esac
8441 fi
8442 fi
8443 fi
8444fi
52a549d0
JH
8445case "$myhostname" in
8446'') myhostname=noname ;;
8447esac
b4eb6b3d
JH
8448: you do not want to know about this
8449set $myhostname
8450myhostname=$1
8451
8452: verify guess
8453if $test "$myhostname" ; then
8454 dflt=y
8455 rp='Your host name appears to be "'$myhostname'".'" Right?"
8456 . ./myread
8457 case "$ans" in
8458 y*) ;;
8459 *) myhostname='';;
8460 esac
8461fi
8462
8463: bad guess or no guess
8464while $test "X$myhostname" = X ; do
8465 dflt=''
8466 rp="Please type the (one word) name of your host:"
8467 . ./myread
8468 myhostname="$ans"
8469done
8470
8471: translate upper to lower if necessary
8472case "$myhostname" in
8473*[A-Z]*)
8474 echo "(Normalizing case in your host name)"
8475 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8476 ;;
8477esac
8478
8479case "$myhostname" in
8480*.*)
8481 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8482 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8483 echo "(Trimming domain name from host name--host name is now $myhostname)"
8484 ;;
8485*) case "$mydomain" in
8486 '')
8487 {
8488 test "X$hostcat" = "Xypcat hosts" &&
8489 ypmatch "$myhostname" hosts 2>/dev/null |\
8490 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8491 $test -s hosts
8492 } || {
8493 test "X$hostcat" != "X" &&
8494 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8495 /[ ]$myhostname[ . ]/p" > hosts
8496 }
8497 tmp_re="[ . ]"
f08cbdd1
PP
8498 if $test -f hosts; then
8499 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8500 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8501 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8502 hosts | $sort | $uniq | \
8503 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8504 case `$echo X$dflt` in
8505 X*\ *) echo "(Several hosts in the database matched hostname)"
8506 dflt=.
8507 ;;
8508 X.) echo "(You do not have fully-qualified names in the hosts database)"
8509 ;;
8510 esac
8511 else
8512 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8513 dflt=.
f08cbdd1 8514 fi
b4eb6b3d
JH
8515 case "$dflt" in
8516 .)
8517 tans=`./loc resolv.conf X /etc /usr/etc`
8518 if $test -f "$tans"; then
8519 echo "(Attempting domain name extraction from $tans)"
8520 dflt=.`$sed -n -e 's/ / /g' \
8521 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
8522 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8523 case "$dflt" in
8524 .) dflt=.`$sed -n -e 's/ / /g' \
8525 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
8526 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8527 ;;
8528 esac
8529 fi
8530 ;;
8531 esac
8532 case "$dflt" in
8533 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8534 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8535 case "$dflt" in
8536 '') dflt='.';;
8537 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8538 esac
8539 ;;
8540 esac
59c9e5d6
PP
8541 case "$dflt$osname" in
8542 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8543 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8544 ;;
8545 esac
b4eb6b3d
JH
8546 case "$dflt" in
8547 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8548 dflt='.nonet'
b4eb6b3d
JH
8549 ;;
8550 esac
8551 $rm -f hosts
8552 ;;
8553 *) dflt="$mydomain";;
8554 esac;;
8555esac
8556echo " "
8557rp="What is your domain name?"
8558. ./myread
8559tans="$ans"
8560case "$ans" in
8561'') ;;
8562.*) ;;
8563*) tans=".$tans";;
8564esac
8565mydomain="$tans"
8566
8567: translate upper to lower if necessary
8568case "$mydomain" in
8569*[A-Z]*)
8570 echo "(Normalizing case in your domain name)"
8571 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8572 ;;
8573esac
8574
8575: a little sanity check here
8576case "$phostname" in
8577'') ;;
8578*)
8579 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8580 $myhostname$mydomain|$myhostname) ;;
8581 *)
8582 case "$phostname" in
8583 sed*)
8584 echo "(That doesn't agree with your whoami.h file, by the way.)"
8585 ;;
8586 *)
8587 echo "(That doesn't agree with your $phostname command, by the way.)"
8588 ;;
8589 esac
8590 ;;
8591 esac
8592 ;;
8593esac
8594
8595$cat <<EOM
8596
8597I need to get your e-mail address in Internet format if possible, i.e.
8598something like user@host.domain. Please answer accurately since I have
8599no easy means to double check it. The default value provided below
8600is most probably close to reality but may not be valid from outside
8601your organization...
8602
8603EOM
8604cont=x
8605while test "$cont"; do
8606 case "$cf_email" in
8607 '') dflt="$cf_by@$myhostname$mydomain";;
8608 *) dflt="$cf_email";;
8609 esac
8610 rp='What is your e-mail address?'
8611 . ./myread
8612 cf_email="$ans"
8613 case "$cf_email" in
8614 *@*.*) cont='' ;;
8615 *)
8616 rp='Address does not look like an Internet one. Use it anyway?'
8617 case "$fastread" in
8618 yes) dflt=y ;;
8619 *) dflt=n ;;
8620 esac
8621 . ./myread
8622 case "$ans" in
8623 y*) cont='' ;;
8624 *) echo " " ;;
8625 esac
8626 ;;
8627 esac
8628done
8629
8630$cat <<EOM
8631
8632If you or somebody else will be maintaining perl at your site, please
8633fill in the correct e-mail address here so that they may be contacted
8634if necessary. Currently, the "perlbug" program included with perl
8635will send mail to this address in addition to perlbug@perl.org. You may
8636enter "none" for no administrator.
8637
8638EOM
8639case "$perladmin" in
8640'') dflt="$cf_email";;
8641*) dflt="$perladmin";;
8642esac
8643rp='Perl administrator e-mail address'
8644. ./myread
8645perladmin="$ans"
8646
674912d7
RB
8647: determine whether to only install version-specific parts.
8648echo " "
8649$cat <<EOM
8650Do you want to install only the version-specific parts of the perl
8651distribution? Usually you do *not* want to do this.
8652EOM
8653case "$versiononly" in
8654"$define"|[Yy]*|true) dflt='y' ;;
8655*) dflt='n';
8656esac
8657rp="Do you want to install only the version-specific parts of perl?"
8658. ./myread
8659case "$ans" in
8660[yY]*) val="$define";;
8661*) val="$undef" ;;
8662esac
8663set versiononly
8664eval $setvar
8665
ad493445
MB
8666case "$versiononly" in
8667"$define") inc_version_list=''
8668 inc_version_list_init=0
8669 ;;
8670esac
8671
b4eb6b3d 8672: figure out how to guarantee perl startup
d0e36aa9 8673: XXX Note that this currently takes advantage of the bug that binexp ignores
a2d23ec2
MB
8674: the Configure -Dinstallprefix setting, which in turn means that under
8675: relocatable @INC, initialinstalllocation is what binexp started as.
b4eb6b3d
JH
8676case "$startperl" in
8677'')
8678 case "$sharpbang" in
8679 *!)
8680 $cat <<EOH
8681
8682I can use the #! construct to start perl on your system. This will
8683make startup of perl scripts faster, but may cause problems if you
8684want to share those scripts and perl is not in a standard place
a2d23ec2
MB
8685($initialinstalllocation/perl) on all your platforms. The alternative
8686is to force a shell by starting the script with a single ':' character.
b4eb6b3d
JH
8687
8688EOH
674912d7 8689 case "$versiononly" in
a2d23ec2 8690 "$define") dflt="$initialinstalllocation/perl$version";;
d0e36aa9 8691 *) dflt="$initialinstalllocation/perl";;
674912d7 8692 esac
b4eb6b3d
JH
8693 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8694 . ./myread
8695 case "$ans" in
8696 none) startperl=": # use perl";;
8697 *) startperl="#!$ans"
8698 if $test 30 -lt `echo "$ans" | wc -c`; then
8699 $cat >&4 <<EOM
8700
8701WARNING: Some systems limit the #! command to 32 characters.
8702If you experience difficulty running Perl scripts with #!, try
8703installing Perl in a directory with a shorter pathname.
8704
8705EOM
8706 fi ;;
8707 esac
8708 ;;
8709 *) startperl=": # use perl"
8710 ;;
8711 esac
8712 ;;
8713esac
8714echo "I'll use $startperl to start perl scripts."
8715
8716: figure best path for perl in scripts
8717case "$perlpath" in
8718'')
5e20a8ca 8719 case "$versiononly" in
d0e36aa9
NC
8720 "$define") perlpath="$initialinstalllocation/perl$version";;
8721 *) perlpath="$initialinstalllocation/perl";;
5e20a8ca 8722 esac
b4eb6b3d
JH
8723 case "$startperl" in
8724 *!*) ;;
8725 *)
8726 $cat <<EOH
8727
8728I will use the "eval 'exec'" idiom to start Perl on your system.
8729I can use the full path of your Perl binary for this purpose, but
8730doing so may cause problems if you want to share those scripts and
d0e36aa9 8731Perl is not always in a standard place ($initialinstalllocation/perl).
b4eb6b3d
JH
8732
8733EOH
d0e36aa9 8734 dflt="$initialinstalllocation/perl"
b4eb6b3d
JH
8735 rp="What path shall I use in \"eval 'exec'\"?"
8736 . ./myread
8737 perlpath="$ans"
8738 ;;
8739 esac
8740 ;;
8741esac
8742case "$startperl" in
8743*!*) ;;
8744*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8745esac
8746
8747: determine where public executable scripts go
8748set scriptdir scriptdir
8749eval $prefixit
8750case "$scriptdir" in
8751'')
8752 dflt="$bin"
8753 : guess some guesses
8754 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8755 $test -d /usr/share/bin && dflt=/usr/share/bin
8756 $test -d /usr/local/script && dflt=/usr/local/script
8757 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8758 $test -d $prefixexp/script && dflt=$prefixexp/script
8759 set dflt
8760 eval $prefixup
8761 ;;
8762*) dflt="$scriptdir"
8763 ;;
8764esac
8765$cat <<EOM
f3f1a2d8 8766
b4eb6b3d
JH
8767Some installations have a separate directory just for executable scripts so
8768that they can mount it across multiple architectures but keep the scripts in
8769one spot. You might, for example, have a subdirectory of /usr/share for this.
8770Or you might just lump your scripts in with all your other executables.
f3f1a2d8 8771
b4eb6b3d
JH
8772EOM
8773fn=d~
8774rp='Where do you keep publicly executable scripts?'
8775. ./getfile
8776if $test "X$ansexp" != "X$scriptdirexp"; then
8777 installscript=''
8778fi
f3f1a2d8 8779installscriptdir=''
79522dd2
NC
8780prefixvar=scriptdir
8781. ./setprefixvar
8782: A little fix up for an irregularly named variable.
8783installscript="$installscriptdir"
8784
b4eb6b3d
JH
8785: determine where add-on public executables go
8786case "$sitebin" in
8787'') dflt=$siteprefix/bin ;;
8788*) dflt=$sitebin ;;
8789esac
8790fn=d~
8791rp='Pathname where the add-on public executables should be installed?'
8792. ./getfile
79522dd2
NC
8793prefixvar=sitebin
8794. ./setprefixvar
b4eb6b3d 8795
6e1038e0 8796: determine where add-on html pages go
8d2cbf27 8797: There is no standard location, so try to copy the previously-selected
6e1038e0 8798: directory structure for the core html pages.
8d2cbf27
JH
8799case "$sitehtml1dir" in
8800'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8801*) dflt=$sitehtml1dir ;;
6e1038e0
MB
8802esac
8803case "$dflt" in
8804''|' ') dflt=none ;;
8805esac
8806fn=dn+~
8807rp='Pathname where the site-specific html pages should be installed?'
8808. ./getfile
79522dd2
NC
8809prefixvar=sitehtml1dir
8810. ./setprefixvar
6e1038e0
MB
8811
8812: determine where add-on library html pages go
8813: There is no standard location, so try to copy the previously-selected
8814: directory structure for the core html pages.
8d2cbf27
JH
8815case "$sitehtml3dir" in
8816'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8817*) dflt=$sitehtml3dir ;;
6e1038e0
MB
8818esac
8819case "$dflt" in
8820''|' ') dflt=none ;;
8821esac
8822fn=dn+~
8823rp='Pathname where the site-specific library html pages should be installed?'
8824. ./getfile
79522dd2
NC
8825prefixvar=sitehtml3dir
8826. ./setprefixvar
6e1038e0
MB
8827
8828: determine where add-on manual pages go
91e123a8
JH
8829case "$siteman1dir" in
8830'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 8831*) dflt=$siteman1dir ;;
6e1038e0 8832esac
257059b5
JH
8833case "$dflt" in
8834''|' ') dflt=none ;;
8835esac
6e1038e0
MB
8836fn=dn+~
8837rp='Pathname where the site-specific manual pages should be installed?'
8838. ./getfile
79522dd2
NC
8839prefixvar=siteman1dir
8840. ./setprefixvar
6e1038e0
MB
8841
8842: determine where add-on library man pages go
91e123a8
JH
8843case "$siteman3dir" in
8844'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 8845*) dflt=$siteman3dir ;;
6e1038e0 8846esac
257059b5
JH
8847case "$dflt" in
8848''|' ') dflt=none ;;
8849esac
6e1038e0
MB
8850fn=dn+~
8851rp='Pathname where the site-specific library manual pages should be installed?'
8852. ./getfile
79522dd2
NC
8853prefixvar=siteman3dir
8854. ./setprefixvar
6e1038e0
MB
8855
8856: determine where add-on public executable scripts go
8857case "$sitescript" in
8858'') dflt=$siteprefix/script
8859 $test -d $dflt || dflt=$sitebin ;;
8860*) dflt="$sitescript" ;;
8861esac
8862fn=d~+
8863rp='Pathname where add-on public executable scripts should be installed?'
8864. ./getfile
79522dd2
NC
8865prefixvar=sitescript
8866. ./setprefixvar
6e1038e0 8867
15b61c98
JH
8868case "$usefaststdio" in
8869$define|true|[yY]*|'')
8870 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8871 case "$xversion" in
8872 [68]) dflt='y' ;;
8873 *) dflt='n' ;;
8874 esac
8875 ;;
8876*) dflt='n';;
8877esac
8878cat <<EOM
8879
8880Perl can be built to use 'fast stdio', which means using the stdio
8881library but also directly manipulating the stdio buffers to enable
8882faster I/O. Using stdio is better for backward compatibility (especially
8883for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8884interface has been preferred instead of stdio.
8885
8886If this doesn't make any sense to you, just accept the default '$dflt'.
8887EOM
8888rp='Use the "fast stdio" if available?'
8889. ./myread
8890case "$ans" in
8891y|Y) val="$define" ;;
8892*) val="$undef" ;;
8893esac
8894set usefaststdio
8895eval $setvar
8896
8897
96056487
JH
8898: define an is-a-typedef? function
8899typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8900case "$inclist" in
8901"") inclist="sys/types.h";;
8902esac;
8903eval "varval=\$$var";
8904case "$varval" in
8905"")
8906 $rm -f temp.c;
8907 for inc in $inclist; do
8908 echo "#include <$inc>" >>temp.c;
8909 done;
8910 echo "#ifdef $type" >> temp.c;
8911 echo "printf(\"We have $type\");" >> temp.c;
8912 echo "#endif" >> temp.c;
8913 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8914 if $contains $type temp.E >/dev/null 2>&1; then
8915 eval "$var=\$type";
8916 else
8917 eval "$var=\$def";
8918 fi;
8919 $rm -f temp.?;;
8920*) eval "$var=\$varval";;
8921esac'
8922
8923: define an is-a-typedef? function that prompts if the type is not available.
8924typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8925case "$inclist" in
8926"") inclist="sys/types.h";;
8927esac;
8928eval "varval=\$$var";
8929case "$varval" in
8930"")
8931 $rm -f temp.c;
8932 for inc in $inclist; do
8933 echo "#include <$inc>" >>temp.c;
8934 done;
8935 echo "#ifdef $type" >> temp.c;
8936 echo "printf(\"We have $type\");" >> temp.c;
8937 echo "#endif" >> temp.c;
8938 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8939 echo " " ;
8940 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8941 if $contains $type temp.E >/dev/null 2>&1; then
8942 echo "$type found." >&4;
8943 eval "$var=\$type";
8944 else
8945 echo "$type NOT found." >&4;
8946 dflt="$def";
8947 . ./myread ;
8948 eval "$var=\$ans";
8949 fi;
8950 $rm -f temp.?;;
8951*) eval "$var=\$varval";;
8952esac'
8953
8954: see what type lseek is declared as in the kernel
8955rp="What is the type used for lseek's offset on this system?"
8956set off_t lseektype long stdio.h sys/types.h
8957eval $typedef_ask
8958
8959echo " "
8960echo "Checking to see how big your file offsets are..." >&4
8961$cat >try.c <<EOCP
8962#include <sys/types.h>
8963#include <stdio.h>
8964int main()
8965{
8966 printf("%d\n", (int)sizeof($lseektype));
8967 return(0);
8968}
8969EOCP
8970set try
8971if eval $compile_ok; then
8972 lseeksize=`$run ./try`
8973 echo "Your file offsets are $lseeksize bytes long."
8974else
8975 dflt=$longsize
8976 echo " "
8977 echo "(I can't seem to compile the test program. Guessing...)"
8978 rp="What is the size of your file offsets (in bytes)?"
8979 . ./myread
8980 lseeksize="$ans"
8981fi
8982$rm -f try.c try
8983
8984: see what type file positions are declared as in the library
8985rp="What is the type for file position used by fsetpos()?"
8986set fpos_t fpostype long stdio.h sys/types.h
8987eval $typedef_ask
8988
8989echo " "
8990case "$fpostype" in
8991*_t) zzz="$fpostype" ;;
8992*) zzz="fpos_t" ;;
8993esac
8994echo "Checking the size of $zzz..." >&4
8995cat > try.c <<EOCP
8996#include <sys/types.h>
8997#include <stdio.h>
d1daaddf
JH
8998#$i_stdlib I_STDLIB
8999#ifdef I_STDLIB
9000#include <stdlib.h>
9001#endif
96056487
JH
9002int main() {
9003 printf("%d\n", (int)sizeof($fpostype));
9004 exit(0);
9005}
9006EOCP
9007set try
9008if eval $compile_ok; then
9009 yyy=`$run ./try`
9010 case "$yyy" in
9011 '') fpossize=4
9012 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9013 ;;
9014 *) fpossize=$yyy
9015 echo "Your $zzz is $fpossize bytes long."
9016 ;;
9017 esac
9018else
9019 dflt="$longsize"
9020 echo " " >&4
9021 echo "(I can't compile the test program. Guessing...)" >&4
9022 rp="What is the size of your file positions (in bytes)?"
9023 . ./myread
9024 fpossize="$ans"
9025fi
9026
96056487
JH
9027# Backward compatibility (uselfs is deprecated).
9028case "$uselfs" in
9029"$define"|true|[yY]*)
9030 cat <<EOM >&4
9031
9032*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9033EOM
9034 uselargefiles="$define"
9035 ;;
9036esac
9037
9038case "$lseeksize:$fpossize" in
90398:8) cat <<EOM
9040
9041You can have files larger than 2 gigabytes.
9042EOM
9043 val="$define" ;;
9044*) case "$uselargefiles" in
9045 "$undef"|false|[nN]*) dflt='n' ;;
9046 *) dflt='y' ;;
9047 esac
9048 cat <<EOM
9049
9050Perl can be built to understand large files (files larger than 2 gigabytes)
9051on some systems. To do so, Configure can be run with -Duselargefiles.
9052
9053If this doesn't make any sense to you, just accept the default '$dflt'.
9054EOM
9055 rp='Try to understand large files, if available?'
9056 . ./myread
9057 case "$ans" in
9058 y|Y) val="$define" ;;
9059 *) val="$undef" ;;
9060 esac
9061 ;;
9062esac
9063set uselargefiles
9064eval $setvar
96056487
JH
9065: Look for a hint-file generated 'call-back-unit'. If the
9066: user has specified that a large files perl is to be built,
9067: we may need to set or change some other defaults.
9da7673b
MB
9068if $test -f uselargefiles.cbu; then
9069 echo "Your platform has some specific hints regarding large file builds, using them..."
9070 . ./uselargefiles.cbu
9071fi
9072case "$uselargefiles" in
9073"$define")
96056487 9074 if $test -f uselargefiles.cbu; then
96056487
JH
9075 echo " "
9076 echo "Rechecking to see how big your file offsets are..." >&4
9077 $cat >try.c <<EOCP
9078#include <sys/types.h>
9079#include <stdio.h>
9080int main()
9081{
9082 printf("%d\n", (int)sizeof($lseektype));
9083 return(0);
9084}
9085EOCP
9086 set try
9087 if eval $compile_ok; then
9088 lseeksize=`$run ./try`
9089 $echo "Your file offsets are now $lseeksize bytes long."
9090 else
9091 dflt="$lseeksize"
9092 echo " "
9093 echo "(I can't seem to compile the test program. Guessing...)"
9094 rp="What is the size of your file offsets (in bytes)?"
9095 . ./myread
9096 lseeksize="$ans"
9097 fi
9098 case "$fpostype" in
9099 *_t) zzz="$fpostype" ;;
9100 *) zzz="fpos_t" ;;
9101 esac
9102 $echo $n "Rechecking the size of $zzz...$c" >&4
9103 $cat > try.c <<EOCP
9104#include <sys/types.h>
9105#include <stdio.h>
55954f19
JH
9106#$i_stdlib I_STDLIB
9107#ifdef I_STDLIB
9108#include <stdlib.h>
9109#endif
96056487
JH
9110int main() {
9111 printf("%d\n", (int)sizeof($fpostype));
073b6de5 9112 return(0);
96056487
JH
9113}
9114EOCP
9115 set try
9116 if eval $compile_ok; then
9117 yyy=`$run ./try`
9118 dflt="$lseeksize"
9119 case "$yyy" in
9120 '') echo " "
9121 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9122 ;;
9123 *) fpossize=$yyy
9124 echo " $fpossize bytes." >&4
9125 ;;
9126 esac
9127 else
9128 dflt="$fpossize"
9129 echo " "
9130 echo "(I can't compile the test program. Guessing...)" >&4
9131 rp="What is the size of your file positions (in bytes)?"
9132 . ./myread
9133 fpossize="$ans"
9134 fi
9135 $rm -f try.c try
9136 fi
9137 ;;
9138esac
9139
b4eb6b3d
JH
9140case "$vendorprefix" in
9141'') d_vendorbin="$undef"
9142 vendorbin=''
9143 vendorbinexp=''
9144 ;;
9145*) d_vendorbin="$define"
9146 : determine where vendor-supplied executables go.
9147 case "$vendorbin" in
9148 '') dflt=$vendorprefix/bin ;;
9149 *) dflt="$vendorbin" ;;
9150 esac
9151 fn=d~+
9152 rp='Pathname for the vendor-supplied executables directory?'
9153 . ./getfile
9154 vendorbin="$ans"
9155 vendorbinexp="$ansexp"
9156 ;;
9157esac
a092d240
NC
9158prefixvar=vendorbin
9159. ./installprefix
b4eb6b3d 9160
6e1038e0 9161case "$vendorprefix" in
8d2cbf27
JH
9162'') vendorhtml1dir=''
9163 vendorhtml1direxp=''
6e1038e0
MB
9164 ;;
9165*) : determine where vendor-supplied html pages go.
9166 : There is no standard location, so try to copy the previously-selected
9167 : directory structure for the core html pages.
9168 : XXX Better default suggestions would be welcome.
8d2cbf27 9169 case "$vendorhtml1dir" in
6e1038e0 9170 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9171 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9172 esac
9173 case "$dflt" in
9174 ''|' ') dflt=none ;;
9175 esac
9176 fn=dn+~
9177 rp='Pathname for the vendor-supplied html pages?'
9178 . ./getfile
8d2cbf27
JH
9179 vendorhtml1dir="$ans"
9180 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9181 ;;
9182esac
9183: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9184$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
a092d240
NC
9185prefixvar=vendorhtml1dir
9186. ./installprefix
6e1038e0
MB
9187
9188case "$vendorprefix" in
8d2cbf27
JH
9189'') vendorhtml3dir=''
9190 vendorhtml3direxp=''
6e1038e0
MB
9191 ;;
9192*) : determine where vendor-supplied module html pages go.
9193 : There is no standard location, so try to copy the previously-selected
9194 : directory structure for the core html pages.
9195 : XXX Better default suggestions would be welcome.
8d2cbf27 9196 case "$vendorhtml3dir" in
6e1038e0 9197 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9198 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9199 esac
9200 case "$dflt" in
9201 ''|' ') dflt=none ;;
9202 esac
9203 fn=dn+~
9204 rp='Pathname for the vendor-supplied html pages?'
9205 . ./getfile
8d2cbf27
JH
9206 vendorhtml3dir="$ans"
9207 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9208 ;;
9209esac
9210: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9211$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
a092d240
NC
9212prefixvar=vendorhtml3dir
9213. ./installprefix
6e1038e0
MB
9214
9215case "$vendorprefix" in
91e123a8
JH
9216'') vendorman1dir=''
9217 vendorman1direxp=''
6e1038e0
MB
9218 ;;
9219*) : determine where vendor-supplied manual pages go.
91e123a8 9220 case "$vendorman1dir" in
6e1038e0 9221 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9222 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9223 esac
9224 case "$dflt" in
9225 ''|' ') dflt=none ;;
9226 esac
9227 fn=nd~+
9228 rp='Pathname for the vendor-supplied manual section 1 pages?'
9229 . ./getfile
91e123a8
JH
9230 vendorman1dir="$ans"
9231 vendorman1direxp="$ansexp"
6e1038e0
MB
9232 ;;
9233esac
9234: Use ' ' for none so value is preserved next time through Configure
91e123a8 9235$test X"$vendorman1dir" = "X" && vendorman1dir=' '
a092d240
NC
9236prefixvar=vendorman1dir
9237. ./installprefix
6e1038e0
MB
9238
9239case "$vendorprefix" in
91e123a8
JH
9240'') vendorman3dir=''
9241 vendorman3direxp=''
6e1038e0
MB
9242 ;;
9243*) : determine where vendor-supplied module manual pages go.
91e123a8 9244 case "$vendorman3dir" in
6e1038e0 9245 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9246 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9247 esac
9248 case "$dflt" in
9249 ''|' ') dflt=none ;;
9250 esac
9251 fn=nd~+
9252 rp='Pathname for the vendor-supplied manual section 3 pages?'
9253 . ./getfile
91e123a8
JH
9254 vendorman3dir="$ans"
9255 vendorman3direxp="$ansexp"
6e1038e0
MB
9256 ;;
9257esac
9258: Use ' ' for none so value is preserved next time through Configure
91e123a8 9259$test X"$vendorman3dir" = "X" && vendorman3dir=' '
a092d240
NC
9260prefixvar=vendorman3dir
9261. ./installprefix
6e1038e0
MB
9262
9263case "$vendorprefix" in
9264'') d_vendorscript="$undef"
9265 vendorscript=''
9266 vendorscriptexp=''
9267 ;;
9268*) d_vendorscript="$define"
9269 : determine where vendor-supplied scripts go.
9270 case "$vendorscript" in
9271 '') dflt=$vendorprefix/script
9272 $test -d $dflt || dflt=$vendorbin ;;
9273 *) dflt="$vendorscript" ;;
9274 esac
9275 $cat <<EOM
9276
f3f1a2d8 9277The installation process will create a directory for
6e1038e0
MB
9278vendor-supplied scripts.
9279
9280EOM
9281 fn=d~+
9282 rp='Pathname for the vendor-supplied scripts directory?'
9283 . ./getfile
9284 vendorscript="$ans"
9285 vendorscriptexp="$ansexp"
9286 ;;
9287esac
a092d240
NC
9288prefixvar=vendorscript
9289. ./installprefix
6e1038e0 9290
b4eb6b3d
JH
9291: see if qgcvt exists
9292set qgcvt d_qgcvt
9293eval $inlibc
9294
89ce900e
JH
9295echo " "
9296
9297if $test X"$d_longdbl" = X"$define"; then
9298
9299echo "Checking how to print long doubles..." >&4
9300
9301if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9302 $cat >try.c <<'EOCP'
9303#include <sys/types.h>
9304#include <stdio.h>
9305int main() {
9306 double d = 123.456;
9307 printf("%.3f\n", d);
9308}
9309EOCP
9310 set try
9311 if eval $compile; then
9312 yyy=`$run ./try`
9313 case "$yyy" in
9314 123.456)
9315 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9316 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9317 echo "We will use %f."
9318 ;;
9319 esac
9320 fi
9321fi
9322
9323if $test X"$sPRIfldbl" = X; then
9324 $cat >try.c <<'EOCP'
9325#include <sys/types.h>
9326#include <stdio.h>
9327int main() {
9328 long double d = 123.456;
9329 printf("%.3Lf\n", d);
9330}
9331EOCP
9332 set try
9333 if eval $compile; then
9334 yyy=`$run ./try`
9335 case "$yyy" in
9336 123.456)
9337 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9338 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9339 echo "We will use %Lf."
9340 ;;
9341 esac
9342 fi
9343fi
9344
9345if $test X"$sPRIfldbl" = X; then
9346 $cat >try.c <<'EOCP'
9347#include <sys/types.h>
9348#include <stdio.h>
9349int main() {
9350 long double d = 123.456;
9351 printf("%.3llf\n", d);
9352}
9353EOCP
9354 set try
9355 if eval $compile; then
9356 yyy=`$run ./try`
9357 case "$yyy" in
9358 123.456)
9359 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9360 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9361 echo "We will use %llf."
9362 ;;
9363 esac
9364 fi
9365fi
9366
9367if $test X"$sPRIfldbl" = X; then
9368 $cat >try.c <<'EOCP'
9369#include <sys/types.h>
9370#include <stdio.h>
9371int main() {
9372 long double d = 123.456;
9373 printf("%.3lf\n", d);
9374}
9375EOCP
9376 set try
9377 if eval $compile; then
9378 yyy=`$run ./try`
9379 case "$yyy" in
9380 123.456)
9381 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9382 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9383 echo "We will use %lf."
9384 ;;
9385 esac
9386 fi
9387fi
9388
9389if $test X"$sPRIfldbl" = X; then
9390 echo "Cannot figure out how to print long doubles." >&4
9391else
9392 sSCNfldbl=$sPRIfldbl # expect consistency
9393fi
9394
9395$rm -f try try.*
9396
9397fi # d_longdbl
9398
9399case "$sPRIfldbl" in
9400'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9401 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9402 d_SCNfldbl="$undef";
9403 ;;
9404*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9405 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9406 d_SCNfldbl="$define";
9407 ;;
9408esac
9409
b4eb6b3d 9410: Check how to convert floats to strings.
a5b10d80
YST
9411
9412if test "X$d_Gconvert" = X; then
9413
b4eb6b3d
JH
9414echo " "
9415echo "Checking for an efficient way to convert floats to strings."
9416echo " " > try.c
9417case "$uselongdouble" in
9418"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9419esac
9420case "$d_longdbl" in
9421"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9422esac
9423case "$d_PRIgldbl" in
9424"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9425esac
9426$cat >>try.c <<EOP
9427#ifdef TRY_gconvert
9428#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9429char *myname = "gconvert";
9430#endif
9431#ifdef TRY_gcvt
9432#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9433char *myname = "gcvt";
9434#endif
9435#ifdef TRY_qgcvt
9436#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9437char *myname = "qgcvt";
9438#define DOUBLETYPE long double
9439#endif
9440#ifdef TRY_sprintf
a5b10d80
YST
9441#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9442#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9443#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9444#else
a5b10d80
YST
9445#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9446#endif
9447#else
b4eb6b3d
JH
9448#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9449#endif
9450char *myname = "sprintf";
9451#endif
9452
9453#ifndef DOUBLETYPE
9454#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9455#define DOUBLETYPE long double
9456#else
9457#define DOUBLETYPE double
9458#endif
9459#endif
9460
9461#include <stdio.h>
9462
9463#define I_STDLIB $i_stdlib
9464#ifdef I_STDLIB
9465#include <stdlib.h>
9466#endif
9467
9468int
9469checkit(expect, got)
9470char *expect;
9471char *got;
9472{
9473 if (strcmp(expect, got)) {
9474 printf("%s oddity: Expected %s, got %s\n",
9475 myname, expect, got);
9476 exit(1);
9477 }
9478}
9479
9480int main()
9481{
9482 char buf[64];
9483 buf[63] = '\0';
9484
9485 /* This must be 1st test on (which?) platform */
9486 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9487 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9488 checkit("0.1", buf);
9489
a5b10d80
YST
9490 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9491 checkit("0.01", buf);
9492
9493 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9494 checkit("0.001", buf);
9495
9496 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9497 checkit("0.0001", buf);
9498
9499 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9500 if (strlen(buf) > 5)
9501 checkit("9e-005", buf); /* for Microsoft ?? */
9502 else
9503 checkit("9e-05", buf);
9504
b4eb6b3d
JH
9505 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9506 checkit("1", buf);
9507
9508 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9509 checkit("1.1", buf);
9510
9511 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9512 checkit("1.01", buf);
9513
9514 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9515 checkit("1.001", buf);
9516
9517 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9518 checkit("1.0001", buf);
9519
9520 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9521 checkit("1.00001", buf);
9522
9523 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9524 checkit("1.000001", buf);
9525
9526 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9527 checkit("0", buf);
9528
9529 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9530 checkit("-1", buf);
9531
9532 /* Some Linux gcvt's give 1.e+5 here. */
9533 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9534 checkit("100000", buf);
9535
9536 /* Some Linux gcvt's give -1.e+5 here. */
9537 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9538 checkit("-100000", buf);
9539
9540 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9541 checkit("123.456", buf);
9542
ab6ca9f4 9543 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9544 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9545 /* 34 should be enough to scare even long double
9546 * places into using the e notation. */
ab6ca9f4 9547 if (strlen(buf) > 5)
94b339ad 9548 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9549 else
94b339ad 9550 checkit("1e+34", buf);
8e2a5ede 9551
d1eb8299
YST
9552 /* For Perl, if you add additional tests here, also add them to
9553 * t/base/num.t for benefit of platforms not using Configure or
9554 * overriding d_Gconvert */
9555
b4eb6b3d
JH
9556 exit(0);
9557}
9558EOP
ab6ca9f4 9559: first add preferred functions to our list
a5b10d80 9560xxx_list=""
ab6ca9f4 9561for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9562 case $xxx_convert in
9563 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9564 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
a5b10d80
YST
9565 esac
9566done
9567: then add any others
9568for xxx_convert in gconvert gcvt sprintf; do
9569 case "$xxx_list" in
9570 *$xxx_convert*) ;;
9571 *) xxx_list="$xxx_list $xxx_convert" ;;
9572 esac
9573done
9574
9575case "$d_longdbl$uselongdouble" in
9576"$define$define")
9577 : again, add prefered functions to our list first
9578 xxx_ld_list=""
ab6ca9f4 9579 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9580 case $xxx_convert in
9581 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9582 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9583 esac
9584 done
9585 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9586 for xxx_convert in qgcvt sprintf $xxx_list; do
9587 case "$xxx_ld_list" in
9588 $xxx_convert*|*" $xxx_convert"*) ;;
9589 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9590 esac
9591 done
9592 : if sprintf cannot do long doubles, move it to the end
9593 if test "$d_PRIgldbl" != "$define"; then
9594 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9595 fi
9596 : if no qgcvt, remove it
9597 if test "$d_qgcvt" != "$define"; then
9598 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9599 fi
9600 : use the ld_list
9601 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9602 ;;
9603esac
9604
9605for xxx_convert in $xxx_list; do
9606 echo "Trying $xxx_convert..."
9607 $rm -f try try$_o
9608 set try -DTRY_$xxx_convert
9609 if eval $compile; then
9610 echo "$xxx_convert() found." >&4
5440bc8e 9611 if $run ./try; then
b4eb6b3d
JH
9612 echo "I'll use $xxx_convert to convert floats into a string." >&4
9613 break;
9614 else
9615 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9616 xxx_convert=''
b4eb6b3d
JH
9617 fi
9618 else
9619 echo "$xxx_convert NOT found." >&4
9620 fi
9621done
ab6ca9f4 9622
a5b10d80
YST
9623if test X$xxx_convert = X; then
9624 echo "*** WHOA THERE!!! ***" >&4
9625 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9626 xxx_convert=sprintf
9627fi
9628
b4eb6b3d
JH
9629case "$xxx_convert" in
9630gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9631gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9632qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9633*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9634 "$define$define$define")
9635 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9636 "$define$define$undef")
9637 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9638 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9639 esac
9640 ;;
9641esac
9642
a5b10d80
YST
9643fi
9644
74cac757
JH
9645: see if _fwalk exists
9646set fwalk d__fwalk
9647eval $inlibc
9648
b4eb6b3d
JH
9649: Initialize h_fcntl
9650h_fcntl=false
9651
9652: Initialize h_sysfile
9653h_sysfile=false
9654
9655: access call always available on UNIX
9656set access d_access
9657eval $inlibc
9658
9659: locate the flags for 'access()'
9660case "$d_access" in
9661"$define")
9662 echo " "
55954f19 9663 $cat >access.c <<EOCP
b4eb6b3d
JH
9664#include <sys/types.h>
9665#ifdef I_FCNTL
9666#include <fcntl.h>
9667#endif
9668#ifdef I_SYS_FILE
9669#include <sys/file.h>
9670#endif
9671#ifdef I_UNISTD
9672#include <unistd.h>
9673#endif
55954f19
JH
9674#$i_stdlib I_STDLIB
9675#ifdef I_STDLIB
9676#include <stdlib.h>
9677#endif
b4eb6b3d
JH
9678int main() {
9679 exit(R_OK);
9680}
9681EOCP
9682 : check sys/file.h first, no particular reason here
9683 if $test `./findhdr sys/file.h` && \
7a282f6d 9684 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9685 h_sysfile=true;
9686 echo "<sys/file.h> defines the *_OK access constants." >&4
9687 elif $test `./findhdr fcntl.h` && \
7a282f6d 9688 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9689 h_fcntl=true;
9690 echo "<fcntl.h> defines the *_OK access constants." >&4
9691 elif $test `./findhdr unistd.h` && \
7a282f6d 9692 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9693 echo "<unistd.h> defines the *_OK access constants." >&4
9694 else
9695 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9696 fi
9697 ;;
9698esac
9699$rm -f access*
9700
9701: see if accessx exists
9702set accessx d_accessx
9703eval $inlibc
9704
89ce900e
JH
9705: see if aintl exists
9706set aintl d_aintl
9707eval $inlibc
9708
b4eb6b3d
JH
9709: see if alarm exists
9710set alarm d_alarm
9711eval $inlibc
9712
a9dade78
JH
9713: see if POSIX threads are available
9714set pthread.h i_pthread
9715eval $inhdr
9716
10bc17b6
JH
9717: define a fucntion to check prototypes
9718$cat > protochk <<EOSH
9719$startsh
9720cc="$cc"
9721optimize="$optimize"
9722ccflags="$ccflags"
9723prototype="$prototype"
9724define="$define"
9725rm=$rm
a9dade78
JH
9726usethreads=$usethreads
9727i_pthread=$i_pthread
9728pthread_h_first=$pthread_h_first
10bc17b6
JH
9729EOSH
9730
9731$cat >> protochk <<'EOSH'
9732
9733$rm -f try.c
9734foo="$1"
9735shift
9736while test $# -ge 2; do
9737 case "$1" in
9738 $define) echo "#include <$2>" >> try.c ;;
9739 literal) echo "$2" >> try.c ;;
9740 esac
cce6a207
MB
9741 # Extra magic for the benefit of systems that need pthread.h
9742 # to be included early to correctly detect threadsafe functions.
9743 # Such functions must guarantee themselves, though, that the usethreads
9744 # and i_pthread have been defined, before calling protochk.
9745 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9746 echo "#include <pthread.h>" >> try.c
9747 pthread_h_done=yes
9748 fi
10bc17b6
JH
9749 shift 2
9750done
9751test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
9752cat >> try.c <<'EOCP'
9753#ifdef CAN_PROTOTYPE
9754#define _(args) args
9755#else
9756#define _(args) ()
9757#endif
9758EOCP
9759echo "$foo" >> try.c
9760echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9761$cc $optimize $ccflags -c try.c > /dev/null 2>&1
9762status=$?
9763$rm -f try.[co]
9764exit $status
9765EOSH
9766chmod +x protochk
9767$eunicefix protochk
9768
89ce900e
JH
9769hasproto='varname=$1; func=$2; shift; shift;
9770while $test $# -ge 2; do
9771 case "$1" in
9772 $define) echo "#include <$2>";;
9773 esac ;
9774 shift 2;
9775done > try.c;
9776$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9777if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9778 echo "$func() prototype found.";
9779 val="$define";
9780else
9781 echo "$func() prototype NOT found.";
9782 val="$undef";
9783fi;
9784set $varname;
9785eval $setvar;
9786$rm -f try.c tryout.c'
9787
10bc17b6
JH
9788: see if sys/types.h has to be included
9789set sys/types.h i_systypes
9790eval $inhdr
9791
9792: see if sys/select.h has to be included
9793set sys/select.h i_sysselct
9794eval $inhdr
9795
9796hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9797while $test $# -ge 2; do
9798 case "$1" in
9799 $define) echo "#include <$2>";;
9800 esac ;
9801 shift 2;
9802done > try.c;
9803echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9804set try;
9805if eval $compile; then
9806 val="$define";
9807else
9808 val="$undef";
9809fi;
9810set $varname;
9811eval $setvar;
9812$rm -f try.c try.o'
9813
9814: see if we should include time.h, sys/time.h, or both
9815echo " "
9816if test "X$timeincl" = X; then
9817 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9818 $echo $n "I'm now running the test program...$c"
55954f19 9819 $cat >try.c <<EOCP
10bc17b6
JH
9820#include <sys/types.h>
9821#ifdef I_TIME
9822#include <time.h>
9823#endif
9824#ifdef I_SYSTIME
9825#ifdef SYSTIMEKERNEL
9826#define KERNEL
9827#endif
9828#include <sys/time.h>
9829#endif
9830#ifdef I_SYSSELECT
9831#include <sys/select.h>
9832#endif
55954f19
JH
9833#$i_stdlib I_STDLIB
9834#ifdef I_STDLIB
9835#include <stdlib.h>
9836#endif
10bc17b6
JH
9837int main()
9838{
9839 struct tm foo;
9840#ifdef S_TIMEVAL
9841 struct timeval bar;
9842#endif
9843#ifdef S_TIMEZONE
9844 struct timezone tzp;
9845#endif
9846 if (foo.tm_sec == foo.tm_sec)
9847 exit(0);
9848#ifdef S_TIMEVAL
9849 if (bar.tv_sec == bar.tv_sec)
9850 exit(0);
9851#endif
9852 exit(1);
9853}
9854EOCP
9855 flags=''
9856 for s_timezone in '-DS_TIMEZONE' ''; do
9857 sysselect=''
9858 for s_timeval in '-DS_TIMEVAL' ''; do
9859 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9860 for i_time in '' '-DI_TIME'; do
9861 for i_systime in '-DI_SYSTIME' ''; do
9862 case "$flags" in
9863 '') $echo $n ".$c"
9864 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9865 if eval $compile; then
9866 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9867 shift
9868 flags="$*"
9869 echo " "
9870 $echo $n "Succeeded with $flags$c"
9871 fi
9872 ;;
9873 esac
9874 done
9875 done
9876 done
9877 done
9878 done
9879 timeincl=''
9880 echo " "
9881 case "$flags" in
9882 *SYSTIMEKERNEL*) i_systimek="$define"
9883 timeincl=`./findhdr sys/time.h`
9884 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9885 *) i_systimek="$undef";;
9886 esac
9887 case "$flags" in
9888 *I_TIME*) i_time="$define"
9889 timeincl=`./findhdr time.h`" $timeincl"
9890 echo "We'll include <time.h>." >&4;;
9891 *) i_time="$undef";;
9892 esac
9893 case "$flags" in
9894 *I_SYSTIME*) i_systime="$define"
9895 timeincl=`./findhdr sys/time.h`" $timeincl"
9896 echo "We'll include <sys/time.h>." >&4;;
9897 *) i_systime="$undef";;
9898 esac
9899 $rm -f try.c try
9900fi
9901: see if struct tm knows about tm_zone
9902case "$i_systime$i_time" in
9903*$define*)
9904 echo " "
9905 echo "Checking to see if your struct tm has tm_zone field..." >&4
9906 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9907 eval $hasfield
9908 ;;
9909*) val="$undef"
9910 set d_tm_tm_zone
9911 eval $setvar
9912 ;;
9913esac
9914case "$d_tm_tm_zone" in
9915"$define") echo "Yes, it does." ;;
9916*) echo "No, it doesn't." ;;
9917esac
9918: see if struct tm knows about tm_gmtoff
9919case "$i_systime$i_time" in
9920*$define*)
9921 echo " "
9922 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9923 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9924 eval $hasfield
9925 ;;
9926*) val="$undef"
9927 set d_tm_tm_gmtoff
9928 eval $setvar
9929 ;;
9930esac
9931case "$d_tm_tm_gmtoff" in
9932"$define") echo "Yes, it does." ;;
9933*) echo "No, it doesn't." ;;
9934esac
9935
9936: see if asctime_r exists
9937set asctime_r d_asctime_r
9938eval $inlibc
9939case "$d_asctime_r" in
9940"$define")
d63eadf0 9941 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
9942 case "$d_asctime_r_proto:$usethreads" in
9943 ":define") d_asctime_r_proto=define
a48ec845
JH
9944 set d_asctime_r_proto asctime_r $hdrs
9945 eval $hasproto ;;
9946 *) ;;
9947 esac
9948 case "$d_asctime_r_proto" in
9949 define)
10bc17b6
JH
9950 case "$asctime_r_proto" in
9951 ''|0) try='char* asctime_r(const struct tm*, char*);'
9952 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9953 esac
9954 case "$asctime_r_proto" in
9955 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9956 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9957 esac
9958 case "$asctime_r_proto" in
9959 ''|0) try='int asctime_r(const struct tm*, char*);'
9960 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9961 esac
9962 case "$asctime_r_proto" in
9963 ''|0) try='int asctime_r(const struct tm*, char*, int);'
9964 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9965 esac
9966 case "$asctime_r_proto" in
90e831dc 9967 ''|0) d_asctime_r=undef
10bc17b6 9968 asctime_r_proto=0
a48ec845 9969 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
9970 * ) case "$asctime_r_proto" in
9971 REENTRANT_PROTO*) ;;
9972 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9973 esac
9974 echo "Prototype: $try" ;;
9975 esac
9976 ;;
c18e646a
JH
9977 *) case "$usethreads" in
9978 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9979 esac
90e831dc
SB
9980 d_asctime_r=undef
9981 asctime_r_proto=0
c18e646a 9982 ;;
a48ec845
JH
9983 esac
9984 ;;
10bc17b6
JH
9985*) asctime_r_proto=0
9986 ;;
9987esac
9988
b4eb6b3d
JH
9989: see if atolf exists
9990set atolf d_atolf
9991eval $inlibc
9992
9993: see if atoll exists
9994set atoll d_atoll
9995eval $inlibc
9996
0dbb1585
AL
9997: Look for GCC-style attribute format
9998case "$d_attribute_format" in
bde30f85 9999'')
b4eb6b3d 10000echo " "
0dbb1585 10001echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
b4eb6b3d
JH
10002$cat >attrib.c <<'EOCP'
10003#include <stdio.h>
0dbb1585 10004void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
b4eb6b3d
JH
10005EOCP
10006if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10007 if $contains 'warning' attrib.out >/dev/null 2>&1; then
0dbb1585 10008 echo "Your C compiler doesn't support __attribute__((format))."
b4eb6b3d
JH
10009 val="$undef"
10010 else
0dbb1585 10011 echo "Your C compiler supports __attribute__((format))."
b4eb6b3d
JH
10012 val="$define"
10013 fi
10014else
10015 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10016 val="$undef"
10017fi
bde30f85 10018;;
0dbb1585 10019*) val="$d_attribute_format" ;;
bde30f85 10020esac
0dbb1585
AL
10021set d_attribute_format
10022eval $setvar
10023$rm -f attrib*
10024
dcb594bc
MB
10025: Look for GCC-style attribute format with null format allowed
10026case "$d_printf_format_null" in
10027'') case "$d_attribute_format" in
10028 $define)
10029 echo " "
10030 echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10031$cat >attrib.c <<EOCP
10032#include <stdio.h>
10033#$i_stdlib I_STDLIB
10034#ifdef I_STDLIB
10035#include <stdlib.h>
10036#endif
10037int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10038int null_printf (char* pat,...) { return (int)pat; }
10039int main () { exit(null_printf(NULL)); }
10040EOCP
10041 if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10042 : run the executable in case it produces a run-time warning
10043 if $run ./attrib >>attrib.out 2>&1; then
10044 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10045 echo "Your C compiler doesn't allow __printf__ format to be null."
10046 val="$undef"
10047 else
10048 echo "Your C compiler allows __printf__ format to be null."
10049 val="$define"
10050 fi
10051 else
10052 echo "Your C compiler executable failed with __printf__ format null."
10053 val="$undef"
10054 fi
10055 else
10056 echo "Your C compiler fails with __printf__ format null."
10057 val="$undef"
10058 fi
10059 ;;
10060 *) val="$undef" ;;
10061 esac
10062;;
10063*) val="$d_printf_format_null" ;;
10064esac
10065set d_printf_format_null
10066eval $setvar
10067$rm -f attrib*
10068
0dbb1585
AL
10069: Look for GCC-style attribute malloc
10070case "$d_attribute_malloc" in
10071'')
10072echo " "
10073echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10074$cat >attrib.c <<'EOCP'
10075#include <stdio.h>
10076char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10077EOCP
10078if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10079 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10080 echo "Your C compiler doesn't support __attribute__((malloc))."
10081 val="$undef"
10082 else
10083 echo "Your C compiler supports __attribute__((malloc))."
10084 val="$define"
10085 fi
10086else
10087 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10088 val="$undef"
10089fi
10090;;
10091*) val="$d_attribute_malloc" ;;
10092esac
10093set d_attribute_malloc
10094eval $setvar
10095$rm -f attrib*
10096
10097: Look for GCC-style attribute nonnull
10098case "$d_attribute_nonnull" in
10099'')
10100echo " "
10101echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10102$cat >attrib.c <<'EOCP'
10103#include <stdio.h>
10104void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10105EOCP
10106if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10107 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10108 echo "Your C compiler doesn't support __attribute__((nonnull))."
10109 val="$undef"
10110 else
10111 echo "Your C compiler supports __attribute__((nonnull))."
10112 val="$define"
10113 fi
10114else
10115 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10116 val="$undef"
10117fi
10118;;
10119*) val="$d_attribute_nonnull" ;;
10120esac
10121set d_attribute_nonnull
10122eval $setvar
10123$rm -f attrib*
10124
10125: Look for GCC-style attribute noreturn
10126case "$d_attribute_noreturn" in
10127'')
10128echo " "
10129echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10130$cat >attrib.c <<'EOCP'
10131#include <stdio.h>
10132void fall_over_dead( void ) __attribute__((noreturn));
10133EOCP
10134if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10135 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10136 echo "Your C compiler doesn't support __attribute__((noreturn))."
10137 val="$undef"
10138 else
10139 echo "Your C compiler supports __attribute__((noreturn))."
10140 val="$define"
10141 fi
10142else
10143 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10144 val="$undef"
10145fi
10146;;
10147*) val="$d_attribute_noreturn" ;;
10148esac
10149set d_attribute_noreturn
10150eval $setvar
10151$rm -f attrib*
10152
10153: Look for GCC-style attribute pure
10154case "$d_attribute_pure" in
10155'')
10156echo " "
10157echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10158$cat >attrib.c <<'EOCP'
10159#include <stdio.h>
10160int square( int n ) __attribute__((pure));
10161EOCP
10162if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10163 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10164 echo "Your C compiler doesn't support __attribute__((pure))."
10165 val="$undef"
10166 else
10167 echo "Your C compiler supports __attribute__((pure))."
10168 val="$define"
10169 fi
10170else
10171 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10172 val="$undef"
10173fi
10174;;
10175*) val="$d_attribute_pure" ;;
10176esac
10177set d_attribute_pure
10178eval $setvar
10179$rm -f attrib*
10180
10181: Look for GCC-style attribute unused
10182case "$d_attribute_unused" in
10183'')
10184echo " "
10185echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10186$cat >attrib.c <<'EOCP'
10187#include <stdio.h>
10188int do_something( int dummy __attribute__((unused)), int n );
10189EOCP
10190if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10191 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10192 echo "Your C compiler doesn't support __attribute__((unused))."
10193 val="$undef"
10194 else
10195 echo "Your C compiler supports __attribute__((unused))."
10196 val="$define"
10197 fi
10198else
10199 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10200 val="$undef"
10201fi
10202;;
10203*) val="$d_attribute_unused" ;;
10204esac
10205set d_attribute_unused
10206eval $setvar
10207$rm -f attrib*
10208
10209: Look for GCC-style attribute warn_unused_result
10210case "$d_attribute_warn_unused_result" in
10211'')
10212echo " "
10213echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10214$cat >attrib.c <<'EOCP'
10215#include <stdio.h>
10216int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10217EOCP
10218if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10219 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10220 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10221 val="$undef"
10222 else
10223 echo "Your C compiler supports __attribute__((warn_unused_result))."
10224 val="$define"
10225 fi
10226else
10227 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10228 val="$undef"
10229fi
10230;;
10231*) val="$d_attribute_warn_unused_result" ;;
10232esac
10233set d_attribute_warn_unused_result
b4eb6b3d
JH
10234eval $setvar
10235$rm -f attrib*
10236
10237: see if bcmp exists
10238set bcmp d_bcmp
10239eval $inlibc
10240
10241: see if bcopy exists
10242set bcopy d_bcopy
10243eval $inlibc
10244
b4eb6b3d
JH
10245: see if getpgrp exists
10246set getpgrp d_getpgrp
10247eval $inlibc
10248
10249case "$d_getpgrp" in
10250"$define")
10251 echo " "
10252 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 10253 $cat >try.c <<EOP
b4eb6b3d
JH
10254#$i_unistd I_UNISTD
10255#include <sys/types.h>
10256#ifdef I_UNISTD
10257# include <unistd.h>
10258#endif
55954f19
JH
10259#$i_stdlib I_STDLIB
10260#ifdef I_STDLIB
10261#include <stdlib.h>
10262#endif
b4eb6b3d
JH
10263int main()
10264{
10265 if (getuid() == 0) {
10266 printf("(I see you are running Configure as super-user...)\n");
10267 setuid(1);
10268 }
10269#ifdef TRY_BSD_PGRP
10270 if (getpgrp(1) == 0)
10271 exit(0);
10272#else
10273 if (getpgrp() > 0)
10274 exit(0);
10275#endif
10276 exit(1);
10277}
10278EOP
5440bc8e 10279 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10280 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10281 val="$define"
5440bc8e 10282 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10283 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10284 val="$undef"
10285 else
10286 echo "I can't seem to compile and run the test program."
10287 if ./usg; then
10288 xxx="a USG one, i.e. you use getpgrp()."
10289 else
10290 # SVR4 systems can appear rather BSD-ish.
10291 case "$i_unistd" in
10292 $undef)
10293 xxx="a BSD one, i.e. you use getpgrp(pid)."
10294 val="$define"
10295 ;;
10296 $define)
10297 xxx="probably a USG one, i.e. you use getpgrp()."
10298 val="$undef"
10299 ;;
10300 esac
10301 fi
10302 echo "Assuming your getpgrp is $xxx" >&4
10303 fi
10304 ;;
10305*) val="$undef";;
10306esac
10307set d_bsdgetpgrp
10308eval $setvar
5440bc8e 10309$rm -f try try.*
b4eb6b3d
JH
10310
10311: see if setpgrp exists
10312set setpgrp d_setpgrp
10313eval $inlibc
10314
10315case "$d_setpgrp" in
10316"$define")
10317 echo " "
10318 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 10319 $cat >try.c <<EOP
b4eb6b3d
JH
10320#$i_unistd I_UNISTD
10321#include <sys/types.h>
10322#ifdef I_UNISTD
10323# include <unistd.h>
10324#endif
55954f19
JH
10325#$i_stdlib I_STDLIB
10326#ifdef I_STDLIB
10327#include <stdlib.h>
10328#endif
b4eb6b3d
JH
10329int main()
10330{
10331 if (getuid() == 0) {
10332 printf("(I see you are running Configure as super-user...)\n");
10333 setuid(1);
10334 }
10335#ifdef TRY_BSD_PGRP
10336 if (-1 == setpgrp(1, 1))
10337 exit(0);
10338#else
10339 if (setpgrp() != -1)
10340 exit(0);
10341#endif
10342 exit(1);
10343}
10344EOP
5440bc8e 10345 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10346 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10347 val="$define"
5440bc8e 10348 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10349 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10350 val="$undef"
10351 else
10352 echo "(I can't seem to compile and run the test program.)"
10353 if ./usg; then
10354 xxx="a USG one, i.e. you use setpgrp()."
10355 else
10356 # SVR4 systems can appear rather BSD-ish.
10357 case "$i_unistd" in
10358 $undef)
10359 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10360 val="$define"
10361 ;;
10362 $define)
10363 xxx="probably a USG one, i.e. you use setpgrp()."
10364 val="$undef"
10365 ;;
10366 esac
10367 fi
10368 echo "Assuming your setpgrp is $xxx" >&4
10369 fi
10370 ;;
10371*) val="$undef";;
10372esac
10373set d_bsdsetpgrp
10374eval $setvar
5440bc8e 10375$rm -f try try.*
635aebb7
AL
10376: Look for GCC-style __builtin_choose_expr
10377case "$d_builtin_choose_expr" in
10378'')
10379 echo " "
10380 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10381 $cat >try.c <<'EOCP'
10382#include <assert.h>
10383#include <stdlib.h>
10384#include <stdio.h>
10385
10386#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10387
10388int main(void) {
10389 assert( SYRINX(1) == 2112 );
10390 assert( SYRINX(1) != 5150 );
10391 assert( SYRINX(0) == 5150 );
10392 assert( SYRINX(0) != 2112 );
10393 puts( "All good!" );
10394 exit(0);
10395}
10396
10397EOCP
10398 set try
10399 if eval $compile; then
10400 echo "Your C compiler supports __builtin_choose_expr."
10401 val="$define"
10402 else
10403 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10404 val="$undef"
10405 fi
10406;;
10407*) val="$d_builtin_choose_expr" ;;
10408esac
10409
10410set d_builtin_choose_expr
10411eval $setvar
10412$rm -f try.* try core core.try.*
10413
10414: Look for GCC-style __builtin_expect
10415case "$d_builtin_expect" in
10416'')
10417 echo " "
10418 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10419 $cat >builtin.c <<'EOCP'
10420int main(void) {
10421 int n = 50;
10422 if ( __builtin_expect(n, 0) ) n = 1;
10423}
10424EOCP
10425 set try
10426 if eval $compile; then
10427 echo "Your C compiler supports __builtin_choose_expr."
10428 val="$define"
10429 else
10430 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10431 val="$undef"
10432 fi
10433 ;;
10434*) val="$d_builtin_expect" ;;
10435esac
10436
10437set d_builtin_expect
10438eval $setvar
10439$rm -f try.* try core core.try.*
10440
b4eb6b3d
JH
10441: see if bzero exists
10442set bzero d_bzero
10443eval $inlibc
10444
a2d23ec2
MB
10445: see if stdarg is available
10446echo " "
10447if $test `./findhdr stdarg.h`; then
10448 echo "<stdarg.h> found." >&4
10449 valstd="$define"
10450else
10451 echo "<stdarg.h> NOT found." >&4
10452 valstd="$undef"
10453fi
10454
10455: see if varags is available
10456echo " "
10457if $test `./findhdr varargs.h`; then
10458 echo "<varargs.h> found." >&4
10459else
10460 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10461fi
10462
10463: set up the varargs testing programs
10464$cat > varargs.c <<EOP
10465#ifdef I_STDARG
10466#include <stdarg.h>
10467#endif
10468#ifdef I_VARARGS
10469#include <varargs.h>
10470#endif
10471
10472#ifdef I_STDARG
10473int f(char *p, ...)
10474#else
10475int f(va_alist)
10476va_dcl
10477#endif
10478{
10479 va_list ap;
10480#ifndef I_STDARG
10481 char *p;
10482#endif
10483#ifdef I_STDARG
10484 va_start(ap,p);
10485#else
10486 va_start(ap);
10487 p = va_arg(ap, char *);
10488#endif
10489 va_end(ap);
4fb7dc7d 10490 return 0;
a2d23ec2
MB
10491}
10492EOP
10493$cat > varargs <<EOP
10494$startsh
10495if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10496 echo "true"
10497else
10498 echo "false"
10499fi
10500$rm -f varargs$_o
10501EOP
10502chmod +x varargs
10503
10504: now check which varargs header should be included
10505echo " "
10506i_varhdr=''
10507case "$valstd" in
10508"$define")
10509 if `./varargs I_STDARG`; then
10510 val='stdarg.h'
10511 elif `./varargs I_VARARGS`; then
10512 val='varargs.h'
10513 fi
10514 ;;
10515*)
10516 if `./varargs I_VARARGS`; then
10517 val='varargs.h'
10518 fi
10519 ;;
10520esac
10521case "$val" in
10522'')
10523echo "I could not find the definition for va_dcl... You have problems..." >&4
10524 val="$undef"; set i_stdarg; eval $setvar
10525 val="$undef"; set i_varargs; eval $setvar
10526 ;;
10527*)
10528 set i_varhdr
10529 eval $setvar
10530 case "$i_varhdr" in
10531 stdarg.h)
10532 val="$define"; set i_stdarg; eval $setvar
10533 val="$undef"; set i_varargs; eval $setvar
10534 ;;
10535 varargs.h)
10536 val="$undef"; set i_stdarg; eval $setvar
10537 val="$define"; set i_varargs; eval $setvar
10538 ;;
10539 esac
10540 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10541esac
10542$rm -f varargs*
10543
10544: see if the Compiler supports C99 variadic macros
10545case "$i_stdarg$i_stdlib" in
10546 "$define$define")
10547 echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10548 $cat >try.c <<EOCP
10549#include <stdio.h>
10550#include <stdarg.h>
10551
10552#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10553
10554int main() {
10555 char buf[20];
10556 foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10557 puts(buf);
10558 return 0;
10559}
10560EOCP
10561 set try
10562 if eval $compile && $run ./try 2>&1 >/dev/null; then
10563 case "`$run ./try`" in
10564 "123 456 789")
10565 echo "You have C99 variadic macros." >&4
10566 d_c99_variadic_macros="$define"
10567 ;;
10568 *)
10569 echo "You don't have functional C99 variadic macros." >&4
10570 d_c99_variadic_macros="$undef"
10571 ;;
10572 esac
10573 else
10574 echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10575 d_c99_variadic_macros="$undef"
10576 fi
10577 $rm -f try.* try core core.try.*
10578 ;;
10579 *)
10580 echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10581 d_c99_variadic_macros="$undef"
10582 ;;
10583esac
10584
b4eb6b3d
JH
10585: see if signal is declared as pointer to function returning int or void
10586echo " "
10587xxx=`./findhdr signal.h`
10588$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10589if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10590 echo "You have int (*signal())() instead of void." >&4
10591 val="$undef"
10592elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10593 echo "You have void (*signal())()." >&4
10594 val="$define"
10595elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10596 echo "You have int (*signal())() instead of void." >&4
10597 val="$undef"
10598elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10599 echo "You have void (*signal())()." >&4
10600 val="$define"
10601else
10602 case "$d_voidsig" in
10603 '')
10604 echo "I can't determine whether signal handler returns void or int..." >&4
10605 dflt=void
10606 rp="What type does your signal handler return?"
10607 . ./myread
10608 case "$ans" in
10609 v*) val="$define";;
10610 *) val="$undef";;
10611 esac;;
10612 "$define")
10613 echo "As you already told me, signal handler returns void." >&4
10614 val="$define"
10615 ;;
10616 *) echo "As you already told me, signal handler returns int." >&4
10617 val="$undef"
10618 ;;
10619 esac
10620fi
10621set d_voidsig
10622eval $setvar
10623case "$d_voidsig" in
10624"$define") signal_t="void";;
10625*) signal_t="int";;
10626esac
10627$rm -f $$.tmp
10628
10629: check for ability to cast large floats to 32-bit ints.
10630echo " "
10631echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10632if $test "$intsize" -ge 4; then
10633 xxx=int
10634else
10635 xxx=long
10636fi
10637$cat >try.c <<EOCP
10638#include <stdio.h>
d1daaddf
JH
10639#$i_stdlib I_STDLIB
10640#ifdef I_STDLIB
10641#include <stdlib.h>
10642#endif
b4eb6b3d
JH
10643#include <sys/types.h>
10644#include <signal.h>
7090f861 10645$signal_t blech(int s) { exit(3); }
b4eb6b3d
JH
10646int main()
10647{
10648 $xxx i32;
10649 double f, g;
10650 int result = 0;
10651 char str[16];
10652 signal(SIGFPE, blech);
10653
10654 /* Don't let compiler optimize the test away. Store the number
10655 in a writable string for gcc to pass to sscanf under HP/UX.
10656 */
10657 sprintf(str, "2147483647");
10658 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10659 g = 10 * f;
10660 i32 = ($xxx) g;
10661
10662 /* x86 processors will probably give 0x8000 0000, which is a
4a39fcde 10663 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
10664 behavior here, which is to preserve the sign and give
10665 back 0x7fff ffff.
10666 */
10667 if (i32 != ($xxx) f)
10668 result |= 1;
10669 exit(result);
10670}
10671EOCP
10672set try
10673if eval $compile_ok; then
5440bc8e 10674 $run ./try
b4eb6b3d
JH
10675 yyy=$?
10676else
10677 echo "(I can't seem to compile the test program--assuming it can't)"
10678 yyy=1
10679fi
10680case "$yyy" in
106810) val="$define"
10682 echo "Yup, it can."
10683 ;;
10684*) val="$undef"
10685 echo "Nope, it can't."
10686 ;;
10687esac
10688set d_casti32
10689eval $setvar
10690$rm -f try try.*
10691
10692: check for ability to cast negative floats to unsigned
10693echo " "
10694echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10695$cat >try.c <<EOCP
10696#include <stdio.h>
d1daaddf
JH
10697#$i_stdlib I_STDLIB
10698#ifdef I_STDLIB
10699#include <stdlib.h>
10700#endif
b4eb6b3d
JH
10701#include <sys/types.h>
10702#include <signal.h>
7090f861
JH
10703$signal_t blech(int s) { exit(7); }
10704$signal_t blech_in_list(int s) { exit(4); }
10705unsigned long dummy_long(unsigned long p) { return p; }
10706unsigned int dummy_int(unsigned int p) { return p; }
10707unsigned short dummy_short(unsigned short p) { return p; }
b4eb6b3d
JH
10708int main()
10709{
10710 double f;
10711 unsigned long along;
10712 unsigned int aint;
10713 unsigned short ashort;
10714 int result = 0;
10715 char str[16];
10716
10717 /* Frustrate gcc-2.7.2's optimizer which failed this test with
10718 a direct f = -123. assignment. gcc-2.8.0 reportedly
10719 optimized the whole file away
10720 */
10721 /* Store the number in a writable string for gcc to pass to
10722 sscanf under HP/UX.
10723 */
10724 sprintf(str, "-123");
10725 sscanf(str, "%lf", &f); /* f = -123.; */
10726
10727 signal(SIGFPE, blech);
10728 along = (unsigned long)f;
10729 aint = (unsigned int)f;
10730 ashort = (unsigned short)f;
10731 if (along != (unsigned long)-123)
10732 result |= 1;
10733 if (aint != (unsigned int)-123)
10734 result |= 1;
10735 if (ashort != (unsigned short)-123)
10736 result |= 1;
10737 sprintf(str, "1073741824.");
10738 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10739 f = f + f;
10740 along = 0;
10741 along = (unsigned long)f;
10742 if (along != 0x80000000)
10743 result |= 2;
10744 f -= 1.;
10745 along = 0;
10746 along = (unsigned long)f;
10747 if (along != 0x7fffffff)
10748 result |= 1;
10749 f += 2.;
10750 along = 0;
10751 along = (unsigned long)f;
10752 if (along != 0x80000001)
10753 result |= 2;
10754 if (result)
10755 exit(result);
10756 signal(SIGFPE, blech_in_list);
10757 sprintf(str, "123.");
10758 sscanf(str, "%lf", &f); /* f = 123.; */
10759 along = dummy_long((unsigned long)f);
10760 aint = dummy_int((unsigned int)f);
10761 ashort = dummy_short((unsigned short)f);
10762 if (along != (unsigned long)123)
10763 result |= 4;
10764 if (aint != (unsigned int)123)
10765 result |= 4;
10766 if (ashort != (unsigned short)123)
10767 result |= 4;
10768 exit(result);
10769
10770}
10771EOCP
10772set try
10773if eval $compile_ok; then
5440bc8e 10774 $run ./try
b4eb6b3d
JH
10775 castflags=$?
10776else
10777 echo "(I can't seem to compile the test program--assuming it can't)"
10778 castflags=7
10779fi
10780case "$castflags" in
107810) val="$define"
10782 echo "Yup, it can."
10783 ;;
10784*) val="$undef"
10785 echo "Nope, it can't."
10786 ;;
10787esac
10788set d_castneg
10789eval $setvar
10790$rm -f try.*
10791
10792: see if vprintf exists
10793echo " "
10794if set vprintf val -f d_vprintf; eval $csym; $val; then
10795 echo 'vprintf() found.' >&4
10796 val="$define"
55954f19 10797 $cat >try.c <<EOF
b4eb6b3d 10798#include <varargs.h>
55954f19
JH
10799#$i_stdlib I_STDLIB
10800#ifdef I_STDLIB
10801#include <stdlib.h>
10802#endif
b4eb6b3d
JH
10803
10804int main() { xxx("foo"); }
10805
10806xxx(va_alist)
10807va_dcl
10808{
10809 va_list args;
10810 char buf[10];
10811
10812 va_start(args);
10813 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10814}
10815EOF
5440bc8e
JH
10816 set try
10817 if eval $compile && $run ./try; then
b4eb6b3d
JH
10818 echo "Your vsprintf() returns (int)." >&4
10819 val2="$undef"
10820 else
10821 echo "Your vsprintf() returns (char*)." >&4
10822 val2="$define"
10823 fi
10824else
10825 echo 'vprintf() NOT found.' >&4
10826 val="$undef"
10827 val2="$undef"
10828fi
5440bc8e 10829$rm -f try try.*
b4eb6b3d
JH
10830set d_vprintf
10831eval $setvar
10832val=$val2
10833set d_charvspr
10834eval $setvar
10835
10836: see if chown exists
10837set chown d_chown
10838eval $inlibc
10839
10840: see if chroot exists
10841set chroot d_chroot
10842eval $inlibc
10843
10844: see if chsize exists
10845set chsize d_chsize
10846eval $inlibc
10847
758a5d79
JH
10848: see if class exists
10849set class d_class
10850eval $inlibc
10851
b0a2e8e6
MB
10852: see if clearenv exists
10853set clearenv d_clearenv
10854eval $inlibc
10855
4e0554ec
JH
10856hasstruct='varname=$1; struct=$2; shift; shift;
10857while $test $# -ge 2; do
10858 case "$1" in
10859 $define) echo "#include <$2>";;
10860 esac ;
10861 shift 2;
10862done > try.c;
10863echo "int main () { struct $struct foo; }" >> try.c;
10864set try;
10865if eval $compile; then
10866 val="$define";
10867else
10868 val="$undef";
10869fi;
10870set $varname;
10871eval $setvar;
10872$rm -f try.c try.o'
10873
4e0554ec
JH
10874socketlib=''
10875sockethdr=''
10876: see whether socket exists
10877echo " "
10878$echo $n "Hmm... $c" >&4
10879if set socket val -f d_socket; eval $csym; $val; then
10880 echo "Looks like you have Berkeley networking support." >&4
10881 d_socket="$define"
10882 if set setsockopt val -f; eval $csym; $val; then
10883 d_oldsock="$undef"
10884 else
10885 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10886 d_oldsock="$define"
10887 fi
10888else
10889 if $contains socklib libc.list >/dev/null 2>&1; then
10890 echo "Looks like you have Berkeley networking support." >&4
10891 d_socket="$define"
10892 : we will have to assume that it supports the 4.2 BSD interface
10893 d_oldsock="$undef"
10894 else
10895 echo "You don't have Berkeley networking in libc$_a..." >&4
10896 if test "X$d_socket" = "X$define"; then
10897 echo "...but you seem to believe that you have sockets." >&4
10898 else
10899 for net in net socket
10900 do
10901 if test -f /usr/lib/lib$net$_a; then
10902 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
10903 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10904 if $contains socket libc.list >/dev/null 2>&1; then
10905 d_socket="$define"
10906 socketlib="-l$net"
10907 case "$net" in
10908 net)
10909 echo "...but the Wollongong group seems to have hacked it in." >&4
10910 sockethdr="-I/usr/netinclude"
10911 ;;
10912 esac
3c728e00 10913 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
10914 if $contains setsockopt libc.list >/dev/null 2>&1; then
10915 d_oldsock="$undef"
10916 else
10917 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10918 d_oldsock="$define"
10919 fi
10920 break
10921 fi
10922 fi
10923 done
10924 if test "X$d_socket" != "X$define"; then
10925 echo "or anywhere else I see." >&4
10926 d_socket="$undef"
10927 d_oldsock="$undef"
10928 fi
10929 fi
10930 fi
10931fi
10932
10933: see if socketpair exists
10934set socketpair d_sockpair
10935eval $inlibc
10936
10937
10938echo " "
3c728e00 10939echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
10940for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10941 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10942 $cat >try.c <<EOF
10943#include <sys/types.h>
10944#include <sys/socket.h>
10945int main() {
10946 int i = $ENUM;
10947}
10948EOF
10949 val="$undef"
10950 set try; if eval $compile; then
10951 val="$define"
10952 fi
10953 set d_${enum}; eval $setvar
10954 $rm -f try.c try
10955done
10956
10957: see if this is a sys/uio.h system
10958set sys/uio.h i_sysuio
10959eval $inhdr
10960
10961
10962echo " "
10963echo "Checking to see if your system supports struct cmsghdr..." >&4
10964set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10965eval $hasstruct
10966case "$d_cmsghdr_s" in
10967"$define") echo "Yes, it does." ;;
10968*) echo "No, it doesn't." ;;
10969esac
10970
10971
b4eb6b3d
JH
10972: check for const keyword
10973echo " "
10974echo 'Checking to see if your C compiler knows about "const"...' >&4
10975$cat >const.c <<'EOCP'
10976typedef struct spug { int drokk; } spug;
76f47787 10977int main()
b4eb6b3d
JH
10978{
10979 const char *foo;
666ea192 10980 const spug y = { 0 };
b4eb6b3d
JH
10981}
10982EOCP
10983if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10984 val="$define"
10985 echo "Yup, it does."
10986else
10987 val="$undef"
10988 echo "Nope, it doesn't."
10989fi
10990set d_const
10991eval $setvar
10992
89ce900e
JH
10993: see if copysignl exists
10994set copysignl d_copysignl
10995eval $inlibc
10996
b4eb6b3d
JH
10997: see if crypt exists
10998echo " "
a5a94ea5
JH
10999set crypt d_crypt
11000eval $inlibc
11001case "$d_crypt" in
11002$define) cryptlib='' ;;
11003*) if set crypt val -f d_crypt; eval $csym; $val; then
11004 echo 'crypt() found.' >&4
b4eb6b3d 11005 val="$define"
a5a94ea5
JH
11006 cryptlib=''
11007 else
11008 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11009 if $test -z "$cryptlib"; then
11010 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11011 else
11012 cryptlib=-lcrypt
11013 fi
11014 if $test -z "$cryptlib"; then
11015 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11016 else
11017 cryptlib=-lcrypt
11018 fi
11019 if $test -z "$cryptlib"; then
11020 cryptlib=`./loc libcrypt$_a "" $libpth`
11021 else
11022 cryptlib=-lcrypt
11023 fi
11024 if $test -z "$cryptlib"; then
11025 echo 'crypt() NOT found.' >&4
11026 val="$undef"
11027 else
11028 val="$define"
11029 fi
b4eb6b3d 11030 fi
a5a94ea5
JH
11031 set d_crypt
11032 eval $setvar
11033 ;;
11034esac
b4eb6b3d 11035
10bc17b6
JH
11036: see if this is a crypt.h system
11037set crypt.h i_crypt
11038eval $inhdr
11039
11040: see if crypt_r exists
11041set crypt_r d_crypt_r
11042eval $inlibc
11043case "$d_crypt_r" in
11044"$define")
11045 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
11046 case "$d_crypt_r_proto:$usethreads" in
11047 ":define") d_crypt_r_proto=define
a48ec845
JH
11048 set d_crypt_r_proto crypt_r $hdrs
11049 eval $hasproto ;;
11050 *) ;;
11051 esac
11052 case "$d_crypt_r_proto" in
11053 define)
10bc17b6
JH
11054 case "$crypt_r_proto" in
11055 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11056 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11057 esac
11058 case "$crypt_r_proto" in
b430fd04
JH
11059 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11060 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11061 esac
11062 case "$crypt_r_proto" in
90e831dc 11063 ''|0) d_crypt_r=undef
10bc17b6 11064 crypt_r_proto=0
a48ec845 11065 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11066 * ) case "$crypt_r_proto" in
11067 REENTRANT_PROTO*) ;;
11068 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11069 esac
11070 echo "Prototype: $try" ;;
11071 esac
11072 ;;
c18e646a
JH
11073 *) case "$usethreads" in
11074 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11075 esac
90e831dc
SB
11076 d_crypt_r=undef
11077 crypt_r_proto=0
c18e646a 11078 ;;
a48ec845
JH
11079 esac
11080 ;;
10bc17b6
JH
11081*) crypt_r_proto=0
11082 ;;
11083esac
11084
b4eb6b3d
JH
11085: get csh whereabouts
11086case "$csh" in
11087'csh') val="$undef" ;;
11088*) val="$define" ;;
11089esac
11090set d_csh
11091eval $setvar
11092: Respect a hint or command line value for full_csh.
11093case "$full_csh" in
11094'') full_csh=$csh ;;
11095esac
11096
13cfc98d
MB
11097: see if ctermid exists
11098set ctermid d_ctermid
11099eval $inlibc
11100
10bc17b6
JH
11101: see if ctermid_r exists
11102set ctermid_r d_ctermid_r
11103eval $inlibc
11104case "$d_ctermid_r" in
11105"$define")
31ee0cb7 11106 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
11107 case "$d_ctermid_r_proto:$usethreads" in
11108 ":define") d_ctermid_r_proto=define
a48ec845
JH
11109 set d_ctermid_r_proto ctermid_r $hdrs
11110 eval $hasproto ;;
11111 *) ;;
11112 esac
11113 case "$d_ctermid_r_proto" in
11114 define)
10bc17b6
JH
11115 case "$ctermid_r_proto" in
11116 ''|0) try='char* ctermid_r(char*);'
11117 ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11118 esac
11119 case "$ctermid_r_proto" in
90e831dc 11120 ''|0) d_ctermid_r=undef
10bc17b6 11121 ctermid_r_proto=0
a48ec845 11122 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11123 * ) case "$ctermid_r_proto" in
11124 REENTRANT_PROTO*) ;;
11125 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11126 esac
11127 echo "Prototype: $try" ;;
11128 esac
11129 ;;
c18e646a
JH
11130 *) case "$usethreads" in
11131 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11132 esac
90e831dc
SB
11133 d_ctermid_r=undef
11134 ctermid_r_proto=0
c18e646a 11135 ;;
a48ec845
JH
11136 esac
11137 ;;
10bc17b6
JH
11138*) ctermid_r_proto=0
11139 ;;
11140esac
11141
11142: see if ctime_r exists
11143set ctime_r d_ctime_r
11144eval $inlibc
11145case "$d_ctime_r" in
11146"$define")
d63eadf0 11147 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
11148 case "$d_ctime_r_proto:$usethreads" in
11149 ":define") d_ctime_r_proto=define
a48ec845
JH
11150 set d_ctime_r_proto ctime_r $hdrs
11151 eval $hasproto ;;
11152 *) ;;
11153 esac
11154 case "$d_ctime_r_proto" in
11155 define)
10bc17b6
JH
11156 case "$ctime_r_proto" in
11157 ''|0) try='char* ctime_r(const time_t*, char*);'
11158 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11159 esac
11160 case "$ctime_r_proto" in
11161 ''|0) try='char* ctime_r(const time_t*, char*, int);'
11162 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11163 esac
11164 case "$ctime_r_proto" in
11165 ''|0) try='int ctime_r(const time_t*, char*);'
11166 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11167 esac
11168 case "$ctime_r_proto" in
11169 ''|0) try='int ctime_r(const time_t*, char*, int);'
11170 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11171 esac
11172 case "$ctime_r_proto" in
90e831dc 11173 ''|0) d_ctime_r=undef
10bc17b6 11174 ctime_r_proto=0
a48ec845 11175 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11176 * ) case "$ctime_r_proto" in
11177 REENTRANT_PROTO*) ;;
11178 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11179 esac
11180 echo "Prototype: $try" ;;
11181 esac
11182 ;;
c18e646a
JH
11183 *) case "$usethreads" in
11184 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11185 esac
90e831dc
SB
11186 d_ctime_r=undef
11187 ctime_r_proto=0
c18e646a 11188 ;;
a48ec845
JH
11189 esac
11190 ;;
10bc17b6
JH
11191*) ctime_r_proto=0
11192 ;;
11193esac
11194
b4eb6b3d
JH
11195: see if cuserid exists
11196set cuserid d_cuserid
11197eval $inlibc
11198
11199: see if this is a limits.h system
11200set limits.h i_limits
11201eval $inhdr
11202
11203: see if this is a float.h system
11204set float.h i_float
11205eval $inhdr
11206
11207: See if number of significant digits in a double precision number is known
11208echo " "
11209$cat >dbl_dig.c <<EOM
11210#$i_limits I_LIMITS
11211#$i_float I_FLOAT
11212#ifdef I_LIMITS
11213#include <limits.h>
11214#endif
11215#ifdef I_FLOAT
11216#include <float.h>
11217#endif
11218#ifdef DBL_DIG
11219printf("Contains DBL_DIG");
11220#endif
11221EOM
11222$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11223if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11224 echo "DBL_DIG found." >&4
11225 val="$define"
11226else
11227 echo "DBL_DIG NOT found." >&4
11228 val="$undef"
11229fi
11230$rm -f dbl_dig.?
11231set d_dbl_dig
11232eval $setvar
11233
2ef53570
JH
11234: see if dbm.h is available
11235: see if dbmclose exists
11236set dbmclose d_dbmclose
11237eval $inlibc
11238
11239case "$d_dbmclose" in
11240$define)
11241 set dbm.h i_dbm
11242 eval $inhdr
11243 case "$i_dbm" in
11244 $define)
11245 val="$undef"
11246 set i_rpcsvcdbm
11247 eval $setvar
11248 ;;
11249 *) set rpcsvc/dbm.h i_rpcsvcdbm
11250 eval $inhdr
11251 ;;
11252 esac
11253 ;;
11254*) echo "We won't be including <dbm.h>"
11255 val="$undef"
11256 set i_dbm
11257 eval $setvar
11258 val="$undef"
11259 set i_rpcsvcdbm
11260 eval $setvar
11261 ;;
11262esac
11263
11264: see if prototype for dbminit is available
11265echo " "
11266set d_dbminitproto dbminit $i_dbm dbm.h
11267eval $hasproto
11268
b4eb6b3d
JH
11269: see if difftime exists
11270set difftime d_difftime
11271eval $inlibc
11272
11273: see if this is a dirent system
11274echo " "
11275if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11276 val="$define"
11277 echo "<dirent.h> found." >&4
11278else
11279 val="$undef"
11280 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11281 echo "<sys/dir.h> found." >&4
11282 echo " "
11283 else
11284 xinc=`./findhdr sys/ndir.h`
11285 fi
11286 echo "<dirent.h> NOT found." >&4
11287fi
11288set i_dirent
11289eval $setvar
11290
11291: Look for type of directory structure.
11292echo " "
11293$cppstdin $cppflags $cppminus < "$xinc" > try.c
11294
11295case "$direntrytype" in
11296''|' ')
11297 case "$i_dirent" in
11298 $define) guess1='struct dirent' ;;
11299 *) guess1='struct direct' ;;
11300 esac
11301 ;;
11302*) guess1="$direntrytype"
11303 ;;
11304esac
11305
11306case "$guess1" in
11307'struct dirent') guess2='struct direct' ;;
11308*) guess2='struct dirent' ;;
11309esac
11310
11311if $contains "$guess1" try.c >/dev/null 2>&1; then
11312 direntrytype="$guess1"
11313 echo "Your directory entries are $direntrytype." >&4
11314elif $contains "$guess2" try.c >/dev/null 2>&1; then
11315 direntrytype="$guess2"
11316 echo "Your directory entries seem to be $direntrytype." >&4
11317else
11318 echo "I don't recognize your system's directory entries." >&4
11319 rp="What type is used for directory entries on this system?"
11320 dflt="$guess1"
11321 . ./myread
11322 direntrytype="$ans"
11323fi
11324$rm -f try.c
11325
11326
11327: see if the directory entry stores field length
11328echo " "
11329$cppstdin $cppflags $cppminus < "$xinc" > try.c
11330if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11331 echo "Good, your directory entry keeps length information in d_namlen." >&4
11332 val="$define"
11333else
11334 echo "Your directory entry does not know about the d_namlen field." >&4
11335 val="$undef"
11336fi
11337set d_dirnamlen
11338eval $setvar
11339$rm -f try.c
11340
de52168c
SP
11341: Look for DIR.dd_fd
11342case "$i_dirent" in
11343"$define")
11344 echo "Checking to see if DIR has a dd_fd member variable" >&4
11345 $cat >try.c <<EOCP
11346#$i_stdlib I_STDLIB
11347#ifdef I_STDLIB
11348#include <stdlib.h>
11349#endif
11350#include <dirent.h>
11351
11352int main() {
11353 DIR dir;
11354 dir.dd_fd = 1;
11355 return 0;
11356}
11357EOCP
11358 val=$undef
11359 set try
11360 if eval $compile; then
11361 echo "Yes, it does."
11362 val="$define"
11363 else
11364 echo "No, it does not."
11365 val="$undef"
11366 fi
11367 ;;
11368*)
11369 echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11370 val="$undef"
11371 ;;
11372esac
11373set d_dir_dd_fd
11374eval $setvar
11375$rm -f try try.*
11376
ae0e3d3b
JH
11377: see if this is an sysdir system
11378set sys/dir.h i_sysdir
11379eval $inhdr
11380
11381: see if this is an sysndir system
11382set sys/ndir.h i_sysndir
11383eval $inhdr
11384
11385: Look for dirfd
11386echo " "
11387$cat >dirfd.c <<EOM
11388#include <stdio.h>
55954f19
JH
11389#$i_stdlib I_STDLIB
11390#ifdef I_STDLIB
11391#include <stdlib.h>
11392#endif
ae0e3d3b
JH
11393#$i_dirent I_DIRENT /**/
11394#$i_sysdir I_SYS_DIR /**/
11395#$i_sysndir I_SYS_NDIR /**/
11396#$i_systypes I_SYS_TYPES /**/
11397#if defined(I_SYS_TYPES)
11398#include <sys/types.h>
11399#endif
11400#if defined(I_DIRENT)
11401#include <dirent.h>
11402#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11403#include <sys/dir.h>
11404#endif
11405#else
11406#ifdef I_SYS_NDIR
11407#include <sys/ndir.h>
11408#else
11409#ifdef I_SYS_DIR
11410#ifdef hp9000s500
11411#include <ndir.h> /* may be wrong in the future */
11412#else
11413#include <sys/dir.h>
11414#endif
11415#endif
11416#endif
11417#endif
11418int main() {
11419 DIR *dirp = opendir(".");
11420 if (dirfd(dirp) >= 0)
11421 exit(0);
11422 else
11423 exit(1);
11424}
11425EOM
5cadb3f3 11426val=$undef
ae0e3d3b
JH
11427set dirfd
11428if eval $compile; then
11429 val="$define"
11430fi
11431case "$val" in
11432$define) echo "dirfd() found." >&4 ;;
11433*) echo "dirfd() NOT found." >&4 ;;
11434esac
11435set d_dirfd
11436eval $setvar
11437$rm -f dirfd*
11438
b4eb6b3d
JH
11439: see if dlerror exists
11440xxx_runnm="$runnm"
11441runnm=false
11442set dlerror d_dlerror
11443eval $inlibc
11444runnm="$xxx_runnm"
11445
11446: see if dlfcn is available
11447set dlfcn.h i_dlfcn
11448eval $inhdr
11449
11450case "$usedl" in
11451$define|y|true)
11452 $cat << EOM
11453
11454On a few systems, the dynamically loaded modules that perl generates and uses
11455will need a different extension than shared libs. The default will probably
11456be appropriate.
11457
11458EOM
11459 case "$dlext" in
11460 '') dflt="$so" ;;
11461 *) dflt="$dlext" ;;
11462 esac
11463 rp='What is the extension of dynamically loaded modules'
11464 . ./myread
11465 dlext="$ans"
11466 ;;
11467*)
11468 dlext="none"
11469 ;;
11470esac
11471
11472: Check if dlsym need a leading underscore
11473echo " "
11474val="$undef"
11475
11476case "$dlsrc" in
11477dl_dlopen.xs)
11478 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11479 $cat >dyna.c <<'EOM'
11480fred () { }
11481EOM
11482
11483$cat >fred.c<<EOM
11484
11485#include <stdio.h>
55954f19
JH
11486#$i_stdlib I_STDLIB
11487#ifdef I_STDLIB
11488#include <stdlib.h>
11489#endif
b4eb6b3d
JH
11490#$i_dlfcn I_DLFCN
11491#ifdef I_DLFCN
5440bc8e 11492#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
11493#else
11494#include <sys/types.h>
11495#include <nlist.h>
11496#include <link.h>
11497#endif
11498
11499extern int fred() ;
11500
11501int main()
11502{
11503 void * handle ;
11504 void * symbol ;
11505#ifndef RTLD_LAZY
11506 int mode = 1 ;
11507#else
11508 int mode = RTLD_LAZY ;
11509#endif
11510 handle = dlopen("./dyna.$dlext", mode) ;
11511 if (handle == NULL) {
11512 printf ("1\n") ;
11513 fflush (stdout) ;
11514 exit(0);
11515 }
11516 symbol = dlsym(handle, "fred") ;
11517 if (symbol == NULL) {
11518 /* try putting a leading underscore */
11519 symbol = dlsym(handle, "_fred") ;
11520 if (symbol == NULL) {
11521 printf ("2\n") ;
11522 fflush (stdout) ;
11523 exit(0);
11524 }
11525 printf ("3\n") ;
11526 }
11527 else
11528 printf ("4\n") ;
11529 fflush (stdout) ;
11530 exit(0);
11531}
11532EOM
11533 : Call the object file tmp-dyna.o in case dlext=o.
11534 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11535 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 11536 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
11537 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11538 xxx=`$run ./fred`
b4eb6b3d
JH
11539 case $xxx in
11540 1) echo "Test program failed using dlopen." >&4
11541 echo "Perhaps you should not use dynamic loading." >&4;;
11542 2) echo "Test program failed using dlsym." >&4
11543 echo "Perhaps you should not use dynamic loading." >&4;;
11544 3) echo "dlsym needs a leading underscore" >&4
11545 val="$define" ;;
11546 4) echo "dlsym doesn't need a leading underscore." >&4;;
11547 esac
11548 else
11549 echo "I can't compile and run the test program." >&4
11550 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11551 fi
11552 ;;
11553esac
11554
3c728e00 11555$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
11556
11557set d_dlsymun
11558eval $setvar
11559
10bc17b6
JH
11560: see if drand48_r exists
11561set drand48_r d_drand48_r
11562eval $inlibc
11563case "$d_drand48_r" in
11564"$define")
11565 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
11566 case "$d_drand48_r_proto:$usethreads" in
11567 ":define") d_drand48_r_proto=define
a48ec845
JH
11568 set d_drand48_r_proto drand48_r $hdrs
11569 eval $hasproto ;;
11570 *) ;;
11571 esac
11572 case "$d_drand48_r_proto" in
11573 define)
10bc17b6
JH
11574 case "$drand48_r_proto" in
11575 ''|0) try='int drand48_r(struct drand48_data*, double*);'
11576 ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11577 esac
11578 case "$drand48_r_proto" in
90e831dc 11579 ''|0) d_drand48_r=undef
10bc17b6 11580 drand48_r_proto=0
a48ec845 11581 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11582 * ) case "$drand48_r_proto" in
11583 REENTRANT_PROTO*) ;;
11584 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11585 esac
11586 echo "Prototype: $try" ;;
11587 esac
11588 ;;
c18e646a
JH
11589 *) case "$usethreads" in
11590 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11591 esac
90e831dc
SB
11592 d_drand48_r=undef
11593 drand48_r_proto=0
c18e646a 11594 ;;
a48ec845
JH
11595 esac
11596 ;;
10bc17b6
JH
11597*) drand48_r_proto=0
11598 ;;
11599esac
11600
11601: see if prototype for drand48 is available
11602echo " "
11603set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11604eval $hasproto
11605
b4eb6b3d
JH
11606: see if dup2 exists
11607set dup2 d_dup2
11608eval $inlibc
11609
11610: see if eaccess exists
11611set eaccess d_eaccess
11612eval $inlibc
11613
11614: see if endgrent exists
11615set endgrent d_endgrent
11616eval $inlibc
11617
10bc17b6
JH
11618: see if this is an grp system
11619set grp.h i_grp
11620eval $inhdr
11621
11622case "$i_grp" in
11623$define)
11624 xxx=`./findhdr grp.h`
11625 $cppstdin $cppflags $cppminus < $xxx >$$.h
11626
11627 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11628 val="$define"
11629 else
11630 val="$undef"
11631 fi
11632 set d_grpasswd
11633 eval $setvar
11634
11635 $rm -f $$.h
11636 ;;
11637*)
11638 val="$undef";
11639 set d_grpasswd; eval $setvar
11640 ;;
11641esac
11642
11643: see if endgrent_r exists
11644set endgrent_r d_endgrent_r
11645eval $inlibc
11646case "$d_endgrent_r" in
11647"$define")
11648 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11649 case "$d_endgrent_r_proto:$usethreads" in
11650 ":define") d_endgrent_r_proto=define
a48ec845
JH
11651 set d_endgrent_r_proto endgrent_r $hdrs
11652 eval $hasproto ;;
11653 *) ;;
11654 esac
11655 case "$d_endgrent_r_proto" in
11656 define)
10bc17b6
JH
11657 case "$endgrent_r_proto" in
11658 ''|0) try='int endgrent_r(FILE**);'
11659 ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11660 esac
11661 case "$endgrent_r_proto" in
11662 ''|0) try='void endgrent_r(FILE**);'
11663 ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11664 esac
11665 case "$endgrent_r_proto" in
90e831dc 11666 ''|0) d_endgrent_r=undef
10bc17b6 11667 endgrent_r_proto=0
a48ec845 11668 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11669 * ) case "$endgrent_r_proto" in
11670 REENTRANT_PROTO*) ;;
11671 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11672 esac
11673 echo "Prototype: $try" ;;
11674 esac
11675 ;;
c18e646a
JH
11676 *) case "$usethreads" in
11677 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11678 esac
90e831dc
SB
11679 d_endgrent_r=undef
11680 endgrent_r_proto=0
c18e646a 11681 ;;
a48ec845
JH
11682 esac
11683 ;;
10bc17b6
JH
11684*) endgrent_r_proto=0
11685 ;;
11686esac
11687
b4eb6b3d
JH
11688: see if endhostent exists
11689set endhostent d_endhent
11690eval $inlibc
11691
10bc17b6
JH
11692: see if this is a netdb.h system
11693set netdb.h i_netdb
11694eval $inhdr
11695
11696: see if endhostent_r exists
11697set endhostent_r d_endhostent_r
11698eval $inlibc
11699case "$d_endhostent_r" in
11700"$define")
11701 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11702 case "$d_endhostent_r_proto:$usethreads" in
11703 ":define") d_endhostent_r_proto=define
a48ec845
JH
11704 set d_endhostent_r_proto endhostent_r $hdrs
11705 eval $hasproto ;;
11706 *) ;;
11707 esac
11708 case "$d_endhostent_r_proto" in
11709 define)
10bc17b6
JH
11710 case "$endhostent_r_proto" in
11711 ''|0) try='int endhostent_r(struct hostent_data*);'
31ee0cb7 11712 ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
11713 esac
11714 case "$endhostent_r_proto" in
11715 ''|0) try='void endhostent_r(struct hostent_data*);'
31ee0cb7 11716 ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
11717 esac
11718 case "$endhostent_r_proto" in
90e831dc 11719 ''|0) d_endhostent_r=undef
10bc17b6 11720 endhostent_r_proto=0
a48ec845 11721 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11722 * ) case "$endhostent_r_proto" in
11723 REENTRANT_PROTO*) ;;
11724 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11725 esac
11726 echo "Prototype: $try" ;;
11727 esac
11728 ;;
c18e646a
JH
11729 *) case "$usethreads" in
11730 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11731 esac
90e831dc
SB
11732 d_endhostent_r=undef
11733 endhostent_r_proto=0
c18e646a 11734 ;;
a48ec845
JH
11735 esac
11736 ;;
10bc17b6
JH
11737*) endhostent_r_proto=0
11738 ;;
11739esac
11740
b4eb6b3d
JH
11741: see if endnetent exists
11742set endnetent d_endnent
11743eval $inlibc
11744
10bc17b6
JH
11745: see if endnetent_r exists
11746set endnetent_r d_endnetent_r
11747eval $inlibc
11748case "$d_endnetent_r" in
11749"$define")
11750 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11751 case "$d_endnetent_r_proto:$usethreads" in
11752 ":define") d_endnetent_r_proto=define
a48ec845
JH
11753 set d_endnetent_r_proto endnetent_r $hdrs
11754 eval $hasproto ;;
11755 *) ;;
11756 esac
11757 case "$d_endnetent_r_proto" in
11758 define)
10bc17b6
JH
11759 case "$endnetent_r_proto" in
11760 ''|0) try='int endnetent_r(struct netent_data*);'
31ee0cb7 11761 ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
11762 esac
11763 case "$endnetent_r_proto" in
11764 ''|0) try='void endnetent_r(struct netent_data*);'
31ee0cb7 11765 ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
11766 esac
11767 case "$endnetent_r_proto" in
90e831dc 11768 ''|0) d_endnetent_r=undef
10bc17b6 11769 endnetent_r_proto=0
a48ec845 11770 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11771 * ) case "$endnetent_r_proto" in
11772 REENTRANT_PROTO*) ;;
11773 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11774 esac
11775 echo "Prototype: $try" ;;
11776 esac
11777 ;;
c18e646a
JH
11778 *) case "$usethreads" in
11779 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11780 esac
90e831dc
SB
11781 d_endnetent_r=undef
11782 endnetent_r_proto=0
c18e646a 11783 ;;
a48ec845
JH
11784 esac
11785 ;;
10bc17b6
JH
11786*) endnetent_r_proto=0
11787 ;;
11788esac
11789
b4eb6b3d
JH
11790: see if endprotoent exists
11791set endprotoent d_endpent
11792eval $inlibc
11793
10bc17b6
JH
11794: see if endprotoent_r exists
11795set endprotoent_r d_endprotoent_r
11796eval $inlibc
11797case "$d_endprotoent_r" in
11798"$define")
11799 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11800 case "$d_endprotoent_r_proto:$usethreads" in
11801 ":define") d_endprotoent_r_proto=define
a48ec845
JH
11802 set d_endprotoent_r_proto endprotoent_r $hdrs
11803 eval $hasproto ;;
11804 *) ;;
11805 esac
11806 case "$d_endprotoent_r_proto" in
11807 define)
10bc17b6
JH
11808 case "$endprotoent_r_proto" in
11809 ''|0) try='int endprotoent_r(struct protoent_data*);'
31ee0cb7 11810 ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
11811 esac
11812 case "$endprotoent_r_proto" in
11813 ''|0) try='void endprotoent_r(struct protoent_data*);'
31ee0cb7 11814 ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
11815 esac
11816 case "$endprotoent_r_proto" in
90e831dc 11817 ''|0) d_endprotoent_r=undef
10bc17b6 11818 endprotoent_r_proto=0
a48ec845 11819 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11820 * ) case "$endprotoent_r_proto" in
11821 REENTRANT_PROTO*) ;;
11822 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11823 esac
11824 echo "Prototype: $try" ;;
11825 esac
11826 ;;
c18e646a
JH
11827 *) case "$usethreads" in
11828 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11829 esac
90e831dc
SB
11830 d_endprotoent_r=undef
11831 endprotoent_r_proto=0
c18e646a 11832 ;;
a48ec845
JH
11833 esac
11834 ;;
10bc17b6
JH
11835*) endprotoent_r_proto=0
11836 ;;
11837esac
11838
b4eb6b3d
JH
11839: see if endpwent exists
11840set endpwent d_endpwent
11841eval $inlibc
11842
10bc17b6
JH
11843: see if this is a pwd.h system
11844set pwd.h i_pwd
11845eval $inhdr
11846
11847case "$i_pwd" in
11848$define)
11849 xxx=`./findhdr pwd.h`
11850 $cppstdin $cppflags $cppminus < $xxx >$$.h
11851
11852 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11853 val="$define"
11854 else
11855 val="$undef"
11856 fi
11857 set d_pwquota
11858 eval $setvar
11859
11860 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11861 val="$define"
11862 else
11863 val="$undef"
11864 fi
11865 set d_pwage
11866 eval $setvar
11867
11868 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11869 val="$define"
11870 else
11871 val="$undef"
11872 fi
11873 set d_pwchange
11874 eval $setvar
11875
11876 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11877 val="$define"
11878 else
11879 val="$undef"
11880 fi
11881 set d_pwclass
11882 eval $setvar
11883
11884 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11885 val="$define"
11886 else
11887 val="$undef"
11888 fi
11889 set d_pwexpire
11890 eval $setvar
11891
11892 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11893 val="$define"
11894 else
11895 val="$undef"
11896 fi
11897 set d_pwcomment
11898 eval $setvar
11899
11900 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11901 val="$define"
11902 else
11903 val="$undef"
11904 fi
11905 set d_pwgecos
11906 eval $setvar
11907
11908 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11909 val="$define"
11910 else
11911 val="$undef"
11912 fi
11913 set d_pwpasswd
11914 eval $setvar
11915
11916 $rm -f $$.h
11917 ;;
11918*)
11919 val="$undef";
11920 set d_pwquota; eval $setvar
11921 set d_pwage; eval $setvar
11922 set d_pwchange; eval $setvar
11923 set d_pwclass; eval $setvar
11924 set d_pwexpire; eval $setvar
11925 set d_pwcomment; eval $setvar
11926 set d_pwgecos; eval $setvar
11927 set d_pwpasswd; eval $setvar
11928 ;;
11929esac
11930
11931: see if endpwent_r exists
11932set endpwent_r d_endpwent_r
11933eval $inlibc
11934case "$d_endpwent_r" in
11935"$define")
11936 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
11937 case "$d_endpwent_r_proto:$usethreads" in
11938 ":define") d_endpwent_r_proto=define
a48ec845
JH
11939 set d_endpwent_r_proto endpwent_r $hdrs
11940 eval $hasproto ;;
11941 *) ;;
11942 esac
11943 case "$d_endpwent_r_proto" in
11944 define)
10bc17b6
JH
11945 case "$endpwent_r_proto" in
11946 ''|0) try='int endpwent_r(FILE**);'
11947 ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11948 esac
11949 case "$endpwent_r_proto" in
11950 ''|0) try='void endpwent_r(FILE**);'
11951 ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11952 esac
11953 case "$endpwent_r_proto" in
90e831dc 11954 ''|0) d_endpwent_r=undef
10bc17b6 11955 endpwent_r_proto=0
a48ec845 11956 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11957 * ) case "$endpwent_r_proto" in
11958 REENTRANT_PROTO*) ;;
11959 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11960 esac
11961 echo "Prototype: $try" ;;
11962 esac
11963 ;;
c18e646a
JH
11964 *) case "$usethreads" in
11965 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11966 esac
90e831dc
SB
11967 d_endpwent_r=undef
11968 endpwent_r_proto=0
c18e646a 11969 ;;
a48ec845
JH
11970 esac
11971 ;;
10bc17b6
JH
11972*) endpwent_r_proto=0
11973 ;;
11974esac
11975
b4eb6b3d
JH
11976: see if endservent exists
11977set endservent d_endsent
11978eval $inlibc
11979
10bc17b6
JH
11980: see if endservent_r exists
11981set endservent_r d_endservent_r
11982eval $inlibc
11983case "$d_endservent_r" in
11984"$define")
11985 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11986 case "$d_endservent_r_proto:$usethreads" in
11987 ":define") d_endservent_r_proto=define
a48ec845
JH
11988 set d_endservent_r_proto endservent_r $hdrs
11989 eval $hasproto ;;
11990 *) ;;
11991 esac
11992 case "$d_endservent_r_proto" in
11993 define)
10bc17b6
JH
11994 case "$endservent_r_proto" in
11995 ''|0) try='int endservent_r(struct servent_data*);'
31ee0cb7 11996 ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
11997 esac
11998 case "$endservent_r_proto" in
11999 ''|0) try='void endservent_r(struct servent_data*);'
31ee0cb7 12000 ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
12001 esac
12002 case "$endservent_r_proto" in
90e831dc 12003 ''|0) d_endservent_r=undef
10bc17b6 12004 endservent_r_proto=0
a48ec845 12005 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12006 * ) case "$endservent_r_proto" in
12007 REENTRANT_PROTO*) ;;
12008 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12009 esac
12010 echo "Prototype: $try" ;;
12011 esac
12012 ;;
c18e646a
JH
12013 *) case "$usethreads" in
12014 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12015 esac
90e831dc
SB
12016 d_endservent_r=undef
12017 endservent_r_proto=0
c18e646a 12018 ;;
a48ec845
JH
12019 esac
12020 ;;
10bc17b6
JH
12021*) endservent_r_proto=0
12022 ;;
12023esac
12024
b4eb6b3d
JH
12025: Locate the flags for 'open()'
12026echo " "
55954f19 12027$cat >try.c <<EOCP
b4eb6b3d
JH
12028#include <sys/types.h>
12029#ifdef I_FCNTL
12030#include <fcntl.h>
12031#endif
12032#ifdef I_SYS_FILE
12033#include <sys/file.h>
12034#endif
55954f19
JH
12035#$i_stdlib I_STDLIB
12036#ifdef I_STDLIB
12037#include <stdlib.h>
12038#endif
b4eb6b3d
JH
12039int main() {
12040 if(O_RDONLY);
12041#ifdef O_TRUNC
12042 exit(0);
12043#else
12044 exit(1);
12045#endif
12046}
12047EOCP
12048: check sys/file.h first to get FREAD on Sun
12049if $test `./findhdr sys/file.h` && \
5440bc8e 12050 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
12051 h_sysfile=true;
12052 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 12053 if $run ./try; then
b4eb6b3d
JH
12054 echo "and you have the 3 argument form of open()." >&4
12055 val="$define"
12056 else
12057 echo "but not the 3 argument form of open(). Oh, well." >&4
12058 val="$undef"
12059 fi
12060elif $test `./findhdr fcntl.h` && \
5440bc8e 12061 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
12062 h_fcntl=true;
12063 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 12064 if $run ./try; then
b4eb6b3d
JH
12065 echo "and you have the 3 argument form of open()." >&4
12066 val="$define"
12067 else
12068 echo "but not the 3 argument form of open(). Oh, well." >&4
12069 val="$undef"
12070 fi
12071else
12072 val="$undef"
12073 echo "I can't find the O_* constant definitions! You got problems." >&4
12074fi
12075set d_open3
12076eval $setvar
5440bc8e 12077$rm -f try try.*
b4eb6b3d
JH
12078
12079: see which of string.h or strings.h is needed
12080echo " "
12081strings=`./findhdr string.h`
12082if $test "$strings" && $test -r "$strings"; then
12083 echo "Using <string.h> instead of <strings.h>." >&4
12084 val="$define"
12085else
12086 val="$undef"
12087 strings=`./findhdr strings.h`
12088 if $test "$strings" && $test -r "$strings"; then
12089 echo "Using <strings.h> instead of <string.h>." >&4
12090 else
12091 echo "No string header found -- You'll surely have problems." >&4
12092 fi
12093fi
12094set i_string
12095eval $setvar
12096case "$i_string" in
12097"$undef") strings=`./findhdr strings.h`;;
12098*) strings=`./findhdr string.h`;;
12099esac
12100
3c728e00
JH
12101: see if this is a sys/file.h system
12102val=''
12103set sys/file.h val
12104eval $inhdr
12105
12106: do we need to include sys/file.h ?
12107case "$val" in
12108"$define")
12109 echo " "
12110 if $h_sysfile; then
12111 val="$define"
12112 echo "We'll be including <sys/file.h>." >&4
12113 else
12114 val="$undef"
12115 echo "We won't be including <sys/file.h>." >&4
12116 fi
12117 ;;
12118*)
12119 h_sysfile=false
12120 ;;
12121esac
12122set i_sysfile
12123eval $setvar
12124
12125: see if fcntl.h is there
12126val=''
12127set fcntl.h val
12128eval $inhdr
12129
12130: see if we can include fcntl.h
12131case "$val" in
12132"$define")
12133 echo " "
12134 if $h_fcntl; then
12135 val="$define"
12136 echo "We'll be including <fcntl.h>." >&4
12137 else
12138 val="$undef"
12139 if $h_sysfile; then
12140 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12141 else
12142 echo "We won't be including <fcntl.h>." >&4
12143 fi
12144 fi
12145 ;;
12146*)
12147 h_fcntl=false
12148 val="$undef"
12149 ;;
12150esac
12151set i_fcntl
12152eval $setvar
12153
b4eb6b3d
JH
12154: check for non-blocking I/O stuff
12155case "$h_sysfile" in
a0acbdc3
JH
12156true) echo "#include <sys/file.h>" > head.c;;
12157*)
12158 case "$h_fcntl" in
12159 true) echo "#include <fcntl.h>" > head.c;;
12160 *) echo "#include <sys/fcntl.h>" > head.c;;
12161 esac
12162 ;;
b4eb6b3d
JH
12163esac
12164echo " "
12165echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12166case "$o_nonblock" in
12167'')
12168 $cat head.c > try.c
3c728e00 12169 $cat >>try.c <<EOCP
b4eb6b3d 12170#include <stdio.h>
55954f19
JH
12171#$i_stdlib I_STDLIB
12172#ifdef I_STDLIB
80b3ef99 12173#include <stdlib.h>
55954f19 12174#endif
3c728e00
JH
12175#$i_fcntl I_FCNTL
12176#ifdef I_FCNTL
12177#include <fcntl.h>
12178#endif
b4eb6b3d
JH
12179int main() {
12180#ifdef O_NONBLOCK
12181 printf("O_NONBLOCK\n");
12182 exit(0);
12183#endif
12184#ifdef O_NDELAY
12185 printf("O_NDELAY\n");
12186 exit(0);
12187#endif
12188#ifdef FNDELAY
12189 printf("FNDELAY\n");
12190 exit(0);
12191#endif
12192 exit(0);
12193}
12194EOCP
12195 set try
12196 if eval $compile_ok; then
5440bc8e 12197 o_nonblock=`$run ./try`
b4eb6b3d
JH
12198 case "$o_nonblock" in
12199 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12200 *) echo "Seems like we can use $o_nonblock.";;
12201 esac
12202 else
12203 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12204 fi
12205 ;;
12206*) echo "Using $hint value $o_nonblock.";;
12207esac
12208$rm -f try try.* .out core
12209
12210echo " "
12211echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12212case "$eagain" in
12213'')
12214 $cat head.c > try.c
12215 $cat >>try.c <<EOCP
12216#include <errno.h>
12217#include <sys/types.h>
12218#include <signal.h>
12219#include <stdio.h>
55954f19
JH
12220#$i_stdlib I_STDLIB
12221#ifdef I_STDLIB
12222#include <stdlib.h>
12223#endif
1deb0a86
JH
12224#$i_fcntl I_FCNTL
12225#ifdef I_FCNTL
12226#include <fcntl.h>
12227#endif
b4eb6b3d
JH
12228#define MY_O_NONBLOCK $o_nonblock
12229#ifndef errno /* XXX need better Configure test */
12230extern int errno;
12231#endif
12232#$i_unistd I_UNISTD
12233#ifdef I_UNISTD
12234#include <unistd.h>
12235#endif
12236#$i_string I_STRING
12237#ifdef I_STRING
12238#include <string.h>
12239#else
12240#include <strings.h>
12241#endif
7090f861 12242$signal_t blech(int x) { exit(3); }
b4eb6b3d
JH
12243EOCP
12244 $cat >> try.c <<'EOCP'
12245int main()
12246{
12247 int pd[2];
12248 int pu[2];
12249 char buf[1];
12250 char string[100];
12251
12252 pipe(pd); /* Down: child -> parent */
12253 pipe(pu); /* Up: parent -> child */
12254 if (0 != fork()) {
12255 int ret;
12256 close(pd[1]); /* Parent reads from pd[0] */
12257 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 12258#ifdef F_SETFL
b4eb6b3d
JH
12259 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12260 exit(1);
a0acbdc3
JH
12261#else
12262 exit(4);
12263#endif
b4eb6b3d
JH
12264 signal(SIGALRM, blech);
12265 alarm(5);
12266 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
12267 exit(2);
12268 sprintf(string, "%d\n", ret);
12269 write(2, string, strlen(string));
12270 alarm(0);
12271#ifdef EAGAIN
12272 if (errno == EAGAIN) {
12273 printf("EAGAIN\n");
12274 goto ok;
12275 }
12276#endif
12277#ifdef EWOULDBLOCK
12278 if (errno == EWOULDBLOCK)
12279 printf("EWOULDBLOCK\n");
12280#endif
12281 ok:
12282 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
12283 sleep(2); /* Give it time to close our pipe */
12284 alarm(5);
12285 ret = read(pd[0], buf, 1); /* Should read EOF */
12286 alarm(0);
12287 sprintf(string, "%d\n", ret);
868439a2 12288 write(4, string, strlen(string));
b4eb6b3d
JH
12289 exit(0);
12290 }
12291
12292 close(pd[0]); /* We write to pd[1] */
12293 close(pu[1]); /* We read from pu[0] */
12294 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
12295 close(pd[1]); /* Pipe pd is now fully closed! */
12296 exit(0); /* Bye bye, thank you for playing! */
12297}
12298EOCP
12299 set try
12300 if eval $compile_ok; then
12301 echo "$startsh" >mtry
868439a2 12302 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
12303 chmod +x mtry
12304 ./mtry >/dev/null 2>&1
12305 case $? in
12306 0) eagain=`$cat try.out`;;
12307 1) echo "Could not perform non-blocking setting!";;
12308 2) echo "I did a successful read() for something that was not there!";;
12309 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 12310 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
12311 *) echo "Something terribly wrong happened during testing.";;
12312 esac
12313 rd_nodata=`$cat try.ret`
12314 echo "A read() system call with no data present returns $rd_nodata."
12315 case "$rd_nodata" in
12316 0|-1) ;;
12317 *)
12318 echo "(That's peculiar, fixing that to be -1.)"
12319 rd_nodata=-1
12320 ;;
12321 esac
12322 case "$eagain" in
12323 '')
12324 echo "Forcing errno EAGAIN on read() with no data available."
12325 eagain=EAGAIN
12326 ;;
12327 *)
12328 echo "Your read() sets errno to $eagain when no data is available."
12329 ;;
12330 esac
12331 status=`$cat try.err`
12332 case "$status" in
12333 0) echo "And it correctly returns 0 to signal EOF.";;
12334 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12335 *) echo "However, your read() returns '$status' on EOF??";;
12336 esac
12337 val="$define"
12338 if test "$status" = "$rd_nodata"; then
12339 echo "WARNING: you can't distinguish between EOF and no data!"
12340 val="$undef"
12341 fi
12342 else
12343 echo "I can't compile the test program--assuming errno EAGAIN will do."
12344 eagain=EAGAIN
12345 fi
12346 set d_eofnblk
12347 eval $setvar
12348 ;;
12349*)
12350 echo "Using $hint value $eagain."
12351 echo "Your read() returns $rd_nodata when no data is present."
12352 case "$d_eofnblk" in
12353 "$define") echo "And you can see EOF because read() returns 0.";;
12354 "$undef") echo "But you can't see EOF status from read() returned value.";;
12355 *)
12356 echo "(Assuming you can't see EOF status from read anyway.)"
12357 d_eofnblk=$undef
12358 ;;
12359 esac
12360 ;;
12361esac
12362$rm -f try try.* .out core head.c mtry
12363
15b61c98
JH
12364: see if _ptr and _cnt from stdio act std
12365echo " "
b4eb6b3d 12366
15b61c98
JH
12367if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12368 echo "(Looks like you have stdio.h from BSD.)"
12369 case "$stdio_ptr" in
12370 '') stdio_ptr='((fp)->_p)'
12371 ptr_lval=$define
12372 ;;
12373 *) ptr_lval=$d_stdio_ptr_lval;;
12374 esac
12375 case "$stdio_cnt" in
12376 '') stdio_cnt='((fp)->_r)'
12377 cnt_lval=$define
12378 ;;
12379 *) cnt_lval=$d_stdio_cnt_lval;;
12380 esac
12381 case "$stdio_base" in
12382 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12383 esac
12384 case "$stdio_bufsiz" in
12385 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12386 esac
12387elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12388 echo "(Looks like you have stdio.h from Linux.)"
12389 case "$stdio_ptr" in
12390 '') stdio_ptr='((fp)->_IO_read_ptr)'
12391 ptr_lval=$define
12392 ;;
12393 *) ptr_lval=$d_stdio_ptr_lval;;
12394 esac
12395 case "$stdio_cnt" in
12396 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12397 cnt_lval=$undef
12398 ;;
12399 *) cnt_lval=$d_stdio_cnt_lval;;
12400 esac
12401 case "$stdio_base" in
12402 '') stdio_base='((fp)->_IO_read_base)';;
12403 esac
12404 case "$stdio_bufsiz" in
12405 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12406 esac
12407else
12408 case "$stdio_ptr" in
12409 '') stdio_ptr='((fp)->_ptr)'
12410 ptr_lval=$define
12411 ;;
12412 *) ptr_lval=$d_stdio_ptr_lval;;
12413 esac
12414 case "$stdio_cnt" in
12415 '') stdio_cnt='((fp)->_cnt)'
12416 cnt_lval=$define
12417 ;;
12418 *) cnt_lval=$d_stdio_cnt_lval;;
12419 esac
12420 case "$stdio_base" in
12421 '') stdio_base='((fp)->_base)';;
12422 esac
12423 case "$stdio_bufsiz" in
12424 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12425 esac
12426fi
b4eb6b3d 12427
15b61c98
JH
12428: test whether _ptr and _cnt really work
12429echo "Checking how std your stdio is..." >&4
12430$cat >try.c <<EOP
12431#include <stdio.h>
55954f19
JH
12432#$i_stdlib I_STDLIB
12433#ifdef I_STDLIB
9d9004a9 12434#include <stdlib.h>
55954f19 12435#endif
15b61c98
JH
12436#define FILE_ptr(fp) $stdio_ptr
12437#define FILE_cnt(fp) $stdio_cnt
9d9004a9 12438int main() {
15b61c98
JH
12439 FILE *fp = fopen("try.c", "r");
12440 char c = getc(fp);
12441 if (
12442 18 <= FILE_cnt(fp) &&
12443 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12444 )
12445 exit(0);
12446 exit(1);
9d9004a9 12447}
15b61c98
JH
12448EOP
12449val="$undef"
12450set try
12451if eval $compile && $to try.c; then
12452 if $run ./try; then
12453 echo "Your stdio acts pretty std."
12454 val="$define"
9d9004a9 12455 else
15b61c98 12456 echo "Your stdio isn't very std."
9d9004a9 12457 fi
15b61c98
JH
12458else
12459 echo "Your stdio doesn't appear very std."
12460fi
12461$rm -f try.c try
12462
12463# glibc 2.2.90 and above apparently change stdio streams so Perl's
12464# direct buffer manipulation no longer works. The Configure tests
12465# should be changed to correctly detect this, but until then,
12466# the following check should at least let perl compile and run.
12467# (This quick fix should be updated before 5.8.1.)
12468# To be defensive, reject all unknown versions, and all versions > 2.2.9.
12469# A. Dougherty, June 3, 2002.
12470case "$d_gnulibc" in
12471$define)
12472 case "$gnulibc_version" in
12473 2.[01]*) ;;
12474 2.2) ;;
12475 2.2.[0-9]) ;;
12476 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12477 val="$undef"
12478 ;;
12479 esac
9d9004a9
AD
12480 ;;
12481esac
15b61c98 12482set d_stdstdio
9d9004a9 12483eval $setvar
9d9004a9 12484
15b61c98
JH
12485: Can _ptr be used as an lvalue?
12486case "$d_stdstdio$ptr_lval" in
12487$define$define) val=$define ;;
12488*) val=$undef ;;
12489esac
12490set d_stdio_ptr_lval
12491eval $setvar
9d9004a9 12492
15b61c98
JH
12493: Can _cnt be used as an lvalue?
12494case "$d_stdstdio$cnt_lval" in
12495$define$define) val=$define ;;
12496*) val=$undef ;;
12497esac
12498set d_stdio_cnt_lval
12499eval $setvar
b4eb6b3d 12500
15b61c98
JH
12501
12502: test whether setting _ptr sets _cnt as a side effect
12503d_stdio_ptr_lval_sets_cnt="$undef"
12504d_stdio_ptr_lval_nochange_cnt="$undef"
12505case "$d_stdio_ptr_lval$d_stdstdio" in
12506$define$define)
12507 echo "Checking to see what happens if we set the stdio ptr..." >&4
12508$cat >try.c <<EOP
12509#include <stdio.h>
12510/* Can we scream? */
12511/* Eat dust sed :-) */
12512/* In the buffer space, no one can hear you scream. */
55954f19
JH
12513#$i_stdlib I_STDLIB
12514#ifdef I_STDLIB
12515#include <stdlib.h>
12516#endif
15b61c98
JH
12517#define FILE_ptr(fp) $stdio_ptr
12518#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 12519#include <sys/types.h>
b4eb6b3d 12520int main() {
15b61c98
JH
12521 FILE *fp = fopen("try.c", "r");
12522 int c;
12523 char *ptr;
12524 size_t cnt;
12525 if (!fp) {
12526 puts("Fail even to read");
12527 exit(1);
12528 }
12529 c = getc(fp); /* Read away the first # */
12530 if (c == EOF) {
12531 puts("Fail even to read");
12532 exit(1);
12533 }
12534 if (!(
12535 18 <= FILE_cnt(fp) &&
12536 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12537 )) {
12538 puts("Fail even to read");
12539 exit (1);
12540 }
12541 ptr = (char*) FILE_ptr(fp);
12542 cnt = (size_t)FILE_cnt(fp);
12543
12544 FILE_ptr(fp) += 42;
12545
12546 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12547 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12548 exit (1);
12549 }
12550 if (FILE_cnt(fp) <= 20) {
12551 printf ("Fail (<20 chars to test)");
12552 exit (1);
12553 }
12554 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12555 puts("Fail compare");
12556 exit (1);
12557 }
12558 if (cnt == FILE_cnt(fp)) {
12559 puts("Pass_unchanged");
12560 exit (0);
12561 }
12562 if (FILE_cnt(fp) == (cnt - 42)) {
12563 puts("Pass_changed");
12564 exit (0);
12565 }
12566 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12567 return 1;
12568
12569}
12570EOP
12571 set try
12572 if eval $compile && $to try.c; then
12573 case `$run ./try` in
12574 Pass_changed)
12575 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
12576 d_stdio_ptr_lval_sets_cnt="$define" ;;
12577 Pass_unchanged)
12578 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12579 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12580 Fail*)
12581 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12582 *)
12583 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12584 esac
12585 else
12586 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12587 fi
12588 $rm -f try.c try
12589 ;;
12590esac
12591
12592: see if _base is also standard
12593val="$undef"
12594case "$d_stdstdio" in
12595$define)
12596 $cat >try.c <<EOP
12597#include <stdio.h>
12598#$i_stdlib I_STDLIB
12599#ifdef I_STDLIB
12600#include <stdlib.h>
12601#endif
12602#define FILE_base(fp) $stdio_base
12603#define FILE_bufsiz(fp) $stdio_bufsiz
12604int main() {
12605 FILE *fp = fopen("try.c", "r");
12606 char c = getc(fp);
12607 if (
12608 19 <= FILE_bufsiz(fp) &&
12609 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12610 )
12611 exit(0);
12612 exit(1);
12613}
12614EOP
12615 set try
12616 if eval $compile && $to try.c; then
12617 if $run ./try; then
12618 echo "And its _base field acts std."
12619 val="$define"
12620 else
12621 echo "But its _base field isn't std."
12622 fi
12623 else
12624 echo "However, it seems to be lacking the _base field."
12625 fi
12626 $rm -f try.c try
12627 ;;
12628esac
12629set d_stdiobase
12630eval $setvar
12631
12632: see if fast_stdio exists
12633val="$undef"
12634case "$d_stdstdio:$d_stdio_ptr_lval" in
12635"$define:$define")
12636 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12637 *$define*)
12638 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12639 val="$define"
12640 ;;
12641 esac
12642 ;;
12643esac
12644set d_faststdio
12645eval $setvar
12646
12647
12648
12649: see if fchdir exists
12650set fchdir d_fchdir
12651eval $inlibc
12652
12653: see if fchmod exists
12654set fchmod d_fchmod
12655eval $inlibc
12656
12657: see if fchown exists
12658set fchown d_fchown
12659eval $inlibc
12660
12661: see if this is an fcntl system
12662set fcntl d_fcntl
12663eval $inlibc
12664
12665echo " "
12666: See if fcntl-based locking works.
12667$cat >try.c <<EOCP
12668#$i_stdlib I_STDLIB
12669#ifdef I_STDLIB
12670#include <stdlib.h>
12671#endif
12672#include <unistd.h>
12673#include <fcntl.h>
12674#include <signal.h>
7090f861 12675$signal_t blech(int x) { exit(3); }
15b61c98
JH
12676int main() {
12677#if defined(F_SETLK) && defined(F_SETLKW)
12678 struct flock flock;
12679 int retval, fd;
12680 fd = open("try.c", O_RDONLY);
12681 flock.l_type = F_RDLCK;
12682 flock.l_whence = SEEK_SET;
12683 flock.l_start = flock.l_len = 0;
12684 signal(SIGALRM, blech);
12685 alarm(10);
12686 retval = fcntl(fd, F_SETLK, &flock);
12687 close(fd);
12688 (retval < 0 ? exit(2) : exit(0));
12689#else
12690 exit(2);
12691#endif
12692}
12693EOCP
12694echo "Checking if fcntl-based file locking works... "
12695case "$d_fcntl" in
12696"$define")
12697 set try
12698 if eval $compile_ok; then
12699 if $run ./try; then
12700 echo "Yes, it seems to work."
12701 val="$define"
12702 else
12703 echo "Nope, it didn't work."
12704 val="$undef"
12705 case "$?" in
12706 3) $cat >&4 <<EOM
12707***
12708*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12709*** This is (almost) impossible.
12710*** If your NFS lock daemons are not feeling well, something like
12711*** this may happen, please investigate. Cannot continue, aborting.
12712***
12713EOM
12714 exit 1
12715 ;;
12716 esac
12717 fi
12718 else
12719 echo "I'm unable to compile the test program, so I'll assume not."
12720 val="$undef"
12721 fi
12722 ;;
12723*) val="$undef";
12724 echo "Nope, since you don't even have fcntl()."
12725 ;;
12726esac
12727set d_fcntl_can_lock
12728eval $setvar
12729$rm -f try*
12730
12731
12732: check for fd_set items
12733$cat <<EOM
12734
12735Checking to see how well your C compiler handles fd_set and friends ...
12736EOM
12737$cat >try.c <<EOCP
12738#$i_stdlib I_STDLIB
12739#ifdef I_STDLIB
12740#include <stdlib.h>
12741#endif
12742#$i_systime I_SYS_TIME
12743#$i_sysselct I_SYS_SELECT
12744#$d_socket HAS_SOCKET
12745#include <sys/types.h>
12746#ifdef HAS_SOCKET
12747#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12748#endif
12749#ifdef I_SYS_TIME
12750#include <sys/time.h>
12751#endif
12752#ifdef I_SYS_SELECT
12753#include <sys/select.h>
12754#endif
12755int main() {
12756 fd_set fds;
12757
12758#ifdef TRYBITS
12759 if(fds.fds_bits);
12760#endif
12761
12762#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12763 exit(0);
12764#else
12765 exit(1);
12766#endif
12767}
12768EOCP
12769set try -DTRYBITS
12770if eval $compile; then
12771 d_fds_bits="$define"
12772 d_fd_set="$define"
12773 echo "Well, your system knows about the normal fd_set typedef..." >&4
12774 if $run ./try; then
b4eb6b3d
JH
12775 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12776 d_fd_macros="$define"
12777 else
12778 $cat >&4 <<'EOM'
12779but not the normal fd_set macros! Gaaack! I'll have to cover for you.
12780EOM
12781 d_fd_macros="$undef"
12782 fi
12783else
12784 $cat <<'EOM'
12785Hmm, your compiler has some difficulty with fd_set. Checking further...
12786EOM
5440bc8e 12787 set try
b4eb6b3d
JH
12788 if eval $compile; then
12789 d_fds_bits="$undef"
12790 d_fd_set="$define"
12791 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 12792 if $run ./try; then
b4eb6b3d
JH
12793 echo "and you have the normal fd_set macros." >&4
12794 d_fd_macros="$define"
12795 else
12796 $cat <<'EOM'
12797but not the normal fd_set macros! Gross! More work for me...
12798EOM
12799 d_fd_macros="$undef"
12800 fi
12801 else
12802 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
12803 d_fd_set="$undef"
12804 d_fds_bits="$undef"
12805 d_fd_macros="$undef"
12806 fi
12807fi
5440bc8e 12808$rm -f try try.*
b4eb6b3d
JH
12809
12810: see if fgetpos exists
12811set fgetpos d_fgetpos
12812eval $inlibc
12813
758a5d79
JH
12814: see if finite exists
12815set finite d_finite
12816eval $inlibc
12817
12818: see if finitel exists
12819set finitel d_finitel
12820eval $inlibc
12821
b4eb6b3d
JH
12822: see if flock exists
12823set flock d_flock
12824eval $inlibc
12825
2ef53570
JH
12826: see if prototype for flock is available
12827echo " "
12828set d_flockproto flock $i_sysfile sys/file.h
12829eval $hasproto
12830
b4eb6b3d
JH
12831: see if fork exists
12832set fork d_fork
12833eval $inlibc
12834
758a5d79
JH
12835: see if fp_class exists
12836set fp_class d_fp_class
12837eval $inlibc
12838
b4eb6b3d
JH
12839: see if pathconf exists
12840set pathconf d_pathconf
12841eval $inlibc
12842
12843: see if fpathconf exists
12844set fpathconf d_fpathconf
12845eval $inlibc
12846
758a5d79
JH
12847: see if fpclass exists
12848set fpclass d_fpclass
12849eval $inlibc
12850
12851: see if fpclassify exists
12852set fpclassify d_fpclassify
12853eval $inlibc
12854
12855: see if fpclassl exists
12856set fpclassl d_fpclassl
12857eval $inlibc
12858
b4eb6b3d
JH
12859
12860: check for fpos64_t
12861echo " "
12862echo "Checking to see if you have fpos64_t..." >&4
12863$cat >try.c <<EOCP
12864#include <stdio.h>
12865int main() { fpos64_t x = 7; }
12866EOCP
12867set try
12868if eval $compile; then
12869 val="$define"
12870 echo "You have fpos64_t."
12871else
12872 val="$undef"
12873 echo "You do not have fpos64_t."
12874 case "$fpossize" in
12875 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12876 esac
12877fi
12878$rm -f try.* try
12879set d_fpos64_t
12880eval $setvar
12881
12882: see if frexpl exists
12883set frexpl d_frexpl
12884eval $inlibc
12885
b4eb6b3d
JH
12886: see if this is a sys/param system
12887set sys/param.h i_sysparam
12888eval $inhdr
12889
12890: see if this is a sys/mount.h system
12891set sys/mount.h i_sysmount
12892eval $inhdr
12893
b4eb6b3d
JH
12894
12895echo " "
12896echo "Checking to see if your system supports struct fs_data..." >&4
12897set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12898eval $hasstruct
12899case "$d_fs_data_s" in
12900"$define") echo "Yes, it does." ;;
12901*) echo "No, it doesn't." ;;
12902esac
12903
12904: see if fseeko exists
12905set fseeko d_fseeko
12906eval $inlibc
12907case "$longsize" in
129088) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12909esac
12910
12911: see if fsetpos exists
12912set fsetpos d_fsetpos
12913eval $inlibc
12914
12915
12916: see if fstatfs exists
12917set fstatfs d_fstatfs
12918eval $inlibc
12919
12920
12921: see if statvfs exists
12922set statvfs d_statvfs
12923eval $inlibc
12924
12925: see if fstatvfs exists
12926set fstatvfs d_fstatvfs
12927eval $inlibc
12928
12929
411ab01c
JH
12930: see if fsync exists
12931set fsync d_fsync
12932eval $inlibc
12933
b4eb6b3d
JH
12934: see if ftello exists
12935set ftello d_ftello
12936eval $inlibc
12937case "$longsize" in
129388) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12939esac
12940
bff98e24
SP
12941d_futimes="$undef"
12942: check for a working futimes
12943echo " "
12944echo "Checking for a working futimes()" >&4
12945$cat >try.c <<EOCP
12946#include <stdio.h>
12947#include <sys/time.h>
12948#include <errno.h>
12949#include <fcntl.h>
12950
12951int main ()
12952{
12953 int fd, rv;
12954 fd = open ("try.c", O_RDWR);
12955 if (-1 == fd) exit (1);
12956 rv = futimes (fd, NULL);
12957 exit (rv == -1 ? errno : 0);
12958}
12959EOCP
12960set try
12961if eval $compile; then
12962 `$run ./try`
12963 rc=$?
12964 case "$rc" in
12965 0) echo "Yes, it does" >&4
12966 d_futimes="$define"
12967 ;;
12968 *) echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12969 ;;
12970 esac
12971else
12972 echo "No, it does not (probably harmless)\n" >&4
12973fi
12974$rm -f try.* try core core.try.*
dc814df1 12975
b4eb6b3d
JH
12976: see if getcwd exists
12977set getcwd d_getcwd
12978eval $inlibc
12979
12980: see if getespwnam exists
12981set getespwnam d_getespwnam
12982eval $inlibc
12983
12984
12985: see if getfsstat exists
12986set getfsstat d_getfsstat
12987eval $inlibc
12988
12989: see if getgrent exists
12990set getgrent d_getgrent
12991eval $inlibc
12992
10bc17b6
JH
12993: see if getgrent_r exists
12994set getgrent_r d_getgrent_r
12995eval $inlibc
12996case "$d_getgrent_r" in
12997"$define")
12998 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12999 case "$d_getgrent_r_proto:$usethreads" in
13000 ":define") d_getgrent_r_proto=define
a48ec845
JH
13001 set d_getgrent_r_proto getgrent_r $hdrs
13002 eval $hasproto ;;
13003 *) ;;
13004 esac
13005 case "$d_getgrent_r_proto" in
13006 define)
10bc17b6
JH
13007 case "$getgrent_r_proto" in
13008 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13009 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13010 esac
13011 case "$getgrent_r_proto" in
13012 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13013 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13014 esac
13015 case "$getgrent_r_proto" in
13016 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13017 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13018 esac
13019 case "$getgrent_r_proto" in
13020 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13021 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13022 esac
13023 case "$getgrent_r_proto" in
13024 ''|0) try='int getgrent_r(struct group*, char*, int);'
13025 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13026 esac
13027 case "$getgrent_r_proto" in
13028 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13029 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13030 esac
13031 case "$getgrent_r_proto" in
90e831dc 13032 ''|0) d_getgrent_r=undef
10bc17b6 13033 getgrent_r_proto=0
a48ec845 13034 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13035 * ) case "$getgrent_r_proto" in
13036 REENTRANT_PROTO*) ;;
13037 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13038 esac
13039 echo "Prototype: $try" ;;
13040 esac
13041 ;;
c18e646a
JH
13042 *) case "$usethreads" in
13043 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13044 esac
90e831dc
SB
13045 d_getgrent_r=undef
13046 getgrent_r_proto=0
c18e646a 13047 ;;
a48ec845
JH
13048 esac
13049 ;;
10bc17b6
JH
13050*) getgrent_r_proto=0
13051 ;;
13052esac
13053
13054: see if getgrgid_r exists
13055set getgrgid_r d_getgrgid_r
13056eval $inlibc
13057case "$d_getgrgid_r" in
13058"$define")
13059 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13060 case "$d_getgrgid_r_proto:$usethreads" in
13061 ":define") d_getgrgid_r_proto=define
a48ec845
JH
13062 set d_getgrgid_r_proto getgrgid_r $hdrs
13063 eval $hasproto ;;
13064 *) ;;
13065 esac
13066 case "$d_getgrgid_r_proto" in
13067 define)
10bc17b6
JH
13068 case "$getgrgid_r_proto" in
13069 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13070 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13071 esac
13072 case "$getgrgid_r_proto" in
13073 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13074 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13075 esac
13076 case "$getgrgid_r_proto" in
13077 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13078 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13079 esac
13080 case "$getgrgid_r_proto" in
13081 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13082 ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13083 esac
13084 case "$getgrgid_r_proto" in
90e831dc 13085 ''|0) d_getgrgid_r=undef
10bc17b6 13086 getgrgid_r_proto=0
a48ec845 13087 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13088 * ) case "$getgrgid_r_proto" in
13089 REENTRANT_PROTO*) ;;
13090 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13091 esac
13092 echo "Prototype: $try" ;;
13093 esac
13094 ;;
c18e646a
JH
13095 *) case "$usethreads" in
13096 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13097 esac
90e831dc
SB
13098 d_getgrgid_r=undef
13099 getgrgid_r_proto=0
c18e646a 13100 ;;
a48ec845
JH
13101 esac
13102 ;;
10bc17b6
JH
13103*) getgrgid_r_proto=0
13104 ;;
13105esac
13106
13107: see if getgrnam_r exists
13108set getgrnam_r d_getgrnam_r
13109eval $inlibc
13110case "$d_getgrnam_r" in
13111"$define")
13112 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13113 case "$d_getgrnam_r_proto:$usethreads" in
13114 ":define") d_getgrnam_r_proto=define
a48ec845
JH
13115 set d_getgrnam_r_proto getgrnam_r $hdrs
13116 eval $hasproto ;;
13117 *) ;;
13118 esac
13119 case "$d_getgrnam_r_proto" in
13120 define)
10bc17b6
JH
13121 case "$getgrnam_r_proto" in
13122 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13123 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13124 esac
13125 case "$getgrnam_r_proto" in
13126 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13127 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13128 esac
13129 case "$getgrnam_r_proto" in
13130 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13131 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13132 esac
13133 case "$getgrnam_r_proto" in
13134 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13135 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13136 esac
13137 case "$getgrnam_r_proto" in
13138 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13139 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13140 esac
13141 case "$getgrnam_r_proto" in
90e831dc 13142 ''|0) d_getgrnam_r=undef
10bc17b6 13143 getgrnam_r_proto=0
a48ec845 13144 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13145 * ) case "$getgrnam_r_proto" in
13146 REENTRANT_PROTO*) ;;
13147 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13148 esac
13149 echo "Prototype: $try" ;;
13150 esac
13151 ;;
c18e646a
JH
13152 *) case "$usethreads" in
13153 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13154 esac
90e831dc
SB
13155 d_getgrnam_r=undef
13156 getgrnam_r_proto=0
c18e646a 13157 ;;
a48ec845
JH
13158 esac
13159 ;;
10bc17b6
JH
13160*) getgrnam_r_proto=0
13161 ;;
13162esac
13163
b4eb6b3d
JH
13164: see if gethostbyaddr exists
13165set gethostbyaddr d_gethbyaddr
13166eval $inlibc
13167
13168: see if gethostbyname exists
13169set gethostbyname d_gethbyname
13170eval $inlibc
13171
13172: see if gethostent exists
13173set gethostent d_gethent
13174eval $inlibc
13175
13176: see how we will look up host name
13177echo " "
13178call=''
13179if set gethostname val -f d_gethname; eval $csym; $val; then
13180 echo 'gethostname() found.' >&4
13181 d_gethname="$define"
13182 call=gethostname
13183fi
13184if set uname val -f d_uname; eval $csym; $val; then
13185 if ./xenix; then
13186 $cat <<'EOM'
13187uname() was found, but you're running xenix, and older versions of xenix
13188have a broken uname(). If you don't really know whether your xenix is old
13189enough to have a broken system call, use the default answer.
13190
13191EOM
13192 dflt=y
13193 case "$d_uname" in
13194 "$define") dflt=n;;
13195 esac
13196 rp='Is your uname() broken?'
13197 . ./myread
13198 case "$ans" in
13199 n*) d_uname="$define"; call=uname;;
13200 esac
13201 else
13202 echo 'uname() found.' >&4
13203 d_uname="$define"
13204 case "$call" in
13205 '') call=uname ;;
13206 esac
13207 fi
13208fi
13209case "$d_gethname" in
13210'') d_gethname="$undef";;
13211esac
13212case "$d_uname" in
13213'') d_uname="$undef";;
13214esac
13215case "$d_uname$d_gethname" in
13216*define*)
13217 dflt=n
13218 cat <<EOM
13219
13220Every now and then someone has a $call() that lies about the hostname
13221but can't be fixed for political or economic reasons. If you wish, I can
13222pretend $call() isn't there and maybe compute hostname at run-time
13223thanks to the '$phostname' command.
13224
13225EOM
13226 rp="Shall I ignore $call() from now on?"
13227 . ./myread
13228 case "$ans" in
13229 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13230 esac;;
13231esac
13232case "$phostname" in
13233'') aphostname='';;
13234*) case "$aphostname" in
13235 /*) ;;
13236 *) set X $phostname
13237 shift
13238 file=$1
13239 shift
13240 file=`./loc $file $file $pth`
13241 aphostname=`echo $file $*`
13242 ;;
13243 esac
13244 ;;
13245esac
13246case "$d_uname$d_gethname" in
13247*define*) ;;
13248*)
13249 case "$phostname" in
13250 '')
13251 echo "There will be no way for $package to get your hostname." >&4;;
13252 *)
13253 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13254 ;;
13255 esac;;
13256esac
13257case "$d_phostname" in
13258'') d_phostname="$undef";;
13259esac
13260
10bc17b6
JH
13261: see if gethostbyaddr_r exists
13262set gethostbyaddr_r d_gethostbyaddr_r
13263eval $inlibc
13264case "$d_gethostbyaddr_r" in
13265"$define")
13266 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13267 case "$d_gethostbyaddr_r_proto:$usethreads" in
13268 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
13269 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13270 eval $hasproto ;;
13271 *) ;;
13272 esac
13273 case "$d_gethostbyaddr_r_proto" in
13274 define)
10bc17b6
JH
13275 case "$gethostbyaddr_r_proto" in
13276 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13277 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13278 esac
13279 case "$gethostbyaddr_r_proto" in
13280 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13281 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13282 esac
13283 case "$gethostbyaddr_r_proto" in
13284 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13285 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13286 esac
13287 case "$gethostbyaddr_r_proto" in
13288 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13289 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13290 esac
13291 case "$gethostbyaddr_r_proto" in
13292 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13293 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13294 esac
13295 case "$gethostbyaddr_r_proto" in
13296 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13297 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13298 esac
13299 case "$gethostbyaddr_r_proto" in
13300 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13301 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13302 esac
13303 case "$gethostbyaddr_r_proto" in
13304 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13305 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13306 esac
13307 case "$gethostbyaddr_r_proto" in
13308 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13309 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13310 esac
13311 case "$gethostbyaddr_r_proto" in
13312 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13313 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13314 esac
13315 case "$gethostbyaddr_r_proto" in
a845a0d4
JH
13316 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13317 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13318 esac
13319 case "$gethostbyaddr_r_proto" in
90e831dc 13320 ''|0) d_gethostbyaddr_r=undef
10bc17b6 13321 gethostbyaddr_r_proto=0
a48ec845 13322 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13323 * ) case "$gethostbyaddr_r_proto" in
13324 REENTRANT_PROTO*) ;;
13325 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13326 esac
13327 echo "Prototype: $try" ;;
13328 esac
13329 ;;
c18e646a
JH
13330 *) case "$usethreads" in
13331 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13332 esac
90e831dc
SB
13333 d_gethostbyaddr_r=undef
13334 gethostbyaddr_r_proto=0
c18e646a 13335 ;;
a48ec845
JH
13336 esac
13337 ;;
10bc17b6
JH
13338*) gethostbyaddr_r_proto=0
13339 ;;
13340esac
13341
13342: see if gethostbyname_r exists
13343set gethostbyname_r d_gethostbyname_r
13344eval $inlibc
13345case "$d_gethostbyname_r" in
13346"$define")
13347 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13348 case "$d_gethostbyname_r_proto:$usethreads" in
13349 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
13350 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13351 eval $hasproto ;;
13352 *) ;;
13353 esac
13354 case "$d_gethostbyname_r_proto" in
13355 define)
10bc17b6
JH
13356 case "$gethostbyname_r_proto" in
13357 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13358 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13359 esac
13360 case "$gethostbyname_r_proto" in
13361 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13362 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13363 esac
13364 case "$gethostbyname_r_proto" in
13365 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13366 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13367 esac
13368 case "$gethostbyname_r_proto" in
90e831dc 13369 ''|0) d_gethostbyname_r=undef
10bc17b6 13370 gethostbyname_r_proto=0
a48ec845 13371 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13372 * ) case "$gethostbyname_r_proto" in
13373 REENTRANT_PROTO*) ;;
13374 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13375 esac
13376 echo "Prototype: $try" ;;
13377 esac
13378 ;;
c18e646a
JH
13379 *) case "$usethreads" in
13380 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13381 esac
90e831dc
SB
13382 d_gethostbyname_r=undef
13383 gethostbyname_r_proto=0
c18e646a 13384 ;;
a48ec845
JH
13385 esac
13386 ;;
10bc17b6
JH
13387*) gethostbyname_r_proto=0
13388 ;;
13389esac
13390
13391: see if gethostent_r exists
13392set gethostent_r d_gethostent_r
13393eval $inlibc
13394case "$d_gethostent_r" in
13395"$define")
13396 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13397 case "$d_gethostent_r_proto:$usethreads" in
13398 ":define") d_gethostent_r_proto=define
a48ec845
JH
13399 set d_gethostent_r_proto gethostent_r $hdrs
13400 eval $hasproto ;;
13401 *) ;;
13402 esac
13403 case "$d_gethostent_r_proto" in
13404 define)
10bc17b6
JH
13405 case "$gethostent_r_proto" in
13406 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13407 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13408 esac
13409 case "$gethostent_r_proto" in
13410 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13411 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13412 esac
13413 case "$gethostent_r_proto" in
13414 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13415 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13416 esac
13417 case "$gethostent_r_proto" in
13418 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13419 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13420 esac
13421 case "$gethostent_r_proto" in
13422 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13423 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13424 esac
13425 case "$gethostent_r_proto" in
13426 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13427 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13428 esac
13429 case "$gethostent_r_proto" in
90e831dc 13430 ''|0) d_gethostent_r=undef
10bc17b6 13431 gethostent_r_proto=0
a48ec845 13432 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13433 * ) case "$gethostent_r_proto" in
13434 REENTRANT_PROTO*) ;;
13435 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13436 esac
13437 echo "Prototype: $try" ;;
13438 esac
13439 ;;
c18e646a
JH
13440 *) case "$usethreads" in
13441 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13442 esac
90e831dc
SB
13443 d_gethostent_r=undef
13444 gethostent_r_proto=0
c18e646a 13445 ;;
a48ec845
JH
13446 esac
13447 ;;
10bc17b6
JH
13448*) gethostent_r_proto=0
13449 ;;
13450esac
b4eb6b3d
JH
13451
13452: see if prototypes for various gethostxxx netdb.h functions are available
13453echo " "
13454set d_gethostprotos gethostent $i_netdb netdb.h
13455eval $hasproto
13456
4e0554ec
JH
13457: see if getitimer exists
13458set getitimer d_getitimer
13459eval $inlibc
13460
b4eb6b3d
JH
13461: see if getlogin exists
13462set getlogin d_getlogin
13463eval $inlibc
13464
10bc17b6
JH
13465: see if getlogin_r exists
13466set getlogin_r d_getlogin_r
13467eval $inlibc
13468case "$d_getlogin_r" in
13469"$define")
13470 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
13471 case "$d_getlogin_r_proto:$usethreads" in
13472 ":define") d_getlogin_r_proto=define
a48ec845
JH
13473 set d_getlogin_r_proto getlogin_r $hdrs
13474 eval $hasproto ;;
13475 *) ;;
13476 esac
13477 case "$d_getlogin_r_proto" in
13478 define)
10bc17b6
JH
13479 case "$getlogin_r_proto" in
13480 ''|0) try='int getlogin_r(char*, size_t);'
13481 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13482 esac
13483 case "$getlogin_r_proto" in
13484 ''|0) try='int getlogin_r(char*, int);'
13485 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13486 esac
13487 case "$getlogin_r_proto" in
13488 ''|0) try='char* getlogin_r(char*, size_t);'
13489 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13490 esac
13491 case "$getlogin_r_proto" in
13492 ''|0) try='char* getlogin_r(char*, int);'
13493 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13494 esac
13495 case "$getlogin_r_proto" in
90e831dc 13496 ''|0) d_getlogin_r=undef
10bc17b6 13497 getlogin_r_proto=0
a48ec845 13498 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13499 * ) case "$getlogin_r_proto" in
13500 REENTRANT_PROTO*) ;;
13501 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13502 esac
13503 echo "Prototype: $try" ;;
13504 esac
13505 ;;
c18e646a
JH
13506 *) case "$usethreads" in
13507 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13508 esac
90e831dc
SB
13509 d_getlogin_r=undef
13510 getlogin_r_proto=0
c18e646a 13511 ;;
a48ec845
JH
13512 esac
13513 ;;
10bc17b6
JH
13514*) getlogin_r_proto=0
13515 ;;
13516esac
13517
b4eb6b3d
JH
13518: see if getmnt exists
13519set getmnt d_getmnt
13520eval $inlibc
13521
13522: see if getmntent exists
13523set getmntent d_getmntent
13524eval $inlibc
13525
13526: see if getnetbyaddr exists
13527set getnetbyaddr d_getnbyaddr
13528eval $inlibc
13529
13530: see if getnetbyname exists
13531set getnetbyname d_getnbyname
13532eval $inlibc
13533
13534: see if getnetent exists
13535set getnetent d_getnent
13536eval $inlibc
13537
10bc17b6
JH
13538: see if getnetbyaddr_r exists
13539set getnetbyaddr_r d_getnetbyaddr_r
13540eval $inlibc
13541case "$d_getnetbyaddr_r" in
13542"$define")
13543 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13544 case "$d_getnetbyaddr_r_proto:$usethreads" in
13545 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
13546 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13547 eval $hasproto ;;
13548 *) ;;
13549 esac
13550 case "$d_getnetbyaddr_r_proto" in
13551 define)
10bc17b6
JH
13552 case "$getnetbyaddr_r_proto" in
13553 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13554 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13555 esac
13556 case "$getnetbyaddr_r_proto" in
13557 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13558 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13559 esac
13560 case "$getnetbyaddr_r_proto" in
13561 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13562 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13563 esac
13564 case "$getnetbyaddr_r_proto" in
13565 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13566 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13567 esac
13568 case "$getnetbyaddr_r_proto" in
13569 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13570 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13571 esac
13572 case "$getnetbyaddr_r_proto" in
13573 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13574 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13575 esac
13576 case "$getnetbyaddr_r_proto" in
13577 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13578 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13579 esac
13580 case "$getnetbyaddr_r_proto" in
a845a0d4
JH
13581 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13582 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13583 esac
13584 case "$getnetbyaddr_r_proto" in
90e831dc 13585 ''|0) d_getnetbyaddr_r=undef
10bc17b6 13586 getnetbyaddr_r_proto=0
a48ec845 13587 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13588 * ) case "$getnetbyaddr_r_proto" in
13589 REENTRANT_PROTO*) ;;
13590 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13591 esac
13592 echo "Prototype: $try" ;;
13593 esac
13594 ;;
c18e646a
JH
13595 *) case "$usethreads" in
13596 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13597 esac
90e831dc
SB
13598 d_getnetbyaddr_r=undef
13599 getnetbyaddr_r_proto=0
c18e646a 13600 ;;
a48ec845
JH
13601 esac
13602 ;;
10bc17b6
JH
13603*) getnetbyaddr_r_proto=0
13604 ;;
13605esac
13606
13607: see if getnetbyname_r exists
13608set getnetbyname_r d_getnetbyname_r
13609eval $inlibc
13610case "$d_getnetbyname_r" in
13611"$define")
13612 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13613 case "$d_getnetbyname_r_proto:$usethreads" in
13614 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
13615 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13616 eval $hasproto ;;
13617 *) ;;
13618 esac
13619 case "$d_getnetbyname_r_proto" in
13620 define)
10bc17b6
JH
13621 case "$getnetbyname_r_proto" in
13622 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13623 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13624 esac
13625 case "$getnetbyname_r_proto" in
13626 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13627 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13628 esac
13629 case "$getnetbyname_r_proto" in
13630 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13631 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13632 esac
13633 case "$getnetbyname_r_proto" in
13634 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13635 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13636 esac
13637 case "$getnetbyname_r_proto" in
90e831dc 13638 ''|0) d_getnetbyname_r=undef
10bc17b6 13639 getnetbyname_r_proto=0
a48ec845 13640 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13641 * ) case "$getnetbyname_r_proto" in
13642 REENTRANT_PROTO*) ;;
13643 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13644 esac
13645 echo "Prototype: $try" ;;
13646 esac
13647 ;;
c18e646a
JH
13648 *) case "$usethreads" in
13649 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13650 esac
90e831dc
SB
13651 d_getnetbyname_r=undef
13652 getnetbyname_r_proto=0
c18e646a 13653 ;;
a48ec845
JH
13654 esac
13655 ;;
10bc17b6
JH
13656*) getnetbyname_r_proto=0
13657 ;;
13658esac
13659
13660: see if getnetent_r exists
13661set getnetent_r d_getnetent_r
13662eval $inlibc
13663case "$d_getnetent_r" in
13664"$define")
13665 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13666 case "$d_getnetent_r_proto:$usethreads" in
13667 ":define") d_getnetent_r_proto=define
a48ec845
JH
13668 set d_getnetent_r_proto getnetent_r $hdrs
13669 eval $hasproto ;;
13670 *) ;;
13671 esac
13672 case "$d_getnetent_r_proto" in
13673 define)
10bc17b6
JH
13674 case "$getnetent_r_proto" in
13675 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13676 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13677 esac
13678 case "$getnetent_r_proto" in
13679 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13680 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13681 esac
13682 case "$getnetent_r_proto" in
13683 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13684 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13685 esac
13686 case "$getnetent_r_proto" in
13687 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13688 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13689 esac
13690 case "$getnetent_r_proto" in
13691 ''|0) try='int getnetent_r(struct netent*, char*, int);'
13692 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13693 esac
13694 case "$getnetent_r_proto" in
13695 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13696 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13697 esac
13698 case "$getnetent_r_proto" in
90e831dc 13699 ''|0) d_getnetent_r=undef
10bc17b6 13700 getnetent_r_proto=0
a48ec845 13701 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13702 * ) case "$getnetent_r_proto" in
13703 REENTRANT_PROTO*) ;;
13704 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13705 esac
13706 echo "Prototype: $try" ;;
13707 esac
13708 ;;
c18e646a
JH
13709 *) case "$usethreads" in
13710 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13711 esac
90e831dc
SB
13712 d_getnetent_r=undef
13713 getnetent_r_proto=0
c18e646a 13714 ;;
a48ec845
JH
13715 esac
13716 ;;
10bc17b6
JH
13717*) getnetent_r_proto=0
13718 ;;
13719esac
13720
b4eb6b3d
JH
13721: see if prototypes for various getnetxxx netdb.h functions are available
13722echo " "
13723set d_getnetprotos getnetent $i_netdb netdb.h
13724eval $hasproto
13725
0c0643d0
JH
13726: see if getpagesize exists
13727set getpagesize d_getpagsz
13728eval $inlibc
13729
b4eb6b3d
JH
13730
13731: see if getprotobyname exists
13732set getprotobyname d_getpbyname
13733eval $inlibc
13734
13735: see if getprotobynumber exists
13736set getprotobynumber d_getpbynumber
13737eval $inlibc
13738
13739: see if getprotoent exists
13740set getprotoent d_getpent
13741eval $inlibc
13742
13743: see if getpgid exists
13744set getpgid d_getpgid
13745eval $inlibc
13746
13747: see if getpgrp2 exists
13748set getpgrp2 d_getpgrp2
13749eval $inlibc
13750
13751: see if getppid exists
13752set getppid d_getppid
13753eval $inlibc
13754
13755: see if getpriority exists
13756set getpriority d_getprior
13757eval $inlibc
13758
10bc17b6
JH
13759: see if getprotobyname_r exists
13760set getprotobyname_r d_getprotobyname_r
13761eval $inlibc
13762case "$d_getprotobyname_r" in
13763"$define")
13764 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13765 case "$d_getprotobyname_r_proto:$usethreads" in
13766 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
13767 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13768 eval $hasproto ;;
13769 *) ;;
13770 esac
13771 case "$d_getprotobyname_r_proto" in
13772 define)
10bc17b6
JH
13773 case "$getprotobyname_r_proto" in
13774 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13775 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13776 esac
13777 case "$getprotobyname_r_proto" in
13778 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13779 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13780 esac
13781 case "$getprotobyname_r_proto" in
13782 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13783 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13784 esac
13785 case "$getprotobyname_r_proto" in
90e831dc 13786 ''|0) d_getprotobyname_r=undef
10bc17b6 13787 getprotobyname_r_proto=0
a48ec845 13788 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13789 * ) case "$getprotobyname_r_proto" in
13790 REENTRANT_PROTO*) ;;
13791 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13792 esac
13793 echo "Prototype: $try" ;;
13794 esac
13795 ;;
c18e646a
JH
13796 *) case "$usethreads" in
13797 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13798 esac
90e831dc
SB
13799 d_getprotobyname_r=undef
13800 getprotobyname_r_proto=0
c18e646a 13801 ;;
a48ec845
JH
13802 esac
13803 ;;
10bc17b6
JH
13804*) getprotobyname_r_proto=0
13805 ;;
13806esac
13807
13808: see if getprotobynumber_r exists
13809set getprotobynumber_r d_getprotobynumber_r
13810eval $inlibc
13811case "$d_getprotobynumber_r" in
13812"$define")
13813 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13814 case "$d_getprotobynumber_r_proto:$usethreads" in
13815 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
13816 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13817 eval $hasproto ;;
13818 *) ;;
13819 esac
13820 case "$d_getprotobynumber_r_proto" in
13821 define)
10bc17b6
JH
13822 case "$getprotobynumber_r_proto" in
13823 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13824 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13825 esac
13826 case "$getprotobynumber_r_proto" in
13827 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13828 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13829 esac
13830 case "$getprotobynumber_r_proto" in
13831 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13832 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13833 esac
13834 case "$getprotobynumber_r_proto" in
90e831dc 13835 ''|0) d_getprotobynumber_r=undef
10bc17b6 13836 getprotobynumber_r_proto=0
a48ec845 13837 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13838 * ) case "$getprotobynumber_r_proto" in
13839 REENTRANT_PROTO*) ;;
13840 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13841 esac
13842 echo "Prototype: $try" ;;
13843 esac
13844 ;;
c18e646a
JH
13845 *) case "$usethreads" in
13846 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13847 esac
90e831dc
SB
13848 d_getprotobynumber_r=undef
13849 getprotobynumber_r_proto=0
c18e646a 13850 ;;
a48ec845
JH
13851 esac
13852 ;;
10bc17b6
JH
13853*) getprotobynumber_r_proto=0
13854 ;;
13855esac
13856
13857: see if getprotoent_r exists
13858set getprotoent_r d_getprotoent_r
13859eval $inlibc
13860case "$d_getprotoent_r" in
13861"$define")
13862 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13863 case "$d_getprotoent_r_proto:$usethreads" in
13864 ":define") d_getprotoent_r_proto=define
a48ec845
JH
13865 set d_getprotoent_r_proto getprotoent_r $hdrs
13866 eval $hasproto ;;
13867 *) ;;
13868 esac
13869 case "$d_getprotoent_r_proto" in
13870 define)
10bc17b6
JH
13871 case "$getprotoent_r_proto" in
13872 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13873 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13874 esac
13875 case "$getprotoent_r_proto" in
13876 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13877 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13878 esac
13879 case "$getprotoent_r_proto" in
13880 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13881 ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13882 esac
13883 case "$getprotoent_r_proto" in
13884 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13885 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13886 esac
13887 case "$getprotoent_r_proto" in
90e831dc 13888 ''|0) d_getprotoent_r=undef
10bc17b6 13889 getprotoent_r_proto=0
a48ec845 13890 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13891 * ) case "$getprotoent_r_proto" in
13892 REENTRANT_PROTO*) ;;
13893 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13894 esac
13895 echo "Prototype: $try" ;;
13896 esac
13897 ;;
c18e646a
JH
13898 *) case "$usethreads" in
13899 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13900 esac
90e831dc
SB
13901 d_getprotoent_r=undef
13902 getprotoent_r_proto=0
c18e646a 13903 ;;
a48ec845
JH
13904 esac
13905 ;;
10bc17b6
JH
13906*) getprotoent_r_proto=0
13907 ;;
13908esac
13909
b4eb6b3d
JH
13910: see if prototypes for various getprotoxxx netdb.h functions are available
13911echo " "
13912set d_getprotoprotos getprotoent $i_netdb netdb.h
13913eval $hasproto
13914
13915: see if getprpwnam exists
13916set getprpwnam d_getprpwnam
13917eval $inlibc
13918
13919: see if getpwent exists
13920set getpwent d_getpwent
13921eval $inlibc
13922
10bc17b6
JH
13923: see if getpwent_r exists
13924set getpwent_r d_getpwent_r
13925eval $inlibc
13926case "$d_getpwent_r" in
13927"$define")
13928 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13929 case "$d_getpwent_r_proto:$usethreads" in
13930 ":define") d_getpwent_r_proto=define
a48ec845
JH
13931 set d_getpwent_r_proto getpwent_r $hdrs
13932 eval $hasproto ;;
13933 *) ;;
13934 esac
13935 case "$d_getpwent_r_proto" in
13936 define)
10bc17b6
JH
13937 case "$getpwent_r_proto" in
13938 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13939 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13940 esac
13941 case "$getpwent_r_proto" in
13942 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13943 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13944 esac
13945 case "$getpwent_r_proto" in
13946 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13947 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13948 esac
13949 case "$getpwent_r_proto" in
13950 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13951 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13952 esac
13953 case "$getpwent_r_proto" in
13954 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13955 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13956 esac
13957 case "$getpwent_r_proto" in
13958 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13959 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13960 esac
13961 case "$getpwent_r_proto" in
90e831dc 13962 ''|0) d_getpwent_r=undef
10bc17b6 13963 getpwent_r_proto=0
a48ec845 13964 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13965 * ) case "$getpwent_r_proto" in
13966 REENTRANT_PROTO*) ;;
13967 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13968 esac
13969 echo "Prototype: $try" ;;
13970 esac
13971 ;;
c18e646a
JH
13972 *) case "$usethreads" in
13973 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13974 esac
90e831dc
SB
13975 d_getpwent_r=undef
13976 getpwent_r_proto=0
c18e646a 13977 ;;
a48ec845
JH
13978 esac
13979 ;;
10bc17b6
JH
13980*) getpwent_r_proto=0
13981 ;;
13982esac
13983
13984: see if getpwnam_r exists
13985set getpwnam_r d_getpwnam_r
13986eval $inlibc
13987case "$d_getpwnam_r" in
13988"$define")
13989 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13990 case "$d_getpwnam_r_proto:$usethreads" in
13991 ":define") d_getpwnam_r_proto=define
a48ec845
JH
13992 set d_getpwnam_r_proto getpwnam_r $hdrs
13993 eval $hasproto ;;
13994 *) ;;
13995 esac
13996 case "$d_getpwnam_r_proto" in
13997 define)
10bc17b6
JH
13998 case "$getpwnam_r_proto" in
13999 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14000 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14001 esac
14002 case "$getpwnam_r_proto" in
14003 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14004 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14005 esac
14006 case "$getpwnam_r_proto" in
14007 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14008 ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14009 esac
14010 case "$getpwnam_r_proto" in
14011 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14012 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14013 esac
14014 case "$getpwnam_r_proto" in
90e831dc 14015 ''|0) d_getpwnam_r=undef
10bc17b6 14016 getpwnam_r_proto=0
a48ec845 14017 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14018 * ) case "$getpwnam_r_proto" in
14019 REENTRANT_PROTO*) ;;
14020 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14021 esac
14022 echo "Prototype: $try" ;;
14023 esac
14024 ;;
c18e646a
JH
14025 *) case "$usethreads" in
14026 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14027 esac
90e831dc
SB
14028 d_getpwnam_r=undef
14029 getpwnam_r_proto=0
c18e646a 14030 ;;
a48ec845
JH
14031 esac
14032 ;;
10bc17b6
JH
14033*) getpwnam_r_proto=0
14034 ;;
14035esac
14036
14037: see if getpwuid_r exists
14038set getpwuid_r d_getpwuid_r
14039eval $inlibc
14040case "$d_getpwuid_r" in
14041"$define")
14042 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14043 case "$d_getpwuid_r_proto:$usethreads" in
14044 ":define") d_getpwuid_r_proto=define
a48ec845
JH
14045 set d_getpwuid_r_proto getpwuid_r $hdrs
14046 eval $hasproto ;;
14047 *) ;;
14048 esac
14049 case "$d_getpwuid_r_proto" in
14050 define)
10bc17b6
JH
14051 case "$getpwuid_r_proto" in
14052 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14053 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14054 esac
14055 case "$getpwuid_r_proto" in
14056 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14057 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14058 esac
14059 case "$getpwuid_r_proto" in
14060 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14061 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14062 esac
14063 case "$getpwuid_r_proto" in
14064 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14065 ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14066 esac
14067 case "$getpwuid_r_proto" in
90e831dc 14068 ''|0) d_getpwuid_r=undef
10bc17b6 14069 getpwuid_r_proto=0
a48ec845 14070 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14071 * ) case "$getpwuid_r_proto" in
14072 REENTRANT_PROTO*) ;;
14073 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14074 esac
14075 echo "Prototype: $try" ;;
14076 esac
14077 ;;
c18e646a
JH
14078 *) case "$usethreads" in
14079 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14080 esac
90e831dc
SB
14081 d_getpwuid_r=undef
14082 getpwuid_r_proto=0
c18e646a 14083 ;;
a48ec845
JH
14084 esac
14085 ;;
10bc17b6
JH
14086*) getpwuid_r_proto=0
14087 ;;
14088esac
14089
b4eb6b3d
JH
14090
14091: see if getservbyname exists
14092set getservbyname d_getsbyname
14093eval $inlibc
14094
14095: see if getservbyport exists
14096set getservbyport d_getsbyport
14097eval $inlibc
14098
14099: see if getservent exists
14100set getservent d_getsent
14101eval $inlibc
14102
10bc17b6
JH
14103: see if getservbyname_r exists
14104set getservbyname_r d_getservbyname_r
14105eval $inlibc
14106case "$d_getservbyname_r" in
14107"$define")
14108 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14109 case "$d_getservbyname_r_proto:$usethreads" in
14110 ":define") d_getservbyname_r_proto=define
a48ec845
JH
14111 set d_getservbyname_r_proto getservbyname_r $hdrs
14112 eval $hasproto ;;
14113 *) ;;
14114 esac
14115 case "$d_getservbyname_r_proto" in
14116 define)
10bc17b6
JH
14117 case "$getservbyname_r_proto" in
14118 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14119 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14120 esac
14121 case "$getservbyname_r_proto" in
14122 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14123 ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14124 esac
14125 case "$getservbyname_r_proto" in
14126 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14127 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14128 esac
14129 case "$getservbyname_r_proto" in
90e831dc 14130 ''|0) d_getservbyname_r=undef
10bc17b6 14131 getservbyname_r_proto=0
a48ec845 14132 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14133 * ) case "$getservbyname_r_proto" in
14134 REENTRANT_PROTO*) ;;
14135 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14136 esac
14137 echo "Prototype: $try" ;;
14138 esac
14139 ;;
c18e646a
JH
14140 *) case "$usethreads" in
14141 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14142 esac
90e831dc
SB
14143 d_getservbyname_r=undef
14144 getservbyname_r_proto=0
c18e646a 14145 ;;
a48ec845
JH
14146 esac
14147 ;;
10bc17b6
JH
14148*) getservbyname_r_proto=0
14149 ;;
14150esac
14151
14152: see if getservbyport_r exists
14153set getservbyport_r d_getservbyport_r
14154eval $inlibc
14155case "$d_getservbyport_r" in
14156"$define")
14157 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14158 case "$d_getservbyport_r_proto:$usethreads" in
14159 ":define") d_getservbyport_r_proto=define
a48ec845
JH
14160 set d_getservbyport_r_proto getservbyport_r $hdrs
14161 eval $hasproto ;;
14162 *) ;;
14163 esac
14164 case "$d_getservbyport_r_proto" in
14165 define)
10bc17b6
JH
14166 case "$getservbyport_r_proto" in
14167 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14168 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14169 esac
14170 case "$getservbyport_r_proto" in
14171 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14172 ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14173 esac
14174 case "$getservbyport_r_proto" in
14175 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14176 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14177 esac
14178 case "$getservbyport_r_proto" in
90e831dc 14179 ''|0) d_getservbyport_r=undef
10bc17b6 14180 getservbyport_r_proto=0
a48ec845 14181 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14182 * ) case "$getservbyport_r_proto" in
14183 REENTRANT_PROTO*) ;;
14184 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14185 esac
14186 echo "Prototype: $try" ;;
14187 esac
14188 ;;
c18e646a
JH
14189 *) case "$usethreads" in
14190 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14191 esac
90e831dc
SB
14192 d_getservbyport_r=undef
14193 getservbyport_r_proto=0
c18e646a 14194 ;;
a48ec845
JH
14195 esac
14196 ;;
10bc17b6
JH
14197*) getservbyport_r_proto=0
14198 ;;
14199esac
14200
14201: see if getservent_r exists
14202set getservent_r d_getservent_r
14203eval $inlibc
14204case "$d_getservent_r" in
14205"$define")
14206 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14207 case "$d_getservent_r_proto:$usethreads" in
14208 ":define") d_getservent_r_proto=define
a48ec845
JH
14209 set d_getservent_r_proto getservent_r $hdrs
14210 eval $hasproto ;;
14211 *) ;;
14212 esac
14213 case "$d_getservent_r_proto" in
14214 define)
10bc17b6
JH
14215 case "$getservent_r_proto" in
14216 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14217 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14218 esac
14219 case "$getservent_r_proto" in
14220 ''|0) try='int getservent_r(struct servent*, char*, int);'
14221 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14222 esac
14223 case "$getservent_r_proto" in
14224 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14225 ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14226 esac
14227 case "$getservent_r_proto" in
14228 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14229 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14230 esac
14231 case "$getservent_r_proto" in
90e831dc 14232 ''|0) d_getservent_r=undef
10bc17b6 14233 getservent_r_proto=0
a48ec845 14234 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14235 * ) case "$getservent_r_proto" in
14236 REENTRANT_PROTO*) ;;
14237 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14238 esac
14239 echo "Prototype: $try" ;;
14240 esac
14241 ;;
c18e646a
JH
14242 *) case "$usethreads" in
14243 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14244 esac
90e831dc
SB
14245 d_getservent_r=undef
14246 getservent_r_proto=0
c18e646a 14247 ;;
a48ec845
JH
14248 esac
14249 ;;
10bc17b6
JH
14250*) getservent_r_proto=0
14251 ;;
14252esac
14253
b4eb6b3d
JH
14254: see if prototypes for various getservxxx netdb.h functions are available
14255echo " "
14256set d_getservprotos getservent $i_netdb netdb.h
14257eval $hasproto
14258
14259: see if getspnam exists
14260set getspnam d_getspnam
14261eval $inlibc
14262
10bc17b6
JH
14263: see if this is a shadow.h system
14264set shadow.h i_shadow
14265eval $inhdr
14266
14267: see if getspnam_r exists
14268set getspnam_r d_getspnam_r
14269eval $inlibc
14270case "$d_getspnam_r" in
14271"$define")
14272 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
14273 case "$d_getspnam_r_proto:$usethreads" in
14274 ":define") d_getspnam_r_proto=define
a48ec845
JH
14275 set d_getspnam_r_proto getspnam_r $hdrs
14276 eval $hasproto ;;
14277 *) ;;
14278 esac
14279 case "$d_getspnam_r_proto" in
14280 define)
10bc17b6
JH
14281 case "$getspnam_r_proto" in
14282 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14283 ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14284 esac
14285 case "$getspnam_r_proto" in
14286 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14287 ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14288 esac
14289 case "$getspnam_r_proto" in
90e831dc 14290 ''|0) d_getspnam_r=undef
10bc17b6 14291 getspnam_r_proto=0
a48ec845 14292 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14293 * ) case "$getspnam_r_proto" in
14294 REENTRANT_PROTO*) ;;
14295 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14296 esac
14297 echo "Prototype: $try" ;;
14298 esac
14299 ;;
c18e646a
JH
14300 *) case "$usethreads" in
14301 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14302 esac
90e831dc
SB
14303 d_getspnam_r=undef
14304 getspnam_r_proto=0
c18e646a 14305 ;;
a48ec845
JH
14306 esac
14307 ;;
10bc17b6
JH
14308*) getspnam_r_proto=0
14309 ;;
14310esac
14311
b4eb6b3d
JH
14312: see if gettimeofday or ftime exists
14313set gettimeofday d_gettimeod
14314eval $inlibc
14315case "$d_gettimeod" in
14316"$undef")
14317 set ftime d_ftime
14318 eval $inlibc
14319 ;;
14320*)
14321 val="$undef"; set d_ftime; eval $setvar
14322 ;;
14323esac
14324case "$d_gettimeod$d_ftime" in
14325"$undef$undef")
14326 echo " "
14327 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14328 ;;
14329esac
14330
10bc17b6
JH
14331: see if gmtime_r exists
14332set gmtime_r d_gmtime_r
14333eval $inlibc
14334case "$d_gmtime_r" in
14335"$define")
d63eadf0 14336 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14337 case "$d_gmtime_r_proto:$usethreads" in
14338 ":define") d_gmtime_r_proto=define
a48ec845
JH
14339 set d_gmtime_r_proto gmtime_r $hdrs
14340 eval $hasproto ;;
14341 *) ;;
14342 esac
14343 case "$d_gmtime_r_proto" in
14344 define)
10bc17b6
JH
14345 case "$gmtime_r_proto" in
14346 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14347 ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14348 esac
14349 case "$gmtime_r_proto" in
14350 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14351 ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14352 esac
14353 case "$gmtime_r_proto" in
90e831dc 14354 ''|0) d_gmtime_r=undef
10bc17b6 14355 gmtime_r_proto=0
a48ec845 14356 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14357 * ) case "$gmtime_r_proto" in
14358 REENTRANT_PROTO*) ;;
14359 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14360 esac
14361 echo "Prototype: $try" ;;
14362 esac
b4eb6b3d 14363 ;;
c18e646a
JH
14364 *) case "$usethreads" in
14365 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14366 esac
90e831dc
SB
14367 d_gmtime_r=undef
14368 gmtime_r_proto=0
c18e646a 14369 ;;
a48ec845
JH
14370 esac
14371 ;;
10bc17b6 14372*) gmtime_r_proto=0
b4eb6b3d
JH
14373 ;;
14374esac
14375
14376: see if hasmntopt exists
14377set hasmntopt d_hasmntopt
14378eval $inlibc
14379
14380: see if this is a netinet/in.h or sys/in.h system
14381set netinet/in.h i_niin sys/in.h i_sysin
14382eval $inhdr
14383
14384: see if arpa/inet.h has to be included
14385set arpa/inet.h i_arpainet
14386eval $inhdr
14387
14388: see if htonl --and friends-- exists
14389val=''
14390set htonl val
14391eval $inlibc
14392
14393: Maybe they are macros.
14394case "$val" in
14395$undef)
14396 $cat >htonl.c <<EOM
14397#include <stdio.h>
14398#include <sys/types.h>
14399#$i_niin I_NETINET_IN
14400#$i_sysin I_SYS_IN
14401#$i_arpainet I_ARPA_INET
14402#ifdef I_NETINET_IN
14403#include <netinet/in.h>
14404#endif
14405#ifdef I_SYS_IN
14406#include <sys/in.h>
14407#endif
14408#ifdef I_ARPA_INET
14409#include <arpa/inet.h>
14410#endif
14411#ifdef htonl
14412printf("Defined as a macro.");
14413#endif
14414EOM
14415 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14416 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14417 val="$define"
14418 echo "But it seems to be defined as a macro." >&4
14419 fi
14420 $rm -f htonl.?
14421 ;;
14422esac
14423set d_htonl
14424eval $setvar
14425
36adc09b
JH
14426: see if ilogbl exists
14427set ilogbl d_ilogbl
14428eval $inlibc
14429
b4eb6b3d
JH
14430: index or strchr
14431echo " "
14432if set index val -f; eval $csym; $val; then
14433 if set strchr val -f d_strchr; eval $csym; $val; then
14434 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14435 val="$define"
14436 vali="$undef"
14437 echo "strchr() found." >&4
14438 else
14439 val="$undef"
14440 vali="$define"
14441 echo "index() found." >&4
14442 fi
14443 else
14444 val="$undef"
14445 vali="$define"
8dfa8df9
JH
14446 echo "index() found." >&4
14447 fi
b4eb6b3d 14448else
8dfa8df9
JH
14449 if set strchr val -f d_strchr; eval $csym; $val; then
14450 val="$define"
14451 vali="$undef"
14452 echo "strchr() found." >&4
14453 else
14454 echo "No index() or strchr() found!" >&4
14455 val="$undef"
14456 vali="$undef"
14457 fi
b4eb6b3d 14458fi
8dfa8df9
JH
14459set d_strchr; eval $setvar
14460val="$vali"
14461set d_index; eval $setvar
14462
14463: check whether inet_aton exists
14464set inet_aton d_inetaton
14465eval $inlibc
b4eb6b3d
JH
14466
14467: Look for isascii
14468echo " "
36adc09b 14469$cat >isascii.c <<EOCP
b4eb6b3d
JH
14470#include <stdio.h>
14471#include <ctype.h>
55954f19
JH
14472#$i_stdlib I_STDLIB
14473#ifdef I_STDLIB
14474#include <stdlib.h>
14475#endif
b4eb6b3d
JH
14476int main() {
14477 int c = 'A';
14478 if (isascii(c))
14479 exit(0);
14480 else
14481 exit(1);
14482}
14483EOCP
14484set isascii
14485if eval $compile; then
14486 echo "isascii() found." >&4
14487 val="$define"
14488else
14489 echo "isascii() NOT found." >&4
14490 val="$undef"
14491fi
14492set d_isascii
14493eval $setvar
14494$rm -f isascii*
14495
758a5d79
JH
14496: see if isfinite exists
14497set isfinite d_isfinite
14498eval $inlibc
14499
14500: see if isinf exists
14501set isinf d_isinf
14502eval $inlibc
14503
b4eb6b3d
JH
14504: see if isnan exists
14505set isnan d_isnan
14506eval $inlibc
14507
14508: see if isnanl exists
14509set isnanl d_isnanl
14510eval $inlibc
14511
14512: see if killpg exists
14513set killpg d_killpg
14514eval $inlibc
14515
14516: see if lchown exists
14517echo " "
14518$cat > try.c <<'EOCP'
14519/* System header to define __stub macros and hopefully few prototypes,
14520 which can conflict with char lchown(); below. */
14521#include <assert.h>
14522/* Override any gcc2 internal prototype to avoid an error. */
14523/* We use char because int might match the return type of a gcc2
14524 builtin and then its argument prototype would still apply. */
14525char lchown();
14526int main() {
14527 /* The GNU C library defines this for functions which it implements
14528 to always fail with ENOSYS. Some functions are actually named
14529 something starting with __ and the normal name is an alias. */
14530#if defined (__stub_lchown) || defined (__stub___lchown)
14531choke me
14532#else
14533lchown();
14534#endif
14535; return 0; }
14536EOCP
14537set try
14538if eval $compile; then
14539 $echo "lchown() found." >&4
14540 val="$define"
14541else
14542 $echo "lchown() NOT found." >&4
14543 val="$undef"
14544fi
14545set d_lchown
14546eval $setvar
14547
14548: See if number of significant digits in a double precision number is known
14549echo " "
14550$cat >ldbl_dig.c <<EOM
14551#$i_limits I_LIMITS
14552#$i_float I_FLOAT
14553#ifdef I_LIMITS
14554#include <limits.h>
14555#endif
14556#ifdef I_FLOAT
14557#include <float.h>
14558#endif
14559#ifdef LDBL_DIG
14560printf("Contains LDBL_DIG");
14561#endif
14562EOM
14563$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14564if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14565 echo "LDBL_DIG found." >&4
14566 val="$define"
14567else
14568 echo "LDBL_DIG NOT found." >&4
14569 val="$undef"
14570fi
14571$rm -f ldbl_dig.?
14572set d_ldbl_dig
14573eval $setvar
14574
0a0abfba
MB
14575: see if this is a math.h system
14576set math.h i_math
14577eval $inhdr
14578
14579d_libm_lib_version="$undef"
14580case $i_math in
14581 $define)
14582 : check to see if math.h defines _LIB_VERSION
14583 echo " "
14584 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14585 $cat >try.c <<EOCP
14586#include <unistd.h>
14587#include <math.h>
14588int main (int argc, char *argv[])
14589{
14590 printf ("%d\n", _LIB_VERSION);
14591 return (0);
14592 } /* main */
14593EOCP
14594 set try
14595 if eval $compile; then
14596 foo=`$run ./try`
14597 echo "Yes, it does ($foo)" >&4
14598 d_libm_lib_version="$define"
14599 else
14600 echo "No, it does not (probably harmless)\n" >&4
14601 fi
14602 $rm -f try.* try core core.try.*
14603 ;;
14604
14605 esac
14606
b4eb6b3d
JH
14607: see if link exists
14608set link d_link
14609eval $inlibc
14610
10bc17b6
JH
14611: see if localtime_r exists
14612set localtime_r d_localtime_r
14613eval $inlibc
14614case "$d_localtime_r" in
14615"$define")
d63eadf0 14616 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14617 case "$d_localtime_r_proto:$usethreads" in
14618 ":define") d_localtime_r_proto=define
a48ec845
JH
14619 set d_localtime_r_proto localtime_r $hdrs
14620 eval $hasproto ;;
14621 *) ;;
14622 esac
14623 case "$d_localtime_r_proto" in
14624 define)
10bc17b6
JH
14625 case "$localtime_r_proto" in
14626 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14627 ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14628 esac
14629 case "$localtime_r_proto" in
14630 ''|0) try='int localtime_r(const time_t*, struct tm*);'
14631 ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14632 esac
14633 case "$localtime_r_proto" in
90e831dc 14634 ''|0) d_localtime_r=undef
10bc17b6 14635 localtime_r_proto=0
a48ec845 14636 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14637 * ) case "$localtime_r_proto" in
14638 REENTRANT_PROTO*) ;;
14639 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14640 esac
14641 echo "Prototype: $try" ;;
14642 esac
14643 ;;
c18e646a
JH
14644 *) case "$usethreads" in
14645 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14646 esac
90e831dc
SB
14647 d_localtime_r=undef
14648 localtime_r_proto=0
c18e646a 14649 ;;
a48ec845
JH
14650 esac
14651 ;;
10bc17b6
JH
14652*) localtime_r_proto=0
14653 ;;
14654esac
14655
8572b25d
BH
14656: see if localtime_r calls tzset
14657case "$localtime_r_proto" in
14658REENTRANT_PROTO*)
14659 $cat >try.c <<EOCP
14660/* Does our libc's localtime_r call tzset ?
14661 * return 0 if so, 1 otherwise.
14662 */
14663#include <sys/types.h>
14664#include <unistd.h>
14665#include <time.h>
14666#include <string.h>
14667#include <malloc.h>
14668int main()
14669{
14670 time_t t = time(0L);
14671 char w_tz[]="TZ" "=GMT+5",
14672 e_tz[]="TZ" "=GMT-5",
14673 *tz_e = (char*)malloc(16),
14674 *tz_w = (char*)malloc(16);
14675 struct tm tm_e, tm_w;
14676 memset(&tm_e,'\0',sizeof(struct tm));
14677 memset(&tm_w,'\0',sizeof(struct tm));
14678 strcpy(tz_e,e_tz);
14679 strcpy(tz_w,w_tz);
14680
14681 putenv(tz_e);
14682 localtime_r(&t, &tm_e);
14683
14684 putenv(tz_w);
14685 localtime_r(&t, &tm_w);
14686
14687 if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14688 return 1;
14689 return 0;
14690}
14691EOCP
14692 set try
14693 if eval $compile; then
14694 if ./try; then
14695 d_localtime_r_needs_tzset=undef;
14696 else
14697 d_localtime_r_needs_tzset=define;
14698 fi;
14699 else
14700 d_localtime_r_needs_tzset=undef;
14701 fi;
14702 ;;
14703 *)
14704 d_localtime_r_needs_tzset=undef;
14705 ;;
14706esac
14707$rm -f try try.* core
14708
b4eb6b3d
JH
14709: see if localeconv exists
14710set localeconv d_locconv
14711eval $inlibc
14712
14713: see if lockf exists
14714set lockf d_lockf
14715eval $inlibc
14716
b4eb6b3d
JH
14717: see if prototype for lseek is available
14718echo " "
4786929f 14719set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
14720eval $hasproto
14721
14722: see if lstat exists
14723set lstat d_lstat
14724eval $inlibc
14725
14726: see if madvise exists
14727set madvise d_madvise
14728eval $inlibc
14729
7dd121ae
MB
14730: see if malloc_size exists
14731set malloc_size d_malloc_size
14732eval $inlibc
14733
14734: see if malloc_size_good exists
14735set malloc_good_size d_malloc_good_size
14736eval $inlibc
14737
b4eb6b3d
JH
14738: see if mblen exists
14739set mblen d_mblen
14740eval $inlibc
14741
14742: see if mbstowcs exists
14743set mbstowcs d_mbstowcs
14744eval $inlibc
14745
14746: see if mbtowc exists
14747set mbtowc d_mbtowc
14748eval $inlibc
14749
14750: see if memchr exists
14751set memchr d_memchr
14752eval $inlibc
14753
14754: see if memcmp exists
14755set memcmp d_memcmp
14756eval $inlibc
14757
14758: see if memcpy exists
14759set memcpy d_memcpy
14760eval $inlibc
14761
14762: see if memmove exists
14763set memmove d_memmove
14764eval $inlibc
14765
14766: see if memset exists
14767set memset d_memset
14768eval $inlibc
14769
14770: see if mkdir exists
14771set mkdir d_mkdir
14772eval $inlibc
14773
14774: see if mkdtemp exists
14775set mkdtemp d_mkdtemp
14776eval $inlibc
14777
14778: see if mkfifo exists
14779set mkfifo d_mkfifo
14780eval $inlibc
14781
14782: see if mkstemp exists
14783set mkstemp d_mkstemp
14784eval $inlibc
14785
14786: see if mkstemps exists
14787set mkstemps d_mkstemps
14788eval $inlibc
14789
14790: see if mktime exists
14791set mktime d_mktime
14792eval $inlibc
14793
14794: see if this is a sys/mman.h system
14795set sys/mman.h i_sysmman
14796eval $inhdr
14797
14798: see if mmap exists
14799set mmap d_mmap
14800eval $inlibc
14801: see what shmat returns
14802: default to something harmless
14803mmaptype='void *'
14804case "$i_sysmman$d_mmap" in
14805"$define$define")
14806 $cat >mmap.c <<'END'
14807#include <sys/mman.h>
14808void *mmap();
14809END
14810 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14811 mmaptype='void *'
14812 else
14813 mmaptype='caddr_t'
14814 fi
14815 echo "and it returns ($mmaptype)." >&4
14816 ;;
14817esac
14818
14819
14820
89ce900e
JH
14821: see if sqrtl exists
14822set sqrtl d_sqrtl
14823eval $inlibc
14824
af1ff193
JH
14825: see if scalbnl exists
14826set scalbnl d_scalbnl
14827eval $inlibc
14828
89ce900e
JH
14829: see if modfl exists
14830set modfl d_modfl
14831eval $inlibc
14832
14833: see if prototype for modfl is available
14834echo " "
3a794506 14835set d_modflproto modfl $i_math math.h
89ce900e
JH
14836eval $hasproto
14837
14838d_modfl_pow32_bug="$undef"
14839
14840case "$d_longdbl$d_modfl" in
14841$define$define)
14842 $cat <<EOM
14843Checking to see whether your modfl() is okay for large values...
14844EOM
14845$cat >try.c <<EOCP
14846#include <math.h>
14847#include <stdio.h>
14848EOCP
14849if $test "X$d_modflproto" != "X$define"; then
14850 $cat >>try.c <<EOCP
14851/* Sigh. many current glibcs provide the function, but do not prototype it. */
14852long double modfl (long double, long double *);
14853EOCP
14854fi
14855$cat >>try.c <<EOCP
14856int main() {
14857 long double nv = 4294967303.15;
14858 long double v, w;
14859 v = modfl(nv, &w);
14860#ifdef __GLIBC__
14861 printf("glibc");
14862#endif
14863 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14864 return 0;
14865}
14866EOCP
14867 case "$osname:$gccversion" in
14868 aix:) saveccflags="$ccflags"
14869 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14870 esac
14871 set try
14872 if eval $compile; then
14873 foo=`$run ./try`
14874 case "$foo" in
14875 *" 4294967303.150000 1.150000 4294967302.000000")
14876 echo >&4 "Your modfl() is broken for large values."
14877 d_modfl_pow32_bug="$define"
14878 case "$foo" in
14879 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14880 ;;
14881 esac
14882 ;;
14883 *" 4294967303.150000 0.150000 4294967303.000000")
14884 echo >&4 "Your modfl() seems okay for large values."
14885 ;;
14886 *) echo >&4 "I don't understand your modfl() at all."
14887 d_modfl="$undef"
14888 ;;
14889 esac
14890 $rm -f try.* try core core.try.*
14891 else
14892 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14893 d_modfl="$undef"
14894 fi
14895 case "$osname:$gccversion" in
14896 aix:) ccflags="$saveccflags" ;; # restore
14897 esac
14898 ;;
14899esac
14900
14901if $test "$uselongdouble" = "$define"; then
af1ff193
JH
14902 message=""
14903 if $test "$d_sqrtl" != "$define"; then
14904 message="$message sqrtl"
14905 fi
14906 if $test "$d_modfl" != "$define"; then
89ce900e
JH
14907 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14908 echo "You have both aintl and copysignl, so I can emulate modfl."
14909 else
af1ff193 14910 message="$message modfl"
89ce900e 14911 fi
af1ff193
JH
14912 fi
14913 if $test "$d_frexpl" != "$define"; then
14914 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14915 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14916 else
14917 message="$message frexpl"
14918 fi
14919 fi
89ce900e 14920
af1ff193 14921 if $test "$message" != ""; then
89ce900e
JH
14922 $cat <<EOM >&4
14923
14924*** You requested the use of long doubles but you do not seem to have
af1ff193
JH
14925*** the following mathematical functions needed for long double support:
14926*** $message
fe63a0b4
JH
14927*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14928*** Cannot continue, aborting.
89ce900e
JH
14929
14930EOM
14931
fe63a0b4 14932 exit 1
89ce900e
JH
14933 fi
14934fi
14935
b4eb6b3d
JH
14936: see if mprotect exists
14937set mprotect d_mprotect
14938eval $inlibc
14939
14940: see if msgctl exists
14941set msgctl d_msgctl
14942eval $inlibc
14943
14944: see if msgget exists
14945set msgget d_msgget
14946eval $inlibc
14947
14948: see if msgsnd exists
14949set msgsnd d_msgsnd
14950eval $inlibc
14951
14952: see if msgrcv exists
14953set msgrcv d_msgrcv
14954eval $inlibc
14955
14956: see how much of the 'msg*(2)' library is present.
14957h_msg=true
14958echo " "
14959case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14960*"$undef"*) h_msg=false;;
14961esac
14962case "$osname" in
14963freebsd)
14964 case "`ipcs 2>&1`" in
14965 "SVID messages"*"not configured"*)
14966 echo "Your $osname does not have the msg*(2) configured." >&4
14967 h_msg=false
14968 val="$undef"
14969 set msgctl d_msgctl
14970 eval $setvar
14971 set msgget d_msgget
14972 eval $setvar
14973 set msgsnd d_msgsnd
14974 eval $setvar
14975 set msgrcv d_msgrcv
14976 eval $setvar
14977 ;;
14978 esac
14979 ;;
14980esac
14981: we could also check for sys/ipc.h ...
14982if $h_msg && $test `./findhdr sys/msg.h`; then
14983 echo "You have the full msg*(2) library." >&4
14984 val="$define"
14985else
14986 echo "You don't have the full msg*(2) library." >&4
14987 val="$undef"
14988fi
14989set d_msg
14990eval $setvar
14991
4e0554ec
JH
14992
14993echo " "
14994echo "Checking to see if your system supports struct msghdr..." >&4
14995set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14996eval $hasstruct
14997case "$d_msghdr_s" in
14998"$define") echo "Yes, it does." ;;
14999*) echo "No, it doesn't." ;;
15000esac
15001
15002
b4eb6b3d
JH
15003: see if msync exists
15004set msync d_msync
15005eval $inlibc
15006
15007: see if munmap exists
15008set munmap d_munmap
15009eval $inlibc
15010
15011: see if nice exists
15012set nice d_nice
15013eval $inlibc
15014
2765b840
JH
15015: see if this is a langinfo.h system
15016set langinfo.h i_langinfo
15017eval $inhdr
15018
15019: see if nl_langinfo exists
15020set nl_langinfo d_nl_langinfo
15021eval $inlibc
15022
b4eb6b3d
JH
15023: check for length of character
15024echo " "
15025case "$charsize" in
15026'')
15027 echo "Checking to see how big your characters are (hey, you never know)..." >&4
74d00865 15028 $cat >try.c <<EOCP
b4eb6b3d 15029#include <stdio.h>
d1daaddf
JH
15030#$i_stdlib I_STDLIB
15031#ifdef I_STDLIB
15032#include <stdlib.h>
15033#endif
b4eb6b3d
JH
15034int main()
15035{
15036 printf("%d\n", (int)sizeof(char));
15037 exit(0);
15038}
15039EOCP
15040 set try
15041 if eval $compile_ok; then
5440bc8e 15042 dflt=`$run ./try`
b4eb6b3d
JH
15043 else
15044 dflt='1'
15045 echo "(I can't seem to compile the test program. Guessing...)"
15046 fi
15047 ;;
15048*)
15049 dflt="$charsize"
15050 ;;
15051esac
15052rp="What is the size of a character (in bytes)?"
15053. ./myread
15054charsize="$ans"
15055$rm -f try.c try
15056
1d1be0dc
NC
15057: check for volatile keyword
15058echo " "
15059echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15060$cat >try.c <<'EOCP'
76f47787 15061int main()
1d1be0dc
NC
15062{
15063 typedef struct _goo_struct goo_struct;
15064 goo_struct * volatile goo = ((goo_struct *)0);
15065 struct _goo_struct {
15066 long long_int;
15067 int reg_int;
15068 char char_var;
15069 };
15070 typedef unsigned short foo_t;
15071 char *volatile foo;
15072 volatile int bar;
15073 volatile foo_t blech;
15074 foo = foo;
15075}
15076EOCP
15077if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15078 val="$define"
15079 echo "Yup, it does."
15080else
15081 val="$undef"
15082 echo "Nope, it doesn't."
15083fi
15084set d_volatile
15085eval $setvar
15086$rm -f try.*
15087
b4eb6b3d
JH
15088
15089echo " "
15090$echo "Choosing the C types to be used for Perl's internal types..." >&4
15091
15092case "$use64bitint:$d_quad:$quadtype" in
15093define:define:?*)
15094 ivtype="$quadtype"
15095 uvtype="$uquadtype"
15096 ivsize=8
15097 uvsize=8
15098 ;;
15099*) ivtype="long"
15100 uvtype="unsigned long"
15101 ivsize=$longsize
15102 uvsize=$longsize
15103 ;;
15104esac
15105
15106case "$uselongdouble:$d_longdbl" in
15107define:define)
15108 nvtype="long double"
15109 nvsize=$longdblsize
15110 ;;
15111*) nvtype=double
15112 nvsize=$doublesize
15113 ;;
15114esac
15115
15116$echo "(IV will be "$ivtype", $ivsize bytes)"
15117$echo "(UV will be "$uvtype", $uvsize bytes)"
15118$echo "(NV will be "$nvtype", $nvsize bytes)"
15119
15120$cat >try.c <<EOCP
15121#$i_inttypes I_INTTYPES
15122#ifdef I_INTTYPES
15123#include <inttypes.h>
15124#endif
15125#include <stdio.h>
15126int main() {
15127#ifdef INT8
15128 int8_t i = INT8_MAX;
15129 uint8_t u = UINT8_MAX;
15130 printf("int8_t\n");
15131#endif
15132#ifdef INT16
15133 int16_t i = INT16_MAX;
15134 uint16_t i = UINT16_MAX;
15135 printf("int16_t\n");
15136#endif
15137#ifdef INT32
15138 int32_t i = INT32_MAX;
15139 uint32_t u = UINT32_MAX;
15140 printf("int32_t\n");
15141#endif
15142}
15143EOCP
15144
15145case "$i8type" in
15146'') case "$charsize" in
15147 1) i8type=char
15148 u8type="unsigned char"
15149 i8size=$charsize
15150 u8size=$charsize
15151 ;;
15152 esac
15153 ;;
15154esac
15155case "$i8type" in
15156'') set try -DINT8
15157 if eval $compile; then
5440bc8e 15158 case "`$run ./try`" in
b4eb6b3d
JH
15159 int8_t) i8type=int8_t
15160 u8type=uint8_t
15161 i8size=1
15162 u8size=1
15163 ;;
15164 esac
15165 fi
15166 ;;
15167esac
15168case "$i8type" in
15169'') if $test $charsize -ge 1; then
15170 i8type=char
15171 u8type="unsigned char"
15172 i8size=$charsize
15173 u8size=$charsize
15174 fi
15175 ;;
15176esac
15177
15178case "$i16type" in
15179'') case "$shortsize" in
15180 2) i16type=short
15181 u16type="unsigned short"
15182 i16size=$shortsize
15183 u16size=$shortsize
15184 ;;
15185 esac
15186 ;;
15187esac
15188case "$i16type" in
15189'') set try -DINT16
15190 if eval $compile; then
5440bc8e 15191 case "`$run ./try`" in
b4eb6b3d
JH
15192 int16_t)
15193 i16type=int16_t
15194 u16type=uint16_t
15195 i16size=2
15196 u16size=2
15197 ;;
15198 esac
15199 fi
15200 ;;
15201esac
15202case "$i16type" in
15203'') if $test $shortsize -ge 2; then
15204 i16type=short
15205 u16type="unsigned short"
15206 i16size=$shortsize
15207 u16size=$shortsize
15208 fi
15209 ;;
15210esac
15211
15212case "$i32type" in
15213'') case "$longsize" in
15214 4) i32type=long
15215 u32type="unsigned long"
15216 i32size=$longsize
15217 u32size=$longsize
15218 ;;
15219 *) case "$intsize" in
15220 4) i32type=int
15221 u32type="unsigned int"
15222 i32size=$intsize
15223 u32size=$intsize
15224 ;;
15225 esac
15226 ;;
15227 esac
15228 ;;
15229esac
15230case "$i32type" in
15231'') set try -DINT32
15232 if eval $compile; then
5440bc8e 15233 case "`$run ./try`" in
b4eb6b3d
JH
15234 int32_t)
15235 i32type=int32_t
15236 u32type=uint32_t
15237 i32size=4
15238 u32size=4
15239 ;;
15240 esac
15241 fi
15242 ;;
15243esac
15244case "$i32type" in
15245'') if $test $intsize -ge 4; then
15246 i32type=int
15247 u32type="unsigned int"
15248 i32size=$intsize
15249 u32size=$intsize
15250 fi
15251 ;;
15252esac
15253
15254case "$i64type" in
15255'') case "$d_quad:$quadtype" in
15256 define:?*)
15257 i64type="$quadtype"
15258 u64type="$uquadtype"
15259 i64size=8
15260 u64size=8
15261 ;;
15262 esac
15263 ;;
15264esac
15265
1d1be0dc
NC
15266$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15267: volatile so that the compiler has to store it out to memory.
15268if test X"$d_volatile" = X"$define"; then
15269 volatile=volatile
15270fi
b4eb6b3d
JH
15271$cat <<EOP >try.c
15272#include <stdio.h>
55954f19
JH
15273#$i_stdlib I_STDLIB
15274#ifdef I_STDLIB
15275#include <stdlib.h>
15276#endif
1d1be0dc
NC
15277#include <sys/types.h>
15278#include <signal.h>
15279#ifdef SIGFPE
15280$volatile int bletched = 0;
7090f861 15281$signal_t blech(int s) { bletched = 1; }
1d1be0dc 15282#endif
b4eb6b3d
JH
15283int main() {
15284 $uvtype u = 0;
1d1be0dc 15285 $nvtype d;
b4eb6b3d
JH
15286 int n = 8 * $uvsize;
15287 int i;
1d1be0dc
NC
15288#ifdef SIGFPE
15289 signal(SIGFPE, blech);
15290#endif
15291
b4eb6b3d
JH
15292 for (i = 0; i < n; i++) {
15293 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
15294 d = ($nvtype)u;
15295 if (($uvtype)d != u)
b4eb6b3d 15296 break;
1d1be0dc
NC
15297 if (d <= 0)
15298 break;
15299 d = ($nvtype)(u - 1);
15300 if (($uvtype)d != (u - 1))
15301 break;
15302#ifdef SIGFPE
22676560 15303 if (bletched)
1d1be0dc
NC
15304 break;
15305#endif
b4eb6b3d 15306 }
efd1522b 15307 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
15308 exit(0);
15309}
15310EOP
1d1be0dc
NC
15311set try
15312
15313d_nv_preserves_uv="$undef"
15314if eval $compile; then
53133ed1 15315 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 15316fi
53133ed1 15317case "$nv_preserves_uv_bits" in
1d1be0dc 15318\-[1-9]*)
53133ed1
NC
15319 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15320 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 15321 d_nv_preserves_uv="$define"
b4eb6b3d 15322 ;;
53133ed1 15323[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
15324 d_nv_preserves_uv="$undef" ;;
15325*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
d6cc064f 15326 nv_preserves_uv_bits="0" ;;
b4eb6b3d
JH
15327esac
15328
1d1be0dc
NC
15329$rm -f try.* try
15330
f607920a
CB
15331$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15332: volatile so that the compiler has to store it out to memory.
15333if test X"$d_volatile" = X"$define"; then
15334 volatile=volatile
15335fi
15336$cat <<EOP >try.c
15337#include <stdio.h>
15338#$i_stdlib I_STDLIB
15339#ifdef I_STDLIB
15340#include <stdlib.h>
15341#endif
15342#$i_string I_STRING
15343#ifdef I_STRING
15344# include <string.h>
15345#else
15346# include <strings.h>
15347#endif
15348#include <sys/types.h>
15349#include <signal.h>
15350#ifdef SIGFPE
15351$volatile int bletched = 0;
7090f861 15352$signal_t blech(int s) { bletched = 1; }
f607920a
CB
15353#endif
15354
15355int checkit($nvtype d, char *where) {
15356 unsigned char *p = (char *)&d;
15357 unsigned char *end = p + sizeof(d);
15358 int fail = 0;
15359
15360 while (p < end)
15361 fail += *p++;
15362
15363 if (!fail)
17f6277d 15364 return 0;
f607920a
CB
15365
15366 p = (char *)&d;
15367 printf("No - %s: 0x", where);
15368 while (p < end)
15369 printf ("%02X", *p++);
15370 printf("\n");
15371 return 1;
15372}
15373
15374int main(int argc, char **argv) {
15375 $nvtype d = 0.0;
15376 int fail = 0;
15377 fail += checkit(d, "0.0");
15378
15379 /* The compiler shouldn't be assuming that bletched is 0 */
15380 d = bletched;
15381
15382 fail += checkit(d, "bleched");
15383
15384#ifdef SIGFPE
15385 signal(SIGFPE, blech);
15386#endif
15387
15388 /* Paranoia - the compiler should have no way of knowing that ANSI says
15389 that argv[argc] will always be NULL. Actually, if it did assume this it
15390 would be buggy, as this is C and main() can be called from elsewhere in
15391 the program. */
15392 d = argv[argc] ? 1 : 0;
15393
15394 if (d) {
15395 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15396 }
15397
15398 fail += checkit(d, "ternary");
15399
15400 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15401
15402 if (d != 0.0) {
15403 printf("No - memset doesn't give 0.0\n");
15404 /* This might just blow up: */
15405 printf("(gives %g)\n", d);
15406 return 1;
15407 }
15408
15409#ifdef SIGFPE
15410 if (bletched) {
15411 printf("No - something bleched\n");
15412 return 1;
15413 }
15414#endif
15415 if (fail) {
15416 printf("No - %d fail(s)\n", fail);
15417 return 1;
15418 }
15419 printf("Yes\n");
15420 return 0;
15421}
15422EOP
15423set try
15424
15425d_nv_zero_is_allbits_zero="$undef"
15426if eval $compile; then
15427 xxx="`$run ./try`"
15428 case "$?" in
15429 0)
15430 case "$xxx" in
15431 Yes) cat >&4 <<EOM
154320.0 is represented as all bits zero in memory
15433EOM
15434 d_nv_zero_is_allbits_zero="$define"
15435 ;;
15436 *) cat >&4 <<EOM
154370.0 is not represented as all bits zero in memory
15438EOM
15439 d_nv_zero_is_allbits_zero="$undef"
15440 ;;
15441 esac
15442 ;;
15443 *) cat >&4 <<EOM
154440.0 is not represented as all bits zero in memory
15445EOM
15446 d_nv_zero_is_allbits_zero="$undef"
15447 ;;
15448 esac
15449fi
15450
15451$rm -f try.* try
15452
b4eb6b3d
JH
15453
15454: check for off64_t
15455echo " "
15456echo "Checking to see if you have off64_t..." >&4
15457$cat >try.c <<EOCP
15458#include <sys/types.h>
15459#include <unistd.h>
15460int main() { off64_t x = 7; }
15461EOCP
15462set try
15463if eval $compile; then
15464 val="$define"
15465 echo "You have off64_t."
15466else
15467 val="$undef"
15468 echo "You do not have off64_t."
15469 case "$lseeksize" in
15470 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15471 esac
15472fi
15473$rm -f try.* try
15474set d_off64_t
15475eval $setvar
15476
b4eb6b3d
JH
15477: how to create joinable pthreads
15478if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15479 echo " "
15480 echo "Checking what constant to use for creating joinable pthreads..." >&4
15481 $cat >try.c <<'EOCP'
15482#include <pthread.h>
15483int main() {
15484 int detachstate = JOINABLE;
15485}
15486EOCP
15487 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15488 if eval $compile; then
15489 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15490 val="$undef" # Yes, undef.
15491 set d_old_pthread_create_joinable
15492 eval $setvar
15493 val=""
15494 set old_pthread_create_joinable
15495 eval $setvar
15496 else
15497 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15498 if eval $compile; then
15499 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15500 val="$define"
15501 set d_old_pthread_create_joinable
15502 eval $setvar
15503 val=PTHREAD_CREATE_UNDETACHED
15504 set old_pthread_create_joinable
15505 eval $setvar
15506 else
15507 set try -DJOINABLE=__UNDETACHED
15508 if eval $compile; then
15509 echo "You seem to use __UNDETACHED." >&4
15510 val="$define"
15511 set d_old_pthread_create_joinable
15512 eval $setvar
15513 val=__UNDETACHED
15514 set old_pthread_create_joinable
15515 eval $setvar
15516 else
15517 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
15518 val="$define"
15519 set d_old_pthread_create_joinable
15520 eval $setvar
15521 val=0
15522 set old_pthread_create_joinable
15523 eval $setvar
15524 fi
15525 fi
15526 fi
15527 $rm -f try try.*
15528else
15529 d_old_pthread_create_joinable="$undef"
15530 old_pthread_create_joinable=""
15531fi
15532
15533: see if pause exists
15534set pause d_pause
15535eval $inlibc
15536
15537: see if pipe exists
15538set pipe d_pipe
15539eval $inlibc
15540
15541: see if poll exists
15542set poll d_poll
15543eval $inlibc
15544
c7aff470
NIS
15545: see if readlink exists
15546set readlink d_readlink
15547eval $inlibc
15548
15549echo " "
f24dbf84 15550procselfexe=''
c7aff470 15551val="$undef"
a33c94aa
JH
15552case "$d_readlink" in
15553"$define")
c7aff470
NIS
15554 if $issymlink /proc/self/exe ; then
15555 $ls -l /proc/self/exe > reflect
51660ed5 15556 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 15557 echo "You have Linux-like /proc/self/exe."
92236451 15558 procselfexe='"/proc/self/exe"'
f24dbf84 15559 val="$define"
f24dbf84
JH
15560 fi
15561 fi
15562 if $issymlink /proc/curproc/file ; then
15563 $ls -l /proc/curproc/file > reflect
15564 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15565 echo "You have BSD-like /proc/curproc/file."
92236451 15566 procselfexe='"/proc/curproc/file"'
f24dbf84 15567 val="$define"
c7aff470 15568 fi
c7aff470 15569 fi
a33c94aa
JH
15570 ;;
15571esac
428dc699 15572$rm -f reflect
c7aff470
NIS
15573set d_procselfexe
15574eval $setvar
15575
233e16ce
MB
15576: backward compatibility for d_hvfork
15577if test X$d_hvfork != X; then
15578 d_vfork="$d_hvfork"
15579 d_hvfork=''
15580fi
15581: see if there is a vfork
15582val=''
15583set vfork val
15584eval $inlibc
15585
15586d_pseudofork=$undef
15587
15588: Ok, but do we want to use it. vfork is reportedly unreliable in
15589: perl on Solaris 2.x, and probably elsewhere.
15590case "$val" in
15591$define)
15592 echo " "
15593 case "$usevfork" in
15594 false) dflt='n';;
15595 *) dflt='y';;
15596 esac
15597 cat <<'EOM'
15598
15599Perl can only use a vfork() that doesn't suffer from strict
15600restrictions on calling functions or modifying global data in
15601the child. For example, glibc-2.1 contains such a vfork()
15602that is unsuitable. If your system provides a proper fork()
15603call, chances are that you do NOT want perl to use vfork().
15604
15605EOM
15606 rp="Do you still want to use vfork()?"
15607 . ./myread
15608 case "$ans" in
15609 y|Y) ;;
15610 *)
15611 echo "Ok, we won't use vfork()."
15612 val="$undef"
15613 ;;
15614 esac
15615 ;;
15616esac
15617set d_vfork
15618eval $setvar
15619case "$d_vfork" in
15620$define) usevfork='true';;
15621*) usevfork='false';;
15622esac
15623
263fee3f
JH
15624: see whether the pthread_atfork exists
15625$cat >try.c <<EOP
15626#include <pthread.h>
15627#include <stdio.h>
15628int main() {
15629#ifdef PTHREAD_ATFORK
15630 pthread_atfork(NULL,NULL,NULL);
15631#endif
15632}
15633EOP
15634
d6483fcc 15635: see if pthread_atfork exists
263fee3f
JH
15636set try -DPTHREAD_ATFORK
15637if eval $compile; then
15638 val="$define"
15639else
15640 val="$undef"
15641fi
15642case "$usethreads" in
15643$define)
15644 case "$val" in
15645 $define) echo 'pthread_atfork found.' >&4 ;;
15646 *) echo 'pthread_atfork NOT found.' >&4 ;;
15647 esac
15648esac
15649set d_pthread_atfork
15650eval $setvar
d6483fcc 15651
58d975c3
JH
15652: see if pthread_attr_setscope exists
15653set pthread_attr_setscope d_pthread_attr_setscope
15654eval $inlibc
15655
b4eb6b3d
JH
15656
15657: see whether the various POSIXish _yields exist
15658$cat >try.c <<EOP
15659#include <pthread.h>
15660#include <stdio.h>
15661int main() {
15662#ifdef SCHED_YIELD
15663 sched_yield();
15664#else
15665#ifdef PTHREAD_YIELD
15666 pthread_yield();
15667#else
15668#ifdef PTHREAD_YIELD_NULL
15669 pthread_yield(NULL);
15670#endif
15671#endif
15672#endif
15673}
15674EOP
15675: see if sched_yield exists
15676set try -DSCHED_YIELD
15677if eval $compile; then
15678 val="$define"
15679 sched_yield='sched_yield()'
15680else
15681 val="$undef"
15682fi
15683case "$usethreads" in
15684$define)
15685 case "$val" in
15686 $define) echo 'sched_yield() found.' >&4 ;;
15687 *) echo 'sched_yield() NOT found.' >&4 ;;
15688 esac
15689esac
10bc17b6
JH
15690set d_sched_yield
15691eval $setvar
b4eb6b3d 15692
10bc17b6
JH
15693: see if pthread_yield exists
15694set try -DPTHREAD_YIELD
15695if eval $compile; then
15696 val="$define"
15697 case "$sched_yield" in
15698 '') sched_yield='pthread_yield()' ;;
15699 esac
15700else
15701 set try -DPTHREAD_YIELD_NULL
15702 if eval $compile; then
15703 val="$define"
15704 case "$sched_yield" in
15705 '') sched_yield='pthread_yield(NULL)' ;;
15706 esac
15707 else
15708 val="$undef"
15709 fi
15710fi
15711case "$usethreads" in
15712$define)
15713 case "$val" in
15714 $define) echo 'pthread_yield() found.' >&4 ;;
15715 *) echo 'pthread_yield() NOT found.' >&4 ;;
15716 esac
15717 ;;
15718esac
15719set d_pthread_yield
15720eval $setvar
b4eb6b3d 15721
10bc17b6
JH
15722case "$sched_yield" in
15723'') sched_yield=undef ;;
15724esac
b4eb6b3d 15725
10bc17b6
JH
15726$rm -f try try.*
15727
15728: see if random_r exists
15729set random_r d_random_r
15730eval $inlibc
15731case "$d_random_r" in
15732"$define")
15733 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
15734 case "$d_random_r_proto:$usethreads" in
15735 ":define") d_random_r_proto=define
a48ec845
JH
15736 set d_random_r_proto random_r $hdrs
15737 eval $hasproto ;;
15738 *) ;;
15739 esac
15740 case "$d_random_r_proto" in
15741 define)
10bc17b6
JH
15742 case "$random_r_proto" in
15743 ''|0) try='int random_r(int*, struct random_data*);'
a845a0d4
JH
15744 ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15745 esac
15746 case "$random_r_proto" in
15747 ''|0) try='int random_r(long*, struct random_data*);'
15748 ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15749 esac
15750 case "$random_r_proto" in
15751 ''|0) try='int random_r(struct random_data*, int32_t*);'
15752 ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
15753 esac
15754 case "$random_r_proto" in
90e831dc 15755 ''|0) d_random_r=undef
10bc17b6 15756 random_r_proto=0
a48ec845 15757 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15758 * ) case "$random_r_proto" in
15759 REENTRANT_PROTO*) ;;
15760 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15761 esac
15762 echo "Prototype: $try" ;;
15763 esac
b4eb6b3d 15764 ;;
c18e646a
JH
15765 *) case "$usethreads" in
15766 define) echo "random_r has no prototype, not using it." >&4 ;;
15767 esac
90e831dc
SB
15768 d_random_r=undef
15769 random_r_proto=0
c18e646a 15770 ;;
a48ec845
JH
15771 esac
15772 ;;
10bc17b6 15773*) random_r_proto=0
b4eb6b3d
JH
15774 ;;
15775esac
15776
15777: see if readdir and friends exist
15778set readdir d_readdir
15779eval $inlibc
15780set seekdir d_seekdir
15781eval $inlibc
15782set telldir d_telldir
15783eval $inlibc
15784set rewinddir d_rewinddir
15785eval $inlibc
15786
10bc17b6
JH
15787: see if readdir64_r exists
15788set readdir64_r d_readdir64_r
15789eval $inlibc
15790case "$d_readdir64_r" in
15791"$define")
15792 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15793 case "$d_readdir64_r_proto:$usethreads" in
15794 ":define") d_readdir64_r_proto=define
a48ec845
JH
15795 set d_readdir64_r_proto readdir64_r $hdrs
15796 eval $hasproto ;;
15797 *) ;;
15798 esac
15799 case "$d_readdir64_r_proto" in
15800 define)
10bc17b6
JH
15801 case "$readdir64_r_proto" in
15802 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15803 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15804 esac
15805 case "$readdir64_r_proto" in
15806 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15807 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15808 esac
15809 case "$readdir64_r_proto" in
90e831dc 15810 ''|0) d_readdir64_r=undef
10bc17b6 15811 readdir64_r_proto=0
a48ec845 15812 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15813 * ) case "$readdir64_r_proto" in
15814 REENTRANT_PROTO*) ;;
15815 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15816 esac
15817 echo "Prototype: $try" ;;
15818 esac
15819 ;;
c18e646a
JH
15820 *) case "$usethreads" in
15821 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15822 esac
90e831dc
SB
15823 d_readdir64_r=undef
15824 readdir64_r_proto=0
c18e646a 15825 ;;
a48ec845
JH
15826 esac
15827 ;;
10bc17b6
JH
15828*) readdir64_r_proto=0
15829 ;;
15830esac
15831
15832: see if readdir_r exists
15833set readdir_r d_readdir_r
15834eval $inlibc
15835case "$d_readdir_r" in
15836"$define")
15837 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15838 case "$d_readdir_r_proto:$usethreads" in
15839 ":define") d_readdir_r_proto=define
a48ec845
JH
15840 set d_readdir_r_proto readdir_r $hdrs
15841 eval $hasproto ;;
15842 *) ;;
15843 esac
15844 case "$d_readdir_r_proto" in
15845 define)
10bc17b6
JH
15846 case "$readdir_r_proto" in
15847 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15848 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15849 esac
15850 case "$readdir_r_proto" in
15851 ''|0) try='int readdir_r(DIR*, struct dirent*);'
15852 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15853 esac
15854 case "$readdir_r_proto" in
90e831dc 15855 ''|0) d_readdir_r=undef
10bc17b6 15856 readdir_r_proto=0
a48ec845 15857 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15858 * ) case "$readdir_r_proto" in
15859 REENTRANT_PROTO*) ;;
15860 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15861 esac
15862 echo "Prototype: $try" ;;
15863 esac
15864 ;;
c18e646a
JH
15865 *) case "$usethreads" in
15866 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15867 esac
90e831dc
SB
15868 d_readdir_r=undef
15869 readdir_r_proto=0
c18e646a 15870 ;;
a48ec845
JH
15871 esac
15872 ;;
10bc17b6
JH
15873*) readdir_r_proto=0
15874 ;;
15875esac
15876
4e0554ec
JH
15877: see if readv exists
15878set readv d_readv
15879eval $inlibc
15880
15881: see if recvmsg exists
15882set recvmsg d_recvmsg
15883eval $inlibc
15884
b4eb6b3d
JH
15885: see if rename exists
15886set rename d_rename
15887eval $inlibc
15888
15889: see if rmdir exists
15890set rmdir d_rmdir
15891eval $inlibc
15892
15893: see if memory.h is available.
15894val=''
15895set memory.h val
15896eval $inhdr
15897
15898: See if it conflicts with string.h
15899case "$val" in
15900$define)
15901 case "$strings" in
15902 '') ;;
15903 *)
15904 $cppstdin $cppflags $cppminus < $strings > mem.h
15905 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15906 echo " "
15907 echo "We won't be including <memory.h>."
15908 val="$undef"
15909 fi
15910 $rm -f mem.h
15911 ;;
15912 esac
15913esac
15914set i_memory
15915eval $setvar
15916
15917: can bcopy handle overlapping blocks?
b6cc3bc4 15918echo " "
b4eb6b3d 15919val="$undef"
b6cc3bc4
AD
15920case "$d_memmove" in
15921"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15922*) case "$d_bcopy" in
15923 "$define")
15924 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15925 $cat >try.c <<EOCP
b4eb6b3d
JH
15926#$i_memory I_MEMORY
15927#$i_stdlib I_STDLIB
15928#$i_string I_STRING
15929#$i_unistd I_UNISTD
15930EOCP
15931 $cat >>try.c <<'EOCP'
15932#include <stdio.h>
15933#ifdef I_MEMORY
15934# include <memory.h>
15935#endif
15936#ifdef I_STDLIB
15937# include <stdlib.h>
15938#endif
15939#ifdef I_STRING
15940# include <string.h>
15941#else
15942# include <strings.h>
15943#endif
15944#ifdef I_UNISTD
15945# include <unistd.h> /* Needed for NetBSD */
15946#endif
15947int main()
15948{
15949char buf[128], abc[128];
15950char *b;
15951int len;
15952int off;
15953int align;
15954
b6cc3bc4
AD
15955/* Copy "abcde..." string to char abc[] so that gcc doesn't
15956 try to store the string in read-only memory. */
b4eb6b3d
JH
15957bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15958
15959for (align = 7; align >= 0; align--) {
15960 for (len = 36; len; len--) {
15961 b = buf+align;
15962 bcopy(abc, b, len);
15963 for (off = 1; off <= len; off++) {
15964 bcopy(b, b+off, len);
15965 bcopy(b+off, b, len);
15966 if (bcmp(b, abc, len))
15967 exit(1);
15968 }
15969 }
15970}
15971exit(0);
15972}
15973EOCP
b6cc3bc4
AD
15974 set try
15975 if eval $compile_ok; then
15976 if ./try 2>/dev/null; then
15977 echo "Yes, it can."
15978 val="$define"
15979 else
15980 echo "It can't, sorry."
15981 fi
b4eb6b3d 15982 else
b6cc3bc4 15983 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15984 fi
b6cc3bc4
AD
15985 ;;
15986 esac
15987 $rm -f try.* try core
b4eb6b3d
JH
15988 ;;
15989esac
b4eb6b3d
JH
15990set d_safebcpy
15991eval $setvar
15992
15993: can memcpy handle overlapping blocks?
b6cc3bc4 15994echo " "
b4eb6b3d 15995val="$undef"
b6cc3bc4
AD
15996case "$d_memmove" in
15997"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15998*) case "$d_memcpy" in
15999 "$define")
16000 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16001 $cat >try.c <<EOCP
b4eb6b3d
JH
16002#$i_memory I_MEMORY
16003#$i_stdlib I_STDLIB
16004#$i_string I_STRING
16005#$i_unistd I_UNISTD
16006EOCP
16007 $cat >>try.c <<'EOCP'
16008#include <stdio.h>
16009#ifdef I_MEMORY
16010# include <memory.h>
16011#endif
16012#ifdef I_STDLIB
16013# include <stdlib.h>
16014#endif
16015#ifdef I_STRING
16016# include <string.h>
16017#else
16018# include <strings.h>
16019#endif
16020#ifdef I_UNISTD
16021# include <unistd.h> /* Needed for NetBSD */
16022#endif
16023int main()
16024{
16025char buf[128], abc[128];
16026char *b;
16027int len;
16028int off;
16029int align;
16030
16031/* Copy "abcde..." string to char abc[] so that gcc doesn't
16032 try to store the string in read-only memory. */
16033memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16034
16035for (align = 7; align >= 0; align--) {
16036 for (len = 36; len; len--) {
16037 b = buf+align;
16038 memcpy(b, abc, len);
16039 for (off = 1; off <= len; off++) {
16040 memcpy(b+off, b, len);
16041 memcpy(b, b+off, len);
16042 if (memcmp(b, abc, len))
16043 exit(1);
16044 }
16045 }
16046}
16047exit(0);
16048}
16049EOCP
b6cc3bc4
AD
16050 set try
16051 if eval $compile_ok; then
16052 if ./try 2>/dev/null; then
16053 echo "Yes, it can."
16054 val="$define"
16055 else
16056 echo "It can't, sorry."
16057 fi
b4eb6b3d 16058 else
b6cc3bc4 16059 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16060 fi
b6cc3bc4
AD
16061 ;;
16062 esac
16063 $rm -f try.* try core
b4eb6b3d
JH
16064 ;;
16065esac
b4eb6b3d
JH
16066set d_safemcpy
16067eval $setvar
16068
16069: can memcmp be trusted to compare relative magnitude?
16070val="$undef"
16071case "$d_memcmp" in
16072"$define")
16073 echo " "
16074 echo "Checking if your memcmp() can compare relative magnitude..." >&4
16075 $cat >try.c <<EOCP
16076#$i_memory I_MEMORY
16077#$i_stdlib I_STDLIB
16078#$i_string I_STRING
16079#$i_unistd I_UNISTD
16080EOCP
16081 $cat >>try.c <<'EOCP'
16082#include <stdio.h>
16083#ifdef I_MEMORY
16084# include <memory.h>
16085#endif
16086#ifdef I_STDLIB
36adc09b 16087# include <stdlib.h>
b4eb6b3d
JH
16088#endif
16089#ifdef I_STRING
16090# include <string.h>
16091#else
16092# include <strings.h>
16093#endif
16094#ifdef I_UNISTD
16095# include <unistd.h> /* Needed for NetBSD */
16096#endif
16097int main()
16098{
16099char a = -1;
16100char b = 0;
16101if ((a < b) && memcmp(&a, &b, 1) < 0)
16102 exit(1);
16103exit(0);
16104}
16105EOCP
16106 set try
16107 if eval $compile_ok; then
5440bc8e 16108 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
16109 echo "Yes, it can."
16110 val="$define"
16111 else
16112 echo "No, it can't (it uses signed chars)."
16113 fi
16114 else
16115 echo "(I can't compile the test program, so we'll assume not...)"
16116 fi
16117 ;;
16118esac
16119$rm -f try.* try core
16120set d_sanemcmp
16121eval $setvar
16122
ef9f17be
JH
16123: see if prototype for sbrk is available
16124echo " "
16125set d_sbrkproto sbrk $i_unistd unistd.h
16126eval $hasproto
16127
b4eb6b3d
JH
16128: see if select exists
16129set select d_select
16130eval $inlibc
16131
16132: see if semctl exists
16133set semctl d_semctl
16134eval $inlibc
16135
16136: see if semget exists
16137set semget d_semget
16138eval $inlibc
16139
16140: see if semop exists
16141set semop d_semop
16142eval $inlibc
16143
16144: see how much of the 'sem*(2)' library is present.
16145h_sem=true
16146echo " "
16147case "$d_semctl$d_semget$d_semop" in
16148*"$undef"*) h_sem=false;;
16149esac
16150case "$osname" in
16151freebsd)
16152 case "`ipcs 2>&1`" in
16153 "SVID messages"*"not configured"*)
16154 echo "Your $osname does not have the sem*(2) configured." >&4
16155 h_sem=false
16156 val="$undef"
16157 set semctl d_semctl
16158 eval $setvar
16159 set semget d_semget
16160 eval $setvar
16161 set semop d_semop
16162 eval $setvar
16163 ;;
16164 esac
16165 ;;
16166esac
16167: we could also check for sys/ipc.h ...
16168if $h_sem && $test `./findhdr sys/sem.h`; then
16169 echo "You have the full sem*(2) library." >&4
16170 val="$define"
16171else
16172 echo "You don't have the full sem*(2) library." >&4
16173 val="$undef"
16174fi
16175set d_sem
16176eval $setvar
16177
16178: see whether sys/sem.h defines union semun
16179echo " "
16180$cat > try.c <<'END'
16181#include <sys/types.h>
16182#include <sys/ipc.h>
16183#include <sys/sem.h>
16184int main () { union semun semun; semun.buf = 0; }
16185END
16186set try
16187if eval $compile; then
16188 echo "You have union semun in <sys/sem.h>." >&4
16189 val="$define"
16190else
16191 echo "You do not have union semun in <sys/sem.h>." >&4
16192 val="$undef"
16193fi
2fad75a1 16194$rm -f try try.c
b4eb6b3d
JH
16195set d_union_semun
16196eval $setvar
16197
16198: see how to do semctl IPC_STAT
16199case "$d_sem" in
16200$define)
b4eb6b3d
JH
16201 echo " "
16202 $cat > try.h <<END
16203#ifndef S_IRUSR
16204# ifdef S_IREAD
16205# define S_IRUSR S_IREAD
16206# define S_IWUSR S_IWRITE
16207# define S_IXUSR S_IEXEC
16208# else
16209# define S_IRUSR 0400
16210# define S_IWUSR 0200
16211# define S_IXUSR 0100
16212# endif
16213# define S_IRGRP (S_IRUSR>>3)
16214# define S_IWGRP (S_IWUSR>>3)
16215# define S_IXGRP (S_IXUSR>>3)
16216# define S_IROTH (S_IRUSR>>6)
16217# define S_IWOTH (S_IWUSR>>6)
16218# define S_IXOTH (S_IXUSR>>6)
16219#endif
16220#ifndef S_IRWXU
16221# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16222# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16223# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16224#endif
16225END
2fad75a1 16226 : see whether semctl IPC_STAT can use union semun
2fad75a1
JH
16227 case "$d_semctl_semun" in
16228 '')
35918792 16229 val="$undef"
2fad75a1 16230 $cat > try.c <<END
b4eb6b3d
JH
16231#include <sys/types.h>
16232#include <sys/ipc.h>
16233#include <sys/sem.h>
16234#include <sys/stat.h>
16235#include <stdio.h>
16236#include <errno.h>
16237#include "try.h"
16238#ifndef errno
16239extern int errno;
16240#endif
16241#$d_union_semun HAS_UNION_SEMUN
16242int main() {
16243 union semun
16244#ifndef HAS_UNION_SEMUN
16245 {
16246 int val;
16247 struct semid_ds *buf;
16248 unsigned short *array;
16249 }
16250#endif
16251 arg;
16252 int sem, st;
16253
16254#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16255 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16256 if (sem > -1) {
16257 struct semid_ds argbuf;
16258 arg.buf = &argbuf;
16259# ifdef IPC_STAT
16260 st = semctl(sem, 0, IPC_STAT, arg);
16261 if (st == 0)
16262 printf("semun\n");
16263 else
16264# endif /* IPC_STAT */
16265 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16266# ifdef IPC_RMID
16267 if (semctl(sem, 0, IPC_RMID, arg) != 0)
35918792 16268# endif /* IPC_RMID */
b4eb6b3d
JH
16269 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16270 } else
16271#endif /* IPC_PRIVATE && ... */
16272 printf("semget failed: errno = %d\n", errno);
16273 return 0;
16274}
16275END
2fad75a1
JH
16276 set try
16277 if eval $compile; then
16278 xxx=`$run ./try`
16279 case "$xxx" in
16280 semun) val="$define" ;;
16281 esac
16282 fi
16283 $rm -f try try.c
35918792
YST
16284 set d_semctl_semun
16285 eval $setvar
2fad75a1
JH
16286 ;;
16287 esac
b4eb6b3d
JH
16288 case "$d_semctl_semun" in
16289 $define)
16290 echo "You can use union semun for semctl IPC_STAT." >&4
16291 also='also'
16292 ;;
16293 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
16294 also=''
16295 ;;
16296 esac
16297
16298 : see whether semctl IPC_STAT can use struct semid_ds pointer
2fad75a1
JH
16299 case "$d_semctl_semid_ds" in
16300 '')
35918792 16301 val="$undef"
2fad75a1 16302 $cat > try.c <<'END'
b4eb6b3d
JH
16303#include <sys/types.h>
16304#include <sys/ipc.h>
16305#include <sys/sem.h>
16306#include <sys/stat.h>
16307#include "try.h"
16308#include <stdio.h>
16309#include <errno.h>
16310#ifndef errno
16311extern int errno;
16312#endif
16313int main() {
16314 struct semid_ds arg;
16315 int sem, st;
16316
16317#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16318 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16319 if (sem > -1) {
16320# ifdef IPC_STAT
16321 st = semctl(sem, 0, IPC_STAT, &arg);
16322 if (st == 0)
16323 printf("semid_ds\n");
16324 else
16325# endif /* IPC_STAT */
16326 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16327# ifdef IPC_RMID
16328 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16329# endif /* IPC_RMID */
16330 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16331 } else
16332#endif /* IPC_PRIVATE && ... */
16333 printf("semget failed: errno = %d\n", errno);
16334
16335 return 0;
16336}
16337END
2fad75a1
JH
16338 set try
16339 if eval $compile; then
16340 xxx=`$run ./try`
16341 case "$xxx" in
16342 semid_ds) val="$define" ;;
16343 esac
16344 fi
16345 $rm -f try try.c
35918792
YST
16346 set d_semctl_semid_ds
16347 eval $setvar
2fad75a1
JH
16348 ;;
16349 esac
b4eb6b3d
JH
16350 case "$d_semctl_semid_ds" in
16351 $define)
16352 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16353 ;;
16354 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16355 ;;
16356 esac
16357 $rm -f try.h
16358 ;;
16359*) val="$undef"
16360
16361 # We do not have the full sem*(2) library, so assume we can not
16362 # use either.
16363
16364 set d_semctl_semun
16365 eval $setvar
16366
16367 set d_semctl_semid_ds
16368 eval $setvar
16369 ;;
16370esac
16371
4e0554ec
JH
16372: see if sendmsg exists
16373set sendmsg d_sendmsg
16374eval $inlibc
16375
b4eb6b3d
JH
16376: see if setegid exists
16377set setegid d_setegid
16378eval $inlibc
16379
16380: see if seteuid exists
16381set seteuid d_seteuid
16382eval $inlibc
16383
16384: see if setgrent exists
16385set setgrent d_setgrent
16386eval $inlibc
16387
10bc17b6
JH
16388: see if setgrent_r exists
16389set setgrent_r d_setgrent_r
16390eval $inlibc
16391case "$d_setgrent_r" in
16392"$define")
16393 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
16394 case "$d_setgrent_r_proto:$usethreads" in
16395 ":define") d_setgrent_r_proto=define
a48ec845
JH
16396 set d_setgrent_r_proto setgrent_r $hdrs
16397 eval $hasproto ;;
16398 *) ;;
16399 esac
16400 case "$d_setgrent_r_proto" in
16401 define)
10bc17b6
JH
16402 case "$setgrent_r_proto" in
16403 ''|0) try='int setgrent_r(FILE**);'
16404 ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16405 esac
16406 case "$setgrent_r_proto" in
16407 ''|0) try='void setgrent_r(FILE**);'
16408 ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16409 esac
16410 case "$setgrent_r_proto" in
90e831dc 16411 ''|0) d_setgrent_r=undef
10bc17b6 16412 setgrent_r_proto=0
a48ec845 16413 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16414 * ) case "$setgrent_r_proto" in
16415 REENTRANT_PROTO*) ;;
16416 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16417 esac
16418 echo "Prototype: $try" ;;
16419 esac
16420 ;;
c18e646a
JH
16421 *) case "$usethreads" in
16422 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16423 esac
90e831dc
SB
16424 d_setgrent_r=undef
16425 setgrent_r_proto=0
c18e646a 16426 ;;
a48ec845
JH
16427 esac
16428 ;;
10bc17b6
JH
16429*) setgrent_r_proto=0
16430 ;;
16431esac
16432
b4eb6b3d
JH
16433: see if sethostent exists
16434set sethostent d_sethent
16435eval $inlibc
16436
10bc17b6
JH
16437: see if sethostent_r exists
16438set sethostent_r d_sethostent_r
16439eval $inlibc
16440case "$d_sethostent_r" in
16441"$define")
16442 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16443 case "$d_sethostent_r_proto:$usethreads" in
16444 ":define") d_sethostent_r_proto=define
a48ec845
JH
16445 set d_sethostent_r_proto sethostent_r $hdrs
16446 eval $hasproto ;;
16447 *) ;;
16448 esac
16449 case "$d_sethostent_r_proto" in
16450 define)
10bc17b6
JH
16451 case "$sethostent_r_proto" in
16452 ''|0) try='int sethostent_r(int, struct hostent_data*);'
16453 ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16454 esac
16455 case "$sethostent_r_proto" in
16456 ''|0) try='void sethostent_r(int, struct hostent_data*);'
16457 ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16458 esac
16459 case "$sethostent_r_proto" in
90e831dc 16460 ''|0) d_sethostent_r=undef
10bc17b6 16461 sethostent_r_proto=0
a48ec845 16462 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16463 * ) case "$sethostent_r_proto" in
16464 REENTRANT_PROTO*) ;;
16465 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16466 esac
16467 echo "Prototype: $try" ;;
16468 esac
16469 ;;
c18e646a
JH
16470 *) case "$usethreads" in
16471 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16472 esac
90e831dc
SB
16473 d_sethostent_r=undef
16474 sethostent_r_proto=0
c18e646a 16475 ;;
a48ec845
JH
16476 esac
16477 ;;
10bc17b6
JH
16478*) sethostent_r_proto=0
16479 ;;
16480esac
16481
4e0554ec
JH
16482: see if setitimer exists
16483set setitimer d_setitimer
16484eval $inlibc
16485
b4eb6b3d
JH
16486: see if setlinebuf exists
16487set setlinebuf d_setlinebuf
16488eval $inlibc
16489
16490: see if setlocale exists
16491set setlocale d_setlocale
16492eval $inlibc
16493
10bc17b6
JH
16494: see if locale.h is available
16495set locale.h i_locale
16496eval $inhdr
16497
16498: see if setlocale_r exists
16499set setlocale_r d_setlocale_r
16500eval $inlibc
16501case "$d_setlocale_r" in
16502"$define")
16503 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
16504 case "$d_setlocale_r_proto:$usethreads" in
16505 ":define") d_setlocale_r_proto=define
a48ec845
JH
16506 set d_setlocale_r_proto setlocale_r $hdrs
16507 eval $hasproto ;;
16508 *) ;;
16509 esac
16510 case "$d_setlocale_r_proto" in
16511 define)
10bc17b6
JH
16512 case "$setlocale_r_proto" in
16513 ''|0) try='int setlocale_r(int, const char*, char*, int);'
16514 ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16515 esac
16516 case "$setlocale_r_proto" in
90e831dc 16517 ''|0) d_setlocale_r=undef
10bc17b6 16518 setlocale_r_proto=0
a48ec845 16519 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16520 * ) case "$setlocale_r_proto" in
16521 REENTRANT_PROTO*) ;;
16522 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16523 esac
16524 echo "Prototype: $try" ;;
16525 esac
16526 ;;
c18e646a
JH
16527 *) case "$usethreads" in
16528 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16529 esac
90e831dc
SB
16530 d_setlocale_r=undef
16531 setlocale_r_proto=0
c18e646a 16532 ;;
a48ec845
JH
16533 esac
16534 ;;
10bc17b6
JH
16535*) setlocale_r_proto=0
16536 ;;
16537esac
16538
b4eb6b3d
JH
16539: see if setnetent exists
16540set setnetent d_setnent
16541eval $inlibc
16542
10bc17b6
JH
16543: see if setnetent_r exists
16544set setnetent_r d_setnetent_r
16545eval $inlibc
16546case "$d_setnetent_r" in
16547"$define")
16548 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16549 case "$d_setnetent_r_proto:$usethreads" in
16550 ":define") d_setnetent_r_proto=define
a48ec845
JH
16551 set d_setnetent_r_proto setnetent_r $hdrs
16552 eval $hasproto ;;
16553 *) ;;
16554 esac
16555 case "$d_setnetent_r_proto" in
16556 define)
10bc17b6
JH
16557 case "$setnetent_r_proto" in
16558 ''|0) try='int setnetent_r(int, struct netent_data*);'
16559 ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16560 esac
16561 case "$setnetent_r_proto" in
16562 ''|0) try='void setnetent_r(int, struct netent_data*);'
16563 ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16564 esac
16565 case "$setnetent_r_proto" in
90e831dc 16566 ''|0) d_setnetent_r=undef
10bc17b6 16567 setnetent_r_proto=0
a48ec845 16568 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16569 * ) case "$setnetent_r_proto" in
16570 REENTRANT_PROTO*) ;;
16571 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16572 esac
16573 echo "Prototype: $try" ;;
16574 esac
16575 ;;
c18e646a
JH
16576 *) case "$usethreads" in
16577 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16578 esac
90e831dc
SB
16579 d_setnetent_r=undef
16580 setnetent_r_proto=0
c18e646a 16581 ;;
a48ec845
JH
16582 esac
16583 ;;
10bc17b6
JH
16584*) setnetent_r_proto=0
16585 ;;
16586esac
16587
b4eb6b3d
JH
16588: see if setprotoent exists
16589set setprotoent d_setpent
16590eval $inlibc
16591
16592: see if setpgid exists
16593set setpgid d_setpgid
16594eval $inlibc
16595
16596: see if setpgrp2 exists
16597set setpgrp2 d_setpgrp2
16598eval $inlibc
16599
16600: see if setpriority exists
16601set setpriority d_setprior
16602eval $inlibc
16603
16604: see if setproctitle exists
16605set setproctitle d_setproctitle
16606eval $inlibc
16607
10bc17b6
JH
16608: see if setprotoent_r exists
16609set setprotoent_r d_setprotoent_r
16610eval $inlibc
16611case "$d_setprotoent_r" in
16612"$define")
16613 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16614 case "$d_setprotoent_r_proto:$usethreads" in
16615 ":define") d_setprotoent_r_proto=define
a48ec845
JH
16616 set d_setprotoent_r_proto setprotoent_r $hdrs
16617 eval $hasproto ;;
16618 *) ;;
16619 esac
16620 case "$d_setprotoent_r_proto" in
16621 define)
10bc17b6
JH
16622 case "$setprotoent_r_proto" in
16623 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16624 ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16625 esac
16626 case "$setprotoent_r_proto" in
16627 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16628 ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16629 esac
16630 case "$setprotoent_r_proto" in
90e831dc 16631 ''|0) d_setprotoent_r=undef
10bc17b6 16632 setprotoent_r_proto=0
a48ec845 16633 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16634 * ) case "$setprotoent_r_proto" in
16635 REENTRANT_PROTO*) ;;
16636 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16637 esac
16638 echo "Prototype: $try" ;;
16639 esac
16640 ;;
c18e646a
JH
16641 *) case "$usethreads" in
16642 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16643 esac
90e831dc
SB
16644 d_setprotoent_r=undef
16645 setprotoent_r_proto=0
c18e646a 16646 ;;
a48ec845
JH
16647 esac
16648 ;;
10bc17b6
JH
16649*) setprotoent_r_proto=0
16650 ;;
16651esac
16652
b4eb6b3d
JH
16653: see if setpwent exists
16654set setpwent d_setpwent
16655eval $inlibc
16656
10bc17b6
JH
16657: see if setpwent_r exists
16658set setpwent_r d_setpwent_r
16659eval $inlibc
16660case "$d_setpwent_r" in
16661"$define")
16662 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
16663 case "$d_setpwent_r_proto:$usethreads" in
16664 ":define") d_setpwent_r_proto=define
a48ec845
JH
16665 set d_setpwent_r_proto setpwent_r $hdrs
16666 eval $hasproto ;;
16667 *) ;;
16668 esac
16669 case "$d_setpwent_r_proto" in
16670 define)
10bc17b6
JH
16671 case "$setpwent_r_proto" in
16672 ''|0) try='int setpwent_r(FILE**);'
16673 ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16674 esac
16675 case "$setpwent_r_proto" in
16676 ''|0) try='void setpwent_r(FILE**);'
16677 ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16678 esac
16679 case "$setpwent_r_proto" in
90e831dc 16680 ''|0) d_setpwent_r=undef
10bc17b6 16681 setpwent_r_proto=0
a48ec845 16682 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16683 * ) case "$setpwent_r_proto" in
16684 REENTRANT_PROTO*) ;;
16685 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16686 esac
16687 echo "Prototype: $try" ;;
16688 esac
16689 ;;
c18e646a
JH
16690 *) case "$usethreads" in
16691 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16692 esac
90e831dc
SB
16693 d_setpwent_r=undef
16694 setpwent_r_proto=0
c18e646a 16695 ;;
a48ec845
JH
16696 esac
16697 ;;
10bc17b6
JH
16698*) setpwent_r_proto=0
16699 ;;
16700esac
16701
b4eb6b3d
JH
16702: see if setregid exists
16703set setregid d_setregid
16704eval $inlibc
16705set setresgid d_setresgid
16706eval $inlibc
16707
16708: see if setreuid exists
16709set setreuid d_setreuid
16710eval $inlibc
16711set setresuid d_setresuid
16712eval $inlibc
16713
16714: see if setrgid exists
16715set setrgid d_setrgid
16716eval $inlibc
16717
16718: see if setruid exists
16719set setruid d_setruid
16720eval $inlibc
16721
16722: see if setservent exists
16723set setservent d_setsent
16724eval $inlibc
16725
10bc17b6
JH
16726: see if setservent_r exists
16727set setservent_r d_setservent_r
16728eval $inlibc
16729case "$d_setservent_r" in
16730"$define")
16731 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16732 case "$d_setservent_r_proto:$usethreads" in
16733 ":define") d_setservent_r_proto=define
a48ec845
JH
16734 set d_setservent_r_proto setservent_r $hdrs
16735 eval $hasproto ;;
16736 *) ;;
16737 esac
16738 case "$d_setservent_r_proto" in
16739 define)
10bc17b6
JH
16740 case "$setservent_r_proto" in
16741 ''|0) try='int setservent_r(int, struct servent_data*);'
16742 ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16743 esac
16744 case "$setservent_r_proto" in
16745 ''|0) try='void setservent_r(int, struct servent_data*);'
16746 ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16747 esac
16748 case "$setservent_r_proto" in
90e831dc 16749 ''|0) d_setservent_r=undef
10bc17b6 16750 setservent_r_proto=0
a48ec845 16751 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16752 * ) case "$setservent_r_proto" in
16753 REENTRANT_PROTO*) ;;
16754 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16755 esac
16756 echo "Prototype: $try" ;;
16757 esac
16758 ;;
c18e646a
JH
16759 *) case "$usethreads" in
16760 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16761 esac
90e831dc
SB
16762 d_setservent_r=undef
16763 setservent_r_proto=0
c18e646a 16764 ;;
a48ec845
JH
16765 esac
16766 ;;
10bc17b6
JH
16767*) setservent_r_proto=0
16768 ;;
16769esac
16770
b4eb6b3d
JH
16771: see if setsid exists
16772set setsid d_setsid
16773eval $inlibc
16774
16775: see if setvbuf exists
16776set setvbuf d_setvbuf
16777eval $inlibc
16778
16779: see if sfio.h is available
16780set sfio.h i_sfio
16781eval $inhdr
16782
16783
16784: see if sfio library is available
16785case "$i_sfio" in
16786$define)
16787 val=''
16788 set sfreserve val
16789 eval $inlibc
16790 ;;
16791*)
16792 val="$undef"
16793 ;;
16794esac
16795: Ok, but do we want to use it.
16796case "$val" in
16797$define)
16798 case "$usesfio" in
16799 true|$define|[yY]*) dflt='y';;
16800 *) dflt='n';;
16801 esac
16802 echo "$package can use the sfio library, but it is experimental."
16803 case "$useperlio" in
16804 "$undef")
16805 echo "For sfio also the PerlIO abstraction layer is needed."
16806 echo "Earlier you said you wouldn't want that."
16807 ;;
16808 esac
16809 rp="You seem to have sfio available, do you want to try using it?"
16810 . ./myread
16811 case "$ans" in
16812 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
16813 useperlio="$define"
16814 val="$define"
16815 ;;
16816 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
16817 val="$undef"
b4eb6b3d
JH
16818 ;;
16819 esac
16820 ;;
16821*) case "$usesfio" in
16822 true|$define|[yY]*)
16823 echo "Sorry, cannot find sfio on this machine." >&4
16824 echo "Ignoring your setting of usesfio=$usesfio." >&4
16825 val="$undef"
16826 ;;
16827 esac
16828 ;;
16829esac
16830set d_sfio
16831eval $setvar
16832case "$d_sfio" in
16833$define) usesfio='true';;
16834*) usesfio='false';;
16835esac
3659ebf1
JH
16836case "$d_sfio" in
16837$define) ;;
16838*) : Remove sfio from list of libraries to use
7483f793
JH
16839 case "$libs" in
16840 *-lsfio*)
16841 echo "Removing unneeded -lsfio from library list" >&4
16842 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16843 shift
16844 libs="$*"
16845 echo "libs = $libs" >&4
16846 ;;
16847 esac
3659ebf1
JH
16848;;
16849esac
16850
b4eb6b3d
JH
16851
16852: see if shmctl exists
16853set shmctl d_shmctl
16854eval $inlibc
16855
16856: see if shmget exists
16857set shmget d_shmget
16858eval $inlibc
16859
16860: see if shmat exists
16861set shmat d_shmat
16862eval $inlibc
16863: see what shmat returns
16864case "$d_shmat" in
16865"$define")
16866 $cat >shmat.c <<'END'
16867#include <sys/shm.h>
16868void *shmat();
16869END
16870 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16871 shmattype='void *'
16872 else
16873 shmattype='char *'
16874 fi
16875 echo "and it returns ($shmattype)." >&4
16876 : see if a prototype for shmat is available
16877 xxx=`./findhdr sys/shm.h`
16878 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16879 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16880 val="$define"
16881 else
16882 val="$undef"
16883 fi
16884 $rm -f shmat.[co]
16885 ;;
16886*)
16887 val="$undef"
16888 ;;
16889esac
16890set d_shmatprototype
16891eval $setvar
16892
16893: see if shmdt exists
16894set shmdt d_shmdt
16895eval $inlibc
16896
16897: see how much of the 'shm*(2)' library is present.
16898h_shm=true
16899echo " "
16900case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16901*"$undef"*) h_shm=false;;
16902esac
16903case "$osname" in
16904freebsd)
16905 case "`ipcs 2>&1`" in
16906 "SVID shared memory"*"not configured"*)
16907 echo "Your $osname does not have the shm*(2) configured." >&4
16908 h_shm=false
16909 val="$undef"
16910 set shmctl d_shmctl
16911 evat $setvar
16912 set shmget d_shmget
16913 evat $setvar
16914 set shmat d_shmat
16915 evat $setvar
16916 set shmdt d_shmdt
16917 evat $setvar
16918 ;;
16919 esac
16920 ;;
16921esac
16922: we could also check for sys/ipc.h ...
16923if $h_shm && $test `./findhdr sys/shm.h`; then
16924 echo "You have the full shm*(2) library." >&4
16925 val="$define"
16926else
16927 echo "You don't have the full shm*(2) library." >&4
16928 val="$undef"
16929fi
16930set d_shm
16931eval $setvar
16932
16933echo " "
16934: see if we have sigaction
16935if set sigaction val -f d_sigaction; eval $csym; $val; then
16936 echo 'sigaction() found.' >&4
073b6de5 16937 $cat > try.c <<EOP
b4eb6b3d
JH
16938#include <stdio.h>
16939#include <sys/types.h>
16940#include <signal.h>
073b6de5
JH
16941#$i_stdlib I_STDLIB
16942#ifdef I_STDLIB
16943#include <stdlib.h>
16944#endif
b4eb6b3d
JH
16945int main()
16946{
16947 struct sigaction act, oact;
16948 act.sa_flags = 0;
16949 oact.sa_handler = 0;
16950 /* so that act and oact are used */
16951 exit(act.sa_flags == 0 && oact.sa_handler == 0);
16952}
16953EOP
16954 set try
16955 if eval $compile_ok; then
16956 val="$define"
16957 else
16958 echo "But you don't seem to have a useable struct sigaction." >&4
16959 val="$undef"
16960 fi
16961else
16962 echo 'sigaction NOT found.' >&4
16963 val="$undef"
16964fi
16965set d_sigaction; eval $setvar
16966$rm -f try try$_o try.c
16967
ed140128
AD
16968: see if this is a sunmath.h system
16969set sunmath.h i_sunmath
16970eval $inhdr
16971
16972: see if signbit exists
16973$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
16974$cat >try.c <<EOCP
16975#$i_math I_MATH
16976#$i_sunmath I_SUNMATH
16977#ifdef I_MATH
16978# include <math.h>
16979#endif
16980#ifdef I_SUNMATH /* Solaris special math library */
16981# include <sunmath.h>
16982#endif
16983#define NV $nvtype
16984int main(int argc, char **argv)
16985{
16986 NV x = 0.0;
16987 NV y = -0.0;
16988 if ((signbit(x) == 0) && (signbit(y) != 0))
16989 return 0;
16990 else
16991 return 1;
16992}
16993EOCP
16994val="$undef"
16995set try
16996if eval $compile; then
16997 if $run ./try; then
16998 $echo "Yes." >&4
16999 val="$define"
17000 else
17001 $echo "Signbit seems to be available, but doesn't work as I expected."
17002 $echo "I won't use it." >&4
17003 val="$undef"
17004 fi
17005else
17006 $echo "Nope." >&4
17007 dflt="$undef"
17008fi
17009set d_signbit
17010eval $setvar
17011$rm -f try.* try
17012
983dbef6
JH
17013: see if sigprocmask exists
17014set sigprocmask d_sigprocmask
17015eval $inlibc
17016
b4eb6b3d
JH
17017: see if sigsetjmp exists
17018echo " "
17019case "$d_sigsetjmp" in
17020'')
c727eafa 17021 $cat >try.c <<EOP
b4eb6b3d 17022#include <setjmp.h>
d1daaddf
JH
17023#$i_stdlib I_STDLIB
17024#ifdef I_STDLIB
17025#include <stdlib.h>
17026#endif
b4eb6b3d
JH
17027sigjmp_buf env;
17028int set = 1;
17029int main()
17030{
17031 if (sigsetjmp(env,1))
17032 exit(set);
17033 set = 0;
17034 siglongjmp(env, 1);
17035 exit(1);
17036}
17037EOP
17038 set try
17039 if eval $compile; then
5440bc8e 17040 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
17041 echo "POSIX sigsetjmp found." >&4
17042 val="$define"
17043 else
17044 $cat >&4 <<EOM
17045Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17046I'll ignore them.
17047EOM
17048 val="$undef"
17049 fi
17050 else
17051 echo "sigsetjmp not found." >&4
17052 val="$undef"
17053 fi
17054 ;;
17055*) val="$d_sigsetjmp"
17056 case "$d_sigsetjmp" in
17057 $define) echo "POSIX sigsetjmp found." >&4;;
17058 $undef) echo "sigsetjmp not found." >&4;;
17059 esac
17060 ;;
17061esac
17062set d_sigsetjmp
17063eval $setvar
17064$rm -f try.c try
17065
4f5da3e9
SP
17066: see if snprintf exists
17067set snprintf d_snprintf
17068eval $inlibc
17069
17070: see if vsnprintf exists
17071set vsnprintf d_vsnprintf
17072eval $inlibc
17073
2478f7a0
MB
17074case "$d_snprintf-$d_vsnprintf" in
17075"$define-$define")
17076 $cat <<EOM
17077Checking whether your snprintf() and vsnprintf() work okay...
17078EOM
17079 $cat >try.c <<'EOCP'
17080/* v?snprintf testing logic courtesy of Russ Allbery.
17081 * According to C99:
17082 * - if the buffer is too short it still must be \0-terminated
17083 * - if the buffer is too short the potentially required length
17084 * must be returned and not -1
17085 * - if the buffer is NULL the potentially required length
17086 * must be returned and not -1 or core dump
17087 */
17088#include <stdio.h>
17089#include <stdarg.h>
17090
17091char buf[2];
17092
17093int test (char *format, ...)
17094{
17095 va_list args;
17096 int count;
17097
17098 va_start (args, format);
17099 count = vsnprintf (buf, sizeof buf, format, args);
17100 va_end (args);
17101 return count;
17102}
17103
17104int main ()
17105{
17106 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17107 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17108}
17109EOCP
17110 set try
17111 if eval $compile; then
17112 `$run ./try`
17113 case "$?" in
17114 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17115 *) cat <<EOM >&4
17116Your snprintf() and snprintf() don't seem to be working okay.
17117EOM
17118 d_snprintf="$undef"
17119 d_vsnprintf="$undef"
17120 ;;
17121 esac
17122 else
17123 echo "(I can't seem to compile the test program--assuming they don't)"
17124 d_snprintf="$undef"
17125 d_vsnprintf="$undef"
17126 fi
17127 $rm -f try.* try core core.try.*
17128 ;;
17129esac
17130
49a78c82
JH
17131: see if sockatmark exists
17132set sockatmark d_sockatmark
17133eval $inlibc
17134
2ef53570
JH
17135: see if prototype for sockatmark is available
17136echo " "
17137set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17138eval $hasproto
17139
b4eb6b3d
JH
17140: see if socks5_init exists
17141set socks5_init d_socks5_init
17142eval $inlibc
17143
360321b3
YST
17144: see if sprintf returns the length of the string in the buffer as per ANSI
17145$echo "Checking whether sprintf returns the length of the string..." >&4
17146$cat <<EOP >try.c
17147#include <stdio.h>
17148#$i_stdlib I_STDLIB
17149#ifdef I_STDLIB
17150#include <stdlib.h>
17151#endif
17152#$i_string I_STRING
17153#ifdef I_STRING
17154# include <string.h>
17155#else
17156# include <strings.h>
17157#endif
17158#$i_math I_MATH
17159#ifdef I_MATH
17160#include <math.h>
17161#endif
17162
17163char buffer[256];
17164
17165int check (size_t expect, int test) {
17166 size_t got = strlen(buffer);
17167 if (expect == got)
17168 return 0;
17169
17170 printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17171 test, buffer);
17172 exit (test);
17173}
17174
17175int main(int argc, char **argv) {
17176 int test = 0;
17177
17178 check(sprintf(buffer, ""), ++test);
17179 check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17180 check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17181
17182 return 0;
17183}
17184EOP
17185set try
17186
17187d_sprintf_returns_strlen="$undef"
17188if eval $compile; then
17189 xxx="`$run ./try`"
17190 case "$?" in
17191 0) cat >&4 <<EOM
17192sprintf returns the length of the string (as ANSI says it should)
17193EOM
17194 d_sprintf_returns_strlen="$define"
17195 ;;
17196 *) cat >&4 <<EOM
17197sprintf does not return the length of the string (how old is this system?)
17198EOM
17199 d_sprintf_returns_strlen="$undef"
17200 ;;
17201 esac
17202fi
17203
17204$rm -f try.* try
17205
10bc17b6
JH
17206: see if srand48_r exists
17207set srand48_r d_srand48_r
17208eval $inlibc
17209case "$d_srand48_r" in
17210"$define")
17211 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17212 case "$d_srand48_r_proto:$usethreads" in
17213 ":define") d_srand48_r_proto=define
a48ec845
JH
17214 set d_srand48_r_proto srand48_r $hdrs
17215 eval $hasproto ;;
17216 *) ;;
17217 esac
17218 case "$d_srand48_r_proto" in
17219 define)
10bc17b6
JH
17220 case "$srand48_r_proto" in
17221 ''|0) try='int srand48_r(long, struct drand48_data*);'
17222 ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17223 esac
17224 case "$srand48_r_proto" in
90e831dc 17225 ''|0) d_srand48_r=undef
10bc17b6 17226 srand48_r_proto=0
a48ec845 17227 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17228 * ) case "$srand48_r_proto" in
17229 REENTRANT_PROTO*) ;;
17230 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17231 esac
17232 echo "Prototype: $try" ;;
17233 esac
17234 ;;
c18e646a
JH
17235 *) case "$usethreads" in
17236 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17237 esac
90e831dc
SB
17238 d_srand48_r=undef
17239 srand48_r_proto=0
c18e646a 17240 ;;
a48ec845
JH
17241 esac
17242 ;;
10bc17b6
JH
17243*) srand48_r_proto=0
17244 ;;
17245esac
17246
17247: see if srandom_r exists
17248set srandom_r d_srandom_r
17249eval $inlibc
17250case "$d_srandom_r" in
17251"$define")
17252 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17253 case "$d_srandom_r_proto:$usethreads" in
17254 ":define") d_srandom_r_proto=define
a48ec845
JH
17255 set d_srandom_r_proto srandom_r $hdrs
17256 eval $hasproto ;;
17257 *) ;;
17258 esac
17259 case "$d_srandom_r_proto" in
17260 define)
10bc17b6
JH
17261 case "$srandom_r_proto" in
17262 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17263 ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17264 esac
17265 case "$srandom_r_proto" in
90e831dc 17266 ''|0) d_srandom_r=undef
10bc17b6 17267 srandom_r_proto=0
a48ec845 17268 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17269 * ) case "$srandom_r_proto" in
17270 REENTRANT_PROTO*) ;;
17271 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17272 esac
17273 echo "Prototype: $try" ;;
17274 esac
17275 ;;
c18e646a
JH
17276 *) case "$usethreads" in
17277 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17278 esac
90e831dc
SB
17279 d_srandom_r=undef
17280 srandom_r_proto=0
c18e646a 17281 ;;
a48ec845
JH
17282 esac
17283 ;;
10bc17b6
JH
17284*) srandom_r_proto=0
17285 ;;
17286esac
17287
eef837ea
JH
17288: see if prototype for setresgid is available
17289echo " "
17290set d_sresgproto setresgid $i_unistd unistd.h
17291eval $hasproto
17292
640374d0
JH
17293: see if prototype for setresuid is available
17294echo " "
17295set d_sresuproto setresuid $i_unistd unistd.h
17296eval $hasproto
17297
b4eb6b3d
JH
17298: see if sys/stat.h is available
17299set sys/stat.h i_sysstat
17300eval $inhdr
17301
17302
17303: see if stat knows about block sizes
17304echo " "
17305echo "Checking to see if your struct stat has st_blocks field..." >&4
17306set d_statblks stat st_blocks $i_sysstat sys/stat.h
17307eval $hasfield
17308
17309
17310: see if this is a sys/vfs.h system
17311set sys/vfs.h i_sysvfs
17312eval $inhdr
17313
17314
17315: see if this is a sys/statfs.h system
17316set sys/statfs.h i_sysstatfs
17317eval $inhdr
17318
17319
17320echo " "
17321echo "Checking to see if your system supports struct statfs..." >&4
17322set 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
17323eval $hasstruct
17324case "$d_statfs_s" in
17325"$define") echo "Yes, it does." ;;
17326*) echo "No, it doesn't." ;;
17327esac
17328
17329
17330
17331: see if struct statfs knows about f_flags
17332case "$d_statfs_s" in
17333define)
17334 echo " "
17335 echo "Checking to see if your struct statfs has f_flags field..." >&4
17336 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
17337 eval $hasfield
17338 ;;
17339*) val="$undef"
17340 set d_statfs_f_flags
17341 eval $setvar
17342 ;;
17343esac
17344case "$d_statfs_f_flags" in
17345"$define") echo "Yes, it does." ;;
17346*) echo "No, it doesn't." ;;
17347esac
17348
b4eb6b3d
JH
17349$cat >&4 <<EOM
17350Checking how to access stdio streams by file descriptor number...
17351EOM
17352case "$stdio_stream_array" in
17353'') $cat >try.c <<EOCP
17354#include <stdio.h>
17355int main() {
17356 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17357 printf("yes\n");
17358}
17359EOCP
17360 for s in _iob __iob __sF
17361 do
17362 set try -DSTDIO_STREAM_ARRAY=$s
17363 if eval $compile; then
5440bc8e 17364 case "`$run ./try`" in
b4eb6b3d
JH
17365 yes) stdio_stream_array=$s; break ;;
17366 esac
17367 fi
17368 done
17369 $rm -f try.* try$exe_ext
17370esac
17371case "$stdio_stream_array" in
17372'') $cat >&4 <<EOM
17373I can't figure out how to access stdio streams by file descriptor number.
17374EOM
17375 d_stdio_stream_array="$undef"
17376 ;;
17377*) $cat >&4 <<EOM
17378You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17379EOM
17380 d_stdio_stream_array="$define"
17381 ;;
17382esac
17383
17384: see if strcoll exists
17385set strcoll d_strcoll
17386eval $inlibc
17387
17388: check for structure copying
17389echo " "
17390echo "Checking to see if your C compiler can copy structs..." >&4
17391$cat >try.c <<'EOCP'
76f47787 17392int main()
b4eb6b3d
JH
17393{
17394 struct blurfl {
17395 int dyick;
17396 } foo, bar;
17397
17398 foo = bar;
17399}
17400EOCP
17401if $cc -c try.c >/dev/null 2>&1 ; then
17402 val="$define"
17403 echo "Yup, it can."
17404else
17405 val="$undef"
17406 echo "Nope, it can't."
17407fi
17408set d_strctcpy
17409eval $setvar
17410$rm -f try.*
17411
17412: see if strerror and/or sys_errlist[] exist
17413echo " "
17414if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17415 if set strerror val -f d_strerror; eval $csym; $val; then
17416 echo 'strerror() found.' >&4
17417 d_strerror="$define"
17418 d_strerrm='strerror(e)'
17419 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17420 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
17421 d_syserrlst="$define"
17422 else
17423 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17424 d_syserrlst="$undef"
17425 fi
17426 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17427 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17428 echo 'strerror() found in string header.' >&4
17429 d_strerror="$define"
17430 d_strerrm='strerror(e)'
17431 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17432 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17433 d_syserrlst="$define"
17434 else
17435 echo "(You don't appear to have any sys_errlist[], how can this be?)"
17436 d_syserrlst="$undef"
17437 fi
17438 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17439 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17440 d_strerror="$undef"
17441 d_syserrlst="$define"
17442 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17443 else
17444 echo 'strerror() and sys_errlist[] NOT found.' >&4
17445 d_strerror="$undef"
17446 d_syserrlst="$undef"
17447 d_strerrm='"unknown"'
17448 fi
17449fi
17450
10bc17b6
JH
17451: see if strerror_r exists
17452set strerror_r d_strerror_r
17453eval $inlibc
17454case "$d_strerror_r" in
17455"$define")
17456 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
17457 case "$d_strerror_r_proto:$usethreads" in
17458 ":define") d_strerror_r_proto=define
a48ec845
JH
17459 set d_strerror_r_proto strerror_r $hdrs
17460 eval $hasproto ;;
17461 *) ;;
17462 esac
17463 case "$d_strerror_r_proto" in
17464 define)
10bc17b6
JH
17465 case "$strerror_r_proto" in
17466 ''|0) try='int strerror_r(int, char*, size_t);'
17467 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17468 esac
17469 case "$strerror_r_proto" in
17470 ''|0) try='int strerror_r(int, char*, int);'
17471 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17472 esac
17473 case "$strerror_r_proto" in
17474 ''|0) try='char* strerror_r(int, char*, size_t);'
17475 ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17476 esac
17477 case "$strerror_r_proto" in
90e831dc 17478 ''|0) d_strerror_r=undef
10bc17b6 17479 strerror_r_proto=0
a48ec845 17480 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17481 * ) case "$strerror_r_proto" in
17482 REENTRANT_PROTO*) ;;
17483 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17484 esac
17485 echo "Prototype: $try" ;;
17486 esac
17487 ;;
c18e646a
JH
17488 *) case "$usethreads" in
17489 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17490 esac
90e831dc
SB
17491 d_strerror_r=undef
17492 strerror_r_proto=0
c18e646a 17493 ;;
a48ec845
JH
17494 esac
17495 ;;
10bc17b6
JH
17496*) strerror_r_proto=0
17497 ;;
17498esac
17499
b3c85772
JH
17500: see if strftime exists
17501set strftime d_strftime
17502eval $inlibc
17503
08c92000
MB
17504: see if strlcat exists
17505set strlcat d_strlcat
17506eval $inlibc
17507
17508: see if strlcpy exists
17509set strlcpy d_strlcpy
17510eval $inlibc
17511
b4eb6b3d
JH
17512: see if strtod exists
17513set strtod d_strtod
17514eval $inlibc
17515
17516: see if strtol exists
17517set strtol d_strtol
17518eval $inlibc
17519
17520: see if strtold exists
17521set strtold d_strtold
17522eval $inlibc
17523
17524: see if strtoll exists
17525set strtoll d_strtoll
17526eval $inlibc
17527
17528case "$d_longlong-$d_strtoll" in
17529"$define-$define")
17530 $cat <<EOM
17531Checking whether your strtoll() works okay...
17532EOM
17533 $cat >try.c <<'EOCP'
17534#include <errno.h>
17535#ifdef __hpux
17536#define strtoll __strtoll
17537#endif
e75931a7
YST
17538#ifdef __EMX__
17539#define strtoll _strtoll
17540#endif
b4eb6b3d
JH
17541#include <stdio.h>
17542extern long long int strtoll(char *s, char **, int);
17543static int bad = 0;
17544int check(char *s, long long ell, int een) {
17545 long long gll;
17546 errno = 0;
17547 gll = strtoll(s, 0, 10);
17548 if (!((gll == ell) && (errno == een)))
17549 bad++;
17550}
17551int main() {
17552 check(" 1", 1LL, 0);
17553 check(" 0", 0LL, 0);
17554 check("-1", -1LL, 0);
17555 check("-9223372036854775808", -9223372036854775808LL, 0);
17556 check("-9223372036854775808", -9223372036854775808LL, 0);
17557 check(" 9223372036854775807", 9223372036854775807LL, 0);
17558 check("-9223372036854775808", -9223372036854775808LL, 0);
17559 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
17560 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17561 if (!bad)
17562 printf("ok\n");
17563}
17564EOCP
17565 set try
17566 if eval $compile; then
5440bc8e 17567 yyy=`$run ./try`
e75931a7 17568 case "$yyy" in
b4eb6b3d
JH
17569 ok) echo "Your strtoll() seems to be working okay." ;;
17570 *) cat <<EOM >&4
17571Your strtoll() doesn't seem to be working okay.
17572EOM
17573 d_strtoll="$undef"
17574 ;;
69eadf66 17575 esac
e75931a7
YST
17576 else
17577 echo "(I can't seem to compile the test program--assuming it doesn't)"
17578 d_strtoll="$undef"
b4eb6b3d
JH
17579 fi
17580 ;;
17581esac
17582
28e5dec8
JH
17583: see if strtoq exists
17584set strtoq d_strtoq
17585eval $inlibc
17586
b4eb6b3d
JH
17587: see if strtoul exists
17588set strtoul d_strtoul
17589eval $inlibc
17590
d0e6d399
NC
17591case "$d_strtoul" in
17592"$define")
17593 $cat <<EOM
17594Checking whether your strtoul() works okay...
17595EOM
17596 $cat >try.c <<'EOCP'
17597#include <errno.h>
17598#include <stdio.h>
17599extern unsigned long int strtoul(char *s, char **, int);
17600static int bad = 0;
17601void check(char *s, unsigned long eul, int een) {
17602 unsigned long gul;
17603 errno = 0;
17604 gul = strtoul(s, 0, 10);
17605 if (!((gul == eul) && (errno == een)))
17606 bad++;
17607}
17608int main() {
17609 check(" 1", 1L, 0);
17610 check(" 0", 0L, 0);
17611EOCP
17612 case "$longsize" in
17613 8)
17614 $cat >>try.c <<'EOCP'
09c0d2c4
JH
17615 check("18446744073709551615", 18446744073709551615UL, 0);
17616 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 17617#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 17618 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
17619 check("-18446744073709551614", 2, 0);
17620 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
17621 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17622 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 17623#endif
d0e6d399
NC
17624EOCP
17625 ;;
17626 4)
17627 $cat >>try.c <<'EOCP'
17628 check("4294967295", 4294967295UL, 0);
17629 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 17630#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
17631 check("-1", 4294967295UL, 0);
17632 check("-4294967294", 2, 0);
17633 check("-4294967295", 1, 0);
17634 check("-4294967296", 4294967295UL, ERANGE);
17635 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 17636#endif
d0e6d399
NC
17637EOCP
17638 ;;
17639 *)
17640: Should we write these tests to be more portable by sprintf-ing
17641: ~0 and then manipulating that char string as input for strtol?
17642 ;;
17643 esac
17644 $cat >>try.c <<'EOCP'
17645 if (!bad)
17646 printf("ok\n");
17647 return 0;
17648}
17649EOCP
17650 set try
17651 if eval $compile; then
5440bc8e 17652 case "`$run ./try`" in
d0e6d399
NC
17653 ok) echo "Your strtoul() seems to be working okay." ;;
17654 *) cat <<EOM >&4
17655Your strtoul() doesn't seem to be working okay.
17656EOM
17657 d_strtoul="$undef"
17658 ;;
17659 esac
17660 fi
17661 ;;
17662esac
17663
b4eb6b3d
JH
17664: see if strtoull exists
17665set strtoull d_strtoull
17666eval $inlibc
17667
17668case "$d_longlong-$d_strtoull" in
17669"$define-$define")
17670 $cat <<EOM
17671Checking whether your strtoull() works okay...
17672EOM
17673 $cat >try.c <<'EOCP'
17674#include <errno.h>
17675#ifdef __hpux
17676#define strtoull __strtoull
17677#endif
17678#include <stdio.h>
17679extern unsigned long long int strtoull(char *s, char **, int);
17680static int bad = 0;
17681int check(char *s, long long eull, int een) {
17682 long long gull;
17683 errno = 0;
17684 gull = strtoull(s, 0, 10);
17685 if (!((gull == eull) && (errno == een)))
17686 bad++;
17687}
17688int main() {
d0e6d399
NC
17689 check(" 1", 1LL, 0);
17690 check(" 0", 0LL, 0);
17691 check("18446744073709551615", 18446744073709551615ULL, 0);
17692 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 17693#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
17694 check("-1", 18446744073709551615ULL, 0);
17695 check("-18446744073709551614", 2LL, 0);
17696 check("-18446744073709551615", 1LL, 0);
17697 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17698 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 17699#endif
b4eb6b3d
JH
17700 if (!bad)
17701 printf("ok\n");
17702}
17703EOCP
17704 set try
17705 if eval $compile; then
5440bc8e 17706 case "`$run ./try`" in
b4eb6b3d
JH
17707 ok) echo "Your strtoull() seems to be working okay." ;;
17708 *) cat <<EOM >&4
17709Your strtoull() doesn't seem to be working okay.
17710EOM
17711 d_strtoull="$undef"
17712 ;;
17713 esac
17714 fi
17715 ;;
17716esac
17717
17718: see if strtouq exists
17719set strtouq d_strtouq
17720eval $inlibc
17721
d0e6d399
NC
17722case "$d_strtouq" in
17723"$define")
17724 $cat <<EOM
17725Checking whether your strtouq() works okay...
17726EOM
17727 $cat >try.c <<'EOCP'
17728#include <errno.h>
17729#include <stdio.h>
17730extern unsigned long long int strtouq(char *s, char **, int);
17731static int bad = 0;
17732void check(char *s, unsigned long long eull, int een) {
17733 unsigned long long gull;
17734 errno = 0;
17735 gull = strtouq(s, 0, 10);
17736 if (!((gull == eull) && (errno == een)))
17737 bad++;
17738}
17739int main() {
17740 check(" 1", 1LL, 0);
17741 check(" 0", 0LL, 0);
17742 check("18446744073709551615", 18446744073709551615ULL, 0);
17743 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 17744#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
17745 check("-1", 18446744073709551615ULL, 0);
17746 check("-18446744073709551614", 2LL, 0);
17747 check("-18446744073709551615", 1LL, 0);
17748 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17749 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 17750#endif
d0e6d399
NC
17751 if (!bad)
17752 printf("ok\n");
17753 return 0;
17754}
17755EOCP
17756 set try
17757 if eval $compile; then
5440bc8e 17758 case "`$run ./try`" in
d0e6d399
NC
17759 ok) echo "Your strtouq() seems to be working okay." ;;
17760 *) cat <<EOM >&4
17761Your strtouq() doesn't seem to be working okay.
17762EOM
17763 d_strtouq="$undef"
17764 ;;
17765 esac
17766 fi
17767 ;;
17768esac
17769
b4eb6b3d
JH
17770: see if strxfrm exists
17771set strxfrm d_strxfrm
17772eval $inlibc
17773
17774: see if symlink exists
17775set symlink d_symlink
17776eval $inlibc
17777
17778: see if syscall exists
17779set syscall d_syscall
17780eval $inlibc
17781
2ef53570
JH
17782: see if prototype for syscall is available
17783echo " "
17784set d_syscallproto syscall $i_unistd unistd.h
17785eval $hasproto
17786
b4eb6b3d
JH
17787: see if sysconf exists
17788set sysconf d_sysconf
17789eval $inlibc
17790
17791: see if system exists
17792set system d_system
17793eval $inlibc
17794
17795: see if tcgetpgrp exists
17796set tcgetpgrp d_tcgetpgrp
17797eval $inlibc
17798
17799: see if tcsetpgrp exists
17800set tcsetpgrp d_tcsetpgrp
17801eval $inlibc
17802
17803: see if prototype for telldir is available
17804echo " "
17805set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17806eval $hasproto
17807
ad493445
MB
17808: see if time exists
17809echo " "
17810if test "X$d_time" = X -o X"$timetype" = X; then
17811 if set time val -f d_time; eval $csym; $val; then
17812 echo 'time() found.' >&4
17813 val="$define"
17814 rp="What is the type returned by time() on this system?"
17815 set time_t timetype long stdio.h sys/types.h
17816 eval $typedef_ask
17817 else
17818 echo 'time() not found, hope that will do.' >&4
17819 val="$undef"
17820 timetype='int';
17821 fi
17822 set d_time
17823 eval $setvar
17824fi
17825
b4eb6b3d
JH
17826: see if this is a sys/times.h system
17827set sys/times.h i_systimes
17828eval $inhdr
17829
17830: see if times exists
17831echo " "
17832if set times val -f d_times; eval $csym; $val; then
17833 echo 'times() found.' >&4
17834 d_times="$define"
17835 inc=''
17836 case "$i_systimes" in
17837 "$define") inc='sys/times.h';;
17838 esac
17839 rp="What is the type returned by times() on this system?"
17840 set clock_t clocktype long stdio.h sys/types.h $inc
17841 eval $typedef_ask
17842else
17843 echo 'times() NOT found, hope that will do.' >&4
17844 d_times="$undef"
17845 clocktype='int'
17846fi
17847
10bc17b6
JH
17848: see if tmpnam_r exists
17849set tmpnam_r d_tmpnam_r
17850eval $inlibc
17851case "$d_tmpnam_r" in
17852"$define")
31ee0cb7 17853 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
17854 case "$d_tmpnam_r_proto:$usethreads" in
17855 ":define") d_tmpnam_r_proto=define
a48ec845
JH
17856 set d_tmpnam_r_proto tmpnam_r $hdrs
17857 eval $hasproto ;;
17858 *) ;;
17859 esac
17860 case "$d_tmpnam_r_proto" in
17861 define)
10bc17b6
JH
17862 case "$tmpnam_r_proto" in
17863 ''|0) try='char* tmpnam_r(char*);'
17864 ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17865 esac
17866 case "$tmpnam_r_proto" in
90e831dc 17867 ''|0) d_tmpnam_r=undef
10bc17b6 17868 tmpnam_r_proto=0
a48ec845 17869 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17870 * ) case "$tmpnam_r_proto" in
17871 REENTRANT_PROTO*) ;;
17872 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17873 esac
17874 echo "Prototype: $try" ;;
17875 esac
17876 ;;
c18e646a
JH
17877 *) case "$usethreads" in
17878 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17879 esac
90e831dc
SB
17880 d_tmpnam_r=undef
17881 tmpnam_r_proto=0
c18e646a 17882 ;;
a48ec845
JH
17883 esac
17884 ;;
10bc17b6
JH
17885*) tmpnam_r_proto=0
17886 ;;
17887esac
17888
b4eb6b3d
JH
17889: see if truncate exists
17890set truncate d_truncate
17891eval $inlibc
17892
10bc17b6
JH
17893: see if ttyname_r exists
17894set ttyname_r d_ttyname_r
17895eval $inlibc
17896case "$d_ttyname_r" in
17897"$define")
17898 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
17899 case "$d_ttyname_r_proto:$usethreads" in
17900 ":define") d_ttyname_r_proto=define
a48ec845
JH
17901 set d_ttyname_r_proto ttyname_r $hdrs
17902 eval $hasproto ;;
17903 *) ;;
17904 esac
17905 case "$d_ttyname_r_proto" in
17906 define)
10bc17b6
JH
17907 case "$ttyname_r_proto" in
17908 ''|0) try='int ttyname_r(int, char*, size_t);'
17909 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17910 esac
17911 case "$ttyname_r_proto" in
17912 ''|0) try='int ttyname_r(int, char*, int);'
17913 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17914 esac
17915 case "$ttyname_r_proto" in
17916 ''|0) try='char* ttyname_r(int, char*, int);'
17917 ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17918 esac
17919 case "$ttyname_r_proto" in
90e831dc 17920 ''|0) d_ttyname_r=undef
10bc17b6 17921 ttyname_r_proto=0
a48ec845 17922 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17923 * ) case "$ttyname_r_proto" in
17924 REENTRANT_PROTO*) ;;
17925 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17926 esac
17927 echo "Prototype: $try" ;;
17928 esac
17929 ;;
c18e646a
JH
17930 *) case "$usethreads" in
17931 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17932 esac
90e831dc
SB
17933 d_ttyname_r=undef
17934 ttyname_r_proto=0
c18e646a 17935 ;;
a48ec845
JH
17936 esac
17937 ;;
10bc17b6
JH
17938*) ttyname_r_proto=0
17939 ;;
17940esac
17941
b4eb6b3d
JH
17942: see if tzname[] exists
17943echo " "
17944if set tzname val -a d_tzname; eval $csym; $val; then
17945 val="$define"
17946 echo 'tzname[] found.' >&4
17947else
17948 val="$undef"
17949 echo 'tzname[] NOT found.' >&4
17950fi
17951set d_tzname
17952eval $setvar
17953
4e0554ec
JH
17954case "$osname" in
17955next|rhapsody|darwin) multiarch="$define" ;;
17956esac
17957case "$multiarch" in
17958''|[nN]*) multiarch="$undef" ;;
17959esac
17960
24412007 17961: check for ordering of bytes in a UV
4e0554ec 17962echo " "
5440bc8e 17963case "$usecrosscompile$multiarch" in
4e0554ec
JH
17964*$define*)
17965 $cat <<EOM
17966You seem to be either cross-compiling or doing a multiarchitecture build,
17967skipping the byteorder check.
17968
17969EOM
5440bc8e 17970 byteorder='ffff'
4e0554ec
JH
17971 ;;
17972*)
17973 case "$byteorder" in
17974 '')
17975 $cat <<'EOM'
17976In the following, larger digits indicate more significance. A big-endian
17977machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17978little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17979machines may have weird orders like 3412. A Cray will report 87654321,
17980an Alpha will report 12345678. If the test program works the default is
17981probably right.
17982I'm now running the test program...
17983EOM
24412007 17984 $cat >try.c <<EOCP
4e0554ec 17985#include <stdio.h>
55954f19
JH
17986#$i_stdlib I_STDLIB
17987#ifdef I_STDLIB
17988#include <stdlib.h>
17989#endif
24412007
JH
17990#include <sys/types.h>
17991typedef $uvtype UV;
4e0554ec
JH
17992int main()
17993{
17994 int i;
17995 union {
24412007
JH
17996 UV l;
17997 char c[$uvsize];
4e0554ec
JH
17998 } u;
17999
24412007 18000 if ($uvsize > 4)
b5ded3e5 18001 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 18002 else
a4c53327 18003 u.l = (UV)0x04030201;
24412007 18004 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
18005 printf("%c", u.c[i]+'0');
18006 printf("\n");
18007 exit(0);
18008}
18009EOCP
18010 xxx_prompt=y
18011 set try
18012 if eval $compile && ./try > /dev/null; then
5440bc8e 18013 dflt=`$run ./try`
4e0554ec
JH
18014 case "$dflt" in
18015 [1-4][1-4][1-4][1-4]|12345678|87654321)
18016 echo "(The test program ran ok.)"
18017 echo "byteorder=$dflt"
18018 xxx_prompt=n
18019 ;;
18020 ????|????????) echo "(The test program ran ok.)" ;;
18021 *) echo "(The test program didn't run right for some reason.)" ;;
18022 esac
18023 else
18024 dflt='4321'
18025 cat <<'EOM'
18026(I can't seem to compile the test program. Guessing big-endian...)
18027EOM
18028 fi
18029 case "$xxx_prompt" in
18030 y)
24412007 18031 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
18032 . ./myread
18033 byteorder="$ans"
18034 ;;
18035 *) byteorder=$dflt
18036 ;;
18037 esac
18038 ;;
18039 esac
18040 $rm -f try.c try
18041 ;;
18042esac
18043
18044
18045$cat <<EOM
18046
18047Checking to see whether you can access character data unalignedly...
18048EOM
dc7b0a4f
JH
18049case "$d_u32align" in
18050'') $cat >try.c <<EOCP
4e0554ec 18051#include <stdio.h>
d1daaddf
JH
18052#$i_stdlib I_STDLIB
18053#ifdef I_STDLIB
18054#include <stdlib.h>
18055#endif
4e0554ec 18056#define U32 $u32type
d308175a
JH
18057#define BYTEORDER 0x$byteorder
18058#define U8 $u8type
9958dc3c
JH
18059#include <signal.h>
18060#ifdef SIGBUS
7090f861 18061$signal_t bletch(int s) { exit(4); }
9958dc3c 18062#endif
4e0554ec
JH
18063int main() {
18064#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
8906a23e 18065 U8 buf[8];
4e0554ec
JH
18066 U32 *up;
18067 int i;
18068
18069 if (sizeof(U32) != 4) {
18070 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18071 exit(1);
18072 }
18073
18074 fflush(stdout);
18075
9958dc3c
JH
18076#ifdef SIGBUS
18077 signal(SIGBUS, bletch);
18078#endif
18079
8906a23e
JH
18080 buf[0] = 0;
18081 buf[1] = 0;
18082 buf[2] = 0;
18083 buf[3] = 1;
7eac3fd6 18084 buf[4] = 0;
8906a23e
JH
18085 buf[5] = 0;
18086 buf[6] = 0;
7eac3fd6 18087 buf[7] = 1;
8906a23e 18088
4e0554ec
JH
18089 for (i = 0; i < 4; i++) {
18090 up = (U32*)(buf + i);
18091 if (! ((*up == 1 << (8*i)) || /* big-endian */
18092 (*up == 1 << (8*(3-i))) /* little-endian */
18093 )
18094 )
18095 {
18096 printf("read failed (%x)\n", *up);
18097 exit(2);
18098 }
18099 }
18100
18101 /* write test */
18102 for (i = 0; i < 4; i++) {
18103 up = (U32*)(buf + i);
18104 *up = 0xBeef;
18105 if (*up != 0xBeef) {
18106 printf("write failed (%x)\n", *up);
18107 exit(3);
18108 }
18109 }
18110
18111 exit(0);
18112#else
18113 printf("1\n");
18114 exit(1);
18115#endif
18116 return 0;
18117}
18118EOCP
18119set try
18120if eval $compile_ok; then
d308175a 18121 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 18122 $run ./try 2>&1 >/dev/null
4e0554ec
JH
18123 case "$?" in
18124 0) cat >&4 <<EOM
18125You can access character data pretty unalignedly.
18126EOM
18127 d_u32align="$undef"
18128 ;;
18129 *) cat >&4 <<EOM
18130It seems that you must access character data in an aligned manner.
18131EOM
18132 d_u32align="$define"
18133 ;;
18134 esac
4e0554ec
JH
18135else
18136 rp='Can you access character data at unaligned addresses?'
18137 dflt='n'
18138 . ./myread
18139 case "$ans" in
18140 [yY]*) d_u32align="$undef" ;;
18141 *) d_u32align="$define" ;;
18142 esac
18143fi
e36b5403 18144$rm -f core core.try.* try.core
dc7b0a4f
JH
18145;;
18146esac
4e0554ec
JH
18147
18148: see if ualarm exists
18149set ualarm d_ualarm
18150eval $inlibc
18151
b4eb6b3d
JH
18152: see if umask exists
18153set umask d_umask
18154eval $inlibc
18155
758a5d79
JH
18156: see if unordered exists
18157set unordered d_unordered
18158eval $inlibc
18159
bdf33aa7
SP
18160: see if unsetenv exists
18161set unsetenv d_unsetenv
18162eval $inlibc
18163
4e0554ec
JH
18164: see if usleep exists
18165set usleep d_usleep
18166eval $inlibc
18167
2ef53570
JH
18168: see if prototype for usleep is available
18169echo " "
18170set d_usleepproto usleep $i_unistd unistd.h
18171eval $hasproto
18172
b4eb6b3d
JH
18173: see if ustat exists
18174set ustat d_ustat
18175eval $inlibc
18176
b4eb6b3d
JH
18177: see if closedir exists
18178set closedir d_closedir
18179eval $inlibc
18180
18181case "$d_closedir" in
18182"$define")
18183 echo " "
18184 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 18185 cat > try.c <<EOM
b4eb6b3d
JH
18186#$i_dirent I_DIRENT /**/
18187#$i_sysdir I_SYS_DIR /**/
18188#$i_sysndir I_SYS_NDIR /**/
18189#$i_systypes I_SYS_TYPES /**/
18190
18191#if defined(I_SYS_TYPES)
18192#include <sys/types.h>
18193#endif
18194#if defined(I_DIRENT)
18195#include <dirent.h>
18196#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18197#include <sys/dir.h>
18198#endif
18199#else
18200#ifdef I_SYS_NDIR
18201#include <sys/ndir.h>
18202#else
18203#ifdef I_SYS_DIR
18204#ifdef hp9000s500
18205#include <ndir.h> /* may be wrong in the future */
18206#else
18207#include <sys/dir.h>
18208#endif
18209#endif
18210#endif
18211#endif
18212int main() { return closedir(opendir(".")); }
18213EOM
5440bc8e 18214 set try
b4eb6b3d 18215 if eval $compile_ok; then
5440bc8e 18216 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
18217 echo "Yes, it does."
18218 val="$undef"
18219 else
18220 echo "No, it doesn't."
18221 val="$define"
18222 fi
18223 else
18224 echo "(I can't seem to compile the test program--assuming it doesn't)"
18225 val="$define"
18226 fi
18227 ;;
18228*)
18229 val="$undef";
18230 ;;
18231esac
18232set d_void_closedir
18233eval $setvar
5440bc8e 18234$rm -f try try.*
b4eb6b3d
JH
18235: see if there is a wait4
18236set wait4 d_wait4
18237eval $inlibc
18238
18239: see if waitpid exists
18240set waitpid d_waitpid
18241eval $inlibc
18242
18243: see if wcstombs exists
18244set wcstombs d_wcstombs
18245eval $inlibc
18246
18247: see if wctomb exists
18248set wctomb d_wctomb
18249eval $inlibc
18250
4e0554ec
JH
18251: see if writev exists
18252set writev d_writev
18253eval $inlibc
18254
b4eb6b3d
JH
18255: preserve RCS keywords in files with variable substitution, grrr
18256Date='$Date'
18257Id='$Id'
18258Log='$Log'
18259RCSfile='$RCSfile'
18260Revision='$Revision'
18261
b4eb6b3d
JH
18262: check for alignment requirements
18263echo " "
5440bc8e 18264case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
18265*$define*)
18266 $cat <<EOM
18267You seem to be either cross-compiling or doing a multiarchitecture build,
18268skipping the memory alignment check.
18269
18270EOM
18271 case "$alignbytes" in
18272 '') alignbytes=8 ;;
18273 esac
18274 ;;
18275*)
18276 case "$alignbytes" in
18277 '') echo "Checking alignment constraints..." >&4
18278 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18279 $cat >try.c <<'EOCP'
18280typedef long double NV;
18281EOCP
18282 else
18283 $cat >try.c <<'EOCP'
18284typedef double NV;
18285EOCP
18286 fi
18287 $cat >>try.c <<'EOCP'
18288#include <stdio.h>
18289struct foobar {
18290 char foo;
18291 NV bar;
18292} try_algn;
18293int main()
18294{
18295 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18296 return(0);
18297}
18298EOCP
18299 set try
18300 if eval $compile_ok; then
5440bc8e 18301 dflt=`$run ./try`
b4eb6b3d
JH
18302 else
18303 dflt='8'
18304 echo "(I can't seem to compile the test program...)"
18305 fi
18306 ;;
18307 *) dflt="$alignbytes"
18308 ;;
18309 esac
18310 rp="Doubles must be aligned on a how-many-byte boundary?"
18311 . ./myread
18312 alignbytes="$ans"
18313 $rm -f try.c try
18314 ;;
18315esac
18316
18317
18318: set the base revision
18319baserev=5.0
18320
3099fc99 18321: how do we concatenate cpp tokens here?
b4eb6b3d 18322echo " "
3099fc99 18323echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
18324$cat >cpp_stuff.c <<'EOCP'
18325#define RCAT(a,b)a/**/b
18326#define ACAT(a,b)a ## b
18327RCAT(Rei,ser)
18328ACAT(Cir,cus)
18329EOCP
18330$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18331if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18332 echo "Oh! Smells like ANSI's been here." >&4
18333 echo "We can catify or stringify, separately or together!"
18334 cpp_stuff=42
18335elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18336 echo "Ah, yes! The good old days!" >&4
18337 echo "However, in the good old days we don't know how to stringify and"
18338 echo "catify at the same time."
18339 cpp_stuff=1
18340else
18341 $cat >&4 <<EOM
3099fc99
CW
18342Hmm, I don't seem to be able to concatenate tokens with your cpp.
18343You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
18344EOM
18345 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18346fi
18347$rm -f cpp_stuff.*
18348
18349: see if this is a db.h system
18350set db.h i_db
18351eval $inhdr
18352
18353case "$i_db" in
18354$define)
18355 : Check db version.
18356 echo " "
18357 echo "Checking Berkeley DB version ..." >&4
18358 $cat >try.c <<EOCP
18359#$d_const HASCONST
18360#ifndef HASCONST
18361#define const
18362#endif
18363#include <sys/types.h>
18364#include <stdio.h>
55954f19
JH
18365#$i_stdlib I_STDLIB
18366#ifdef I_STDLIB
18367#include <stdlib.h>
18368#endif
b4eb6b3d 18369#include <db.h>
640374d0 18370int main(int argc, char *argv[])
b4eb6b3d
JH
18371{
18372#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18373 int Major, Minor, Patch ;
18374 unsigned long Version ;
18375 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
18376 if (argc == 2) {
18377 printf("%d %d %d %d %d %d\n",
18378 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18379 Major, Minor, Patch);
18380 exit(0);
18381 }
18382 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
18383
18384 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18385 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18386 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18387 Major, Minor, Patch) ;
18388
18389 /* check that db.h & libdb are compatible */
18390 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 18391 printf("db.h and libdb are incompatible.\n") ;
b4eb6b3d
JH
18392 exit(3);
18393 }
18394
640374d0 18395 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
18396
18397 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18398 + DB_VERSION_PATCH ;
18399
18400 /* needs to be >= 2.3.4 */
18401 if (Version < 2003004) {
18402 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 18403 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
b4eb6b3d
JH
18404 exit(2);
18405 }
18406
18407 exit(0);
18408#else
18409#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
18410 if (argc == 2) {
18411 printf("1 0 0\n");
18412 exit(0);
18413 }
18414 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
18415 exit(0); /* DB version < 2: the coast is clear. */
18416#else
18417 exit(1); /* <db.h> not Berkeley DB? */
18418#endif
18419#endif
18420}
18421EOCP
18422 set try
5440bc8e 18423 if eval $compile_ok && $run ./try; then
b4eb6b3d 18424 echo 'Looks OK.' >&4
5440bc8e 18425 set `$run ./try 1`
640374d0
JH
18426 db_version_major=$1
18427 db_version_minor=$2
18428 db_version_patch=$3
b4eb6b3d
JH
18429 else
18430 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
18431 i_db=$undef
18432 case " $libs " in
18433 *"-ldb "*)
18434 : Remove db from list of libraries to use
18435 echo "Removing unusable -ldb from library list" >&4
18436 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18437 shift
18438 libs="$*"
18439 echo "libs = $libs" >&4
18440 ;;
18441 esac
18442 fi
18443 $rm -f try.*
18444 ;;
18445esac
18446
18447case "$i_db" in
18448define)
18449 : Check the return type needed for hash
18450 echo " "
18451 echo "Checking return type needed for hash for Berkeley DB ..." >&4
18452 $cat >try.c <<EOCP
18453#$d_const HASCONST
18454#ifndef HASCONST
18455#define const
18456#endif
18457#include <sys/types.h>
18458#include <db.h>
18459
18460#ifndef DB_VERSION_MAJOR
18461u_int32_t hash_cb (ptr, size)
18462const void *ptr;
18463size_t size;
18464{
18465}
18466HASHINFO info;
18467int main()
18468{
18469 info.hash = hash_cb;
18470}
18471#endif
18472EOCP
18473 if $cc $ccflags -c try.c >try.out 2>&1 ; then
18474 if $contains warning try.out >>/dev/null 2>&1 ; then
18475 db_hashtype='int'
18476 else
18477 db_hashtype='u_int32_t'
18478 fi
18479 else
18480 : XXX Maybe we should just give up here.
18481 db_hashtype=u_int32_t
18482 $cat try.out >&4
18483 echo "Help: I can't seem to compile the db test program." >&4
18484 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18485 fi
18486 $rm -f try.*
18487 echo "Your version of Berkeley DB uses $db_hashtype for hash."
18488 ;;
18489*) db_hashtype=u_int32_t
18490 ;;
18491esac
18492case "$i_db" in
18493define)
18494 : Check the return type needed for prefix
18495 echo " "
18496 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18497 cat >try.c <<EOCP
18498#$d_const HASCONST
18499#ifndef HASCONST
18500#define const
18501#endif
18502#include <sys/types.h>
18503#include <db.h>
18504
18505#ifndef DB_VERSION_MAJOR
18506size_t prefix_cb (key1, key2)
18507const DBT *key1;
18508const DBT *key2;
18509{
18510}
18511BTREEINFO info;
18512int main()
18513{
18514 info.prefix = prefix_cb;
18515}
18516#endif
18517EOCP
18518 if $cc $ccflags -c try.c >try.out 2>&1 ; then
18519 if $contains warning try.out >>/dev/null 2>&1 ; then
18520 db_prefixtype='int'
18521 else
18522 db_prefixtype='size_t'
18523 fi
18524 else
18525 db_prefixtype='size_t'
18526 : XXX Maybe we should just give up here.
18527 $cat try.out >&4
18528 echo "Help: I can't seem to compile the db test program." >&4
18529 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18530 fi
18531 $rm -f try.*
18532 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18533 ;;
18534*) db_prefixtype='size_t'
18535 ;;
18536esac
18537
b4eb6b3d
JH
18538
18539: How can we generate normalized random numbers ?
18540echo " "
18541echo "Looking for a random number function..." >&4
18542case "$randfunc" in
18543'')
18544 if set drand48 val -f; eval $csym; $val; then
18545 dflt="drand48"
18546 echo "Good, found drand48()." >&4
18547 elif set random val -f; eval $csym; $val; then
18548 dflt="random"
18549 echo "OK, found random()." >&4
18550 else
18551 dflt="rand"
18552 echo "Yick, looks like I have to use rand()." >&4
18553 fi
18554 echo " "
18555 ;;
18556*)
18557 dflt="$randfunc"
18558 ;;
18559esac
18560cont=true
18561
18562case "$ccflags" in
18563*-Dmy_rand=*|*-Dmy_srand=*)
18564 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18565 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18566 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18567 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18568 ;;
18569esac
18570
18571while $test "$cont"; do
18572 rp="Use which function to generate random numbers?"
18573 . ./myread
18574 if $test "$ans" = "$dflt"; then
18575 : null
18576 else
18577 randbits=''
18578 fi
18579 randfunc="$ans"
18580 if set $ans val -f; eval $csym; $val; then
18581 cont=''
18582 else
18583 dflt=y
18584 rp="I cannot find function $ans. Use that name anyway?"
18585 . ./myread
18586 dflt=rand
18587 case "$ans" in
18588 [yY]*) cont='';;
18589 esac
18590 fi
18591 case "$cont" in
18592 '')
18593 case "$randfunc" in
18594 drand48)
18595 drand01="drand48()"
18596 seedfunc="srand48"
18597 randbits=48
18598 randseedtype=long
18599 ;;
18600 rand|random)
18601 case "$randbits" in
18602 '')
18603echo "Checking to see how many bits your $randfunc() function produces..." >&4
18604 $cat >try.c <<EOCP
18605#$i_unistd I_UNISTD
18606#$i_stdlib I_STDLIB
18607#include <stdio.h>
18608#ifdef I_UNISTD
18609# include <unistd.h>
18610#endif
18611#ifdef I_STDLIB
18612# include <stdlib.h>
18613#endif
18614int main()
18615{
18616 register int i;
18617 register unsigned long tmp;
18618 register unsigned long max = 0L;
18619
18620 for (i = 1000; i; i--) {
18621 tmp = (unsigned long) $randfunc();
18622 if (tmp > max) max = tmp;
18623 }
18624 for (i = 0; max; i++)
18625 max /= 2;
18626 printf("%d\n",i);
18627}
18628EOCP
18629 set try
18630 if eval $compile_ok; then
18631 dflt=`try`
18632 else
18633 dflt='?'
18634 echo "(I can't seem to compile the test program...)"
18635 fi
18636 ;;
18637 *)
18638 dflt="$randbits"
18639 ;;
18640 esac
18641 rp="How many bits does your $randfunc() function produce?"
18642 . ./myread
18643 randbits="$ans"
18644 $rm -f try.c try
18645 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18646 seedfunc="s$randfunc"
18647 randseedtype=unsigned
18648 ;;
18649 *)
18650 dflt="31"
18651 rp="How many bits does your $randfunc() function produce?"
18652 . ./myread
18653 randbits="$ans"
18654 seedfunc="s$randfunc"
18655 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18656 if set $seedfunc val -f; eval $csym; $val; then
18657 echo "(Using $seedfunc() to seed random generator)"
18658 else
18659 echo "(Warning: no $seedfunc() to seed random generator)"
18660 seedfunc=rand
18661 fi
18662 randseedtype=unsigned
18663 ;;
18664 esac
18665 ;;
18666 esac
18667done
18668
18669echo " "
18670echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 18671$cat >try.c <<'EOM'
b4eb6b3d
JH
18672int main()
18673{
18674 if ('M'==0xd4) return 0;
18675 return 1;
18676}
18677EOM
18678
18679val=$undef
5440bc8e 18680set try
b4eb6b3d 18681if eval $compile_ok; then
5440bc8e 18682 if $run ./try; then
b4eb6b3d
JH
18683 echo "You seem to speak EBCDIC." >&4
18684 val="$define"
18685 else
5440bc8e 18686 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
18687 fi
18688else
18689 echo "I'm unable to compile the test program." >&4
18690 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18691fi
5440bc8e 18692$rm -f try try.*
b4eb6b3d
JH
18693set ebcdic
18694eval $setvar
18695
18696echo " "
18697$cat >&4 <<EOM
18698Checking how to flush all pending stdio output...
18699EOM
18700# I only know how to find the first 32 possibly open files on SunOS.
18701# See also hints/sunos_4_1.sh and util.c --AD
18702case "$osname" in
18703sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18704esac
18705$cat >>try.c <<EOCP
18706#include <stdio.h>
55954f19
JH
18707#$i_stdlib I_STDLIB
18708#ifdef I_STDLIB
18709#include <stdlib.h>
18710#endif
b4eb6b3d
JH
18711#$i_unistd I_UNISTD
18712#ifdef I_UNISTD
18713# include <unistd.h>
18714#endif
18715#$d_sysconf HAS_SYSCONF
18716#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18717#ifdef HAS_STDIO_STREAM_ARRAY
18718# define STDIO_STREAM_ARRAY $stdio_stream_array
18719#endif
18720int main() {
5440bc8e
JH
18721 FILE* p;
18722 unlink("try.out");
18723 p = fopen("try.out", "w");
b4eb6b3d
JH
18724#ifdef TRY_FPUTC
18725 fputc('x', p);
18726#else
18727# ifdef TRY_FPRINTF
18728 fprintf(p, "x");
18729# endif
18730#endif
18731#ifdef TRY_FFLUSH_NULL
18732 fflush(NULL);
18733#endif
18734#ifdef TRY_FFLUSH_ALL
18735 {
18736 long open_max = -1;
18737# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18738 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18739# else
18740# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18741 open_max = sysconf(_SC_OPEN_MAX);
18742# else
18743# ifdef FOPEN_MAX
18744 open_max = FOPEN_MAX;
18745# else
18746# ifdef OPEN_MAX
18747 open_max = OPEN_MAX;
18748# else
18749# ifdef _NFILE
18750 open_max = _NFILE;
18751# endif
18752# endif
18753# endif
18754# endif
18755# endif
18756# ifdef HAS_STDIO_STREAM_ARRAY
18757 if (open_max > 0) {
18758 long i;
18759 for (i = 0; i < open_max; i++)
18760 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18761 STDIO_STREAM_ARRAY[i]._file < open_max &&
18762 STDIO_STREAM_ARRAY[i]._flag)
18763 fflush(&STDIO_STREAM_ARRAY[i]);
18764 }
18765 }
18766# endif
18767#endif
18768 _exit(42);
18769}
18770EOCP
18771: first we have to find out how _not_ to flush
5440bc8e 18772$to try.c
b4eb6b3d
JH
18773if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18774 output=''
18775 set try -DTRY_FPUTC
18776 if eval $compile; then
fbe73d74 18777 $run ./try 2>/dev/null
28f5ac64 18778 code="$?"
5440bc8e 18779 $from try.out
28f5ac64 18780 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18781 output=-DTRY_FPUTC
18782 fi
18783 fi
18784 case "$output" in
18785 '')
18786 set try -DTRY_FPRINTF
b4eb6b3d 18787 if eval $compile; then
fbe73d74 18788 $run ./try 2>/dev/null
28f5ac64 18789 code="$?"
5440bc8e 18790 $from try.out
28f5ac64 18791 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18792 output=-DTRY_FPRINTF
18793 fi
18794 fi
18795 ;;
18796 esac
18797fi
18798: check for fflush NULL behaviour
18799case "$fflushNULL" in
18800'') set try -DTRY_FFLUSH_NULL $output
18801 if eval $compile; then
5440bc8e 18802 $run ./try 2>/dev/null
b4eb6b3d 18803 code="$?"
5440bc8e 18804 $from try.out
b4eb6b3d
JH
18805 if $test -s try.out -a "X$code" = X42; then
18806 fflushNULL="`$cat try.out`"
18807 else
18808 if $test "X$code" != X42; then
18809 $cat >&4 <<EOM
18810(If this test failed, don't worry, we'll try another method shortly.)
18811EOM
18812 fi
18813 fi
18814 fi
18815 $rm -f core try.core core.try.*
18816 case "$fflushNULL" in
18817 x) $cat >&4 <<EOM
18818Your fflush(NULL) works okay for output streams.
18819Let's see if it clobbers input pipes...
18820EOM
18821# As of mid-March 2000 all versions of Solaris appear to have a stdio
18822# bug that improperly flushes the input end of pipes. So we avoid the
18823# autoflush on fork/system/exec support for now. :-(
18824$cat >tryp.c <<EOCP
18825#include <stdio.h>
18826int
18827main(int argc, char **argv)
18828{
18829 char buf[1024];
18830 int i;
18831 char *bp = buf;
18832 while (1) {
18833 while ((i = getc(stdin)) != -1
18834 && (*bp++ = i) != '\n'
18835 && bp < &buf[1024])
18836 /* DO NOTHING */ ;
18837 *bp = '\0';
18838 fprintf(stdout, "%s", buf);
18839 fflush(NULL);
18840 if (i == -1)
18841 return 0;
18842 bp = buf;
18843 }
18844}
18845EOCP
18846 fflushNULL="$define"
18847 set tryp
18848 if eval $compile; then
18849 $rm -f tryp.out
5440bc8e 18850 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18851 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18852 $cat >&4 <<EOM
18853fflush(NULL) seems to behave okay with input streams.
18854EOM
18855 fflushNULL="$define"
18856 else
18857 $cat >&4 <<EOM
18858Ouch, fflush(NULL) clobbers input pipes! We will not use it.
18859EOM
18860 fflushNULL="$undef"
18861 fi
18862 fi
18863 $rm -f core tryp.c tryp.core core.tryp.*
18864 ;;
18865 '') $cat >&4 <<EOM
18866Your fflush(NULL) isn't working (contrary to ANSI C).
18867EOM
18868 fflushNULL="$undef"
18869 ;;
18870 *) $cat >&4 <<EOM
18871Cannot figure out whether your fflush(NULL) works or not.
18872I'm assuming it doesn't (contrary to ANSI C).
18873EOM
18874 fflushNULL="$undef"
18875 ;;
18876 esac
18877 ;;
18878$define|true|[yY]*)
18879 fflushNULL="$define"
18880 ;;
18881*)
18882 fflushNULL="$undef"
18883 ;;
18884esac
18885: check explicit looping only if NULL did not work, and if the pipe
18886: bug does not show up on an explicit flush too
18887case "$fflushNULL" in
18888"$undef")
18889 $cat >tryp.c <<EOCP
18890#include <stdio.h>
18891int
18892main(int argc, char **argv)
18893{
18894 char buf[1024];
18895 int i;
18896 char *bp = buf;
18897 while (1) {
18898 while ((i = getc(stdin)) != -1
18899 && (*bp++ = i) != '\n'
18900 && bp < &buf[1024])
18901 /* DO NOTHING */ ;
18902 *bp = '\0';
18903 fprintf(stdout, "%s", buf);
18904 fflush(stdin);
18905 if (i == -1)
18906 return 0;
18907 bp = buf;
18908 }
18909}
18910EOCP
18911 set tryp
18912 if eval $compile; then
18913 $rm -f tryp.out
5440bc8e 18914 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18915 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18916 $cat >&4 <<EOM
18917Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18918EOM
18919 : now check for fflushall behaviour
18920 case "$fflushall" in
18921 '') set try -DTRY_FFLUSH_ALL $output
18922 if eval $compile; then
18923 $cat >&4 <<EOM
18924(Now testing the other method--but note that this also may fail.)
18925EOM
5440bc8e 18926 $run ./try 2>/dev/null
28f5ac64 18927 code=$?
fbe73d74 18928 $from try.out
28f5ac64 18929 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18930 fflushall="`$cat try.out`"
18931 fi
18932 fi
18933 $rm -f core try.core core.try.*
18934 case "$fflushall" in
18935 x) $cat >&4 <<EOM
18936Whew. Flushing explicitly all the stdio streams works.
18937EOM
18938 fflushall="$define"
18939 ;;
18940 '') $cat >&4 <<EOM
18941Sigh. Flushing explicitly all the stdio streams doesn't work.
18942EOM
18943 fflushall="$undef"
18944 ;;
18945 *) $cat >&4 <<EOM
18946Cannot figure out whether flushing stdio streams explicitly works or not.
18947I'm assuming it doesn't.
18948EOM
18949 fflushall="$undef"
18950 ;;
18951 esac
18952 ;;
18953 "$define"|true|[yY]*)
18954 fflushall="$define"
18955 ;;
18956 *)
18957 fflushall="$undef"
18958 ;;
18959 esac
18960 else
18961 $cat >&4 <<EOM
18962All is futile. Even fflush(stdin) clobbers input pipes!
18963EOM
18964 fflushall="$undef"
18965 fi
18966 else
18967 fflushall="$undef"
18968 fi
18969 $rm -f core tryp.c tryp.core core.tryp.*
18970 ;;
18971*) fflushall="$undef"
18972 ;;
18973esac
18974
18975case "$fflushNULL$fflushall" in
18976undefundef)
18977 $cat <<EOM
18978OK, I give up. I cannot figure out how to flush pending stdio output.
18979We won't be flushing handles at all before fork/exec/popen.
18980EOM
18981 ;;
18982esac
18983$rm -f try.* try$exe_ext
18984
18985: Store the full pathname to the ar program for use in the C program
18986: Respect a hint or command line value for full_ar.
18987case "$full_ar" in
18988'') full_ar=$ar ;;
18989esac
18990
18991: Store the full pathname to the sed program for use in the C program
18992full_sed=$sed
18993
18994: see what type gids are declared as in the kernel
18995echo " "
18996echo "Looking for the type for group ids returned by getgid()."
18997set gid_t gidtype xxx stdio.h sys/types.h
18998eval $typedef
18999case "$gidtype" in
19000xxx)
19001 xxx=`./findhdr sys/user.h`
19002 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19003 case $1 in
19004 unsigned) dflt="$1 $2" ;;
19005 *) dflt="$1" ;;
19006 esac
19007 ;;
19008*) dflt="$gidtype";;
19009esac
19010case "$gidtype" in
19011gid_t) echo "gid_t found." ;;
19012*) rp="What is the type for group ids returned by getgid()?"
19013 . ./myread
19014 gidtype="$ans"
19015 ;;
19016esac
19017
19018echo " "
19019case "$gidtype" in
19020*_t) zzz="$gidtype" ;;
19021*) zzz="gid" ;;
19022esac
19023echo "Checking the size of $zzz..." >&4
19024cat > try.c <<EOCP
19025#include <sys/types.h>
19026#include <stdio.h>
d1daaddf
JH
19027#$i_stdlib I_STDLIB
19028#ifdef I_STDLIB
19029#include <stdlib.h>
19030#endif
b4eb6b3d
JH
19031int main() {
19032 printf("%d\n", (int)sizeof($gidtype));
19033 exit(0);
19034}
19035EOCP
19036set try
19037if eval $compile_ok; then
5440bc8e 19038 yyy=`$run ./try`
b4eb6b3d
JH
19039 case "$yyy" in
19040 '') gidsize=4
19041 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19042 ;;
19043 *) gidsize=$yyy
19044 echo "Your $zzz is $gidsize bytes long."
19045 ;;
19046 esac
19047else
19048 gidsize=4
19049 echo "(I can't compile the test program--guessing $gidsize.)" >&4
19050fi
19051
19052
19053echo " "
19054case "$gidtype" in
19055*_t) zzz="$gidtype" ;;
19056*) zzz="gid" ;;
19057esac
19058echo "Checking the sign of $zzz..." >&4
19059cat > try.c <<EOCP
19060#include <sys/types.h>
19061#include <stdio.h>
19062int main() {
19063 $gidtype foo = -1;
19064 if (foo < 0)
19065 printf("-1\n");
19066 else
19067 printf("1\n");
19068}
19069EOCP
19070set try
19071if eval $compile; then
5440bc8e 19072 yyy=`$run ./try`
b4eb6b3d
JH
19073 case "$yyy" in
19074 '') gidsign=1
19075 echo "(I can't execute the test program--guessing unsigned.)" >&4
19076 ;;
19077 *) gidsign=$yyy
19078 case "$gidsign" in
19079 1) echo "Your $zzz is unsigned." ;;
19080 -1) echo "Your $zzz is signed." ;;
19081 esac
19082 ;;
19083 esac
19084else
19085 gidsign=1
19086 echo "(I can't compile the test program--guessing unsigned.)" >&4
19087fi
19088
19089
19090echo " "
19091
19092if $test X"$quadtype" != X; then
19093
19094echo "Checking how to print 64-bit integers..." >&4
19095
19096if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19097 $cat >try.c <<'EOCP'
19098#include <sys/types.h>
19099#include <stdio.h>
19100int main() {
19101 int q = 12345678901;
19102 printf("%ld\n", q);
19103}
19104EOCP
19105 set try
19106 if eval $compile; then
5440bc8e 19107 yyy=`$run ./try`
b4eb6b3d
JH
19108 case "$yyy" in
19109 12345678901)
19110 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19111 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19112 echo "We will use %d."
19113 ;;
19114 esac
19115 fi
19116fi
19117
19118if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19119 $cat >try.c <<'EOCP'
19120#include <sys/types.h>
19121#include <stdio.h>
19122int main() {
19123 long q = 12345678901;
19124 printf("%ld\n", q);
19125}
19126EOCP
19127 set try
19128 if eval $compile; then
5440bc8e 19129 yyy=`$run ./try`
b4eb6b3d
JH
19130 case "$yyy" in
19131 12345678901)
19132 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19133 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19134 echo "We will use %ld."
19135 ;;
19136 esac
19137 fi
19138fi
19139
19140if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19141 $cat >try.c <<'EOCP'
19142#include <sys/types.h>
19143#include <inttypes.h>
19144#include <stdio.h>
19145int main() {
19146 int64_t q = 12345678901;
19147 printf("%" PRId64 "\n", q);
19148}
19149EOCP
19150 set try
19151 if eval $compile; then
5440bc8e 19152 yyy=`$run ./try`
b4eb6b3d
JH
19153 case "$yyy" in
19154 12345678901)
19155 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19156 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19157 echo "We will use the C9X style."
19158 ;;
19159 esac
19160 fi
19161fi
19162
2ef53570
JH
19163if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19164 $cat >try.c <<EOCP
b4eb6b3d
JH
19165#include <sys/types.h>
19166#include <stdio.h>
19167int main() {
2ef53570
JH
19168 $quadtype q = 12345678901;
19169 printf("%Ld\n", q);
b4eb6b3d
JH
19170}
19171EOCP
19172 set try
19173 if eval $compile; then
5440bc8e 19174 yyy=`$run ./try`
b4eb6b3d
JH
19175 case "$yyy" in
19176 12345678901)
2ef53570
JH
19177 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19178 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19179 echo "We will use %Ld."
b4eb6b3d
JH
19180 ;;
19181 esac
19182 fi
19183fi
19184
2ef53570
JH
19185if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19186 $cat >try.c <<'EOCP'
b4eb6b3d
JH
19187#include <sys/types.h>
19188#include <stdio.h>
19189int main() {
2ef53570
JH
19190 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19191 printf("%lld\n", q);
b4eb6b3d
JH
19192}
19193EOCP
19194 set try
19195 if eval $compile; then
5440bc8e 19196 yyy=`$run ./try`
b4eb6b3d
JH
19197 case "$yyy" in
19198 12345678901)
2ef53570
JH
19199 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19200 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19201 echo "We will use the %lld style."
b4eb6b3d
JH
19202 ;;
19203 esac
19204 fi
19205fi
19206
19207if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19208 $cat >try.c <<EOCP
19209#include <sys/types.h>
19210#include <stdio.h>
19211int main() {
19212 $quadtype q = 12345678901;
19213 printf("%qd\n", q);
19214}
19215EOCP
19216 set try
19217 if eval $compile; then
5440bc8e 19218 yyy=`$run ./try`
b4eb6b3d
JH
19219 case "$yyy" in
19220 12345678901)
19221 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19222 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19223 echo "We will use %qd."
19224 ;;
19225 esac
19226 fi
19227fi
19228
19229if $test X"$sPRId64" = X; then
19230 echo "Cannot figure out how to print 64-bit integers." >&4
19231fi
19232
19233$rm -f try try.*
19234
19235fi
19236
19237case "$sPRId64" in
19238'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19239 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19240 ;;
19241*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19242 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19243 ;;
19244esac
19245
19246
19247echo " "
19248$echo "Checking the format strings to be used for Perl's internal types..." >&4
19249
19250if $test X"$ivsize" = X8; then
19251 ivdformat="$sPRId64"
19252 uvuformat="$sPRIu64"
19253 uvoformat="$sPRIo64"
19254 uvxformat="$sPRIx64"
19255 uvXUformat="$sPRIXU64"
19256else
19257 if $test X"$ivsize" = X"$longsize"; then
19258 ivdformat='"ld"'
19259 uvuformat='"lu"'
19260 uvoformat='"lo"'
19261 uvxformat='"lx"'
19262 uvXUformat='"lX"'
19263 else
19264 if $test X"$ivsize" = X"$intsize"; then
19265 ivdformat='"d"'
19266 uvuformat='"u"'
19267 uvoformat='"o"'
19268 uvxformat='"x"'
19269 uvXUformat='"X"'
19270 else
19271 : far out
19272 if $test X"$ivsize" = X"$shortsize"; then
19273 ivdformat='"hd"'
19274 uvuformat='"hu"'
19275 uvoformat='"ho"'
19276 uvxformat='"hx"'
19277 uvXUformat='"hX"'
19278 fi
19279 fi
19280 fi
19281fi
19282
19283if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19284 nveformat="$sPRIeldbl"
19285 nvfformat="$sPRIfldbl"
19286 nvgformat="$sPRIgldbl"
19287 nvEUformat="$sPRIEUldbl"
19288 nvFUformat="$sPRIFUldbl"
19289 nvGUformat="$sPRIGUldbl"
19290else
19291 nveformat='"e"'
19292 nvfformat='"f"'
19293 nvgformat='"g"'
19294 nvEUformat='"E"'
19295 nvFUformat='"F"'
19296 nvGUformat='"G"'
19297fi
19298
19299case "$ivdformat" in
3c728e00 19300'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
19301 exit 1
19302 ;;
19303esac
19304
19305
19306echo " "
19307$echo "Checking the format string to be used for gids..." >&4
19308
19309case "$gidsign" in
19310-1) if $test X"$gidsize" = X"$ivsize"; then
19311 gidformat="$ivdformat"
19312 else
19313 if $test X"$gidsize" = X"$longsize"; then
19314 gidformat='"ld"'
19315 else
19316 if $test X"$gidsize" = X"$intsize"; then
19317 gidformat='"d"'
19318 else
19319 if $test X"$gidsize" = X"$shortsize"; then
19320 gidformat='"hd"'
19321 fi
19322 fi
19323 fi
19324 fi
19325 ;;
19326*) if $test X"$gidsize" = X"$uvsize"; then
19327 gidformat="$uvuformat"
19328 else
19329 if $test X"$gidsize" = X"$longsize"; then
19330 gidformat='"lu"'
19331 else
19332 if $test X"$gidsize" = X"$intsize"; then
19333 gidformat='"u"'
19334 else
19335 if $test X"$gidsize" = X"$shortsize"; then
19336 gidformat='"hu"'
19337 fi
19338 fi
19339 fi
19340 fi
19341 ;;
19342esac
19343
19344: see if getgroups exists
19345set getgroups d_getgrps
19346eval $inlibc
19347
19348: see if setgroups exists
19349set setgroups d_setgrps
19350eval $inlibc
19351
19352
19353: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19354echo " "
19355case "$d_getgrps$d_setgrps" in
19356*define*)
19357 case "$groupstype" in
19358 '') dflt="$gidtype" ;;
19359 *) dflt="$groupstype" ;;
19360 esac
19361 $cat <<EOM
19362What type of pointer is the second argument to getgroups() and setgroups()?
19363Usually this is the same as group ids, $gidtype, but not always.
19364
19365EOM
19366 rp='What type pointer is the second argument to getgroups() and setgroups()?'
19367 . ./myread
19368 groupstype="$ans"
19369 ;;
19370*) groupstype="$gidtype";;
19371esac
19372
d620c7b3 19373
fd655d33
NC
19374if $test $patchlevel -lt 9; then
19375: MAD is not available in 5.8.x or earlier.
19376 ans=n;
19377else
19378 case "$mad" in
19379 $define|true|[yY]*) dflt='y' ;;
19380 *) dflt='n' ;;
19381 esac
19382 cat <<EOM
d620c7b3
MB
19383
19384Would you like to build with Misc Attribute Decoration? This is development
19385work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19386overhead on the interpreter.
19387
19388If this doesn't make any sense to you, just accept the default '$dflt'.
19389EOM
fd655d33
NC
19390 rp='Build Perl with MAD?'
19391 . ./myread
19392fi
d620c7b3 19393case "$ans" in
00e74f14
NC
19394y|Y) val="$define"
19395 madlyh='madly.h madly.act madly.tab'
19396 madlysrc='madly.c'
19397 madlyobj="madly$_o" ;;
19398*) val="$undef"
19399 madlyh=''
19400 madlysrc=''
19401 madlyobj='' ;;
d620c7b3
MB
19402esac
19403set mad
19404eval $setvar
19405
b4eb6b3d
JH
19406echo " "
19407echo "Checking if your $make program sets \$(MAKE)..." >&4
19408case "$make_set_make" in
19409'')
19410 $sed 's/^X //' > testmake.mak << 'EOF'
19411Xall:
19412X @echo 'maketemp="$(MAKE)"'
19413EOF
19414 case "`$make -f testmake.mak 2>/dev/null`" in
19415 *maketemp=*) make_set_make='#' ;;
19416 *) make_set_make="MAKE=$make" ;;
19417 esac
19418 $rm -f testmake.mak
19419 ;;
19420esac
19421case "$make_set_make" in
19422'#') echo "Yup, it does.";;
19423*) echo "Nope, it doesn't.";;
19424esac
19425
19426: see what type is used for mode_t
19427rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19428set mode_t modetype int stdio.h sys/types.h
19429eval $typedef_ask
19430
2cc61e15
DD
19431: see if we need va_copy
19432echo " "
19433case "$i_stdarg" in
19434"$define")
19435 $cat >try.c <<EOCP
19436#include <stdarg.h>
19437#include <stdio.h>
85c8a686
DD
19438#$i_stdlib I_STDLIB
19439#ifdef I_STDLIB
19440#include <stdlib.h>
19441#endif
19442#include <signal.h>
2cc61e15
DD
19443
19444int
19445ivfprintf(FILE *f, const char *fmt, va_list *valp)
19446{
19447 return vfprintf(f, fmt, *valp);
19448}
19449
19450int
19451myvfprintf(FILE *f, const char *fmt, va_list val)
19452{
19453 return ivfprintf(f, fmt, &val);
19454}
19455
19456int
19457myprintf(char *fmt, ...)
19458{
19459 va_list val;
19460 va_start(val, fmt);
19461 return myvfprintf(stdout, fmt, val);
19462}
19463
19464int
19465main(int ac, char **av)
19466{
85c8a686
DD
19467 signal(SIGSEGV, exit);
19468
2cc61e15
DD
19469 myprintf("%s%cs all right, then\n", "that", '\'');
19470 exit(0);
19471}
19472EOCP
19473 set try
5440bc8e
JH
19474 if eval $compile && $run ./try 2>&1 >/dev/null; then
19475 case "`$run ./try`" in
2cc61e15
DD
19476 "that's all right, then")
19477 okay=yes
19478 ;;
19479 esac
19480 fi
19481 case "$okay" in
19482 yes) echo "It seems that you don't need va_copy()." >&4
19483 need_va_copy="$undef"
19484 ;;
19485 *) echo "It seems that va_copy() or similar will be needed." >&4
19486 need_va_copy="$define"
19487 ;;
19488 esac
19489 $rm -f try.* core core.* *.core *.core.*
19490 ;;
19491*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19492 ;;
19493esac
19494
b4eb6b3d
JH
19495: see what type is used for size_t
19496rp="What is the type used for the length parameter for string functions?"
19497set size_t sizetype 'unsigned int' stdio.h sys/types.h
19498eval $typedef_ask
19499
19500: check for type of arguments to gethostbyaddr.
19501if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19502 case "$d_gethbyaddr" in
19503 $define)
19504 $cat <<EOM
19505
19506Checking to see what type of arguments are accepted by gethostbyaddr().
19507EOM
19508 hdrs="$define sys/types.h
19509 $d_socket sys/socket.h
19510 $i_niin netinet/in.h
19511 $i_netdb netdb.h
19512 $i_unistd unistd.h"
19513 : The first arg can 'char *' or 'void *'
19514 : The second arg is some of integral type
19515 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19516 for yyy in size_t long int; do
19517 case "$netdb_host_type" in
19518 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19519 if ./protochk "$try" $hdrs; then
19520 echo "Your system accepts $xxx for the first arg."
19521 echo "...and $yyy for the second arg."
19522 netdb_host_type="$xxx"
19523 netdb_hlen_type="$yyy"
19524 fi
19525 ;;
19526 esac
19527 done
19528 done
19529 : In case none of those worked, prompt the user.
19530 case "$netdb_host_type" in
19531 '') rp='What is the type for the 1st argument to gethostbyaddr?'
19532 dflt='char *'
19533 . ./myread
19534 netdb_host_type=$ans
19535 rp='What is the type for the 2nd argument to gethostbyaddr?'
19536 dflt="$sizetype"
19537 . ./myread
19538 netdb_hlen_type=$ans
19539 ;;
19540 esac
19541 ;;
19542 *) : no gethostbyaddr, so pick harmless defaults
19543 netdb_host_type='char *'
19544 netdb_hlen_type="$sizetype"
19545 ;;
19546 esac
19547 # Remove the "const" if needed. -- but then we'll have a
19548 # prototype clash!
19549 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19550fi
19551
19552: check for type of argument to gethostbyname.
19553if test "X$netdb_name_type" = X ; then
19554 case "$d_gethbyname" in
19555 $define)
19556 $cat <<EOM
19557
19558Checking to see what type of argument is accepted by gethostbyname().
19559EOM
19560 hdrs="$define sys/types.h
19561 $d_socket sys/socket.h
19562 $i_niin netinet/in.h
19563 $i_netdb netdb.h
19564 $i_unistd unistd.h"
19565 for xxx in "const char *" "char *"; do
19566 case "$netdb_name_type" in
19567 '') try="extern struct hostent *gethostbyname($xxx);"
19568 if ./protochk "$try" $hdrs; then
19569 echo "Your system accepts $xxx."
19570 netdb_name_type="$xxx"
19571 fi
19572 ;;
19573 esac
19574 done
19575 : In case none of those worked, prompt the user.
19576 case "$netdb_name_type" in
19577 '') rp='What is the type for the 1st argument to gethostbyname?'
19578 dflt='char *'
19579 . ./myread
19580 netdb_name_type=$ans
19581 ;;
19582 esac
19583 ;;
19584 *) : no gethostbyname, so pick harmless default
19585 netdb_name_type='char *'
19586 ;;
19587 esac
19588fi
19589
19590: check for type of 1st argument to getnetbyaddr.
19591if test "X$netdb_net_type" = X ; then
19592 case "$d_getnbyaddr" in
19593 $define)
19594 $cat <<EOM
19595
19596Checking to see what type of 1st argument is accepted by getnetbyaddr().
19597EOM
19598 hdrs="$define sys/types.h
19599 $d_socket sys/socket.h
19600 $i_niin netinet/in.h
19601 $i_netdb netdb.h
19602 $i_unistd unistd.h"
19603 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19604 case "$netdb_net_type" in
19605 '') try="extern struct netent *getnetbyaddr($xxx, int);"
19606 if ./protochk "$try" $hdrs; then
19607 echo "Your system accepts $xxx."
19608 netdb_net_type="$xxx"
19609 fi
19610 ;;
19611 esac
19612 done
19613 : In case none of those worked, prompt the user.
19614 case "$netdb_net_type" in
19615 '') rp='What is the type for the 1st argument to getnetbyaddr?'
19616 dflt='long'
19617 . ./myread
19618 netdb_net_type=$ans
19619 ;;
19620 esac
19621 ;;
19622 *) : no getnetbyaddr, so pick harmless default
19623 netdb_net_type='long'
19624 ;;
19625 esac
19626fi
19627: locate the preferred pager for this system
d604bb53 19628fn=f/
b4eb6b3d
JH
19629case "$pager" in
19630'')
19631 dflt=''
19632 case "$pg" in
19633 /*) dflt=$pg;;
19634 [a-zA-Z]:/*) dflt=$pg;;
19635 esac
19636 case "$more" in
19637 /*) dflt=$more;;
19638 [a-zA-Z]:/*) dflt=$more;;
19639 esac
19640 case "$less" in
19641 /*) dflt=$less;;
19642 [a-zA-Z]:/*) dflt=$less;;
19643 esac
19644 case "$dflt" in
19645 '') dflt=/usr/ucb/more;;
19646 esac
19647 ;;
d604bb53
JH
19648*) dflt="$pager"
19649 : Instruct ./getfile to trust the hinted or previous pager value,
19650 : even if it does not begin with a slash. For example, on os2,
19651 : pager might be cmd /c more. See comments in UU/getfile.
19652 fn="f/($pager)"
19653 ;;
b4eb6b3d
JH
19654esac
19655echo " "
b4eb6b3d
JH
19656rp='What pager is used on your system?'
19657. ./getfile
19658pager="$ans"
19659
19660: see what type pids are declared as in the kernel
19661rp="What is the type of process ids on this system?"
19662set pid_t pidtype int stdio.h sys/types.h
19663eval $typedef_ask
19664
b4eb6b3d
JH
19665: see if ar generates random libraries by itself
19666echo " "
19667echo "Checking how to generate random libraries on your machine..." >&4
19668echo 'int bar1() { return bar2(); }' > bar1.c
19669echo 'int bar2() { return 2; }' > bar2.c
55954f19
JH
19670$cat > foo.c <<EOP
19671#$i_stdlib I_STDLIB
19672#ifdef I_STDLIB
19673#include <stdlib.h>
19674#endif
b4eb6b3d
JH
19675int main() { printf("%d\n", bar1()); exit(0); }
19676EOP
19677$cc $ccflags -c bar1.c >/dev/null 2>&1
19678$cc $ccflags -c bar2.c >/dev/null 2>&1
19679$cc $ccflags -c foo.c >/dev/null 2>&1
19680$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 19681if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19682 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19683 echo "$ar appears to generate random libraries itself."
19684 orderlib=false
e39a9d84
LC
19685 if [ "X$ranlib" = "X" ]; then
19686 ranlib=":"
19687 fi
88d4d47b
PC
19688elif $ar s bar$_a >/dev/null 2>&1 &&
19689 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19690 $run ./foobar >/dev/null 2>&1; then
19691 echo "a table of contents needs to be added with '$ar s'."
19692 orderlib=false
19693 ranlib="$ar s"
b4eb6b3d 19694elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 19695 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19696 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19697 echo "a table of contents needs to be added with '$ar ts'."
19698 orderlib=false
19699 ranlib="$ar ts"
19700else
19701 case "$ranlib" in
19702 :) ranlib='';;
19703 '')
19704 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19705 $test -f $ranlib || ranlib=''
19706 ;;
19707 esac
19708 if $test -n "$ranlib"; then
19709 echo "your system has '$ranlib'; we'll use that."
19710 orderlib=false
19711 else
19712 echo "your system doesn't seem to support random libraries"
19713 echo "so we'll use lorder and tsort to order the libraries."
19714 orderlib=true
19715 ranlib=":"
19716 fi
19717fi
88d4d47b 19718$rm -f foo* bar*
b4eb6b3d
JH
19719
19720: check for type of arguments to select.
19721case "$selecttype" in
19722'') case "$d_select" in
19723 $define)
19724 echo " "
19725 $cat <<EOM
19726Checking to see what type of arguments are accepted by select().
19727EOM
19728 hdrs="$define sys/types.h
19729 $i_systime sys/time.h
19730 $i_sysselct sys/select.h
19731 $d_socket sys/socket.h"
19732 : The first arg can be int, unsigned, or size_t
19733 : The last arg may or may not be 'const'
19734 val=''
19735 : void pointer has been seen but using that
19736 : breaks the selectminbits test
19737 for xxx in 'fd_set *' 'int *'; do
19738 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19739 for tmo in 'struct timeval *' 'const struct timeval *'; do
19740 case "$val" in
19741 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19742 if ./protochk "$try" $hdrs; then
19743 echo "Your system accepts $xxx."
19744 val="$xxx"
19745 fi
19746 ;;
19747 esac
19748 done
19749 done
19750 done
19751 case "$val" in
19752 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19753 case "$d_fd_set" in
19754 $define) dflt="fd_set *" ;;
19755 *) dflt="int *" ;;
19756 esac
19757 . ./myread
19758 val=$ans
19759 ;;
19760 esac
19761 selecttype="$val"
19762 ;;
19763 *) : no select, so pick a harmless default
19764 selecttype='int *'
19765 ;;
19766 esac
19767 ;;
19768esac
19769
19770: check for the select 'width'
19771case "$selectminbits" in
e6e7e605
JH
19772'') safebits=`expr $ptrsize \* 8`
19773 case "$d_select" in
b4eb6b3d
JH
19774 $define)
19775 $cat <<EOM
19776
19777Checking to see on how many bits at a time your select() operates...
19778EOM
19779 $cat >try.c <<EOCP
19780#include <sys/types.h>
19781#$i_time I_TIME
19782#$i_systime I_SYS_TIME
19783#$i_systimek I_SYS_TIME_KERNEL
19784#ifdef I_TIME
19785# include <time.h>
19786#endif
19787#ifdef I_SYS_TIME
19788# ifdef I_SYS_TIME_KERNEL
19789# define KERNEL
19790# endif
19791# include <sys/time.h>
19792# ifdef I_SYS_TIME_KERNEL
19793# undef KERNEL
19794# endif
19795#endif
19796#$i_sysselct I_SYS_SELECT
19797#ifdef I_SYS_SELECT
19798#include <sys/select.h>
19799#endif
19800#$d_socket HAS_SOCKET
19801#ifdef HAS_SOCKET
19802# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19803#endif
19804#include <stdio.h>
d1daaddf
JH
19805#$i_stdlib I_STDLIB
19806#ifdef I_STDLIB
19807#include <stdlib.h>
19808#endif
b4eb6b3d
JH
19809$selecttype b;
19810#define S sizeof(*(b))
19811#define MINBITS 64
19812#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19813#define NBITS (NBYTES * 8)
19814int main() {
7090f861 19815 char *s = (char *)malloc(NBYTES);
b4eb6b3d
JH
19816 struct timeval t;
19817 int i;
19818 FILE* fp;
19819 int fd;
19820
e6e7e605
JH
19821 if (!s)
19822 exit(1);
b4eb6b3d
JH
19823 fclose(stdin);
19824 fp = fopen("try.c", "r");
19825 if (fp == 0)
e6e7e605 19826 exit(2);
b4eb6b3d
JH
19827 fd = fileno(fp);
19828 if (fd < 0)
e6e7e605 19829 exit(3);
b4eb6b3d
JH
19830 b = ($selecttype)s;
19831 for (i = 0; i < NBITS; i++)
19832 FD_SET(i, b);
19833 t.tv_sec = 0;
19834 t.tv_usec = 0;
19835 select(fd + 1, b, 0, 0, &t);
19836 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
e6e7e605 19837 free(s);
b4eb6b3d
JH
19838 printf("%d\n", i + 1);
19839 return 0;
19840}
19841EOCP
19842 set try
19843 if eval $compile_ok; then
5440bc8e 19844 selectminbits=`$run ./try`
b4eb6b3d
JH
19845 case "$selectminbits" in
19846 '') cat >&4 <<EOM
19847Cannot figure out on how many bits at a time your select() operates.
e6e7e605 19848I'll play safe and guess it is $safebits bits.
b4eb6b3d 19849EOM
e6e7e605
JH
19850 selectminbits=$safebits
19851 bits="$safebits bits"
b4eb6b3d
JH
19852 ;;
19853 1) bits="1 bit" ;;
19854 *) bits="$selectminbits bits" ;;
19855 esac
19856 echo "Your select() operates on $bits at a time." >&4
19857 else
19858 rp='What is the minimum number of bits your select() operates on?'
19859 case "$byteorder" in
e6e7e605
JH
19860 12345678) dflt=64 ;;
19861 1234) dflt=32 ;;
b4eb6b3d
JH
19862 *) dflt=1 ;;
19863 esac
19864 . ./myread
19865 val=$ans
19866 selectminbits="$val"
19867 fi
19868 $rm -f try.* try
19869 ;;
19870 *) : no select, so pick a harmless default
e6e7e605 19871 selectminbits=$safebits
b4eb6b3d
JH
19872 ;;
19873 esac
19874 ;;
19875esac
19876
19877: Trace out the files included by signal.h, then look for SIGxxx names.
19878: Remove SIGARRAYSIZE used by HPUX.
19879: Remove SIGSTKSIZE used by Linux.
19880: Remove SIGSTKSZ used by Posix.
19881: Remove SIGTYP void lines used by OS2.
19882: Some cpps, like os390, dont give the file name anywhere
19883if [ "X$fieldn" = X ]; then
19884 : Just make some guesses. We check them later.
19885 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19886else
19887 xxx=`echo '#include <signal.h>' |
19888 $cppstdin $cppminus $cppflags 2>/dev/null |
19889 $grep '^[ ]*#.*include' |
a938a3bb 19890 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
19891fi
19892: Check this list of files to be sure we have parsed the cpp output ok.
19893: This will also avoid potentially non-existent files, such
19894: as ../foo/bar.h
19895xxxfiles=''
19896for xx in $xxx /dev/null ; do
19897 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19898done
19899: If we have found no files, at least try signal.h
19900case "$xxxfiles" in
19901'') xxxfiles=`./findhdr signal.h` ;;
19902esac
19903xxx=`awk '
19904$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19905 print substr($2, 4, 20)
19906}
19907$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19908 print substr($3, 4, 20)
19909}' $xxxfiles`
19910: Append some common names just in case the awk scan failed.
19911xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19912xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19913xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19914xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19915xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19916
19917: generate a few handy files for later
55954f19 19918$cat > signal.c <<EOCP
b4eb6b3d
JH
19919#include <sys/types.h>
19920#include <signal.h>
55954f19
JH
19921#$i_stdlib I_STDLIB
19922#ifdef I_STDLIB
19923#include <stdlib.h>
19924#endif
b4eb6b3d
JH
19925#include <stdio.h>
19926int main() {
19927
19928/* Strange style to avoid deeply-nested #if/#else/#endif */
19929#ifndef NSIG
19930# ifdef _NSIG
19931# define NSIG (_NSIG)
19932# endif
19933#endif
19934
19935#ifndef NSIG
19936# ifdef SIGMAX
19937# define NSIG (SIGMAX+1)
19938# endif
19939#endif
19940
19941#ifndef NSIG
19942# ifdef SIG_MAX
19943# define NSIG (SIG_MAX+1)
19944# endif
19945#endif
19946
19947#ifndef NSIG
3609ea0d
JH
19948# ifdef _SIG_MAX
19949# define NSIG (_SIG_MAX+1)
19950# endif
19951#endif
19952
19953#ifndef NSIG
b4eb6b3d
JH
19954# ifdef MAXSIG
19955# define NSIG (MAXSIG+1)
19956# endif
19957#endif
19958
19959#ifndef NSIG
19960# ifdef MAX_SIG
19961# define NSIG (MAX_SIG+1)
19962# endif
19963#endif
19964
19965#ifndef NSIG
19966# ifdef SIGARRAYSIZE
3609ea0d 19967# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
b4eb6b3d
JH
19968# endif
19969#endif
19970
19971#ifndef NSIG
19972# ifdef _sys_nsig
19973# define NSIG (_sys_nsig) /* Solaris 2.5 */
19974# endif
19975#endif
19976
19977/* Default to some arbitrary number that's big enough to get most
19978 of the common signals.
19979*/
19980#ifndef NSIG
19981# define NSIG 50
19982#endif
19983
19984printf("NSIG %d\n", NSIG);
19985
19986#ifndef JUST_NSIG
19987
19988EOCP
19989
19990echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19991{
19992 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 19993 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
19994 printf $1; printf ");\n"
19995 printf "#endif\n"
19996}
19997END {
19998 printf "#endif /* JUST_NSIG */\n";
19999 printf "exit(0);\n}\n";
20000}
20001' >>signal.c
20002$cat >signal.awk <<'EOP'
20003BEGIN { ndups = 0 }
65197d93 20004$1 ~ /^NSIG$/ { nsig = $2 }
1ebe1ffb 20005($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
20006 if ($2 > maxsig) { maxsig = $2 }
20007 if (sig_name[$2]) {
20008 dup_name[ndups] = $1
20009 dup_num[ndups] = $2
b4eb6b3d
JH
20010 ndups++
20011 }
1ebe1ffb 20012 else {
65197d93
JH
20013 sig_name[$2] = $1
20014 sig_num[$2] = $2
b4eb6b3d
JH
20015 }
20016}
20017END {
20018 if (nsig == 0) {
20019 nsig = maxsig + 1
20020 }
20021 printf("NSIG %d\n", nsig);
20022 for (n = 1; n < nsig; n++) {
20023 if (sig_name[n]) {
20024 printf("%s %d\n", sig_name[n], sig_num[n])
20025 }
20026 else {
20027 printf("NUM%d %d\n", n, n)
20028 }
20029 }
20030 for (n = 0; n < ndups; n++) {
20031 printf("%s %d\n", dup_name[n], dup_num[n])
20032 }
20033}
20034EOP
20035$cat >signal_cmd <<EOS
20036$startsh
20037if $test -s signal.lst; then
20038 echo "Using your existing signal.lst file"
20039 exit 0
20040fi
20041xxx="$xxx"
20042EOS
20043$cat >>signal_cmd <<'EOS'
20044
20045set signal
20046if eval $compile_ok; then
1eb9ad5b 20047 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20048else
20049 echo "(I can't seem be able to compile the whole test program)" >&4
20050 echo "(I'll try it in little pieces.)" >&4
20051 set signal -DJUST_NSIG
20052 if eval $compile_ok; then
5440bc8e 20053 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
20054 $cat signal.nsg
20055 else
20056 echo "I can't seem to figure out how many signals you have." >&4
20057 echo "Guessing 50." >&4
20058 echo 'NSIG 50' > signal.nsg
20059 fi
20060 : Now look at all the signal names, one at a time.
20061 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20062 $cat > signal.c <<EOCP
20063#include <sys/types.h>
20064#include <signal.h>
20065#include <stdio.h>
20066int main() {
20067printf("$xx %d\n", SIG${xx});
20068return 0;
20069}
20070EOCP
20071 set signal
20072 if eval $compile; then
20073 echo "SIG${xx} found."
5440bc8e 20074 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
20075 else
20076 echo "SIG${xx} NOT found."
20077 fi
20078 done
20079 if $test -s signal.ls1; then
20080 $cat signal.nsg signal.ls1 |
65197d93 20081 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20082 fi
20083
20084fi
20085if $test -s signal.lst; then
20086 :
20087else
20088 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20089 echo 'kill -l' >signal
20090 set X `csh -f <signal`
20091 $rm -f signal
20092 shift
20093 case $# in
20094 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20095 esac
20096 echo $@ | $tr ' ' $trnl | \
20097 $awk '{ printf "%s %d\n", $1, ++s; }
20098 END { printf "NSIG %d\n", ++s }' >signal.lst
20099fi
20100$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20101EOS
20102chmod a+x signal_cmd
20103$eunicefix signal_cmd
20104
20105: generate list of signal names
20106echo " "
20107case "$sig_name_init" in
20108'') doinit=yes ;;
20109*) case "$sig_num_init" in
20110 ''|*,*) doinit=yes ;;
20111 esac ;;
20112esac
20113case "$doinit" in
20114yes)
20115 echo "Generating a list of signal names and numbers..." >&4
20116 . ./signal_cmd
20117 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20118 sig_name=`$awk 'BEGIN { printf "ZERO " }
20119 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20120 sig_num=`$awk 'BEGIN { printf "0 " }
20121 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20122 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
20123 !/^NSIG/ { printf "\"%s\", ", $1 }
20124 END { printf "0\n" }' signal.lst`
20125 sig_num_init=`$awk 'BEGIN { printf "0, " }
20126 !/^NSIG/ { printf "%d, ", $2}
20127 END { printf "0\n"}' signal.lst`
20128 ;;
20129esac
20130echo "The following $sig_count signals are available:"
20131echo " "
20132echo $sig_name | $awk \
20133'BEGIN { linelen = 0 }
20134{
20135 for (i = 1; i <= NF; i++) {
20136 name = "SIG" $i " "
20137 linelen = linelen + length(name)
20138 if (linelen > 70) {
20139 printf "\n"
20140 linelen = length(name)
20141 }
20142 printf "%s", name
20143 }
20144 printf "\n"
20145}'
76d3c696 20146sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
20147$rm -f signal signal.c signal.awk signal.lst signal_cmd
20148
20149echo " "
20150case "$sizetype" in
20151*_t) zzz="$sizetype" ;;
20152*) zzz="filesize" ;;
20153esac
20154echo "Checking the size of $zzz..." >&4
20155cat > try.c <<EOCP
20156#include <sys/types.h>
20157#include <stdio.h>
d1daaddf
JH
20158#$i_stdlib I_STDLIB
20159#ifdef I_STDLIB
20160#include <stdlib.h>
20161#endif
b4eb6b3d
JH
20162int main() {
20163 printf("%d\n", (int)sizeof($sizetype));
20164 exit(0);
20165}
20166EOCP
20167set try
20168if eval $compile_ok; then
5440bc8e 20169 yyy=`$run ./try`
b4eb6b3d
JH
20170 case "$yyy" in
20171 '') sizesize=4
20172 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20173 ;;
20174 *) sizesize=$yyy
20175 echo "Your $zzz size is $sizesize bytes."
20176 ;;
20177 esac
20178else
20179 sizesize=4
20180 echo "(I can't compile the test program--guessing $sizesize.)" >&4
20181fi
20182
20183
20184: check for socklen_t
20185echo " "
20186echo "Checking to see if you have socklen_t..." >&4
20187$cat >try.c <<EOCP
20188#include <sys/types.h>
20189#$d_socket HAS_SOCKET
20190#ifdef HAS_SOCKET
20191#include <sys/socket.h>
20192#endif
20193int main() { socklen_t x = 16; }
20194EOCP
20195set try
20196if eval $compile; then
20197 val="$define"
20198 echo "You have socklen_t."
20199else
20200 val="$undef"
20201 echo "You do not have socklen_t."
20202 case "$sizetype" in
20203 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20204 esac
20205fi
20206$rm -f try try.*
20207set d_socklen_t
20208eval $setvar
20209
a7710f8d
JH
20210: see if this is a socks.h system
20211set socks.h i_socks
20212eval $inhdr
20213
b4eb6b3d
JH
20214: check for type of the size argument to socket calls
20215case "$d_socket" in
20216"$define")
20217 $cat <<EOM
20218
20219Checking to see what type is the last argument of accept().
20220EOM
b4eb6b3d
JH
20221 yyy=''
20222 case "$d_socklen_t" in
20223 "$define") yyy="$yyy socklen_t"
20224 esac
20225 yyy="$yyy $sizetype int long unsigned"
20226 for xxx in $yyy; do
20227 case "$socksizetype" in
20228 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
20229 case "$usesocks" in
20230 "$define")
20231 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20232 echo "Your system accepts '$xxx *' for the last argument of accept()."
20233 socksizetype="$xxx"
20234 fi
20235 ;;
20236 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
20237 echo "Your system accepts '$xxx *' for the last argument of accept()."
20238 socksizetype="$xxx"
20239 fi
20240 ;;
20241 esac
b4eb6b3d
JH
20242 ;;
20243 esac
20244 done
20245: In case none of those worked, prompt the user.
20246 case "$socksizetype" in
20247 '') rp='What is the type for socket address structure sizes?'
20248 dflt='int'
20249 . ./myread
20250 socksizetype=$ans
20251 ;;
20252 esac
20253 ;;
20254*) : no sockets, so pick relatively harmless default
20255 socksizetype='int'
20256 ;;
20257esac
20258
20259: see what type is used for signed size_t
20260set ssize_t ssizetype int stdio.h sys/types.h
20261eval $typedef
20262dflt="$ssizetype"
5440bc8e 20263$cat > try.c <<EOM
b4eb6b3d 20264#include <stdio.h>
d1daaddf
JH
20265#$i_stdlib I_STDLIB
20266#ifdef I_STDLIB
20267#include <stdlib.h>
20268#endif
b4eb6b3d
JH
20269#include <sys/types.h>
20270#define Size_t $sizetype
20271#define SSize_t $dflt
20272int main()
20273{
20274 if (sizeof(Size_t) == sizeof(SSize_t))
20275 printf("$dflt\n");
20276 else if (sizeof(Size_t) == sizeof(int))
20277 printf("int\n");
20278 else
20279 printf("long\n");
20280 exit(0);
20281}
20282EOM
20283echo " "
5440bc8e
JH
20284set try
20285if eval $compile_ok && $run ./try > /dev/null; then
20286 ssizetype=`$run ./try`
b4eb6b3d
JH
20287 echo "I'll be using $ssizetype for functions returning a byte count." >&4
20288else
20289 $cat >&4 <<EOM
20290Help! I can't compile and run the ssize_t test program: please enlighten me!
20291(This is probably a misconfiguration in your system or libraries, and
20292you really ought to fix it. Still, I'll try anyway.)
20293
20294I need a type that is the same size as $sizetype, but is guaranteed to
20295be signed. Common values are ssize_t, int and long.
20296
20297EOM
20298 rp="What signed type is the same size as $sizetype?"
20299 . ./myread
20300 ssizetype="$ans"
20301fi
5440bc8e 20302$rm -f try try.*
b4eb6b3d
JH
20303
20304: see what type of char stdio uses.
20305echo " "
359842a5
JH
20306echo '#include <stdio.h>' > stdio.c
20307$cppstdin $cppminus < stdio.c > stdioh
aa517f50 20308if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
20309 echo "Your stdio uses unsigned chars." >&4
20310 stdchar="unsigned char"
20311else
aa517f50
JH
20312 echo "Your stdio uses signed chars." >&4
20313 stdchar="char"
b4eb6b3d 20314fi
359842a5 20315$rm -f stdio.* stdioh
b4eb6b3d 20316
b4eb6b3d
JH
20317: see what type uids are declared as in the kernel
20318echo " "
20319echo "Looking for the type for user ids returned by getuid()."
20320set uid_t uidtype xxx stdio.h sys/types.h
20321eval $typedef
20322case "$uidtype" in
20323xxx)
20324 xxx=`./findhdr sys/user.h`
20325 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20326 case $1 in
20327 unsigned) dflt="$1 $2" ;;
20328 *) dflt="$1" ;;
20329 esac
20330 ;;
20331*) dflt="$uidtype";;
20332esac
20333case "$uidtype" in
20334uid_t) echo "uid_t found." ;;
20335*) rp="What is the type for user ids returned by getuid()?"
20336 . ./myread
20337 uidtype="$ans"
20338 ;;
20339esac
20340
20341echo " "
20342case "$uidtype" in
20343*_t) zzz="$uidtype" ;;
20344*) zzz="uid" ;;
20345esac
20346echo "Checking the size of $zzz..." >&4
20347cat > try.c <<EOCP
20348#include <sys/types.h>
20349#include <stdio.h>
d1daaddf
JH
20350#$i_stdlib I_STDLIB
20351#ifdef I_STDLIB
20352#include <stdlib.h>
20353#endif
b4eb6b3d
JH
20354int main() {
20355 printf("%d\n", (int)sizeof($uidtype));
20356 exit(0);
20357}
20358EOCP
20359set try
20360if eval $compile_ok; then
5440bc8e 20361 yyy=`$run ./try`
b4eb6b3d
JH
20362 case "$yyy" in
20363 '') uidsize=4
20364 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20365 ;;
20366 *) uidsize=$yyy
20367 echo "Your $zzz is $uidsize bytes long."
20368 ;;
20369 esac
20370else
20371 uidsize=4
20372 echo "(I can't compile the test program--guessing $uidsize.)" >&4
20373fi
20374
20375echo " "
20376case "$uidtype" in
20377*_t) zzz="$uidtype" ;;
20378*) zzz="uid" ;;
20379esac
20380echo "Checking the sign of $zzz..." >&4
20381cat > try.c <<EOCP
20382#include <sys/types.h>
20383#include <stdio.h>
20384int main() {
20385 $uidtype foo = -1;
20386 if (foo < 0)
20387 printf("-1\n");
20388 else
20389 printf("1\n");
20390}
20391EOCP
20392set try
20393if eval $compile; then
5440bc8e 20394 yyy=`$run ./try`
b4eb6b3d
JH
20395 case "$yyy" in
20396 '') uidsign=1
20397 echo "(I can't execute the test program--guessing unsigned.)" >&4
20398 ;;
20399 *) uidsign=$yyy
20400 case "$uidsign" in
20401 1) echo "Your $zzz is unsigned." ;;
20402 -1) echo "Your $zzz is signed." ;;
20403 esac
20404 ;;
20405 esac
20406else
20407 uidsign=1
20408 echo "(I can't compile the test program--guessing unsigned.)" >&4
20409fi
20410
20411
20412
20413echo " "
20414$echo "Checking the format string to be used for uids..." >&4
20415
20416case "$uidsign" in
20417-1) if $test X"$uidsize" = X"$ivsize"; then
20418 uidformat="$ivdformat"
20419 else
20420 if $test X"$uidsize" = X"$longsize"; then
20421 uidformat='"ld"'
20422 else
20423 if $test X"$uidsize" = X"$intsize"; then
20424 uidformat='"d"'
20425 else
20426 if $test X"$uidsize" = X"$shortsize"; then
20427 uidformat='"hd"'
20428 fi
20429 fi
20430 fi
20431 fi
20432 ;;
20433*) if $test X"$uidsize" = X"$uvsize"; then
20434 uidformat="$uvuformat"
20435 else
20436 if $test X"$uidsize" = X"$longsize"; then
20437 uidformat='"lu"'
20438 else
20439 if $test X"$uidsize" = X"$intsize"; then
20440 uidformat='"u"'
20441 else
20442 if $test X"$uidsize" = X"$shortsize"; then
20443 uidformat='"hu"'
20444 fi
20445 fi
20446 fi
20447 fi
20448 ;;
20449esac
20450
4afd418c
MB
20451
20452case "$usesitecustomize" in
20453 $define|true|[Yy]*)
20454 usesitecustomize="$define"
20455 ;;
20456 *)
20457 usesitecustomize="$undef"
20458 ;;
20459 esac
20460
3659ebf1
JH
20461: determine compiler compiler
20462case "$yacc" in
20463'')
20464 dflt=yacc;;
20465*)
20466 dflt="$yacc";;
20467esac
20468echo " "
20469comp='yacc'
3c728e00 20470if $test -f "$byacc$_exe"; then
3659ebf1
JH
20471 dflt="$byacc"
20472 comp="byacc or $comp"
20473fi
3c728e00 20474if $test -f "$bison$_exe"; then
3659ebf1
JH
20475 comp="$comp or bison -y"
20476fi
20477rp="Which compiler compiler ($comp) shall I use?"
20478. ./myread
20479yacc="$ans"
20480case "$yacc" in
20481*bis*)
20482 case "$yacc" in
20483 *-y*) ;;
20484 *)
20485 yacc="$yacc -y"
20486 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20487 ;;
20488 esac
20489 ;;
20490esac
20491
758a5d79
JH
20492: see if this is a fp.h system
20493set fp.h i_fp
20494eval $inhdr
20495
20496: see if this is a fp_class.h system
20497set fp_class.h i_fp_class
20498eval $inhdr
20499
13cfc98d
MB
20500: see if gdbm.h is available
20501set gdbm.h t_gdbm
20502eval $inhdr
20503case "$t_gdbm" in
20504$define)
20505 : see if gdbm_open exists
20506 set gdbm_open d_gdbm_open
20507 eval $inlibc
20508 case "$d_gdbm_open" in
20509 $undef)
20510 t_gdbm="$undef"
20511 echo "We won't be including <gdbm.h>"
20512 ;;
20513 esac
20514 ;;
20515esac
20516val="$t_gdbm"
20517set i_gdbm
20518eval $setvar
20519
b4eb6b3d 20520: see if this is a ieeefp.h system
b5b9f165
JH
20521case "$i_ieeefp" in
20522'' ) set ieeefp.h i_ieeefp
20523 eval $inhdr
20524 ;;
20525esac
b4eb6b3d
JH
20526
20527: see if this is a libutil.h system
20528set libutil.h i_libutil
20529eval $inhdr
20530
b4eb6b3d
JH
20531: see if mach cthreads are available
20532if test "X$usethreads" = "X$define"; then
20533 set mach/cthreads.h i_machcthr
20534 eval $inhdr
20535else
20536 i_machcthr="$undef"
20537fi
20538
20539
20540
b4eb6b3d
JH
20541: see if this is a mntent.h system
20542set mntent.h i_mntent
20543eval $inhdr
20544
20545: see if ndbm.h is available
20546set ndbm.h t_ndbm
20547eval $inhdr
1c6861ad
JS
20548
20549case "$t_ndbm" in
20550$undef)
20551 # Some Linux distributions such as RedHat 7.1 put the
20552 # ndbm.h header in /usr/include/gdbm/ndbm.h.
20553 if $test -f /usr/include/gdbm/ndbm.h; then
d11b91bf 20554 echo '<gdbm/ndbm.h> found.'
1c6861ad
JS
20555 ccflags="$ccflags -I/usr/include/gdbm"
20556 cppflags="$cppflags -I/usr/include/gdbm"
20557 t_ndbm=$define
20558 fi
20559 ;;
20560esac
20561
b4eb6b3d
JH
20562case "$t_ndbm" in
20563$define)
20564 : see if dbm_open exists
20565 set dbm_open d_dbm_open
20566 eval $inlibc
20567 case "$d_dbm_open" in
20568 $undef)
20569 t_ndbm="$undef"
20570 echo "We won't be including <ndbm.h>"
20571 ;;
20572 esac
20573 ;;
20574esac
20575val="$t_ndbm"
20576set i_ndbm
20577eval $setvar
20578
20579: see if net/errno.h is available
20580val=''
20581set net/errno.h val
20582eval $inhdr
20583
20584: Unfortunately, it causes problems on some systems. Arrgh.
20585case "$val" in
20586$define)
20587 cat > try.c <<'EOM'
20588#include <stdio.h>
20589#include <errno.h>
20590#include <net/errno.h>
20591int func()
20592{
20593 return ENOTSOCK;
20594}
20595EOM
20596 if $cc $ccflags -c try.c >/dev/null 2>&1; then
20597 echo "We'll be including <net/errno.h>." >&4
20598 else
20599 echo "We won't be including <net/errno.h>." >&4
20600 val="$undef"
20601 fi
20602 $rm -f try.* try
20603 ;;
20604esac
20605set i_neterrno
20606eval $setvar
20607
20608: see if netinet/tcp.h is available
20609set netinet/tcp.h i_netinettcp
20610eval $inhdr
20611
20612: see if this is a poll.h system
20613set poll.h i_poll
20614eval $inhdr
20615
20616: see if this is a prot.h system
20617set prot.h i_prot
20618eval $inhdr
20619
20620echo " "
ddfca5da 20621$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
b4eb6b3d
JH
20622$cat <<'EOSH' > Cppsym.know
20623a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20624AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
44c87379 20625alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
d46c9a2d
JH
20626ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20627BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
20628BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20629bull c cadmus clipper CMU COFF COMPILER_VERSION
20630concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
8b7d8421 20631CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
20632Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20633FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20634GLIBC GLIBC_MINOR
20635GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
20636H3050R H3050RX hbullx20 hcx host_mips
20637hp200 hp300 hp700 HP700 hp800 hp9000
20638hp9000s200 hp9000s300 hp9000s400 hp9000s500
20639hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20640i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 20641IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
20642INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20643LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20644LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20645Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20646LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20647M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20648M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20649M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20650MATH_HAS_NO_SIDE_EFFECTS
20651mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20652mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20653mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20654MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20655mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20656NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 20657news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
20658ns32016 ns32332 ns32k nsc32000
20659OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20660pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20661pc532 pdp11 PGC PIC plexus PORTAR posix
20662POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20663POSIX_C_SOURCE POSIX_SOURCE POWER
20664PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 20665riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
20666SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20667sony sony_news sonyrisc sparc sparclite spectrum
20668stardent stdc STDC_EXT stratos sun sun3 sun386
20669Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20670SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20671SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20672sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 20673TM3200 TM5400 TM5600
b4eb6b3d
JH
20674tower tower32 tower32_200 tower32_600 tower32_700
20675tower32_800 tower32_850 tss
20676u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20677ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
20678unix UNIX95 UNIX99 unixpc unos
20679USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20680USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20681USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20682USGr4 USGr4_2
44c87379 20683Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
b4eb6b3d
JH
20684XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20685XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20686z8000
20687EOSH
20688# Maybe put other stuff here too.
20689cat <<EOSH >>Cppsym.know
20690$osname
20691EOSH
20692./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20693./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20694$cat Cppsym.know > Cppsym.c
381aa1ff 20695$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
20696$rm -f Cppsym.a Cppsym.b Cppsym.c
20697cat <<EOSH > Cppsym
20698$startsh
20699if $test \$# -gt 0; then
20700 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20701 if $test -s Cppsym.got; then
20702 $rm -f Cppsym.got
20703 exit 0
20704 fi
20705 $rm -f Cppsym.got
20706 exit 1
20707else
20708 $tr " " "$trnl" | ./Cppsym.try
20709 exit 0
20710fi
20711EOSH
20712chmod +x Cppsym
20713$eunicefix Cppsym
20714cat <<EOSH > Cppsym.try
20715$startsh
20716cat <<'EOCP' > try.c
20717#include <stdio.h>
360321b3
YST
20718#if cpp_stuff == 1
20719#define STRINGIFY(a) "a"
20720#endif
20721#if cpp_stuff == 42
20722#define StGiFy(a) #a
20723#define STRINGIFY(a) StGiFy(a)
20724#endif
20725#if $cpp_stuff != 1 && $cpp_stuff != 42
20726# include "Bletch: How does this C preprocessor stringify macros?"
20727#endif
b4eb6b3d
JH
20728int main() {
20729EOCP
20730$awk \\
20731EOSH
20732cat <<'EOSH' >> Cppsym.try
20733'length($1) > 0 {
360321b3
YST
20734 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20735 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20736 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20737 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
b4eb6b3d 20738}' >> try.c
2ef53570 20739echo 'return 0;}' >> try.c
b4eb6b3d
JH
20740EOSH
20741cat <<EOSH >> Cppsym.try
20742ccflags="$ccflags"
20743case "$osname-$gccversion" in
20744irix-) ccflags="\$ccflags -woff 1178" ;;
20745os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20746esac
360321b3 20747$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
b4eb6b3d
JH
20748EOSH
20749chmod +x Cppsym.try
20750$eunicefix Cppsym.try
20751./Cppsym < Cppsym.know > Cppsym.true
ddfca5da 20752: Add in any linux cpp "predefined macros":
b6a7163e
MB
20753case "$osname::$gccversion" in
20754 *linux*::*.*)
20755 tHdrH=_tmpHdr
20756 rm -f $tHdrH'.h' $tHdrH
20757 touch $tHdrH'.h'
20758 if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20759 sed 's/#define[\ \ ]*//;s/[\ \ ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20760 if [ -s $tHdrH'_cppsym.real' ]; then
20761 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20762 fi
20763 fi
20764 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20765 ;;
20766esac
b4eb6b3d
JH
20767: now check the C compiler for additional symbols
20768postprocess_cc_v=''
20769case "$osname" in
20770aix) postprocess_cc_v="|$tr , ' '" ;;
20771esac
20772$cat >ccsym <<EOS
20773$startsh
20774$cat >tmp.c <<EOF
20775extern int foo;
20776EOF
20777for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20778do
20779 case "\$i" in
20780 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 20781 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
20782 esac
20783done
20784$rm -f try.c
20785EOS
20786postprocess_cc_v=''
20787chmod +x ccsym
20788$eunicefix ccsym
20789./ccsym > ccsym1.raw
20790if $test -s ccsym1.raw; then
20791 $sort ccsym1.raw | $uniq >ccsym.raw
20792else
20793 mv ccsym1.raw ccsym.raw
20794fi
20795
20796$awk '/\=/ { print $0; next }
20797 { print $0"=1" }' ccsym.raw >ccsym.list
360321b3
YST
20798$comm -13 Cppsym.true ccsym.list >ccsym.own
20799$comm -12 Cppsym.true ccsym.list >ccsym.com
20800$comm -23 Cppsym.true ccsym.list >ccsym.cpp
b4eb6b3d
JH
20801also=''
20802if $test -z ccsym.raw; then
20803 echo "Your C compiler doesn't seem to define any symbols!" >&4
20804 echo " "
20805 echo "However, your C preprocessor defines the following symbols:"
20806 $cat Cppsym.true
20807 ccsymbols=''
20808 cppsymbols=`$cat Cppsym.true`
20809 cppsymbols=`echo $cppsymbols`
20810 cppccsymbols="$cppsymbols"
20811else
20812 if $test -s ccsym.com; then
20813 echo "Your C compiler and pre-processor define these symbols:"
20814 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20815 also='also '
20816 symbols='ones'
20817 cppccsymbols=`$cat ccsym.com`
20818 cppccsymbols=`echo $cppccsymbols`
20819 $test "$silent" || sleep 1
20820 fi
20821 if $test -s ccsym.cpp; then
20822 $test "$also" && echo " "
20823 echo "Your C pre-processor ${also}defines the following symbols:"
20824 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20825 also='further '
20826 cppsymbols=`$cat ccsym.cpp`
20827 cppsymbols=`echo $cppsymbols`
20828 $test "$silent" || sleep 1
20829 fi
20830 if $test -s ccsym.own; then
20831 $test "$also" && echo " "
20832 echo "Your C compiler ${also}defines the following cpp symbols:"
20833 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20834 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20835 ccsymbols=`$cat ccsym.own`
20836 ccsymbols=`echo $ccsymbols`
20837 $test "$silent" || sleep 1
20838 fi
20839fi
b4eb6b3d
JH
20840
20841: see if this is a termio system
20842val="$undef"
20843val2="$undef"
20844val3="$undef"
20845if $test `./findhdr termios.h`; then
20846 set tcsetattr i_termios
20847 eval $inlibc
20848 val3="$i_termios"
20849fi
20850echo " "
20851case "$val3" in
20852"$define") echo "You have POSIX termios.h... good!" >&4;;
20853*) if ./Cppsym pyr; then
20854 case "`/bin/universe`" in
20855 ucb) if $test `./findhdr sgtty.h`; then
20856 val2="$define"
20857 echo "<sgtty.h> found." >&4
20858 else
20859 echo "System is pyramid with BSD universe."
20860 echo "<sgtty.h> not found--you could have problems." >&4
20861 fi;;
20862 *) if $test `./findhdr termio.h`; then
20863 val="$define"
20864 echo "<termio.h> found." >&4
20865 else
20866 echo "System is pyramid with USG universe."
20867 echo "<termio.h> not found--you could have problems." >&4
20868 fi;;
20869 esac
20870 elif ./usg; then
20871 if $test `./findhdr termio.h`; then
20872 echo "<termio.h> found." >&4
20873 val="$define"
20874 elif $test `./findhdr sgtty.h`; then
20875 echo "<sgtty.h> found." >&4
20876 val2="$define"
20877 else
20878echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20879 fi
20880 else
20881 if $test `./findhdr sgtty.h`; then
20882 echo "<sgtty.h> found." >&4
20883 val2="$define"
20884 elif $test `./findhdr termio.h`; then
20885 echo "<termio.h> found." >&4
20886 val="$define"
20887 else
20888echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20889 fi
20890 fi;;
20891esac
20892set i_termio; eval $setvar
20893val=$val2; set i_sgtty; eval $setvar
20894val=$val3; set i_termios; eval $setvar
20895
b4eb6b3d
JH
20896: see if stddef is available
20897set stddef.h i_stddef
20898eval $inhdr
923fc586 20899
b4eb6b3d
JH
20900: see if sys/access.h is available
20901set sys/access.h i_sysaccess
20902eval $inhdr
20903
20904: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20905set sys/filio.h i_sysfilio
20906eval $inhdr
20907echo " "
20908if $test `./findhdr sys/ioctl.h`; then
20909 val="$define"
20910 echo '<sys/ioctl.h> found.' >&4
20911else
20912 val="$undef"
20913 if $test $i_sysfilio = "$define"; then
20914 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 20915 else
b4eb6b3d
JH
20916 $test $i_sgtty = "$define" && xxx="sgtty.h"
20917 $test $i_termio = "$define" && xxx="termio.h"
20918 $test $i_termios = "$define" && xxx="termios.h"
20919echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20920 fi
20921fi
20922set i_sysioctl
20923eval $setvar
20924
49a78c82
JH
20925: see if socket ioctl defs are in sys/sockio.h
20926echo " "
20927xxx=`./findhdr sys/sockio.h`
20928if $test "$xxx"; then
20929 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20930 val="$define"
20931 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20932 else
20933 val="$undef"
20934 echo "No socket ioctls found in <sys/sockio.h>." >&4
20935 fi
20936else
20937 val="$undef"
20938 $cat <<EOM
20939<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20940EOM
20941fi
20942set i_syssockio
20943eval $setvar
20944
b4eb6b3d
JH
20945
20946: see if this is a syslog.h system
20947set syslog.h i_syslog
20948eval $inhdr
20949
20950
20951: see if this is a sys/mode.h system
20952set sys/mode.h i_sysmode
20953eval $inhdr
20954
20955: see if sys/resource.h has to be included
20956set sys/resource.h i_sysresrc
20957eval $inhdr
20958
20959: see if sys/security.h is available
20960set sys/security.h i_syssecrt
20961eval $inhdr
20962
20963: see if this is a sys/statvfs.h system
20964set sys/statvfs.h i_sysstatvfs
20965eval $inhdr
20966
b4eb6b3d
JH
20967: see if this is a sys/un.h system
20968set sys/un.h i_sysun
20969eval $inhdr
20970
20971
20972: see if this is a sys/utsname.h system
20973set sys/utsname.h i_sysutsname
20974eval $inhdr
20975
20976: see if this is a syswait system
20977set sys/wait.h i_syswait
20978eval $inhdr
20979
20980: see if this is a ustat.h system
20981set ustat.h i_ustat
20982eval $inhdr
20983
20984: see if this is an utime system
20985set utime.h i_utime
20986eval $inhdr
20987
20988: see if this is a values.h system
20989set values.h i_values
20990eval $inhdr
20991
20992: see if this is a vfork system
20993case "$d_vfork" in
20994"$define")
20995 set vfork.h i_vfork
20996 eval $inhdr
20997 ;;
20998*)
20999 i_vfork="$undef"
21000 ;;
21001esac
21002
b4eb6b3d
JH
21003echo " "
21004echo "Looking for extensions..." >&4
21005: If we are using the old config.sh, known_extensions may contain
21006: old or inaccurate or duplicate values.
21007known_extensions=''
21008nonxs_extensions=''
21009: We do not use find because it might not be available.
21010: We do not just use MANIFEST because the user may have dropped
21011: some additional extensions into the source tree and expect them
21012: to be built.
21013
21014: Function to recursively find available extensions, ignoring DynaLoader
21015: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21016find_extensions='
21017 for xxx in *; do
822a6ee0
MB
21018 case "$xxx" in
21019 DynaLoader|dynaload) ;;
21020 *)
78ff2d7b 21021 if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
822a6ee0
MB
21022 known_extensions="$known_extensions $1$xxx";
21023 elif $test -f $xxx/Makefile.PL; then
21024 nonxs_extensions="$nonxs_extensions $1$xxx";
21025 else
21026 if $test -d $xxx -a $# -lt 10; then
21027 set $1$xxx/ $*;
21028 cd "$xxx";
21029 eval $find_extensions;
21030 cd ..;
21031 shift;
21032 fi;
21033 fi
21034 ;;
21035 esac;
b4eb6b3d
JH
21036 done'
21037tdir=`pwd`
6904989c 21038cd "$rsrc/ext"
b4eb6b3d
JH
21039set X
21040shift
21041eval $find_extensions
4e1a6d26
AD
21042# Special case: Add in threads/shared since it is not picked up by the
21043# recursive find above (and adding in general recursive finding breaks
21044# SDBM_File/sdbm). A.D. 10/25/2001.
998b396c 21045known_extensions="$known_extensions threads/shared"
faae14e6
MB
21046set X $known_extensions
21047shift
21048known_extensions="$*"
21049# Ditto for IO/Compress/Base and IO/Compress/Zlib
59c368f1 21050nonxs_extensions="$nonxs_extensions IO/Compress/Base IO/Compress/Zlib"
b4eb6b3d
JH
21051set X $nonxs_extensions
21052shift
21053nonxs_extensions="$*"
6904989c 21054cd "$tdir"
b4eb6b3d
JH
21055
21056: Now see which are supported on this system.
21057avail_ext=''
21058for xxx in $known_extensions ; do
21059 case "$xxx" in
21060 DB_File|db_file)
21061 case "$i_db" in
21062 $define) avail_ext="$avail_ext $xxx" ;;
21063 esac
21064 ;;
21065 GDBM_File|gdbm_fil)
7c345082 21066 case "$i_gdbm" in
b4eb6b3d
JH
21067 $define) avail_ext="$avail_ext $xxx" ;;
21068 esac
21069 ;;
1d59c593 21070 I18N/Langinfo|i18n_lan)
7c345082 21071 case "$i_langinfo$d_nl_langinfo" in
4bbcc6e8
JH
21072 $define$define) avail_ext="$avail_ext $xxx" ;;
21073 esac
21074 ;;
b4eb6b3d
JH
21075 NDBM_File|ndbm_fil)
21076 case "$i_ndbm" in
21077 $define)
21078 case "$osname-$use64bitint" in
0be9fa5d 21079 hpux-define)
b4eb6b3d
JH
21080 case "$libs" in
21081 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21082 esac
21083 ;;
21084 *) avail_ext="$avail_ext $xxx" ;;
21085 esac
21086 ;;
21087 esac
21088 ;;
7c345082 21089 ODBM_File|odbm_fil)
b4eb6b3d
JH
21090 case "${i_dbm}${i_rpcsvcdbm}" in
21091 *"${define}"*)
21092 case "$osname-$use64bitint" in
0be9fa5d 21093 hpux-define)
b4eb6b3d
JH
21094 case "$libs" in
21095 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21096 esac
21097 ;;
21098 *) avail_ext="$avail_ext $xxx" ;;
21099 esac
21100 ;;
21101 esac
21102 ;;
21103 POSIX|posix)
21104 case "$useposix" in
21105 true|define|y) avail_ext="$avail_ext $xxx" ;;
21106 esac
21107 ;;
21108 Opcode|opcode)
21109 case "$useopcode" in
21110 true|define|y) avail_ext="$avail_ext $xxx" ;;
21111 esac
21112 ;;
21113 Socket|socket)
7c345082 21114 case "$d_socket" in
4a9f028c
JH
21115 true|$define|y)
21116 case "$osname" in
21117 beos) ;; # not unless BONE
21118 *) avail_ext="$avail_ext $xxx" ;;
21119 esac
21120 ;;
b4eb6b3d
JH
21121 esac
21122 ;;
21123 Sys/Syslog|sys/syslog)
21124 : XXX syslog requires socket
7c345082 21125 case "$d_socket" in
b4eb6b3d
JH
21126 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21127 esac
21128 ;;
21129 Thread|thread)
b00ec89b
AB
21130 case "$usethreads" in
21131 true|$define|y)
21132 case "$useithreads" in
21133 $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
21134 esac
b4eb6b3d
JH
21135 esac
21136 ;;
78ff2d7b 21137 Win32*)
b149d92d
JD
21138 case "$osname" in
21139 cygwin) avail_ext="$avail_ext $xxx" ;;
21140 esac
21141 ;;
f9b6ed1c
AD
21142 XS/APItest|xs/apitest)
21143 # This is just for testing. Skip it unless we have dynamic loading.
21144
21145 case "$usedl" in
21146 $define) avail_ext="$avail_ext $xxx" ;;
21147 esac
21148 ;;
21149 XS/Typemap|xs/typemap)
21150 # This is just for testing. Skip it unless we have dynamic loading.
21151 case "$usedl" in
21152 $define) avail_ext="$avail_ext $xxx" ;;
21153 esac
21154 ;;
7deadc5f 21155 threads|threads/shared)
73e09c8f
JH
21156 # threads and threads::shared are special cases.
21157 # To stop people from asking "Perl 5.8.0 was supposed
21158 # to have this new fancy threads implementation but my
21159 # perl doesn't have it" and from people trying to
21160 # (re)install the threads module using CPAN.pm and
21161 # CPAN.pm then offering to reinstall Perl 5.8.0,
21162 # the threads.pm and threads/shared.pm will always be
21163 # there, croaking informatively ("you need to rebuild
21164 # all of Perl with threads, sorry") when threads haven't
21165 # been compiled in.
21166 # --jhi
21167 avail_ext="$avail_ext $xxx"
1dca008a 21168 ;;
b4eb6b3d
JH
21169 IPC/SysV|ipc/sysv)
21170 : XXX Do we need a useipcsysv variable here
7c345082 21171 case "${d_msg}${d_sem}${d_shm}" in
b4eb6b3d
JH
21172 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21173 esac
21174 ;;
21175 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
21176 ;;
21177 esac
b4eb6b3d 21178done
5f80c64f 21179
b4eb6b3d
JH
21180set X $avail_ext
21181shift
21182avail_ext="$*"
5f80c64f 21183
ef0c5be8
JH
21184case "$onlyextensions" in
21185'') ;;
21186*) keepextensions=''
21187 echo "You have requested that only certains extensions be included..." >&4
21188 for i in $onlyextensions; do
21189 case " $avail_ext " in
21190 *" $i "*)
21191 echo "Keeping extension $i."
21192 keepextensions="$keepextensions $i"
21193 ;;
21194 *) echo "Ignoring extension $i." ;;
21195 esac
21196 done
21197 avail_ext="$keepextensions"
21198 ;;
21199esac
21200
21201case "$noextensions" in
21202'') ;;
21203*) keepextensions=''
21204 echo "You have requested that certain extensions be ignored..." >&4
21205 for i in $avail_ext; do
c3dadc13
AD
21206 case " $noextensions " in
21207 *" $i "*) echo "Ignoring extension $i." ;;
ef0c5be8
JH
21208 *) echo "Keeping extension $i.";
21209 keepextensions="$keepextensions $i"
21210 ;;
21211 esac
21212 done
21213 avail_ext="$keepextensions"
21214 ;;
21215esac
21216
b4eb6b3d
JH
21217: Now see which nonxs extensions are supported on this system.
21218: For now assume all are.
21219nonxs_ext=''
21220for xxx in $nonxs_extensions ; do
21221 case "$xxx" in
21222 *) nonxs_ext="$nonxs_ext $xxx"
21223 ;;
21224 esac
21225done
5f80c64f 21226
b4eb6b3d
JH
21227set X $nonxs_ext
21228shift
21229nonxs_ext="$*"
21230
21231case $usedl in
21232$define)
21233 $cat <<EOM
21234A number of extensions are supplied with $package. You may choose to
21235compile these extensions for dynamic loading (the default), compile
21236them into the $package executable (static loading), or not include
21237them at all. Answer "none" to include no extensions.
21238Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
21239
21240EOM
b4eb6b3d 21241 case "$dynamic_ext" in
736accd3
YST
21242 '')
21243 : Exclude those listed in static_ext
21244 dflt=''
21245 for xxx in $avail_ext; do
21246 case " $static_ext " in
21247 *" $xxx "*) ;;
21248 *) dflt="$dflt $xxx" ;;
21249 esac
21250 done
21251 set X $dflt
21252 shift
21253 dflt="$*"
21254 ;;
b4eb6b3d
JH
21255 *) dflt="$dynamic_ext"
21256 # Perhaps we are reusing an old out-of-date config.sh.
21257 case "$hint" in
21258 previous)
21259 if test X"$dynamic_ext" != X"$avail_ext"; then
21260 $cat <<EOM
7c345082
RGS
21261NOTICE: Your previous config.sh list may be incorrect.
21262The extensions now available to you are
b4eb6b3d
JH
21263 ${avail_ext}
21264but the default list from your previous config.sh is
7c345082 21265 ${dynamic_ext}
9c839522 21266
b4eb6b3d
JH
21267EOM
21268 fi
9c839522
PM
21269 ;;
21270 esac
b4eb6b3d
JH
21271 ;;
21272 esac
5f80c64f 21273 case "$dflt" in
b4eb6b3d
JH
21274 '') dflt=none;;
21275 esac
21276 rp="What extensions do you wish to load dynamically?"
21277 . ./myread
21278 case "$ans" in
21279 none) dynamic_ext=' ' ;;
21280 *) dynamic_ext="$ans" ;;
5f80c64f 21281 esac
5f80c64f 21282
b4eb6b3d
JH
21283 case "$static_ext" in
21284 '')
21285 : Exclude those already listed in dynamic linking
21286 dflt=''
21287 for xxx in $avail_ext; do
21288 case " $dynamic_ext " in
21289 *" $xxx "*) ;;
21290 *) dflt="$dflt $xxx" ;;
21291 esac
21292 done
21293 set X $dflt
21294 shift
21295 dflt="$*"
21296 ;;
7c345082 21297 *) dflt="$static_ext"
b4eb6b3d
JH
21298 ;;
21299 esac
9c839522 21300
b4eb6b3d
JH
21301 case "$dflt" in
21302 '') dflt=none;;
21303 esac
21304 rp="What extensions do you wish to load statically?"
21305 . ./myread
21306 case "$ans" in
21307 none) static_ext=' ' ;;
21308 *) static_ext="$ans" ;;
21309 esac
21310 ;;
21311*)
21312 $cat <<EOM
7c345082
RGS
21313A number of extensions are supplied with $package. Answer "none"
21314to include no extensions.
b4eb6b3d 21315Note that DynaLoader is always built and need not be mentioned here.
9c839522 21316
b4eb6b3d
JH
21317EOM
21318 case "$static_ext" in
21319 '') dflt="$avail_ext" ;;
21320 *) dflt="$static_ext"
21321 # Perhaps we are reusing an old out-of-date config.sh.
21322 case "$hint" in
21323 previous)
21324 if test X"$static_ext" != X"$avail_ext"; then
21325 $cat <<EOM
7c345082
RGS
21326NOTICE: Your previous config.sh list may be incorrect.
21327The extensions now available to you are
b4eb6b3d
JH
21328 ${avail_ext}
21329but the default list from your previous config.sh is
7c345082 21330 ${static_ext}
5f80c64f
JH
21331
21332EOM
b4eb6b3d
JH
21333 fi
21334 ;;
21335 esac
21336 ;;
21337 esac
21338 : Exclude those that are not xs extensions
21339 case "$dflt" in
21340 '') dflt=none;;
21341 esac
21342 rp="What extensions do you wish to include?"
21343 . ./myread
21344 case "$ans" in
21345 none) static_ext=' ' ;;
21346 *) static_ext="$ans" ;;
21347 esac
21348 ;;
5f80c64f 21349esac
7c345082 21350#
f1f6834f
AD
21351# Encode is a special case. If we are building Encode as a static
21352# extension, we need to explicitly list its subextensions as well.
21353# For other nested extensions, this is handled automatically by
21354# the appropriate Makefile.PL.
21355case " $static_ext " in
21356 *" Encode "*) # Add the subextensions of Encode
21357 cd "$rsrc/ext"
21358 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21359 static_ext="$static_ext Encode/$xxx"
21360 done
21361 cd "$tdir"
21362 ;;
21363esac
5f80c64f 21364
b4eb6b3d
JH
21365set X $dynamic_ext $static_ext $nonxs_ext
21366shift
21367extensions="$*"
21368
93a2cd18
AD
21369# Sanity check: We require an extension suitable for use with
21370# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
21371# should show up as failures in the test suite, but it's helpful to
21372# catch them now.) The 'extensions' list is normally sorted
21373# alphabetically, so we need to accept either
21374# DB_File ... Fcntl ... IO ....
21375# or something like
21376# Fcntl ... NDBM_File ... IO ....
42fde7b2
JH
21377case " $extensions" in
21378*"_File "*" Fcntl "*" IO "*) ;; # DB_File
21379*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21380*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
7a8675bc
JH
21381*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21382 echo "WARNING: The Perl you are building will be quite crippled." >& 4
21383 ;;
21384esac
21385
9c839522
PM
21386: Remove libraries needed only for extensions
21387: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
21388: The exception is SunOS 4.x, which needs them.
21389case "${osname}X${osvers}" in
21390sunos*X4*)
21391 perllibs="$libs"
21392 ;;
21393*) case "$usedl" in
21394 $define|true|[yY]*)
21395 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
21396 shift
21397 perllibs="$*"
21398 ;;
21399 *) perllibs="$libs"
21400 ;;
21401 esac
21402 ;;
9c839522 21403esac
5f80c64f
JH
21404
21405: Remove build directory name from cppstdin so it can be used from
21406: either the present location or the final installed location.
21407echo " "
21408: Get out of the UU directory to get correct path name.
21409cd ..
21410case "$cppstdin" in
21411`pwd`/cppstdin)
21412 echo "Stripping down cppstdin path name"
21413 cppstdin=cppstdin
21414 ;;
21415esac
21416cd UU
21417
21418: end of configuration questions
21419echo " "
21420echo "End of configuration questions."
21421echo " "
21422
21423: back to where it started
21424if test -d ../UU; then
21425 cd ..
21426fi
21427
48370efc
JH
21428: configuration may be patched via a 'config.arch' file
21429if $test -f config.arch; then
21430 echo "I see a config.arch file, loading it."
21431 . ./config.arch
21432fi
21433
5f80c64f
JH
21434: configuration may be patched via a 'config.over' file
21435if $test -f config.over; then
21436 echo " "
21437 dflt=y
21438 rp='I see a config.over file. Do you wish to load it?'
21439 . UU/myread
21440 case "$ans" in
21441 n*) echo "OK, I'll ignore it.";;
21442 *) . ./config.over
21443 echo "Configuration override changes have been loaded."
21444 ;;
21445 esac
21446fi
21447
21448: in case they want portability, strip down executable paths
21449case "$d_portable" in
21450"$define")
21451 echo " "
21452 echo "Stripping down executable paths..." >&4
21453 for file in $loclist $trylist; do
534ac15a
JH
21454 eval temp=\$$file
21455 eval $file=`basename $temp`
5f80c64f
JH
21456 done
21457 ;;
21458esac
21459
21460: create config.sh file
21461echo " "
21462echo "Creating config.sh..." >&4
21463$spitshell <<EOT >config.sh
21464$startsh
21465#
21466# This file was produced by running the Configure script. It holds all the
21467# definitions figured out by Configure. Should you modify one of these values,
21468# do not forget to propagate your changes by running "Configure -der". You may
21469# instead choose to run each of the .SH files by yourself, or "Configure -S".
21470#
21471
21472# Package name : $package
21473# Source directory : $src
21474# Configuration time: $cf_time
21475# Configured by : $cf_by
21476# Target system : $myuname
21477
21478Author='$Author'
21479Date='$Date'
21480Header='$Header'
21481Id='$Id'
21482Locker='$Locker'
21483Log='$Log'
21484Mcc='$Mcc'
21485RCSfile='$RCSfile'
21486Revision='$Revision'
21487Source='$Source'
21488State='$State'
21489_a='$_a'
21490_exe='$_exe'
21491_o='$_o'
b4eb6b3d 21492afs='$afs'
a6d26a0d 21493afsroot='$afsroot'
b4eb6b3d
JH
21494alignbytes='$alignbytes'
21495ansi2knr='$ansi2knr'
21496aphostname='$aphostname'
21497api_revision='$api_revision'
21498api_subversion='$api_subversion'
21499api_version='$api_version'
21500api_versionstring='$api_versionstring'
5f80c64f 21501ar='$ar'
b4eb6b3d
JH
21502archlib='$archlib'
21503archlibexp='$archlibexp'
21504archname64='$archname64'
21505archname='$archname'
5f80c64f 21506archobjs='$archobjs'
10bc17b6 21507asctime_r_proto='$asctime_r_proto'
5f80c64f 21508awk='$awk'
b4eb6b3d 21509baserev='$baserev'
5f80c64f 21510bash='$bash'
b4eb6b3d 21511bin='$bin'
b4eb6b3d 21512binexp='$binexp'
5f80c64f
JH
21513bison='$bison'
21514byacc='$byacc'
b4eb6b3d 21515byteorder='$byteorder'
5f80c64f 21516c='$c'
b4eb6b3d 21517castflags='$castflags'
5f80c64f
JH
21518cat='$cat'
21519cc='$cc'
21520cccdlflags='$cccdlflags'
21521ccdlflags='$ccdlflags'
21522ccflags='$ccflags'
b4eb6b3d 21523ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 21524ccname='$ccname'
b4eb6b3d 21525ccsymbols='$ccsymbols'
6b356c8e 21526ccversion='$ccversion'
5f80c64f 21527cf_by='$cf_by'
b4eb6b3d 21528cf_email='$cf_email'
5f80c64f 21529cf_time='$cf_time'
b4eb6b3d 21530charsize='$charsize'
5f80c64f
JH
21531chgrp='$chgrp'
21532chmod='$chmod'
21533chown='$chown'
b4eb6b3d 21534clocktype='$clocktype'
5f80c64f
JH
21535comm='$comm'
21536compress='$compress'
21537contains='$contains'
21538cp='$cp'
21539cpio='$cpio'
21540cpp='$cpp'
b4eb6b3d
JH
21541cpp_stuff='$cpp_stuff'
21542cppccsymbols='$cppccsymbols'
5f80c64f
JH
21543cppflags='$cppflags'
21544cpplast='$cpplast'
21545cppminus='$cppminus'
21546cpprun='$cpprun'
21547cppstdin='$cppstdin'
b4eb6b3d 21548cppsymbols='$cppsymbols'
10bc17b6 21549crypt_r_proto='$crypt_r_proto'
b4eb6b3d 21550cryptlib='$cryptlib'
5f80c64f 21551csh='$csh'
10bc17b6
JH
21552ctermid_r_proto='$ctermid_r_proto'
21553ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
21554d_Gconvert='$d_Gconvert'
21555d_PRIEUldbl='$d_PRIEUldbl'
21556d_PRIFUldbl='$d_PRIFUldbl'
21557d_PRIGUldbl='$d_PRIGUldbl'
21558d_PRIXU64='$d_PRIXU64'
21559d_PRId64='$d_PRId64'
21560d_PRIeldbl='$d_PRIeldbl'
21561d_PRIfldbl='$d_PRIfldbl'
21562d_PRIgldbl='$d_PRIgldbl'
21563d_PRIi64='$d_PRIi64'
21564d_PRIo64='$d_PRIo64'
21565d_PRIu64='$d_PRIu64'
21566d_PRIx64='$d_PRIx64'
21567d_SCNfldbl='$d_SCNfldbl'
74cac757 21568d__fwalk='$d__fwalk'
b4eb6b3d
JH
21569d_access='$d_access'
21570d_accessx='$d_accessx'
55954f19 21571d_aintl='$d_aintl'
b4eb6b3d
JH
21572d_alarm='$d_alarm'
21573d_archlib='$d_archlib'
10bc17b6 21574d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
21575d_atolf='$d_atolf'
21576d_atoll='$d_atoll'
0dbb1585
AL
21577d_attribute_format='$d_attribute_format'
21578d_attribute_malloc='$d_attribute_malloc'
21579d_attribute_nonnull='$d_attribute_nonnull'
21580d_attribute_noreturn='$d_attribute_noreturn'
21581d_attribute_pure='$d_attribute_pure'
21582d_attribute_unused='$d_attribute_unused'
21583d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
b4eb6b3d
JH
21584d_bcmp='$d_bcmp'
21585d_bcopy='$d_bcopy'
5f80c64f 21586d_bsd='$d_bsd'
b4eb6b3d
JH
21587d_bsdgetpgrp='$d_bsdgetpgrp'
21588d_bsdsetpgrp='$d_bsdsetpgrp'
635aebb7
AL
21589d_builtin_choose_expr='$d_builtin_choose_expr'
21590d_builtin_expect='$d_builtin_expect'
b4eb6b3d 21591d_bzero='$d_bzero'
a2d23ec2 21592d_c99_variadic_macros='$d_c99_variadic_macros'
b4eb6b3d
JH
21593d_casti32='$d_casti32'
21594d_castneg='$d_castneg'
21595d_charvspr='$d_charvspr'
21596d_chown='$d_chown'
21597d_chroot='$d_chroot'
21598d_chsize='$d_chsize'
758a5d79 21599d_class='$d_class'
b0a2e8e6 21600d_clearenv='$d_clearenv'
b4eb6b3d 21601d_closedir='$d_closedir'
4e0554ec 21602d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 21603d_const='$d_const'
55954f19 21604d_copysignl='$d_copysignl'
666ea192 21605d_cplusplus='$d_cplusplus'
b4eb6b3d 21606d_crypt='$d_crypt'
10bc17b6 21607d_crypt_r='$d_crypt_r'
b4eb6b3d 21608d_csh='$d_csh'
13cfc98d 21609d_ctermid='$d_ctermid'
10bc17b6
JH
21610d_ctermid_r='$d_ctermid_r'
21611d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
21612d_cuserid='$d_cuserid'
21613d_dbl_dig='$d_dbl_dig'
2ef53570 21614d_dbminitproto='$d_dbminitproto'
b4eb6b3d 21615d_difftime='$d_difftime'
de52168c 21616d_dir_dd_fd='$d_dir_dd_fd'
ae0e3d3b 21617d_dirfd='$d_dirfd'
b4eb6b3d
JH
21618d_dirnamlen='$d_dirnamlen'
21619d_dlerror='$d_dlerror'
5f80c64f 21620d_dlopen='$d_dlopen'
b4eb6b3d
JH
21621d_dlsymun='$d_dlsymun'
21622d_dosuid='$d_dosuid'
10bc17b6 21623d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
21624d_drand48proto='$d_drand48proto'
21625d_dup2='$d_dup2'
21626d_eaccess='$d_eaccess'
21627d_endgrent='$d_endgrent'
10bc17b6 21628d_endgrent_r='$d_endgrent_r'
b4eb6b3d 21629d_endhent='$d_endhent'
10bc17b6 21630d_endhostent_r='$d_endhostent_r'
b4eb6b3d 21631d_endnent='$d_endnent'
10bc17b6 21632d_endnetent_r='$d_endnetent_r'
b4eb6b3d 21633d_endpent='$d_endpent'
10bc17b6 21634d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 21635d_endpwent='$d_endpwent'
10bc17b6 21636d_endpwent_r='$d_endpwent_r'
b4eb6b3d 21637d_endsent='$d_endsent'
10bc17b6 21638d_endservent_r='$d_endservent_r'
b4eb6b3d 21639d_eofnblk='$d_eofnblk'
5f80c64f 21640d_eunice='$d_eunice'
15b61c98 21641d_faststdio='$d_faststdio'
b363b713 21642d_fchdir='$d_fchdir'
b4eb6b3d
JH
21643d_fchmod='$d_fchmod'
21644d_fchown='$d_fchown'
21645d_fcntl='$d_fcntl'
9d9004a9 21646d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
21647d_fd_macros='$d_fd_macros'
21648d_fd_set='$d_fd_set'
21649d_fds_bits='$d_fds_bits'
21650d_fgetpos='$d_fgetpos'
758a5d79
JH
21651d_finite='$d_finite'
21652d_finitel='$d_finitel'
b4eb6b3d
JH
21653d_flexfnam='$d_flexfnam'
21654d_flock='$d_flock'
2ef53570 21655d_flockproto='$d_flockproto'
b4eb6b3d 21656d_fork='$d_fork'
758a5d79 21657d_fp_class='$d_fp_class'
b4eb6b3d 21658d_fpathconf='$d_fpathconf'
758a5d79
JH
21659d_fpclass='$d_fpclass'
21660d_fpclassify='$d_fpclassify'
21661d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
21662d_fpos64_t='$d_fpos64_t'
21663d_frexpl='$d_frexpl'
21664d_fs_data_s='$d_fs_data_s'
21665d_fseeko='$d_fseeko'
21666d_fsetpos='$d_fsetpos'
21667d_fstatfs='$d_fstatfs'
21668d_fstatvfs='$d_fstatvfs'
411ab01c 21669d_fsync='$d_fsync'
b4eb6b3d
JH
21670d_ftello='$d_ftello'
21671d_ftime='$d_ftime'
dc814df1 21672d_futimes='$d_futimes'
b4eb6b3d
JH
21673d_getcwd='$d_getcwd'
21674d_getespwnam='$d_getespwnam'
21675d_getfsstat='$d_getfsstat'
21676d_getgrent='$d_getgrent'
10bc17b6
JH
21677d_getgrent_r='$d_getgrent_r'
21678d_getgrgid_r='$d_getgrgid_r'
21679d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
21680d_getgrps='$d_getgrps'
21681d_gethbyaddr='$d_gethbyaddr'
21682d_gethbyname='$d_gethbyname'
21683d_gethent='$d_gethent'
21684d_gethname='$d_gethname'
10bc17b6
JH
21685d_gethostbyaddr_r='$d_gethostbyaddr_r'
21686d_gethostbyname_r='$d_gethostbyname_r'
21687d_gethostent_r='$d_gethostent_r'
b4eb6b3d 21688d_gethostprotos='$d_gethostprotos'
4e0554ec 21689d_getitimer='$d_getitimer'
b4eb6b3d 21690d_getlogin='$d_getlogin'
10bc17b6 21691d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
21692d_getmnt='$d_getmnt'
21693d_getmntent='$d_getmntent'
21694d_getnbyaddr='$d_getnbyaddr'
21695d_getnbyname='$d_getnbyname'
21696d_getnent='$d_getnent'
10bc17b6
JH
21697d_getnetbyaddr_r='$d_getnetbyaddr_r'
21698d_getnetbyname_r='$d_getnetbyname_r'
21699d_getnetent_r='$d_getnetent_r'
b4eb6b3d 21700d_getnetprotos='$d_getnetprotos'
0c0643d0 21701d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
21702d_getpbyname='$d_getpbyname'
21703d_getpbynumber='$d_getpbynumber'
21704d_getpent='$d_getpent'
21705d_getpgid='$d_getpgid'
21706d_getpgrp2='$d_getpgrp2'
21707d_getpgrp='$d_getpgrp'
21708d_getppid='$d_getppid'
21709d_getprior='$d_getprior'
10bc17b6
JH
21710d_getprotobyname_r='$d_getprotobyname_r'
21711d_getprotobynumber_r='$d_getprotobynumber_r'
21712d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
21713d_getprotoprotos='$d_getprotoprotos'
21714d_getprpwnam='$d_getprpwnam'
21715d_getpwent='$d_getpwent'
10bc17b6
JH
21716d_getpwent_r='$d_getpwent_r'
21717d_getpwnam_r='$d_getpwnam_r'
21718d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
21719d_getsbyname='$d_getsbyname'
21720d_getsbyport='$d_getsbyport'
21721d_getsent='$d_getsent'
10bc17b6
JH
21722d_getservbyname_r='$d_getservbyname_r'
21723d_getservbyport_r='$d_getservbyport_r'
21724d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
21725d_getservprotos='$d_getservprotos'
21726d_getspnam='$d_getspnam'
10bc17b6 21727d_getspnam_r='$d_getspnam_r'
b4eb6b3d 21728d_gettimeod='$d_gettimeod'
10bc17b6 21729d_gmtime_r='$d_gmtime_r'
5f80c64f 21730d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
21731d_grpasswd='$d_grpasswd'
21732d_hasmntopt='$d_hasmntopt'
21733d_htonl='$d_htonl'
55954f19 21734d_ilogbl='$d_ilogbl'
f3f1a2d8 21735d_inc_version_list='$d_inc_version_list'
b4eb6b3d
JH
21736d_index='$d_index'
21737d_inetaton='$d_inetaton'
21738d_int64_t='$d_int64_t'
21739d_isascii='$d_isascii'
758a5d79
JH
21740d_isfinite='$d_isfinite'
21741d_isinf='$d_isinf'
b4eb6b3d
JH
21742d_isnan='$d_isnan'
21743d_isnanl='$d_isnanl'
21744d_killpg='$d_killpg'
21745d_lchown='$d_lchown'
21746d_ldbl_dig='$d_ldbl_dig'
0a0abfba 21747d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 21748d_link='$d_link'
10bc17b6 21749d_localtime_r='$d_localtime_r'
8572b25d 21750d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
b4eb6b3d
JH
21751d_locconv='$d_locconv'
21752d_lockf='$d_lockf'
21753d_longdbl='$d_longdbl'
21754d_longlong='$d_longlong'
21755d_lseekproto='$d_lseekproto'
21756d_lstat='$d_lstat'
21757d_madvise='$d_madvise'
7dd121ae
MB
21758d_malloc_good_size='$d_malloc_good_size'
21759d_malloc_size='$d_malloc_size'
b4eb6b3d
JH
21760d_mblen='$d_mblen'
21761d_mbstowcs='$d_mbstowcs'
21762d_mbtowc='$d_mbtowc'
21763d_memchr='$d_memchr'
21764d_memcmp='$d_memcmp'
21765d_memcpy='$d_memcpy'
21766d_memmove='$d_memmove'
21767d_memset='$d_memset'
21768d_mkdir='$d_mkdir'
21769d_mkdtemp='$d_mkdtemp'
21770d_mkfifo='$d_mkfifo'
21771d_mkstemp='$d_mkstemp'
21772d_mkstemps='$d_mkstemps'
21773d_mktime='$d_mktime'
21774d_mmap='$d_mmap'
21775d_modfl='$d_modfl'
e67aeab1 21776d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 21777d_modflproto='$d_modflproto'
b4eb6b3d
JH
21778d_mprotect='$d_mprotect'
21779d_msg='$d_msg'
21780d_msg_ctrunc='$d_msg_ctrunc'
21781d_msg_dontroute='$d_msg_dontroute'
21782d_msg_oob='$d_msg_oob'
21783d_msg_peek='$d_msg_peek'
21784d_msg_proxy='$d_msg_proxy'
21785d_msgctl='$d_msgctl'
21786d_msgget='$d_msgget'
4e0554ec 21787d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
21788d_msgrcv='$d_msgrcv'
21789d_msgsnd='$d_msgsnd'
21790d_msync='$d_msync'
21791d_munmap='$d_munmap'
21792d_mymalloc='$d_mymalloc'
21793d_nice='$d_nice'
2765b840 21794d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 21795d_nv_preserves_uv='$d_nv_preserves_uv'
f607920a 21796d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
b4eb6b3d
JH
21797d_off64_t='$d_off64_t'
21798d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21799d_oldpthreads='$d_oldpthreads'
21800d_oldsock='$d_oldsock'
21801d_open3='$d_open3'
21802d_pathconf='$d_pathconf'
21803d_pause='$d_pause'
21804d_perl_otherlibdirs='$d_perl_otherlibdirs'
21805d_phostname='$d_phostname'
21806d_pipe='$d_pipe'
21807d_poll='$d_poll'
5f80c64f 21808d_portable='$d_portable'
dcb594bc 21809d_printf_format_null='$d_printf_format_null'
c7aff470 21810d_procselfexe='$d_procselfexe'
233e16ce 21811d_pseudofork='$d_pseudofork'
d6483fcc 21812d_pthread_atfork='$d_pthread_atfork'
58d975c3 21813d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
21814d_pthread_yield='$d_pthread_yield'
21815d_pwage='$d_pwage'
21816d_pwchange='$d_pwchange'
21817d_pwclass='$d_pwclass'
21818d_pwcomment='$d_pwcomment'
21819d_pwexpire='$d_pwexpire'
21820d_pwgecos='$d_pwgecos'
21821d_pwpasswd='$d_pwpasswd'
21822d_pwquota='$d_pwquota'
21823d_qgcvt='$d_qgcvt'
21824d_quad='$d_quad'
10bc17b6
JH
21825d_random_r='$d_random_r'
21826d_readdir64_r='$d_readdir64_r'
b4eb6b3d 21827d_readdir='$d_readdir'
10bc17b6 21828d_readdir_r='$d_readdir_r'
b4eb6b3d 21829d_readlink='$d_readlink'
4e0554ec
JH
21830d_readv='$d_readv'
21831d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
21832d_rename='$d_rename'
21833d_rewinddir='$d_rewinddir'
21834d_rmdir='$d_rmdir'
21835d_safebcpy='$d_safebcpy'
21836d_safemcpy='$d_safemcpy'
21837d_sanemcmp='$d_sanemcmp'
ef9f17be 21838d_sbrkproto='$d_sbrkproto'
55954f19 21839d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
21840d_sched_yield='$d_sched_yield'
21841d_scm_rights='$d_scm_rights'
21842d_seekdir='$d_seekdir'
21843d_select='$d_select'
21844d_sem='$d_sem'
21845d_semctl='$d_semctl'
21846d_semctl_semid_ds='$d_semctl_semid_ds'
21847d_semctl_semun='$d_semctl_semun'
21848d_semget='$d_semget'
21849d_semop='$d_semop'
4e0554ec 21850d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
21851d_setegid='$d_setegid'
21852d_seteuid='$d_seteuid'
21853d_setgrent='$d_setgrent'
10bc17b6 21854d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
21855d_setgrps='$d_setgrps'
21856d_sethent='$d_sethent'
10bc17b6 21857d_sethostent_r='$d_sethostent_r'
4e0554ec 21858d_setitimer='$d_setitimer'
b4eb6b3d
JH
21859d_setlinebuf='$d_setlinebuf'
21860d_setlocale='$d_setlocale'
10bc17b6 21861d_setlocale_r='$d_setlocale_r'
b4eb6b3d 21862d_setnent='$d_setnent'
10bc17b6 21863d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
21864d_setpent='$d_setpent'
21865d_setpgid='$d_setpgid'
21866d_setpgrp2='$d_setpgrp2'
21867d_setpgrp='$d_setpgrp'
21868d_setprior='$d_setprior'
21869d_setproctitle='$d_setproctitle'
10bc17b6 21870d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 21871d_setpwent='$d_setpwent'
10bc17b6 21872d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
21873d_setregid='$d_setregid'
21874d_setresgid='$d_setresgid'
21875d_setresuid='$d_setresuid'
21876d_setreuid='$d_setreuid'
21877d_setrgid='$d_setrgid'
21878d_setruid='$d_setruid'
21879d_setsent='$d_setsent'
10bc17b6 21880d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
21881d_setsid='$d_setsid'
21882d_setvbuf='$d_setvbuf'
21883d_sfio='$d_sfio'
21884d_shm='$d_shm'
21885d_shmat='$d_shmat'
21886d_shmatprototype='$d_shmatprototype'
21887d_shmctl='$d_shmctl'
21888d_shmdt='$d_shmdt'
21889d_shmget='$d_shmget'
21890d_sigaction='$d_sigaction'
ed140128 21891d_signbit='$d_signbit'
983dbef6 21892d_sigprocmask='$d_sigprocmask'
b4eb6b3d 21893d_sigsetjmp='$d_sigsetjmp'
c95d0e17 21894d_sitearch='$d_sitearch'
4f5da3e9 21895d_snprintf='$d_snprintf'
49a78c82 21896d_sockatmark='$d_sockatmark'
2ef53570 21897d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
21898d_socket='$d_socket'
21899d_socklen_t='$d_socklen_t'
21900d_sockpair='$d_sockpair'
21901d_socks5_init='$d_socks5_init'
360321b3 21902d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
b4eb6b3d 21903d_sqrtl='$d_sqrtl'
10bc17b6
JH
21904d_srand48_r='$d_srand48_r'
21905d_srandom_r='$d_srandom_r'
eef837ea 21906d_sresgproto='$d_sresgproto'
640374d0 21907d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
21908d_statblks='$d_statblks'
21909d_statfs_f_flags='$d_statfs_f_flags'
21910d_statfs_s='$d_statfs_s'
21911d_statvfs='$d_statvfs'
21912d_stdio_cnt_lval='$d_stdio_cnt_lval'
21913d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
21914d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21915d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
21916d_stdio_stream_array='$d_stdio_stream_array'
21917d_stdiobase='$d_stdiobase'
21918d_stdstdio='$d_stdstdio'
21919d_strchr='$d_strchr'
21920d_strcoll='$d_strcoll'
21921d_strctcpy='$d_strctcpy'
21922d_strerrm='$d_strerrm'
21923d_strerror='$d_strerror'
10bc17b6 21924d_strerror_r='$d_strerror_r'
b3c85772 21925d_strftime='$d_strftime'
08c92000
MB
21926d_strlcat='$d_strlcat'
21927d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
21928d_strtod='$d_strtod'
21929d_strtol='$d_strtol'
21930d_strtold='$d_strtold'
21931d_strtoll='$d_strtoll'
28e5dec8 21932d_strtoq='$d_strtoq'
b4eb6b3d
JH
21933d_strtoul='$d_strtoul'
21934d_strtoull='$d_strtoull'
21935d_strtouq='$d_strtouq'
21936d_strxfrm='$d_strxfrm'
21937d_suidsafe='$d_suidsafe'
21938d_symlink='$d_symlink'
21939d_syscall='$d_syscall'
2ef53570 21940d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
21941d_sysconf='$d_sysconf'
21942d_sysernlst='$d_sysernlst'
21943d_syserrlst='$d_syserrlst'
21944d_system='$d_system'
21945d_tcgetpgrp='$d_tcgetpgrp'
21946d_tcsetpgrp='$d_tcsetpgrp'
21947d_telldir='$d_telldir'
21948d_telldirproto='$d_telldirproto'
21949d_time='$d_time'
21950d_times='$d_times'
14b90194
JH
21951d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21952d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 21953d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 21954d_truncate='$d_truncate'
10bc17b6 21955d_ttyname_r='$d_ttyname_r'
b4eb6b3d 21956d_tzname='$d_tzname'
4e0554ec
JH
21957d_u32align='$d_u32align'
21958d_ualarm='$d_ualarm'
b4eb6b3d
JH
21959d_umask='$d_umask'
21960d_uname='$d_uname'
21961d_union_semun='$d_union_semun'
758a5d79 21962d_unordered='$d_unordered'
bdf33aa7 21963d_unsetenv='$d_unsetenv'
4e0554ec 21964d_usleep='$d_usleep'
2ef53570 21965d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
21966d_ustat='$d_ustat'
21967d_vendorarch='$d_vendorarch'
21968d_vendorbin='$d_vendorbin'
21969d_vendorlib='$d_vendorlib'
6e1038e0 21970d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
21971d_vfork='$d_vfork'
21972d_void_closedir='$d_void_closedir'
21973d_voidsig='$d_voidsig'
21974d_voidtty='$d_voidtty'
21975d_volatile='$d_volatile'
21976d_vprintf='$d_vprintf'
4f5da3e9 21977d_vsnprintf='$d_vsnprintf'
b4eb6b3d
JH
21978d_wait4='$d_wait4'
21979d_waitpid='$d_waitpid'
21980d_wcstombs='$d_wcstombs'
21981d_wctomb='$d_wctomb'
4e0554ec 21982d_writev='$d_writev'
5f80c64f
JH
21983d_xenix='$d_xenix'
21984date='$date'
b4eb6b3d
JH
21985db_hashtype='$db_hashtype'
21986db_prefixtype='$db_prefixtype'
640374d0
JH
21987db_version_major='$db_version_major'
21988db_version_minor='$db_version_minor'
21989db_version_patch='$db_version_patch'
b4eb6b3d
JH
21990defvoidused='$defvoidused'
21991direntrytype='$direntrytype'
21992dlext='$dlext'
5f80c64f 21993dlsrc='$dlsrc'
b4eb6b3d
JH
21994doublesize='$doublesize'
21995drand01='$drand01'
10bc17b6 21996drand48_r_proto='$drand48_r_proto'
b4eb6b3d
JH
21997dynamic_ext='$dynamic_ext'
21998eagain='$eagain'
21999ebcdic='$ebcdic'
5f80c64f
JH
22000echo='$echo'
22001egrep='$egrep'
22002emacs='$emacs'
10bc17b6
JH
22003endgrent_r_proto='$endgrent_r_proto'
22004endhostent_r_proto='$endhostent_r_proto'
22005endnetent_r_proto='$endnetent_r_proto'
22006endprotoent_r_proto='$endprotoent_r_proto'
22007endpwent_r_proto='$endpwent_r_proto'
22008endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
22009eunicefix='$eunicefix'
22010exe_ext='$exe_ext'
22011expr='$expr'
b4eb6b3d 22012extensions='$extensions'
6fcddf3b 22013extras='$extras'
b4eb6b3d
JH
22014fflushNULL='$fflushNULL'
22015fflushall='$fflushall'
5f80c64f
JH
22016find='$find'
22017firstmakefile='$firstmakefile'
22018flex='$flex'
b4eb6b3d
JH
22019fpossize='$fpossize'
22020fpostype='$fpostype'
22021freetype='$freetype'
5440bc8e 22022from='$from'
b4eb6b3d
JH
22023full_ar='$full_ar'
22024full_csh='$full_csh'
22025full_sed='$full_sed'
2d736872 22026gccansipedantic='$gccansipedantic'
5b463ca7 22027gccosandvers='$gccosandvers'
5f80c64f 22028gccversion='$gccversion'
10bc17b6
JH
22029getgrent_r_proto='$getgrent_r_proto'
22030getgrgid_r_proto='$getgrgid_r_proto'
22031getgrnam_r_proto='$getgrnam_r_proto'
22032gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22033gethostbyname_r_proto='$gethostbyname_r_proto'
22034gethostent_r_proto='$gethostent_r_proto'
22035getlogin_r_proto='$getlogin_r_proto'
22036getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22037getnetbyname_r_proto='$getnetbyname_r_proto'
22038getnetent_r_proto='$getnetent_r_proto'
22039getprotobyname_r_proto='$getprotobyname_r_proto'
22040getprotobynumber_r_proto='$getprotobynumber_r_proto'
22041getprotoent_r_proto='$getprotoent_r_proto'
22042getpwent_r_proto='$getpwent_r_proto'
22043getpwnam_r_proto='$getpwnam_r_proto'
22044getpwuid_r_proto='$getpwuid_r_proto'
22045getservbyname_r_proto='$getservbyname_r_proto'
22046getservbyport_r_proto='$getservbyport_r_proto'
22047getservent_r_proto='$getservent_r_proto'
22048getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
22049gidformat='$gidformat'
22050gidsign='$gidsign'
22051gidsize='$gidsize'
22052gidtype='$gidtype'
5f80c64f 22053glibpth='$glibpth'
3c728e00 22054gmake='$gmake'
10bc17b6 22055gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 22056gnulibc_version='$gnulibc_version'
5f80c64f 22057grep='$grep'
b4eb6b3d
JH
22058groupcat='$groupcat'
22059groupstype='$groupstype'
5f80c64f 22060gzip='$gzip'
b4eb6b3d
JH
22061h_fcntl='$h_fcntl'
22062h_sysfile='$h_sysfile'
5f80c64f 22063hint='$hint'
b4eb6b3d 22064hostcat='$hostcat'
6e1038e0
MB
22065html1dir='$html1dir'
22066html1direxp='$html1direxp'
22067html3dir='$html3dir'
22068html3direxp='$html3direxp'
b4eb6b3d
JH
22069i16size='$i16size'
22070i16type='$i16type'
22071i32size='$i32size'
22072i32type='$i32type'
22073i64size='$i64size'
22074i64type='$i64type'
22075i8size='$i8size'
22076i8type='$i8type'
22077i_arpainet='$i_arpainet'
22078i_bsdioctl='$i_bsdioctl'
10bc17b6 22079i_crypt='$i_crypt'
b4eb6b3d
JH
22080i_db='$i_db'
22081i_dbm='$i_dbm'
22082i_dirent='$i_dirent'
5f80c64f 22083i_dld='$i_dld'
b4eb6b3d
JH
22084i_dlfcn='$i_dlfcn'
22085i_fcntl='$i_fcntl'
22086i_float='$i_float'
758a5d79
JH
22087i_fp='$i_fp'
22088i_fp_class='$i_fp_class'
b4eb6b3d
JH
22089i_gdbm='$i_gdbm'
22090i_grp='$i_grp'
b4eb6b3d
JH
22091i_ieeefp='$i_ieeefp'
22092i_inttypes='$i_inttypes'
2765b840 22093i_langinfo='$i_langinfo'
b4eb6b3d
JH
22094i_libutil='$i_libutil'
22095i_limits='$i_limits'
22096i_locale='$i_locale'
22097i_machcthr='$i_machcthr'
22098i_malloc='$i_malloc'
22099i_math='$i_math'
22100i_memory='$i_memory'
22101i_mntent='$i_mntent'
22102i_ndbm='$i_ndbm'
22103i_netdb='$i_netdb'
22104i_neterrno='$i_neterrno'
22105i_netinettcp='$i_netinettcp'
22106i_niin='$i_niin'
22107i_poll='$i_poll'
22108i_prot='$i_prot'
22109i_pthread='$i_pthread'
22110i_pwd='$i_pwd'
22111i_rpcsvcdbm='$i_rpcsvcdbm'
22112i_sfio='$i_sfio'
22113i_sgtty='$i_sgtty'
22114i_shadow='$i_shadow'
22115i_socks='$i_socks'
22116i_stdarg='$i_stdarg'
22117i_stddef='$i_stddef'
22118i_stdlib='$i_stdlib'
22119i_string='$i_string'
22120i_sunmath='$i_sunmath'
22121i_sysaccess='$i_sysaccess'
22122i_sysdir='$i_sysdir'
22123i_sysfile='$i_sysfile'
22124i_sysfilio='$i_sysfilio'
22125i_sysin='$i_sysin'
22126i_sysioctl='$i_sysioctl'
22127i_syslog='$i_syslog'
22128i_sysmman='$i_sysmman'
22129i_sysmode='$i_sysmode'
22130i_sysmount='$i_sysmount'
22131i_sysndir='$i_sysndir'
22132i_sysparam='$i_sysparam'
22133i_sysresrc='$i_sysresrc'
22134i_syssecrt='$i_syssecrt'
22135i_sysselct='$i_sysselct'
22136i_syssockio='$i_syssockio'
22137i_sysstat='$i_sysstat'
22138i_sysstatfs='$i_sysstatfs'
22139i_sysstatvfs='$i_sysstatvfs'
22140i_systime='$i_systime'
22141i_systimek='$i_systimek'
22142i_systimes='$i_systimes'
22143i_systypes='$i_systypes'
22144i_sysuio='$i_sysuio'
22145i_sysun='$i_sysun'
22146i_sysutsname='$i_sysutsname'
22147i_sysvfs='$i_sysvfs'
22148i_syswait='$i_syswait'
22149i_termio='$i_termio'
22150i_termios='$i_termios'
22151i_time='$i_time'
22152i_unistd='$i_unistd'
22153i_ustat='$i_ustat'
22154i_utime='$i_utime'
22155i_values='$i_values'
22156i_varargs='$i_varargs'
22157i_varhdr='$i_varhdr'
22158i_vfork='$i_vfork'
5f80c64f 22159ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
22160inc_version_list='$inc_version_list'
22161inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
22162incpath='$incpath'
22163inews='$inews'
f3f1a2d8 22164initialinstalllocation='$initialinstalllocation'
b4eb6b3d
JH
22165installarchlib='$installarchlib'
22166installbin='$installbin'
6e1038e0
MB
22167installhtml1dir='$installhtml1dir'
22168installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
22169installman1dir='$installman1dir'
22170installman3dir='$installman3dir'
22171installprefix='$installprefix'
22172installprefixexp='$installprefixexp'
22173installprivlib='$installprivlib'
22174installscript='$installscript'
22175installsitearch='$installsitearch'
22176installsitebin='$installsitebin'
8d2cbf27
JH
22177installsitehtml1dir='$installsitehtml1dir'
22178installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 22179installsitelib='$installsitelib'
91e123a8
JH
22180installsiteman1dir='$installsiteman1dir'
22181installsiteman3dir='$installsiteman3dir'
6e1038e0 22182installsitescript='$installsitescript'
b4eb6b3d
JH
22183installstyle='$installstyle'
22184installusrbinperl='$installusrbinperl'
22185installvendorarch='$installvendorarch'
22186installvendorbin='$installvendorbin'
8d2cbf27
JH
22187installvendorhtml1dir='$installvendorhtml1dir'
22188installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 22189installvendorlib='$installvendorlib'
91e123a8
JH
22190installvendorman1dir='$installvendorman1dir'
22191installvendorman3dir='$installvendorman3dir'
6e1038e0 22192installvendorscript='$installvendorscript'
b4eb6b3d 22193intsize='$intsize'
4b661809 22194issymlink='$issymlink'
b4eb6b3d
JH
22195ivdformat='$ivdformat'
22196ivsize='$ivsize'
22197ivtype='$ivtype'
22198known_extensions='$known_extensions'
5f80c64f 22199ksh='$ksh'
5f80c64f
JH
22200ld='$ld'
22201lddlflags='$lddlflags'
22202ldflags='$ldflags'
b4eb6b3d
JH
22203ldflags_uselargefiles='$ldflags_uselargefiles'
22204ldlibpthname='$ldlibpthname'
5f80c64f
JH
22205less='$less'
22206lib_ext='$lib_ext'
22207libc='$libc'
b4eb6b3d 22208libperl='$libperl'
5f80c64f
JH
22209libpth='$libpth'
22210libs='$libs'
43999f95
JH
22211libsdirs='$libsdirs'
22212libsfiles='$libsfiles'
22213libsfound='$libsfound'
13b3f787 22214libspath='$libspath'
5f80c64f 22215libswanted='$libswanted'
b4eb6b3d 22216libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
22217line='$line'
22218lint='$lint'
22219lkflags='$lkflags'
22220ln='$ln'
22221lns='$lns'
10bc17b6 22222localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
22223locincpth='$locincpth'
22224loclibpth='$loclibpth'
b4eb6b3d
JH
22225longdblsize='$longdblsize'
22226longlongsize='$longlongsize'
22227longsize='$longsize'
5f80c64f
JH
22228lp='$lp'
22229lpr='$lpr'
22230ls='$ls'
b4eb6b3d
JH
22231lseeksize='$lseeksize'
22232lseektype='$lseektype'
a724edfe 22233mad='$mad'
f3f1a2d8
MB
22234madlyh='$madlyh'
22235madlyobj='$madlyobj'
22236madlysrc='$madlysrc'
5f80c64f
JH
22237mail='$mail'
22238mailx='$mailx'
22239make='$make'
22240make_set_make='$make_set_make'
b4eb6b3d
JH
22241mallocobj='$mallocobj'
22242mallocsrc='$mallocsrc'
22243malloctype='$malloctype'
22244man1dir='$man1dir'
22245man1direxp='$man1direxp'
22246man1ext='$man1ext'
22247man3dir='$man3dir'
22248man3direxp='$man3direxp'
22249man3ext='$man3ext'
5f80c64f 22250mips_type='$mips_type'
5129fff4 22251mistrustnm='$mistrustnm'
5f80c64f 22252mkdir='$mkdir'
b4eb6b3d
JH
22253mmaptype='$mmaptype'
22254modetype='$modetype'
5f80c64f 22255more='$more'
b4eb6b3d 22256multiarch='$multiarch'
5f80c64f 22257mv='$mv'
b4eb6b3d
JH
22258myarchname='$myarchname'
22259mydomain='$mydomain'
22260myhostname='$myhostname'
5f80c64f
JH
22261myuname='$myuname'
22262n='$n'
2cc61e15 22263need_va_copy='$need_va_copy'
b4eb6b3d
JH
22264netdb_hlen_type='$netdb_hlen_type'
22265netdb_host_type='$netdb_host_type'
22266netdb_name_type='$netdb_name_type'
22267netdb_net_type='$netdb_net_type'
5f80c64f
JH
22268nm='$nm'
22269nm_opt='$nm_opt'
22270nm_so_opt='$nm_so_opt'
b4eb6b3d 22271nonxs_ext='$nonxs_ext'
5f80c64f 22272nroff='$nroff'
b4eb6b3d
JH
22273nvEUformat='$nvEUformat'
22274nvFUformat='$nvFUformat'
22275nvGUformat='$nvGUformat'
53133ed1 22276nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
22277nveformat='$nveformat'
22278nvfformat='$nvfformat'
22279nvgformat='$nvgformat'
22280nvsize='$nvsize'
22281nvtype='$nvtype'
22282o_nonblock='$o_nonblock'
5f80c64f 22283obj_ext='$obj_ext'
b4eb6b3d 22284old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 22285optimize='$optimize'
b4eb6b3d 22286orderlib='$orderlib'
5f80c64f
JH
22287osname='$osname'
22288osvers='$osvers'
b4eb6b3d 22289otherlibdirs='$otherlibdirs'
5f80c64f 22290package='$package'
b4eb6b3d
JH
22291pager='$pager'
22292passcat='$passcat'
22293patchlevel='$patchlevel'
5f80c64f 22294path_sep='$path_sep'
b4eb6b3d 22295perl5='$perl5'
5f80c64f 22296perl='$perl'
151e6568 22297perl_patchlevel='$perl_patchlevel'
b4eb6b3d 22298perladmin='$perladmin'
9c839522 22299perllibs='$perllibs'
b4eb6b3d 22300perlpath='$perlpath'
5f80c64f 22301pg='$pg'
b4eb6b3d
JH
22302phostname='$phostname'
22303pidtype='$pidtype'
5f80c64f
JH
22304plibpth='$plibpth'
22305pmake='$pmake'
22306pr='$pr'
b4eb6b3d
JH
22307prefix='$prefix'
22308prefixexp='$prefixexp'
22309privlib='$privlib'
22310privlibexp='$privlibexp'
f24dbf84 22311procselfexe='$procselfexe'
b4eb6b3d
JH
22312prototype='$prototype'
22313ptrsize='$ptrsize'
22314quadkind='$quadkind'
22315quadtype='$quadtype'
22316randbits='$randbits'
22317randfunc='$randfunc'
10bc17b6 22318random_r_proto='$random_r_proto'
b4eb6b3d
JH
22319randseedtype='$randseedtype'
22320ranlib='$ranlib'
22321rd_nodata='$rd_nodata'
10bc17b6
JH
22322readdir64_r_proto='$readdir64_r_proto'
22323readdir_r_proto='$readdir_r_proto'
b4eb6b3d 22324revision='$revision'
5f80c64f
JH
22325rm='$rm'
22326rmail='$rmail'
5440bc8e 22327run='$run'
5f80c64f 22328runnm='$runnm'
b4eb6b3d
JH
22329sPRIEUldbl='$sPRIEUldbl'
22330sPRIFUldbl='$sPRIFUldbl'
22331sPRIGUldbl='$sPRIGUldbl'
22332sPRIXU64='$sPRIXU64'
22333sPRId64='$sPRId64'
22334sPRIeldbl='$sPRIeldbl'
22335sPRIfldbl='$sPRIfldbl'
22336sPRIgldbl='$sPRIgldbl'
22337sPRIi64='$sPRIi64'
22338sPRIo64='$sPRIo64'
22339sPRIu64='$sPRIu64'
22340sPRIx64='$sPRIx64'
22341sSCNfldbl='$sSCNfldbl'
22342sched_yield='$sched_yield'
22343scriptdir='$scriptdir'
22344scriptdirexp='$scriptdirexp'
5f80c64f 22345sed='$sed'
b4eb6b3d
JH
22346seedfunc='$seedfunc'
22347selectminbits='$selectminbits'
22348selecttype='$selecttype'
5f80c64f 22349sendmail='$sendmail'
10bc17b6
JH
22350setgrent_r_proto='$setgrent_r_proto'
22351sethostent_r_proto='$sethostent_r_proto'
22352setlocale_r_proto='$setlocale_r_proto'
22353setnetent_r_proto='$setnetent_r_proto'
22354setprotoent_r_proto='$setprotoent_r_proto'
22355setpwent_r_proto='$setpwent_r_proto'
22356setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
22357sh='$sh'
22358shar='$shar'
22359sharpbang='$sharpbang'
b4eb6b3d
JH
22360shmattype='$shmattype'
22361shortsize='$shortsize'
22362shrpenv='$shrpenv'
5f80c64f 22363shsharp='$shsharp'
b4eb6b3d
JH
22364sig_count='$sig_count'
22365sig_name='$sig_name'
22366sig_name_init='$sig_name_init'
22367sig_num='$sig_num'
22368sig_num_init='$sig_num_init'
76d3c696 22369sig_size='$sig_size'
b4eb6b3d
JH
22370signal_t='$signal_t'
22371sitearch='$sitearch'
22372sitearchexp='$sitearchexp'
22373sitebin='$sitebin'
22374sitebinexp='$sitebinexp'
8d2cbf27
JH
22375sitehtml1dir='$sitehtml1dir'
22376sitehtml1direxp='$sitehtml1direxp'
22377sitehtml3dir='$sitehtml3dir'
22378sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
22379sitelib='$sitelib'
22380sitelib_stem='$sitelib_stem'
22381sitelibexp='$sitelibexp'
91e123a8
JH
22382siteman1dir='$siteman1dir'
22383siteman1direxp='$siteman1direxp'
22384siteman3dir='$siteman3dir'
22385siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
22386siteprefix='$siteprefix'
22387siteprefixexp='$siteprefixexp'
6e1038e0
MB
22388sitescript='$sitescript'
22389sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
22390sizesize='$sizesize'
22391sizetype='$sizetype'
5f80c64f
JH
22392sleep='$sleep'
22393smail='$smail'
5f80c64f 22394so='$so'
b4eb6b3d
JH
22395sockethdr='$sockethdr'
22396socketlib='$socketlib'
22397socksizetype='$socksizetype'
5f80c64f
JH
22398sort='$sort'
22399spackage='$spackage'
22400spitshell='$spitshell'
10bc17b6
JH
22401srand48_r_proto='$srand48_r_proto'
22402srandom_r_proto='$srandom_r_proto'
5f80c64f 22403src='$src'
b4eb6b3d
JH
22404ssizetype='$ssizetype'
22405startperl='$startperl'
5f80c64f 22406startsh='$startsh'
b4eb6b3d
JH
22407static_ext='$static_ext'
22408stdchar='$stdchar'
22409stdio_base='$stdio_base'
22410stdio_bufsiz='$stdio_bufsiz'
22411stdio_cnt='$stdio_cnt'
22412stdio_filbuf='$stdio_filbuf'
22413stdio_ptr='$stdio_ptr'
22414stdio_stream_array='$stdio_stream_array'
10bc17b6 22415strerror_r_proto='$strerror_r_proto'
b4eb6b3d 22416strings='$strings'
5f80c64f 22417submit='$submit'
b4eb6b3d
JH
22418subversion='$subversion'
22419sysman='$sysman'
5f80c64f
JH
22420tail='$tail'
22421tar='$tar'
5440bc8e 22422targetarch='$targetarch'
5f80c64f
JH
22423tbl='$tbl'
22424tee='$tee'
22425test='$test'
b4eb6b3d
JH
22426timeincl='$timeincl'
22427timetype='$timetype'
10bc17b6 22428tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 22429to='$to'
5f80c64f
JH
22430touch='$touch'
22431tr='$tr'
22432trnl='$trnl'
22433troff='$troff'
10bc17b6 22434ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
22435u16size='$u16size'
22436u16type='$u16type'
22437u32size='$u32size'
22438u32type='$u32type'
22439u64size='$u64size'
22440u64type='$u64type'
22441u8size='$u8size'
22442u8type='$u8type'
22443uidformat='$uidformat'
22444uidsign='$uidsign'
22445uidsize='$uidsize'
22446uidtype='$uidtype'
5f80c64f
JH
22447uname='$uname'
22448uniq='$uniq'
b4eb6b3d
JH
22449uquadtype='$uquadtype'
22450use5005threads='$use5005threads'
22451use64bitall='$use64bitall'
22452use64bitint='$use64bitint'
5440bc8e 22453usecrosscompile='$usecrosscompile'
5f80c64f 22454usedl='$usedl'
15b61c98 22455usefaststdio='$usefaststdio'
b4eb6b3d
JH
22456useithreads='$useithreads'
22457uselargefiles='$uselargefiles'
22458uselongdouble='$uselongdouble'
19a100ff 22459usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
22460usemorebits='$usemorebits'
22461usemultiplicity='$usemultiplicity'
22462usemymalloc='$usemymalloc'
5f80c64f 22463usenm='$usenm'
b4eb6b3d
JH
22464useopcode='$useopcode'
22465useperlio='$useperlio'
22466useposix='$useposix'
9514c62b 22467usereentrant='$usereentrant'
d51aaa9d 22468userelocatableinc='$userelocatableinc'
b4eb6b3d
JH
22469usesfio='$usesfio'
22470useshrplib='$useshrplib'
5f106f9c 22471usesitecustomize='$usesitecustomize'
29209bc5 22472usesocks='$usesocks'
b4eb6b3d
JH
22473usethreads='$usethreads'
22474usevendorprefix='$usevendorprefix'
22475usevfork='$usevfork'
5f80c64f
JH
22476usrinc='$usrinc'
22477uuname='$uuname'
b4eb6b3d
JH
22478uvXUformat='$uvXUformat'
22479uvoformat='$uvoformat'
22480uvsize='$uvsize'
22481uvtype='$uvtype'
22482uvuformat='$uvuformat'
22483uvxformat='$uvxformat'
22484vendorarch='$vendorarch'
22485vendorarchexp='$vendorarchexp'
22486vendorbin='$vendorbin'
22487vendorbinexp='$vendorbinexp'
8d2cbf27
JH
22488vendorhtml1dir='$vendorhtml1dir'
22489vendorhtml1direxp='$vendorhtml1direxp'
22490vendorhtml3dir='$vendorhtml3dir'
22491vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
22492vendorlib='$vendorlib'
22493vendorlib_stem='$vendorlib_stem'
22494vendorlibexp='$vendorlibexp'
91e123a8
JH
22495vendorman1dir='$vendorman1dir'
22496vendorman1direxp='$vendorman1direxp'
22497vendorman3dir='$vendorman3dir'
22498vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
22499vendorprefix='$vendorprefix'
22500vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
22501vendorscript='$vendorscript'
22502vendorscriptexp='$vendorscriptexp'
b4eb6b3d 22503version='$version'
861eb78d 22504version_patchlevel_string='$version_patchlevel_string'
d56c5707 22505versiononly='$versiononly'
5f80c64f 22506vi='$vi'
b4eb6b3d 22507voidflags='$voidflags'
5f80c64f 22508xlibpth='$xlibpth'
3659ebf1
JH
22509yacc='$yacc'
22510yaccflags='$yaccflags'
5f80c64f
JH
22511zcat='$zcat'
22512zip='$zip'
22513EOT
22514
22515: Add in command line options if available
22516$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22517
22518: add special variables
22519$test -f $src/patchlevel.h && \
d00b958f 22520awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 22521echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 22522echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
22523
22524: propagate old symbols
22525if $test -f UU/config.sh; then
381aa1ff 22526 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 22527 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 22528 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
22529 set X `cat UU/oldsyms`
22530 shift
22531 case $# in
22532 0) ;;
22533 *)
22534 cat <<EOM
22535Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22536EOM
22537 echo "# Variables propagated from previous config.sh file." >>config.sh
22538 for sym in `cat UU/oldsyms`; do
22539 echo " Propagating $hint variable "'$'"$sym..."
22540 eval 'tmp="$'"${sym}"'"'
22541 echo "$tmp" | \
22542 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22543 done
22544 ;;
22545 esac
22546fi
22547
22548: Finish up by extracting the .SH files
22549case "$alldone" in
22550exit)
22551 $rm -rf UU
24ccb310 22552 echo "Extraction done."
5f80c64f
JH
22553 exit 0
22554 ;;
22555cont)
22556 ;;
22557'')
22558 dflt=''
22559 nostick=true
22560 $cat <<EOM
22561
22562If you'd like to make any changes to the config.sh file before I begin
22563to configure things, do it as a shell escape now (e.g. !vi config.sh).
22564
22565EOM
22566 rp="Press return or use a shell escape to edit config.sh:"
22567 . UU/myread
22568 nostick=''
22569 case "$ans" in
22570 '') ;;
22571 *) : in case they cannot read
22572 sh 1>&4 -c "$ans";;
22573 esac
22574 ;;
22575esac
22576
22577: if this fails, just run all the .SH files by hand
22578. ./config.sh
22579
22580echo " "
22581exec 1>&4
a43e8593 22582pwd=`pwd`
5f80c64f 22583. ./UU/extract
6904989c 22584cd "$pwd"
5f80c64f
JH
22585
22586if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22587 dflt=y
22588 case "$silent" in
22589 true) ;;
22590 *)
22591 $cat <<EOM
22592
22593Now you need to generate make dependencies by running "$make depend".
22594You might prefer to run it in background: "$make depend > makedepend.out &"
22595It can take a while, so you might not want to run it right now.
22596
22597EOM
22598 ;;
22599 esac
22600 rp="Run $make depend now?"
22601 . UU/myread
22602 case "$ans" in
22603 y*)
3d5d58b1 22604 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
22605 ;;
22606 *)
22607 echo "You must run '$make depend' then '$make'."
22608 ;;
22609 esac
22610elif test -f [Mm]akefile; then
22611 echo " "
22612 echo "Now you must run a $make."
22613else
24ccb310 22614 echo "Configure done."
5f80c64f
JH
22615fi
22616
22617if $test -f Policy.sh; then
22618 $cat <<EOM
22619
22620If you compile $package on a different machine or from a different object
22621directory, copy the Policy.sh file from this object directory to the
22622new one before you run Configure -- this will help you with most of
22623the policy defaults.
22624
22625EOM
22626fi
22627if $test -f config.msg; then
22628 echo "Hmm. I also noted the following information while running:"
22629 echo " "
22630 $cat config.msg >&4
22631 $rm -f config.msg
22632fi
22633$rm -f kit*isdone ark*isdone
22634$rm -rf UU
22635
22636: End of Configure
22637