This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Pod::Functions with changes from perlfunc.pod
[perl5.git] / Configure
CommitLineData
2304df62
AD
1#! /bin/sh
2#
3# If these # comments don't work, trim them. Don't worry about any other
4# shell scripts, Configure will trim # comments from them for you.
5#
6# (If you are trying to port this package to a machine without sh,
7# I would suggest you have a look at the prototypical config_h.SH file
8# and edit it to reflect your system. Some packages may include samples
9# of config.h for certain machines, so you might look for one of those.)
10#
11# Yes, you may rip this off to use in other distribution packages. This
12# script belongs to the public domain and cannot be copyrighted.
13#
613d6c3e 14# Note: this Configure script was generated automatically. Rather than
2304df62 15# working with this copy of Configure, you may wish to get metaconfig.
613d6c3e
MB
16# The dist package (which contains metaconfig) is available via SVN:
17# svn co https://svn.sourceforge.net/svnroot/dist/trunk/dist
2304df62 18#
6f5be6d1
MB
19# Though this script was generated by metaconfig from metaunits, it is
20# OK to send patches against Configure itself. It's up to the Configure
21# pumpkin to backport the patch to the metaunits if it is accepted.
4471067f
JV
22# For more information on patching Configure, see pod/perlhack.pod
23#
6f5be6d1
MB
24# The metaunits are also available from the public git repository:
25# http://perl5.git.perl.org/metaconfig.git/ or
26# $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
5cadb3f3 27#
5cadb3f3
MB
28# See Porting/pumpkin.pod for more information on metaconfig.
29#
2304df62 30
18126d98 31# Generated on Thu Feb 16 16:57:30 CET 2012 [metaconfig 3.5 PL0]
7f2de2d2 32# (with additional metaconfig patches by perlbug@perl.org)
2304df62 33
283fdd21 34cat >c1$$ <<EOF
2304df62
AD
35ARGGGHHHH!!!!!
36
37SCO csh still thinks true is false. Write to SCO today and tell them that next
38year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
39
40(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
41we'd have to do is go in and swap the && and || tokens, wherever they are.)
42
43[End of diatribe. We now return you to your regularly scheduled programming...]
44EOF
283fdd21 45cat >c2$$ <<EOF
2304df62
AD
46
47OOPS! You naughty creature! You didn't run Configure with sh!
48I will attempt to remedy the situation by running sh for you...
49EOF
50
283fdd21 51true || cat c1$$ c2$$
2304df62
AD
52true || exec sh $0 $argv:q
53
283fdd21 54(exit $?0) || cat c2$$
2304df62 55(exit $?0) || exec sh $0 $argv:q
283fdd21 56rm -f c1$$ c2$$
2304df62 57
f6538904 58if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
d03b3b00 59 cat <<EOF
cbee2ce6
JH
60***
61*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
62*** Configure that well. (Plan 9 is close to UNIX but not close enough.)
63*** Please read the README.plan9 for further instructions.
64*** Cannot continue, aborting.
65***
66EOF
67 exit 1
68fi
69
f8e2af1d 70if test ! -c /dev/null ; then
d03b3b00 71 cat <<EOF
f8e2af1d
MC
72***
73*** I'm sorry, but /dev/null appears to be a file rather than a device.
74*** Please consult your operating sytem's notes for making a device
75*** in /dev.
76*** Cannot continue, aborting.
77***
78EOF
79 exit 1
80fi
81
a0d0e21e
LW
82: compute my invocation name
83me=$0
84case "$0" in
85*/*)
86 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
87 test "$me" || me=$0
88 ;;
89esac
90
dfe9444c 91: Proper separator for the PATH environment variable
8e07c86e 92p_=:
613d6c3e 93: On OS/2 this directory should exist if this is not floppy only system ":-]"
5c728af0 94if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
613d6c3e 95 if test -n "$OS2_SHELL"; then
dfe9444c
AD
96 p_=\;
97 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
98 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
5c728af0 99 is_os2=yes
c4f23d77 100 elif test -n "$DJGPP"; then
495e2cbe
MB
101 case "X${MACHTYPE:-nonesuchmach}" in
102 *cygwin) ;;
103 *) p_=\; ;;
104 esac
dfe9444c 105 fi
39e571d4 106fi
a0d0e21e
LW
107
108: Proper PATH setting
109paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 110paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 111paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 112paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e 113paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
87bdd940 114paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
232e078e
AD
115paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
116paths="$paths /sbin /usr/sbin /usr/libexec"
3c728e00 117paths="$paths /system/gnu_library/bin"
a0d0e21e
LW
118
119for p in $paths
120do
8e07c86e
AD
121 case "$p_$PATH$p_" in
122 *$p_$p$p_*) ;;
123 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
124 esac
125done
126
8e07c86e 127PATH=.$p_$PATH
2304df62
AD
128export PATH
129
dfe9444c
AD
130: shall we be using ksh?
131inksh=''
132needksh=''
133avoidksh=''
134newsh=/bin/ksh
135changesh=''
ff0cee69 136if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
137 inksh=true
138fi
139if test -f /hp-ux -a -f /bin/ksh; then
140 needksh='to avoid sh bug in "here document" expansion'
141fi
142if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
143 if test X`/usr/bin/uname -v` = X4; then
144 avoidksh="to avoid AIX 4's /bin/sh"
145 newsh=/usr/bin/bsh
2304df62 146 fi
dfe9444c 147fi
cf04f91f
JH
148if test -f /osf_boot -a -f /usr/sbin/setld; then
149 if test X`/usr/bin/uname -s` = XOSF1; then
613d6c3e
MB
150 avoidksh="to avoid Digital UNIX' ksh"
151 newsh=/bin/sh
152 unset BIN_SH
cf04f91f
JH
153 fi
154fi
dfe9444c
AD
155case "$inksh/$needksh" in
156/[a-z]*)
c4f23d77 157 ENV=''
dfe9444c
AD
158 changesh=true
159 reason="$needksh"
160 ;;
161esac
162case "$inksh/$avoidksh" in
163true/[a-z]*)
164 changesh=true
165 reason="$avoidksh"
166 ;;
167esac
168case "$inksh/$needksh-$avoidksh-" in
169true/--)
a0d0e21e
LW
170 cat <<EOM
171(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 172mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 173EOM
dfe9444c
AD
174 ;;
175esac
176case "$changesh" in
177true)
2e2a97a6 178 export newsh
dfe9444c
AD
179 echo "(Feeding myself to $newsh $reason.)"
180 case "$0" in
181 Configure|*/Configure) exec $newsh $0 "$@";;
182 *) exec $newsh Configure "$@";;
183 esac
184 ;;
185esac
7730b9f4 186test -x "${newsh}" || unset newsh
2304df62 187
613d6c3e 188: if needed, set CDPATH to a harmless value that is not chatty
bfb7748a
AD
189: avoid bash 2.02 problems with empty CDPATH.
190case "$CDPATH" in
191'') ;;
192*) case "$SHELL" in
613d6c3e
MB
193 *bash*) CDPATH='.' ;;
194 *) CDPATH='' ;;
bfb7748a
AD
195 esac
196 ;;
197esac
613d6c3e 198
2304df62
AD
199: Configure runs within the UU subdirectory
200test -d UU || mkdir UU
8e07c86e 201cd UU && rm -f ./*
2304df62 202
6b356c8e
JH
203ccname=''
204ccversion=''
b4eb6b3d
JH
205ccsymbols=''
206cppccsymbols=''
207cppsymbols=''
5440bc8e
JH
208from=''
209run=''
210targetarch=''
211to=''
212usecrosscompile=''
61c26d18 213extern_C=''
6b34ded5 214mistrustnm=''
1be1b388 215usedevel=''
9c839522 216perllibs=''
b4eb6b3d
JH
217dynamic_ext=''
218extensions=''
219known_extensions=''
220nonxs_ext=''
221static_ext=''
222useopcode=''
223useposix=''
6fcddf3b 224extras=''
ecfc5424 225d_bsd=''
40a7a20a 226d_eunice=''
2304df62
AD
227d_xenix=''
228eunicefix=''
dfe9444c 229ar=''
2304df62
AD
230awk=''
231bash=''
232bison=''
233byacc=''
234cat=''
235chgrp=''
236chmod=''
237chown=''
ecfc5424 238comm=''
2304df62
AD
239compress=''
240cp=''
241cpio=''
242cpp=''
243csh=''
244date=''
245echo=''
246egrep=''
247emacs=''
248expr=''
249find=''
250flex=''
3c728e00 251gmake=''
2304df62 252grep=''
8ff267be 253gzip=''
2304df62
AD
254inews=''
255ksh=''
256less=''
257line=''
258lint=''
259ln=''
260lp=''
261lpr=''
262ls=''
263mail=''
264mailx=''
dfe9444c 265make=''
2304df62
AD
266mkdir=''
267more=''
268mv=''
693762b4 269nm=''
2304df62
AD
270nroff=''
271perl=''
272pg=''
273pmake=''
274pr=''
275rm=''
276rmail=''
277sed=''
278sendmail=''
2304df62
AD
279shar=''
280sleep=''
281smail=''
282sort=''
283submit=''
284tail=''
285tar=''
286tbl=''
693762b4 287tee=''
2304df62
AD
288test=''
289touch=''
290tr=''
291troff=''
292uname=''
293uniq=''
294uuname=''
295vi=''
296zcat=''
8ff267be 297zip=''
b4eb6b3d
JH
298full_ar=''
299full_sed=''
a0d0e21e 300libswanted=''
2304df62
AD
301hint=''
302myuname=''
85e6fe83
LW
303osname=''
304osvers=''
2304df62
AD
305Author=''
306Date=''
307Header=''
308Id=''
309Locker=''
310Log=''
311RCSfile=''
312Revision=''
313Source=''
314State=''
dfe9444c
AD
315_a=''
316_exe=''
317_o=''
4633a7c4
LW
318archobjs=''
319exe_ext=''
320firstmakefile=''
321lib_ext=''
322obj_ext=''
323path_sep=''
5b813a60 324rm_try=''
b4eb6b3d 325afs=''
a6d26a0d 326afsroot=''
b4eb6b3d
JH
327alignbytes=''
328ansi2knr=''
329archlib=''
330archlibexp=''
331d_archlib=''
332installarchlib=''
333archname=''
334myarchname=''
335d_atolf=''
336d_atoll=''
337baserev=''
338bin=''
339binexp=''
f3f1a2d8 340initialinstalllocation=''
b4eb6b3d 341installbin=''
f3f1a2d8 342userelocatableinc=''
b4eb6b3d 343byteorder=''
2304df62 344cc=''
2304df62
AD
345ccflags=''
346cppflags=''
347ldflags=''
348lkflags=''
8e07c86e 349locincpth=''
2304df62 350optimize=''
b4eb6b3d 351cf_email=''
2304df62
AD
352cf_by=''
353cf_time=''
c193ef60
MB
354charbits=''
355charsize=''
2304df62 356contains=''
b4eb6b3d 357cpp_stuff=''
2304df62
AD
358cpplast=''
359cppminus=''
360cpprun=''
361cppstdin=''
74cac757 362d__fwalk=''
b4eb6b3d
JH
363d_access=''
364d_accessx=''
55954f19 365d_aintl=''
b4eb6b3d 366d_alarm=''
10bc17b6
JH
367asctime_r_proto=''
368d_asctime_r=''
fcdf39cf 369d_attribute_deprecated=''
0dbb1585
AL
370d_attribute_format=''
371d_attribute_malloc=''
372d_attribute_nonnull=''
373d_attribute_noreturn=''
374d_attribute_pure=''
375d_attribute_unused=''
376d_attribute_warn_unused_result=''
dcb594bc 377d_printf_format_null=''
b4eb6b3d
JH
378d_bcmp=''
379d_bcopy=''
635aebb7
AL
380d_builtin_choose_expr=''
381d_builtin_expect=''
b4eb6b3d 382d_bzero=''
a2d23ec2 383d_c99_variadic_macros=''
b4eb6b3d
JH
384d_casti32=''
385castflags=''
386d_castneg=''
387d_chown=''
388d_chroot=''
389d_chsize=''
758a5d79 390d_class=''
b0a2e8e6 391d_clearenv=''
b4eb6b3d
JH
392d_closedir=''
393d_void_closedir=''
4e0554ec 394d_cmsghdr_s=''
b4eb6b3d 395d_const=''
36adc09b 396d_copysignl=''
666ea192 397d_cplusplus=''
b4eb6b3d
JH
398cryptlib=''
399d_crypt=''
10bc17b6
JH
400crypt_r_proto=''
401d_crypt_r=''
b4eb6b3d
JH
402d_csh=''
403full_csh=''
13cfc98d 404d_ctermid=''
10bc17b6
JH
405ctermid_r_proto=''
406d_ctermid_r=''
407ctime_r_proto=''
408d_ctime_r=''
b4eb6b3d
JH
409d_cuserid=''
410d_dbl_dig=''
2ef53570 411d_dbminitproto=''
b4eb6b3d 412d_difftime=''
de52168c 413d_dir_dd_fd=''
ae0e3d3b 414d_dirfd=''
b4eb6b3d 415d_dlerror=''
a0d0e21e 416d_dlopen=''
b4eb6b3d
JH
417d_dlsymun=''
418d_dosuid=''
419d_suidsafe=''
10bc17b6
JH
420d_drand48_r=''
421drand48_r_proto=''
b4eb6b3d
JH
422d_drand48proto=''
423d_dup2=''
424d_eaccess=''
425d_endgrent=''
10bc17b6
JH
426d_endgrent_r=''
427endgrent_r_proto=''
b4eb6b3d 428d_endhent=''
10bc17b6
JH
429d_endhostent_r=''
430endhostent_r_proto=''
b4eb6b3d 431d_endnent=''
10bc17b6
JH
432d_endnetent_r=''
433endnetent_r_proto=''
b4eb6b3d 434d_endpent=''
10bc17b6
JH
435d_endprotoent_r=''
436endprotoent_r_proto=''
b4eb6b3d 437d_endpwent=''
10bc17b6
JH
438d_endpwent_r=''
439endpwent_r_proto=''
b4eb6b3d 440d_endsent=''
10bc17b6
JH
441d_endservent_r=''
442endservent_r_proto=''
15b61c98 443d_faststdio=''
b363b713 444d_fchdir=''
b4eb6b3d
JH
445d_fchmod=''
446d_fchown=''
447d_fcntl=''
9d9004a9 448d_fcntl_can_lock=''
b4eb6b3d
JH
449d_fd_macros=''
450d_fd_set=''
451d_fds_bits=''
452d_fgetpos=''
758a5d79
JH
453d_finite=''
454d_finitel=''
b4eb6b3d
JH
455d_flexfnam=''
456d_flock=''
2ef53570 457d_flockproto=''
b4eb6b3d 458d_fork=''
758a5d79
JH
459d_fp_class=''
460d_fpclass=''
461d_fpclassify=''
462d_fpclassl=''
b4eb6b3d
JH
463d_fpos64_t=''
464d_frexpl=''
465d_fs_data_s=''
466d_fseeko=''
467d_fsetpos=''
468d_fstatfs=''
411ab01c 469d_fsync=''
b4eb6b3d
JH
470d_ftello=''
471d_ftime=''
472d_gettimeod=''
dc814df1 473d_futimes=''
b4eb6b3d 474d_Gconvert=''
5086dff9 475d_getaddrinfo=''
b4eb6b3d
JH
476d_getcwd=''
477d_getespwnam=''
478d_getfsstat=''
479d_getgrent=''
10bc17b6
JH
480d_getgrent_r=''
481getgrent_r_proto=''
482d_getgrgid_r=''
483getgrgid_r_proto=''
484d_getgrnam_r=''
485getgrnam_r_proto=''
b4eb6b3d
JH
486d_getgrps=''
487d_gethbyaddr=''
488d_gethbyname=''
489d_gethent=''
490aphostname=''
491d_gethname=''
492d_phostname=''
493d_uname=''
10bc17b6
JH
494d_gethostbyaddr_r=''
495gethostbyaddr_r_proto=''
496d_gethostbyname_r=''
497gethostbyname_r_proto=''
498d_gethostent_r=''
499gethostent_r_proto=''
b4eb6b3d 500d_gethostprotos=''
4e0554ec 501d_getitimer=''
b4eb6b3d 502d_getlogin=''
10bc17b6
JH
503d_getlogin_r=''
504getlogin_r_proto=''
b4eb6b3d
JH
505d_getmnt=''
506d_getmntent=''
5086dff9 507d_getnameinfo=''
b4eb6b3d
JH
508d_getnbyaddr=''
509d_getnbyname=''
510d_getnent=''
10bc17b6
JH
511d_getnetbyaddr_r=''
512getnetbyaddr_r_proto=''
513d_getnetbyname_r=''
514getnetbyname_r_proto=''
515d_getnetent_r=''
516getnetent_r_proto=''
b4eb6b3d 517d_getnetprotos=''
0c0643d0 518d_getpagsz=''
b4eb6b3d
JH
519d_getpent=''
520d_getpgid=''
521d_getpgrp2=''
522d_bsdgetpgrp=''
523d_getpgrp=''
524d_getppid=''
525d_getprior=''
526d_getpbyname=''
527d_getpbynumber=''
10bc17b6
JH
528d_getprotobyname_r=''
529getprotobyname_r_proto=''
530d_getprotobynumber_r=''
531getprotobynumber_r_proto=''
532d_getprotoent_r=''
533getprotoent_r_proto=''
b4eb6b3d
JH
534d_getprotoprotos=''
535d_getprpwnam=''
536d_getpwent=''
10bc17b6
JH
537d_getpwent_r=''
538getpwent_r_proto=''
539d_getpwnam_r=''
540getpwnam_r_proto=''
541d_getpwuid_r=''
542getpwuid_r_proto=''
b4eb6b3d 543d_getsent=''
10bc17b6
JH
544d_getservbyname_r=''
545getservbyname_r_proto=''
546d_getservbyport_r=''
547getservbyport_r_proto=''
548d_getservent_r=''
549getservent_r_proto=''
b4eb6b3d
JH
550d_getservprotos=''
551d_getspnam=''
10bc17b6
JH
552d_getspnam_r=''
553getspnam_r_proto=''
b4eb6b3d
JH
554d_getsbyname=''
555d_getsbyport=''
10bc17b6
JH
556d_gmtime_r=''
557gmtime_r_proto=''
a4f3eea9 558d_gnulibc=''
5f6e0ee4 559gnulibc_version=''
b4eb6b3d
JH
560d_hasmntopt=''
561d_htonl=''
55954f19 562d_ilogbl=''
b4eb6b3d 563d_inetaton=''
5086dff9
MB
564d_inetntop=''
565d_inetpton=''
b4eb6b3d
JH
566d_int64_t=''
567d_isascii=''
269a7913 568d_isblank=''
758a5d79
JH
569d_isfinite=''
570d_isinf=''
b4eb6b3d
JH
571d_isnan=''
572d_isnanl=''
573d_killpg=''
574d_lchown=''
575d_ldbl_dig=''
0a0abfba 576d_libm_lib_version=''
b4eb6b3d 577d_link=''
10bc17b6 578d_localtime_r=''
8572b25d 579d_localtime_r_needs_tzset=''
10bc17b6 580localtime_r_proto=''
b4eb6b3d
JH
581d_locconv=''
582d_lockf=''
583d_longdbl=''
584longdblsize=''
585d_longlong=''
586longlongsize=''
587d_lseekproto=''
588d_lstat=''
589d_madvise=''
7dd121ae
MB
590d_malloc_good_size=''
591d_malloc_size=''
b4eb6b3d
JH
592d_mblen=''
593d_mbstowcs=''
594d_mbtowc=''
595d_memchr=''
596d_memcmp=''
597d_memcpy=''
598d_memmove=''
599d_memset=''
600d_mkdir=''
601d_mkdtemp=''
602d_mkfifo=''
603d_mkstemp=''
604d_mkstemps=''
605d_mktime=''
606d_mmap=''
607mmaptype=''
608d_modfl=''
e67aeab1 609d_modfl_pow32_bug=''
bc9a1b2c 610d_modflproto=''
b4eb6b3d
JH
611d_mprotect=''
612d_msg=''
613d_msgctl=''
614d_msgget=''
4e0554ec 615d_msghdr_s=''
b4eb6b3d
JH
616d_msgrcv=''
617d_msgsnd=''
618d_msync=''
619d_munmap=''
620d_nice=''
2765b840 621d_nl_langinfo=''
b4eb6b3d
JH
622d_off64_t=''
623d_open3=''
624d_fpathconf=''
625d_pathconf=''
626d_pause=''
627d_pipe=''
628d_poll=''
2304df62 629d_portable=''
c796e3db
MB
630d_prctl=''
631d_prctl_set_name=''
a33c94aa 632d_procselfexe=''
f24dbf84 633procselfexe=''
b4eb6b3d
JH
634d_old_pthread_create_joinable=''
635old_pthread_create_joinable=''
d6483fcc 636d_pthread_atfork=''
58d975c3 637d_pthread_attr_setscope=''
b4eb6b3d
JH
638d_pthread_yield=''
639d_sched_yield=''
640sched_yield=''
641d_qgcvt=''
10bc17b6
JH
642d_random_r=''
643random_r_proto=''
644d_readdir64_r=''
645readdir64_r_proto=''
b4eb6b3d
JH
646d_readdir=''
647d_rewinddir=''
648d_seekdir=''
649d_telldir=''
10bc17b6
JH
650d_readdir_r=''
651readdir_r_proto=''
b4eb6b3d 652d_readlink=''
4e0554ec
JH
653d_readv=''
654d_recvmsg=''
b4eb6b3d
JH
655d_rename=''
656d_rmdir=''
657d_safebcpy=''
658d_safemcpy=''
659d_sanemcmp=''
ef9f17be 660d_sbrkproto=''
55954f19 661d_scalbnl=''
b4eb6b3d
JH
662d_select=''
663d_sem=''
664d_semctl=''
665d_semget=''
666d_semop=''
4e0554ec 667d_sendmsg=''
b4eb6b3d
JH
668d_setegid=''
669d_seteuid=''
670d_setgrent=''
10bc17b6
JH
671d_setgrent_r=''
672setgrent_r_proto=''
b4eb6b3d
JH
673d_setgrps=''
674d_sethent=''
10bc17b6
JH
675d_sethostent_r=''
676sethostent_r_proto=''
4e0554ec 677d_setitimer=''
b4eb6b3d
JH
678d_setlinebuf=''
679d_setlocale=''
10bc17b6
JH
680d_setlocale_r=''
681setlocale_r_proto=''
b4eb6b3d 682d_setnent=''
10bc17b6
JH
683d_setnetent_r=''
684setnetent_r_proto=''
b4eb6b3d
JH
685d_setpent=''
686d_setpgid=''
687d_setpgrp2=''
688d_bsdsetpgrp=''
689d_setpgrp=''
690d_setprior=''
691d_setproctitle=''
10bc17b6
JH
692d_setprotoent_r=''
693setprotoent_r_proto=''
b4eb6b3d 694d_setpwent=''
10bc17b6
JH
695d_setpwent_r=''
696setpwent_r_proto=''
b4eb6b3d
JH
697d_setregid=''
698d_setresgid=''
699d_setresuid=''
700d_setreuid=''
701d_setrgid=''
702d_setruid=''
703d_setsent=''
10bc17b6
JH
704d_setservent_r=''
705setservent_r_proto=''
b4eb6b3d
JH
706d_setsid=''
707d_setvbuf=''
708d_sfio=''
709usesfio=''
710d_shm=''
711d_shmat=''
712d_shmatprototype=''
713shmattype=''
714d_shmctl=''
715d_shmdt=''
716d_shmget=''
717d_sigaction=''
ed140128 718d_signbit=''
983dbef6 719d_sigprocmask=''
b4eb6b3d 720d_sigsetjmp=''
5f106f9c 721usesitecustomize=''
4f5da3e9
SP
722d_snprintf=''
723d_vsnprintf=''
49a78c82 724d_sockatmark=''
2ef53570 725d_sockatmarkproto=''
18126d98 726d_ipv6_mreq=''
b4eb6b3d
JH
727d_msg_ctrunc=''
728d_msg_dontroute=''
729d_msg_oob=''
730d_msg_peek=''
731d_msg_proxy=''
732d_oldsock=''
733d_scm_rights=''
f53580fe 734d_sin6_scope_id=''
18126d98 735d_sockaddr_in6=''
b8677e3b 736d_sockaddr_sa_len=''
b4eb6b3d
JH
737d_socket=''
738d_sockpair=''
739sockethdr=''
740socketlib=''
741d_socklen_t=''
742d_socks5_init=''
360321b3 743d_sprintf_returns_strlen=''
b4eb6b3d 744d_sqrtl=''
10bc17b6
JH
745d_srand48_r=''
746srand48_r_proto=''
747d_srandom_r=''
748srandom_r_proto=''
eef837ea 749d_sresgproto=''
640374d0 750d_sresuproto=''
b4eb6b3d
JH
751d_statblks=''
752d_statfs_f_flags=''
753d_statfs_s=''
17a6c8e3
AD
754d_static_inline=''
755perl_static_inline=''
b4eb6b3d
JH
756d_fstatvfs=''
757d_statvfs=''
758d_stdio_cnt_lval=''
759d_stdio_ptr_lval=''
a7ffa9b9
NC
760d_stdio_ptr_lval_nochange_cnt=''
761d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
762d_stdiobase=''
763d_stdstdio=''
764stdio_base=''
765stdio_bufsiz=''
766stdio_cnt=''
767stdio_filbuf=''
768stdio_ptr=''
769d_index=''
770d_strchr=''
771d_strcoll=''
772d_strctcpy=''
773d_strerrm=''
774d_strerror=''
775d_sysernlst=''
776d_syserrlst=''
10bc17b6
JH
777d_strerror_r=''
778strerror_r_proto=''
b3c85772 779d_strftime=''
08c92000
MB
780d_strlcat=''
781d_strlcpy=''
b4eb6b3d
JH
782d_strtod=''
783d_strtol=''
784d_strtold=''
785d_strtoll=''
28e5dec8 786d_strtoq=''
b4eb6b3d
JH
787d_strtoul=''
788d_strtoull=''
789d_strtouq=''
790d_strxfrm=''
791d_symlink=''
792d_syscall=''
2ef53570 793d_syscallproto=''
b4eb6b3d
JH
794d_sysconf=''
795d_system=''
796d_tcgetpgrp=''
797d_tcsetpgrp=''
798d_telldirproto=''
799d_time=''
800timetype=''
96938616
MB
801d_asctime64=''
802d_ctime64=''
803d_difftime64=''
804d_gmtime64=''
805d_localtime64=''
806d_mktime64=''
cbb9e8a7 807d_timegm=''
b4eb6b3d
JH
808clocktype=''
809d_times=''
10bc17b6
JH
810d_tmpnam_r=''
811tmpnam_r_proto=''
b4eb6b3d 812d_truncate=''
10bc17b6
JH
813d_ttyname_r=''
814ttyname_r_proto=''
b4eb6b3d 815d_tzname=''
4e0554ec
JH
816d_u32align=''
817d_ualarm=''
b4eb6b3d
JH
818d_umask=''
819d_semctl_semid_ds=''
820d_semctl_semun=''
821d_union_semun=''
758a5d79 822d_unordered=''
bdf33aa7 823d_unsetenv=''
4e0554ec 824d_usleep=''
2ef53570 825d_usleepproto=''
b4eb6b3d 826d_ustat=''
233e16ce 827d_pseudofork=''
b4eb6b3d
JH
828d_vfork=''
829usevfork=''
830d_voidsig=''
831signal_t=''
832d_volatile=''
833d_charvspr=''
834d_vprintf=''
835d_wait4=''
836d_waitpid=''
837d_wcstombs=''
838d_wctomb=''
4e0554ec 839d_writev=''
b4eb6b3d 840dlext=''
f1ce3bf1 841bin_ELF=''
85e6fe83
LW
842cccdlflags=''
843ccdlflags=''
2304df62 844dlsrc=''
232e078e 845ld=''
85e6fe83 846lddlflags=''
2304df62 847usedl=''
b4eb6b3d
JH
848doublesize=''
849ebcdic=''
850fflushNULL=''
851fflushall=''
852fpossize=''
853fpostype=''
2d736872 854gccansipedantic=''
5b463ca7 855gccosandvers=''
8a27cf78 856gccversion=''
b4eb6b3d
JH
857gidformat=''
858gidsign=''
859gidsize=''
860gidtype=''
861groupstype=''
862h_fcntl=''
863h_sysfile=''
6e1038e0
MB
864html1dir=''
865html1direxp=''
866installhtml1dir=''
867html3dir=''
868html3direxp=''
869installhtml3dir=''
b4eb6b3d 870i_arpainet=''
c0bacbef 871i_assert=''
10bc17b6 872i_crypt=''
b4eb6b3d
JH
873db_hashtype=''
874db_prefixtype=''
640374d0
JH
875db_version_major=''
876db_version_minor=''
877db_version_patch=''
b4eb6b3d
JH
878i_db=''
879i_dbm=''
880i_rpcsvcdbm=''
881d_dirnamlen=''
882direntrytype=''
883i_dirent=''
a0d0e21e 884i_dld=''
b4eb6b3d
JH
885i_dlfcn=''
886i_fcntl=''
887i_float=''
758a5d79
JH
888i_fp=''
889i_fp_class=''
b4eb6b3d
JH
890i_gdbm=''
891d_grpasswd=''
892i_grp=''
b4eb6b3d
JH
893i_ieeefp=''
894i_inttypes=''
2765b840 895i_langinfo=''
b4eb6b3d
JH
896i_libutil=''
897i_limits=''
898i_locale=''
899i_machcthr=''
900i_malloc=''
1cd66f7c 901i_mallocmalloc=''
b4eb6b3d
JH
902i_math=''
903i_memory=''
904i_mntent=''
e74475c7
MHM
905d_gdbm_ndbm_h_uses_prototypes=''
906d_gdbmndbm_h_uses_prototypes=''
a33f2d9f 907d_ndbm=''
e74475c7 908d_ndbm_h_uses_prototypes=''
a33f2d9f
AD
909i_gdbm_ndbm=''
910i_gdbmndbm=''
b4eb6b3d
JH
911i_ndbm=''
912i_netdb=''
913i_neterrno=''
914i_netinettcp=''
915i_niin=''
916i_sysin=''
917i_poll=''
918i_prot=''
919i_pthread=''
920d_pwage=''
921d_pwchange=''
922d_pwclass=''
923d_pwcomment=''
924d_pwexpire=''
925d_pwgecos=''
926d_pwpasswd=''
927d_pwquota=''
928i_pwd=''
929i_sfio=''
930i_shadow=''
931i_socks=''
bd31be4b 932i_stdbool=''
b4eb6b3d
JH
933i_stddef=''
934i_stdlib=''
935i_string=''
936strings=''
937i_sunmath=''
938i_sysaccess=''
939i_sysdir=''
940i_sysfile=''
941d_voidtty=''
942i_bsdioctl=''
943i_sysfilio=''
944i_sysioctl=''
945i_syssockio=''
946i_syslog=''
947i_sysmman=''
948i_sysmode=''
949i_sysmount=''
950i_sysndir=''
951i_sysparam=''
216dac04 952i_syspoll=''
b4eb6b3d
JH
953i_sysresrc=''
954i_syssecrt=''
955i_sysselct=''
956i_sysstat=''
957i_sysstatfs=''
958i_sysstatvfs=''
959i_systimes=''
960i_systypes=''
961i_sysuio=''
962i_sysun=''
963i_sysutsname=''
964i_sysvfs=''
965i_syswait=''
966i_sgtty=''
967i_termio=''
968i_termios=''
14b90194
JH
969d_tm_tm_gmtoff=''
970d_tm_tm_zone=''
b4eb6b3d
JH
971i_systime=''
972i_systimek=''
973i_time=''
974timeincl=''
975i_unistd=''
976i_ustat=''
977i_utime=''
978i_values=''
979i_stdarg=''
980i_varargs=''
981i_varhdr=''
982i_vfork=''
f3f1a2d8 983d_inc_version_list=''
b4eb6b3d
JH
984inc_version_list=''
985inc_version_list_init=''
986installprefix=''
987installprefixexp=''
988installstyle=''
989installusrbinperl=''
990intsize=''
991longsize=''
992shortsize=''
4b661809 993issymlink=''
2304df62 994libc=''
b4eb6b3d
JH
995ldlibpthname=''
996libperl=''
997shrpenv=''
998useshrplib=''
a0d0e21e 999glibpth=''
2304df62 1000libpth=''
8e07c86e 1001loclibpth=''
2304df62
AD
1002plibpth=''
1003xlibpth=''
1cfa4ec7 1004ignore_versioned_solibs=''
2304df62 1005libs=''
43999f95
JH
1006libsdirs=''
1007libsfiles=''
1008libsfound=''
13b3f787 1009libspath=''
85e6fe83 1010lns=''
b4eb6b3d
JH
1011d_PRIEUldbl=''
1012d_PRIFUldbl=''
1013d_PRIGUldbl=''
1014d_PRIeldbl=''
1015d_PRIfldbl=''
1016d_PRIgldbl=''
1017d_SCNfldbl=''
1018sPRIEUldbl=''
1019sPRIFUldbl=''
1020sPRIGUldbl=''
1021sPRIeldbl=''
1022sPRIfldbl=''
1023sPRIgldbl=''
1024sSCNfldbl=''
1025lseeksize=''
1026lseektype=''
d620c7b3 1027mad=''
00e74f14
NC
1028madlyh=''
1029madlyobj=''
1030madlysrc=''
f3f1a2d8
MB
1031make_set_make=''
1032d_mymalloc=''
1033freetype=''
b4eb6b3d
JH
1034mallocobj=''
1035mallocsrc=''
1036malloctype=''
9df442c2 1037usemallocwrap=''
b4eb6b3d
JH
1038usemymalloc=''
1039installman1dir=''
1040man1dir=''
1041man1direxp=''
1042man1ext=''
1043installman3dir=''
1044man3dir=''
1045man3direxp=''
1046man3ext=''
1047modetype=''
1048multiarch=''
1049mydomain=''
1050myhostname=''
1051phostname=''
2304df62
AD
1052c=''
1053n=''
b4eb6b3d
JH
1054d_eofnblk=''
1055eagain=''
1056o_nonblock=''
1057rd_nodata=''
2cc61e15 1058need_va_copy=''
b4eb6b3d
JH
1059netdb_hlen_type=''
1060netdb_host_type=''
1061netdb_name_type=''
1062netdb_net_type=''
1063groupcat=''
1064hostcat=''
1065passcat=''
1066orderlib=''
1067ranlib=''
1068d_perl_otherlibdirs=''
1069otherlibdirs=''
2304df62
AD
1070package=''
1071spackage=''
b4eb6b3d
JH
1072pager=''
1073api_revision=''
1074api_subversion=''
1075api_version=''
1076api_versionstring=''
1077patchlevel=''
151e6568 1078perl_patchlevel=''
b4eb6b3d
JH
1079revision=''
1080subversion=''
1081version=''
861eb78d 1082version_patchlevel_string=''
b4eb6b3d
JH
1083perl5=''
1084perladmin=''
91f55cc7 1085perlpath=''
b4eb6b3d 1086d_nv_preserves_uv=''
f607920a 1087d_nv_zero_is_allbits_zero=''
b4eb6b3d
JH
1088i16size=''
1089i16type=''
1090i32size=''
1091i32type=''
1092i64size=''
1093i64type=''
1094i8size=''
1095i8type=''
1096ivsize=''
1097ivtype=''
b68c599a 1098nv_overflows_integers_at=''
4137585d 1099nv_preserves_uv_bits=''
b4eb6b3d
JH
1100nvsize=''
1101nvtype=''
1102u16size=''
1103u16type=''
1104u32size=''
1105u32type=''
1106u64size=''
1107u64type=''
1108u8size=''
1109u8type=''
1110uvsize=''
1111uvtype=''
1112ivdformat=''
1113nvEUformat=''
1114nvFUformat=''
1115nvGUformat=''
1116nveformat=''
1117nvfformat=''
1118nvgformat=''
1119uvXUformat=''
1120uvoformat=''
1121uvuformat=''
1122uvxformat=''
1123pidtype=''
1124prefix=''
1125prefixexp=''
1126installprivlib=''
1127privlib=''
1128privlibexp=''
1129prototype=''
1130ptrsize=''
1131d_PRIXU64=''
1132d_PRId64=''
1133d_PRIi64=''
1134d_PRIo64=''
1135d_PRIu64=''
1136d_PRIx64=''
1137sPRIXU64=''
1138sPRId64=''
1139sPRIi64=''
1140sPRIo64=''
1141sPRIu64=''
1142sPRIx64=''
1143d_quad=''
1144quadkind=''
1145quadtype=''
1146uquadtype=''
1147drand01=''
1148randbits=''
1149randfunc=''
1150randseedtype=''
1151seedfunc=''
1152installscript=''
1153scriptdir=''
1154scriptdirexp=''
1155selectminbits=''
1156selecttype=''
8ff267be 1157sh=''
b4eb6b3d
JH
1158sig_count=''
1159sig_name=''
1160sig_name_init=''
1161sig_num=''
1162sig_num_init=''
76d3c696 1163sig_size=''
f3f1a2d8 1164d_sitearch=''
b4eb6b3d
JH
1165installsitearch=''
1166sitearch=''
1167sitearchexp=''
1168installsitebin=''
1169sitebin=''
1170sitebinexp=''
8d2cbf27
JH
1171installsitehtml1dir=''
1172sitehtml1dir=''
1173sitehtml1direxp=''
1174installsitehtml3dir=''
1175sitehtml3dir=''
1176sitehtml3direxp=''
b4eb6b3d
JH
1177installsitelib=''
1178sitelib=''
1179sitelib_stem=''
1180sitelibexp=''
91e123a8
JH
1181installsiteman1dir=''
1182siteman1dir=''
1183siteman1direxp=''
1184installsiteman3dir=''
1185siteman3dir=''
1186siteman3direxp=''
b4eb6b3d
JH
1187siteprefix=''
1188siteprefixexp=''
6e1038e0
MB
1189installsitescript=''
1190sitescript=''
1191sitescriptexp=''
b4eb6b3d
JH
1192sizesize=''
1193sizetype=''
a0d0e21e 1194so=''
b4eb6b3d 1195socksizetype=''
2304df62
AD
1196sharpbang=''
1197shsharp=''
1198spitshell=''
dfe9444c 1199src=''
b4eb6b3d 1200ssizetype=''
668fdbe1
MB
1201st_ino_sign=''
1202st_ino_size=''
b4eb6b3d 1203startperl=''
2304df62 1204startsh=''
b4eb6b3d
JH
1205stdchar=''
1206d_stdio_stream_array=''
1207stdio_stream_array=''
1208sysman=''
81c4fd9e
MB
1209sGMTIME_max=''
1210sGMTIME_min=''
73e6e416
MB
1211sLOCALTIME_max=''
1212sLOCALTIME_min=''
5ff3f7a4 1213trnl=''
b4eb6b3d
JH
1214uidformat=''
1215uidsign=''
1216uidsize=''
1217uidtype=''
1218archname64=''
1219use64bitall=''
1220use64bitint=''
34f1896b
MB
1221dtrace=''
1222usedtrace=''
15b61c98 1223usefaststdio=''
d78f9ffa 1224usekernprocpathname=''
b4eb6b3d
JH
1225ccflags_uselargefiles=''
1226ldflags_uselargefiles=''
1227libswanted_uselargefiles=''
1228uselargefiles=''
1229uselongdouble=''
1230usemorebits=''
1231usemultiplicity=''
2304df62 1232nm_opt=''
40a7a20a 1233nm_so_opt=''
2304df62
AD
1234runnm=''
1235usenm=''
ae60cb46 1236usensgetexecutablepath=''
b4eb6b3d 1237useperlio=''
29209bc5 1238usesocks=''
b4eb6b3d
JH
1239d_oldpthreads=''
1240use5005threads=''
1241useithreads=''
9514c62b 1242usereentrant=''
b4eb6b3d 1243usethreads=''
2304df62 1244incpath=''
2304df62
AD
1245mips_type=''
1246usrinc=''
d03b3b00 1247vaproto=''
b4eb6b3d
JH
1248d_vendorarch=''
1249installvendorarch=''
1250vendorarch=''
1251vendorarchexp=''
1252d_vendorbin=''
1253installvendorbin=''
1254vendorbin=''
1255vendorbinexp=''
8d2cbf27
JH
1256installvendorhtml1dir=''
1257vendorhtml1dir=''
1258vendorhtml1direxp=''
1259installvendorhtml3dir=''
1260vendorhtml3dir=''
1261vendorhtml3direxp=''
b4eb6b3d
JH
1262d_vendorlib=''
1263installvendorlib=''
1264vendorlib=''
1265vendorlib_stem=''
1266vendorlibexp=''
91e123a8
JH
1267installvendorman1dir=''
1268vendorman1dir=''
1269vendorman1direxp=''
1270installvendorman3dir=''
1271vendorman3dir=''
1272vendorman3direxp=''
b4eb6b3d
JH
1273usevendorprefix=''
1274vendorprefix=''
1275vendorprefixexp=''
6e1038e0
MB
1276d_vendorscript=''
1277installvendorscript=''
1278vendorscript=''
1279vendorscriptexp=''
d56c5707 1280versiononly=''
b4eb6b3d
JH
1281defvoidused=''
1282voidflags=''
3659ebf1
JH
1283yacc=''
1284yaccflags=''
2304df62
AD
1285CONFIG=''
1286
34f1896b 1287: Detect odd OSs
ecfc5424
AD
1288define='define'
1289undef='undef'
1290smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1291rmlist=''
1292
1293: We must find out about Eunice early
1294eunicefix=':'
1295if test -f /etc/unixtovms; then
1296 eunicefix=/etc/unixtovms
1297fi
1298if test -f /etc/unixtovms.exe; then
1299 eunicefix=/etc/unixtovms.exe
1300fi
1301
cfb04860 1302: Set executable suffix now -- needed before hints available
6153ba32
PG
1303if test -f "/libs/version.library"; then
1304: Amiga OS
1305 _exe=""
1306elif test -f "/system/gnu_library/bin/ar.pm"; then
1307: Stratus VOS
cfb04860 1308 _exe=".pm"
6153ba32
PG
1309elif test -n "$DJGPP"; then
1310: DOS DJGPP
cfb04860 1311 _exe=".exe"
5c728af0 1312elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1313: OS/2 or cygwin
ba863942
JH
1314 _exe=".exe"
1315fi
868439a2 1316
1d8eaf8c 1317groupstype=''
b4eb6b3d 1318i_whoami=''
06501368
MB
1319: Trailing extension. Override this in a hint file, if needed.
1320: Extra object files, if any, needed on this platform.
1321archobjs=''
b8677e3b
MB
1322archname=''
1323: Possible local include directories to search.
1324: Set locincpth to "" in a hint file to defeat local include searches.
1325locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1326locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1327:
1328: no include file wanted by default
1329inclwanted=''
1330
1331: Enable -DEBUGGING and -DDEBUGGING from the command line
1332EBUGGING=''
356123f1 1333DEBUGGING=''
b8677e3b 1334
64615a5e 1335libnames=''
732c9516
JH
1336: change the next line if compiling for Xenix/286 on Xenix/386
1337xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1338: Possible local library directories to search.
1339loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1340loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1341
1342: general looking path for locating libraries
5869b1f1 1343glibpth="/lib /usr/lib $xlibpth"
732c9516 1344glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1345test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1346test -f /shlib/libc.so && glibpth="/shlib $glibpth"
faae14e6 1347test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
732c9516
JH
1348
1349: Private path used by Configure to find libraries. Its value
1350: is prepended to libpth. This variable takes care of special
1351: machines, like the mips. Usually, it should be empty.
1352plibpth=''
1353
1cfa4ec7
GS
1354: default library list
1355libswanted=''
921b2963 1356: some systems want to use only the non-versioned libso:s
1cfa4ec7 1357ignore_versioned_solibs=''
06501368
MB
1358: set usethreads on the Configure command line to enable threads.
1359usereentrant='undef'
ed140128
AD
1360: full support for void wanted by default
1361defvoidused=15
1362
ed140128
AD
1363ccname=''
1364ccversion=''
1365perllibs=''
1366: set useposix=false in your hint file to disable the POSIX extension.
1367useposix=true
1368: set useopcode=false in your hint file to disable the Opcode extension.
1369useopcode=true
b4eb6b3d
JH
1370archname64=''
1371ccflags_uselargefiles=''
1372ldflags_uselargefiles=''
1373libswanted_uselargefiles=''
1374: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1375: set usesocks on the Configure command line to enable socks.
ecfc5424 1376: List of libraries we want.
15431986 1377: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef 1378libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
8119684f 1379libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1380: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1381: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1382glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1383glibpth="/usr/shlib $glibpth"
1384: Do not use vfork unless overridden by a hint file.
1385usevfork=false
1386
8ff267be 1387: Find the basic shell for Bourne shell scripts
1388case "$sh" in
1389'')
8ff267be 1390 case "$SYSTYPE" in
1391 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1392 *) xxx='/bin/sh';;
1393 esac
1394 if test -f "$xxx"; then
1395 sh="$xxx"
1396 else
1397 : Build up a list and do a single loop so we can 'break' out.
1398 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1399 for xxx in sh bash ksh pdksh ash; do
1400 for p in $pth; do
1401 try="$try ${p}/${xxx}"
1402 done
1403 done
1404 for xxx in $try; do
1405 if test -f "$xxx"; then
1406 sh="$xxx";
8ff267be 1407 break
a5a94ea5
JH
1408 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1409 sh="$xxx";
1410 break
8ff267be 1411 elif test -f "$xxx.exe"; then
1412 sh="$xxx";
8ff267be 1413 break
1414 fi
1415 done
1416 fi
1417 ;;
1418esac
1419
1420case "$sh" in
a33c94aa 1421'') cat >&2 <<EOM
8ff267be 1422$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1423
8ff267be 1424Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1425Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1426we'll try to straighten this all out.
8ff267be 1427EOM
1428 exit 1
1429 ;;
1430esac
1431
760ac839 1432: see if sh knows # comments
73614538 1433if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1434 shsharp=true
1435 spitshell=cat
760ac839 1436 xcat=/bin/cat
a931254c
JH
1437 test -f $xcat$_exe || xcat=/usr/bin/cat
1438 if test ! -f $xcat$_exe; then
4bdb8fb5 1439 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1440 if test -f $p/cat$_exe; then
1deb0a86 1441 xcat=$p/cat
3c728e00
JH
1442 break
1443 fi
1444 done
1deb0a86
JH
1445 if test ! -f $xcat$_exe; then
1446 echo "Can't find cat anywhere!"
3c728e00
JH
1447 exit 1
1448 fi
1449 fi
5440bc8e
JH
1450 echo "#!$xcat" >sharp
1451 $eunicefix sharp
1452 chmod +x sharp
1d8eaf8c 1453 ./sharp > today 2>/dev/null
760ac839 1454 if test -s today; then
760ac839
LW
1455 sharpbang='#!'
1456 else
5440bc8e
JH
1457 echo "#! $xcat" > sharp
1458 $eunicefix sharp
1459 chmod +x sharp
1d8eaf8c 1460 ./sharp > today 2>/dev/null
760ac839 1461 if test -s today; then
760ac839
LW
1462 sharpbang='#! '
1463 else
760ac839
LW
1464 sharpbang=': use '
1465 fi
1466 fi
1467else
dfe9444c 1468 echo " "
8ff267be 1469 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1470 shsharp=false
1471 cd ..
1472 echo "exec grep -v '^[ ]*#'" >spitshell
1473 chmod +x spitshell
1474 $eunicefix spitshell
1475 spitshell=`pwd`/spitshell
1476 cd UU
1477 echo "I presume that if # doesn't work, #! won't work either!"
1478 sharpbang=': use '
1479fi
5440bc8e 1480rm -f sharp today
760ac839
LW
1481
1482: figure out how to guarantee sh startup
8ff267be 1483case "$startsh" in
1484'') startsh=${sharpbang}${sh} ;;
1485*)
760ac839 1486esac
5440bc8e 1487cat >sharp <<EOSS
760ac839
LW
1488$startsh
1489set abc
1490test "$?abc" != 1
1491EOSS
1492
5440bc8e
JH
1493chmod +x sharp
1494$eunicefix sharp
1495if ./sharp; then
8ff267be 1496 : echo "Yup, it does."
760ac839 1497else
dfe9444c
AD
1498 echo "Hmm... '$startsh' does not guarantee sh startup..."
1499 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1500fi
5440bc8e 1501rm -f sharp
760ac839 1502
aebf16e7
AD
1503: Save command line options in file UU/cmdline.opt for later use in
1504: generating config.sh.
1505cat > cmdline.opt <<EOSH
613d6c3e 1506: Configure command line arguments.
aebf16e7
AD
1507config_arg0='$0'
1508config_args='$*'
1509config_argc=$#
1510EOSH
1511argn=1
ee45ea83
IZ
1512args_exp=''
1513args_sep=''
aebf16e7
AD
1514for arg in "$@"; do
1515 cat >>cmdline.opt <<EOSH
1516config_arg$argn='$arg'
1517EOSH
ee45ea83
IZ
1518 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1519$arg
1520EOC
1521 arg_exp=`cat cmdl.opt`
1522 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1523 argn=`expr $argn + 1`
ee45ea83 1524 args_sep=' '
aebf16e7 1525done
ee45ea83 1526rm -f cmdl.opt
aebf16e7 1527
2304df62
AD
1528: produce awk script to parse command line options
1529cat >options.awk <<'EOF'
1530BEGIN {
02e93a22 1531 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1532
1533 len = length(optstr);
1534 for (i = 1; i <= len; i++) {
1535 c = substr(optstr, i, 1);
1536 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1537 if (a == ":") {
1538 arg[c] = 1;
1539 i++;
1540 }
1541 opt[c] = 1;
1542 }
1543}
1544{
1545 expect = 0;
1546 str = $0;
1547 if (substr(str, 1, 1) != "-") {
1548 printf("'%s'\n", str);
1549 next;
1550 }
1551 len = length($0);
1552 for (i = 2; i <= len; i++) {
1553 c = substr(str, i, 1);
1554 if (!opt[c]) {
1555 printf("-%s\n", substr(str, i));
1556 next;
1557 }
1558 printf("-%s\n", c);
1559 if (arg[c]) {
1560 if (i < len)
1561 printf("'%s'\n", substr(str, i + 1));
1562 else
1563 expect = 1;
1564 next;
1565 }
1566 }
1567}
1568END {
1569 if (expect)
1570 print "?";
1571}
1572EOF
1573
1574: process the command line options
4633a7c4
LW
1575set X `for arg in "$@"; do echo "X$arg"; done |
1576 sed -e s/X// | awk -f options.awk`
2304df62
AD
1577eval "set $*"
1578shift
1579rm -f options.awk
1580
1581: set up default values
1582fastread=''
1583reuseval=false
1584config_sh=''
1585alldone=''
1586error=''
1587silent=''
1588extractsh=''
ecfc5424 1589override=''
16d20bd9 1590knowitall=''
02e93a22 1591rm -f optdef.sh posthint.sh
28757baa 1592cat >optdef.sh <<EOS
1593$startsh
1594EOS
2304df62 1595
dfe9444c 1596
2304df62
AD
1597: option parsing
1598while test $# -gt 0; do
1599 case "$1" in
1600 -d) shift; fastread=yes;;
1601 -e) shift; alldone=cont;;
1602 -f)
1603 shift
1604 cd ..
1605 if test -r "$1"; then
1606 config_sh="$1"
1607 else
a0d0e21e 1608 echo "$me: cannot read config file $1." >&2
2304df62
AD
1609 error=true
1610 fi
1611 cd UU
1612 shift;;
3f30fabf 1613 --help|\
2304df62
AD
1614 -h) shift; error=true;;
1615 -r) shift; reuseval=true;;
dfe9444c 1616 -s) shift; silent=true; realsilent=true;;
2304df62 1617 -E) shift; alldone=exit;;
16d20bd9 1618 -K) shift; knowitall=true;;
ecfc5424 1619 -O) shift; override=true;;
dfe9444c 1620 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1621 -D)
1622 shift
1623 case "$1" in
1624 *=)
1625 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1626 echo "$me: ignoring -D $1" >&2
1627 ;;
ecfc5424 1628 *=*) echo "$1" | \
1aef975c
AD
1629 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1630 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1631 esac
1632 shift
1633 ;;
1634 -U)
1635 shift
1636 case "$1" in
1aef975c 1637 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1638 *=*)
1639 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1640 echo "$me: ignoring -U $1" >&2
1641 ;;
1aef975c 1642 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1643 esac
1644 shift
1645 ;;
02e93a22
JH
1646 -A)
1647 shift
1648 xxx=''
1649 yyy="$1"
02e93a22 1650 zzz=''
5f83a3e9 1651 uuu=undef
02e93a22 1652 case "$yyy" in
f7c31117 1653 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1654 case "$zzz" in
1655 *:*) zzz='' ;;
1656 *) xxx=append
613d6c3e 1657 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
f7c31117 1658 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1659 esac
1660 ;;
1661 esac
1662 case "$xxx" in
1663 '') case "$yyy" in
f7c31117
JH
1664 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1665 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1666 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1667 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1668 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1669 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9 1670 esac
613d6c3e 1671 ;;
5f83a3e9 1672 esac
02e93a22
JH
1673 case "$xxx" in
1674 append)
5f83a3e9 1675 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1676 clear)
5f83a3e9 1677 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1678 define)
1679 case "$zzz" in
1680 '') zzz=define ;;
1681 esac
5f83a3e9 1682 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1683 eval)
5f83a3e9 1684 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1685 prepend)
5f83a3e9 1686 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1687 undef)
1688 case "$zzz" in
1689 '') zzz="$uuu" ;;
1690 esac
5f83a3e9
JH
1691 echo "$yyy=$zzz" >> posthint.sh ;;
1692 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1693 esac
bde6b06b 1694 shift
02e93a22 1695 ;;
216dac04 1696 -V) echo "$me generated by metaconfig 3.5 PL0." >&2
5f83a3e9 1697 exit 0;;
2304df62 1698 --) break;;
a0d0e21e 1699 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1700 *) break;;
1701 esac
1702done
1703
1704case "$error" in
1705true)
1706 cat >&2 <<EOM
2afac517 1707Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1708 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1709 -d : use defaults for all answers.
1710 -e : go on without questioning past the production of config.sh.
1711 -f : specify an alternate default configuration file.
1712 -h : print this help message and exit (with an error status).
1713 -r : reuse C symbols value if possible (skips costly nm extraction).
1714 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1715 -D : define symbol to have some value:
1716 -D symbol symbol gets the value 'define'
1717 -D symbol=value symbol gets the value 'value'
3f30fabf
MB
1718 common used examples (see INSTALL for more info):
1719 -Duse64bitint use 64bit integers
b79e0b55 1720 -Duse64bitall use 64bit integers and pointers
3f30fabf 1721 -Dusethreads use thread support
b79e0b55 1722 -Dinc_version_list=none do not include older perl trees in @INC
3f30fabf
MB
1723 -DEBUGGING=none DEBUGGING options
1724 -Dcc=gcc choose your compiler
1725 -Dprefix=/opt/perl5 choose your destination
2304df62 1726 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1727 -K : do not use unless you know what you are doing.
ecfc5424 1728 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1729 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1730 -U : undefine symbol:
1731 -U symbol symbol gets the value 'undef'
1732 -U symbol= symbol gets completely empty
3f30fabf 1733 e.g.: -Uversiononly
02e93a22 1734 -A : manipulate symbol after the platform specific hints have been applied:
2ac814f3
MB
1735 -A append:symbol=value append value to symbol
1736 -A symbol=value like append:, but with a separating space
1737 -A define:symbol=value define symbol to have value
1738 -A clear:symbol define symbol to be ''
1739 -A define:symbol define symbol to be 'define'
1740 -A eval:symbol=value define symbol to be eval of value
1741 -A prepend:symbol=value prepend value to symbol
1742 -A undef:symbol define symbol to be 'undef'
1743 -A undef:symbol= define symbol to be ''
3f30fabf 1744 e.g.: -A prepend:libswanted='cl pthread '
2ac814f3 1745 -A ccflags=-DSOME_MACRO
2304df62
AD
1746 -V : print version number and exit (with a zero status).
1747EOM
1748 exit 1
1749 ;;
1750esac
1751
dfe9444c
AD
1752: Sanity checks
1753case "$fastread$alldone" in
1754yescont|yesexit) ;;
1755*)
aaeb8e51
GS
1756 case "$extractsh" in
1757 true) ;;
1758 *)
1759 if test ! -t 0; then
1760 echo "Say 'sh Configure', not 'sh <Configure'"
1761 exit 1
1762 fi
1763 ;;
1764 esac
dfe9444c
AD
1765 ;;
1766esac
1767
2304df62
AD
1768exec 4>&1
1769case "$silent" in
1770true) exec 1>/dev/null;;
1771esac
1772
ecfc5424 1773: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1774touch optdef.sh
1775. ./optdef.sh
02e93a22
JH
1776: create the posthint manipulation script and leave the file out there...
1777touch posthint.sh
a0d0e21e 1778
2304df62 1779: set package name
34f1896b 1780package='perl5'
b4eb6b3d
JH
1781first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1782last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1783case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1784ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1785*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1786esac
2304df62 1787
2304df62
AD
1788: Some greps do not return status, grrr.
1789echo "grimblepritz" >grimble
1790if grep blurfldyick grimble >/dev/null 2>&1 ; then
1791 contains=contains
1792elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1793 contains=grep
1794else
1795 contains=contains
1796fi
1797rm -f grimble
1798: the following should work in any shell
1799case "$contains" in
1800contains*)
1801 echo " "
1802 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1803 cat >contains <<'EOSS'
1804grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1805EOSS
1806chmod +x contains
1807esac
1808
dfe9444c
AD
1809: Find the path to the source tree
1810case "$src" in
1811'') case "$0" in
b233458b
JH
1812 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1813 case "$src" in
1814 /*) ;;
8504afb7 1815 .) ;;
b233458b
JH
1816 *) src=`cd ../$src && pwd` ;;
1817 esac
1818 ;;
dfe9444c
AD
1819 *) src='.';;
1820 esac;;
1821esac
1822case "$src" in
1823'') src=/
1824 rsrc=/
1825 ;;
34f1896b
MB
1826/*) rsrc="$src";;
1827*) rsrc="../$src";;
dfe9444c
AD
1828esac
1829if test -f $rsrc/Configure && \
34f1896b 1830 $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
dfe9444c
AD
1831then
1832 : found it, so we are ok.
1833else
1834 rsrc=''
1835 for src in . .. ../.. ../../.. ../../../..; do
1836 if test -f ../$src/Configure && \
1837 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1838 then
1839 rsrc=../$src
1840 break
1841 fi
1842 done
1843fi
1844case "$rsrc" in
1845'')
1846 cat <<EOM >&4
1847
1848Sorry, I can't seem to locate the source dir for $package. Please start
1849Configure with an explicit path -- i.e. /some/path/Configure.
1850
1851EOM
1852 exit 1
1853 ;;
1854../.) rsrc='..';;
1855*)
1856 echo " "
1857 echo "Sources for $package found in \"$src\"." >&4
1858 ;;
1859esac
1860
1861: script used to extract .SH files with variable substitutions
1862cat >extract <<'EOS'
a02608de 1863PERL_CONFIG_SH=true
dfe9444c 1864echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1865if test -f MANIFEST; then
1866 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1867else
1868 echo "(Looking for .SH files under the source directory.)"
6904989c 1869 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1870fi
1871shift
1872case $# in
6904989c 18730) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1874esac
6904989c 1875if test ! -f "$src/$1"; then
dfe9444c
AD
1876 shift
1877fi
1878mkdir_p='
1879name=$1;
1880create="";
1881while test $name; do
1882 if test ! -d "$name"; then
1883 create="$name $create";
1884 name=`echo $name | sed -e "s|^[^/]*$||"`;
1885 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1886 else
1887 name="";
1888 fi;
1889done;
1890for file in $create; do
1891 mkdir $file;
1892done
1893'
1894for file in $*; do
1895 case "$src" in
1896 ".")
1897 case "$file" in
1898 */*)
1899 dir=`expr X$file : 'X\(.*\)/'`
1900 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1901 (cd "$dir" && . ./$file)
dfe9444c
AD
1902 ;;
1903 *)
1904 . ./$file
1905 ;;
1906 esac
1907 ;;
1908 *)
1909 case "$file" in
1910 */*)
1911 dir=`expr X$file : 'X\(.*\)/'`
1912 file=`expr X$file : 'X.*/\(.*\)'`
1913 (set x $dir; shift; eval $mkdir_p)
6904989c 1914 sh <"$src/$dir/$file"
dfe9444c
AD
1915 ;;
1916 *)
6904989c 1917 sh <"$src/$file"
dfe9444c
AD
1918 ;;
1919 esac
1920 ;;
1921 esac
1922done
6904989c 1923if test -f "$src/config_h.SH"; then
dfe9444c
AD
1924 if test ! -f config.h; then
1925 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1926 . "$src/config_h.SH"
dfe9444c
AD
1927 fi
1928fi
1929EOS
1930
1931: extract files and exit if asked to do so
1932case "$extractsh" in
1933true)
1934 case "$realsilent" in
1935 true) ;;
1936 *) exec 1>&4;;
1937 esac
1938 case "$config_sh" in
1939 '') config_sh='config.sh';;
1940 esac
1941 echo " "
1942 echo "Fetching answers from $config_sh..."
1943 cd ..
1944 . $config_sh
1945 test "$override" && . ./optdef.sh
1946 echo " "
1947 . UU/extract
1948 rm -rf UU
24ccb310 1949 echo "Extraction done."
dfe9444c
AD
1950 exit 0
1951 ;;
1952esac
1953
1954: Eunice requires " " instead of "", can you believe it
1955echo " "
1956: Here we go...
1957echo "Beginning of configuration questions for $package."
1958
1959trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1960
2304df62
AD
1961: first determine how to suppress newline on echo command
1962echo " "
1963echo "Checking echo to see how to suppress newlines..."
1964(echo "hi there\c" ; echo " ") >.echotmp
1965if $contains c .echotmp >/dev/null 2>&1 ; then
1966 echo "...using -n."
1967 n='-n'
1968 c=''
1969else
1970 cat <<'EOM'
1971...using \c
1972EOM
1973 n=''
1974 c='\c'
1975fi
1976echo $n "The star should be here-->$c"
1977echo '*'
1978rm -f .echotmp
1979
1980: Now test for existence of everything in MANIFEST
1981echo " "
6904989c 1982if test -f "$rsrc/MANIFEST"; then
2304df62 1983 echo "First let's make sure your kit is complete. Checking..." >&4
1d8eaf8c 1984 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
776a38e3 1985 (split -l 50 2>/dev/null || split -50)
2304df62 1986 rm -f missing
dfe9444c 1987 tmppwd=`pwd`
2304df62 1988 for filelist in x??; do
776a38e3
MB
1989 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1990 >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1991 done
1992 if test -s missing; then
1993 cat missing >&4
1994 cat >&4 <<'EOM'
1995
1996THIS PACKAGE SEEMS TO BE INCOMPLETE.
1997
1998You have the option of continuing the configuration process, despite the
1999distinct possibility that your kit is damaged, by typing 'y'es. If you
2000do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 2001and contact the author (perlbug@perl.org).
2304df62
AD
2002
2003EOM
2004 echo $n "Continue? [n] $c" >&4
2005 read ans
2006 case "$ans" in
2007 y*)
2008 echo "Continuing..." >&4
2009 rm -f missing
2010 ;;
2011 *)
2012 echo "ABORTING..." >&4
2013 kill $$
2014 ;;
2015 esac
2016 else
dfe9444c 2017 echo "Looks good..."
2304df62
AD
2018 fi
2019else
2020 echo "There is no MANIFEST file. I hope your kit is complete !"
2021fi
2022rm -f missing x??
2023
5ff3f7a4 2024: Find the appropriate value for a newline for tr
613d6c3e 2025echo " "
5ff3f7a4
GS
2026if test -n "$DJGPP"; then
2027 trnl='\012'
2028fi
2029if test X"$trnl" = X; then
2030 case "`echo foo|tr '\n' x 2>/dev/null`" in
2031 foox) trnl='\n' ;;
2032 esac
2033fi
2034if test X"$trnl" = X; then
2035 case "`echo foo|tr '\012' x 2>/dev/null`" in
2036 foox) trnl='\012' ;;
2037 esac
2038fi
2039if test X"$trnl" = X; then
8be2c24c
JH
2040 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2041 fooxy) trnl='\n\r' ;;
2042 esac
2043fi
2044if test X"$trnl" = X; then
5ff3f7a4
GS
2045 cat <<EOM >&2
2046
2047$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2048
2049EOM
2050 exit 1
2051fi
2052
2304df62
AD
2053: compute the number of columns on the terminal for proper question formatting
2054case "$COLUMNS" in
2055'') COLUMNS='80';;
2056esac
2057
2058: set up the echo used in my read
2059myecho="case \"\$xxxm\" in
2060'') echo $n \"\$rp $c\" >&4;;
2061*) case \"\$rp\" in
2062 '') echo $n \"[\$xxxm] $c\";;
2063 *)
2064 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
2065 echo \"\$rp\" >&4
2066 echo $n \"[\$xxxm] $c\" >&4
2067 else
2068 echo $n \"\$rp [\$xxxm] $c\" >&4
2069 fi
2070 ;;
2071 esac;;
2072esac"
2073
2074: now set up to do reads with possible shell escape and default assignment
2075cat <<EOSC >myread
28757baa 2076$startsh
2304df62
AD
2077xxxm=\$dflt
2078$myecho
2079ans='!'
2080case "\$fastread" in
2081yes) case "\$dflt" in
2082 '') ;;
2083 *) ans='';
2084 case "\$silent-\$rp" in
2085 true-) ;;
2086 *) echo " " >&4;;
2087 esac;;
2088 esac;;
2089*) case "\$silent" in
2090 true) case "\$rp" in
2091 '') ans='';;
2092 esac;;
2093 esac;;
2094esac
2095while expr "X\$ans" : "X!" >/dev/null; do
2096 read answ
2097 set x \$xxxm
2098 shift
dfe9444c 2099 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 2100 case "\$answ" in
dfe9444c
AD
2101 "!")
2102 sh 1>&4
2103 echo " "
2104 $myecho
2105 ;;
2106 !*)
2107 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2108 shift
2109 sh 1>&4 -c "\$*"
2110 echo " "
2111 $myecho
2112 ;;
2304df62
AD
2113 "\$ans")
2114 case "\$ans" in
ecfc5424
AD
2115 \\&*)
2116 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2117 shift
2118 case "\$1" in
2119 -d)
2120 fastread=yes
40a7a20a 2121 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2122 ;;
2123 -*)
40a7a20a 2124 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2125 ;;
2126 esac
2127 $myecho
2128 ans=!
2129 ;;
2304df62
AD
2130 esac;;
2131 *)
2132 case "\$aok" in
2133 y)
2134 echo "*** Substitution done -- please confirm."
2135 xxxm="\$ans"
c9795ab7 2136 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2137 xxxm="\$ans"
2138 ans=!
2139 ;;
2140 *)
2141 echo "*** Error -- try again."
2142 ans=!
2143 ;;
2144 esac
2145 $myecho
2146 ;;
2147 esac
2148 case "\$ans\$xxxm\$nostick" in
2149 '')
2150 ans=!
2151 $myecho
2152 ;;
2153 esac
2154done
2155case "\$ans" in
2156'') ans="\$xxxm";;
2157esac
2158EOSC
2159
2160: create .config dir to save info across Configure sessions
2161test -d ../.config || mkdir ../.config
2162cat >../.config/README <<EOF
2163This directory created by Configure to save information that should
dfe9444c 2164persist across sessions for $package.
2304df62
AD
2165
2166You may safely delete it if you wish.
2167EOF
2168
613d6c3e 2169: See if we are using a devel version and want that
9507cadf 2170xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2171case "$usedevel" in
1be1b388
MB
2172$define|true|[yY]*)
2173 usedevel="$define" ;;
9507cadf 2174*) case "$xversion" in
0107c034
JH
2175 *[13579])
2176 cat >&4 <<EOH
2177*** WHOA THERE!!! ***
2178
2179 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2180 The version of this $package distribution is $xversion, that is, odd,
2181 (as opposed to even) and that signifies a development release.
3d5d58b1 2182 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2183
2184 Do ***NOT*** install this into production use.
2185 Data corruption and crashes are possible.
2186
2187 It is most seriously suggested that you do not continue any further
2188 unless you want to help in developing and debugging Perl.
2189
6adc6a45
JH
2190 If you *still* want to build perl, you can answer 'y' now,
2191 or pass -Dusedevel to Configure.
2192
0107c034
JH
2193EOH
2194 rp='Do you really want to continue?'
2195 dflt='n'
2196 . ./myread
2197 case "$ans" in
8feeef0e
JH
2198 [yY]) echo >&4 "Okay, continuing."
2199 usedevel="$define" ;;
0107c034
JH
2200 *) echo >&4 "Okay, bye."
2201 exit 1
2202 ;;
2203 esac
2204 ;;
2205 esac
1be1b388 2206 usedevel="$undef"
0107c034
JH
2207 ;;
2208esac
8feeef0e
JH
2209case "$usedevel" in
2210$define|true|[yY]*)
2211 case "$versiononly" in
2212 '') versiononly="$define" ;;
2213 esac
2214 case "$installusrbinperl" in
2215 '') installusrbinperl="$undef" ;;
2216 esac
2217 ;;
2218esac
0107c034 2219
2304df62
AD
2220: general instructions
2221needman=true
2222firsttime=true
760ac839 2223user=`(logname) 2>/dev/null`
dfe9444c
AD
2224case "$user" in
2225'') user=`whoami 2>&1`;;
760ac839 2226esac
2304df62
AD
2227if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2228 firsttime=false
2229 echo " "
2230 rp='Would you like to see the instructions?'
2231 dflt=n
2232 . ./myread
2233 case "$ans" in
2234 [yY]*) ;;
2235 *) needman=false;;
2236 esac
2237fi
2238if $needman; then
2239 cat <<EOH
4e2a5f63 2240
2304df62 2241This installation shell script will examine your system and ask you questions
a0d0e21e 2242to determine how the perl5 package should be installed. If you get
2304df62
AD
2243stuck on a question, you may use a ! shell escape to start a subshell or
2244execute a command. Many of the questions will have default answers in square
2245brackets; typing carriage return will give you the default.
2246
2247On some of the questions which ask for file or directory names you are allowed
2248to use the ~name construct to specify the login directory belonging to "name",
2249even if you don't have a shell which knows about that. Questions where this is
2250allowed will be marked "(~name ok)".
2251
2252EOH
2253 rp=''
2254 dflt='Type carriage return to continue'
2255 . ./myread
2256 cat <<'EOH'
2257
2258The prompter used in this script allows you to use shell variables and
2259backticks in your answers. You may use $1, $2, etc... to refer to the words
2260in the default answer, as if the default line was a set of arguments given to a
2261script shell. This means you may also use $* to repeat the whole default line,
2262so you do not have to re-type everything to add something to the default.
2263
cd95ead5 2264Every time there is a substitution, you will have to confirm. If there is an
2304df62
AD
2265error (e.g. an unmatched backtick), the default answer will remain unchanged
2266and you will be prompted again.
2267
2268If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2269the questions and use the computed defaults (or the previous answers if there
2270was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2271You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2272on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2273
2274EOH
2275 . ./myread
2276 cat <<EOH
2277
2278Much effort has been expended to ensure that this shell script will run on any
2279Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2280Configure and run it again. If you can't run Configure for some reason,
2281you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2282have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2283
2284This installation script affects things in two ways:
2285
22861) it may do direct variable substitutions on some of the files included
2287 in this kit.
22882) it builds a config.h file for inclusion in C programs. You may edit
2289 any of these files as the need arises after running this script.
2290
2291If you make a mistake on a question, there is no easy way to back up to it
2292currently. The easiest thing to do is to edit config.sh and rerun all the SH
2293files. Configure will offer to let you do this before it runs the SH files.
2294
2295EOH
2296 dflt='Type carriage return to continue'
2297 . ./myread
2298 case "$firsttime" in
2299 true) echo $user >>../.config/instruct;;
2300 esac
2301fi
2302
2304df62
AD
2303: find out where common programs are
2304echo " "
2305echo "Locating common programs..." >&4
2306cat <<EOSC >loc
2307$startsh
2308case \$# in
23090) exit 1;;
2310esac
2311thing=\$1
2312shift
2313dflt=\$1
2314shift
2315for dir in \$*; do
2316 case "\$thing" in
2317 .)
2318 if test -d \$dir/\$thing; then
2319 echo \$dir
2320 exit 0
2321 fi
2322 ;;
2323 *)
a0d0e21e 2324 for thisthing in \$dir/\$thing; do
ecfc5424 2325 : just loop through to pick last item
a0d0e21e 2326 done
25f94b33 2327 if test -f \$thisthing; then
a0d0e21e 2328 echo \$thisthing
2304df62 2329 exit 0
a5a94ea5
JH
2330 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2331 echo \$thisthing
776a38e3 2332 exit 0
2304df62 2333 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2334 if test -n "$DJGPP"; then
2335 echo \$dir/\$thing.exe
b921d661 2336 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2337 : on Eunice apparently
2338 echo \$dir/\$thing
2339 fi
2d736872 2340 exit 0
2304df62
AD
2341 fi
2342 ;;
2343 esac
2344done
2345echo \$dflt
2346exit 1
2347EOSC
2348chmod +x loc
2349$eunicefix loc
2350loclist="
2351awk
2352cat
f8006fac 2353chmod
b4eb6b3d
JH
2354comm
2355cp
2304df62
AD
2356echo
2357expr
2358grep
a0d0e21e 2359ls
b4eb6b3d 2360mkdir
2304df62
AD
2361rm
2362sed
b4eb6b3d 2363sort
85e6fe83 2364touch
2304df62 2365tr
b4eb6b3d 2366uniq
2304df62
AD
2367"
2368trylist="
dfe9444c 2369ar
3659ebf1 2370bison
b4eb6b3d 2371byacc
2304df62 2372cpp
b4eb6b3d 2373csh
2304df62
AD
2374date
2375egrep
1fef16b3 2376gmake
8ff267be 2377gzip
b4eb6b3d 2378less
8ff267be 2379ln
3c728e00 2380make
b4eb6b3d 2381more
693762b4 2382nm
b4eb6b3d 2383nroff
b8677e3b 2384perl
b4eb6b3d 2385pg
2304df62
AD
2386test
2387uname
8ff267be 2388zip
2304df62 2389"
8e07c86e 2390pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2391pth="$pth /lib /usr/lib"
2392for file in $loclist; do
dfe9444c
AD
2393 eval xxx=\$$file
2394 case "$xxx" in
2395 /*|?:[\\/]*)
2396 if test -f "$xxx"; then
2397 : ok
2398 else
2399 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2400 xxx=`./loc $file $file $pth`
2401 fi
2402 ;;
2403 '') xxx=`./loc $file $file $pth`;;
2404 *) xxx=`./loc $xxx $xxx $pth`;;
2405 esac
a5a94ea5 2406 eval $file=$xxx$_exe
2304df62
AD
2407 eval _$file=$xxx
2408 case "$xxx" in
2409 /*)
2410 echo $file is in $xxx.
2411 ;;
8e07c86e
AD
2412 ?:[\\/]*)
2413 echo $file is in $xxx.
2414 ;;
2304df62 2415 *)
25f94b33
AD
2416 echo "I don't know where '$file' is, and my life depends on it." >&4
2417 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2418 exit 1
2304df62
AD
2419 ;;
2420 esac
2421done
2422echo " "
2423echo "Don't worry if any of the following aren't found..."
2424say=offhand
2425for file in $trylist; do
dfe9444c
AD
2426 eval xxx=\$$file
2427 case "$xxx" in
2428 /*|?:[\\/]*)
2429 if test -f "$xxx"; then
2430 : ok
2431 else
2432 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2433 xxx=`./loc $file $file $pth`
2434 fi
2435 ;;
2436 '') xxx=`./loc $file $file $pth`;;
2437 *) xxx=`./loc $xxx $xxx $pth`;;
2438 esac
306a8474 2439 eval $file=$xxx$_exe
2304df62
AD
2440 eval _$file=$xxx
2441 case "$xxx" in
2442 /*)
2443 echo $file is in $xxx.
2444 ;;
8e07c86e
AD
2445 ?:[\\/]*)
2446 echo $file is in $xxx.
2447 ;;
2304df62
AD
2448 *)
2449 echo "I don't see $file out there, $say."
2450 say=either
2451 ;;
2452 esac
2453done
2454case "$egrep" in
1fef16b3 2455egrep)
2304df62
AD
2456 echo "Substituting grep for egrep."
2457 egrep=$grep
868439a2 2458 _egrep=$grep
2304df62
AD
2459 ;;
2460esac
3141af47
MB
2461case "$less" in
2462'') ;;
2463*) if $less -R </dev/null >/dev/null; then
2464 echo "Substituting less -R for less."
2465 less="$less -R"
2466 _less=$less
2467 fi
2468 ;;
2469esac
8ff267be 2470case "$ln" in
1fef16b3 2471ln)
8ff267be 2472 echo "Substituting cp for ln."
2473 ln=$cp
868439a2 2474 _ln=$cp
8ff267be 2475 ;;
2476esac
2e26f1d5 2477case "$make" in
613d6c3e 2478make)
2e26f1d5
JH
2479 case "$gmake" in
2480 gmake)
2481 echo "I can't find make or gmake, and my life depends on it." >&4
2482 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2483 exit 1
2484 ;;
2485 esac
2486 ;;
613d6c3e 2487esac
2e26f1d5
JH
2488case "$gmake" in
2489gmake) ;;
2490*) # We can't have osname yet.
1fef16b3
JH
2491 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2492 # Assume that gmake, if found, is definitely GNU make
2493 # and prefer it over the system make.
2494 echo "Substituting gmake for make."
2495 make=$gmake
868439a2 2496 _make=$gmake
1fef16b3
JH
2497 fi
2498 ;;
a5a94ea5 2499esac
2304df62
AD
2500case "$test" in
2501test)
2502 echo "Hopefully test is built into your sh."
2503 ;;
2504*)
73614538 2505 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2506 echo "Using the test built into your sh."
2304df62
AD
2507 test=test
2508 _test=test
2509 fi
2510 ;;
2511esac
2512case "$echo" in
2513echo)
2514 echo "Hopefully echo is built into your sh."
2515 ;;
2516'') ;;
2517*)
2518 echo " "
2519echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2520 $echo $n "hi there$c" >foo1
2521 echo $n "hi there$c" >foo2
2522 if cmp foo1 foo2 >/dev/null 2>&1; then
2523 echo "They are compatible. In fact, they may be identical."
2524 else
2525 case "$n" in
2526 '-n') n='' c='\c';;
2527 *) n='-n' c='';;
2528 esac
2529 cat <<FOO
2530They are not compatible! You are probably running ksh on a non-USG system.
2531I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2532have echo built in and we may have to run some Bourne shell scripts. That
2533means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2534
2535FOO
2536 $echo $n "The star should be here-->$c"
2537 $echo "*"
2538 fi
2539 $rm -f foo1 foo2
2540 ;;
2541esac
2542
2f88d857
MB
2543# This question was auctioned at YAPC::Europe-2007 in Vienna
2544# I never promised you could answer it. I only auctioned the question.
2545cat <<FOO
2546The following message is sponsored by
2547
2548 Dresden.pm<--The stars should be here.
2549
2550Dear Perl user, system administrator or package
2551maintainer, the Perl community sends greetings to
2552you. Do you (emblematical) greet back [Y/n]? n
2553
2554FOO
2555
613d6c3e 2556: Check what type of C compiler we use
6b769f8f 2557cat <<EOS >trygcc
2573c5f9
JH
2558$startsh
2559EOS
6b769f8f 2560cat <<'EOSC' >>trygcc
2573c5f9
JH
2561case "$cc" in
2562'') ;;
2563*) $rm -f try try.*
2564 $cat >try.c <<EOM
2565int main(int argc, char *argv[]) {
2566 return 0;
2567}
2568EOM
e4778687 2569 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2570 :
2571 else
2572 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2573 despair=yes
2574 trygcc=yes
2575 case "$cc" in
2576 *gcc*) trygcc=no ;;
2577 esac
dce40316
AD
2578 # Skip this test because it gives a false match on output like:
2579 # ./trygcc: line 23: cc: command not found
2580 # case "`$cc -v -c try.c 2>&1`" in
2581 # *gcc*) trygcc=no ;;
2582 # esac
2573c5f9
JH
2583 if $test X"$trygcc" = Xyes; then
2584 if gcc -o try -c try.c; then
2585 echo " "
2586 echo "You seem to have a working gcc, though." >&4
dce40316
AD
2587 # Switching compilers may undo the work of hints files.
2588 # The most common problem is -D_REENTRANT for threads.
2589 # This heuristic catches that case, but gets false positives
2590 # if -Dusethreads was not actually specified. Better to
2591 # bail out here with a useful message than fail
2592 # mysteriously later. Should we perhaps just try to
2593 # re-invoke Configure -Dcc=gcc config_args ?
2594 if $test -f usethreads.cbu; then
2595 $cat >&4 <<EOM
2596
2597*** However, any setting of the C compiler flags (e.g. for thread support)
2598*** will be lost. It may be necessary for you to restart Configure and
2599*** add -Dcc=gcc to your Configure command line.
2600
2601EOM
2602 rp="Would you like to go ahead and try gcc anyway?"
2603 dflt=n
2604 else
2605 rp="Would you like to use it?"
2606 dflt=y
2607 fi
2573c5f9
JH
2608 if $test -f myread; then
2609 . ./myread
2610 else
2611 if $test -f UU/myread; then
2612 . ./UU/myread
2613 else
2614 echo "Cannot find myread, sorry. Aborting." >&2
2615 exit 1
2616 fi
2617 fi
2618 case "$ans" in
6371411c 2619 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2573c5f9
JH
2620 esac
2621 fi
2622 fi
6b769f8f
RB
2623 fi
2624 $rm -f try try.*
2625 ;;
2626esac
2627EOSC
2628
2629cat <<EOS >checkcc
2630$startsh
2631EOS
2632cat <<'EOSC' >>checkcc
2633case "$cc" in
2634'') ;;
2635*) $rm -f try try.*
2636 $cat >try.c <<EOM
2637int main(int argc, char *argv[]) {
2638 return 0;
2639}
2640EOM
2641 if $cc -o try $ccflags $ldflags try.c; then
2642 :
2643 else
2573c5f9 2644 if $test X"$despair" = Xyes; then
6b769f8f
RB
2645 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2646 fi
2647 $cat >&4 <<EOM
5dd4fbdf
MB
2648You need to find a working C compiler.
2649Either (purchase and) install the C compiler supplied by your OS vendor,
2650or for a free C compiler try http://gcc.gnu.org/
2651I cannot continue any further, aborting.
2652EOM
6b769f8f 2653 exit 1
2573c5f9
JH
2654 fi
2655 $rm -f try try.*
2656 ;;
2657esac
2658EOSC
2659
a0d0e21e
LW
2660: determine whether symbolic links are supported
2661echo " "
2662$touch blurfl
2663if $ln -s blurfl sym > /dev/null 2>&1 ; then
2664 echo "Symbolic links are supported." >&4
818f00be 2665 lns="$ln -s"
a0d0e21e
LW
2666else
2667 echo "Symbolic links are NOT supported." >&4
2668 lns="$ln"
2669fi
2670$rm -f blurfl sym
2671
dafca956
JH
2672: determine whether symbolic links are supported
2673echo " "
2674case "$lns" in
18ea2752 2675*"ln"*" -s")
dafca956
JH
2676 echo "Checking how to test for symbolic links..." >&4
2677 $lns blurfl sym
4b661809 2678 if $test "X$issymlink" = X; then
2e2a97a6
JH
2679 case "$newsh" in
2680 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2681 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2682 esac
5d644a95
MB
2683 if test $? = 0; then
2684 issymlink="test -h"
2e2a97a6
JH
2685 else
2686 echo "Your builtin 'test -h' may be broken." >&4
2687 case "$test" in
2688 /*) ;;
2689 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2690 for p in $pth
2691 do
2692 if test -f "$p/$test"; then
2693 test="$p/$test"
2694 break
2695 fi
2696 done
2697 ;;
2698 esac
2699 case "$test" in
2700 /*)
2701 echo "Trying external '$test -h'." >&4
2702 issymlink="$test -h"
2703 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2704 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2705 issymlink=''
2706 fi
2707 ;;
2708 *) issymlink='' ;;
2709 esac
5d644a95
MB
2710 fi
2711 fi
4b661809 2712 if $test "X$issymlink" = X; then
dafca956 2713 if $test -L sym 2>/dev/null; then
5d644a95 2714 issymlink="$test -L"
2e2a97a6 2715 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2716 fi
2717 fi
4b661809 2718 if $test "X$issymlink" != X; then
5d644a95 2719 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2720 else
2721 echo "I do not know how you can test for symbolic links." >&4
2722 fi
2723 $rm -f blurfl sym
2724 ;;
2725*) echo "No symbolic links, so not testing for their testing..." >&4
2726 ;;
2727esac
2728echo " "
2729
34f1896b 2730: Make symlinks util
dafca956
JH
2731case "$mksymlinks" in
2732$define|true|[yY]*)
2733 case "$src" in
2734 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2735 exit 1
2736 ;;
4b661809 2737 *) case "$lns:$issymlink" in
f314eb9f 2738 *"ln"*" -s:"*"test -"?)
dafca956
JH
2739 echo "Creating the symbolic links..." >&4
2740 echo "(First creating the subdirectories...)" >&4
2741 cd ..
2742 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2743 read directory
2744 test -z "$directory" && break
2745 mkdir -p $directory
2746 done
2747 # Sanity check 1.
2748 if test ! -d t/base; then
2749 echo "Failed to create the subdirectories. Aborting." >&4
2750 exit 1
2751 fi
2752 echo "(Then creating the symlinks...)" >&4
2753 awk '{print $1}' $src/MANIFEST | while true; do
2754 read filename
2755 test -z "$filename" && break
2756 if test -f $filename; then
5d644a95 2757 if $issymlink $filename; then
dafca956
JH
2758 rm -f $filename
2759 fi
2760 fi
2761 if test -f $filename; then
2762 echo "$filename already exists, not symlinking."
2763 else
2764 ln -s $src/$filename $filename
2765 fi
2766 done
2767 # Sanity check 2.
a0d24b8a
JH
2768 if test ! -f t/base/lex.t; then
2769 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2770 exit 1
2771 fi
2772 cd UU
2773 ;;
2774 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2775 ;;
2776 esac
2777 ;;
2778 esac
2779 ;;
2780esac
2781
613d6c3e 2782: Check for Cross-Compilation
5440bc8e
JH
2783case "$usecrosscompile" in
2784$define|true|[yY]*)
93bc48fa 2785 $echo "Cross-compiling..."
5440bc8e
JH
2786 croak=''
2787 case "$cc" in
2788 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2789 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2790 ar=$targetarch-ar
2791 # leave out ld, choosing it is more complex
2792 nm=$targetarch-nm
2793 ranlib=$targetarch-ranlib
93bc48fa 2794 $echo 'extern int foo;' > try.c
f8006fac 2795 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2796 shift
2797 if $test $# -gt 0; then
2798 incpth="$incpth $*"
f8006fac
JH
2799 incpth="`$echo $incpth|$sed 's/^ //'`"
2800 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2801 for i in $*; do
f8006fac 2802 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2803 if $test -d $j; then
2804 libpth="$libpth $j"
2805 fi
2806 done
f8006fac
JH
2807 libpth="`$echo $libpth|$sed 's/^ //'`"
2808 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2809 fi
2810 $rm -f try.c
5440bc8e
JH
2811 ;;
2812 esac
2813 case "$targetarch" in
93bc48fa
JH
2814 '') echo "Targetarch not defined." >&4; croak=y ;;
2815 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2816 esac
2817 case "$incpth" in
93bc48fa 2818 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2819 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2820 esac
2821 case "$libpth" in
93bc48fa 2822 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2823 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2824 esac
93bc48fa
JH
2825 case "$usrinc" in
2826 '') for i in $incpth; do
2827 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2828 usrinc=$i
2829 echo "Guessing usrinc $usrinc." >&4
2830 break
2831 fi
2832 done
2833 case "$usrinc" in
2834 '') echo "Usrinc not defined." >&4; croak=y ;;
2835 esac
2836 ;;
2837 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2838 esac
93bc48fa
JH
2839 case "$targethost" in
2840 '') echo "Targethost not defined." >&4; croak=y ;;
2841 *) echo "Using targethost $targethost." >&4
5440bc8e 2842 esac
93bc48fa
JH
2843 locincpth=' '
2844 loclibpth=' '
5440bc8e 2845 case "$croak" in
93bc48fa 2846 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2847 esac
2848 case "$src" in
2849 /*) run=$src/Cross/run
93c0359c 2850 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2851 to=$src/Cross/to
2852 from=$src/Cross/from
2853 ;;
93bc48fa 2854 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2855 run=$pwd/Cross/run
f8006fac 2856 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2857 to=$pwd/Cross/to
2858 from=$pwd/Cross/from
2859 ;;
2860 esac
2861 case "$targetrun" in
2862 '') targetrun=ssh ;;
2863 esac
2864 case "$targetto" in
2865 '') targetto=scp ;;
2866 esac
2867 case "$targetfrom" in
2868 '') targetfrom=scp ;;
2869 esac
2870 run=$run-$targetrun
2871 to=$to-$targetto
2872 from=$from-$targetfrom
93bc48fa
JH
2873 case "$targetdir" in
2874 '') targetdir=/tmp
2875 echo "Guessing targetdir $targetdir." >&4
2876 ;;
2877 esac
5440bc8e 2878 case "$targetuser" in
93bc48fa
JH
2879 '') targetuser=root
2880 echo "Guessing targetuser $targetuser." >&4
2881 ;;
5440bc8e
JH
2882 esac
2883 case "$targetfrom" in
2884 scp) q=-q ;;
2885 *) q='' ;;
2886 esac
2887 case "$targetrun" in
2888 ssh|rsh)
2889 cat >$run <<EOF
2890#!/bin/sh
93c0359c
JH
2891case "\$1" in
2892-cwd)
2893 shift
2894 cwd=\$1
2895 shift
2896 ;;
2897esac
2898case "\$cwd" in
2899'') cwd=$targetdir ;;
2900esac
5440bc8e
JH
2901exe=\$1
2902shift
93c0359c
JH
2903if $test ! -f \$exe.xok; then
2904 $to \$exe
2905 $touch \$exe.xok
2906fi
2907$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2908EOF
2909 ;;
93bc48fa 2910 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2911 exit 1
2912 ;;
2913 esac
93c0359c
JH
2914 case "$targetmkdir" in
2915 */Cross/mkdir)
2916 cat >$targetmkdir <<EOF
2917#!/bin/sh
2918$targetrun -l $targetuser $targethost "mkdir -p \$@"
2919EOF
f8006fac 2920 $chmod a+rx $targetmkdir
93c0359c
JH
2921 ;;
2922 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2923 exit 1
2924 ;;
2925 esac
5440bc8e
JH
2926 case "$targetto" in
2927 scp|rcp)
2928 cat >$to <<EOF
2929#!/bin/sh
2930for f in \$@
2931do
93c0359c
JH
2932 case "\$f" in
2933 /*)
2934 $targetmkdir \`dirname \$f\`
2935 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2936 ;;
2937 *)
2938 $targetmkdir $targetdir/\`dirname \$f\`
2939 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2940 ;;
2941 esac
5440bc8e
JH
2942done
2943exit 0
2944EOF
2945 ;;
2946 cp) cat >$to <<EOF
2947#!/bin/sh
93c0359c
JH
2948for f in \$@
2949do
2950 case "\$f" in
2951 /*)
2952 $mkdir -p $targetdir/\`dirname \$f\`
2953 $cp \$f $targetdir/\$f || exit 1
2954 ;;
2955 *)
2956 $targetmkdir $targetdir/\`dirname \$f\`
2957 $cp \$f $targetdir/\$f || exit 1
2958 ;;
2959 esac
2960done
2961exit 0
5440bc8e
JH
2962EOF
2963 ;;
93bc48fa 2964 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2965 exit 1
2966 ;;
2967 esac
2968 case "$targetfrom" in
2969 scp|rcp)
2970 cat >$from <<EOF
2971#!/bin/sh
2972for f in \$@
2973do
93c0359c 2974 $rm -f \$f
5440bc8e
JH
2975 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2976done
2977exit 0
2978EOF
2979 ;;
2980 cp) cat >$from <<EOF
2981#!/bin/sh
2982for f in \$@
2983do
93c0359c 2984 $rm -f \$f
5440bc8e
JH
2985 cp $targetdir/\$f . || exit 1
2986done
2987exit 0
2988EOF
2989 ;;
93bc48fa 2990 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2991 exit 1
2992 ;;
2993 esac
93bc48fa
JH
2994 if $test ! -f $run; then
2995 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2996 else
f8006fac 2997 $chmod a+rx $run
5440bc8e 2998 fi
93bc48fa
JH
2999 if $test ! -f $to; then
3000 echo "Target 'to' script '$to' not found." >&4
5440bc8e 3001 else
f8006fac 3002 $chmod a+rx $to
5440bc8e 3003 fi
93bc48fa
JH
3004 if $test ! -f $from; then
3005 echo "Target 'from' script '$from' not found." >&4
5440bc8e 3006 else
f8006fac 3007 $chmod a+rx $from
5440bc8e 3008 fi
93bc48fa 3009 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
3010 exit 1
3011 fi
3012 cat >&4 <<EOF
f8006fac
JH
3013Using '$run' for remote execution,
3014and '$from' and '$to'
93bc48fa 3015for remote file transfer.
5440bc8e
JH
3016EOF
3017 ;;
3018*) run=''
3019 to=:
3020 from=:
3021 usecrosscompile='undef'
3022 targetarch=''
3023 ;;
3024esac
3025
ecfc5424
AD
3026: see whether [:lower:] and [:upper:] are supported character classes
3027echo " "
ecfc5424
AD
3028case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3029ABYZ)
3030 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3031 up='[:upper:]'
3032 low='[:lower:]'
3033 ;;
416d0bea
MB
3034*) # There is a discontinuity in EBCDIC between 'R' and 'S'
3035 # (0xd9 and 0xe2), therefore that is a nice testing point.
3036 if test "X$up" = X -o "X$low" = X; then
3037 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3038 rs) up='[A-Z]'
3039 low='[a-z]'
28e8609d
JH
3040 ;;
3041 esac
416d0bea 3042 fi
28e8609d 3043 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3044 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3045 rs) up='A-Z'
28e8609d
JH
3046 low='a-z'
3047 ;;
3048 esac
416d0bea 3049 fi
28e8609d 3050 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3051 case "`echo RS | od -x 2>/dev/null`" in
3052 *D9E2*|*d9e2*)
28e8609d
JH
3053 echo "Hey, this might be EBCDIC." >&4
3054 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3055 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3056 rs) up='[A-IJ-RS-Z]'
3057 low='[a-ij-rs-z]'
28e8609d
JH
3058 ;;
3059 esac
3060 fi
3061 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3062 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3063 rs) up='A-IJ-RS-Z'
3064 low='a-ij-rs-z'
28e8609d
JH
3065 ;;
3066 esac
3067 fi
3068 ;;
3069 esac
3070 fi
3071esac
416d0bea
MB
3072case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3073rs)
28e8609d
JH
3074 echo "Using $up and $low to convert case." >&4
3075 ;;
ecfc5424 3076*)
28e8609d
JH
3077 echo "I don't know how to translate letters from upper to lower case." >&4
3078 echo "Your tr is not acting any way I know of." >&4
3079 exit 1
3080 ;;
ecfc5424
AD
3081esac
3082: set up the translation script tr, must be called with ./tr of course
3083cat >tr <<EOSC
3084$startsh
3085case "\$1\$2" in
3086'[A-Z][a-z]') exec $tr '$up' '$low';;
3087'[a-z][A-Z]') exec $tr '$low' '$up';;
3088esac
3089exec $tr "\$@"
3090EOSC
3091chmod +x tr
3092$eunicefix tr
3093
2304df62
AD
3094: Try to determine whether config.sh was made on this system
3095case "$config_sh" in
3096'')
43999f95
JH
3097myuname=`$uname -a 2>/dev/null`
3098$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
3099# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3100# because the A-Z/a-z are not consecutive.
34e09935 3101myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3eaeeeae 3102 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 3103newmyuname="$myuname"
2304df62 3104dflt=n
16d20bd9
AD
3105case "$knowitall" in
3106'')
3107 if test -f ../config.sh; then
3108 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3109 eval "`grep myuname= ../config.sh`"
3110 fi
3111 if test "X$myuname" = "X$newmyuname"; then
3112 dflt=y
3113 fi
2304df62 3114 fi
16d20bd9
AD
3115 ;;
3116*) dflt=y;;
3117esac
2304df62
AD
3118
3119: Get old answers from old config file if Configure was run on the
3120: same system, otherwise use the hints.
3121hint=default
3122cd ..
3123if test -f config.sh; then
16d20bd9
AD
3124 echo " "
3125 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
3126 . UU/myread
3127 case "$ans" in
f83701cd
AD
3128 n*|N*) echo "OK, I'll ignore it."
3129 mv config.sh config.sh.old
3130 myuname="$newmyuname"
3131 ;;
2304df62 3132 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
3133 tmp_n="$n"
3134 tmp_c="$c"
85cad39c 3135 tmp_sh="$sh"
2304df62
AD
3136 . ./config.sh
3137 cp config.sh UU
ecfc5424
AD
3138 n="$tmp_n"
3139 c="$tmp_c"
85cad39c 3140 : Older versions did not always set $sh. Catch re-use of such
3141 : an old config.sh.
3142 case "$sh" in
3143 '') sh="$tmp_sh" ;;
3144 esac
2304df62
AD
3145 hint=previous
3146 ;;
3147 esac
3148fi
2573c5f9 3149. ./UU/checkcc
2304df62
AD
3150if test ! -f config.sh; then
3151 $cat <<EOM
3152
4e2a5f63
AD
3153First time through, eh? I have some defaults handy for some systems
3154that need some extra help getting the Configure answers right:
2304df62
AD
3155
3156EOM
dfe9444c 3157 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3158 dflt=''
3159 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3160 : tests or hints, please send them to perlbug@perl.org
2304df62 3161 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3162 $test -f /irix && osname=irix
85e6fe83
LW
3163 $test -f /xenix && osname=sco_xenix
3164 $test -f /dynix && osname=dynix
3165 $test -f /dnix && osname=dnix
5f05dabc 3166 $test -f /lynx.os && osname=lynxos
3167 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3168 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3169 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3170 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3171 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3172 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3173 $test -d /usr/apollo/bin && osname=apollo
3174 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3175 $test -d /usr/include/minix && osname=minix
d54344fc 3176 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3177 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3178 osname=machten
4633a7c4 3179 if $test -x /sbin/version; then
dfe9444c 3180 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3181 $sed -e 's/[A-Za-z]$//'`
3182 elif $test -x /usr/etc/version; then
dfe9444c 3183 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3184 $sed -e 's/[A-Za-z]$//'`
3185 else
3186 osvers="$2.$3"
3187 fi
3188 fi
aaacdc8b
GS
3189
3190 $test -f /sys/posix.dll &&
3191 $test -f /usr/bin/what &&
3192 set X `/usr/bin/what /sys/posix.dll` &&
3193 $test "$3" = UWIN &&
3194 osname=uwin &&
3195 osvers="$5"
3196
2304df62
AD
3197 if $test -f $uname; then
3198 set X $myuname
3199 shift
3200
2304df62 3201 case "$5" in
85e6fe83 3202 fps*) osname=fps ;;
2304df62
AD
3203 mips*)
3204 case "$4" in
85e6fe83
LW
3205 umips) osname=umips ;;
3206 *) osname=mips ;;
2304df62 3207 esac;;
85e6fe83
LW
3208 [23]100) osname=mips ;;
3209 next*) osname=next ;;
ecfc5424 3210 i386*)
c6912327
JH
3211 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3212 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3213 osname='sco'
3214 osvers=$tmp
3215 elif $test -f /etc/kconfig; then
ecfc5424 3216 osname=isc
bd628c73 3217 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3218 osvers=4
3219 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3220 osvers=3
2304df62 3221 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3222 osvers=2
ecfc5424
AD
3223 fi
3224 fi
2000072c 3225 tmp=''
ecfc5424 3226 ;;
c4f23d77
AD
3227 pc*)
3228 if test -n "$DJGPP"; then
3229 osname=dos
3230 osvers=djgpp
3231 fi
3232 ;;
2304df62
AD
3233 esac
3234
3235 case "$1" in
a0d0e21e
LW
3236 aix) osname=aix
3237 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3238 case "$tmp" in
e81c5c2a
NC
3239 # oslevel can fail with:
3240 # oslevel: Unable to acquire lock.
3241 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3242 '<3240'|'<>3240') osvers=3.2.0 ;;
3243 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3244 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3245 *) osvers=$tmp;;
a0d0e21e
LW
3246 esac
3247 ;;
aaacdc8b
GS
3248 bsd386) osname=bsd386
3249 osvers=`$uname -r`
3250 ;;
3251 cygwin*) osname=cygwin
3252 osvers="$3"
3253 ;;
23f87696
SZ
3254 *dc.osx) osname=dcosx
3255 osvers="$3"
3256 ;;
a0d0e21e
LW
3257 dnix) osname=dnix
3258 osvers="$3"
3259 ;;
3260 domainos) osname=apollo
3261 osvers="$3"
3262 ;;
a774dfe6
RSG
3263 dgux) osname=dgux
3264 osvers="$3"
3265 ;;
3266 dragonfly) osname=dragonfly
a0d0e21e
LW
3267 osvers="$3"
3268 ;;
760ac839 3269 dynixptx*) osname=dynixptx
e58e581d 3270 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3271 ;;
a774dfe6 3272 freebsd) osname=freebsd
a0d0e21e 3273 osvers="$3" ;;
761ee4e8
BD
3274 genix) osname=genix ;;
3275 gnu) osname=gnu
3276 osvers="$3" ;;
a774dfe6 3277 hp*) osname=hpux
bfb7748a 3278 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3279 ;;
761ee4e8 3280 irix*) osname=irix
a0d0e21e
LW
3281 case "$3" in
3282 4*) osvers=4 ;;
3283 5*) osvers=5 ;;
ecfc5424 3284 *) osvers="$3" ;;
a0d0e21e
LW
3285 esac
3286 ;;
761ee4e8 3287 linux) osname=linux
a0d0e21e 3288 case "$3" in
a0d0e21e
LW
3289 *) osvers="$3" ;;
3290 esac
3291 ;;
761ee4e8 3292 MiNT) osname=mint
28e8609d
JH
3293 ;;
3294 netbsd*) osname=netbsd
ecfc5424
AD
3295 osvers="$3"
3296 ;;
4e81affe
MM
3297 news-os) osvers="$3"
3298 case "$3" in
3299 4*) osname=newsos4 ;;
3300 *) osname=newsos ;;
3301 esac
3302 ;;
aaacdc8b 3303 next*) osname=next ;;
28bb1e2c 3304 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3305 openbsd) osname=openbsd
3306 osvers="$3"
3307 ;;
5c728af0
IZ
3308 os2) osname=os2
3309 osvers="$4"
3310 ;;
aaacdc8b
GS
3311 POSIX-BC | posix-bc ) osname=posix-bc
3312 osvers="$3"
a0d0e21e 3313 ;;
ae3afa4e
TH
3314 powerux | power_ux | powermax_os | powermaxos | \
3315 powerunix | power_unix) osname=powerux
3316 osvers="$3"
3317 ;;
aaacdc8b
GS
3318 qnx) osname=qnx
3319 osvers="$4"
3320 ;;
a0d0e21e
LW
3321 solaris) osname=solaris
3322 case "$3" in
3323 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3324 *) osvers="$3" ;;
a0d0e21e
LW
3325 esac
3326 ;;
85e6fe83
LW
3327 sunos) osname=sunos
3328 case "$3" in
85e6fe83
LW
3329 5*) osname=solaris
3330 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3331 *) osvers="$3" ;;
2304df62
AD
3332 esac
3333 ;;
a0d0e21e 3334 titanos) osname=titanos
85e6fe83 3335 case "$3" in
a0d0e21e
LW
3336 1*) osvers=1 ;;
3337 2*) osvers=2 ;;
3338 3*) osvers=3 ;;
3339 4*) osvers=4 ;;
ecfc5424 3340 *) osvers="$3" ;;
2304df62
AD
3341 esac
3342 ;;
85e6fe83 3343 ultrix) osname=ultrix
ecfc5424 3344 osvers="$3"
2304df62 3345 ;;
28757baa 3346 osf1|mls+) case "$5" in
fed7345c
AD
3347 alpha)
3348 osname=dec_osf
fdd85a03 3349 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3350 case "$osvers" in
3351 [1-9].[0-9]*) ;;
3352 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3353 esac
ecfc5424
AD
3354 ;;
3355 hp*) osname=hp_osf1 ;;
3356 mips) osname=mips_osf1 ;;
85e6fe83
LW
3357 esac
3358 ;;
af1ff193 3359 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3360 openunix|unixware) osname=svr5
0337d152
BG
3361 osvers="$4"
3362 ;;
3c728e00 3363 uts) osname=uts
a0d0e21e
LW
3364 osvers="$3"
3365 ;;
3c728e00
JH
3366 vos) osvers="$3"
3367 ;;
85e6fe83 3368 $2) case "$osname" in
2304df62 3369 *isc*) ;;
a0d0e21e 3370 *freebsd*) ;;
5f05dabc 3371 svr*)
a0d0e21e 3372 : svr4.x or possibly later
a774dfe6 3373 case "svr$3" in
a0d0e21e
LW
3374 ${osname}*)
3375 osname=svr$3
3376 osvers=$4
3377 ;;
3378 esac
3379 case "$osname" in
3380 svr4.0)
3381 : Check for ESIX
3382 if test -f /stand/boot ; then
3383 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3384 if test -n "$INITPROG" -a -f "$INITPROG"; then
3385 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3386 if test -n "$isesix"; then
a0d0e21e
LW
3387 osname=esix4
3388 fi
3389 fi
3390 fi
3391 ;;
3392 esac
3393 ;;
2304df62 3394 *) if test -f /etc/systemid; then
a0d0e21e
LW
3395 osname=sco
3396 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3397 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3398 osvers=$1.$2.$3
c4f23d77 3399 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3400 osvers=$1.$2
c4f23d77 3401 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3402 osvers=$1
2304df62 3403 fi
a0d0e21e
LW
3404 else
3405 case "$osname" in
3406 '') : Still unknown. Probably a generic Sys V.
3407 osname="sysv"
3408 osvers="$3"
3409 ;;
3410 esac
2304df62
AD
3411 fi
3412 ;;
3413 esac
3414 ;;
a0d0e21e
LW
3415 *) case "$osname" in
3416 '') : Still unknown. Probably a generic BSD.
3417 osname="$1"
3418 osvers="$3"
3419 ;;
3420 esac
3421 ;;
2304df62
AD
3422 esac
3423 else
dfe9444c
AD
3424 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3425 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3426 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3427 osname=news_os
2304df62 3428 fi
dfe9444c 3429 $rm -f UU/kernel.what
5c728af0 3430 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3431 set X $myuname
3432 osname=os2
3433 osvers="$5"
2304df62
AD
3434 fi
3435 fi
a774dfe6 3436
5440bc8e
JH
3437 case "$targetarch" in
3438 '') ;;
3439 *) hostarch=$osname
3440 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3441 osvers=''
3442 ;;
3443 esac
3444
a0d0e21e
LW
3445 : Now look for a hint file osname_osvers, unless one has been
3446 : specified already.
3447 case "$hintfile" in
3448 ''|' ')
1e127011 3449 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3450 : Also try without trailing minor version numbers.
1e127011
DD
3451 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3452 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3453 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3454 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3455 case "$file" in
3456 '') dflt=none ;;
3457 *) case "$osvers" in
3458 '') dflt=$file
3459 ;;
dfe9444c 3460 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3461 dflt=$file
dfe9444c 3462 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3463 dflt=$xfile
dfe9444c 3464 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3465 dflt=$xxfile
dfe9444c 3466 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3467 dflt=$xxxfile
dfe9444c 3468 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3469 dflt=$xxxxfile
dfe9444c 3470 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3471 dflt="${osname}"
3472 else
3473 dflt=none
3474 fi
3475 ;;
3476 esac
85e6fe83
LW
3477 ;;
3478 esac
4e2a5f63
AD
3479 if $test -f Policy.sh ; then
3480 case "$dflt" in
3481 *Policy*) ;;
3482 none) dflt="Policy" ;;
3483 *) dflt="Policy $dflt" ;;
3484 esac
3485 fi
85e6fe83 3486 ;;
a0d0e21e 3487 *)
ecfc5424 3488 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3489 ;;
2304df62 3490 esac
1aef975c 3491
4e2a5f63
AD
3492 if $test -f Policy.sh ; then
3493 $cat <<EOM
3494
3495There's also a Policy hint file available, which should make the
3496site-specific (policy) questions easier to answer.
3497EOM
3498
3499 fi
3500
2304df62
AD
3501 $cat <<EOM
3502
3503You may give one or more space-separated answers, or "none" if appropriate.
a2d23ec2
MB
3504If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3505previous run of Configure, you may specify it as well as or instead of
3506OS-specific hints. If hints are provided for your OS, you should use them:
3507although Perl can probably be built without hints on many platforms, using
3508hints often improve performance and may enable features that Configure can't
3509set up on its own. If there are no hints that match your OS, specify "none";
3510DO NOT give a wrong version or a wrong OS.
2304df62
AD
3511
3512EOM
4e2a5f63 3513
2304df62 3514 rp="Which of these apply, if any?"
dfe9444c 3515 . UU/myread
85e6fe83
LW
3516 tans=$ans
3517 for file in $tans; do
4e2a5f63
AD
3518 if $test X$file = XPolicy -a -f Policy.sh; then
3519 . Policy.sh
3520 $cat Policy.sh >> UU/config.sh
3521 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3522 . $src/hints/$file.sh
3523 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3524 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3525 : nothing
3526 else
85e6fe83
LW
3527 : Give one chance to correct a possible typo.
3528 echo "$file.sh does not exist"
3529 dflt=$file
3530 rp="hint to use instead?"
dfe9444c 3531 . UU/myread
85e6fe83 3532 for file in $ans; do
dfe9444c
AD
3533 if $test -f "$src/hints/$file.sh"; then
3534 . $src/hints/$file.sh
3535 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3536 elif $test X$ans = X -o X$ans = Xnone ; then
3537 : nothing
3538 else
3539 echo "$file.sh does not exist -- ignored."
3540 fi
3541 done
2304df62
AD
3542 fi
3543 done
85e6fe83 3544
2304df62 3545 hint=recommended
85e6fe83 3546 : Remember our hint file for later.
dfe9444c 3547 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3548 hintfile="$file"
85e6fe83 3549 else
a0d0e21e 3550 hintfile=''
85e6fe83 3551 fi
2304df62
AD
3552fi
3553cd UU
3554;;
3555*)
3556 echo " "
3557 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3558 tmp_n="$n"
3559 tmp_c="$c"
2304df62
AD
3560 cd ..
3561 cp $config_sh config.sh 2>/dev/null
a78b0d02 3562 chmod +w config.sh
2304df62
AD
3563 . ./config.sh
3564 cd UU
3565 cp ../config.sh .
ecfc5424
AD
3566 n="$tmp_n"
3567 c="$tmp_c"
2304df62
AD
3568 hint=previous
3569 ;;
3570esac
1aef975c 3571test "$override" && . ./optdef.sh
2304df62
AD
3572
3573: Restore computed paths
3574for file in $loclist $trylist; do
3575 eval $file="\$_$file"
3576done
3577
85e6fe83 3578cat << EOM
a0d0e21e 3579
85e6fe83 3580Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3581The default value is probably right if the name rings a bell. Otherwise,
3582since spelling matters for me, either accept the default or answer "none"
3583to leave it blank.
a0d0e21e 3584
85e6fe83 3585EOM
85e6fe83 3586case "$osname" in
a0d0e21e 3587 ''|' ')
85e6fe83 3588 case "$hintfile" in
a0d0e21e 3589 ''|' '|none) dflt=none ;;
ecfc5424 3590 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3591 esac
3592 ;;
3593 *) dflt="$osname" ;;
3594esac
3595rp="Operating system name?"
3596. ./myread
3597case "$ans" in
ecfc5424
AD
3598none) osname='' ;;
3599*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3600esac
8ff267be 3601echo " "
3602case "$osvers" in
3603 ''|' ')
3604 case "$hintfile" in
3605 ''|' '|none) dflt=none ;;
3606 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3607 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3608 case "$dflt" in
3609 ''|' ') dflt=none ;;
3610 esac
3611 ;;
3612 esac
3613 ;;
3614 *) dflt="$osvers" ;;
3615esac
3616rp="Operating system version?"
3617. ./myread
3618case "$ans" in
3619none) osvers='' ;;
3620*) osvers="$ans" ;;
3621esac
3622
02e93a22
JH
3623
3624. ./posthint.sh
3625
2304df62 3626: who configured the system
59b83a6f 3627cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3628case "$cf_by" in
3629"")
7c04078e 3630 cf_by=`(logname) 2>/dev/null`
dfe9444c 3631 case "$cf_by" in
7c04078e
GA
3632 "")
3633 cf_by=`(whoami) 2>/dev/null`
3634 case "$cf_by" in
3635 "") cf_by=unknown ;;
3636 esac ;;
8ff267be 3637 esac ;;
3638esac
2304df62 3639
f3f1a2d8
MB
3640: decide how portable to be. Allow command line overrides.
3641case "$d_portable" in
3642"$undef") ;;
3643*) d_portable="$define" ;;
b4eb6b3d 3644esac
b4eb6b3d 3645
f3f1a2d8
MB
3646: set up shell script to do ~ expansion
3647cat >filexp <<EOSS
3648$startsh
3649: expand filename
3650case "\$1" in
f16e9d76 3651 \~/*|\~)
f3f1a2d8
MB
3652 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3653 ;;
4137585d 3654 \~*)
f3f1a2d8
MB
3655 if $test -f /bin/csh; then
3656 /bin/csh -f -c "glob \$1"
3657 failed=\$?
3658 echo ""
3659 exit \$failed
3660 else
3661 name=\`$expr x\$1 : '..\([^/]*\)'\`
3662 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3663 if $test ! -d "\$dir"; then
3664 me=\`basename \$0\`
3665 echo "\$me: can't locate home directory for: \$name" >&2
3666 exit 1
3667 fi
3668 case "\$1" in
3669 */*)
3670 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3671 ;;
3672 *)
3673 echo \$dir
3674 ;;
3675 esac
3676 fi
3677 ;;
3678*)
3679 echo \$1
3680 ;;
b29b105d 3681esac
f3f1a2d8
MB
3682EOSS
3683chmod +x filexp
3684$eunicefix filexp
b29b105d 3685
f3f1a2d8
MB
3686: now set up to get a file name
3687cat <<EOS >getfile
3688$startsh
3689EOS
3690cat <<'EOSC' >>getfile
3691tilde=''
3692fullpath=''
3693already=''
3694skip=''
3695none_ok=''
3696exp_file=''
3697nopath_ok=''
3698orig_rp="$rp"
3699orig_dflt="$dflt"
3700case "$gfpth" in
3701'') gfpth='.' ;;
b29b105d 3702esac
b29b105d 3703
f3f1a2d8
MB
3704case "$fn" in
3705*\(*)
3706 : getfile will accept an answer from the comma-separated list
3707 : enclosed in parentheses even if it does not meet other criteria.
3708 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3709 fn=`echo $fn | sed 's/(.*)//'`
3710 ;;
b29b105d
JH
3711esac
3712
f3f1a2d8
MB
3713case "$fn" in
3714*:*)
3715 loc_file=`expr $fn : '.*:\(.*\)'`
3716 fn=`expr $fn : '\(.*\):.*'`
3717 ;;
b29b105d 3718esac
b29b105d 3719
f3f1a2d8
MB
3720case "$fn" in
3721*~*) tilde=true;;
3722esac
3723case "$fn" in
3724*/*) fullpath=true;;
3725esac
3726case "$fn" in
3727*+*) skip=true;;
3728esac
3729case "$fn" in
3730*n*) none_ok=true;;
3731esac
3732case "$fn" in
3733*e*) exp_file=true;;
3734esac
3735case "$fn" in
3736*p*) nopath_ok=true;;
b29b105d 3737esac
b29b105d 3738
f3f1a2d8
MB
3739case "$fn" in
3740*f*) type='File';;
3741*d*) type='Directory';;
3742*l*) type='Locate';;
3743esac
b29b105d 3744
f3f1a2d8
MB
3745what="$type"
3746case "$what" in
3747Locate) what='File';;
3748esac
b29b105d 3749
f3f1a2d8
MB
3750case "$exp_file" in
3751'')
3752 case "$d_portable" in
3753 "$define") ;;
3754 *) exp_file=true;;
b29b105d
JH
3755 esac
3756 ;;
3757esac
3758
f3f1a2d8
MB
3759cd ..
3760while test "$type"; do
3761 redo=''
3762 rp="$orig_rp"
3763 dflt="$orig_dflt"
3764 case "$tilde" in
3765 true) rp="$rp (~name ok)";;
3766 esac
3767 . UU/myread
3768 if test -f UU/getfile.ok && \
3769 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3770 then
3771 value="$ans"
3772 ansexp="$ans"
3773 break
3774 fi
3775 case "$ans" in
3776 none)
3777 value=''
3778 ansexp=''
3779 case "$none_ok" in
3780 true) type='';;
b29b105d
JH
3781 esac
3782 ;;
f3f1a2d8
MB
3783 *)
3784 case "$tilde" in
3785 '') value="$ans"
3786 ansexp="$ans";;
3787 *)
3788 value=`UU/filexp $ans`
3789 case $? in
3790 0)
3791 if test "$ans" != "$value"; then
3792 echo "(That expands to $value on this system.)"
3793 fi
3794 ;;
3795 *) value="$ans";;
3796 esac
3797 ansexp="$value"
3798 case "$exp_file" in
3799 '') value="$ans";;
3800 esac
3801 ;;
3802 esac
3803 case "$fullpath" in
3804 true)
3805 case "$ansexp" in
3806 /*) value="$ansexp" ;;
3807 [a-zA-Z]:/*) value="$ansexp" ;;
3808 *)
3809 redo=true
3810 case "$already" in
3811 true)
3812 echo "I shall only accept a full path name, as in /bin/ls." >&4
3813 echo "Use a ! shell escape if you wish to check pathnames." >&4
3814 ;;
3815 *)
3816 echo "Please give a full path name, starting with slash." >&4
3817 case "$tilde" in
3818 true)
3819 echo "Note that using ~name is ok provided it expands well." >&4
3820 already=true
3821 ;;
3822 esac
3823 esac
3824 ;;
3825 esac
3826 ;;
3827 esac
3828 case "$redo" in
3829 '')
3830 case "$type" in
3831 File)
3832 for fp in $gfpth; do
3833 if test "X$fp" = X.; then
3834 pf="$ansexp"
3835 else
3836 pf="$fp/$ansexp"
3837 fi
3838 if test -f "$pf"; then
3839 type=''
3840 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3841 then
3842 echo "($value is not a plain file, but that's ok.)"
3843 type=''
3844 fi
3845 if test X"$type" = X; then
3846 value="$pf"
3847 break
3848 fi
3849 done
3850 ;;
3851 Directory)
3852 for fp in $gfpth; do
3853 if test "X$fp" = X.; then
3854 dir="$ans"
3855 direxp="$ansexp"
3856 else
3857 dir="$fp/$ansexp"
3858 direxp="$fp/$ansexp"
3859 fi
3860 if test -d "$direxp"; then
3861 type=''
3862 value="$dir"
3863 break
3864 fi
3865 done
3866 ;;
3867 Locate)
3868 if test -d "$ansexp"; then
3869 echo "(Looking for $loc_file in directory $value.)"
3870 value="$value/$loc_file"
3871 ansexp="$ansexp/$loc_file"
3872 fi
3873 if test -f "$ansexp"; then
3874 type=''
3875 fi
3876 case "$nopath_ok" in
3877 true) case "$value" in
3878 */*) ;;
3879 *) echo "Assuming $value will be in people's path."
3880 type=''
3881 ;;
3882 esac
3883 ;;
3884 esac
3885 ;;
3886 esac
b4eb6b3d 3887
f3f1a2d8
MB
3888 case "$skip" in
3889 true) type='';
3890 esac
3891
3892 case "$type" in
3893 '') ;;
3894 *)
3895 if test "$fastread" = yes; then
3896 dflt=y
3897 else
3898 dflt=n
3899 fi
3900 rp="$what $value doesn't exist. Use that name anyway?"
3901 . UU/myread
3902 dflt=''
3903 case "$ans" in
3904 y*) type='';;
3905 *) echo " ";;
3906 esac
3907 ;;
3908 esac
3909 ;;
3910 esac
3911 ;;
b4eb6b3d 3912 esac
f3f1a2d8
MB
3913done
3914cd UU
3915ans="$value"
3916rp="$orig_rp"
3917dflt="$orig_dflt"
3918rm -f getfile.ok
3919test "X$gfpthkeep" != Xy && gfpth=""
3920EOSC
3921
3922: determine root of directory hierarchy where package will be installed.
3923case "$prefix" in
3924'')
3925 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3926 ;;
3927*?/)
3928 dflt=`echo "$prefix" | sed 's/.$//'`
b4eb6b3d
JH
3929 ;;
3930*)
f3f1a2d8 3931 dflt="$prefix"
b4eb6b3d
JH
3932 ;;
3933esac
f3f1a2d8 3934$cat <<EOM
b4eb6b3d 3935
f3f1a2d8
MB
3936By default, $package will be installed in $dflt/bin, manual pages
3937under $dflt/man, etc..., i.e. with $dflt as prefix for all
3938installation directories. Typically this is something like /usr/local.
3939If you wish to have binaries under /usr/bin but other parts of the
3940installation under /usr/local, that's ok: you will be prompted
3941separately for each of the installation directories, the prefix being
3942only used to set the defaults.
c915ce7f
JH
3943
3944EOM
f3f1a2d8
MB
3945fn=d~
3946rp='Installation prefix to use?'
3947. ./getfile
3948oldprefix=''
3949case "$prefix" in
3950'') ;;
3951*)
3952 case "$ans" in
3953 "$prefix") ;;
3954 *) oldprefix="$prefix";;
3955 esac
c915ce7f
JH
3956 ;;
3957esac
f3f1a2d8
MB
3958prefix="$ans"
3959prefixexp="$ansexp"
c915ce7f 3960
776a38e3 3961: allow them to override the AFS root
f3f1a2d8
MB
3962case "$afsroot" in
3963'') afsroot=/afs ;;
3964*) afsroot=$afsroot ;;
b4eb6b3d 3965esac
b4eb6b3d 3966
776a38e3 3967: is AFS running?
f3f1a2d8
MB
3968echo " "
3969case "$afs" in
3970$define|true) afs=true ;;
3971$undef|false) afs=false ;;
776a38e3 3972*) if $test -d $afsroot; then
f3f1a2d8
MB
3973 afs=true
3974 else
3975 afs=false
3976 fi
b4eb6b3d 3977 ;;
f3f1a2d8
MB
3978esac
3979if $afs; then
3980 echo "AFS may be running... I'll be extra cautious then..." >&4
3981else
3982 echo "AFS does not seem to be running..." >&4
9da7673b 3983fi
b4eb6b3d 3984
f3f1a2d8
MB
3985: determine installation prefix for where package is to be installed.
3986if $afs; then
3987$cat <<EOM
3988
3989Since you are running AFS, I need to distinguish the directory in which
3990files will reside from the directory in which they are installed (and from
3991which they are presumably copied to the former directory by occult means).
b4eb6b3d 3992
b4eb6b3d 3993EOM
f3f1a2d8
MB
3994 case "$installprefix" in
3995 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3996 *) dflt="$installprefix";;
3997 esac
3998else
3999$cat <<EOM
b4eb6b3d 4000
f3f1a2d8
MB
4001In some special cases, particularly when building $package for distribution,
4002it is convenient to distinguish the directory in which files should be
4003installed from the directory ($prefix) in which they will
4004eventually reside. For most users, these two directories are the same.
4005
4006EOM
4007 case "$installprefix" in
4008 '') dflt=$prefix ;;
4009 *) dflt=$installprefix;;
4010 esac
4011fi
4012fn=d~
4013rp='What installation prefix should I use for installing files?'
4014. ./getfile
4015installprefix="$ans"
4016installprefixexp="$ansexp"
4017
4018: Perform the prefixexp/installprefixexp correction if necessary
4019cat <<EOS >installprefix
4020$startsh
4021EOS
4022cat <<'EOSC' >>installprefix
4023: Change installation prefix, if necessary.
4024if $test X"$prefix" != X"$installprefix"; then
4025 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4026else
4027 eval "install${prefixvar}=\"\$${prefixvar}exp\""
4028fi
4029EOSC
4030chmod +x installprefix
4031$eunicefix installprefix
4032
4033: Set variables such as privlib and privlibexp from the output of ./getfile
4034: performing the prefixexp/installprefixexp correction if necessary.
4035cat <<EOS >setprefixvar
4036$startsh
4037EOS
4038cat <<'EOSC' >>setprefixvar
4039eval "${prefixvar}=\"\$ans\""
4040eval "${prefixvar}exp=\"\$ansexp\""
4041. ./installprefix
4042EOSC
4043chmod +x setprefixvar
4044$eunicefix setprefixvar
4045
4046: set up the script used to warn in case of inconsistency
4047cat <<EOS >whoa
4048$startsh
4049EOS
4050cat <<'EOSC' >>whoa
4051dflt=y
dcb594bc
MB
4052case "$hint" in
4053 recommended)
4054 case "$hintfile" in
4055 '') echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4056 ;;
4057 *) echo "Hmm. Based on the hints in hints/$hintfile.sh, " >&4
4058 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4059 ;;
4060 esac
4061 ;;
4062 *) echo " "
4063 echo "*** WHOA THERE!!! ***" >&4
4064 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
4065 ;;
4066esac
f3f1a2d8
MB
4067rp=" Keep the $hint value?"
4068. ./myread
4069case "$ans" in
4070y) td=$was; tu=$was;;
4071esac
4072EOSC
4073
216dac04 4074: function used to set '$1' to '$val'
f3f1a2d8
MB
4075setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4076case "$val$was" in
4077$define$undef) . ./whoa; eval "$var=\$td";;
4078$undef$define) . ./whoa; eval "$var=\$tu";;
4079*) eval "$var=$val";;
4080esac'
4081
5c40187f
MB
4082: get the patchlevel
4083echo " "
4084echo "Getting the current patchlevel..." >&4
4085if $test -r $rsrc/patchlevel.h;then
4086 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4087 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4088 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4089 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4090 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4091 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
ff803615 4092 perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
5c40187f
MB
4093else
4094 revision=0
4095 patchlevel=0
4096 subversion=0
4097 api_revision=0
4098 api_version=0
4099 api_subversion=0
4100 perl_patchlevel=0
4101 $echo "(You do not have patchlevel.h. Eek.)"
4102fi
5c40187f
MB
4103: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4104version_patchlevel_string="version $patchlevel subversion $subversion"
4105case "$perl_patchlevel" in
41060|'') ;;
0f04e85f
MB
4107*) perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4108 version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4109 ;;
5c40187f
MB
4110esac
4111
4112$echo "(You have $package $version_patchlevel_string.)"
4113
4114case "$osname" in
4115dos|vms)
4116 : XXX Should be a Configure test for double-dots in filenames.
4117 version=`echo $revision $patchlevel $subversion | \
4118 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4119 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4120 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4121 ;;
4122*)
4123 version=`echo $revision $patchlevel $subversion | \
4124 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4125 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4126 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4127 ;;
4128esac
4129: Special case the 5.005_xx maintenance series, which used 5.005
4130: without any subversion label as a subdirectory in $sitelib
4131if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4132 api_versionstring='5.005'
4133fi
4134
613d6c3e 4135: Do we want threads support and if so, what type
f3f1a2d8
MB
4136case "$usethreads" in
4137$define|true|[yY]*) dflt='y';;
4138*) # Catch case where user specified ithreads or 5005threads but
4139 # forgot -Dusethreads (A.D. 4/2002)
4140 case "$useithreads$use5005threads" in
dd35fa16
MB
4141 *$define*) dflt='y';;
4142 *) dflt='n';;
f3f1a2d8
MB
4143 esac
4144 ;;
4145esac
4146cat <<EOM
4147
4148Perl can be built to take advantage of threads on some systems.
4149To do so, Configure can be run with -Dusethreads.
4150
4151Note that Perl built with threading support runs slightly slower
4152and uses more memory than plain Perl. The current implementation
4153is believed to be stable, but it is fairly new, and so should be
4154treated with caution.
4155
4156If this doesn't make any sense to you, just accept the default '$dflt'.
4157EOM
4158rp='Build a threading Perl?'
4159. ./myread
4160case "$ans" in
4161y|Y) val="$define" ;;
4162*) val="$undef" ;;
4163esac
4164set usethreads
4165eval $setvar
4166
5c40187f
MB
4167if $test $patchlevel -lt 9; then
4168 case "$usethreads" in
4169 $define)
f3f1a2d8
MB
4170 $cat <<EOM
4171
4172Since release 5.6, Perl has had two different threading implementations,
4173the newer interpreter-based version (ithreads) with one interpreter per
4174thread, and the older 5.005 version (5005threads).
4175The 5005threads version is effectively unmaintained and will probably be
4176removed in Perl 5.10, so there should be no need to build a Perl using it
4177unless needed for backwards compatibility with some existing 5.005threads
4178code.
4179
4180EOM
4181 : Default to ithreads unless overridden on command line or with
4182 : old config.sh
4183 dflt='y'
4184 case "$use5005threads" in
4185 $define|true|[yY]*) dflt='n';;
4186 esac
4187 case "$useithreads" in
4188 $undef|false|[nN]*) dflt='n';;
4189 esac
4190 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
4191 . ./myread
4192 case "$ans" in
f3f1a2d8 4193 y|Y) val="$define" ;;
b4eb6b3d
JH
4194 *) val="$undef" ;;
4195 esac
f3f1a2d8
MB
4196 set useithreads
4197 eval $setvar
4198 : Now set use5005threads to the opposite value.
4199 case "$useithreads" in
4200 $define) val="$undef" ;;
4201 *) val="$define" ;;
4202 esac
4203 set use5005threads
4204 eval $setvar
4205 ;;
5c40187f 4206 *)
f3f1a2d8
MB
4207 useithreads="$undef"
4208 use5005threads="$undef"
b4eb6b3d 4209 ;;
5c40187f 4210 esac
b4eb6b3d 4211
5c40187f
MB
4212 case "$useithreads$use5005threads" in
4213 "$define$define")
f3f1a2d8 4214 $cat >&4 <<EOM
96056487 4215
f3f1a2d8
MB
4216You cannot have both the ithreads and the 5.005 threads enabled
4217at the same time. Disabling the 5.005 threads since they are
4218much less stable than the ithreads.
4219
4220EOM
4221 use5005threads="$undef"
96056487 4222 ;;
5c40187f
MB
4223 esac
4224
4225else
4226: perl-5.9.x and later
4227
47f9f84c 4228 if test X"$usethreads" = "X$define"; then
3f30fabf
MB
4229 case "$use5005threads" in
4230 $define|true|[yY]*)
4231 $cat >&4 <<EOM
47f9f84c
JH
4232
42335.005 threads has been removed for 5.10. Perl will be built using ithreads.
5c40187f 4234
47f9f84c 4235EOM
3f30fabf
MB
4236 ;;
4237 esac
47f9f84c 4238 fi
3f30fabf 4239
47f9f84c
JH
4240 use5005threads="$undef"
4241 useithreads="$usethreads"
5c40187f 4242fi
96056487 4243
f3f1a2d8
MB
4244case "$d_oldpthreads" in
4245'') : Configure tests would be welcome here. For now, assume undef.
4246 val="$undef" ;;
4247*) val="$d_oldpthreads" ;;
4248esac
4249set d_oldpthreads
4250eval $setvar
4251
4252
4253: Look for a hint-file generated 'call-back-unit'. If the
4254: user has specified that a threading perl is to be built,
4255: we may need to set or change some other defaults.
4256if $test -f usethreads.cbu; then
4257 echo "Your platform has some specific hints regarding threaded builds, using them..."
4258 . ./usethreads.cbu
4259else
4260 case "$usethreads" in
4261 "$define"|true|[yY]*)
4262 $cat <<EOM
4263(Your platform does not have any specific hints for threaded builds.
4264 Assuming POSIX threads, then.)
4265EOM
4266 ;;
4267 esac
4268fi
4269
34f1896b 4270: Check if multiplicity is required
f3f1a2d8
MB
4271cat <<EOM
4272
4273Perl can be built so that multiple Perl interpreters can coexist
4274within the same Perl executable.
4275EOM
4276
4277case "$useithreads" in
4278$define)
4279 cat <<EOM
4280This multiple interpreter support is required for interpreter-based threads.
4281EOM
4282 val="$define"
4283 ;;
4284*) case "$usemultiplicity" in
4285 $define|true|[yY]*) dflt='y';;
4286 *) dflt='n';;
4287 esac
4288 echo " "
4289 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4290 rp='Build Perl for multiplicity?'
4291 . ./myread
4292 case "$ans" in
4293 y|Y) val="$define" ;;
4294 *) val="$undef" ;;
4295 esac
4296 ;;
4297esac
4298set usemultiplicity
4299eval $setvar
4300
34f1896b 4301: Check if morebits is requested
f3f1a2d8
MB
4302case "$usemorebits" in
4303"$define"|true|[yY]*)
4304 use64bitint="$define"
4305 uselongdouble="$define"
4306 usemorebits="$define"
4307 ;;
4308*) usemorebits="$undef"
4309 ;;
4310esac
4311
776a38e3
MB
4312: Determine the C compiler to be used
4313echo " "
4314case "$cc" in
4315'') dflt=cc;;
4316*) dflt="$cc";;
4317esac
4318rp="Use which C compiler?"
4319. ./myread
4320cc="$ans"
4321
4322: See whether they have no cc but they do have gcc
4323. ./trygcc
4324if $test -f cc.cbu; then
4325 . ./cc.cbu
4326fi
4327. ./checkcc
4328
f3f1a2d8
MB
4329: make some quick guesses about what we are up against
4330echo " "
4331$echo $n "Hmm... $c"
4332echo exit 1 >bsd
4333echo exit 1 >usg
4334echo exit 1 >v7
4335echo exit 1 >osf1
4336echo exit 1 >eunice
4337echo exit 1 >xenix
4338echo exit 1 >venix
4339echo exit 1 >os2
4340d_bsd="$undef"
4341$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4342if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
e5e20432
JH
4343then
4344 echo "Looks kind of like an OSF/1 system, but we'll see..."
4345 echo exit 0 >osf1
381aa1ff 4346elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
4347 xxx=`./loc addbib blurfl $pth`
4348 if $test -f $xxx; then
4349 echo "Looks kind of like a USG system with BSD features, but we'll see..."
4350 echo exit 0 >bsd
4351 echo exit 0 >usg
4352 else
4353 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4354 echo "Looks kind of like an extended USG system, but we'll see..."
4355 else
4356 echo "Looks kind of like a USG system, but we'll see..."
4357 fi
4358 echo exit 0 >usg
4359 fi
4360elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4361 echo "Looks kind of like a BSD system, but we'll see..."
4362 d_bsd="$define"
4363 echo exit 0 >bsd
4364else
4365 echo "Looks kind of like a Version 7 system, but we'll see..."
4366 echo exit 0 >v7
4367fi
4368case "$eunicefix" in
4369*unixtovms*)
4370 $cat <<'EOI'
4371There is, however, a strange, musty smell in the air that reminds me of
4372something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4373EOI
4374 echo exit 0 >eunice
4375 d_eunice="$define"
4376: it so happens the Eunice I know will not run shell scripts in Unix format
4377 ;;
4378*)
4379 echo " "
4380 echo "Congratulations. You aren't running Eunice."
4381 d_eunice="$undef"
4382 ;;
4383esac
4384: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
4385: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4386: semicolon as a patch separator
e5e20432
JH
4387case "$p_" in
4388:) ;;
4389*)
4390 $cat <<'EOI'
4391I have the feeling something is not exactly right, however...don't tell me...
4392lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 4393(Or you may be running DOS with DJGPP.)
e5e20432
JH
4394EOI
4395 echo exit 0 >os2
4396 ;;
4397esac
4398if test -f /xenix; then
4399 echo "Actually, this looks more like a XENIX system..."
4400 echo exit 0 >xenix
4401 d_xenix="$define"
4402else
4403 echo " "
4404 echo "It's not Xenix..."
4405 d_xenix="$undef"
4406fi
4407chmod +x xenix
4408$eunicefix xenix
4409if test -f /venix; then
4410 echo "Actually, this looks more like a VENIX system..."
4411 echo exit 0 >venix
4412else
4413 echo " "
4414 if ./xenix; then
4415 : null
4416 else
4417 echo "Nor is it Venix..."
4418 fi
4419fi
4420chmod +x bsd usg v7 osf1 eunice xenix venix os2
4421$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4422$rm -f foo
4423
613d6c3e 4424: Check if we are using GNU gcc and what its version is
e5e20432
JH
4425echo " "
4426echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 4427$cat >try.c <<EOM
e5e20432
JH
4428#include <stdio.h>
4429int main() {
7686528e 4430#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
e5e20432
JH
4431#ifdef __VERSION__
4432 printf("%s\n", __VERSION__);
4433#else
4434 printf("%s\n", "1");
4435#endif
4436#endif
073b6de5 4437 return(0);
e5e20432
JH
4438}
4439EOM
5440bc8e
JH
4440if $cc -o try $ccflags $ldflags try.c; then
4441 gccversion=`$run ./try`
f3f1a2d8
MB
4442 case "$gccversion" in
4443 '') echo "You are not using GNU cc." ;;
4444 *) echo "You are using GNU cc $gccversion."
4445 ccname=gcc
4446 ;;
4447 esac
4448else
4449 echo " "
4450 echo "*** WHOA THERE!!! ***" >&4
4451 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
4452 case "$knowitall" in
4453 '')
4454 echo " You'd better start hunting for one and let me know about it." >&4
4455 exit 1
2304df62
AD
4456 ;;
4457 esac
f3f1a2d8
MB
4458fi
4459$rm -f try try.*
4460case "$gccversion" in
44611*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4462esac
4463case "$gccversion" in
4464'') gccosandvers='' ;;
4465*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4466 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4467 gccshortvers=''
4468 case "$gccosandvers" in
4469 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4470 $osname$osvers) ;; # looking good
4471 $osname*) cat <<EOM >&4
4472
4473*** WHOA THERE!!! ***
4474
4475 Your gcc has not been compiled for the exact release of
4476 your operating system ($gccosandvers versus $osname$osvers).
4477
4478 In general it is a good idea to keep gcc synchronized with
4479 the operating system because otherwise serious problems
4480 may ensue when trying to compile software, like Perl.
4481
4482 I'm trying to be optimistic here, though, and will continue.
4483 If later during the configuration and build icky compilation
4484 problems appear (headerfile conflicts being the most common
4485 manifestation), I suggest reinstalling the gcc to match
4486 your operating system release.
4487
4488EOM
4489 ;;
4490 *) gccosandvers='' ;; # failed to parse, better be silent
4491 esac
4492 ;;
4493esac
4494case "$ccname" in
4495'') ccname="$cc" ;;
4496esac
4497
4498# gcc 3.* complain about adding -Idirectories that they already know about,
4499# so we will take those off from locincpth.
4500case "$gccversion" in
45013*)
4502 echo "main(){}">try.c
4503 for incdir in $locincpth; do
4504 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4505 grep '^c[cp]p*[01]: warning: changing search order '`
4506 if test "X$warn" != X; then
4507 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4508 fi
4509 done
4510 $rm -f try try.*
4511esac
2304df62 4512
bd9b35c9
JH
4513: What should the include directory be ?
4514echo " "
4515$echo $n "Hmm... $c"
4516dflt='/usr/include'
4517incpath=''
4518mips_type=''
4519if $test -f /bin/mips && /bin/mips; then
4520 echo "Looks like a MIPS system..."
4521 $cat >usr.c <<'EOCP'
4522#ifdef SYSTYPE_BSD43
4523/bsd43
4524#endif
4525EOCP
8a27cf78 4526 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4527 dflt='/bsd43/usr/include'
4528 incpath='/bsd43'
4529 mips_type='BSD 4.3'
4530 else
4531 mips_type='System V'
4532 fi
4533 $rm -f usr.c usr.out
4534 echo "and you're compiling with the $mips_type compiler and libraries."
4535 xxx_prompt=y
4536 echo "exit 0" >mips
4537else
4538 echo "Doesn't look like a MIPS system."
4539 xxx_prompt=n
4540 echo "exit 1" >mips
4541fi
4542chmod +x mips
4543$eunicefix mips
4544case "$usrinc" in
4545'') ;;
4546*) dflt="$usrinc";;
4547esac
4548case "$xxx_prompt" in
4549y) fn=d/
4550 echo " "
4551 rp='Where are the include files you want to use?'
4552 . ./getfile
4553 usrinc="$ans"
8e07c86e 4554 ;;
bd9b35c9 4555*) usrinc="$dflt"
8e07c86e
AD
4556 ;;
4557esac
2304df62 4558
96056487
JH
4559: see how we invoke the C preprocessor
4560echo " "
4561echo "Now, how can we feed standard input to your C preprocessor..." >&4
4562cat <<'EOT' >testcpp.c
4563#define ABC abc
4564#define XYZ xyz
4565ABC.XYZ
4566EOT
4567cd ..
4568if test ! -f cppstdin; then
4569 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4570 # AIX cc -E doesn't show the absolute headerfile
4571 # locations but we'll cheat by using the -M flag.
4572 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
4573 else
4574 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4575 fi
4576else
4577 echo "Keeping your $hint cppstdin wrapper."
4578fi
4579chmod 755 cppstdin
4580wrapper=`pwd`/cppstdin
4581ok='false'
4582cd UU
4583
4584if $test "X$cppstdin" != "X" && \
4585 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4586 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4587then
4588 echo "You used to use $cppstdin $cppminus so we'll use that again."
4589 case "$cpprun" in
4590 '') echo "But let's see if we can live without a wrapper..." ;;
4591 *)
4592 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4593 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4594 then
4595 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4596 ok='true'
4597 else
4598 echo "(However, $cpprun $cpplast does not work, let's see...)"
4599 fi
4600 ;;
4601 esac
4602else
4603 case "$cppstdin" in
4604 '') ;;
4605 *)
4606 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4607 ;;
4608 esac
4609fi
4610
4611if $ok; then
4612 : nothing
4613elif echo 'Maybe "'"$cc"' -E" will work...'; \
4614 $cc -E <testcpp.c >testcpp.out 2>&1; \
4615 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4616 echo "Yup, it does."
4617 x_cpp="$cc -E"
4618 x_minus='';
4619elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4620 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4621 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4622 echo "Yup, it does."
4623 x_cpp="$cc -E"
4624 x_minus='-';
4625elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4626 $cc -P <testcpp.c >testcpp.out 2>&1; \
4627 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4628 echo "Yipee, that works!"
4629 x_cpp="$cc -P"
4630 x_minus='';
4631elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4632 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4633 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4634 echo "At long last!"
4635 x_cpp="$cc -P"
4636 x_minus='-';
4637elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4638 $cpp <testcpp.c >testcpp.out 2>&1; \
4639 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4640 echo "It works!"
4641 x_cpp="$cpp"
4642 x_minus='';
4643elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4644 $cpp - <testcpp.c >testcpp.out 2>&1; \
4645 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4646 echo "Hooray, it works! I was beginning to wonder."
4647 x_cpp="$cpp"
4648 x_minus='-';
4649elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4650 $wrapper <testcpp.c >testcpp.out 2>&1; \
4651 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4652 x_cpp="$wrapper"
4653 x_minus=''
4654 echo "Eureka!"
4655else
4656 dflt=''
4657 rp="No dice. I can't find a C preprocessor. Name one:"
4658 . ./myread
4659 x_cpp="$ans"
4660 x_minus=''
4661 $x_cpp <testcpp.c >testcpp.out 2>&1
4662 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4663 echo "OK, that will do." >&4
4664 else
4665echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4666 exit 1
4667 fi
4668fi
4669
4670case "$ok" in
4671false)
4672 cppstdin="$x_cpp"
4673 cppminus="$x_minus"
4674 cpprun="$x_cpp"
4675 cpplast="$x_minus"
4676 set X $x_cpp
4677 shift
4678 case "$1" in
4679 "$cpp")
4680 echo "Perhaps can we force $cc -E using a wrapper..."
4681 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4682 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4683 then
4684 echo "Yup, we can."
4685 cppstdin="$wrapper"
4686 cppminus='';
4687 else
4688 echo "Nope, we'll have to live without it..."
4689 fi
4690 ;;
4691 esac
4692 case "$cpprun" in
4693 "$wrapper")
4694 cpprun=''
4695 cpplast=''
4696 ;;
4697 esac
4698 ;;
4699esac
4700
4701case "$cppstdin" in
4702"$wrapper"|'cppstdin') ;;
4703*) $rm -f $wrapper;;
4704esac
4705$rm -f testcpp.c testcpp.out
4706
bd9b35c9
JH
4707: Set private lib path
4708case "$plibpth" in
4709'') if ./mips; then
4710 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4711 fi;;
4712esac
4713case "$libpth" in
4714' ') dlist='';;
4715'') dlist="$loclibpth $plibpth $glibpth";;
4716*) dlist="$libpth";;
4717esac
4718
4719: Now check and see which directories actually exist, avoiding duplicates
4720libpth=''
4721for xxx in $dlist
4722do
4723 if $test -d $xxx; then
4724 case " $libpth " in
4725 *" $xxx "*) ;;
4726 *) libpth="$libpth $xxx";;
4727 esac
4728 fi
4729done
4730$cat <<'EOM'
4731
4732Some systems have incompatible or broken versions of libraries. Among
4733the directories listed in the question below, please remove any you
4734know not to be holding relevant libraries, and add any that are needed.
4735Say "none" for none.
8e07c86e
AD
4736
4737EOM
bd9b35c9
JH
4738case "$libpth" in
4739'') dflt='none';;
8e07c86e 4740*)
bd9b35c9
JH
4741 set X $libpth
4742 shift
4743 dflt=${1+"$@"}
8e07c86e 4744 ;;
a0d0e21e 4745esac
bd9b35c9
JH
4746rp="Directories to use for library searches?"
4747. ./myread
4748case "$ans" in
4749none) libpth=' ';;
4750*) libpth="$ans";;
4751esac
a0d0e21e 4752
bd9b35c9
JH
4753: compute shared library extension
4754case "$so" in
4755'')
4756 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4757 dflt='sl'
dd4e71fd 4758 else
bd9b35c9 4759 dflt='so'
dd4e71fd
JH
4760 fi
4761 ;;
bd9b35c9 4762*) dflt="$so";;
dd4e71fd 4763esac
dd4e71fd
JH
4764$cat <<EOM
4765
bd9b35c9 4766On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4767you want to suppress searching of shared libraries for the remainder
bd9b35c9 4768of this configuration.
dd4e71fd
JH
4769
4770EOM
bd9b35c9
JH
4771rp='What is the file extension used for shared libraries?'
4772. ./myread
4773so="$ans"
dd4e71fd 4774
bd9b35c9
JH
4775: Define several unixisms.
4776: Hints files or command line option can be used to override them.
4777: The convoluted testing is in case hints files set either the old
4778: or the new name.
4779case "$_exe" in
4780'') case "$exe_ext" in
1fef16b3 4781 '') ;;
bd9b35c9 4782 *) _exe="$exe_ext" ;;
dd4e71fd 4783 esac
bd9b35c9 4784 ;;
bfb7748a 4785esac
bd9b35c9
JH
4786case "$_a" in
4787'') case "$lib_ext" in
4788 '') _a='.a';;
4789 *) _a="$lib_ext" ;;
dd4e71fd
JH
4790 esac
4791 ;;
dd4e71fd 4792esac
bd9b35c9
JH
4793case "$_o" in
4794'') case "$obj_ext" in
4795 '') _o='.o';;
4796 *) _o="$obj_ext";;
4797 esac
4798 ;;
4799esac
4800case "$p_" in
4801'') case "$path_sep" in
4802 '') p_=':';;
4803 *) p_="$path_sep";;
4804 esac
4805 ;;
4806esac
4807exe_ext=$_exe
4808lib_ext=$_a
4809obj_ext=$_o
4810path_sep=$p_
dd4e71fd 4811
5b813a60
MB
4812rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4813
b4eb6b3d
JH
4814: Which makefile gets called first. This is used by make depend.
4815case "$firstmakefile" in
4816'') firstmakefile='makefile';;
4633a7c4 4817esac
4633a7c4 4818
dd35fa16
MB
4819: Check is we will use socks
4820case "$usesocks" in
4821$define|true|[yY]*) dflt='y';;
4822*) dflt='n';;
4823esac
4824cat <<EOM
4825
4826Perl can be built to use the SOCKS proxy protocol library. To do so,
4827Configure must be run with -Dusesocks. If you use SOCKS you also need
4828to use the PerlIO abstraction layer, this will be implicitly selected.
4829
4830If this doesn't make any sense to you, just accept the default '$dflt'.
4831EOM
4832rp='Build Perl for SOCKS?'
4833. ./myread
4834case "$ans" in
4835y|Y) val="$define" ;;
4836*) val="$undef" ;;
4837esac
4838set usesocks
4839eval $setvar
4840
34f1896b 4841: Check for uselongdouble support
1f603089
JH
4842case "$ccflags" in
4843*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4844esac
4845
4846case "$uselongdouble" in
4847$define|true|[yY]*) dflt='y';;
4848*) dflt='n';;
4849esac
4850cat <<EOM
4851
4852Perl can be built to take advantage of long doubles which
4853(if available) may give more accuracy and range for floating point numbers.
4854
4855If this doesn't make any sense to you, just accept the default '$dflt'.
4856EOM
4857rp='Try to use long doubles if available?'
4858. ./myread
4859case "$ans" in
4860y|Y) val="$define" ;;
4861*) val="$undef" ;;
4862esac
4863set uselongdouble
4864eval $setvar
4865
4866case "$uselongdouble" in
4867true|[yY]*) uselongdouble="$define" ;;
4868esac
4869
1f603089
JH
4870: Look for a hint-file generated 'call-back-unit'. If the
4871: user has specified that long doubles should be used,
4872: we may need to set or change some other defaults.
9da7673b
MB
4873if $test -f uselongdouble.cbu; then
4874 echo "Your platform has some specific hints regarding long doubles, using them..."
4875 . ./uselongdouble.cbu
4876else
4877 case "$uselongdouble" in
4878 $define)
1f603089 4879 $cat <<EOM
9da7673b 4880(Your platform does not have any specific hints for long doubles.)
1f603089 4881EOM
1f603089 4882 ;;
9da7673b
MB
4883 esac
4884fi
1f603089 4885
bd9b35c9
JH
4886: Looking for optional libraries
4887echo " "
4888echo "Checking for optional libraries..." >&4
4889case "$libs" in
4890' '|'') dflt='';;
4891*) dflt="$libs";;
4892esac
4893case "$libswanted" in
4894'') libswanted='c_s';;
4895esac
4896case "$usesocks" in
923fc586 4897"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4898esac
68435ea7
JH
4899libsfound=''
4900libsfiles=''
4901libsdirs=''
13b3f787
JH
4902libspath=''
4903for thisdir in $libpth $xlibpth; do
4904 test -d $thisdir && libspath="$libspath $thisdir"
4905done
bd9b35c9 4906for thislib in $libswanted; do
13b3f787 4907 for thisdir in $libspath; do
f7dd4e7f
JH
4908 xxx=''
4909 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4910 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4911 $test -f "$xxx" && eval $libscheck
4912 $test -f "$xxx" && libstyle=shared
4913 fi
4914 if test ! -f "$xxx"; then
4915 xxx=$thisdir/lib$thislib.$so
4916 $test -f "$xxx" && eval $libscheck
4917 $test -f "$xxx" && libstyle=shared
613d6c3e 4918 fi
f7dd4e7f
JH
4919 if test ! -f "$xxx"; then
4920 xxx=$thisdir/lib$thislib$_a
4921 $test -f "$xxx" && eval $libscheck
4922 $test -f "$xxx" && libstyle=static
4923 fi
4924 if test ! -f "$xxx"; then
4925 xxx=$thisdir/$thislib$_a
4926 $test -f "$xxx" && eval $libscheck
4927 $test -f "$xxx" && libstyle=static
4928 fi
4929 if test ! -f "$xxx"; then
4930 xxx=$thisdir/lib${thislib}_s$_a
4931 $test -f "$xxx" && eval $libscheck
4932 $test -f "$xxx" && libstyle=static
09ea5ba9 4933 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4934 fi
4935 if test ! -f "$xxx"; then
4936 xxx=$thisdir/Slib$thislib$_a
4937 $test -f "$xxx" && eval $libscheck
4938 $test -f "$xxx" && libstyle=static
4939 fi
4940 if $test -f "$xxx"; then
43999f95 4941 case "$libstyle" in
f7dd4e7f
JH
4942 shared) echo "Found -l$thislib (shared)." ;;
4943 static) echo "Found -l$thislib." ;;
4944 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4945 esac
bd9b35c9
JH
4946 case " $dflt " in
4947 *"-l$thislib "*);;
f7dd4e7f 4948 *) dflt="$dflt -l$thislib"
43999f95
JH
4949 libsfound="$libsfound $xxx"
4950 yyy=`basename $xxx`
4951 libsfiles="$libsfiles $yyy"
1e127011 4952 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4953 case " $libsdirs " in
4954 *" $yyy "*) ;;
4955 *) libsdirs="$libsdirs $yyy" ;;
4956 esac
4957 ;;
bd9b35c9 4958 esac
f7dd4e7f 4959 break
613d6c3e 4960 fi
f7dd4e7f
JH
4961 done
4962 if $test ! -f "$xxx"; then
4963 echo "No -l$thislib."
bd9b35c9
JH
4964 fi
4965done
4966set X $dflt
4967shift
4968dflt="$*"
4969case "$libs" in
4970'') dflt="$dflt";;
4971*) dflt="$libs";;
4972esac
4973case "$dflt" in
4974' '|'') dflt='none';;
4975esac
4633a7c4 4976
bd9b35c9 4977$cat <<EOM
4633a7c4 4978
bd9b35c9
JH
4979In order to compile $package on your machine, a number of libraries
4980are usually needed. Include any other special libraries here as well.
4981Say "none" for none. The default list is almost always right.
8e07c86e 4982EOM
8e07c86e 4983
bd9b35c9
JH
4984echo " "
4985rp="What libraries to use?"
4986. ./myread
4987case "$ans" in
4988none) libs=' ';;
4989*) libs="$ans";;
4990esac
d71b2b6b 4991
bd9b35c9
JH
4992: determine optimization, if desired, or use for debug flag also
4993case "$optimize" in
4994' '|$undef) dflt='none';;
4995'') dflt='-O';;
4996*) dflt="$optimize";;
4997esac
4998$cat <<EOH
d71b2b6b 4999
bd9b35c9
JH
5000By default, $package compiles with the -O flag to use the optimizer.
5001Alternately, you might want to use the symbolic debugger, which uses
5002the -g flag (on traditional Unix systems). Either flag can be
5003specified here. To use neither flag, specify the word "none".
d71b2b6b 5004
bd9b35c9
JH
5005EOH
5006rp="What optimizer/debugger flag should be used?"
5007. ./myread
5008optimize="$ans"
5009case "$optimize" in
5010'none') optimize=" ";;
5011esac
5012
eaf812ae
MB
5013: Check what DEBUGGING is required from the command line
5014: -DEBUGGING or -DDEBUGGING or
5015: -DEBUGGING=both = -g + -DDEBUGGING
5016: -DEBUGGING=-g or -Doptimize=-g = -g
5017: -DEBUGGING=none or -UDEBUGGING =
5018: -DEBUGGING=old or -DEBUGGING=default = ? $optimize
5019case "$EBUGGING" in
5020'') ;;
5021*) DEBUGGING=$EBUGGING ;;
5022esac
5023
5024case "$DEBUGGING" in
5a7c70d6 5025-g|both|$define)
eaf812ae
MB
5026 case "$optimize" in
5027 *-g*) ;;
5028 *) optimize="$optimize -g" ;;
5029 esac ;;
5030none|$undef)
5031 case "$optimize" in
5032 *-g*) set `echo "X $optimize " | sed 's/ -g / /'`
5033 shift
5034 optimize="$*"
5035 ;;
5036 esac ;;
5037esac
5038
bd9b35c9 5039dflt=''
eaf812ae
MB
5040case "$DEBUGGING" in
5041both|$define) dflt='-DDEBUGGING'
5042esac
5043
c34316b3
NC
5044: argument order is deliberate, as the flag will start with - which set could
5045: think is an option
6682be1c 5046checkccflag='check=$1; flag=$2; callback=$3;
c34316b3
NC
5047echo " ";
5048echo "Checking if your compiler accepts $flag" 2>&1;
5049echo "int main(void) { return 0; }" > gcctest.c;
04b62921 5050if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
c34316b3 5051 echo "Yes, it does." 2>&1;
580e570e 5052 if $test -s gcctest.out ; then
04b62921
MB
5053 echo "But your platform does not like it:";
5054 cat gcctest.out;
5055 else
5056 case "$ccflags" in
5057 *$check*)
5058 echo "Leaving current flags $ccflags alone." 2>&1
5059 ;;
5060 *) dflt="$dflt $flag";
5061 eval $callback
5062 ;;
5063 esac
5064 fi
c34316b3
NC
5065else
5066 echo "Nope, it does not, but that is ok." 2>&1;
5067fi
5068'
5069
bd9b35c9
JH
5070: We will not override a previous value, but we might want to
5071: augment a hint file
5072case "$hint" in
5073default|recommended)
5074 case "$gccversion" in
eaf812ae 5075 1*) dflt="$dflt -fpcc-struct-return" ;;
d71b2b6b 5076 esac
eaf812ae
MB
5077 case "$optimize:$DEBUGGING" in
5078 *-g*:old) dflt="$dflt -DDEBUGGING";;
d71b2b6b 5079 esac
bd9b35c9 5080 case "$gccversion" in
580e570e 5081 2*) if $test -d /etc/conf/kconfig.d &&
bd9b35c9
JH
5082 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5083 then
00e89ad4 5084 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
5085 dflt="$dflt -posix"
5086 fi
f0d04425 5087 ;;
bd9b35c9
JH
5088 esac
5089 case "$gccversion" in
5090 1*) ;;
5091 2.[0-8]*) ;;
c0bacbef 5092 ?*) set strict-aliasing -fno-strict-aliasing
c34316b3 5093 eval $checkccflag
f0d04425 5094 ;;
e5e20432 5095 esac
00e89ad4
AD
5096 # For gcc, adding -pipe speeds up compilations for some, but apparently
5097 # some assemblers can't read from stdin. (It also slows down compilations
5098 # in other cases, but those are apparently rarer these days.) AD 5/2004.
5099 case "$gccversion" in
c34316b3
NC
5100 ?*) set pipe -pipe
5101 eval $checkccflag
00e89ad4
AD
5102 ;;
5103 esac
6682be1c
NC
5104
5105 # on x86_64 (at least) we require an extra library (libssp) in the
5106 # link command line. This library is not named, so I infer that it is
5107 # an implementation detail that may change. Hence the safest approach
5108 # is to add the flag to the flags passed to the compiler at link time,
5109 # as that way the compiler can do the right implementation dependant
5110 # thing. (NWC)
5111 case "$gccversion" in
8f68b0e6 5112 ?*) set stack-protector -fstack-protector
6682be1c
NC
5113 eval $checkccflag
5114 ;;
5115 esac
e5e20432
JH
5116 ;;
5117esac
5118
bd9b35c9
JH
5119case "$mips_type" in
5120*BSD*|'') inclwanted="$locincpth $usrinc";;
5121*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5122esac
5123for thisincl in $inclwanted; do
5124 if $test -d $thisincl; then
5125 if $test x$thisincl != x$usrinc; then
5126 case "$dflt" in
00e89ad4
AD
5127 *" -I$thisincl "*);;
5128 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
5129 esac
5130 fi
5131 fi
5132done
40a7a20a 5133
bd9b35c9
JH
5134inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5135 xxx=true;
5136elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5137 xxx=true;
5138else
5139 xxx=false;
5140fi;
5141if $xxx; then
5142 case "$dflt" in
5143 *$2*);;
5144 *) dflt="$dflt -D$2";;
5145 esac;
5146fi'
40a7a20a 5147
bd9b35c9 5148set signal.h LANGUAGE_C; eval $inctest
40a7a20a 5149
bd9b35c9
JH
5150case "$usesocks" in
5151$define)
5152 ccflags="$ccflags -DSOCKS"
5153 ;;
5154esac
40a7a20a 5155
bd9b35c9
JH
5156case "$hint" in
5157default|recommended) dflt="$ccflags $dflt" ;;
5158*) dflt="$ccflags";;
5159esac
40a7a20a 5160
bd9b35c9
JH
5161case "$dflt" in
5162''|' ') dflt=none;;
5163esac
422af00a 5164
bd9b35c9 5165$cat <<EOH
40a7a20a 5166
bd9b35c9
JH
5167Your C compiler may want other flags. For this question you should include
5168-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5169but you should NOT include libraries or ld flags like -lwhatever. If you
5170want $package to honor its debug switch, you should include -DDEBUGGING here.
5171Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 5172
bd9b35c9 5173To use no flags, specify the word "none".
40a7a20a 5174
bd9b35c9
JH
5175EOH
5176set X $dflt
5177shift
5178dflt=${1+"$@"}
5179rp="Any additional cc flags?"
5180. ./myread
5181case "$ans" in
5182none) ccflags='';;
5183*) ccflags="$ans";;
5184esac
8e07c86e 5185
bd9b35c9 5186: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
5187case "$cppflags" in
5188'') cppflags="$ccflags" ;;
5189*) cppflags="$cppflags $ccflags" ;;
5190esac
bd9b35c9
JH
5191case "$gccversion" in
51921*) cppflags="$cppflags -D__GNUC__"
4633a7c4 5193esac
bd9b35c9
JH
5194case "$mips_type" in
5195'');;
5196*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5197esac
5198case "$cppflags" in
5199'');;
5200*)
5201 echo " "
5202 echo "Let me guess what the preprocessor flags are..." >&4
5203 set X $cppflags
5204 shift
5205 cppflags=''
5206 $cat >cpp.c <<'EOM'
5207#define BLURFL foo
8e07c86e 5208
bd9b35c9
JH
5209BLURFL xx LFRULB
5210EOM
5211 previous=''
5212 for flag in $*
5213 do
5214 case "$flag" in
5215 -*) ftry="$flag";;
5216 *) ftry="$previous $flag";;
5217 esac
5218 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5219 >cpp1.out 2>/dev/null && \
5220 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5221 >cpp2.out 2>/dev/null && \
5222 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5223 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5224 then
5225 cppflags="$cppflags $ftry"
5226 previous=''
5227 else
5228 previous="$flag"
5229 fi
5230 done
5231 set X $cppflags
5232 shift
5233 cppflags=${1+"$@"}
5234 case "$cppflags" in
5235 *-*) echo "They appear to be: $cppflags";;
5236 esac
5237 $rm -f cpp.c cpp?.out
2afac517 5238 ;;
5239esac
8e07c86e 5240
bd9b35c9
JH
5241: flags used in final linking phase
5242case "$ldflags" in
5243'') if ./venix; then
5244 dflt='-i -z'
10a23457 5245 else
bd9b35c9 5246 dflt=''
10a23457 5247 fi
bd9b35c9
JH
5248 case "$ccflags" in
5249 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 5250 esac
bd9b35c9
JH
5251 ;;
5252*) dflt="$ldflags";;
5253esac
b2f871ed
AD
5254# See note above about -fstack-protector
5255case "$ccflags" in
5256*-fstack-protector*)
5257 case "$dflt" in
5258 *-fstack-protector*) ;; # Don't add it again
5259 *) dflt="$dflt -fstack-protector" ;;
5260 esac
5261 ;;
5262esac
bd9b35c9
JH
5263
5264: Try to guess additional flags to pick up local libraries.
5265for thislibdir in $libpth; do
5266 case " $loclibpth " in
5267 *" $thislibdir "*)
00e89ad4 5268 case "$dflt " in
bd9b35c9
JH
5269 *"-L$thislibdir "*) ;;
5270 *) dflt="$dflt -L$thislibdir" ;;
5271 esac
c4f23d77
AD
5272 ;;
5273 esac
bd9b35c9 5274done
c4f23d77 5275
bd9b35c9
JH
5276case "$dflt" in
5277'') dflt='none' ;;
5278esac
c4f23d77 5279
bd9b35c9
JH
5280$cat <<EOH
5281
5282Your C linker may need flags. For this question you should
5283include -L/whatever and any other flags used by the C linker, but you
5284should NOT include libraries like -lwhatever.
5285
5286Make sure you include the appropriate -L/path flags if your C linker
5287does not normally search all of the directories you specified above,
5288namely
5289 $libpth
5290To use no flags, specify the word "none".
5291
5292EOH
5293
5294rp="Any additional ld flags (NOT including libraries)?"
5295. ./myread
5296case "$ans" in
5297none) ldflags='';;
5298*) ldflags="$ans";;
5299esac
5300rmlist="$rmlist pdp11"
5301
5302: coherency check
5303echo " "
5304echo "Checking your choice of C compiler and flags for coherency..." >&4
5305$cat > try.c <<'EOF'
5306#include <stdio.h>
55954f19 5307int main() { printf("Ok\n"); return(0); }
bd9b35c9 5308EOF
7a282f6d 5309set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
5310shift
5311$cat >try.msg <<'EOM'
5312I've tried to compile and run the following simple program:
5313
5314EOM
5315$cat try.c >> try.msg
5316
5317$cat >> try.msg <<EOM
5318
5319I used the command:
5320
5321 $*
5440bc8e 5322 $run ./try
bd9b35c9
JH
5323
5324and I got the following output:
5325
5326EOM
5327dflt=y
73614538 5328if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
613d6c3e 5329 if $sh -c "$run ./try " >>try.msg 2>&1; then
5440bc8e 5330 xxx=`$run ./try`
bd9b35c9
JH
5331 case "$xxx" in
5332 "Ok") dflt=n ;;
5333 *) echo 'The program compiled OK, but produced no output.' >> try.msg
5334 case " $libs " in
5335 *" -lsfio "*)
5336 cat >> try.msg <<'EOQS'
5337If $libs contains -lsfio, and sfio is mis-configured, then it
5338sometimes (apparently) runs and exits with a 0 status, but with no
5339output! It may have to do with sfio's use of _exit vs. exit.
5340
5341EOQS
5342 rp="You have a big problem. Shall I abort Configure"
5343 dflt=y
5344 ;;
5345 esac
5346 ;;
5347 esac
5348 else
5349 echo "The program compiled OK, but exited with status $?." >>try.msg
5350 rp="You have a problem. Shall I abort Configure"
5351 dflt=y
5352 fi
5353else
5354 echo "I can't compile the test program." >>try.msg
5355 rp="You have a BIG problem. Shall I abort Configure"
5356 dflt=y
5357fi
5358case "$dflt" in
5359y)
5360 $cat try.msg >&4
5361 case "$knowitall" in
5362 '')
5363 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5364 ;;
bd9b35c9 5365 *) dflt=n;;
c4f23d77 5366 esac
bd9b35c9
JH
5367 echo " "
5368 . ./myread
5369 case "$ans" in
5370 n*|N*) ;;
5371 *) echo "Ok. Stopping Configure." >&4
5372 exit 1
c4f23d77
AD
5373 ;;
5374 esac
5375 ;;
bd9b35c9 5376n) echo "OK, that should do.";;
c4f23d77 5377esac
613d6c3e 5378$rm_try gcctest gcctest.out
c4f23d77 5379
bd9b35c9
JH
5380: define a shorthand compile call
5381compile='
5382mc_file=$1;
5383shift;
08593cf4
NC
5384case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5385echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5386exit 1;
5387fi;
5388esac;
08413ebc 5389$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5390: define a shorthand compile call for compilations that should be ok.
5391compile_ok='
5392mc_file=$1;
5393shift;
7a282f6d 5394$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5395
8dfa8df9
JH
5396: determine filename position in cpp output
5397echo " "
5398echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5399case "$osname" in
5400vos) testaccess=-e ;;
5401*) testaccess=-r ;;
5402esac
8dfa8df9
JH
5403echo '#include <stdio.h>' > foo.c
5404$cat >fieldn <<EOF
5405$startsh
5406$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5407$grep '^[ ]*#.*stdio\.h' | \
5408while read cline; do
5409 pos=1
5410 set \$cline
5411 while $test \$# -gt 0; do
a5a94ea5 5412 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5413 echo "\$pos"
5414 exit 0
5415 fi
5416 shift
5417 pos=\`expr \$pos + 1\`
5418 done
5419done
5420EOF
5421chmod +x fieldn
5422fieldn=`./fieldn`
5423$rm -f foo.c fieldn
5424case $fieldn in
5425'') pos='???';;
54261) pos=first;;
54272) pos=second;;
54283) pos=third;;
5429*) pos="${fieldn}th";;
5430esac
5431echo "Your cpp writes the filename in the $pos field of the line."
5432
3c728e00
JH
5433case "$osname" in
5434vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5c728af0 5435os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5436*) cppfilter='' ;;
5437esac
8dfa8df9
JH
5438: locate header file
5439$cat >findhdr <<EOF
5440$startsh
5441wanted=\$1
5442name=''
5443for usrincdir in $usrinc
5444do
5445 if test -f \$usrincdir/\$wanted; then
5446 echo "\$usrincdir/\$wanted"
5447 exit 0
5448 fi
5449done
5450awkprg='{ print \$$fieldn }'
5451echo "#include <\$wanted>" > foo\$\$.c
5452$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5453$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5454while read cline; do
5455 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5456 case "\$name" in
5457 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5458 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5459 *) exit 2;;
5460 esac;
5461done;
5462#
5463# status = 0: grep returned 0 lines, case statement not executed
5464# status = 1: headerfile found
5465# status = 2: while loop executed, no headerfile found
5466#
5467status=\$?
5468$rm -f foo\$\$.c;
5469if test \$status -eq 1; then
5470 exit 0;
5471fi
5472exit 1
5473EOF
5474chmod +x findhdr
5475
5476: define an alternate in-header-list? function
5477inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5478cont=true; xxf="echo \"<\$1> found.\" >&4";
5479case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5480*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5481esac;
5482case $# in 4) instead=instead;; *) instead="at last";; esac;
5483while $test "$cont"; do
5484 xxx=`./findhdr $1`
5485 var=$2; eval "was=\$$2";
5486 if $test "$xxx" && $test -r "$xxx";
5487 then eval $xxf;
5488 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5489 cont="";
5490 else eval $xxnf;
5491 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5492 set $yyy; shift; shift; yyy=$@;
5493 case $# in 0) cont="";;
5494 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5495 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5496 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5497 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5498 esac;
5499done;
5500while $test "$yyy";
5501do set $yyy; var=$2; eval "was=\$$2";
5502 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5503 set $yyy; shift; shift; yyy=$@;
5504done'
5505
d1daaddf
JH
5506: see if stdlib is available
5507set stdlib.h i_stdlib
5508eval $inhdr
5509
5510: check for lengths of integral types
5511echo " "
5512case "$intsize" in
5513'')
5514 echo "Checking to see how big your integers are..." >&4
c63dfae1 5515 $cat >try.c <<EOCP
d1daaddf
JH
5516#include <stdio.h>
5517#$i_stdlib I_STDLIB
5518#ifdef I_STDLIB
5519#include <stdlib.h>
5520#endif
5521int main()
5522{
5523 printf("intsize=%d;\n", (int)sizeof(int));
5524 printf("longsize=%d;\n", (int)sizeof(long));
5525 printf("shortsize=%d;\n", (int)sizeof(short));
5526 exit(0);
5527}
5528EOCP
5529 set try
5530 if eval $compile_ok && $run ./try > /dev/null; then
5531 eval `$run ./try`
5532 echo "Your integers are $intsize bytes long."
5533 echo "Your long integers are $longsize bytes long."
5534 echo "Your short integers are $shortsize bytes long."
5535 else
5536 $cat >&4 <<EOM
5537!
5538Help! I can't compile and run the intsize test program: please enlighten me!
5539(This is probably a misconfiguration in your system or libraries, and
5540you really ought to fix it. Still, I'll try anyway.)
5541!
5542EOM
5543 dflt=4
5544 rp="What is the size of an integer (in bytes)?"
5545 . ./myread
5546 intsize="$ans"
5547 dflt=$intsize
5548 rp="What is the size of a long integer (in bytes)?"
5549 . ./myread
5550 longsize="$ans"
5551 dflt=2
5552 rp="What is the size of a short integer (in bytes)?"
5553 . ./myread
5554 shortsize="$ans"
5555 fi
5556 ;;
5557esac
5b813a60 5558$rm_try
d1daaddf
JH
5559
5560: check for long long
5561echo " "
5562echo "Checking to see if you have long long..." >&4
5563echo 'int main() { long long x = 7; return 0; }' > try.c
5564set try
5565if eval $compile; then
5566 val="$define"
5567 echo "You have long long."
5568else
5569 val="$undef"
5570 echo "You do not have long long."
5571fi
5b813a60 5572$rm_try
d1daaddf
JH
5573set d_longlong
5574eval $setvar
5575
5576: check for length of long long
5577case "${d_longlong}${longlongsize}" in
5578$define)
5579 echo " "
5580 echo "Checking to see how big your long longs are..." >&4
5581 $cat >try.c <<'EOCP'
5582#include <stdio.h>
5583int main()
5584{
5585 printf("%d\n", (int)sizeof(long long));
5586 return(0);
5587}
5588EOCP
5589 set try
5590 if eval $compile_ok; then
5591 longlongsize=`$run ./try`
5592 echo "Your long longs are $longlongsize bytes long."
5593 else
5594 dflt='8'
5595 echo " "
5596 echo "(I can't seem to compile the test program. Guessing...)"
5597 rp="What is the size of a long long (in bytes)?"
5598 . ./myread
5599 longlongsize="$ans"
5600 fi
5601 if $test "X$longsize" = "X$longlongsize"; then
5602 echo "(That isn't any different from an ordinary long.)"
5b813a60 5603 fi
d1daaddf
JH
5604 ;;
5605esac
5b813a60 5606$rm_try
d1daaddf 5607
8dfa8df9
JH
5608: see if inttypes.h is available
5609: we want a real compile instead of Inhdr because some systems
5610: have an inttypes.h which includes non-existent headers
5611echo " "
5612$cat >try.c <<EOCP
5613#include <inttypes.h>
5614int main() {
5615 static int32_t foo32 = 0x12345678;
5616}
5617EOCP
5618set try
5619if eval $compile; then
5620 echo "<inttypes.h> found." >&4
5621 val="$define"
5622else
5623 echo "<inttypes.h> NOT found." >&4
5624 val="$undef"
5625fi
5b813a60 5626$rm_try
8dfa8df9
JH
5627set i_inttypes
5628eval $setvar
5629
5630: check for int64_t
5631echo " "
5632echo "Checking to see if you have int64_t..." >&4
5633$cat >try.c <<EOCP
5634#include <sys/types.h>
5635#$i_inttypes I_INTTYPES
5636#ifdef I_INTTYPES
5637#include <inttypes.h>
5638#endif
5639int main() { int64_t x = 7; }
5640EOCP
5641set try
5642if eval $compile; then
5643 val="$define"
5644 echo "You have int64_t."
5645else
5646 val="$undef"
5647 echo "You do not have int64_t."
5648fi
5b813a60 5649$rm_try
8dfa8df9
JH
5650set d_int64_t
5651eval $setvar
5652
613d6c3e 5653: Check if 64bit ints have a quad type
8dfa8df9
JH
5654echo " "
5655echo "Checking which 64-bit integer type we could use..." >&4
5656
5657case "$intsize" in
56588) val=int
5659 set quadtype
5660 eval $setvar
5661 val='"unsigned int"'
5662 set uquadtype
5663 eval $setvar
5664 quadkind=1
5665 ;;
5666*) case "$longsize" in
5667 8) val=long
5668 set quadtype
5669 eval $setvar
5670 val='"unsigned long"'
5671 set uquadtype
5672 eval $setvar
5673 quadkind=2
5674 ;;
5675 *) case "$d_longlong:$longlongsize" in
5676 define:8)
5677 val='"long long"'
5678 set quadtype
5679 eval $setvar
5680 val='"unsigned long long"'
5681 set uquadtype
5682 eval $setvar
5683 quadkind=3
5684 ;;
5685 *) case "$d_int64_t" in
5686 define)
5687 val=int64_t
5688 set quadtype
5689 eval $setvar
5690 val=uint64_t
5691 set uquadtype
5692 eval $setvar
5693 quadkind=4
5694 ;;
5695 esac
5696 ;;
5697 esac
5698 ;;
5699 esac
5700 ;;
5701esac
5702
5703case "$quadtype" in
5704'') echo "Alas, no 64-bit integer types in sight." >&4
5705 d_quad="$undef"
5706 ;;
5707*) echo "We could use '$quadtype' for 64-bit integers." >&4
5708 d_quad="$define"
5709 ;;
5710esac
5711
34f1896b 5712: Do we want 64bit support
b4eb6b3d
JH
5713case "$uselonglong" in
5714"$define"|true|[yY]*)
5715 cat <<EOM >&4
5716
5717*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5718EOM
5719 use64bitint="$define"
5720 ;;
613d6c3e 5721esac
b4eb6b3d
JH
5722case "$use64bits" in
5723"$define"|true|[yY]*)
5724 cat <<EOM >&4
5725
5726*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5727EOM
5728 use64bitint="$define"
5729 ;;
613d6c3e 5730esac
b4eb6b3d
JH
5731case "$use64bitints" in
5732"$define"|true|[yY]*)
5733 cat <<EOM >&4
5734
5735*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5736EOM
5737 use64bitint="$define"
5738 ;;
613d6c3e 5739esac
b4eb6b3d
JH
5740case "$use64bitsint" in
5741"$define"|true|[yY]*)
5742 cat <<EOM >&4
5743
5744*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5745EOM
5746 use64bitint="$define"
5747 ;;
613d6c3e 5748esac
b4eb6b3d
JH
5749case "$uselonglongs" in
5750"$define"|true|[yY]*)
5751 cat <<EOM >&4
5752
5753*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5754EOM
5755 use64bitint="$define"
5756 ;;
613d6c3e 5757esac
b4eb6b3d
JH
5758case "$use64bitsall" in
5759"$define"|true|[yY]*)
5760 cat <<EOM >&4
5761
5762*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5763EOM
5764 use64bitall="$define"
5765 ;;
613d6c3e 5766esac
b4eb6b3d
JH
5767
5768case "$ccflags" in
5769*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5770esac
5771case "$use64bitall" in
5772"$define"|true|[yY]*) use64bitint="$define" ;;
5773esac
5774
5775case "$longsize" in
57768) cat <<EOM
5777
5778You have natively 64-bit long integers.
5779EOM
5780 val="$define"
5781 ;;
5782*) case "$use64bitint" in
5783 "$define"|true|[yY]*) dflt='y';;
5784 *) dflt='n';;
5785 esac
8dfa8df9
JH
5786 case "$d_quad" in
5787 "$define") ;;
5788 *) dflt='n' ;;
5789 esac
b4eb6b3d
JH
5790 cat <<EOM
5791
5792Perl can be built to take advantage of 64-bit integer types
5793on some systems. To do so, Configure can be run with -Duse64bitint.
5794Choosing this option will most probably introduce binary incompatibilities.
5795
5796If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5797(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5798EOM
5799 rp='Try to use 64-bit integers, if available?'
5800 . ./myread
5801 case "$ans" in
5802 [yY]*) val="$define" ;;
5803 *) val="$undef" ;;
5804 esac
5805 ;;
5806esac
5807set use64bitint
5808eval $setvar
5809
5810case "$use64bitall" in
5811"$define"|true|[yY]*) dflt='y' ;;
5812*) case "$longsize" in
5813 8) dflt='y' ;;
5814 *) dflt='n' ;;
5815 esac
5816 ;;
613d6c3e 5817esac
b4eb6b3d
JH
5818cat <<EOM
5819
5820You may also choose to try maximal 64-bitness. It means using as much
582164-bitness as possible on the platform. This in turn means even more
5822binary incompatibilities. On the other hand, your platform may not
5823have any more 64-bitness available than what you already have chosen.
5824
5825If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5826(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5827EOM
5828rp='Try to use maximal 64-bit support, if available?'
5829. ./myread
5830case "$ans" in
5831[yY]*) val="$define" ;;
5832*) val="$undef" ;;
5833esac
5834set use64bitall
5835eval $setvar
5836case "$use64bitall" in
5837"$define")
5838 case "$use64bitint" in
5839 "$undef")
5840 cat <<EOM
5841
5842Since you have chosen a maximally 64-bit build, I'm also turning on
5843the use of 64-bit integers.
5844EOM
5845 use64bitint="$define" ;;
5846 esac
5847 ;;
5848esac
5849
b4eb6b3d
JH
5850: Look for a hint-file generated 'call-back-unit'. If the
5851: user has specified that a 64-bit perl is to be built,
5852: we may need to set or change some other defaults.
19a100ff 5853if $test -f use64bitint.cbu; then
9da7673b 5854 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
19a100ff
MB
5855 . ./use64bitint.cbu
5856fi
9da7673b
MB
5857case "$use64bitint" in
5858"$define"|true|[yY]*)
b4eb6b3d
JH
5859 case "$longsize" in
5860 4) case "$archname64" in
5861 '') archname64=64int ;;
5862 esac
5863 ;;
5864 esac
5865 ;;
5866esac
5867
b4eb6b3d
JH
5868: Look for a hint-file generated 'call-back-unit'. If the
5869: user has specified that a maximally 64-bit perl is to be built,
5870: we may need to set or change some other defaults.
19a100ff 5871if $test -f use64bitall.cbu; then
9da7673b 5872 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
19a100ff
MB
5873 . ./use64bitall.cbu
5874fi
9da7673b
MB
5875case "$use64bitall" in
5876"$define"|true|[yY]*)
b4eb6b3d
JH
5877 case "$longsize" in
5878 4) case "$archname64" in
5879 ''|64int) archname64=64all ;;
5880 esac
5881 ;;
5882 esac
5883 ;;
5884esac
5885
1911a026
JH
5886case "$d_quad:$use64bitint" in
5887$undef:$define)
5888 cat >&4 <<EOF
5889
5890*** You have chosen to use 64-bit integers,
19a100ff 5891*** but none can be found.
09b58c7b 5892*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
1911a026
JH
5893*** Cannot continue, aborting.
5894
5895EOF
5896 exit 1
5897 ;;
5898esac
5899
36adc09b
JH
5900: check for length of double
5901echo " "
5902case "$doublesize" in
5903'')
5904 echo "Checking to see how big your double precision numbers are..." >&4
5905 $cat >try.c <<EOCP
5906#include <stdio.h>
1911a026
JH
5907#$i_stdlib I_STDLIB
5908#ifdef I_STDLIB
5909#include <stdlib.h>
5910#endif
36adc09b
JH
5911int main()
5912{
5913 printf("%d\n", (int)sizeof(double));
1911a026 5914 exit(0);
36adc09b
JH
5915}
5916EOCP
5917 set try
5918 if eval $compile_ok; then
5919 doublesize=`$run ./try`
5920 echo "Your double is $doublesize bytes long."
5921 else
5922 dflt='8'
5923 echo "(I can't seem to compile the test program. Guessing...)"
5924 rp="What is the size of a double precision number (in bytes)?"
5925 . ./myread
5926 doublesize="$ans"
5927 fi
5928 ;;
5929esac
5b813a60 5930$rm_try
36adc09b
JH
5931
5932: check for long doubles
5933echo " "
5934echo "Checking to see if you have long double..." >&4
5935echo 'int main() { long double x = 7.0; }' > try.c
5936set try
5937if eval $compile; then
5938 val="$define"
5939 echo "You have long double."
5940else
5941 val="$undef"
5942 echo "You do not have long double."
5943fi
5b813a60 5944$rm_try
36adc09b
JH
5945set d_longdbl
5946eval $setvar
5947
5948: check for length of long double
5949case "${d_longdbl}${longdblsize}" in
5950$define)
5951 echo " "
5952 echo "Checking to see how big your long doubles are..." >&4
5953 $cat >try.c <<'EOCP'
5954#include <stdio.h>
5955int main()
5956{
5957 printf("%d\n", sizeof(long double));
5958}
5959EOCP
5960 set try
5961 set try
5962 if eval $compile; then
5963 longdblsize=`$run ./try`
5964 echo "Your long doubles are $longdblsize bytes long."
5965 else
5966 dflt='8'
5967 echo " "
5968 echo "(I can't seem to compile the test program. Guessing...)" >&4
5969 rp="What is the size of a long double (in bytes)?"
5970 . ./myread
5971 longdblsize="$ans"
5972 fi
5973 if $test "X$doublesize" = "X$longdblsize"; then
7ad90562
AD
5974 echo "That isn't any different from an ordinary double."
5975 echo "I'll keep your setting anyway, but you may see some"
5976 echo "harmless compilation warnings."
5b813a60 5977 fi
36adc09b
JH
5978 ;;
5979esac
5b813a60 5980$rm_try
36adc09b 5981
89ce900e 5982: determine the architecture name
b4eb6b3d 5983echo " "
89ce900e
JH
5984if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5985 tarch=`arch`"-$osname"
5986elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5987 if uname -m > tmparch 2>&1 ; then
5988 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5989 -e 's/$/'"-$osname/" tmparch`
5990 else
5991 tarch="$osname"
5992 fi
5993 $rm -f tmparch
b4eb6b3d 5994else
89ce900e 5995 tarch="$osname"
b4eb6b3d 5996fi
89ce900e
JH
5997case "$myarchname" in
5998''|"$tarch") ;;
5999*)
6000 echo "(Your architecture name used to be $myarchname.)"
6001 archname=''
6002 ;;
6003esac
6004case "$targetarch" in
6005'') ;;
6006*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6007esac
6008myarchname="$tarch"
6009case "$archname" in
6010'') dflt="$tarch";;
6011*) dflt="$archname";;
6012esac
6013rp='What is your architecture name'
6014. ./myread
6015archname="$ans"
6016case "$usethreads" in
6017$define)
6018 echo "Threads selected." >&4
6019 case "$archname" in
6020 *-thread*) echo "...and architecture name already has -thread." >&4
6021 ;;
6022 *) archname="$archname-thread"
6023 echo "...setting architecture name to $archname." >&4
6024 ;;
6025 esac
6026 ;;
6027esac
6028case "$usemultiplicity" in
6029$define)
6030 echo "Multiplicity selected." >&4
6031 case "$archname" in
6032 *-multi*) echo "...and architecture name already has -multi." >&4
6033 ;;
6034 *) archname="$archname-multi"
6035 echo "...setting architecture name to $archname." >&4
6036 ;;
6037 esac
6038 ;;
6039esac
6040case "$use64bitint$use64bitall" in
6041*"$define"*)
6042 case "$archname64" in
6043 '')
6044 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
bd9b35c9 6045 ;;
89ce900e
JH
6046 *)
6047 case "$use64bitint" in
6048 "$define") echo "64 bit integers selected." >&4 ;;
6049 esac
6050 case "$use64bitall" in
6051 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6052 esac
6053 case "$archname" in
6054 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6055 ;;
6056 *) archname="$archname-$archname64"
6057 echo "...setting architecture name to $archname." >&4
6058 ;;
6059 esac
c1a7f87b
JH
6060 ;;
6061 esac
89ce900e
JH
6062esac
6063case "$uselongdouble" in
6064$define)
6065 echo "Long doubles selected." >&4
6066 case "$longdblsize" in
6067 $doublesize)
6068 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6069 ;;
6070 *)
6071 case "$archname" in
6072 *-ld*) echo "...and architecture name already has -ld." >&4
6073 ;;
6074 *) archname="$archname-ld"
6075 echo "...setting architecture name to $archname." >&4
6076 ;;
6077 esac
bd9b35c9
JH
6078 ;;
6079 esac
bd9b35c9 6080 ;;
89ce900e 6081esac
d2e0c6f7
JH
6082if $test -f archname.cbu; then
6083 echo "Your platform has some specific hints for architecture name, using them..."
6084 . ./archname.cbu
6085fi
bd9b35c9 6086
b4eb6b3d
JH
6087: set the prefixit variable, to compute a suitable default value
6088prefixit='case "$3" in
6089""|none)
6090 case "$oldprefix" in
6091 "") eval "$1=\"\$$2\"";;
6092 *)
6093 case "$3" in
6094 "") eval "$1=";;
6095 none)
6096 eval "tp=\"\$$2\"";
6097 case "$tp" in
6098 ""|" ") eval "$1=\"\$$2\"";;
6099 *) eval "$1=";;
6100 esac;;
6101 esac;;
6102 esac;;
6103*)
6104 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6105 case "$tp" in
6106 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6107 /*-$oldprefix/*|\~*-$oldprefix/*)
6108 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6109 *) eval "$1=\"\$$2\"";;
6110 esac;;
6111esac'
6112
f3f1a2d8
MB
6113: determine installation style
6114: For now, try to deduce it from prefix unless it is already set.
6115: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6116case "$installstyle" in
6117'') case "$prefix" in
6118 *perl*) dflt='lib';;
6119 *) dflt='lib/perl5' ;;
6120 esac
6121 ;;
6122*) dflt="$installstyle" ;;
4d20abad 6123esac
f3f1a2d8
MB
6124: Probably not worth prompting for this since we prompt for all
6125: the directories individually, and the prompt would be too long and
6126: confusing anyway.
6127installstyle=$dflt
4d20abad 6128
eaf812ae
MB
6129: determine where public executables go
6130echo " "
6131set dflt bin bin
6132eval $prefixit
6133fn=d~
6134rp='Pathname where the public executables will reside?'
6135. ./getfile
6136if $test "X$ansexp" != "X$binexp"; then
6137 installbin=''
6138fi
6139prefixvar=bin
6140: XXX Bug? -- ignores Configure -Dinstallprefix setting.
d0e36aa9 6141: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
a2d23ec2 6142: this via initialinstalllocation
eaf812ae
MB
6143. ./setprefixvar
6144
6145case "$userelocatableinc" in
6146$define|true|[yY]*) dflt='y' ;;
6147*) dflt='n' ;;
6148esac
6149cat <<EOM
6150
6151Would you like to build Perl so that the installation is relocatable, so that
6152library paths in @INC are determined relative to the path of the perl binary?
6153This is not advised for system Perl installs, or if you need to run setid
6154scripts or scripts under taint mode.
6155
6156If this doesn't make any sense to you, just accept the default '$dflt'.
6157EOM
6158rp='Use relocatable @INC?'
6159. ./myread
6160case "$ans" in
6161y|Y) val="$define" ;;
6162*) val="$undef" ;;
6163esac
6164set userelocatableinc
6165eval $setvar
6166
ea7d701d 6167initialinstalllocation="$binexp"
eaf812ae
MB
6168: Default prefix is now "up one level from where the binaries are"
6169case "$userelocatableinc" in
6170$define|true|[yY]*)
eaf812ae
MB
6171 bin=".../"
6172 binexp=".../"
6173 prefix=".../.."
6174 prefixexp=".../.."
6175 installprefixexp=".../.."
6176 ;;
6177esac
6178
b4eb6b3d
JH
6179: determine where private library files go
6180: Usual default is /usr/local/lib/perl5/$version.
f3f1a2d8 6181: Also allow things like /opt/perl/lib/$version, since
b4eb6b3d
JH
6182: /opt/perl/lib/perl5... would be redundant.
6183: The default "style" setting is made in installstyle.U
6184case "$installstyle" in
6185*lib/perl5*) set dflt privlib lib/$package/$version ;;
6186*) set dflt privlib lib/$version ;;
6187esac
6188eval $prefixit
6189$cat <<EOM
6190
6191There are some auxiliary files for $package that need to be put into a
6192private library directory that is accessible by everyone.
6193
6194EOM
eaf812ae 6195fn=$binexp
b4eb6b3d
JH
6196fn=d~+
6197rp='Pathname where the private library files will reside?'
6198. ./getfile
79522dd2
NC
6199prefixvar=privlib
6200. ./setprefixvar
b4eb6b3d
JH
6201
6202: set the prefixup variable, to restore leading tilda escape
6203prefixup='case "$prefixexp" in
6204"$prefix") ;;
6205*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6206esac'
6207
6208: determine where public architecture dependent libraries go
6209set archlib archlib
6210eval $prefixit
6211: privlib default is /usr/local/lib/$package/$version
6212: archlib default is /usr/local/lib/$package/$version/$archname
6213: privlib may have an optional trailing /share.
6214tdflt=`echo $privlib | $sed 's,/share$,,'`
6215tdflt=$tdflt/$archname
6216case "$archlib" in
6217'') dflt=$tdflt
6218 ;;
6219*) dflt="$archlib"
6220 ;;
6221esac
6222$cat <<EOM
6223
6224$spackage contains architecture-dependent library files. If you are
6225sharing libraries in a heterogeneous environment, you might store
6226these files in a separate location. Otherwise, you can just include
6227them with the rest of the public library files.
6228
6229EOM
eaf812ae 6230fn=$binexp
b4eb6b3d
JH
6231fn=d+~
6232rp='Where do you want to put the public architecture-dependent libraries?'
6233. ./getfile
79522dd2
NC
6234prefixvar=archlib
6235. ./setprefixvar
b4eb6b3d
JH
6236if $test X"$archlib" = X"$privlib"; then
6237 d_archlib="$undef"
6238else
6239 d_archlib="$define"
6240fi
b4eb6b3d 6241
b4eb6b3d
JH
6242: see if setuid scripts can be secure
6243$cat <<EOM
6244
6245Some kernels have a bug that prevents setuid #! scripts from being
6246secure. Some sites have disabled setuid #! scripts because of this.
6247
6248First let's decide if your kernel supports secure setuid #! scripts.
6249(If setuid #! scripts would be secure but have been disabled anyway,
6250don't say that they are secure if asked.)
6251
6252EOM
6253
6254val="$undef"
6255if $test -d /dev/fd; then
6256 echo "#!$ls" >reflect
6257 chmod +x,u+s reflect
6258 ./reflect >flect 2>&1
6259 if $contains "/dev/fd" flect >/dev/null; then
6260 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6261 val="$define"
6262 else
6263 $cat <<EOM
6264If you are not sure if they are secure, I can check but I'll need a
6265username and password different from the one you are using right now.
6266If you don't have such a username or don't want me to test, simply
6267enter 'none'.
6268
6269EOM
6270 rp='Other username to test security of setuid scripts with?'
6271 dflt='none'
6272 . ./myread
6273 case "$ans" in
6274 n|none)
6275 case "$d_suidsafe" in
6276 '') echo "I'll assume setuid scripts are *not* secure." >&4
6277 dflt=n;;
6278 "$undef")
6279 echo "Well, the $hint value is *not* secure." >&4
6280 dflt=n;;
6281 *) echo "Well, the $hint value *is* secure." >&4
6282 dflt=y;;
6283 esac
c1a7f87b 6284 ;;
b4eb6b3d
JH
6285 *)
6286 $rm -f reflect flect
6287 echo "#!$ls" >reflect
6288 chmod +x,u+s reflect
6289 echo >flect
6290 chmod a+w flect
6291 echo '"su" will (probably) prompt you for '"$ans's password."
6292 su $ans -c './reflect >flect'
6293 if $contains "/dev/fd" flect >/dev/null; then
6294 echo "Okay, it looks like setuid scripts are secure." >&4
6295 dflt=y
6296 else
6297 echo "I don't think setuid scripts are secure." >&4
6298 dflt=n
6299 fi
6300 ;;
6301 esac
6302 rp='Does your kernel have *secure* setuid scripts?'
6303 . ./myread
6304 case "$ans" in
6305 [yY]*) val="$define";;
6306 *) val="$undef";;
6307 esac
6308 fi
6309else
6310 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6311 echo "(That's for file descriptors, not floppy disks.)"
6312 val="$undef"
6313fi
6314set d_suidsafe
6315eval $setvar
6316
6317$rm -f reflect flect
6318
6319: now see if they want to do setuid emulation
01614441 6320if $test $patchlevel -lt 11; then
b4eb6b3d
JH
6321echo " "
6322val="$undef"
6323case "$d_suidsafe" in
6324"$define")
6325 val="$undef"
3c728e00 6326 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d 6327 ;;
f3f1a2d8
MB
6328*)
6329 $cat <<EOM
6330Some systems have disabled setuid scripts, especially systems where
6331setuid scripts cannot be secure. On systems where setuid scripts have
6332been disabled, the setuid/setgid bits on scripts are currently
6333useless. It is possible for $package to detect those bits and emulate
6334setuid/setgid in a secure fashion. This emulation will only work if
6335setuid scripts have been disabled in your kernel.
6336
6337EOM
6338 case "$d_dosuid" in
6339 "$define") dflt=y ;;
6340 *) dflt=n ;;
6341 esac
6342 rp="Do you want to do setuid/setgid emulation?"
6343 . ./myread
6344 case "$ans" in
6345 [yY]*) val="$define";;
6346 *) val="$undef";;
6347 esac
6348 ;;
6349esac
6350set d_dosuid
6351eval $setvar
01614441
MB
6352else
6353 case "$d_dosuid" in
6354 "$define")
6355 cat >&4 <<EOH
6356
6357SUID emulation has been removed for 5.12
6358Please re-run Configure without -Dd_dosuid
6359
6360EOH
6361 exit 1;
6362 ;;
6363 esac
6364 d_dosuid=undef
6365fi
f3f1a2d8 6366
f3f1a2d8
MB
6367: Find perl5.005 or later.
6368echo "Looking for a previously installed perl5.005 or later... "
6369case "$perl5" in
6370'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6371 : Check if this perl is recent and can load a simple module
6372 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6373 perl5=$tdir/perl
6374 break;
6375 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6376 perl5=$tdir/perl5
6377 break;
6378 fi
6379 done
6380 ;;
6381*) perl5="$perl5"
6382 ;;
6383esac
6384case "$perl5" in
6385'') echo "None found. That's ok.";;
6386*) echo "Using $perl5." ;;
6387esac
6388
613d6c3e 6389: Set the siteprefix variables
f3f1a2d8
MB
6390$cat <<EOM
6391
6392After $package is installed, you may wish to install various
6393add-on modules and utilities. Typically, these add-ons will
6394be installed under $prefix with the rest
6395of this package. However, you may wish to install such add-ons
6396elsewhere under a different prefix.
6397
6398If you do not wish to put everything under a single prefix, that's
6399ok. You will be prompted for the individual locations; this siteprefix
6400is only used to suggest the defaults.
6401
6402The default should be fine for most people.
6403
6404EOM
6405fn=d~+
6406rp='Installation prefix to use for add-on modules and utilities?'
6407: XXX Here might be another good place for an installstyle setting.
6408case "$siteprefix" in
6409'') dflt=$prefix ;;
6410*) dflt=$siteprefix ;;
6411esac
6412. ./getfile
6413: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6414oldsiteprefix=''
6415case "$siteprefix" in
6416'') ;;
6417*) case "$ans" in
6418 "$prefix") ;;
6419 *) oldsiteprefix="$prefix";;
6420 esac
6421 ;;
6422esac
6423siteprefix="$ans"
6424siteprefixexp="$ansexp"
6425
6426: determine where site specific libraries go.
6427: Usual default is /usr/local/lib/perl5/site_perl/$version
6428: The default "style" setting is made in installstyle.U
6429: XXX No longer works with Prefixit stuff.
6430prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6431case "$sitelib" in
6432'') case "$installstyle" in
6433 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6434 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6435 esac
6436 ;;
6437*) dflt="$sitelib"
6438 ;;
6439esac
6440$cat <<EOM
6441
6442The installation process will create a directory for
6443site-specific extensions and modules. Most users find it convenient
6444to place all site-specific files in this directory rather than in the
6445main distribution directory.
6446
6447EOM
6448fn=d~+
6449rp='Pathname for the site-specific library files?'
6450. ./getfile
6451prefixvar=sitelib
6452. ./setprefixvar
6453sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6454
6455: Determine list of previous versions to include in @INC
6456$cat > getverlist <<EOPL
6457#!$perl5 -w
6458use File::Basename;
6459\$api_versionstring = "$api_versionstring";
6460\$version = "$version";
6461\$stem = "$sitelib_stem";
6462\$archname = "$archname";
6463EOPL
6464 $cat >> getverlist <<'EOPL'
13cfc98d
MB
6465# The list found is store twice for each entry: the original name, and
6466# the binary broken down version as pack "sss", so sorting is easy and
6467# unambiguous. This will work for all versions that have a maximum of
6468# three digit groups, separate by '.'s or '_'s. Names are extended with
6469# ".0.0" to ensure at least three elements for the pack.
6470# -- H.Merijn Brand (m)'06 23-10-2006
6471
f3f1a2d8
MB
6472# Can't have leading @ because metaconfig interprets it as a command!
6473;@inc_version_list=();
6474# XXX Redo to do opendir/readdir?
6475if (-d $stem) {
6476 chdir($stem);
13cfc98d
MB
6477 ;@candidates = map {
6478 [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
a71f1801 6479 ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
f3f1a2d8
MB
6480}
6481else {
6482 ;@candidates = ();
6483}
6484
13cfc98d
MB
6485($pversion, $aversion, $vsn5005) = map {
6486 pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
f3f1a2d8 6487foreach $d (@candidates) {
13cfc98d
MB
6488 if ($d->[1] lt $pversion) {
6489 if ($d->[1] ge $aversion) {
6490 unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
f3f1a2d8 6491 }
13cfc98d
MB
6492 elsif ($d->[1] ge $vsn5005) {
6493 unshift(@inc_version_list, grep { -d } $d->[0]);
f3f1a2d8
MB
6494 }
6495 }
6496 else {
6497 # Skip newer version. I.e. don't look in
6498 # 5.7.0 if we're installing 5.6.1.
6499 }
6500}
6501
6502if (@inc_version_list) {
6503 print join(' ', @inc_version_list);
6504}
6505else {
6506 # Blank space to preserve value for next Configure run.
6507 print " ";
6508}
6509EOPL
6510chmod +x getverlist
6511case "$inc_version_list" in
6512'') if test -x "$perl5$exe_ext"; then
6513 dflt=`$perl5 getverlist`
6514 else
6515 dflt='none'
6516 fi
6517 ;;
6518$undef) dflt='none' ;;
6519*) eval dflt=\"$inc_version_list\" ;;
6520esac
6521case "$dflt" in
6522''|' ') dflt=none ;;
6523esac
6524case "$dflt" in
65255.005) dflt=none ;;
6526esac
6527$cat <<EOM
6528
6529In order to ease the process of upgrading, this version of perl
6530can be configured to use modules built and installed with earlier
6531versions of perl that were installed under $prefix. Specify here
6532the list of earlier versions that this version of perl should check.
6533If Configure detected no earlier versions of perl installed under
6534$prefix, then the list will be empty. Answer 'none' to tell perl
6535to not search earlier versions.
b4eb6b3d 6536
f3f1a2d8
MB
6537The default should almost always be sensible, so if you're not sure,
6538just accept the default.
b4eb6b3d 6539EOM
f3f1a2d8
MB
6540
6541rp='List of earlier versions to include in @INC?'
6542. ./myread
6543case "$ans" in
6544[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6545*) inc_version_list="$ans" ;;
6546esac
6547case "$inc_version_list" in
6548''|' ')
6549 inc_version_list_init='0'
6550 d_inc_version_list="$undef"
6551 ;;
6552*) inc_version_list_init=`echo $inc_version_list |
6553 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6554 d_inc_version_list="$define"
b4eb6b3d
JH
6555 ;;
6556esac
f3f1a2d8 6557$rm -f getverlist
b4eb6b3d 6558
1cd66f7c
DD
6559: see if malloc/malloc.h has to be included
6560set malloc/malloc.h i_mallocmalloc
6561eval $inhdr
6562
b4eb6b3d 6563: see if this is a malloc.h system
01d07975
YST
6564: we want a real compile instead of Inhdr because some systems have a
6565: malloc.h that just gives a compile error saying to use stdlib.h instead
6566echo " "
6567$cat >try.c <<EOCP
6568#include <stdlib.h>
6569#include <malloc.h>
f25eda10 6570#$i_mallocmalloc I_MALLOCMALLOC
1cd66f7c
DD
6571#ifdef I_MALLOCMALLOC
6572# include <malloc/malloc.h>
6573#endif
6574
01d07975
YST
6575int main () { return 0; }
6576EOCP
6577set try
6578if eval $compile; then
6579 echo "<malloc.h> found." >&4
6580 val="$define"
6581else
6582 echo "<malloc.h> NOT found." >&4
6583 val="$undef"
6584fi
5b813a60 6585$rm_try
01d07975
YST
6586set i_malloc
6587eval $setvar
b4eb6b3d 6588
c8b93cf9
JH
6589: check for void type
6590echo " "
6591echo "Checking to see how well your C compiler groks the void type..." >&4
6592case "$voidflags" in
6593'')
c727eafa 6594 $cat >try.c <<EOCP
d1daaddf
JH
6595#$i_stdlib I_STDLIB
6596#ifdef I_STDLIB
6597#include <stdlib.h>
6598#endif
c8b93cf9
JH
6599#if TRY & 1
6600void sub() {
6601#else
6602sub() {
6603#endif
6604 extern void moo(); /* function returning void */
6605 void (*goo)(); /* ptr to func returning void */
6606#if TRY & 8
6607 void *hue; /* generic ptr */
6608#endif
6609#if TRY & 2
6610 void (*foo[10])();
6611#endif
6612
6613#if TRY & 4
6614 if(goo == moo) {
6615 exit(0);
6616 }
6617#endif
6618 exit(0);
6619}
6620int main() { sub(); }
6621EOCP
6622 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6623 voidflags=$defvoidused
6624 echo "Good. It appears to support void to the level $package wants.">&4
6625 if $contains warning .out >/dev/null 2>&1; then
6626 echo "However, you might get some warnings that look like this:"
6627 $cat .out
6628 fi
6629 else
6630echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6631 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6632 echo "It supports 1..."
6633 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6634 echo "It also supports 2..."
6635 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6636 voidflags=7
6637 echo "And it supports 4 but not 8 definitely."
6638 else
6639 echo "It doesn't support 4..."
6640 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6641 voidflags=11
6642 echo "But it supports 8."
6643 else
6644 voidflags=3
6645 echo "Neither does it support 8."
6646 fi
6647 fi
6648 else
6649 echo "It does not support 2..."
6650 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6651 voidflags=13
6652 echo "But it supports 4 and 8."
6653 else
6654 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6655 voidflags=5
6656 echo "And it supports 4 but has not heard about 8."
6657 else
6658 echo "However it supports 8 but not 4."
6659 fi
6660 fi
6661 fi
6662 else
6663 echo "There is no support at all for void."
6664 voidflags=0
6665 fi
6666 fi
6667esac
6668case "$voidflags" in
6669"$defvoidused") ;;
6670*) $cat >&4 <<'EOM'
6671 Support flag bits are:
6672 1: basic void declarations.
6673 2: arrays of pointers to functions returning void.
6674 4: operations between pointers to and addresses of void functions.
6675 8: generic void pointers.
6676EOM
6677 dflt="$voidflags";
6678 rp="Your void support flags add up to what?"
6679 . ./myread
6680 voidflags="$ans"
6681 ;;
6682esac
5b813a60 6683$rm_try
c8b93cf9
JH
6684
6685: check for length of pointer
6686echo " "
6687case "$ptrsize" in
6688'')
6689 echo "Checking to see how big your pointers are..." >&4
6690 if test "$voidflags" -gt 7; then
6691 echo '#define VOID_PTR char *' > try.c
6692 else
6693 echo '#define VOID_PTR void *' > try.c
6694 fi
74d00865 6695 $cat >>try.c <<EOCP
c8b93cf9 6696#include <stdio.h>
d1daaddf
JH
6697#$i_stdlib I_STDLIB
6698#ifdef I_STDLIB
6699#include <stdlib.h>
6700#endif
c8b93cf9
JH
6701int main()
6702{
6703 printf("%d\n", (int)sizeof(VOID_PTR));
6704 exit(0);
6705}
6706EOCP
6707 set try
6708 if eval $compile_ok; then
6709 ptrsize=`$run ./try`
6710 echo "Your pointers are $ptrsize bytes long."
6711 else
6712 dflt='4'
6713 echo "(I can't seem to compile the test program. Guessing...)" >&4
6714 rp="What is the size of a pointer (in bytes)?"
6715 . ./myread
6716 ptrsize="$ans"
6717 fi
6718 ;;
6719esac
5b813a60 6720$rm_try
c8b93cf9
JH
6721case "$use64bitall" in
6722"$define"|true|[yY]*)
6723 case "$ptrsize" in
6724 4) cat <<EOM >&4
6725
1911a026
JH
6726*** You have chosen a maximally 64-bit build,
6727*** but your pointers are only 4 bytes wide.
09b58c7b
JH
6728*** Please rerun Configure without -Duse64bitall.
6729EOM
6730 case "$d_quad" in
6731 define)
6732 cat <<EOM >&4
6733*** Since you have quads, you could possibly try with -Duse64bitint.
6734EOM
6735 ;;
6736 esac
6737 cat <<EOM >&4
1911a026 6738*** Cannot continue, aborting.
c8b93cf9
JH
6739
6740EOM
09b58c7b 6741
1911a026 6742 exit 1
c8b93cf9
JH
6743 ;;
6744 esac
6745 ;;
6746esac
6747
19a100ff 6748
9df442c2
NC
6749: determine whether to use malloc wrapping
6750echo " "
6751case "$usemallocwrap" in
6752[yY]*|true|$define) dflt='y' ;;
6753[nN]*|false|$undef) dflt='n' ;;
6754*) case "$usedevel" in
6755 [yY]*|true|$define) dflt='y' ;;
6756 *) dflt='n' ;;
6757 esac
6758 ;;
6759esac
6760rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6761. ./myread
6762usemallocwrap="$ans"
6763case "$ans" in
6764y*|true)
6765 usemallocwrap="$define" ;;
6766*)
6767 usemallocwrap="$undef" ;;
6768esac
c8b93cf9 6769
b4eb6b3d
JH
6770: determine which malloc to compile in
6771echo " "
6772case "$usemymalloc" in
c4163172
JH
6773[yY]*|true|$define) dflt='y' ;;
6774[nN]*|false|$undef) dflt='n' ;;
6775*) case "$ptrsize" in
6776 4) dflt='y' ;;
6777 *) dflt='n' ;;
6778 esac
d9298c1a 6779 if test "$useithreads" = "$define"; then dflt='n'; fi
c4163172 6780 ;;
8dfa8df9 6781esac
b4eb6b3d
JH
6782rp="Do you wish to attempt to use the malloc that comes with $package?"
6783. ./myread
6784usemymalloc="$ans"
6785case "$ans" in
6786y*|true)
6787 usemymalloc='y'
6788 mallocsrc='malloc.c'
6789 mallocobj="malloc$_o"
6790 d_mymalloc="$define"
6791 case "$libs" in
6792 *-lmalloc*)
6793 : Remove malloc from list of libraries to use
6794 echo "Removing unneeded -lmalloc from library list" >&4
6795 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6796 shift
6797 libs="$*"
6798 echo "libs = $libs" >&4
6799 ;;
6800 esac
6801 ;;
6802*)
6803 usemymalloc='n'
6804 mallocsrc=''
6805 mallocobj=''
6806 d_mymalloc="$undef"
6807 ;;
6808esac
6809
6810: compute the return types of malloc and free
6811echo " "
6812$cat >malloc.c <<END
6813#$i_malloc I_MALLOC
6814#$i_stdlib I_STDLIB
6815#include <stdio.h>
6816#include <sys/types.h>
6817#ifdef I_MALLOC
6818#include <malloc.h>
6819#endif
6820#ifdef I_STDLIB
6821#include <stdlib.h>
6822#endif
6823#ifdef TRY_MALLOC
6824void *malloc();
6825#endif
6826#ifdef TRY_FREE
6827void free();
6828#endif
6829END
6830case "$malloctype" in
6831'')
6832 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6833 malloctype='void *'
6834 else
6835 malloctype='char *'
6836 fi
6837 ;;
6838esac
6839echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6840
6841case "$freetype" in
6842'')
6843 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6844 freetype='void'
6845 else
6846 freetype='int'
6847 fi
6848 ;;
6849esac
6850echo "Your system uses $freetype free(), it would seem." >&4
6851$rm -f malloc.[co]
b4eb6b3d
JH
6852: determine where site specific architecture-dependent libraries go.
6853: sitelib default is /usr/local/lib/perl5/site_perl/$version
6854: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6855: sitelib may have an optional trailing /share.
6856case "$sitearch" in
6857'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6858 dflt="$dflt/$archname"
6859 ;;
6860*) dflt="$sitearch"
6861 ;;
6862esac
6863set sitearch sitearch none
6864eval $prefixit
6865$cat <<EOM
6866
6867The installation process will also create a directory for
6868architecture-dependent site-specific extensions and modules.
6869
6870EOM
6871fn=d~+
6872rp='Pathname for the site-specific architecture-dependent library files?'
6873. ./getfile
79522dd2
NC
6874prefixvar=sitearch
6875. ./setprefixvar
c95d0e17
GA
6876if $test X"$sitearch" = X"$sitelib"; then
6877 d_sitearch="$undef"
6878else
6879 d_sitearch="$define"
6880fi
b4eb6b3d 6881
613d6c3e 6882: Set the vendorprefix variables
b4eb6b3d
JH
6883$cat <<EOM
6884
6885The installation process will also create a directory for
6886vendor-supplied add-ons. Vendors who supply perl with their system
6887may find it convenient to place all vendor-supplied files in this
6888directory rather than in the main distribution directory. This will
6889ease upgrades between binary-compatible maintenance versions of perl.
6890
6891Of course you may also use these directories in whatever way you see
6892fit. For example, you might use them to access modules shared over a
6893company-wide network.
6894
6895The default answer should be fine for most people.
6896This causes further questions about vendor add-ons to be skipped
6897and no vendor-specific directories will be configured for perl.
6898
6899EOM
6900rp='Do you want to configure vendor-specific add-on directories?'
6901case "$usevendorprefix" in
6902define|true|[yY]*) dflt=y ;;
6903*) : User may have set vendorprefix directly on Configure command line.
6904 case "$vendorprefix" in
6905 ''|' ') dflt=n ;;
6906 *) dflt=y ;;
6907 esac
6908 ;;
6909esac
6910. ./myread
6911case "$ans" in
6912[yY]*) fn=d~+
6913 rp='Installation prefix to use for vendor-supplied add-ons?'
6914 case "$vendorprefix" in
6915 '') dflt='' ;;
6916 *) dflt=$vendorprefix ;;
6917 esac
6918 . ./getfile
6919 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6920 oldvendorprefix=''
6921 case "$vendorprefix" in
6922 '') ;;
6923 *) case "$ans" in
6924 "$prefix") ;;
6925 *) oldvendorprefix="$prefix";;
6926 esac
6927 ;;
6928 esac
6929 usevendorprefix="$define"
6930 vendorprefix="$ans"
6931 vendorprefixexp="$ansexp"
6932 ;;
6933*) usevendorprefix="$undef"
6934 vendorprefix=''
6935 vendorprefixexp=''
6936 ;;
6937esac
6938
613d6c3e 6939: Set the vendorlib variables
b4eb6b3d
JH
6940case "$vendorprefix" in
6941'') d_vendorlib="$undef"
6942 vendorlib=''
6943 vendorlibexp=''
6944 ;;
6945*) d_vendorlib="$define"
6946 : determine where vendor-supplied modules go.
6947 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6948 case "$vendorlib" in
6949 '')
6950 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6951 case "$installstyle" in
6952 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6953 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6954 esac
6955 ;;
6956 *) dflt="$vendorlib"
6957 ;;
6958 esac
6959 fn=d~+
6960 rp='Pathname for the vendor-supplied library files?'
6961 . ./getfile
6962 vendorlib="$ans"
6963 vendorlibexp="$ansexp"
6964 ;;
6965esac
6966vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
a092d240
NC
6967prefixvar=vendorlib
6968. ./installprefix
b4eb6b3d 6969
613d6c3e 6970: Set the vendorarch variables
b4eb6b3d
JH
6971case "$vendorprefix" in
6972'') d_vendorarch="$undef"
6973 vendorarch=''
6974 vendorarchexp=''
6975 ;;
6976*) d_vendorarch="$define"
6977 : determine where vendor-supplied architecture-dependent libraries go.
6978 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6979 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6980 : vendorlib may have an optional trailing /share.
6981 case "$vendorarch" in
6982 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6983 dflt="$dflt/$archname"
6984 ;;
6985 *) dflt="$vendorarch" ;;
6986 esac
6987 fn=d~+
6988 rp='Pathname for vendor-supplied architecture-dependent files?'
6989 . ./getfile
6990 vendorarch="$ans"
6991 vendorarchexp="$ansexp"
6992 ;;
6993esac
a092d240
NC
6994prefixvar=vendorarch
6995. ./installprefix
1be1b388
MB
6996if $test X"$vendorarch" = X"$vendorlib"; then
6997 d_vendorarch="$undef"
6998else
6999 d_vendorarch="$define"
7000fi
b4eb6b3d
JH
7001
7002: Final catch-all directories to search
7003$cat <<EOM
7004
7005Lastly, you can have perl look in other directories for extensions and
7006modules in addition to those already specified.
7007These directories will be searched after
7008 $sitearch
7009 $sitelib
7010EOM
7011test X"$vendorlib" != "X" && echo ' ' $vendorlib
7012test X"$vendorarch" != "X" && echo ' ' $vendorarch
7013echo ' '
7014case "$otherlibdirs" in
7015''|' ') dflt='none' ;;
7016*) dflt="$otherlibdirs" ;;
7017esac
7018$cat <<EOM
7019Enter a colon-separated set of extra paths to include in perl's @INC
7020search path, or enter 'none' for no extra paths.
7021
7022EOM
7023
7024rp='Colon-separated list of additional directories for perl to search?'
7025. ./myread
7026case "$ans" in
7027' '|''|none) otherlibdirs=' ' ;;
7028*) otherlibdirs="$ans" ;;
7029esac
7030case "$otherlibdirs" in
7031' ') val=$undef ;;
7032*) val=$define ;;
7033esac
7034set d_perl_otherlibdirs
7035eval $setvar
7036
7037: Cruising for prototypes
7038echo " "
7039echo "Checking out function prototypes..." >&4
55954f19
JH
7040$cat >prototype.c <<EOCP
7041#$i_stdlib I_STDLIB
7042#ifdef I_STDLIB
7043#include <stdlib.h>
7044#endif
b4eb6b3d
JH
7045int main(int argc, char *argv[]) {
7046 exit(0);}
7047EOCP
7048if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7049 echo "Your C compiler appears to support function prototypes."
7050 val="$define"
7051else
7052 echo "Your C compiler doesn't seem to understand function prototypes."
7053 val="$undef"
7054fi
7055set prototype
7056eval $setvar
7057$rm -f prototype*
7058
613d6c3e 7059: Check if ansi2knr is required
b4eb6b3d
JH
7060case "$prototype" in
7061"$define") ;;
7062*) ansi2knr='ansi2knr'
7063 echo " "
7064 cat <<EOM >&4
7065
7066$me: FATAL ERROR:
7067This version of $package can only be compiled by a compiler that
7068understands function prototypes. Unfortunately, your C compiler
7069 $cc $ccflags
7070doesn't seem to understand them. Sorry about that.
7071
7072If GNU cc is available for your system, perhaps you could try that instead.
7073
7074Eventually, we hope to support building Perl with pre-ANSI compilers.
7075If you would like to help in that effort, please contact <perlbug@perl.org>.
7076
7077Aborting Configure now.
7078EOM
7079 exit 2
7080 ;;
7081esac
7082
34f1896b
MB
7083: DTrace support
7084dflt_dtrace='/usr/sbin/dtrace'
6e3b7bfa
MB
7085$test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7086
34f1896b
MB
7087cat <<EOM
7088
7089Perl can be built to support DTrace on platforms that support it.
7090DTrace is a diagnosis and performance analysis tool from Sun.
7091
7092If this doesn't make any sense to you, just accept the default '$dflt'.
7093EOM
7094
7095while $test 1 ; do
7096 case "$usedtrace" in
7097 $define|true|[yY]*)
7098 dflt='y'
7099 ;;
7100 ?*)
7101 dflt='y'
7102 dflt_dtrace=$usedtrace
7103 ;;
7104 *)
7105 dflt='n'
7106 ;;
7107 esac
7108
7109 rp='Support DTrace if available?'
7110 . ./myread
7111 case "$ans" in
7112 y|Y) val="$define" ;;
7113 *) val="$undef" ;;
7114 esac
7115 set usedtrace
7116 eval $setvar
7117
7118 test "X$usedtrace" != "X$define" && break
7119
7120 echo " "
7121 rp='Where is the dtrace executable?'
7122 dflt=$dflt_dtrace
7123 . ./getfile
7124 val="$ans"
7125 set dtrace
7126 eval $setvar
7127
7128 if $test -f $dtrace
7129 then
7130 if $dtrace -h -s ../perldtrace.d \
7131 -o perldtrace.tmp >/dev/null 2>&1 \
7132 && rm -f perldtrace.tmp
7133 then
7134 echo " "
7135 echo "Good: your $dtrace knows about the -h flag."
7136 else
7137 cat >&2 <<EOM
7138
7139*** $me: Fatal Error: $dtrace doesn't support -h flag
7140***
7141*** Your installed dtrace doesn't support the -h switch to compile a D
7142*** program into a C header. Can't continue.
7143
7144EOM
7145 exit 1
7146 fi
7147 break;
7148 fi
7149
7150 case "$fastread" in
7151 yes)
7152 cat >&2 <<EOM
7153
7154*** $me: Fatal Error: $dtrace not found.
7155*** Can't continue.
7156
7157EOM
7158 exit 1
7159 ;;
7160 *)
7161 echo "*** $dtrace was not found."
7162 echo " "
7163 ;;
7164 esac
7165done
7166
613d6c3e 7167: See if we want extra modules installed
6fcddf3b 7168echo " "
6fcddf3b 7169case "$extras" in
bf35c3f6
JH
7170'') dflt='n';;
7171*) dflt='y';;
6fcddf3b
JH
7172esac
7173cat <<EOM
7174Perl can be built with extra modules or bundles of modules which
7175will be fetched from the CPAN and installed alongside Perl.
7176
7177Notice that you will need access to the CPAN; either via the Internet,
7178or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
7179be asked later to configure the CPAN.pm module which will in turn do
7180the installation of the rest of the extra modules or bundles.)
7181
7182Notice also that if the modules require any external software such as
dd2de242
JH
7183libraries and headers (the libz library and the zlib.h header for the
7184Compress::Zlib module, for example) you MUST have any such software
7185already installed, this configuration process will NOT install such
7186things for you.
6fcddf3b
JH
7187
7188If this doesn't make any sense to you, just accept the default '$dflt'.
7189EOM
dd2de242 7190rp='Install any extra modules (y or n)?'
6fcddf3b
JH
7191. ./myread
7192case "$ans" in
7193y|Y)
7194 cat <<EOM
7195
7196Please list any extra modules or bundles to be installed from CPAN,
7197with spaces between the names. The names can be in any format the
dd2de242
JH
7198'install' command of CPAN.pm will understand. (Answer 'none',
7199without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
7200EOM
7201 rp='Extras?'
7202 dflt="$extras"
7203 . ./myread
7204 extras="$ans"
7205esac
7206case "$extras" in
7207''|'none')
7208 val=''
7209 $rm -f ../extras.lst
7210 ;;
7211*) echo "(Saving the list of extras for later...)"
dd2de242
JH
7212 echo "$extras" > ../extras.lst
7213 val="'$extras'"
6fcddf3b
JH
7214 ;;
7215esac
7216set extras
7217eval $setvar
7218echo " "
7219
6e1038e0
MB
7220: determine where html pages for programs go
7221set html1dir html1dir none
7222eval $prefixit
7223$cat <<EOM
7224
f3f1a2d8 7225If you wish to install html files for programs in $spackage, indicate
6e1038e0
MB
7226the appropriate directory here. To skip installing html files,
7227answer "none".
7228EOM
7229case "$html1dir" in
7230''|none|$undef|' ') dflt=none ;;
7231*) dflt=$html1dir ;;
7232esac
7233fn=dn+~
7234rp="Directory for the main $spackage html pages?"
7235. ./getfile
79522dd2
NC
7236prefixvar=html1dir
7237. ./setprefixvar
6e1038e0
MB
7238: Use ' ' for none so value is preserved next time through Configure
7239$test X"$html1dir" = "X" && html1dir=' '
6e1038e0
MB
7240
7241: determine where html pages for libraries and modules go
7242set html3dir html3dir none
7243eval $prefixit
7244$cat <<EOM
7245
7246If you wish to install html files for modules associated with $spackage,
7247indicate the appropriate directory here. To skip installing html files,
7248answer "none".
7249EOM
7250: There is no obvious default. If they have specified html1dir, then
7251: try to key off that, possibly changing .../html1 into .../html3.
7252case "$html3dir" in
7253'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7254*) dflt=$html3dir ;;
7255esac
7256fn=dn+~
7257rp="Directory for the $spackage module html pages?"
7258. ./getfile
79522dd2
NC
7259prefixvar=html3dir
7260. ./setprefixvar
6e1038e0
MB
7261: Use ' ' for none so value is preserved next time through Configure
7262$test X"$html3dir" = "X" && html3dir=' '
6e1038e0 7263
89ce900e
JH
7264: determine whether to install perl also as /usr/bin/perl
7265
7266echo " "
7267if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7268 $cat <<EOM
7269Many scripts expect perl to be installed as /usr/bin/perl.
7270
7271If you want to, I can install the perl you are about to compile
7272as /usr/bin/perl (in addition to $bin/perl).
7273EOM
7274 if test -f /usr/bin/perl; then
7275 $cat <<EOM
7276
7277However, please note that because you already have a /usr/bin/perl,
7278overwriting that with a new Perl would very probably cause problems.
7279Therefore I'm assuming you don't want to do that (unless you insist).
7280
7281EOM
7282 case "$installusrbinperl" in
7283 "$define"|[yY]*) dflt='y';;
7284 *) dflt='n';;
7285 esac
7286 else
7287 $cat <<EOM
7288
7289Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7290
7291EOM
7292 case "$installusrbinperl" in
7293 "$undef"|[nN]*) dflt='n';;
7294 *) dflt='y';;
7295 esac
7296 fi
7297 rp="Do you want to install perl as /usr/bin/perl?"
7298 . ./myread
7299 case "$ans" in
7300 [yY]*) val="$define";;
7301 *) val="$undef" ;;
7302 esac
7303else
7304 val="$undef"
7305fi
7306set installusrbinperl
7307eval $setvar
7308
613d6c3e 7309: Check if we are using the GNU C library
89ce900e
JH
7310echo " "
7311echo "Checking for GNU C Library..." >&4
7312cat >try.c <<'EOCP'
7313/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7314 alone are insufficient to distinguish different versions, such as
7315 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7316 libc version 2.1.0. A. Dougherty, June 3, 2002.
7317*/
7318#include <stdio.h>
7319int main(void)
7320{
7321#ifdef __GLIBC__
7322# ifdef __GLIBC_MINOR__
4fb7dc7d 7323# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
89ce900e
JH
7324# include <gnu/libc-version.h>
7325 printf("%s\n", gnu_get_libc_version());
7326# else
7327 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7328# endif
7329# else
7330 printf("%d\n", __GLIBC__);
7331# endif
7332 return 0;
7333#else
7334 return 1;
7335#endif
7336}
7337EOCP
7338set try
7339if eval $compile_ok && $run ./try > glibc.ver; then
7340 val="$define"
7341 gnulibc_version=`$cat glibc.ver`
7342 echo "You are using the GNU C Library version $gnulibc_version"
7343else
7344 val="$undef"
7345 gnulibc_version=''
7346 echo "You are not using the GNU C Library"
7347fi
5b813a60 7348$rm_try glibc.ver
89ce900e
JH
7349set d_gnulibc
7350eval $setvar
7351
7352: see if nm is to be used to determine whether a symbol is defined or not
7353case "$usenm" in
7354'')
7355 dflt=''
7356 case "$d_gnulibc" in
7357 "$define")
7358 echo " "
7359 echo "nm probably won't work on the GNU C Library." >&4
7360 dflt=n
7361 ;;
7362 esac
7363 case "$dflt" in
7364 '')
7365 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7366 echo " "
7367 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7368 echo "'nm' won't be sufficient on this sytem." >&4
7369 dflt=n
7370 fi
7371 ;;
7372 esac
7373 case "$dflt" in
7374 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7375 if $test $dflt -gt 20; then
7376 dflt=y
7377 else
7378 dflt=n
7379 fi
7380 ;;
7381 esac
b4eb6b3d 7382 ;;
89ce900e
JH
7383*)
7384 case "$usenm" in
7385 true|$define) dflt=y;;
7386 *) dflt=n;;
7387 esac
b4eb6b3d
JH
7388 ;;
7389esac
89ce900e 7390$cat <<EOM
b4eb6b3d 7391
89ce900e
JH
7392I can use $nm to extract the symbols from your C libraries. This
7393is a time consuming task which may generate huge output on the disk (up
7394to 3 megabytes) but that should make the symbols extraction faster. The
7395alternative is to skip the 'nm' extraction part and to compile a small
7396test program instead to determine whether each symbol is present. If
7397you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7398this may be the best solution.
b4eb6b3d 7399
89ce900e 7400You probably shouldn't let me use 'nm' if you are using the GNU C Library.
b4eb6b3d 7401
89ce900e
JH
7402EOM
7403rp="Shall I use $nm to extract C symbols from the libraries?"
7404. ./myread
7405case "$ans" in
7406[Nn]*) usenm=false;;
7407*) usenm=true;;
b4eb6b3d 7408esac
89ce900e
JH
7409
7410runnm=$usenm
7411case "$reuseval" in
7412true) runnm=false;;
b4eb6b3d 7413esac
b4eb6b3d 7414
89ce900e
JH
7415: nm options which may be necessary
7416case "$nm_opt" in
7417'') if $test -f /mach_boot; then
7418 nm_opt='' # Mach
7419 elif $test -d /usr/ccs/lib; then
7420 nm_opt='-p' # Solaris (and SunOS?)
7421 elif $test -f /dgux; then
7422 nm_opt='-p' # DG-UX
7423 elif $test -f /lib64/rld; then
7424 nm_opt='-p' # 64-bit Irix
7425 else
7426 nm_opt=''
7427 fi;;
7428esac
b4eb6b3d 7429
89ce900e
JH
7430: nm options which may be necessary for shared libraries but illegal
7431: for archive libraries. Thank you, Linux.
7432case "$nm_so_opt" in
7433'') case "$myuname" in
fb2e1bc0 7434 *linux*|gnu*)
89ce900e
JH
7435 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7436 nm_so_opt='--dynamic'
7437 fi
7438 ;;
7439 esac
7440 ;;
7441esac
b4eb6b3d 7442
1d8eaf8c 7443: Figure out where the libc is located
89ce900e
JH
7444case "$runnm" in
7445true)
1d8eaf8c 7446: get list of predefined functions in a handy place
89ce900e
JH
7447echo " "
7448case "$libc" in
7449'') libc=unknown
7450 case "$libs" in
7451 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7452 esac
7453 ;;
b4eb6b3d 7454esac
89ce900e
JH
7455case "$libs" in
7456'') ;;
7457*) for thislib in $libs; do
7458 case "$thislib" in
7459 -lc|-lc_s)
7460 : Handle C library specially below.
7461 ;;
7462 -l*)
7463 thislib=`echo $thislib | $sed -e 's/^-l//'`
7464 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7465 :
7466 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7467 :
7468 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7469 :
7470 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7471 :
7472 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7473 :
7474 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7475 :
7476 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7477 :
7478 else
7479 try=''
7480 fi
7481 libnames="$libnames $try"
7482 ;;
7483 *) libnames="$libnames $thislib" ;;
7484 esac
7485 done
b4eb6b3d
JH
7486 ;;
7487esac
89ce900e
JH
7488xxx=normal
7489case "$libc" in
7490unknown)
7491 set /lib/libc.$so
7492 for xxx in $libpth; do
7493 $test -r $1 || set $xxx/libc.$so
7494 : The messy sed command sorts on library version numbers.
7495 $test -r $1 || \
7496 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7497 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7498 h
7499 s/[0-9][0-9]*/0000&/g
7500 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7501 G
7502 s/\n/ /' | \
7503 $sort | $sed -e 's/^.* //'`
7504 eval set \$$#
7505 done
7506 $test -r $1 || set /usr/ccs/lib/libc.$so
7507 $test -r $1 || set /lib/libsys_s$_a
7508 ;;
7509*)
7510 set blurfl
7511 ;;
7512esac
7513if $test -r "$1"; then
7514 echo "Your (shared) C library seems to be in $1."
7515 libc="$1"
7516elif $test -r /lib/libc && $test -r /lib/clib; then
7517 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7518 xxx=apollo
7519 libc='/lib/clib /lib/libc'
7520 if $test -r /lib/syslib; then
7521 echo "(Your math library is in /lib/syslib.)"
7522 libc="$libc /lib/syslib"
7523 fi
7524elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7525 echo "Your C library seems to be in $libc, as you said before."
7526elif $test -r $incpath/usr/lib/libc$_a; then
7527 libc=$incpath/usr/lib/libc$_a;
7528 echo "Your C library seems to be in $libc. That's fine."
7529elif $test -r /lib/libc$_a; then
7530 libc=/lib/libc$_a;
7531 echo "Your C library seems to be in $libc. You're normal."
7532else
7533 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7534 :
7535 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7536 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7537 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7538 :
7539 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7540 :
7541 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7542 :
7543 else
7544 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7545 fi
7546 if $test -r "$tans"; then
7547 echo "Your C library seems to be in $tans, of all places."
7548 libc=$tans
7549 else
7550 libc='blurfl'
7551 fi
7552fi
7553if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7554 dflt="$libc"
7555 cat <<EOM
b4eb6b3d 7556
89ce900e
JH
7557If the guess above is wrong (which it might be if you're using a strange
7558compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7559
89ce900e
JH
7560EOM
7561else
7562 dflt=''
7563 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7564 cat >&4 <<EOM
7565I can't seem to find your C library. I've looked in the following places:
5e366f65 7566
b4eb6b3d 7567EOM
89ce900e
JH
7568 $sed 's/^/ /' libpath
7569 cat <<EOM
5e366f65 7570
89ce900e 7571None of these seems to contain your C library. I need to get its name...
5e366f65
JH
7572
7573EOM
89ce900e
JH
7574fi
7575fn=f
7576rp='Where is your C library?'
7577. ./getfile
7578libc="$ans"
5e366f65 7579
89ce900e
JH
7580echo " "
7581echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7582set X `cat libnames`
7583shift
7584xxx=files
7585case $# in 1) xxx=file; esac
7586echo "Extracting names from the following $xxx for later perusal:" >&4
7587echo " "
7588$sed 's/^/ /' libnames >&4
7589echo " "
7590$echo $n "This may take a while...$c" >&4
5e366f65 7591
89ce900e
JH
7592for file in $*; do
7593 case $file in
7594 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7595 *) $nm $nm_opt $file 2>/dev/null;;
b4eb6b3d 7596 esac
89ce900e
JH
7597done >libc.tmp
7598
7599$echo $n ".$c"
7600$grep fprintf libc.tmp > libc.ptf
7601xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7602xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
9e08e8f0 7603xxx='[ADTSIWi]'
ab900c53 7604if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
89ce900e
JH
7605 eval $xscan;\
7606 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7607 eval $xrun
7608elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7609 eval $xscan;\
7610 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7611 eval $xrun
7612elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7613 eval $xscan;\
7614 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7615 eval $xrun
7616elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7617 eval $xscan;\
7618 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7619 eval $xrun
7620elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7621 eval $xscan;\
7622 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7623 eval $xrun
7624elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7625 eval $xscan;\
7626 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7627 eval $xrun
7628elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7629 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7630 eval $xscan;\
7631 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7632 eval $xrun
7633elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7634 eval $xscan;\
7635 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7636 eval $xrun
7637elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7638 eval $xscan;\
7639 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7640 eval $xrun
7641elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7642 eval $xscan;\
7643 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7644 eval $xrun
7645elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7646 eval $xscan;\
7647 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7648 eval $xrun
7649elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7650 eval $xscan;\
7651 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7652 eval $xrun
7653elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7654 eval $xscan;\
7655 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7656 eval $xrun
7657elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7658 eval $xscan;\
7659 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7660 eval $xrun
b4eb6b3d 7661else
89ce900e
JH
7662 $nm -p $* 2>/dev/null >libc.tmp
7663 $grep fprintf libc.tmp > libc.ptf
7664 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7665 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7666 then
7667 nm_opt='-p'
7668 eval $xrun
7669 else
7670 echo " "
7671 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7672 com=''
1d8eaf8c
MB
7673 if $ar t $libc > libc.tmp && \
7674 $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7675 then
89ce900e
JH
7676 for thisname in $libnames $libc; do
7677 $ar t $thisname >>libc.tmp
7678 done
7679 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7680 echo "Ok." >&4
7681 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
89ce900e
JH
7682 for thisname in $libnames $libc; do
7683 $ar tv $thisname >>libc.tmp
89ce900e
JH
7684 emximp -o tmp.imp $thisname \
7685 2>/dev/null && \
7686 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7687 < tmp.imp >>libc.tmp
1d8eaf8c 7688 $rm -f tmp.imp
89ce900e
JH
7689 done
7690 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7691 echo "Ok." >&4
7692 else
7693 echo "$ar didn't seem to work right." >&4
7694 echo "Maybe this is a Cray...trying bld instead..." >&4
1d8eaf8c
MB
7695 if bld t $libc | \
7696 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7697 $test -s libc.list
89ce900e
JH
7698 then
7699 for thisname in $libnames; do
7700 bld t $libnames | \
7701 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7702 $ar t $thisname >>libc.tmp
7703 done
7704 echo "Ok." >&4
7705 else
7706 echo "That didn't work either. Giving up." >&4
7707 exit 1
7708 fi
7709 fi
7710 fi
b4eb6b3d 7711fi
89ce900e
JH
7712nm_extract="$com"
7713case "$PASE" in
7714define)
7715 echo " "
7716 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7717 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7718 ;;
7719*) if $test -f /lib/syscalls.exp; then
7720 echo " "
7721 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
1d8eaf8c
MB
7722 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' \
7723 /lib/syscalls.exp >>libc.list
89ce900e
JH
7724 fi
7725 ;;
7726esac
7727;;
7728esac
7729$rm -f libnames libpath
b4eb6b3d
JH
7730
7731: see if dld is available
7732set dld.h i_dld
7733eval $inhdr
7734
613d6c3e 7735: Check if we are using C++
43dddb59
MB
7736echo " "
7737echo "Checking for C++..." >&4
20e87299 7738$cat >try.c <<'EOCP'
43dddb59
MB
7739#include <stdio.h>
7740int main(void)
7741{
7742#ifdef __cplusplus
20e87299 7743 return 0;
43dddb59 7744#else
20e87299 7745 return 1;
43dddb59 7746#endif
43dddb59
MB
7747}
7748EOCP
7749set try
20e87299
AD
7750if eval $compile_ok && $run ./try; then
7751 val="$define"
43dddb59
MB
7752 echo "You are using a C++ compiler."
7753else
7754 val="$undef"
7755 echo "You are not using a C++ compiler."
7756fi
5b813a60 7757$rm_try cplusplus$$
43dddb59
MB
7758set d_cplusplus
7759eval $setvar
7760
89ce900e
JH
7761: is a C symbol defined?
7762csym='tlook=$1;
7763case "$3" in
373dfab3
JH
7764-v) tf=libc.tmp; tdc="";;
7765-a) tf=libc.tmp; tdc="[]";;
7766*) tlook="^$1\$"; tf=libc.list; tdc="()";;
89ce900e 7767esac;
61c26d18
MHM
7768case "$d_cplusplus" in
7769 $define) extern_C="extern \"C\"" ;;
7770 *) extern_C="extern" ;;
7771esac;
89ce900e
JH
7772tx=yes;
7773case "$reuseval-$4" in
7774true-) ;;
7775true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7776esac;
7777case "$tx" in
7778yes)
43dddb59 7779 tval=false;
5129fff4
JH
7780 if $test "$runnm" = true; then
7781 if $contains $tlook $tf >/dev/null 2>&1; then
ab900c53 7782 tval=true;
5129fff4 7783 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
9945eb56 7784 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7785 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
373dfab3 7786 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
5b813a60 7787 $rm_try;
89ce900e 7788 fi;
5129fff4 7789 else
9945eb56 7790 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7791 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
5b813a60 7792 $rm_try;
ab900c53
AB
7793 fi;
7794 ;;
89ce900e
JH
7795*)
7796 case "$tval" in
7797 $define) tval=true;;
7798 *) tval=false;;
ab900c53
AB
7799 esac;
7800 ;;
89ce900e
JH
7801esac;
7802eval "$2=$tval"'
7803
7804: define an is-in-libc? function
7805inlibc='echo " "; td=$define; tu=$undef;
7806sym=$1; var=$2; eval "was=\$$2";
7807tx=yes;
7808case "$reuseval$was" in
7809true) ;;
7810true*) tx=no;;
7811esac;
7812case "$tx" in
7813yes)
7814 set $sym tres -f;
7815 eval $csym;
7816 case "$tres" in
7817 true)
7818 echo "$sym() found." >&4;
7819 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7820 *)
7821 echo "$sym() NOT found." >&4;
7822 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7823 esac;;
7824*)
7825 case "$was" in
7826 $define) echo "$sym() found." >&4;;
7827 *) echo "$sym() NOT found." >&4;;
7828 esac;;
7829esac'
7830
b4eb6b3d
JH
7831: see if dlopen exists
7832xxx_runnm="$runnm"
666ea192 7833xxx_ccflags="$ccflags"
b4eb6b3d 7834runnm=false
666ea192
JH
7835: with g++ one needs -shared to get is-in-libc to work for dlopen
7836case "$gccversion" in
7837'') ;;
7838*) case "$d_cplusplus" in
7839 "$define") ccflags="$ccflags -shared" ;;
7840 esac
7841 ;;
7842esac
b4eb6b3d
JH
7843set dlopen d_dlopen
7844eval $inlibc
7845runnm="$xxx_runnm"
666ea192 7846ccflags="$xxx_ccflags"
b4eb6b3d 7847
4fb7dc7d
JH
7848: see if this is a unistd.h system
7849set unistd.h i_unistd
7850eval $inhdr
7851
b4eb6b3d
JH
7852: determine which dynamic loading, if any, to compile in
7853echo " "
7854dldir="ext/DynaLoader"
7855case "$usedl" in
7856$define|y|true)
7857 dflt='y'
7858 usedl="$define"
7859 ;;
7860$undef|n|false)
7861 dflt='n'
7862 usedl="$undef"
7863 ;;
5b813a60 7864*)
b4eb6b3d
JH
7865 dflt='n'
7866 case "$d_dlopen" in
7867 $define) dflt='y' ;;
7868 esac
7869 case "$i_dld" in
7870 $define) dflt='y' ;;
7871 esac
7872 : Does a dl_xxx.xs file exist for this operating system
7873 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7874 ;;
7875esac
7876rp="Do you wish to use dynamic loading?"
7877. ./myread
7878usedl="$ans"
f1ce3bf1 7879bin_ELF="$undef"
b4eb6b3d
JH
7880case "$ans" in
7881y*) usedl="$define"
7882 case "$dlsrc" in
7883 '')
7884 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7885 dflt="$dldir/dl_${osname}.xs"
7886 elif $test "$d_dlopen" = "$define" ; then
7887 dflt="$dldir/dl_dlopen.xs"
7888 elif $test "$i_dld" = "$define" ; then
7889 dflt="$dldir/dl_dld.xs"
7890 else
7891 dflt=''
7892 fi
7893 ;;
7894 *) dflt="$dldir/$dlsrc"
7895 ;;
7896 esac
7897 echo "The following dynamic loading files are available:"
7898 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7899 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7900 rp="Source file to use for dynamic loading"
7901 fn="fne"
7902 gfpth="$src"
7903 . ./getfile
7904 usedl="$define"
7905 : emulate basename
7906 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7907
7908 $cat << EOM
7909
7910Some systems may require passing special flags to $cc -c to
7911compile modules that will be used to create a shared library.
7912To use no flags, say "none".
7913
7914EOM
7915 case "$cccdlflags" in
7916 '') case "$gccversion" in
7917 '') case "$osname" in
7918 hpux) dflt='+z' ;;
7919 next) dflt='none' ;;
7920 irix*) dflt='-KPIC' ;;
48bcfe03 7921 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7922 sunos) dflt='-pic' ;;
7923 *) dflt='none' ;;
7924 esac
7925 ;;
7926 *) case "$osname" in
b6cc0f4c 7927 darwin) dflt='none' ;;
15fcae63 7928 linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7929 *) dflt='-fpic' ;;
7930 esac ;;
7931 esac ;;
7932 ' ') dflt='none' ;;
7933 *) dflt="$cccdlflags" ;;
7934 esac
7935 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7936 . ./myread
7937 case "$ans" in
7938 none) cccdlflags=' ' ;;
7939 *) cccdlflags="$ans" ;;
7940 esac
7941
7942 cat << EOM
7943
7944Some systems use ld to create libraries that can be dynamically loaded,
7945while other systems (such as those using ELF) use $cc.
7946
7947EOM
7948 case "$ld" in
55954f19 7949 '') $cat >try.c <<EOM
b4eb6b3d
JH
7950/* Test for whether ELF binaries are produced */
7951#include <fcntl.h>
55954f19
JH
7952#$i_stdlib I_STDLIB
7953#ifdef I_STDLIB
b4eb6b3d 7954#include <stdlib.h>
55954f19 7955#endif
4fb7dc7d
JH
7956#$i_unistd I_UNISTD
7957#ifdef I_UNISTD
7958#include <unistd.h>
7959#endif
b4eb6b3d
JH
7960int main() {
7961 char b[4];
7962 int i = open("a.out",O_RDONLY);
5b813a60 7963 if(i == -1)
b4eb6b3d
JH
7964 exit(1); /* fail */
7965 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7966 exit(0); /* succeed (yes, it's ELF) */
7967 else
7968 exit(1); /* fail */
7969}
7970EOM
5440bc8e 7971 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7972 cat <<EOM
7973You appear to have ELF support. I'll use $cc to build dynamic libraries.
7974EOM
7975 dflt="$cc"
f1ce3bf1 7976 bin_ELF="$define"
b4eb6b3d
JH
7977 else
7978 echo "I'll use ld to build dynamic libraries."
7979 dflt='ld'
7980 fi
5b813a60 7981 $rm_try
b4eb6b3d
JH
7982 ;;
7983 *) dflt="$ld"
7984 ;;
7985 esac
7986
7987 rp="What command should be used to create dynamic libraries?"
7988 . ./myread
7989 ld="$ans"
7990
7991 cat << EOM
7992
7993Some systems may require passing special flags to $ld to create a
7994library that can be dynamically loaded. If your ld flags include
7995-L/other/path options to locate libraries outside your loader's normal
7996search path, you may need to specify those -L options here as well. To
7997use no flags, say "none".
7998
7999EOM
8000 case "$lddlflags" in
8001 '') case "$osname" in
8002 beos) dflt='-nostart' ;;
df00ff3b 8003 haiku) dflt='-shared' ;;
b4eb6b3d
JH
8004 hpux) dflt='-b';
8005 case "$gccversion" in
8006 '') dflt="$dflt +vnocompatwarnings" ;;
8007 esac
5b813a60 8008 ;;
15fcae63 8009 linux|irix*|gnu*) dflt="-shared $optimize" ;;
b4eb6b3d
JH
8010 next) dflt='none' ;;
8011 solaris) dflt='-G' ;;
8012 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 8013 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
8014 *) dflt='none' ;;
8015 esac
8016 ;;
8017 *) dflt="$lddlflags" ;;
8018 esac
8019
8020 : Try to guess additional flags to pick up local libraries.
8021 : Be careful not to append to a plain 'none'
8022 case "$dflt" in
8023 none) dflt='' ;;
8024 esac
8025 for thisflag in $ldflags; do
8026 case "$thisflag" in
b5b9f165 8027 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
8028 case " $dflt " in
8029 *" $thisflag "*) ;;
8030 *) dflt="$dflt $thisflag" ;;
8031 esac
8032 ;;
8033 esac
8034 done
8035
8036 case "$dflt" in
8037 ''|' ') dflt='none' ;;
8038 esac
8039
8f68b0e6
AD
8040 case "$ldflags" in
8041 *-fstack-protector*)
8042 case "$dflt" in
8043 *-fstack-protector*) ;; # Don't add it again
8044 *) dflt="$dflt -fstack-protector" ;;
8045 esac
8046 ;;
8047 esac
8048
8049
b4eb6b3d
JH
8050 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8051 . ./myread
8052 case "$ans" in
8053 none) lddlflags=' ' ;;
8054 *) lddlflags="$ans" ;;
8055 esac
8056
8057 cat <<EOM
8058
8059Some systems may require passing special flags to $cc to indicate that
8060the resulting executable will use dynamic linking. To use no flags,
8061say "none".
8062
8063EOM
8064 case "$ccdlflags" in
8065 '') case "$osname" in
fb2e1bc0 8066 linux|hpux|gnu*) dflt='-Wl,-E' ;;
91fc0aa5
AH
8067 next|sunos) dflt='none' ;;
8068 *) dflt='none' ;;
b4eb6b3d
JH
8069 esac ;;
8070 ' ') dflt='none' ;;
8071 *) dflt="$ccdlflags" ;;
8072 esac
8073 rp="Any special flags to pass to $cc to use dynamic linking?"
8074 . ./myread
8075 case "$ans" in
8076 none) ccdlflags=' ' ;;
8077 *) ccdlflags="$ans" ;;
8078 esac
8079 ;;
8080*) usedl="$undef"
8081 ld='ld'
8082 dlsrc='dl_none.xs'
8083 lddlflags=''
8084 ccdlflags=''
8085 ;;
8086esac
8087
34f1896b 8088: Do we want a shared libperl?
b4eb6b3d
JH
8089also=''
8090case "$usedl" in
8091$undef)
8092 # No dynamic loading being used, so don't bother even to prompt.
8093 useshrplib='false'
8094 ;;
8095*) case "$useshrplib" in
8096 '') case "$osname" in
df00ff3b 8097 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
b4eb6b3d
JH
8098 dflt=y
8099 also='Building a shared libperl is required for dynamic loading to work on your system.'
8100 ;;
8101 next*)
8102 case "$osvers" in
8103 4*) dflt=y
8104 also='Building a shared libperl is needed for MAB support.'
8105 ;;
8106 *) dflt=n
8107 ;;
8108 esac
8109 ;;
8110 *) dflt=n
8111 ;;
8112 esac
8113 ;;
8114 $define|true|[Yy]*)
8115 dflt=y
8116 ;;
8117 *) dflt=n
8118 ;;
8119 esac
8120 $cat << EOM
8121
8122The perl executable is normally obtained by linking perlmain.c with
8123libperl${_a}, any static extensions (usually just DynaLoader), and
8124any other libraries needed on this system (such as -lm, etc.). Since
8125your system supports dynamic loading, it is probably possible to build
8126a shared libperl.$so. If you will have more than one executable linked
8127to libperl.$so, this will significantly reduce the size of each
5cadb3f3 8128executable, but it may have a noticeable effect on performance. The
b4eb6b3d
JH
8129default is probably sensible for your system.
8130$also
8131
8132EOM
8133 rp="Build a shared libperl.$so (y/n)"
8134 . ./myread
8135 case "$ans" in
8136 true|$define|[Yy]*)
8137 useshrplib='true' ;;
8138 *) useshrplib='false' ;;
8139 esac
8140 ;;
8141esac
8142
8143case "$useshrplib" in
8144true)
df31f9b1
MB
8145 case "$userelocatableinc" in
8146 true|define)
8147 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8148 echo "See INSTALL for an explanation why that won't work." >&4
8149 exit 4
8150 ;;
8151 esac
b4eb6b3d
JH
8152 case "$libperl" in
8153 '')
8154 # Figure out a good name for libperl.so. Since it gets stored in
8155 # a version-specific architecture-dependent library, the version
8156 # number isn't really that important, except for making cc/ld happy.
8157 #
56e771c1 8158 # A name such as libperl.so.10.1
b4eb6b3d 8159 majmin="libperl.$so.$patchlevel.$subversion"
56e771c1 8160 # A name such as libperl.so.100
b4eb6b3d
JH
8161 majonly=`echo $patchlevel $subversion |
8162 $awk '{printf "%d%02d", $1, $2}'`
8163 majonly=libperl.$so.$majonly
8164 # I'd prefer to keep the os-specific stuff here to a minimum, and
8165 # rely on figuring it out from the naming of libc.
8166 case "${osname}${osvers}" in
8167 next4*)
8168 dflt=libperl.5.$so
8169 # XXX How handle the --version stuff for MAB?
8170 ;;
fb2e1bc0 8171 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
8172 dflt=libperl.$so
8173 ;;
56e771c1
RU
8174 cygwin*) # ld links now against the dll directly
8175 majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8176 majonly=`echo $patchlevel $subversion |
8177 $awk '{printf "%03d%03d", $1, $2}'`
8178 majonly=cygperl5.$majonly.$so
8179 dflt=$majmin
b4eb6b3d
JH
8180 ;;
8181 *) # Try to guess based on whether libc has major.minor.
8182 case "$libc" in
8183 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8184 *libc.$so.[0-9]*) dflt=$majonly ;;
8185 *) dflt=libperl.$so ;;
8186 esac
8187 ;;
8188 esac
8189 ;;
8190 *) dflt=$libperl
8191 ;;
8192 esac
8193 cat << EOM
8194
8195I need to select a good name for the shared libperl. If your system uses
8196library names with major and minor numbers, then you might want something
8197like $majmin. Alternatively, if your system uses a single version
8198number for shared libraries, then you might want to use $majonly.
8199Or, your system might be quite happy with a simple libperl.$so.
8200
8201Since the shared libperl will get installed into a version-specific
8202architecture-dependent directory, the version number of the shared perl
8203library probably isn't important, so the default should be o.k.
8204
8205EOM
8206 rp='What name do you want to give to the shared libperl?'
8207 . ./myread
8208 libperl=$ans
8209 echo "Ok, I'll use $libperl"
8210 ;;
8211*)
8212 libperl="libperl${_a}"
8213 ;;
8214esac
8215
8216# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8217case "$shrpdir" in
8218'') ;;
8219*) $cat >&4 <<EOM
8220WARNING: Use of the shrpdir variable for the installation location of
8221the shared $libperl is not supported. It was never documented and
8222will not work in this version. Let me (perlbug@perl.org)
8223know of any problems this may cause.
8224
8225EOM
8226 case "$shrpdir" in
8227 "$archlibexp/CORE")
8228 $cat >&4 <<EOM
8229But your current setting of $shrpdir is
8230the default anyway, so it's harmless.
8231EOM
8232 ;;
8233 *)
8234 $cat >&4 <<EOM
8235Further, your current attempted setting of $shrpdir
8236conflicts with the value of $archlibexp/CORE
8237that installperl will use.
8238EOM
8239 ;;
8240 esac
8241 ;;
8242esac
8243
8244# How will the perl executable find the installed shared $libperl?
8245# Add $xxx to ccdlflags.
8246# If we can't figure out a command-line option, use $shrpenv to
8247# set env LD_RUN_PATH. The main perl makefile uses this.
8248shrpdir=$archlibexp/CORE
8249xxx=''
8250tmp_shrpenv=''
8251if "$useshrplib"; then
34f1896b 8252 case "$osname" in
b4eb6b3d
JH
8253 aix)
8254 # We'll set it in Makefile.SH...
8255 ;;
b5b9f165 8256 solaris)
b4eb6b3d
JH
8257 xxx="-R $shrpdir"
8258 ;;
c5f63f38 8259 freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
b4eb6b3d
JH
8260 xxx="-Wl,-R$shrpdir"
8261 ;;
fb2e1bc0 8262 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
8263 xxx="-Wl,-rpath,$shrpdir"
8264 ;;
8265 next)
8266 # next doesn't like the default...
8267 ;;
8268 beos)
8269 # beos doesn't like the default, either.
8270 ;;
df00ff3b
IW
8271 haiku)
8272 # Haiku doesn't like the default, either.
8273 ;;
b4eb6b3d
JH
8274 hpux*)
8275 # hpux doesn't like the default, either.
8276 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8277 ;;
56e771c1
RU
8278 cygwin)
8279 # cygwin needs only ldlibpth
8280 ;;
b4eb6b3d
JH
8281 *)
8282 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8283 ;;
8284 esac
8285 case "$xxx" in
8286 '') ;;
34f1896b 8287 *)
b4eb6b3d
JH
8288 # Only add $xxx if it isn't already in ccdlflags.
8289 case " $ccdlflags " in
8290 *" $xxx "*) ;;
8291 *) ccdlflags="$ccdlflags $xxx"
8292 cat <<EOM >&4
8293
8294Adding $xxx to the flags
34f1896b 8295passed to $ld so that the perl executable will find the
b4eb6b3d
JH
8296installed shared $libperl.
8297
8298EOM
8299 ;;
8300 esac
8301 ;;
8302 esac
8303fi
8304# Fix ccdlflags in AIX for building external extensions.
8305# (For building Perl itself bare -bE:perl.exp is needed,
8306# Makefile.SH takes care of this.)
8307case "$osname" in
8308aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8309esac
8310# Respect a hint or command-line value.
8311case "$shrpenv" in
8312'') shrpenv="$tmp_shrpenv" ;;
8313esac
8314case "$ldlibpthname" in
8315'') ldlibpthname=LD_LIBRARY_PATH ;;
8316none) ldlibpthname='' ;;
8317esac
8318
8319: determine where manual pages are on this system
8320echo " "
8321case "$sysman" in
8322'')
4a0a3829
SD
8323 syspath='/usr/share/man/man1 /usr/man/man1'
8324 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8325 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
8326 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8327 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8328 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8329 sysman=`./loc . /usr/man/man1 $syspath`
8330 ;;
8331esac
8332if $test -d "$sysman"; then
8333 echo "System manual is in $sysman." >&4
8334else
8335 echo "Could not find manual pages in source form." >&4
8336fi
8337
8338: determine where manual pages go
8339set man1dir man1dir none
8340eval $prefixit
8341$cat <<EOM
8342
8343$spackage has manual pages available in source form.
8344EOM
8345case "$nroff" in
8346nroff)
8347 echo "However, you don't have nroff, so they're probably useless to you."
8348 case "$man1dir" in
8349 '') man1dir="none";;
8350 esac;;
8351esac
8352echo "If you don't want the manual sources installed, answer 'none'."
8353case "$man1dir" in
8354' ') dflt=none
8355 ;;
8356'')
4a0a3829
SD
8357 lookpath="$prefixexp/share/man/man1"
8358 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
8359 lookpath="$lookpath $prefixexp/man/p_man/man1"
8360 lookpath="$lookpath $prefixexp/man/u_man/man1"
8361 lookpath="$lookpath $prefixexp/man/man.1"
8362 case "$sysman" in
8363 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8364 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8365 esac
8366 set dflt
8367 eval $prefixup
8368 ;;
8369*) dflt="$man1dir"
8370 ;;
8371esac
8372echo " "
8373fn=dn+~
8374rp="Where do the main $spackage manual pages (source) go?"
8375. ./getfile
8376if $test "X$man1direxp" != "X$ansexp"; then
8377 installman1dir=''
8378fi
79522dd2
NC
8379prefixvar=man1dir
8380. ./setprefixvar
8381
477140ee
NC
8382case "$man1dir" in
8383'') man1dir=' '
8384 installman1dir='';;
8385esac
b4eb6b3d
JH
8386
8387: What suffix to use on installed man pages
8388
8389case "$man1dir" in
8390' ')
8391 man1ext='0'
8392 ;;
8393*)
8394 rp="What suffix should be used for the main $spackage man pages?"
8395 case "$man1ext" in
8396 '') case "$man1dir" in
8397 *1) dflt=1 ;;
8398 *1p) dflt=1p ;;
8399 *1pm) dflt=1pm ;;
8400 *l) dflt=l;;
8401 *n) dflt=n;;
8402 *o) dflt=o;;
8403 *p) dflt=p;;
8404 *C) dflt=C;;
8405 *L) dflt=L;;
8406 *L1) dflt=L1;;
8407 *) dflt=1;;
8408 esac
8409 ;;
8410 *) dflt="$man1ext";;
8411 esac
8412 . ./myread
8413 man1ext="$ans"
8414 ;;
8415esac
8416
8417: see if we can have long filenames
8418echo " "
8419first=123456789abcdef
8420$rm -f $first
8421if (echo hi >$first) 2>/dev/null; then
8422 if $test -f 123456789abcde; then
8423 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8424 val="$undef"
8425 else
8426 echo 'You can have filenames longer than 14 characters.'>&4
8427 val="$define"
8428 fi
8429else
8430 $cat <<'EOM'
8431You can't have filenames longer than 14 chars.
8432You can't even think about them!
8433EOM
8434 val="$undef"
776a38e3 8435fi
b4eb6b3d
JH
8436set d_flexfnam
8437eval $setvar
8438$rm -rf 123456789abcde*
8439
8440: determine where library module manual pages go
8441set man3dir man3dir none
8442eval $prefixit
8443$cat <<EOM
8444
8445$spackage has manual pages for many of the library modules.
8446EOM
8447
8448case "$nroff" in
8449nroff)
8450 $cat <<'EOM'
8451However, you don't have nroff, so they're probably useless to you.
8452EOM
8453 case "$man3dir" in
8454 '') man3dir="none";;
8455 esac;;
8456esac
8457
8458case "$d_flexfnam" in
8459undef)
8460 $cat <<'EOM'
f3f1a2d8 8461However, your system can't handle the long file names like File::Basename.3.
b4eb6b3d
JH
8462EOM
8463 case "$man3dir" in
8464 '') man3dir="none";;
8465 esac;;
8466esac
8467
8468echo "If you don't want the manual sources installed, answer 'none'."
8469prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8470case "$man3dir" in
8471'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8472 if $test -d "$privlib/man/man3"; then
8473 cat <<EOM >&4
8474
8475WARNING: Previous versions of perl installed man3 pages into
f3f1a2d8
MB
8476$privlib/man/man3. This version will suggest a
8477new default of $dflt.
b4eb6b3d
JH
8478EOM
8479 tdflt=$dflt
8480 dflt='n'
8481 rp='Do you wish to preserve the old behavior?(y/n)'
8482 . ./myread
8483 case "$ans" in
8484 y*) dflt="$privlib/man/man3" ;;
8485 *) dflt=$tdflt ;;
8486 esac
8487 fi
8488 ;;
8489*) dflt="$man3dir" ;;
8490esac
8491case "$dflt" in
8492' ') dflt=none ;;
8493esac
8494echo " "
8495fn=dn+~
8496rp="Where do the $package library man pages (source) go?"
8497. ./getfile
79522dd2
NC
8498prefixvar=man3dir
8499. ./setprefixvar
8500
477140ee
NC
8501case "$man3dir" in
8502'') man3dir=' '
8503 installman3dir='';;
8504esac
b4eb6b3d
JH
8505
8506: What suffix to use on installed man pages
8507case "$man3dir" in
8508' ')
8509 man3ext='0'
8510 ;;
8511*)
8512 rp="What suffix should be used for the $package library man pages?"
8513 case "$man3ext" in
8514 '') case "$man3dir" in
8515 *3) dflt=3 ;;
8516 *3p) dflt=3p ;;
8517 *3pm) dflt=3pm ;;
8518 *l) dflt=l;;
8519 *n) dflt=n;;
8520 *o) dflt=o;;
8521 *p) dflt=p;;
8522 *C) dflt=C;;
8523 *L) dflt=L;;
8524 *L3) dflt=L3;;
8525 *) dflt=3;;
8526 esac
8527 ;;
8528 *) dflt="$man3ext";;
8529 esac
8530 . ./myread
8531 man3ext="$ans"
8532 ;;
8533esac
8534
8535: see if we have to deal with yellow pages, now NIS.
0384a54a 8536if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8537 if $test -f /usr/etc/nibindd; then
8538 echo " "
8539 echo "I'm fairly confident you're on a NeXT."
8540 echo " "
8541 rp='Do you get the hosts file via NetInfo?'
8542 dflt=y
8543 case "$hostcat" in
8544 nidump*) ;;
8545 '') ;;
8546 *) dflt=n;;
8547 esac
8548 . ./myread
8549 case "$ans" in
8550 y*) hostcat='nidump hosts .';;
8551 *) case "$hostcat" in
8552 nidump*) hostcat='';;
8553 esac
8554 ;;
8555 esac
8556 fi
8557 case "$hostcat" in
8558 nidump*) ;;
8559 *)
8560 case "$hostcat" in
8561 *ypcat*) dflt=y;;
8562 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8563 dflt=y
8564 else
8565 dflt=n
8566 fi;;
8567 *) dflt=n;;
8568 esac
8569 echo " "
8570 rp='Are you getting the hosts file via yellow pages?'
8571 . ./myread
8572 case "$ans" in
8573 y*) hostcat='ypcat hosts';;
8574 *) hostcat='cat /etc/hosts';;
8575 esac
8576 ;;
8577 esac
8578fi
8579case "$hostcat" in
8580'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8581esac
8582case "$groupcat" in
8583'') test -f /etc/group && groupcat='cat /etc/group';;
8584esac
8585case "$passcat" in
8586'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8587esac
8588
8589: now get the host name
8590echo " "
8591echo "Figuring out host name..." >&4
8592case "$myhostname" in
8593'') cont=true
8594 echo 'Maybe "hostname" will work...'
73614538 8595 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8596 myhostname=$tans
8597 phostname=hostname
8598 cont=''
8599 fi
8600 ;;
8601*) cont='';;
8602esac
8603if $test "$cont"; then
8604 if ./xenix; then
8605 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8606 if tans=`cat /etc/systemid 2>&1` ; then
8607 myhostname=$tans
8608 phostname='cat /etc/systemid'
8609 echo "Whadyaknow. Xenix always was a bit strange..."
8610 cont=''
8611 fi
8612 elif $test -r /etc/systemid; then
8613 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8614 fi
8615fi
8616if $test "$cont"; then
8617 echo 'No, maybe "uuname -l" will work...'
73614538 8618 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8619 myhostname=$tans
8620 phostname='uuname -l'
8621 else
8622 echo 'Strange. Maybe "uname -n" will work...'
73614538 8623 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8624 myhostname=$tans
8625 phostname='uname -n'
8626 else
8627 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8628 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8629 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8630 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8631 else
8632 case "$myhostname" in
8633 '') echo "Does this machine have an identity crisis or something?"
8634 phostname='';;
8635 *)
8636 echo "Well, you said $myhostname before..."
8637 phostname='echo $myhostname';;
8638 esac
8639 fi
8640 fi
8641 fi
8642fi
52a549d0
JH
8643case "$myhostname" in
8644'') myhostname=noname ;;
8645esac
b4eb6b3d
JH
8646: you do not want to know about this
8647set $myhostname
8648myhostname=$1
8649
8650: verify guess
8651if $test "$myhostname" ; then
8652 dflt=y
8653 rp='Your host name appears to be "'$myhostname'".'" Right?"
8654 . ./myread
8655 case "$ans" in
8656 y*) ;;
8657 *) myhostname='';;
8658 esac
8659fi
8660
8661: bad guess or no guess
8662while $test "X$myhostname" = X ; do
8663 dflt=''
8664 rp="Please type the (one word) name of your host:"
8665 . ./myread
8666 myhostname="$ans"
8667done
8668
8669: translate upper to lower if necessary
8670case "$myhostname" in
8671*[A-Z]*)
8672 echo "(Normalizing case in your host name)"
8673 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8674 ;;
8675esac
8676
8677case "$myhostname" in
8678*.*)
8679 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8680 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8681 echo "(Trimming domain name from host name--host name is now $myhostname)"
8682 ;;
8683*) case "$mydomain" in
8684 '')
8685 {
8686 test "X$hostcat" = "Xypcat hosts" &&
8687 ypmatch "$myhostname" hosts 2>/dev/null |\
8688 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8689 $test -s hosts
8690 } || {
8691 test "X$hostcat" != "X" &&
8692 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8693 /[ ]$myhostname[ . ]/p" > hosts
8694 }
8695 tmp_re="[ . ]"
f08cbdd1
PP
8696 if $test -f hosts; then
8697 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8698 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8699 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8700 hosts | $sort | $uniq | \
8701 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8702 case `$echo X$dflt` in
8703 X*\ *) echo "(Several hosts in the database matched hostname)"
8704 dflt=.
8705 ;;
8706 X.) echo "(You do not have fully-qualified names in the hosts database)"
8707 ;;
8708 esac
8709 else
8710 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8711 dflt=.
f08cbdd1 8712 fi
b4eb6b3d
JH
8713 case "$dflt" in
8714 .)
8715 tans=`./loc resolv.conf X /etc /usr/etc`
8716 if $test -f "$tans"; then
8717 echo "(Attempting domain name extraction from $tans)"
8718 dflt=.`$sed -n -e 's/ / /g' \
8719 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
1d40d392 8720 -e 1q 2>/dev/null`
b4eb6b3d
JH
8721 case "$dflt" in
8722 .) dflt=.`$sed -n -e 's/ / /g' \
8723 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
1d40d392 8724 -e 1q 2>/dev/null`
b4eb6b3d
JH
8725 ;;
8726 esac
8727 fi
8728 ;;
8729 esac
8730 case "$dflt" in
8731 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8732 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8733 case "$dflt" in
8734 '') dflt='.';;
8735 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8736 esac
8737 ;;
8738 esac
59c9e5d6
PP
8739 case "$dflt$osname" in
8740 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8741 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8742 ;;
8743 esac
b4eb6b3d
JH
8744 case "$dflt" in
8745 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8746 dflt='.nonet'
b4eb6b3d
JH
8747 ;;
8748 esac
8749 $rm -f hosts
8750 ;;
8751 *) dflt="$mydomain";;
8752 esac;;
8753esac
8754echo " "
8755rp="What is your domain name?"
8756. ./myread
8757tans="$ans"
8758case "$ans" in
8759'') ;;
8760.*) ;;
8761*) tans=".$tans";;
8762esac
8763mydomain="$tans"
8764
8765: translate upper to lower if necessary
8766case "$mydomain" in
8767*[A-Z]*)
8768 echo "(Normalizing case in your domain name)"
8769 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8770 ;;
8771esac
8772
8773: a little sanity check here
8774case "$phostname" in
8775'') ;;
8776*)
8777 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8778 $myhostname$mydomain|$myhostname) ;;
8779 *)
8780 case "$phostname" in
8781 sed*)
8782 echo "(That doesn't agree with your whoami.h file, by the way.)"
8783 ;;
8784 *)
8785 echo "(That doesn't agree with your $phostname command, by the way.)"
8786 ;;
8787 esac
8788 ;;
8789 esac
8790 ;;
8791esac
8792
776a38e3 8793: determine the e-mail address of the user who is running us
b4eb6b3d
JH
8794$cat <<EOM
8795
8796I need to get your e-mail address in Internet format if possible, i.e.
8797something like user@host.domain. Please answer accurately since I have
8798no easy means to double check it. The default value provided below
8799is most probably close to reality but may not be valid from outside
8800your organization...
8801
8802EOM
8803cont=x
8804while test "$cont"; do
8805 case "$cf_email" in
8806 '') dflt="$cf_by@$myhostname$mydomain";;
8807 *) dflt="$cf_email";;
8808 esac
8809 rp='What is your e-mail address?'
8810 . ./myread
8811 cf_email="$ans"
8812 case "$cf_email" in
8813 *@*.*) cont='' ;;
8814 *)
8815 rp='Address does not look like an Internet one. Use it anyway?'
8816 case "$fastread" in
8817 yes) dflt=y ;;
8818 *) dflt=n ;;
8819 esac
8820 . ./myread
8821 case "$ans" in
8822 y*) cont='' ;;
8823 *) echo " " ;;
8824 esac
8825 ;;
8826 esac
8827done
8828
34f1896b 8829: Ask e-mail of administrator
b4eb6b3d
JH
8830$cat <<EOM
8831
8832If you or somebody else will be maintaining perl at your site, please
8833fill in the correct e-mail address here so that they may be contacted
8834if necessary. Currently, the "perlbug" program included with perl
8835will send mail to this address in addition to perlbug@perl.org. You may
8836enter "none" for no administrator.
8837
8838EOM
8839case "$perladmin" in
8840'') dflt="$cf_email";;
8841*) dflt="$perladmin";;
8842esac
8843rp='Perl administrator e-mail address'
8844. ./myread
8845perladmin="$ans"
8846
91f55cc7
MB
8847: determine whether to only install version-specific parts.
8848echo " "
8849$cat <<EOM
8850Do you want to install only the version-specific parts of the perl
8851distribution? Usually you do *not* want to do this.
8852EOM
8853case "$versiononly" in
8854"$define"|[Yy]*|true) dflt='y' ;;
8855*) dflt='n';
8856esac
8857rp="Do you want to install only the version-specific parts of perl?"
8858. ./myread
8859case "$ans" in
8860[yY]*) val="$define";;
8861*) val="$undef" ;;
8862esac
8863set versiononly
8864eval $setvar
8865
8866case "$versiononly" in
8867"$define") inc_version_list=''
8868 inc_version_list_init=0
8869 ;;
8870esac
8871
8872: figure out how to guarantee perl startup
8873: XXX Note that this currently takes advantage of the bug that binexp ignores
8874: the Configure -Dinstallprefix setting, which in turn means that under
8875: relocatable @INC, initialinstalllocation is what binexp started as.
8876case "$startperl" in
8877'')
8878 case "$sharpbang" in
8879 *!)
8880 $cat <<EOH
8881
8882I can use the #! construct to start perl on your system. This will
8883make startup of perl scripts faster, but may cause problems if you
8884want to share those scripts and perl is not in a standard place
8885($initialinstalllocation/perl) on all your platforms. The alternative
8886is to force a shell by starting the script with a single ':' character.
8887
8888EOH
8889 case "$versiononly" in
8890 "$define") dflt="$initialinstalllocation/perl$version";;
8891 *) dflt="$initialinstalllocation/perl";;
8892 esac
8893 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8894 . ./myread
8895 case "$ans" in
8896 none) startperl=": # use perl";;
8897 *) startperl="#!$ans"
8898 if $test 30 -lt `echo "$ans" | wc -c`; then
8899 $cat >&4 <<EOM
8900
8901WARNING: Some systems limit the #! command to 32 characters.
8902If you experience difficulty running Perl scripts with #!, try
8903installing Perl in a directory with a shorter pathname.
8904
8905EOM
8906 fi ;;
8907 esac
8908 ;;
8909 *) startperl=": # use perl"
8910 ;;
8911 esac
8912 ;;
8913esac
8914echo "I'll use $startperl to start perl scripts."
8915
8916: figure best path for perl in scripts
8917case "$perlpath" in
8918'')
8919 case "$versiononly" in
8920 "$define") perlpath="$initialinstalllocation/perl$version";;
8921 *) perlpath="$initialinstalllocation/perl";;
8922 esac
8923 case "$startperl" in
8924 *!*) ;;
8925 *)
8926 $cat <<EOH
8927
8928I will use the "eval 'exec'" idiom to start Perl on your system.
8929I can use the full path of your Perl binary for this purpose, but
8930doing so may cause problems if you want to share those scripts and
8931Perl is not always in a standard place ($initialinstalllocation/perl).
8932
8933EOH
8934 dflt="$initialinstalllocation/perl"
8935 rp="What path shall I use in \"eval 'exec'\"?"
8936 . ./myread
8937 perlpath="$ans"
8938 ;;
8939 esac
8940 ;;
8941esac
8942case "$startperl" in
8943*!*) ;;
8944*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8945esac
8946
b4eb6b3d
JH
8947: determine where public executable scripts go
8948set scriptdir scriptdir
8949eval $prefixit
8950case "$scriptdir" in
8951'')
8952 dflt="$bin"
8953 : guess some guesses
8954 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8955 $test -d /usr/share/bin && dflt=/usr/share/bin
8956 $test -d /usr/local/script && dflt=/usr/local/script
8957 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8958 $test -d $prefixexp/script && dflt=$prefixexp/script
8959 set dflt
8960 eval $prefixup
8961 ;;
8962*) dflt="$scriptdir"
8963 ;;
8964esac
8965$cat <<EOM
f3f1a2d8 8966
b4eb6b3d
JH
8967Some installations have a separate directory just for executable scripts so
8968that they can mount it across multiple architectures but keep the scripts in
8969one spot. You might, for example, have a subdirectory of /usr/share for this.
8970Or you might just lump your scripts in with all your other executables.
f3f1a2d8 8971
b4eb6b3d
JH
8972EOM
8973fn=d~
8974rp='Where do you keep publicly executable scripts?'
8975. ./getfile
8976if $test "X$ansexp" != "X$scriptdirexp"; then
8977 installscript=''
8978fi
f3f1a2d8 8979installscriptdir=''
79522dd2
NC
8980prefixvar=scriptdir
8981. ./setprefixvar
8982: A little fix up for an irregularly named variable.
8983installscript="$installscriptdir"
8984
b4eb6b3d
JH
8985: determine where add-on public executables go
8986case "$sitebin" in
8987'') dflt=$siteprefix/bin ;;
8988*) dflt=$sitebin ;;
8989esac
8990fn=d~
8991rp='Pathname where the add-on public executables should be installed?'
8992. ./getfile
79522dd2
NC
8993prefixvar=sitebin
8994. ./setprefixvar
b4eb6b3d 8995
6e1038e0 8996: determine where add-on html pages go
8d2cbf27 8997: There is no standard location, so try to copy the previously-selected
6e1038e0 8998: directory structure for the core html pages.
8d2cbf27
JH
8999case "$sitehtml1dir" in
9000'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9001*) dflt=$sitehtml1dir ;;
6e1038e0
MB
9002esac
9003case "$dflt" in
9004''|' ') dflt=none ;;
9005esac
9006fn=dn+~
9007rp='Pathname where the site-specific html pages should be installed?'
9008. ./getfile
79522dd2
NC
9009prefixvar=sitehtml1dir
9010. ./setprefixvar
6e1038e0
MB
9011
9012: determine where add-on library html pages go
9013: There is no standard location, so try to copy the previously-selected
9014: directory structure for the core html pages.
8d2cbf27
JH
9015case "$sitehtml3dir" in
9016'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9017*) dflt=$sitehtml3dir ;;
6e1038e0
MB
9018esac
9019case "$dflt" in
9020''|' ') dflt=none ;;
9021esac
9022fn=dn+~
9023rp='Pathname where the site-specific library html pages should be installed?'
9024. ./getfile
79522dd2
NC
9025prefixvar=sitehtml3dir
9026. ./setprefixvar
6e1038e0
MB
9027
9028: determine where add-on manual pages go
91e123a8
JH
9029case "$siteman1dir" in
9030'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 9031*) dflt=$siteman1dir ;;
6e1038e0 9032esac
257059b5
JH
9033case "$dflt" in
9034''|' ') dflt=none ;;
9035esac
6e1038e0
MB
9036fn=dn+~
9037rp='Pathname where the site-specific manual pages should be installed?'
9038. ./getfile
79522dd2
NC
9039prefixvar=siteman1dir
9040. ./setprefixvar
6e1038e0
MB
9041
9042: determine where add-on library man pages go
91e123a8
JH
9043case "$siteman3dir" in
9044'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 9045*) dflt=$siteman3dir ;;
6e1038e0 9046esac
257059b5
JH
9047case "$dflt" in
9048''|' ') dflt=none ;;
9049esac
6e1038e0
MB
9050fn=dn+~
9051rp='Pathname where the site-specific library manual pages should be installed?'
9052. ./getfile
79522dd2
NC
9053prefixvar=siteman3dir
9054. ./setprefixvar
6e1038e0
MB
9055
9056: determine where add-on public executable scripts go
9057case "$sitescript" in
9058'') dflt=$siteprefix/script
9059 $test -d $dflt || dflt=$sitebin ;;
9060*) dflt="$sitescript" ;;
9061esac
9062fn=d~+
9063rp='Pathname where add-on public executable scripts should be installed?'
9064. ./getfile
79522dd2
NC
9065prefixvar=sitescript
9066. ./setprefixvar
6e1038e0 9067
34f1896b 9068: Check if faststdio is requested and available
15b61c98
JH
9069case "$usefaststdio" in
9070$define|true|[yY]*|'')
9071 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9072 case "$xversion" in
9073 [68]) dflt='y' ;;
9074 *) dflt='n' ;;
9075 esac
9076 ;;
9077*) dflt='n';;
9078esac
9079cat <<EOM
9080
9081Perl can be built to use 'fast stdio', which means using the stdio
9082library but also directly manipulating the stdio buffers to enable
9083faster I/O. Using stdio is better for backward compatibility (especially
9084for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9085interface has been preferred instead of stdio.
9086
9087If this doesn't make any sense to you, just accept the default '$dflt'.
9088EOM
9089rp='Use the "fast stdio" if available?'
9090. ./myread
9091case "$ans" in
34f1896b 9092y|Y) val="$define" ;;
15b61c98
JH
9093*) val="$undef" ;;
9094esac
9095set usefaststdio
9096eval $setvar
9097
9098
96056487
JH
9099: define an is-a-typedef? function
9100typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9101case "$inclist" in
9102"") inclist="sys/types.h";;
9103esac;
9104eval "varval=\$$var";
9105case "$varval" in
9106"")
9107 $rm -f temp.c;
9108 for inc in $inclist; do
9109 echo "#include <$inc>" >>temp.c;
9110 done;
9111 echo "#ifdef $type" >> temp.c;
9112 echo "printf(\"We have $type\");" >> temp.c;
9113 echo "#endif" >> temp.c;
9114 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9115 if $contains $type temp.E >/dev/null 2>&1; then
9116 eval "$var=\$type";
9117 else
9118 eval "$var=\$def";
9119 fi;
9120 $rm -f temp.?;;
9121*) eval "$var=\$varval";;
9122esac'
9123
9124: define an is-a-typedef? function that prompts if the type is not available.
9125typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9126case "$inclist" in
9127"") inclist="sys/types.h";;
9128esac;
9129eval "varval=\$$var";
9130case "$varval" in
9131"")
9132 $rm -f temp.c;
9133 for inc in $inclist; do
9134 echo "#include <$inc>" >>temp.c;
9135 done;
9136 echo "#ifdef $type" >> temp.c;
9137 echo "printf(\"We have $type\");" >> temp.c;
9138 echo "#endif" >> temp.c;
9139 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9140 echo " " ;
9141 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9142 if $contains $type temp.E >/dev/null 2>&1; then
9143 echo "$type found." >&4;
9144 eval "$var=\$type";
9145 else
9146 echo "$type NOT found." >&4;
9147 dflt="$def";
9148 . ./myread ;
9149 eval "$var=\$ans";
9150 fi;
9151 $rm -f temp.?;;
9152*) eval "$var=\$varval";;
9153esac'
9154
9155: see what type lseek is declared as in the kernel
9156rp="What is the type used for lseek's offset on this system?"
9157set off_t lseektype long stdio.h sys/types.h
9158eval $typedef_ask
9159
9160echo " "
9161echo "Checking to see how big your file offsets are..." >&4
9162$cat >try.c <<EOCP
9163#include <sys/types.h>
9164#include <stdio.h>
9165int main()
9166{
9167 printf("%d\n", (int)sizeof($lseektype));
5b813a60 9168 return(0);
96056487
JH
9169}
9170EOCP
9171set try
9172if eval $compile_ok; then
9173 lseeksize=`$run ./try`
9174 echo "Your file offsets are $lseeksize bytes long."
9175else
9176 dflt=$longsize
9177 echo " "
9178 echo "(I can't seem to compile the test program. Guessing...)"
9179 rp="What is the size of your file offsets (in bytes)?"
9180 . ./myread
9181 lseeksize="$ans"
9182fi
5b813a60 9183$rm_try
96056487
JH
9184
9185: see what type file positions are declared as in the library
9186rp="What is the type for file position used by fsetpos()?"
9187set fpos_t fpostype long stdio.h sys/types.h
9188eval $typedef_ask
9189
613d6c3e 9190: Check size for Fpos_t
96056487
JH
9191echo " "
9192case "$fpostype" in
9193*_t) zzz="$fpostype" ;;
9194*) zzz="fpos_t" ;;
9195esac
613d6c3e 9196echo "Checking the size of $zzz..." >&4
96056487
JH
9197cat > try.c <<EOCP
9198#include <sys/types.h>
9199#include <stdio.h>
d1daaddf
JH
9200#$i_stdlib I_STDLIB
9201#ifdef I_STDLIB
9202#include <stdlib.h>
9203#endif
96056487
JH
9204int main() {
9205 printf("%d\n", (int)sizeof($fpostype));
9206 exit(0);
9207}
9208EOCP
9209set try
9210if eval $compile_ok; then
9211 yyy=`$run ./try`
9212 case "$yyy" in
9213 '') fpossize=4
9214 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9215 ;;
9216 *) fpossize=$yyy
9217 echo "Your $zzz is $fpossize bytes long."
9218 ;;
9219 esac
9220else
9221 dflt="$longsize"
9222 echo " " >&4
9223 echo "(I can't compile the test program. Guessing...)" >&4
9224 rp="What is the size of your file positions (in bytes)?"
9225 . ./myread
9226 fpossize="$ans"
9227fi
9228
613d6c3e 9229: Check for large file support
96056487
JH
9230# Backward compatibility (uselfs is deprecated).
9231case "$uselfs" in
9232"$define"|true|[yY]*)
9233 cat <<EOM >&4
9234
9235*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9236EOM
9237 uselargefiles="$define"
9238 ;;
5b813a60 9239esac
96056487
JH
9240
9241case "$lseeksize:$fpossize" in
92428:8) cat <<EOM
9243
9244You can have files larger than 2 gigabytes.
9245EOM
9246 val="$define" ;;
9247*) case "$uselargefiles" in
9248 "$undef"|false|[nN]*) dflt='n' ;;
9249 *) dflt='y' ;;
9250 esac
9251 cat <<EOM
9252
9253Perl can be built to understand large files (files larger than 2 gigabytes)
9254on some systems. To do so, Configure can be run with -Duselargefiles.
9255
9256If this doesn't make any sense to you, just accept the default '$dflt'.
9257EOM
9258 rp='Try to understand large files, if available?'
9259 . ./myread
9260 case "$ans" in
9261 y|Y) val="$define" ;;
9262 *) val="$undef" ;;
9263 esac
9264 ;;
9265esac
9266set uselargefiles
9267eval $setvar
96056487
JH
9268: Look for a hint-file generated 'call-back-unit'. If the
9269: user has specified that a large files perl is to be built,
9270: we may need to set or change some other defaults.
9da7673b
MB
9271if $test -f uselargefiles.cbu; then
9272 echo "Your platform has some specific hints regarding large file builds, using them..."
9273 . ./uselargefiles.cbu
9274fi
9275case "$uselargefiles" in
9276"$define")
96056487 9277 if $test -f uselargefiles.cbu; then
96056487
JH
9278 echo " "
9279 echo "Rechecking to see how big your file offsets are..." >&4
9280 $cat >try.c <<EOCP
9281#include <sys/types.h>
9282#include <stdio.h>
9283int main()
9284{
9285 printf("%d\n", (int)sizeof($lseektype));
5b813a60 9286 return(0);
96056487
JH
9287}
9288EOCP
9289 set try
9290 if eval $compile_ok; then
9291 lseeksize=`$run ./try`
9292 $echo "Your file offsets are now $lseeksize bytes long."
9293 else
9294 dflt="$lseeksize"
9295 echo " "
9296 echo "(I can't seem to compile the test program. Guessing...)"
9297 rp="What is the size of your file offsets (in bytes)?"
9298 . ./myread
9299 lseeksize="$ans"
9300 fi
9301 case "$fpostype" in
9302 *_t) zzz="$fpostype" ;;
9303 *) zzz="fpos_t" ;;
9304 esac
5b813a60 9305 $echo $n "Rechecking the size of $zzz...$c" >&4
96056487
JH
9306 $cat > try.c <<EOCP
9307#include <sys/types.h>
9308#include <stdio.h>
55954f19
JH
9309#$i_stdlib I_STDLIB
9310#ifdef I_STDLIB
9311#include <stdlib.h>
9312#endif
96056487
JH
9313int main() {
9314 printf("%d\n", (int)sizeof($fpostype));
073b6de5 9315 return(0);
96056487
JH
9316}
9317EOCP
9318 set try
9319 if eval $compile_ok; then
9320 yyy=`$run ./try`
9321 dflt="$lseeksize"
9322 case "$yyy" in
9323 '') echo " "
9324 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9325 ;;
9326 *) fpossize=$yyy
9327 echo " $fpossize bytes." >&4
9328 ;;
9329 esac
9330 else
9331 dflt="$fpossize"
9332 echo " "
9333 echo "(I can't compile the test program. Guessing...)" >&4
9334 rp="What is the size of your file positions (in bytes)?"
9335 . ./myread
9336 fpossize="$ans"
9337 fi
5b813a60 9338 $rm_try
96056487
JH
9339 fi
9340 ;;
9341esac
9342
dd35fa16
MB
9343: Check if we want perlio
9344useperlio="$define"
9345
613d6c3e 9346: Set the vendorbin variables
b4eb6b3d
JH
9347case "$vendorprefix" in
9348'') d_vendorbin="$undef"
9349 vendorbin=''
9350 vendorbinexp=''
9351 ;;
9352*) d_vendorbin="$define"
9353 : determine where vendor-supplied executables go.
9354 case "$vendorbin" in
9355 '') dflt=$vendorprefix/bin ;;
9356 *) dflt="$vendorbin" ;;
9357 esac
9358 fn=d~+
9359 rp='Pathname for the vendor-supplied executables directory?'
9360 . ./getfile
9361 vendorbin="$ans"
9362 vendorbinexp="$ansexp"
9363 ;;
9364esac
a092d240
NC
9365prefixvar=vendorbin
9366. ./installprefix
b4eb6b3d 9367
613d6c3e 9368: Set the vendorhtml1dir variables
6e1038e0 9369case "$vendorprefix" in
8d2cbf27
JH
9370'') vendorhtml1dir=''
9371 vendorhtml1direxp=''
6e1038e0
MB
9372 ;;
9373*) : determine where vendor-supplied html pages go.
9374 : There is no standard location, so try to copy the previously-selected
9375 : directory structure for the core html pages.
9376 : XXX Better default suggestions would be welcome.
8d2cbf27 9377 case "$vendorhtml1dir" in
6e1038e0 9378 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9379 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9380 esac
9381 case "$dflt" in
9382 ''|' ') dflt=none ;;
9383 esac
9384 fn=dn+~
9385 rp='Pathname for the vendor-supplied html pages?'
9386 . ./getfile
8d2cbf27
JH
9387 vendorhtml1dir="$ans"
9388 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9389 ;;
9390esac
9391: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9392$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
a092d240
NC
9393prefixvar=vendorhtml1dir
9394. ./installprefix
6e1038e0 9395
613d6c3e 9396: Set the vendorhtml3dir variables
6e1038e0 9397case "$vendorprefix" in
8d2cbf27
JH
9398'') vendorhtml3dir=''
9399 vendorhtml3direxp=''
6e1038e0
MB
9400 ;;
9401*) : determine where vendor-supplied module html pages go.
9402 : There is no standard location, so try to copy the previously-selected
9403 : directory structure for the core html pages.
9404 : XXX Better default suggestions would be welcome.
8d2cbf27 9405 case "$vendorhtml3dir" in
6e1038e0 9406 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9407 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9408 esac
9409 case "$dflt" in
9410 ''|' ') dflt=none ;;
9411 esac
9412 fn=dn+~
9413 rp='Pathname for the vendor-supplied html pages?'
9414 . ./getfile
8d2cbf27
JH
9415 vendorhtml3dir="$ans"
9416 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9417 ;;
9418esac
9419: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9420$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
a092d240
NC
9421prefixvar=vendorhtml3dir
9422. ./installprefix
6e1038e0 9423
613d6c3e 9424: Set the vendorman1dir variables
6e1038e0 9425case "$vendorprefix" in
91e123a8
JH
9426'') vendorman1dir=''
9427 vendorman1direxp=''
6e1038e0
MB
9428 ;;
9429*) : determine where vendor-supplied manual pages go.
91e123a8 9430 case "$vendorman1dir" in
6e1038e0 9431 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9432 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9433 esac
9434 case "$dflt" in
9435 ''|' ') dflt=none ;;
9436 esac
9437 fn=nd~+
9438 rp='Pathname for the vendor-supplied manual section 1 pages?'
9439 . ./getfile
91e123a8
JH
9440 vendorman1dir="$ans"
9441 vendorman1direxp="$ansexp"
6e1038e0
MB
9442 ;;
9443esac
9444: Use ' ' for none so value is preserved next time through Configure
91e123a8 9445$test X"$vendorman1dir" = "X" && vendorman1dir=' '
a092d240
NC
9446prefixvar=vendorman1dir
9447. ./installprefix
6e1038e0 9448
613d6c3e 9449: Set the vendorman3dir variables
6e1038e0 9450case "$vendorprefix" in
91e123a8
JH
9451'') vendorman3dir=''
9452 vendorman3direxp=''
6e1038e0
MB
9453 ;;
9454*) : determine where vendor-supplied module manual pages go.
91e123a8 9455 case "$vendorman3dir" in
6e1038e0 9456 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9457 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9458 esac
9459 case "$dflt" in
9460 ''|' ') dflt=none ;;
9461 esac
9462 fn=nd~+
9463 rp='Pathname for the vendor-supplied manual section 3 pages?'
9464 . ./getfile
91e123a8
JH
9465 vendorman3dir="$ans"
9466 vendorman3direxp="$ansexp"
6e1038e0
MB
9467 ;;
9468esac
9469: Use ' ' for none so value is preserved next time through Configure
91e123a8 9470$test X"$vendorman3dir" = "X" && vendorman3dir=' '
a092d240
NC
9471prefixvar=vendorman3dir
9472. ./installprefix
6e1038e0 9473
613d6c3e 9474: Set the vendorscript variables
6e1038e0
MB
9475case "$vendorprefix" in
9476'') d_vendorscript="$undef"
9477 vendorscript=''
9478 vendorscriptexp=''
9479 ;;
9480*) d_vendorscript="$define"
9481 : determine where vendor-supplied scripts go.
9482 case "$vendorscript" in
9483 '') dflt=$vendorprefix/script
9484 $test -d $dflt || dflt=$vendorbin ;;
9485 *) dflt="$vendorscript" ;;
9486 esac
9487 $cat <<EOM
9488
f3f1a2d8 9489The installation process will create a directory for
6e1038e0
MB
9490vendor-supplied scripts.
9491
9492EOM
9493 fn=d~+
9494 rp='Pathname for the vendor-supplied scripts directory?'
9495 . ./getfile
9496 vendorscript="$ans"
9497 vendorscriptexp="$ansexp"
9498 ;;
9499esac
a092d240
NC
9500prefixvar=vendorscript
9501. ./installprefix
6e1038e0 9502
f47f1645
TC
9503: script used to emit important warnings
9504cat >warn <<EOS
9505$startsh
9506if test \$# -gt 0; then
9507 echo "\$@" >msg
9508else
9509 cat >msg
9510fi
9511echo "*** WARNING:" >&4
9512sed -e 's/^/*** /' <msg >&4
9513echo "*** " >&4
9514cat msg >>config.msg
9515echo " " >>config.msg
9516rm -f msg
9517EOS
9518chmod +x warn
9519$eunicefix warn
9520
9521: see which of string.h or strings.h is needed
9522echo " "
9523strings=`./findhdr string.h`
9524if $test "$strings" && $test -r "$strings"; then
9525 echo "Using <string.h> instead of <strings.h>." >&4
9526 val="$define"
9527else
9528 val="$undef"
9529 strings=`./findhdr strings.h`
9530 if $test "$strings" && $test -r "$strings"; then
9531 echo "Using <strings.h> instead of <string.h>." >&4
9532 else
9533 ./warn "No string header found -- You'll surely have problems."
9534 fi
9535fi
9536set i_string
9537eval $setvar
9538case "$i_string" in
9539"$undef") strings=`./findhdr strings.h`;;
9540*) strings=`./findhdr string.h`;;
9541esac
9542
b4eb6b3d
JH
9543: see if qgcvt exists
9544set qgcvt d_qgcvt
9545eval $inlibc
9546
613d6c3e 9547: Check print/scan long double stuff
89ce900e
JH
9548echo " "
9549
9550if $test X"$d_longdbl" = X"$define"; then
9551
9552echo "Checking how to print long doubles..." >&4
9553
9554if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9555 $cat >try.c <<'EOCP'
9556#include <sys/types.h>
9557#include <stdio.h>
9558int main() {
9559 double d = 123.456;
9560 printf("%.3f\n", d);
9561}
9562EOCP
9563 set try
9564 if eval $compile; then
9565 yyy=`$run ./try`
9566 case "$yyy" in
9567 123.456)
9568 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9569 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9570 echo "We will use %f."
9571 ;;
9572 esac
9573 fi
9574fi
9575
9576if $test X"$sPRIfldbl" = X; then
9577 $cat >try.c <<'EOCP'
9578#include <sys/types.h>
9579#include <stdio.h>
9580int main() {
9581 long double d = 123.456;
9582 printf("%.3Lf\n", d);
9583}
9584EOCP
9585 set try
9586 if eval $compile; then
9587 yyy=`$run ./try`
9588 case "$yyy" in
9589 123.456)
9590 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9591 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9592 echo "We will use %Lf."
9593 ;;
9594 esac
9595 fi
9596fi
9597
9598if $test X"$sPRIfldbl" = X; then
9599 $cat >try.c <<'EOCP'
9600#include <sys/types.h>
9601#include <stdio.h>
9602int main() {
9603 long double d = 123.456;
9604 printf("%.3llf\n", d);
9605}
9606EOCP
9607 set try
9608 if eval $compile; then
9609 yyy=`$run ./try`
9610 case "$yyy" in
9611 123.456)
9612 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9613 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9614 echo "We will use %llf."
9615 ;;
9616 esac
9617 fi
9618fi
9619
9620if $test X"$sPRIfldbl" = X; then
9621 $cat >try.c <<'EOCP'
9622#include <sys/types.h>
9623#include <stdio.h>
9624int main() {
9625 long double d = 123.456;
9626 printf("%.3lf\n", d);
9627}
9628EOCP
9629 set try
9630 if eval $compile; then
9631 yyy=`$run ./try`
9632 case "$yyy" in
9633 123.456)
9634 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9635 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9636 echo "We will use %lf."
9637 ;;
9638 esac
9639 fi
9640fi
9641
9642if $test X"$sPRIfldbl" = X; then
9643 echo "Cannot figure out how to print long doubles." >&4
9644else
9645 sSCNfldbl=$sPRIfldbl # expect consistency
9646fi
9647
5b813a60 9648$rm_try
89ce900e
JH
9649
9650fi # d_longdbl
9651
9652case "$sPRIfldbl" in
5b813a60
MB
9653'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9654 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
89ce900e
JH
9655 d_SCNfldbl="$undef";
9656 ;;
5b813a60
MB
9657*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9658 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
89ce900e
JH
9659 d_SCNfldbl="$define";
9660 ;;
9661esac
9662
b4eb6b3d 9663: Check how to convert floats to strings.
a5b10d80
YST
9664
9665if test "X$d_Gconvert" = X; then
9666
b4eb6b3d
JH
9667echo " "
9668echo "Checking for an efficient way to convert floats to strings."
9669echo " " > try.c
9670case "$uselongdouble" in
9671"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9672esac
9673case "$d_longdbl" in
9674"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9675esac
9676case "$d_PRIgldbl" in
9677"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9678esac
9679$cat >>try.c <<EOP
9680#ifdef TRY_gconvert
9681#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9682char *myname = "gconvert";
9683#endif
9684#ifdef TRY_gcvt
9685#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9686char *myname = "gcvt";
9687#endif
9688#ifdef TRY_qgcvt
9689#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9690char *myname = "qgcvt";
9691#define DOUBLETYPE long double
9692#endif
9693#ifdef TRY_sprintf
a5b10d80
YST
9694#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9695#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9696#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9697#else
a5b10d80
YST
9698#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9699#endif
9700#else
b4eb6b3d
JH
9701#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9702#endif
9703char *myname = "sprintf";
9704#endif
9705
9706#ifndef DOUBLETYPE
9707#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9708#define DOUBLETYPE long double
9709#else
9710#define DOUBLETYPE double
9711#endif
9712#endif
9713
9714#include <stdio.h>
9715
f47f1645 9716#$i_stdlib I_STDLIB
b4eb6b3d
JH
9717#ifdef I_STDLIB
9718#include <stdlib.h>
9719#endif
f47f1645
TC
9720#$i_string I_STRING
9721#ifdef I_STRING
9722# include <string.h>
9723#else
9724# include <strings.h>
9725#endif
b4eb6b3d 9726
f47f1645 9727int checkit(char *expect, char *got)
b4eb6b3d
JH
9728{
9729 if (strcmp(expect, got)) {
9730 printf("%s oddity: Expected %s, got %s\n",
9731 myname, expect, got);
9732 exit(1);
9733 }
9734}
9735
9736int main()
5b813a60
MB
9737{
9738 char buf[64];
b4eb6b3d
JH
9739 buf[63] = '\0';
9740
9741 /* This must be 1st test on (which?) platform */
9742 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9743 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9744 checkit("0.1", buf);
9745
5b813a60 9746 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
a5b10d80
YST
9747 checkit("0.01", buf);
9748
5b813a60 9749 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
a5b10d80
YST
9750 checkit("0.001", buf);
9751
5b813a60 9752 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
a5b10d80
YST
9753 checkit("0.0001", buf);
9754
9755 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9756 if (strlen(buf) > 5)
9757 checkit("9e-005", buf); /* for Microsoft ?? */
9758 else
9759 checkit("9e-05", buf);
9760
5b813a60 9761 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
b4eb6b3d
JH
9762 checkit("1", buf);
9763
5b813a60 9764 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
b4eb6b3d
JH
9765 checkit("1.1", buf);
9766
5b813a60 9767 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
b4eb6b3d
JH
9768 checkit("1.01", buf);
9769
5b813a60 9770 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
b4eb6b3d
JH
9771 checkit("1.001", buf);
9772
5b813a60 9773 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
b4eb6b3d
JH
9774 checkit("1.0001", buf);
9775
5b813a60 9776 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
b4eb6b3d
JH
9777 checkit("1.00001", buf);
9778
5b813a60 9779 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
b4eb6b3d
JH
9780 checkit("1.000001", buf);
9781
5b813a60 9782 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
b4eb6b3d
JH
9783 checkit("0", buf);
9784
5b813a60 9785 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
b4eb6b3d
JH
9786 checkit("-1", buf);
9787
9788 /* Some Linux gcvt's give 1.e+5 here. */
5b813a60 9789 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
b4eb6b3d 9790 checkit("100000", buf);
5b813a60 9791
b4eb6b3d 9792 /* Some Linux gcvt's give -1.e+5 here. */
5b813a60 9793 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
b4eb6b3d
JH
9794 checkit("-100000", buf);
9795
5b813a60 9796 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
b4eb6b3d
JH
9797 checkit("123.456", buf);
9798
ab6ca9f4 9799 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9800 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9801 /* 34 should be enough to scare even long double
9802 * places into using the e notation. */
ab6ca9f4 9803 if (strlen(buf) > 5)
94b339ad 9804 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9805 else
94b339ad 9806 checkit("1e+34", buf);
8e2a5ede 9807
d1eb8299
YST
9808 /* For Perl, if you add additional tests here, also add them to
9809 * t/base/num.t for benefit of platforms not using Configure or
9810 * overriding d_Gconvert */
9811
b4eb6b3d
JH
9812 exit(0);
9813}
9814EOP
ab6ca9f4 9815: first add preferred functions to our list
a5b10d80 9816xxx_list=""
ab6ca9f4 9817for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9818 case $xxx_convert in
9819 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9820 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
5b813a60 9821 esac
a5b10d80
YST
9822done
9823: then add any others
9824for xxx_convert in gconvert gcvt sprintf; do
9825 case "$xxx_list" in
9826 *$xxx_convert*) ;;
9827 *) xxx_list="$xxx_list $xxx_convert" ;;
5b813a60 9828 esac
a5b10d80
YST
9829done
9830
9831case "$d_longdbl$uselongdouble" in
9832"$define$define")
cd95ead5 9833 : again, add preferred functions to our list first
a5b10d80 9834 xxx_ld_list=""
ab6ca9f4 9835 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9836 case $xxx_convert in
9837 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9838 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9839 esac
9840 done
9841 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9842 for xxx_convert in qgcvt sprintf $xxx_list; do
9843 case "$xxx_ld_list" in
9844 $xxx_convert*|*" $xxx_convert"*) ;;
9845 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9846 esac
9847 done
9848 : if sprintf cannot do long doubles, move it to the end
9849 if test "$d_PRIgldbl" != "$define"; then
9850 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9851 fi
9852 : if no qgcvt, remove it
9853 if test "$d_qgcvt" != "$define"; then
9854 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9855 fi
9856 : use the ld_list
9857 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9858 ;;
9859esac
9860
9861for xxx_convert in $xxx_list; do
9862 echo "Trying $xxx_convert..."
93451a0d 9863 $rm -f try try$_o core
b4eb6b3d
JH
9864 set try -DTRY_$xxx_convert
9865 if eval $compile; then
9866 echo "$xxx_convert() found." >&4
5440bc8e 9867 if $run ./try; then
b4eb6b3d
JH
9868 echo "I'll use $xxx_convert to convert floats into a string." >&4
9869 break;
9870 else
9871 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9872 xxx_convert=''
b4eb6b3d
JH
9873 fi
9874 else
9875 echo "$xxx_convert NOT found." >&4
9876 fi
9877done
ab6ca9f4 9878
a5b10d80
YST
9879if test X$xxx_convert = X; then
9880 echo "*** WHOA THERE!!! ***" >&4
9881 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9882 xxx_convert=sprintf
9883fi
9884
b4eb6b3d
JH
9885case "$xxx_convert" in
9886gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9887gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9888qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9889*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9890 "$define$define$define")
9891 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9892 "$define$define$undef")
9893 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9894 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9895 esac
5b813a60 9896 ;;
b4eb6b3d
JH
9897esac
9898
a5b10d80 9899fi
93451a0d 9900$rm_try
a5b10d80 9901
74cac757
JH
9902: see if _fwalk exists
9903set fwalk d__fwalk
9904eval $inlibc
9905
b4eb6b3d
JH
9906: Initialize h_fcntl
9907h_fcntl=false
9908
9909: Initialize h_sysfile
9910h_sysfile=false
9911
9912: access call always available on UNIX
9913set access d_access
9914eval $inlibc
9915
9916: locate the flags for 'access()'
9917case "$d_access" in
9918"$define")
9919 echo " "
55954f19 9920 $cat >access.c <<EOCP
b4eb6b3d
JH
9921#include <sys/types.h>
9922#ifdef I_FCNTL
9923#include <fcntl.h>
9924#endif
9925#ifdef I_SYS_FILE
9926#include <sys/file.h>
9927#endif
9928#ifdef I_UNISTD
9929#include <unistd.h>
9930#endif
55954f19
JH
9931#$i_stdlib I_STDLIB
9932#ifdef I_STDLIB
9933#include <stdlib.h>
9934#endif
b4eb6b3d
JH
9935int main() {
9936 exit(R_OK);
9937}
9938EOCP
9939 : check sys/file.h first, no particular reason here
9940 if $test `./findhdr sys/file.h` && \
7a282f6d 9941 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9942 h_sysfile=true;
9943 echo "<sys/file.h> defines the *_OK access constants." >&4
9944 elif $test `./findhdr fcntl.h` && \
7a282f6d 9945 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9946 h_fcntl=true;
9947 echo "<fcntl.h> defines the *_OK access constants." >&4
9948 elif $test `./findhdr unistd.h` && \
7a282f6d 9949 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9950 echo "<unistd.h> defines the *_OK access constants." >&4
9951 else
9952 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9953 fi
9954 ;;
9955esac
9956$rm -f access*
9957
9958: see if accessx exists
9959set accessx d_accessx
9960eval $inlibc
9961
89ce900e
JH
9962: see if aintl exists
9963set aintl d_aintl
9964eval $inlibc
9965
b4eb6b3d
JH
9966: see if alarm exists
9967set alarm d_alarm
9968eval $inlibc
9969
96938616
MB
9970: see if 64bit time functions exists
9971
9972set ctime64 d_ctime64
9973eval $inlibc
9974
9975set localtime64 d_localtime64
9976eval $inlibc
9977
9978set gmtime64 d_gmtime64
9979eval $inlibc
9980
9981set mktime64 d_mktime64
9982eval $inlibc
9983
9984set difftime64 d_difftime64
9985eval $inlibc
9986
9987set asctime64 d_asctime64
9988eval $inlibc
9989
a9dade78
JH
9990: see if POSIX threads are available
9991set pthread.h i_pthread
9992eval $inhdr
9993
cd95ead5 9994: define a function to check prototypes
10bc17b6
JH
9995$cat > protochk <<EOSH
9996$startsh
9997cc="$cc"
9998optimize="$optimize"
9999ccflags="$ccflags"
10000prototype="$prototype"
10001define="$define"
c944cfb9 10002rm_try="$rm_try"
a9dade78
JH
10003usethreads=$usethreads
10004i_pthread=$i_pthread
10005pthread_h_first=$pthread_h_first
10bc17b6
JH
10006EOSH
10007
10008$cat >> protochk <<'EOSH'
10009
5b813a60 10010$rm_try
10bc17b6
JH
10011foo="$1"
10012shift
10013while test $# -ge 2; do
10014 case "$1" in
10015 $define) echo "#include <$2>" >> try.c ;;
10016 literal) echo "$2" >> try.c ;;
10017 esac
cce6a207
MB
10018 # Extra magic for the benefit of systems that need pthread.h
10019 # to be included early to correctly detect threadsafe functions.
10020 # Such functions must guarantee themselves, though, that the usethreads
10021 # and i_pthread have been defined, before calling protochk.
10022 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10023 echo "#include <pthread.h>" >> try.c
10024 pthread_h_done=yes
10025 fi
10bc17b6
JH
10026 shift 2
10027done
10028test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
10029cat >> try.c <<'EOCP'
10030#ifdef CAN_PROTOTYPE
10031#define _(args) args
10032#else
10033#define _(args) ()
10034#endif
10035EOCP
10036echo "$foo" >> try.c
10037echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10038$cc $optimize $ccflags -c try.c > /dev/null 2>&1
10039status=$?
5b813a60 10040$rm_try
10bc17b6
JH
10041exit $status
10042EOSH
10043chmod +x protochk
10044$eunicefix protochk
10045
34f1896b 10046: Define hasproto macro for Configure internal use
89ce900e
JH
10047hasproto='varname=$1; func=$2; shift; shift;
10048while $test $# -ge 2; do
10049 case "$1" in
10050 $define) echo "#include <$2>";;
10051 esac ;
10052 shift 2;
10053done > try.c;
10054$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10055if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10056 echo "$func() prototype found.";
10057 val="$define";
10058else
10059 echo "$func() prototype NOT found.";
10060 val="$undef";
10061fi;
10062set $varname;
10063eval $setvar;
5b813a60 10064$rm_try tryout.c'
89ce900e 10065
10bc17b6
JH
10066: see if sys/types.h has to be included
10067set sys/types.h i_systypes
10068eval $inhdr
10069
10070: see if sys/select.h has to be included
10071set sys/select.h i_sysselct
10072eval $inhdr
10073
34f1896b 10074: Define hasfield macro for Configure internal use
10bc17b6
JH
10075hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10076while $test $# -ge 2; do
10077 case "$1" in
10078 $define) echo "#include <$2>";;
10079 esac ;
10080 shift 2;
10081done > try.c;
10082echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10083set try;
10084if eval $compile; then
10085 val="$define";
10086else
10087 val="$undef";
10088fi;
10089set $varname;
10090eval $setvar;
5b813a60 10091$rm_try'
10bc17b6
JH
10092
10093: see if we should include time.h, sys/time.h, or both
10094echo " "
10095if test "X$timeincl" = X; then
10096 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10097 $echo $n "I'm now running the test program...$c"
55954f19 10098 $cat >try.c <<EOCP
10bc17b6
JH
10099#include <sys/types.h>
10100#ifdef I_TIME
10101#include <time.h>
10102#endif
10103#ifdef I_SYSTIME
10104#ifdef SYSTIMEKERNEL
10105#define KERNEL
10106#endif
10107#include <sys/time.h>
10108#endif
10109#ifdef I_SYSSELECT
10110#include <sys/select.h>
10111#endif
55954f19
JH
10112#$i_stdlib I_STDLIB
10113#ifdef I_STDLIB
10114#include <stdlib.h>
10115#endif
10bc17b6
JH
10116int main()
10117{
10118 struct tm foo;
10119#ifdef S_TIMEVAL
10120 struct timeval bar;
10121#endif
10122#ifdef S_TIMEZONE
10123 struct timezone tzp;
10124#endif
10125 if (foo.tm_sec == foo.tm_sec)
10126 exit(0);
10127#ifdef S_TIMEVAL
10128 if (bar.tv_sec == bar.tv_sec)
10129 exit(0);
10130#endif
10131 exit(1);
10132}
10133EOCP
10134 flags=''
10135 for s_timezone in '-DS_TIMEZONE' ''; do
10136 sysselect=''
10137 for s_timeval in '-DS_TIMEVAL' ''; do
10138 for i_systimek in '' '-DSYSTIMEKERNEL'; do
10139 for i_time in '' '-DI_TIME'; do
10140 for i_systime in '-DI_SYSTIME' ''; do
10141 case "$flags" in
10142 '') $echo $n ".$c"
10143 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10144 if eval $compile; then
10145 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10146 shift
10147 flags="$*"
10148 echo " "
10149 $echo $n "Succeeded with $flags$c"
10150 fi
10151 ;;
10152 esac
10153 done
10154 done
10155 done
10156 done
10157 done
10158 timeincl=''
10159 echo " "
10160 case "$flags" in
10161 *SYSTIMEKERNEL*) i_systimek="$define"
10162 timeincl=`./findhdr sys/time.h`
10163 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10164 *) i_systimek="$undef";;
10165 esac
10166 case "$flags" in
10167 *I_TIME*) i_time="$define"
10168 timeincl=`./findhdr time.h`" $timeincl"
10169 echo "We'll include <time.h>." >&4;;
10170 *) i_time="$undef";;
10171 esac
10172 case "$flags" in
10173 *I_SYSTIME*) i_systime="$define"
10174 timeincl=`./findhdr sys/time.h`" $timeincl"
10175 echo "We'll include <sys/time.h>." >&4;;
10176 *) i_systime="$undef";;
10177 esac
5b813a60 10178 $rm_try
10bc17b6
JH
10179fi
10180: see if struct tm knows about tm_zone
10181case "$i_systime$i_time" in
5b813a60 10182*$define*)
10bc17b6
JH
10183 echo " "
10184 echo "Checking to see if your struct tm has tm_zone field..." >&4
10185 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10186 eval $hasfield
10187 ;;
10188*) val="$undef"
10189 set d_tm_tm_zone
10190 eval $setvar
10191 ;;
10192esac
10193case "$d_tm_tm_zone" in
10194"$define") echo "Yes, it does." ;;
10195*) echo "No, it doesn't." ;;
10196esac
10197: see if struct tm knows about tm_gmtoff
10198case "$i_systime$i_time" in
5b813a60 10199*$define*)
10bc17b6
JH
10200 echo " "
10201 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10202 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10203 eval $hasfield
10204 ;;
10205*) val="$undef"
10206 set d_tm_tm_gmtoff
10207 eval $setvar
10208 ;;
10209esac
10210case "$d_tm_tm_gmtoff" in
10211"$define") echo "Yes, it does." ;;
10212*) echo "No, it doesn't." ;;
10213esac
10214
10215: see if asctime_r exists
10216set asctime_r d_asctime_r
10217eval $inlibc
10218case "$d_asctime_r" in
10219"$define")
d63eadf0 10220 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
10221 case "$d_asctime_r_proto:$usethreads" in
10222 ":define") d_asctime_r_proto=define
a48ec845
JH
10223 set d_asctime_r_proto asctime_r $hdrs
10224 eval $hasproto ;;
10225 *) ;;
10226 esac
10227 case "$d_asctime_r_proto" in
10228 define)
10bc17b6
JH
10229 case "$asctime_r_proto" in
10230 ''|0) try='char* asctime_r(const struct tm*, char*);'
61c26d18 10231 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10bc17b6
JH
10232 esac
10233 case "$asctime_r_proto" in
10234 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
61c26d18 10235 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10bc17b6
JH
10236 esac
10237 case "$asctime_r_proto" in
10238 ''|0) try='int asctime_r(const struct tm*, char*);'
61c26d18 10239 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10bc17b6
JH
10240 esac
10241 case "$asctime_r_proto" in
10242 ''|0) try='int asctime_r(const struct tm*, char*, int);'
61c26d18 10243 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10bc17b6
JH
10244 esac
10245 case "$asctime_r_proto" in
90e831dc 10246 ''|0) d_asctime_r=undef
10bc17b6 10247 asctime_r_proto=0
a48ec845 10248 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10249 * ) case "$asctime_r_proto" in
10250 REENTRANT_PROTO*) ;;
10251 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10252 esac
10253 echo "Prototype: $try" ;;
10254 esac
10255 ;;
c18e646a
JH
10256 *) case "$usethreads" in
10257 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10258 esac
90e831dc
SB
10259 d_asctime_r=undef
10260 asctime_r_proto=0
c18e646a 10261 ;;
a48ec845
JH
10262 esac
10263 ;;
10bc17b6
JH
10264*) asctime_r_proto=0
10265 ;;
10266esac
10267
b4eb6b3d
JH
10268: see if atolf exists
10269set atolf d_atolf
10270eval $inlibc
10271
10272: see if atoll exists
10273set atoll d_atoll
10274eval $inlibc
10275
0dbb1585
AL
10276: Look for GCC-style attribute format
10277case "$d_attribute_format" in
bde30f85 10278'')
b4eb6b3d 10279echo " "
0dbb1585 10280echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
b4eb6b3d
JH
10281$cat >attrib.c <<'EOCP'
10282#include <stdio.h>
0dbb1585 10283void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
b4eb6b3d
JH
10284EOCP
10285if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10286 if $contains 'warning' attrib.out >/dev/null 2>&1; then
0dbb1585 10287 echo "Your C compiler doesn't support __attribute__((format))."
b4eb6b3d
JH
10288 val="$undef"
10289 else
0dbb1585 10290 echo "Your C compiler supports __attribute__((format))."
b4eb6b3d
JH
10291 val="$define"
10292 fi
10293else
10294 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10295 val="$undef"
10296fi
bde30f85 10297;;
0dbb1585 10298*) val="$d_attribute_format" ;;
bde30f85 10299esac
0dbb1585
AL
10300set d_attribute_format
10301eval $setvar
10302$rm -f attrib*
10303
dcb594bc
MB
10304: Look for GCC-style attribute format with null format allowed
10305case "$d_printf_format_null" in
10306'') case "$d_attribute_format" in
10307 $define)
10308 echo " "
10309 echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10310$cat >attrib.c <<EOCP
10311#include <stdio.h>
10312#$i_stdlib I_STDLIB
10313#ifdef I_STDLIB
10314#include <stdlib.h>
10315#endif
10316int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10317int null_printf (char* pat,...) { return (int)pat; }
10318int main () { exit(null_printf(NULL)); }
10319EOCP
10320 if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10321 : run the executable in case it produces a run-time warning
10322 if $run ./attrib >>attrib.out 2>&1; then
10323 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10324 echo "Your C compiler doesn't allow __printf__ format to be null."
10325 val="$undef"
10326 else
10327 echo "Your C compiler allows __printf__ format to be null."
10328 val="$define"
10329 fi
10330 else
10331 echo "Your C compiler executable failed with __printf__ format null."
10332 val="$undef"
10333 fi
10334 else
10335 echo "Your C compiler fails with __printf__ format null."
10336 val="$undef"
10337 fi
10338 ;;
10339 *) val="$undef" ;;
10340 esac
10341;;
10342*) val="$d_printf_format_null" ;;
10343esac
10344set d_printf_format_null
10345eval $setvar
10346$rm -f attrib*
10347
0dbb1585
AL
10348: Look for GCC-style attribute malloc
10349case "$d_attribute_malloc" in
10350'')
10351echo " "
10352echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10353$cat >attrib.c <<'EOCP'
10354#include <stdio.h>
10355char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10356EOCP
10357if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10358 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10359 echo "Your C compiler doesn't support __attribute__((malloc))."
10360 val="$undef"
10361 else
10362 echo "Your C compiler supports __attribute__((malloc))."
10363 val="$define"
10364 fi
10365else
10366 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10367 val="$undef"
10368fi
10369;;
10370*) val="$d_attribute_malloc" ;;
10371esac
10372set d_attribute_malloc
10373eval $setvar
10374$rm -f attrib*
10375
10376: Look for GCC-style attribute nonnull
10377case "$d_attribute_nonnull" in
10378'')
10379echo " "
10380echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10381$cat >attrib.c <<'EOCP'
10382#include <stdio.h>
10383void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10384EOCP
10385if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10386 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10387 echo "Your C compiler doesn't support __attribute__((nonnull))."
10388 val="$undef"
10389 else
10390 echo "Your C compiler supports __attribute__((nonnull))."
10391 val="$define"
10392 fi
10393else
10394 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10395 val="$undef"
10396fi
10397;;
10398*) val="$d_attribute_nonnull" ;;
10399esac
10400set d_attribute_nonnull
10401eval $setvar
10402$rm -f attrib*
10403
10404: Look for GCC-style attribute noreturn
10405case "$d_attribute_noreturn" in
10406'')
10407echo " "
10408echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10409$cat >attrib.c <<'EOCP'
10410#include <stdio.h>
10411void fall_over_dead( void ) __attribute__((noreturn));
10412EOCP
10413if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10414 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10415 echo "Your C compiler doesn't support __attribute__((noreturn))."
10416 val="$undef"
10417 else
10418 echo "Your C compiler supports __attribute__((noreturn))."
10419 val="$define"
10420 fi
10421else
10422 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10423 val="$undef"
10424fi
10425;;
10426*) val="$d_attribute_noreturn" ;;
10427esac
10428set d_attribute_noreturn
10429eval $setvar
10430$rm -f attrib*
10431
10432: Look for GCC-style attribute pure
10433case "$d_attribute_pure" in
10434'')
10435echo " "
10436echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10437$cat >attrib.c <<'EOCP'
10438#include <stdio.h>
10439int square( int n ) __attribute__((pure));
10440EOCP
10441if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10442 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10443 echo "Your C compiler doesn't support __attribute__((pure))."
10444 val="$undef"
10445 else
10446 echo "Your C compiler supports __attribute__((pure))."
10447 val="$define"
10448 fi
10449else
10450 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10451 val="$undef"
10452fi
10453;;
10454*) val="$d_attribute_pure" ;;
10455esac
10456set d_attribute_pure
10457eval $setvar
10458$rm -f attrib*
10459
10460: Look for GCC-style attribute unused
10461case "$d_attribute_unused" in
10462'')
10463echo " "
10464echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10465$cat >attrib.c <<'EOCP'
10466#include <stdio.h>
10467int do_something( int dummy __attribute__((unused)), int n );
10468EOCP
10469if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10470 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10471 echo "Your C compiler doesn't support __attribute__((unused))."
10472 val="$undef"
10473 else
10474 echo "Your C compiler supports __attribute__((unused))."
10475 val="$define"
10476 fi
10477else
10478 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10479 val="$undef"
10480fi
10481;;
10482*) val="$d_attribute_unused" ;;
10483esac
10484set d_attribute_unused
10485eval $setvar
10486$rm -f attrib*
10487
fcdf39cf
RGS
10488: Look for GCC-style attribute deprecated
10489case "$d_attribute_deprecated" in
10490'')
10491echo " "
10492echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10493$cat >attrib.c <<'EOCP'
10494#include <stdio.h>
10495int I_am_deprecated(void) __attribute__((deprecated));
10496EOCP
10497if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10498 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10499 echo "Your C compiler doesn't support __attribute__((deprecated))."
10500 val="$undef"
10501 else
10502 echo "Your C compiler supports __attribute__((deprecated))."
10503 val="$define"
10504 fi
10505else
10506 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10507 val="$undef"
10508fi
10509;;
10510*) val="$d_attribute_deprecated" ;;
10511esac
10512set d_attribute_deprecated
10513eval $setvar
10514$rm -f attrib*
10515
0dbb1585
AL
10516: Look for GCC-style attribute warn_unused_result
10517case "$d_attribute_warn_unused_result" in
10518'')
10519echo " "
10520echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10521$cat >attrib.c <<'EOCP'
10522#include <stdio.h>
10523int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10524EOCP
10525if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10526 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10527 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10528 val="$undef"
10529 else
10530 echo "Your C compiler supports __attribute__((warn_unused_result))."
10531 val="$define"
10532 fi
10533else
10534 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10535 val="$undef"
10536fi
10537;;
10538*) val="$d_attribute_warn_unused_result" ;;
10539esac
10540set d_attribute_warn_unused_result
b4eb6b3d
JH
10541eval $setvar
10542$rm -f attrib*
10543
10544: see if bcmp exists
10545set bcmp d_bcmp
10546eval $inlibc
10547
10548: see if bcopy exists
10549set bcopy d_bcopy
10550eval $inlibc
10551
b4eb6b3d
JH
10552: see if getpgrp exists
10553set getpgrp d_getpgrp
10554eval $inlibc
10555
10556case "$d_getpgrp" in
10557"$define")
10558 echo " "
10559 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 10560 $cat >try.c <<EOP
b4eb6b3d
JH
10561#$i_unistd I_UNISTD
10562#include <sys/types.h>
10563#ifdef I_UNISTD
10564# include <unistd.h>
10565#endif
55954f19
JH
10566#$i_stdlib I_STDLIB
10567#ifdef I_STDLIB
10568#include <stdlib.h>
10569#endif
b4eb6b3d
JH
10570int main()
10571{
10572 if (getuid() == 0) {
10573 printf("(I see you are running Configure as super-user...)\n");
10574 setuid(1);
10575 }
10576#ifdef TRY_BSD_PGRP
10577 if (getpgrp(1) == 0)
10578 exit(0);
10579#else
10580 if (getpgrp() > 0)
10581 exit(0);
10582#endif
10583 exit(1);
10584}
10585EOP
5440bc8e 10586 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10587 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10588 val="$define"
5440bc8e 10589 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10590 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10591 val="$undef"
10592 else
10593 echo "I can't seem to compile and run the test program."
10594 if ./usg; then
10595 xxx="a USG one, i.e. you use getpgrp()."
10596 else
10597 # SVR4 systems can appear rather BSD-ish.
10598 case "$i_unistd" in
10599 $undef)
10600 xxx="a BSD one, i.e. you use getpgrp(pid)."
10601 val="$define"
10602 ;;
10603 $define)
10604 xxx="probably a USG one, i.e. you use getpgrp()."
10605 val="$undef"
10606 ;;
10607 esac
10608 fi
10609 echo "Assuming your getpgrp is $xxx" >&4
10610 fi
10611 ;;
10612*) val="$undef";;
10613esac
10614set d_bsdgetpgrp
10615eval $setvar
5b813a60 10616$rm_try
b4eb6b3d
JH
10617
10618: see if setpgrp exists
10619set setpgrp d_setpgrp
10620eval $inlibc
10621
10622case "$d_setpgrp" in
10623"$define")
10624 echo " "
10625 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 10626 $cat >try.c <<EOP
b4eb6b3d
JH
10627#$i_unistd I_UNISTD
10628#include <sys/types.h>
10629#ifdef I_UNISTD
10630# include <unistd.h>
10631#endif
55954f19
JH
10632#$i_stdlib I_STDLIB
10633#ifdef I_STDLIB
10634#include <stdlib.h>
10635#endif
b4eb6b3d
JH
10636int main()
10637{
10638 if (getuid() == 0) {
10639 printf("(I see you are running Configure as super-user...)\n");
10640 setuid(1);
10641 }
10642#ifdef TRY_BSD_PGRP
10643 if (-1 == setpgrp(1, 1))
10644 exit(0);
10645#else
10646 if (setpgrp() != -1)
10647 exit(0);
10648#endif
10649 exit(1);
10650}
10651EOP
5440bc8e 10652 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10653 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10654 val="$define"
5440bc8e 10655 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10656 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10657 val="$undef"
10658 else
10659 echo "(I can't seem to compile and run the test program.)"
10660 if ./usg; then
10661 xxx="a USG one, i.e. you use setpgrp()."
10662 else
10663 # SVR4 systems can appear rather BSD-ish.
10664 case "$i_unistd" in
10665 $undef)
10666 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10667 val="$define"
10668 ;;
10669 $define)
10670 xxx="probably a USG one, i.e. you use setpgrp()."
10671 val="$undef"
10672 ;;
10673 esac
10674 fi
10675 echo "Assuming your setpgrp is $xxx" >&4
10676 fi
10677 ;;
10678*) val="$undef";;
10679esac
10680set d_bsdsetpgrp
10681eval $setvar
5b813a60
MB
10682$rm_try
10683
635aebb7
AL
10684: Look for GCC-style __builtin_choose_expr
10685case "$d_builtin_choose_expr" in
10686'')
10687 echo " "
10688 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10689 $cat >try.c <<'EOCP'
10690#include <assert.h>
10691#include <stdlib.h>
10692#include <stdio.h>
10693
10694#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10695
10696int main(void) {
10697 assert( SYRINX(1) == 2112 );
10698 assert( SYRINX(1) != 5150 );
10699 assert( SYRINX(0) == 5150 );
10700 assert( SYRINX(0) != 2112 );
10701 puts( "All good!" );
10702 exit(0);
10703}
10704
10705EOCP
10706 set try
70ceb34a 10707 if eval $compile && $run ./try; then
635aebb7
AL
10708 echo "Your C compiler supports __builtin_choose_expr."
10709 val="$define"
10710 else
10711 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10712 val="$undef"
10713 fi
10714;;
10715*) val="$d_builtin_choose_expr" ;;
10716esac
10717
10718set d_builtin_choose_expr
10719eval $setvar
5b813a60 10720$rm_try
635aebb7
AL
10721
10722: Look for GCC-style __builtin_expect
10723case "$d_builtin_expect" in
10724'')
10725 echo " "
10726 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
70ceb34a 10727 $cat >try.c <<'EOCP'
635aebb7
AL
10728int main(void) {
10729 int n = 50;
10730 if ( __builtin_expect(n, 0) ) n = 1;
70ceb34a
NC
10731 /* Remember shell exit code truth is 0, C truth is non-zero */
10732 return !(n == 1);
635aebb7
AL
10733}
10734EOCP
10735 set try
70ceb34a
NC
10736 if eval $compile && $run ./try; then
10737 echo "Your C compiler supports __builtin_expect."
635aebb7
AL
10738 val="$define"
10739 else
70ceb34a 10740 echo "Your C compiler doesn't seem to understand __builtin_expect."
635aebb7
AL
10741 val="$undef"
10742 fi
10743 ;;
10744*) val="$d_builtin_expect" ;;
10745esac
10746
10747set d_builtin_expect
10748eval $setvar
5b813a60 10749$rm_try
635aebb7 10750
b4eb6b3d
JH
10751: see if bzero exists
10752set bzero d_bzero
10753eval $inlibc
10754
a2d23ec2
MB
10755: see if stdarg is available
10756echo " "
10757if $test `./findhdr stdarg.h`; then
10758 echo "<stdarg.h> found." >&4
10759 valstd="$define"
10760else
10761 echo "<stdarg.h> NOT found." >&4
10762 valstd="$undef"
10763fi
10764
10765: see if varags is available
10766echo " "
10767if $test `./findhdr varargs.h`; then
10768 echo "<varargs.h> found." >&4
10769else
10770 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10771fi
10772
10773: set up the varargs testing programs
10774$cat > varargs.c <<EOP
10775#ifdef I_STDARG
10776#include <stdarg.h>
10777#endif
10778#ifdef I_VARARGS
10779#include <varargs.h>
10780#endif
10781
10782#ifdef I_STDARG
10783int f(char *p, ...)
10784#else
10785int f(va_alist)
10786va_dcl
10787#endif
10788{
10789 va_list ap;
10790#ifndef I_STDARG
10791 char *p;
10792#endif
10793#ifdef I_STDARG
10794 va_start(ap,p);
10795#else
10796 va_start(ap);
10797 p = va_arg(ap, char *);
10798#endif
10799 va_end(ap);
4fb7dc7d 10800 return 0;
a2d23ec2
MB
10801}
10802EOP
10803$cat > varargs <<EOP
10804$startsh
10805if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10806 echo "true"
10807else
10808 echo "false"
10809fi
10810$rm -f varargs$_o
10811EOP
10812chmod +x varargs
10813
10814: now check which varargs header should be included
10815echo " "
10816i_varhdr=''
10817case "$valstd" in
10818"$define")
10819 if `./varargs I_STDARG`; then
10820 val='stdarg.h'
10821 elif `./varargs I_VARARGS`; then
10822 val='varargs.h'
10823 fi
10824 ;;
10825*)
10826 if `./varargs I_VARARGS`; then
10827 val='varargs.h'
10828 fi
10829 ;;
10830esac
10831case "$val" in
10832'')
10833echo "I could not find the definition for va_dcl... You have problems..." >&4
10834 val="$undef"; set i_stdarg; eval $setvar
10835 val="$undef"; set i_varargs; eval $setvar
10836 ;;
613d6c3e 10837*)
a2d23ec2
MB
10838 set i_varhdr
10839 eval $setvar
10840 case "$i_varhdr" in
10841 stdarg.h)
10842 val="$define"; set i_stdarg; eval $setvar
10843 val="$undef"; set i_varargs; eval $setvar
10844 ;;
10845 varargs.h)
10846 val="$undef"; set i_stdarg; eval $setvar
10847 val="$define"; set i_varargs; eval $setvar
10848 ;;
10849 esac
10850 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10851esac
10852$rm -f varargs*
10853
10854: see if the Compiler supports C99 variadic macros
10855case "$i_stdarg$i_stdlib" in
10856 "$define$define")
10857 echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10858 $cat >try.c <<EOCP
10859#include <stdio.h>
10860#include <stdarg.h>
10861
10862#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10863
10864int main() {
10865 char buf[20];
10866 foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10867 puts(buf);
10868 return 0;
10869}
10870EOCP
10871 set try
10872 if eval $compile && $run ./try 2>&1 >/dev/null; then
10873 case "`$run ./try`" in
10874 "123 456 789")
10875 echo "You have C99 variadic macros." >&4
10876 d_c99_variadic_macros="$define"
10877 ;;
10878 *)
10879 echo "You don't have functional C99 variadic macros." >&4
10880 d_c99_variadic_macros="$undef"
10881 ;;
10882 esac
10883 else
10884 echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10885 d_c99_variadic_macros="$undef"
10886 fi
5b813a60 10887 $rm_try
a2d23ec2
MB
10888 ;;
10889 *)
10890 echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10891 d_c99_variadic_macros="$undef"
10892 ;;
10893esac
10894
b4eb6b3d
JH
10895: see if signal is declared as pointer to function returning int or void
10896echo " "
10897xxx=`./findhdr signal.h`
10898$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10899if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10900 echo "You have int (*signal())() instead of void." >&4
10901 val="$undef"
10902elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10903 echo "You have void (*signal())()." >&4
10904 val="$define"
10905elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10906 echo "You have int (*signal())() instead of void." >&4
10907 val="$undef"
10908elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10909 echo "You have void (*signal())()." >&4
10910 val="$define"
10911else
10912 case "$d_voidsig" in
10913 '')
10914 echo "I can't determine whether signal handler returns void or int..." >&4
10915 dflt=void
10916 rp="What type does your signal handler return?"
10917 . ./myread
10918 case "$ans" in
10919 v*) val="$define";;
10920 *) val="$undef";;
10921 esac;;
10922 "$define")
10923 echo "As you already told me, signal handler returns void." >&4
10924 val="$define"
10925 ;;
10926 *) echo "As you already told me, signal handler returns int." >&4
10927 val="$undef"
10928 ;;
10929 esac
10930fi
10931set d_voidsig
10932eval $setvar
10933case "$d_voidsig" in
10934"$define") signal_t="void";;
10935*) signal_t="int";;
10936esac
10937$rm -f $$.tmp
10938
10939: check for ability to cast large floats to 32-bit ints.
10940echo " "
10941echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10942if $test "$intsize" -ge 4; then
10943 xxx=int
10944else
10945 xxx=long
10946fi
10947$cat >try.c <<EOCP
10948#include <stdio.h>
d1daaddf
JH
10949#$i_stdlib I_STDLIB
10950#ifdef I_STDLIB
10951#include <stdlib.h>
10952#endif
b4eb6b3d
JH
10953#include <sys/types.h>
10954#include <signal.h>
7090f861 10955$signal_t blech(int s) { exit(3); }
b4eb6b3d
JH
10956int main()
10957{
10958 $xxx i32;
10959 double f, g;
10960 int result = 0;
10961 char str[16];
10962 signal(SIGFPE, blech);
10963
5b813a60 10964 /* Don't let compiler optimize the test away. Store the number
e237eb00 10965 in a writable string for gcc to pass to sscanf under HP-UX.
b4eb6b3d
JH
10966 */
10967 sprintf(str, "2147483647");
10968 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10969 g = 10 * f;
10970 i32 = ($xxx) g;
10971
10972 /* x86 processors will probably give 0x8000 0000, which is a
4a39fcde 10973 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
10974 behavior here, which is to preserve the sign and give
10975 back 0x7fff ffff.
10976 */
10977 if (i32 != ($xxx) f)
10978 result |= 1;
10979 exit(result);
10980}
10981EOCP
10982set try
10983if eval $compile_ok; then
5440bc8e 10984 $run ./try
b4eb6b3d
JH
10985 yyy=$?
10986else
10987 echo "(I can't seem to compile the test program--assuming it can't)"
10988 yyy=1
10989fi
10990case "$yyy" in
109910) val="$define"
10992 echo "Yup, it can."
10993 ;;
10994*) val="$undef"
10995 echo "Nope, it can't."
10996 ;;
10997esac
10998set d_casti32
10999eval $setvar
5b813a60 11000$rm_try
b4eb6b3d
JH
11001
11002: check for ability to cast negative floats to unsigned
11003echo " "
11004echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11005$cat >try.c <<EOCP
11006#include <stdio.h>
d1daaddf
JH
11007#$i_stdlib I_STDLIB
11008#ifdef I_STDLIB
11009#include <stdlib.h>
11010#endif
b4eb6b3d
JH
11011#include <sys/types.h>
11012#include <signal.h>
7090f861
JH
11013$signal_t blech(int s) { exit(7); }
11014$signal_t blech_in_list(int s) { exit(4); }
11015unsigned long dummy_long(unsigned long p) { return p; }
11016unsigned int dummy_int(unsigned int p) { return p; }
11017unsigned short dummy_short(unsigned short p) { return p; }
b4eb6b3d
JH
11018int main()
11019{
11020 double f;
11021 unsigned long along;
11022 unsigned int aint;
11023 unsigned short ashort;
11024 int result = 0;
11025 char str[16];
5b813a60 11026
b4eb6b3d
JH
11027 /* Frustrate gcc-2.7.2's optimizer which failed this test with
11028 a direct f = -123. assignment. gcc-2.8.0 reportedly
11029 optimized the whole file away
11030 */
5b813a60 11031 /* Store the number in a writable string for gcc to pass to
e237eb00 11032 sscanf under HP-UX.
b4eb6b3d
JH
11033 */
11034 sprintf(str, "-123");
11035 sscanf(str, "%lf", &f); /* f = -123.; */
11036
11037 signal(SIGFPE, blech);
11038 along = (unsigned long)f;
11039 aint = (unsigned int)f;
11040 ashort = (unsigned short)f;
11041 if (along != (unsigned long)-123)
11042 result |= 1;
11043 if (aint != (unsigned int)-123)
11044 result |= 1;
11045 if (ashort != (unsigned short)-123)
11046 result |= 1;
11047 sprintf(str, "1073741824.");
11048 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11049 f = f + f;
11050 along = 0;
11051 along = (unsigned long)f;
11052 if (along != 0x80000000)
11053 result |= 2;
11054 f -= 1.;
11055 along = 0;
11056 along = (unsigned long)f;
11057 if (along != 0x7fffffff)
11058 result |= 1;
11059 f += 2.;
11060 along = 0;
11061 along = (unsigned long)f;
11062 if (along != 0x80000001)
11063 result |= 2;
11064 if (result)
11065 exit(result);
11066 signal(SIGFPE, blech_in_list);
11067 sprintf(str, "123.");
11068 sscanf(str, "%lf", &f); /* f = 123.; */
11069 along = dummy_long((unsigned long)f);
11070 aint = dummy_int((unsigned int)f);
11071 ashort = dummy_short((unsigned short)f);
11072 if (along != (unsigned long)123)
11073 result |= 4;
11074 if (aint != (unsigned int)123)
11075 result |= 4;
11076 if (ashort != (unsigned short)123)
11077 result |= 4;
11078 exit(result);
11079
11080}
11081EOCP
11082set try
11083if eval $compile_ok; then
5440bc8e 11084 $run ./try
b4eb6b3d
JH
11085 castflags=$?
11086else
11087 echo "(I can't seem to compile the test program--assuming it can't)"
11088 castflags=7
11089fi
11090case "$castflags" in
110910) val="$define"
11092 echo "Yup, it can."
11093 ;;
11094*) val="$undef"
11095 echo "Nope, it can't."
11096 ;;
11097esac
11098set d_castneg
11099eval $setvar
5b813a60 11100$rm_try
b4eb6b3d
JH
11101
11102: see if vprintf exists
11103echo " "
11104if set vprintf val -f d_vprintf; eval $csym; $val; then
11105 echo 'vprintf() found.' >&4
11106 val="$define"
55954f19 11107 $cat >try.c <<EOF
d0bc9cc8
AD
11108#$i_stdarg I_STDARG /* Only one of these can be defined by i_varhrd */
11109#$i_varargs I_VARARGS
11110
55954f19 11111#$i_stdlib I_STDLIB
d0bc9cc8
AD
11112#$i_unistd I_UNISTD
11113
11114#ifdef I_STDARG
11115# include <stdarg.h>
11116#else /* I_VARARGS */
11117# include <varargs.h>
11118#endif
11119
11120#ifdef I_UNISTD
11121# include <unistd.h>
11122#endif
11123
55954f19 11124#ifdef I_STDLIB
d0bc9cc8 11125# include <stdlib.h>
55954f19 11126#endif
b4eb6b3d 11127
d0bc9cc8
AD
11128#include <stdio.h> /* vsprintf prototype */
11129
11130#ifdef I_STDARG
11131void xxx(int n, ...)
11132{
11133 va_list args;
11134 char buf[10];
11135 va_start(args, n);
11136 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11137}
11138int main() { xxx(1, "foo"); }
11139
11140#else /* I_VARARGS */
b4eb6b3d
JH
11141
11142xxx(va_alist)
11143va_dcl
11144{
d0bc9cc8
AD
11145 va_list args;
11146 char buf[10];
11147 va_start(args);
11148 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
b4eb6b3d 11149}
d0bc9cc8
AD
11150int main() { xxx("foo"); }
11151
11152#endif
11153
b4eb6b3d 11154EOF
5440bc8e 11155 set try
d0bc9cc8
AD
11156 if eval $compile_ok; then
11157 if $run ./try; then
11158 echo "Your vsprintf() returns (int)." >&4
11159 val2="$undef"
11160 else
11161 echo "Your vsprintf() returns (char*)." >&4
11162 val2="$define"
11163 fi
b4eb6b3d 11164 else
d0bc9cc8
AD
11165 echo 'I am unable to compile the vsprintf() test program.' >&4
11166 # We shouldn't get here. If we do, assume the standard signature,
11167 # not the old BSD one.
11168 echo 'Guessing that vsprintf() returns (int).' >&4
11169 val2="$undef"
b4eb6b3d
JH
11170 fi
11171else
11172 echo 'vprintf() NOT found.' >&4
d0bc9cc8
AD
11173 val="$undef"
11174 val2="$undef"
b4eb6b3d 11175fi
5b813a60 11176$rm_try
b4eb6b3d
JH
11177set d_vprintf
11178eval $setvar
11179val=$val2
11180set d_charvspr
11181eval $setvar
11182
11183: see if chown exists
11184set chown d_chown
11185eval $inlibc
11186
11187: see if chroot exists
11188set chroot d_chroot
11189eval $inlibc
11190
11191: see if chsize exists
11192set chsize d_chsize
11193eval $inlibc
11194
758a5d79
JH
11195: see if class exists
11196set class d_class
11197eval $inlibc
11198
b0a2e8e6
MB
11199: see if clearenv exists
11200set clearenv d_clearenv
11201eval $inlibc
11202
34f1896b 11203: Define hasstruct macro for Configure internal use
4e0554ec
JH
11204hasstruct='varname=$1; struct=$2; shift; shift;
11205while $test $# -ge 2; do
11206 case "$1" in
11207 $define) echo "#include <$2>";;
11208 esac ;
11209 shift 2;
11210done > try.c;
11211echo "int main () { struct $struct foo; }" >> try.c;
11212set try;
11213if eval $compile; then
11214 val="$define";
11215else
11216 val="$undef";
11217fi;
11218set $varname;
11219eval $setvar;
5b813a60 11220$rm_try'
4e0554ec 11221
34f1896b 11222: see whether socket exists
4e0554ec
JH
11223socketlib=''
11224sockethdr=''
4e0554ec
JH
11225echo " "
11226$echo $n "Hmm... $c" >&4
11227if set socket val -f d_socket; eval $csym; $val; then
11228 echo "Looks like you have Berkeley networking support." >&4
11229 d_socket="$define"
11230 if set setsockopt val -f; eval $csym; $val; then
11231 d_oldsock="$undef"
11232 else
11233 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11234 d_oldsock="$define"
11235 fi
11236else
11237 if $contains socklib libc.list >/dev/null 2>&1; then
11238 echo "Looks like you have Berkeley networking support." >&4
11239 d_socket="$define"
11240 : we will have to assume that it supports the 4.2 BSD interface
11241 d_oldsock="$undef"
11242 else
11243 echo "You don't have Berkeley networking in libc$_a..." >&4
11244 if test "X$d_socket" = "X$define"; then
11245 echo "...but you seem to believe that you have sockets." >&4
11246 else
11247 for net in net socket
11248 do
11249 if test -f /usr/lib/lib$net$_a; then
11250 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
11251 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11252 if $contains socket libc.list >/dev/null 2>&1; then
11253 d_socket="$define"
11254 socketlib="-l$net"
11255 case "$net" in
11256 net)
11257 echo "...but the Wollongong group seems to have hacked it in." >&4
11258 sockethdr="-I/usr/netinclude"
11259 ;;
11260 esac
5b813a60 11261 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
11262 if $contains setsockopt libc.list >/dev/null 2>&1; then
11263 d_oldsock="$undef"
11264 else
11265 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11266 d_oldsock="$define"
11267 fi
11268 break
11269 fi
11270 fi
11271 done
11272 if test "X$d_socket" != "X$define"; then
11273 echo "or anywhere else I see." >&4
11274 d_socket="$undef"
11275 d_oldsock="$undef"
11276 fi
11277 fi
11278 fi
11279fi
11280
11281: see if socketpair exists
11282set socketpair d_sockpair
11283eval $inlibc
11284
11285
11286echo " "
b8677e3b
MB
11287echo "Checking the availability sa_len in the sock struct ..." >&4
11288$cat >try.c <<EOF
11289#include <sys/types.h>
11290#include <sys/socket.h>
11291int main() {
11292struct sockaddr sa;
11293return (sa.sa_len);
11294}
11295EOF
11296val="$undef"
11297set try; if eval $compile; then
11298 val="$define"
11299fi
11300set d_sockaddr_sa_len; eval $setvar
11301$rm_try
11302
11303echo " "
18126d98
MB
11304echo "Checking the availability struct sockaddr_in6 ..." >&4
11305$cat >try.c <<EOF
11306#include <sys/types.h>
11307#include <sys/socket.h>
11308#include <netinet/in.h>
11309int main() {
11310struct sockaddr_in6 sin6;
11311return (sin6.sin6_family);
11312}
11313EOF
11314val="$undef"
11315set try; if eval $compile; then
11316 val="$define"
11317fi
11318set d_sockaddr_in6; eval $setvar
11319$rm_try
11320
11321echo " "
f53580fe
MB
11322echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11323$cat >try.c <<EOF
11324#include <sys/types.h>
11325#include <sys/socket.h>
11326#include <netinet/in.h>
11327int main() {
11328struct sockaddr_in6 sin6;
11329return (sin6.sin6_scope_id);
11330}
11331EOF
11332val="$undef"
11333set try; if eval $compile; then
11334 val="$define"
11335fi
11336set d_sin6_scope_id; eval $setvar
11337$rm_try
11338
11339echo " "
18126d98
MB
11340echo "Checking the availability struct ipv6_mreq ..." >&4
11341$cat >try.c <<EOF
11342#include <sys/types.h>
11343#include <sys/socket.h>
11344#include <netinet/in.h>
11345int main() {
11346struct ipv6_mreq mreq;
11347return (mreq.ipv6mr_interface);
11348}
11349EOF
11350val="$undef"
11351set try; if eval $compile; then
11352 val="$define"
11353fi
11354set d_ipv6_mreq; eval $setvar
11355$rm_try
11356
11357echo " "
3c728e00 11358echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
11359for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11360 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11361 $cat >try.c <<EOF
11362#include <sys/types.h>
11363#include <sys/socket.h>
11364int main() {
11365 int i = $ENUM;
11366}
11367EOF
11368 val="$undef"
11369 set try; if eval $compile; then
11370 val="$define"
11371 fi
11372 set d_${enum}; eval $setvar
5b813a60 11373 $rm_try
4e0554ec
JH
11374done
11375
11376: see if this is a sys/uio.h system
11377set sys/uio.h i_sysuio
11378eval $inhdr
11379
34f1896b 11380: Check for cmsghdr support
4e0554ec
JH
11381echo " "
11382echo "Checking to see if your system supports struct cmsghdr..." >&4
11383set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11384eval $hasstruct
11385case "$d_cmsghdr_s" in
11386"$define") echo "Yes, it does." ;;
11387*) echo "No, it doesn't." ;;
11388esac
11389
11390
b4eb6b3d
JH
11391: check for const keyword
11392echo " "
11393echo 'Checking to see if your C compiler knows about "const"...' >&4
11394$cat >const.c <<'EOCP'
11395typedef struct spug { int drokk; } spug;
76f47787 11396int main()
b4eb6b3d
JH
11397{
11398 const char *foo;
666ea192 11399 const spug y = { 0 };
b4eb6b3d
JH
11400}
11401EOCP
11402if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11403 val="$define"
11404 echo "Yup, it does."
11405else
11406 val="$undef"
11407 echo "Nope, it doesn't."
11408fi
11409set d_const
11410eval $setvar
11411
89ce900e
JH
11412: see if copysignl exists
11413set copysignl d_copysignl
11414eval $inlibc
11415
b4eb6b3d
JH
11416: see if crypt exists
11417echo " "
a5a94ea5
JH
11418set crypt d_crypt
11419eval $inlibc
11420case "$d_crypt" in
11421$define) cryptlib='' ;;
11422*) if set crypt val -f d_crypt; eval $csym; $val; then
11423 echo 'crypt() found.' >&4
b4eb6b3d 11424 val="$define"
a5a94ea5
JH
11425 cryptlib=''
11426 else
11427 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11428 if $test -z "$cryptlib"; then
11429 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11430 else
11431 cryptlib=-lcrypt
11432 fi
11433 if $test -z "$cryptlib"; then
11434 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11435 else
11436 cryptlib=-lcrypt
11437 fi
11438 if $test -z "$cryptlib"; then
11439 cryptlib=`./loc libcrypt$_a "" $libpth`
11440 else
11441 cryptlib=-lcrypt
11442 fi
11443 if $test -z "$cryptlib"; then
11444 echo 'crypt() NOT found.' >&4
11445 val="$undef"
11446 else
11447 val="$define"
11448 fi
b4eb6b3d 11449 fi
a5a94ea5
JH
11450 set d_crypt
11451 eval $setvar
11452 ;;
11453esac
b4eb6b3d 11454
10bc17b6
JH
11455: see if this is a crypt.h system
11456set crypt.h i_crypt
11457eval $inhdr
11458
11459: see if crypt_r exists
11460set crypt_r d_crypt_r
11461eval $inlibc
11462case "$d_crypt_r" in
11463"$define")
11464 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
11465 case "$d_crypt_r_proto:$usethreads" in
11466 ":define") d_crypt_r_proto=define
a48ec845
JH
11467 set d_crypt_r_proto crypt_r $hdrs
11468 eval $hasproto ;;
11469 *) ;;
11470 esac
11471 case "$d_crypt_r_proto" in
11472 define)
10bc17b6
JH
11473 case "$crypt_r_proto" in
11474 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
61c26d18 11475 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
10bc17b6
JH
11476 esac
11477 case "$crypt_r_proto" in
b430fd04 11478 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
61c26d18 11479 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
b430fd04
JH
11480 esac
11481 case "$crypt_r_proto" in
90e831dc 11482 ''|0) d_crypt_r=undef
10bc17b6 11483 crypt_r_proto=0
a48ec845 11484 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11485 * ) case "$crypt_r_proto" in
11486 REENTRANT_PROTO*) ;;
11487 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11488 esac
11489 echo "Prototype: $try" ;;
11490 esac
11491 ;;
c18e646a
JH
11492 *) case "$usethreads" in
11493 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11494 esac
90e831dc
SB
11495 d_crypt_r=undef
11496 crypt_r_proto=0
c18e646a 11497 ;;
a48ec845
JH
11498 esac
11499 ;;
10bc17b6
JH
11500*) crypt_r_proto=0
11501 ;;
11502esac
11503
b4eb6b3d
JH
11504: get csh whereabouts
11505case "$csh" in
11506'csh') val="$undef" ;;
11507*) val="$define" ;;
11508esac
11509set d_csh
11510eval $setvar
11511: Respect a hint or command line value for full_csh.
11512case "$full_csh" in
11513'') full_csh=$csh ;;
11514esac
11515
13cfc98d
MB
11516: see if ctermid exists
11517set ctermid d_ctermid
11518eval $inlibc
11519
10bc17b6
JH
11520: see if ctermid_r exists
11521set ctermid_r d_ctermid_r
11522eval $inlibc
11523case "$d_ctermid_r" in
11524"$define")
31ee0cb7 11525 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
11526 case "$d_ctermid_r_proto:$usethreads" in
11527 ":define") d_ctermid_r_proto=define
a48ec845
JH
11528 set d_ctermid_r_proto ctermid_r $hdrs
11529 eval $hasproto ;;
11530 *) ;;
11531 esac
11532 case "$d_ctermid_r_proto" in
11533 define)
10bc17b6
JH
11534 case "$ctermid_r_proto" in
11535 ''|0) try='char* ctermid_r(char*);'
61c26d18 11536 ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
10bc17b6
JH
11537 esac
11538 case "$ctermid_r_proto" in
90e831dc 11539 ''|0) d_ctermid_r=undef
10bc17b6 11540 ctermid_r_proto=0
a48ec845 11541 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11542 * ) case "$ctermid_r_proto" in
11543 REENTRANT_PROTO*) ;;
11544 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11545 esac
11546 echo "Prototype: $try" ;;
11547 esac
11548 ;;
c18e646a
JH
11549 *) case "$usethreads" in
11550 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11551 esac
90e831dc
SB
11552 d_ctermid_r=undef
11553 ctermid_r_proto=0
c18e646a 11554 ;;
a48ec845
JH
11555 esac
11556 ;;
10bc17b6
JH
11557*) ctermid_r_proto=0
11558 ;;
11559esac
11560
11561: see if ctime_r exists
11562set ctime_r d_ctime_r
11563eval $inlibc
11564case "$d_ctime_r" in
11565"$define")
d63eadf0 11566 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
11567 case "$d_ctime_r_proto:$usethreads" in
11568 ":define") d_ctime_r_proto=define
a48ec845
JH
11569 set d_ctime_r_proto ctime_r $hdrs
11570 eval $hasproto ;;
11571 *) ;;
11572 esac
11573 case "$d_ctime_r_proto" in
11574 define)
10bc17b6
JH
11575 case "$ctime_r_proto" in
11576 ''|0) try='char* ctime_r(const time_t*, char*);'
61c26d18 11577 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
10bc17b6
JH
11578 esac
11579 case "$ctime_r_proto" in
11580 ''|0) try='char* ctime_r(const time_t*, char*, int);'
61c26d18 11581 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
10bc17b6
JH
11582 esac
11583 case "$ctime_r_proto" in
11584 ''|0) try='int ctime_r(const time_t*, char*);'
61c26d18 11585 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
10bc17b6
JH
11586 esac
11587 case "$ctime_r_proto" in
11588 ''|0) try='int ctime_r(const time_t*, char*, int);'
61c26d18 11589 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
10bc17b6
JH
11590 esac
11591 case "$ctime_r_proto" in
90e831dc 11592 ''|0) d_ctime_r=undef
10bc17b6 11593 ctime_r_proto=0
a48ec845 11594 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11595 * ) case "$ctime_r_proto" in
11596 REENTRANT_PROTO*) ;;
11597 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11598 esac
11599 echo "Prototype: $try" ;;
11600 esac
11601 ;;
c18e646a
JH
11602 *) case "$usethreads" in
11603 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11604 esac
90e831dc
SB
11605 d_ctime_r=undef
11606 ctime_r_proto=0
c18e646a 11607 ;;
a48ec845
JH
11608 esac
11609 ;;
10bc17b6
JH
11610*) ctime_r_proto=0
11611 ;;
11612esac
11613
b4eb6b3d
JH
11614: see if cuserid exists
11615set cuserid d_cuserid
11616eval $inlibc
11617
11618: see if this is a limits.h system
11619set limits.h i_limits
11620eval $inhdr
11621
11622: see if this is a float.h system
11623set float.h i_float
11624eval $inhdr
11625
11626: See if number of significant digits in a double precision number is known
11627echo " "
11628$cat >dbl_dig.c <<EOM
11629#$i_limits I_LIMITS
11630#$i_float I_FLOAT
11631#ifdef I_LIMITS
11632#include <limits.h>
11633#endif
11634#ifdef I_FLOAT
11635#include <float.h>
11636#endif
11637#ifdef DBL_DIG
11638printf("Contains DBL_DIG");
11639#endif
11640EOM
11641$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11642if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11643 echo "DBL_DIG found." >&4
11644 val="$define"
11645else
11646 echo "DBL_DIG NOT found." >&4
11647 val="$undef"
11648fi
11649$rm -f dbl_dig.?
11650set d_dbl_dig
11651eval $setvar
11652
2ef53570
JH
11653: see if dbm.h is available
11654: see if dbmclose exists
11655set dbmclose d_dbmclose
11656eval $inlibc
11657
11658case "$d_dbmclose" in
11659$define)
11660 set dbm.h i_dbm
11661 eval $inhdr
11662 case "$i_dbm" in
11663 $define)
11664 val="$undef"
11665 set i_rpcsvcdbm
11666 eval $setvar
11667 ;;
11668 *) set rpcsvc/dbm.h i_rpcsvcdbm
11669 eval $inhdr
11670 ;;
11671 esac
11672 ;;
11673*) echo "We won't be including <dbm.h>"
11674 val="$undef"
11675 set i_dbm
11676 eval $setvar
11677 val="$undef"
11678 set i_rpcsvcdbm
11679 eval $setvar
11680 ;;
11681esac
11682
11683: see if prototype for dbminit is available
11684echo " "
11685set d_dbminitproto dbminit $i_dbm dbm.h
11686eval $hasproto
11687
b4eb6b3d
JH
11688: see if difftime exists
11689set difftime d_difftime
11690eval $inlibc
11691
11692: see if this is a dirent system
11693echo " "
11694if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11695 val="$define"
11696 echo "<dirent.h> found." >&4
11697else
11698 val="$undef"
11699 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11700 echo "<sys/dir.h> found." >&4
11701 echo " "
11702 else
11703 xinc=`./findhdr sys/ndir.h`
11704 fi
11705 echo "<dirent.h> NOT found." >&4
11706fi
11707set i_dirent
11708eval $setvar
11709
11710: Look for type of directory structure.
11711echo " "
11712$cppstdin $cppflags $cppminus < "$xinc" > try.c
11713
11714case "$direntrytype" in
11715''|' ')
11716 case "$i_dirent" in
11717 $define) guess1='struct dirent' ;;
11718 *) guess1='struct direct' ;;
11719 esac
11720 ;;
11721*) guess1="$direntrytype"
11722 ;;
11723esac
11724
11725case "$guess1" in
11726'struct dirent') guess2='struct direct' ;;
11727*) guess2='struct dirent' ;;
11728esac
5b813a60 11729
b4eb6b3d
JH
11730if $contains "$guess1" try.c >/dev/null 2>&1; then
11731 direntrytype="$guess1"
11732 echo "Your directory entries are $direntrytype." >&4
11733elif $contains "$guess2" try.c >/dev/null 2>&1; then
11734 direntrytype="$guess2"
11735 echo "Your directory entries seem to be $direntrytype." >&4
11736else
11737 echo "I don't recognize your system's directory entries." >&4
11738 rp="What type is used for directory entries on this system?"
11739 dflt="$guess1"
11740 . ./myread
11741 direntrytype="$ans"
11742fi
5b813a60 11743$rm_try
b4eb6b3d
JH
11744
11745: see if the directory entry stores field length
11746echo " "
11747$cppstdin $cppflags $cppminus < "$xinc" > try.c
11748if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11749 echo "Good, your directory entry keeps length information in d_namlen." >&4
11750 val="$define"
11751else
11752 echo "Your directory entry does not know about the d_namlen field." >&4
11753 val="$undef"
11754fi
11755set d_dirnamlen
11756eval $setvar
5b813a60 11757$rm_try
b4eb6b3d 11758
de52168c
SP
11759: Look for DIR.dd_fd
11760case "$i_dirent" in
11761"$define")
11762 echo "Checking to see if DIR has a dd_fd member variable" >&4
11763 $cat >try.c <<EOCP
11764#$i_stdlib I_STDLIB
11765#ifdef I_STDLIB
11766#include <stdlib.h>
11767#endif
11768#include <dirent.h>
11769
11770int main() {
11771 DIR dir;
11772 dir.dd_fd = 1;
11773 return 0;
11774}
11775EOCP
11776 val=$undef
11777 set try
11778 if eval $compile; then
11779 echo "Yes, it does."
11780 val="$define"
11781 else
11782 echo "No, it does not."
11783 val="$undef"
11784 fi
11785 ;;
11786*)
11787 echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11788 val="$undef"
11789 ;;
11790esac
11791set d_dir_dd_fd
11792eval $setvar
5b813a60 11793$rm_try
de52168c 11794
ae0e3d3b
JH
11795: see if this is an sysdir system
11796set sys/dir.h i_sysdir
11797eval $inhdr
11798
11799: see if this is an sysndir system
11800set sys/ndir.h i_sysndir
11801eval $inhdr
11802
11803: Look for dirfd
11804echo " "
11805$cat >dirfd.c <<EOM
11806#include <stdio.h>
55954f19
JH
11807#$i_stdlib I_STDLIB
11808#ifdef I_STDLIB
11809#include <stdlib.h>
11810#endif
ae0e3d3b
JH
11811#$i_dirent I_DIRENT /**/
11812#$i_sysdir I_SYS_DIR /**/
11813#$i_sysndir I_SYS_NDIR /**/
11814#$i_systypes I_SYS_TYPES /**/
11815#if defined(I_SYS_TYPES)
11816#include <sys/types.h>
11817#endif
11818#if defined(I_DIRENT)
11819#include <dirent.h>
11820#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11821#include <sys/dir.h>
11822#endif
11823#else
11824#ifdef I_SYS_NDIR
11825#include <sys/ndir.h>
11826#else
11827#ifdef I_SYS_DIR
11828#ifdef hp9000s500
11829#include <ndir.h> /* may be wrong in the future */
11830#else
11831#include <sys/dir.h>
11832#endif
11833#endif
11834#endif
11835#endif
11836int main() {
11837 DIR *dirp = opendir(".");
11838 if (dirfd(dirp) >= 0)
11839 exit(0);
11840 else
11841 exit(1);
11842}
11843EOM
5cadb3f3 11844val=$undef
ae0e3d3b
JH
11845set dirfd
11846if eval $compile; then
11847 val="$define"
11848fi
11849case "$val" in
11850$define) echo "dirfd() found." >&4 ;;
11851*) echo "dirfd() NOT found." >&4 ;;
11852esac
11853set d_dirfd
11854eval $setvar
11855$rm -f dirfd*
11856
b4eb6b3d
JH
11857: see if dlerror exists
11858xxx_runnm="$runnm"
11859runnm=false
11860set dlerror d_dlerror
11861eval $inlibc
11862runnm="$xxx_runnm"
11863
11864: see if dlfcn is available
11865set dlfcn.h i_dlfcn
11866eval $inhdr
11867
34f1896b 11868: Check what extension to use for shared libs
b4eb6b3d
JH
11869case "$usedl" in
11870$define|y|true)
11871 $cat << EOM
11872
11873On a few systems, the dynamically loaded modules that perl generates and uses
11874will need a different extension than shared libs. The default will probably
11875be appropriate.
11876
11877EOM
11878 case "$dlext" in
11879 '') dflt="$so" ;;
11880 *) dflt="$dlext" ;;
11881 esac
11882 rp='What is the extension of dynamically loaded modules'
11883 . ./myread
11884 dlext="$ans"
11885 ;;
11886*)
11887 dlext="none"
11888 ;;
11889esac
11890
11891: Check if dlsym need a leading underscore
11892echo " "
11893val="$undef"
11894
11895case "$dlsrc" in
11896dl_dlopen.xs)
11897 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11898 $cat >dyna.c <<'EOM'
11899fred () { }
11900EOM
11901
11902$cat >fred.c<<EOM
11903
11904#include <stdio.h>
55954f19
JH
11905#$i_stdlib I_STDLIB
11906#ifdef I_STDLIB
11907#include <stdlib.h>
11908#endif
b4eb6b3d
JH
11909#$i_dlfcn I_DLFCN
11910#ifdef I_DLFCN
5440bc8e 11911#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
11912#else
11913#include <sys/types.h>
11914#include <nlist.h>
11915#include <link.h>
11916#endif
11917
11918extern int fred() ;
11919
11920int main()
11921{
11922 void * handle ;
11923 void * symbol ;
11924#ifndef RTLD_LAZY
11925 int mode = 1 ;
11926#else
11927 int mode = RTLD_LAZY ;
11928#endif
11929 handle = dlopen("./dyna.$dlext", mode) ;
11930 if (handle == NULL) {
11931 printf ("1\n") ;
11932 fflush (stdout) ;
11933 exit(0);
11934 }
11935 symbol = dlsym(handle, "fred") ;
11936 if (symbol == NULL) {
11937 /* try putting a leading underscore */
11938 symbol = dlsym(handle, "_fred") ;
11939 if (symbol == NULL) {
11940 printf ("2\n") ;
11941 fflush (stdout) ;
11942 exit(0);
11943 }
11944 printf ("3\n") ;
11945 }
11946 else
11947 printf ("4\n") ;
11948 fflush (stdout) ;
11949 exit(0);
11950}
11951EOM
11952 : Call the object file tmp-dyna.o in case dlext=o.
613d6c3e
MB
11953 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11954 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11955 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
11956 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11957 xxx=`$run ./fred`
b4eb6b3d
JH
11958 case $xxx in
11959 1) echo "Test program failed using dlopen." >&4
11960 echo "Perhaps you should not use dynamic loading." >&4;;
11961 2) echo "Test program failed using dlsym." >&4
11962 echo "Perhaps you should not use dynamic loading." >&4;;
11963 3) echo "dlsym needs a leading underscore" >&4
11964 val="$define" ;;
11965 4) echo "dlsym doesn't need a leading underscore." >&4;;
11966 esac
11967 else
11968 echo "I can't compile and run the test program." >&4
11969 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11970 fi
11971 ;;
11972esac
613d6c3e 11973
3c728e00 11974$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
11975
11976set d_dlsymun
11977eval $setvar
11978
10bc17b6
JH
11979: see if drand48_r exists
11980set drand48_r d_drand48_r
11981eval $inlibc
11982case "$d_drand48_r" in
11983"$define")
11984 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
11985 case "$d_drand48_r_proto:$usethreads" in
11986 ":define") d_drand48_r_proto=define
a48ec845
JH
11987 set d_drand48_r_proto drand48_r $hdrs
11988 eval $hasproto ;;
11989 *) ;;
11990 esac
11991 case "$d_drand48_r_proto" in
11992 define)
10bc17b6
JH
11993 case "$drand48_r_proto" in
11994 ''|0) try='int drand48_r(struct drand48_data*, double*);'
61c26d18 11995 ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
10bc17b6
JH
11996 esac
11997 case "$drand48_r_proto" in
90e831dc 11998 ''|0) d_drand48_r=undef
10bc17b6 11999 drand48_r_proto=0
a48ec845 12000 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12001 * ) case "$drand48_r_proto" in
12002 REENTRANT_PROTO*) ;;
12003 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12004 esac
12005 echo "Prototype: $try" ;;
12006 esac
12007 ;;
c18e646a
JH
12008 *) case "$usethreads" in
12009 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12010 esac
90e831dc
SB
12011 d_drand48_r=undef
12012 drand48_r_proto=0
c18e646a 12013 ;;
a48ec845
JH
12014 esac
12015 ;;
10bc17b6
JH
12016*) drand48_r_proto=0
12017 ;;
12018esac
12019
12020: see if prototype for drand48 is available
12021echo " "
12022set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12023eval $hasproto
12024
b4eb6b3d
JH
12025: see if dup2 exists
12026set dup2 d_dup2
12027eval $inlibc
12028
12029: see if eaccess exists
12030set eaccess d_eaccess
12031eval $inlibc
12032
12033: see if endgrent exists
12034set endgrent d_endgrent
12035eval $inlibc
12036
10bc17b6
JH
12037: see if this is an grp system
12038set grp.h i_grp
12039eval $inhdr
12040
12041case "$i_grp" in
12042$define)
12043 xxx=`./findhdr grp.h`
12044 $cppstdin $cppflags $cppminus < $xxx >$$.h
12045
12046 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12047 val="$define"
12048 else
12049 val="$undef"
12050 fi
12051 set d_grpasswd
12052 eval $setvar
12053
12054 $rm -f $$.h
12055 ;;
12056*)
12057 val="$undef";
12058 set d_grpasswd; eval $setvar
12059 ;;
12060esac
12061
12062: see if endgrent_r exists
12063set endgrent_r d_endgrent_r
12064eval $inlibc
12065case "$d_endgrent_r" in
12066"$define")
12067 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12068 case "$d_endgrent_r_proto:$usethreads" in
12069 ":define") d_endgrent_r_proto=define
a48ec845
JH
12070 set d_endgrent_r_proto endgrent_r $hdrs
12071 eval $hasproto ;;
12072 *) ;;
12073 esac
12074 case "$d_endgrent_r_proto" in
12075 define)
10bc17b6
JH
12076 case "$endgrent_r_proto" in
12077 ''|0) try='int endgrent_r(FILE**);'
61c26d18 12078 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
10bc17b6
JH
12079 esac
12080 case "$endgrent_r_proto" in
12081 ''|0) try='void endgrent_r(FILE**);'
61c26d18 12082 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
10bc17b6
JH
12083 esac
12084 case "$endgrent_r_proto" in
90e831dc 12085 ''|0) d_endgrent_r=undef
10bc17b6 12086 endgrent_r_proto=0
a48ec845 12087 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12088 * ) case "$endgrent_r_proto" in
12089 REENTRANT_PROTO*) ;;
12090 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12091 esac
12092 echo "Prototype: $try" ;;
12093 esac
12094 ;;
c18e646a
JH
12095 *) case "$usethreads" in
12096 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12097 esac
90e831dc
SB
12098 d_endgrent_r=undef
12099 endgrent_r_proto=0
c18e646a 12100 ;;
a48ec845
JH
12101 esac
12102 ;;
10bc17b6
JH
12103*) endgrent_r_proto=0
12104 ;;
12105esac
12106
b4eb6b3d
JH
12107: see if endhostent exists
12108set endhostent d_endhent
12109eval $inlibc
12110
10bc17b6
JH
12111: see if this is a netdb.h system
12112set netdb.h i_netdb
12113eval $inhdr
12114
12115: see if endhostent_r exists
12116set endhostent_r d_endhostent_r
12117eval $inlibc
12118case "$d_endhostent_r" in
12119"$define")
12120 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12121 case "$d_endhostent_r_proto:$usethreads" in
12122 ":define") d_endhostent_r_proto=define
a48ec845
JH
12123 set d_endhostent_r_proto endhostent_r $hdrs
12124 eval $hasproto ;;
12125 *) ;;
12126 esac
12127 case "$d_endhostent_r_proto" in
12128 define)
10bc17b6
JH
12129 case "$endhostent_r_proto" in
12130 ''|0) try='int endhostent_r(struct hostent_data*);'
61c26d18 12131 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
12132 esac
12133 case "$endhostent_r_proto" in
12134 ''|0) try='void endhostent_r(struct hostent_data*);'
61c26d18 12135 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
12136 esac
12137 case "$endhostent_r_proto" in
90e831dc 12138 ''|0) d_endhostent_r=undef
10bc17b6 12139 endhostent_r_proto=0
a48ec845 12140 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12141 * ) case "$endhostent_r_proto" in
12142 REENTRANT_PROTO*) ;;
12143 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12144 esac
12145 echo "Prototype: $try" ;;
12146 esac
12147 ;;
c18e646a
JH
12148 *) case "$usethreads" in
12149 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12150 esac
90e831dc
SB
12151 d_endhostent_r=undef
12152 endhostent_r_proto=0
c18e646a 12153 ;;
a48ec845
JH
12154 esac
12155 ;;
10bc17b6
JH
12156*) endhostent_r_proto=0
12157 ;;
12158esac
12159
b4eb6b3d
JH
12160: see if endnetent exists
12161set endnetent d_endnent
12162eval $inlibc
12163
10bc17b6
JH
12164: see if endnetent_r exists
12165set endnetent_r d_endnetent_r
12166eval $inlibc
12167case "$d_endnetent_r" in
12168"$define")
12169 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12170 case "$d_endnetent_r_proto:$usethreads" in
12171 ":define") d_endnetent_r_proto=define
a48ec845
JH
12172 set d_endnetent_r_proto endnetent_r $hdrs
12173 eval $hasproto ;;
12174 *) ;;
12175 esac
12176 case "$d_endnetent_r_proto" in
12177 define)
10bc17b6
JH
12178 case "$endnetent_r_proto" in
12179 ''|0) try='int endnetent_r(struct netent_data*);'
61c26d18 12180 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
12181 esac
12182 case "$endnetent_r_proto" in
12183 ''|0) try='void endnetent_r(struct netent_data*);'
61c26d18 12184 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
12185 esac
12186 case "$endnetent_r_proto" in
90e831dc 12187 ''|0) d_endnetent_r=undef
10bc17b6 12188 endnetent_r_proto=0
a48ec845 12189 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12190 * ) case "$endnetent_r_proto" in
12191 REENTRANT_PROTO*) ;;
12192 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12193 esac
12194 echo "Prototype: $try" ;;
12195 esac
12196 ;;
c18e646a
JH
12197 *) case "$usethreads" in
12198 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12199 esac
90e831dc
SB
12200 d_endnetent_r=undef
12201 endnetent_r_proto=0
c18e646a 12202 ;;
a48ec845
JH
12203 esac
12204 ;;
10bc17b6
JH
12205*) endnetent_r_proto=0
12206 ;;
12207esac
12208
b4eb6b3d
JH
12209: see if endprotoent exists
12210set endprotoent d_endpent
12211eval $inlibc
12212
10bc17b6
JH
12213: see if endprotoent_r exists
12214set endprotoent_r d_endprotoent_r
12215eval $inlibc
12216case "$d_endprotoent_r" in
12217"$define")
12218 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12219 case "$d_endprotoent_r_proto:$usethreads" in
12220 ":define") d_endprotoent_r_proto=define
a48ec845
JH
12221 set d_endprotoent_r_proto endprotoent_r $hdrs
12222 eval $hasproto ;;
12223 *) ;;
12224 esac
12225 case "$d_endprotoent_r_proto" in
12226 define)
10bc17b6
JH
12227 case "$endprotoent_r_proto" in
12228 ''|0) try='int endprotoent_r(struct protoent_data*);'
61c26d18 12229 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
12230 esac
12231 case "$endprotoent_r_proto" in
12232 ''|0) try='void endprotoent_r(struct protoent_data*);'
61c26d18 12233 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
12234 esac
12235 case "$endprotoent_r_proto" in
90e831dc 12236 ''|0) d_endprotoent_r=undef
10bc17b6 12237 endprotoent_r_proto=0
a48ec845 12238 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12239 * ) case "$endprotoent_r_proto" in
12240 REENTRANT_PROTO*) ;;
12241 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12242 esac
12243 echo "Prototype: $try" ;;
12244 esac
12245 ;;
c18e646a
JH
12246 *) case "$usethreads" in
12247 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12248 esac
90e831dc
SB
12249 d_endprotoent_r=undef
12250 endprotoent_r_proto=0
c18e646a 12251 ;;
a48ec845
JH
12252 esac
12253 ;;
10bc17b6
JH
12254*) endprotoent_r_proto=0
12255 ;;
12256esac
12257
b4eb6b3d
JH
12258: see if endpwent exists
12259set endpwent d_endpwent
12260eval $inlibc
12261
10bc17b6
JH
12262: see if this is a pwd.h system
12263set pwd.h i_pwd
12264eval $inhdr
12265
12266case "$i_pwd" in
12267$define)
12268 xxx=`./findhdr pwd.h`
12269 $cppstdin $cppflags $cppminus < $xxx >$$.h
12270
12271 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12272 val="$define"
12273 else
12274 val="$undef"
12275 fi
12276 set d_pwquota
12277 eval $setvar
12278
12279 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12280 val="$define"
12281 else
12282 val="$undef"
12283 fi
12284 set d_pwage
12285 eval $setvar
12286
12287 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12288 val="$define"
12289 else
12290 val="$undef"
12291 fi
12292 set d_pwchange
12293 eval $setvar
12294
12295 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12296 val="$define"
12297 else
12298 val="$undef"
12299 fi
12300 set d_pwclass
12301 eval $setvar
12302
12303 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12304 val="$define"
12305 else
12306 val="$undef"
12307 fi
12308 set d_pwexpire
12309 eval $setvar
12310
12311 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12312 val="$define"
12313 else
12314 val="$undef"
12315 fi
12316 set d_pwcomment
12317 eval $setvar
12318
12319 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12320 val="$define"
12321 else
12322 val="$undef"
12323 fi
12324 set d_pwgecos
12325 eval $setvar
12326
12327 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12328 val="$define"
12329 else
12330 val="$undef"
12331 fi
12332 set d_pwpasswd
12333 eval $setvar
12334
12335 $rm -f $$.h
12336 ;;
12337*)
12338 val="$undef";
12339 set d_pwquota; eval $setvar
12340 set d_pwage; eval $setvar
12341 set d_pwchange; eval $setvar
12342 set d_pwclass; eval $setvar
12343 set d_pwexpire; eval $setvar
12344 set d_pwcomment; eval $setvar
12345 set d_pwgecos; eval $setvar
12346 set d_pwpasswd; eval $setvar
12347 ;;
12348esac
12349
12350: see if endpwent_r exists
12351set endpwent_r d_endpwent_r
12352eval $inlibc
12353case "$d_endpwent_r" in
12354"$define")
12355 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
12356 case "$d_endpwent_r_proto:$usethreads" in
12357 ":define") d_endpwent_r_proto=define
a48ec845
JH
12358 set d_endpwent_r_proto endpwent_r $hdrs
12359 eval $hasproto ;;
12360 *) ;;
12361 esac
12362 case "$d_endpwent_r_proto" in
12363 define)
10bc17b6
JH
12364 case "$endpwent_r_proto" in
12365 ''|0) try='int endpwent_r(FILE**);'
61c26d18 12366 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
10bc17b6
JH
12367 esac
12368 case "$endpwent_r_proto" in
12369 ''|0) try='void endpwent_r(FILE**);'
61c26d18 12370 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
10bc17b6
JH
12371 esac
12372 case "$endpwent_r_proto" in
90e831dc 12373 ''|0) d_endpwent_r=undef
10bc17b6 12374 endpwent_r_proto=0
a48ec845 12375 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12376 * ) case "$endpwent_r_proto" in
12377 REENTRANT_PROTO*) ;;
12378 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12379 esac
12380 echo "Prototype: $try" ;;
12381 esac
12382 ;;
c18e646a
JH
12383 *) case "$usethreads" in
12384 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12385 esac
90e831dc
SB
12386 d_endpwent_r=undef
12387 endpwent_r_proto=0
c18e646a 12388 ;;
a48ec845
JH
12389 esac
12390 ;;
10bc17b6
JH
12391*) endpwent_r_proto=0
12392 ;;
12393esac
12394
b4eb6b3d
JH
12395: see if endservent exists
12396set endservent d_endsent
12397eval $inlibc
12398
10bc17b6
JH
12399: see if endservent_r exists
12400set endservent_r d_endservent_r
12401eval $inlibc
12402case "$d_endservent_r" in
12403"$define")
12404 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12405 case "$d_endservent_r_proto:$usethreads" in
12406 ":define") d_endservent_r_proto=define
a48ec845
JH
12407 set d_endservent_r_proto endservent_r $hdrs
12408 eval $hasproto ;;
12409 *) ;;
12410 esac
12411 case "$d_endservent_r_proto" in
12412 define)
10bc17b6
JH
12413 case "$endservent_r_proto" in
12414 ''|0) try='int endservent_r(struct servent_data*);'
61c26d18 12415 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
12416 esac
12417 case "$endservent_r_proto" in
12418 ''|0) try='void endservent_r(struct servent_data*);'
61c26d18 12419 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
12420 esac
12421 case "$endservent_r_proto" in
90e831dc 12422 ''|0) d_endservent_r=undef
10bc17b6 12423 endservent_r_proto=0
a48ec845 12424 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12425 * ) case "$endservent_r_proto" in
12426 REENTRANT_PROTO*) ;;
12427 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12428 esac
12429 echo "Prototype: $try" ;;
12430 esac
12431 ;;
c18e646a
JH
12432 *) case "$usethreads" in
12433 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12434 esac
90e831dc
SB
12435 d_endservent_r=undef
12436 endservent_r_proto=0
c18e646a 12437 ;;
a48ec845
JH
12438 esac
12439 ;;
10bc17b6
JH
12440*) endservent_r_proto=0
12441 ;;
12442esac
12443
b4eb6b3d
JH
12444: Locate the flags for 'open()'
12445echo " "
55954f19 12446$cat >try.c <<EOCP
b4eb6b3d
JH
12447#include <sys/types.h>
12448#ifdef I_FCNTL
12449#include <fcntl.h>
12450#endif
12451#ifdef I_SYS_FILE
12452#include <sys/file.h>
12453#endif
55954f19
JH
12454#$i_stdlib I_STDLIB
12455#ifdef I_STDLIB
12456#include <stdlib.h>
12457#endif
b4eb6b3d
JH
12458int main() {
12459 if(O_RDONLY);
12460#ifdef O_TRUNC
12461 exit(0);
12462#else
12463 exit(1);
12464#endif
12465}
12466EOCP
12467: check sys/file.h first to get FREAD on Sun
12468if $test `./findhdr sys/file.h` && \
5440bc8e 12469 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
12470 h_sysfile=true;
12471 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 12472 if $run ./try; then
b4eb6b3d
JH
12473 echo "and you have the 3 argument form of open()." >&4
12474 val="$define"
12475 else
12476 echo "but not the 3 argument form of open(). Oh, well." >&4
12477 val="$undef"
12478 fi
12479elif $test `./findhdr fcntl.h` && \
5440bc8e 12480 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
12481 h_fcntl=true;
12482 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 12483 if $run ./try; then
b4eb6b3d
JH
12484 echo "and you have the 3 argument form of open()." >&4
12485 val="$define"
12486 else
12487 echo "but not the 3 argument form of open(). Oh, well." >&4
12488 val="$undef"
12489 fi
12490else
12491 val="$undef"
12492 echo "I can't find the O_* constant definitions! You got problems." >&4
12493fi
12494set d_open3
12495eval $setvar
5b813a60 12496$rm_try
b4eb6b3d 12497
3c728e00
JH
12498: see if this is a sys/file.h system
12499val=''
12500set sys/file.h val
12501eval $inhdr
12502
12503: do we need to include sys/file.h ?
12504case "$val" in
12505"$define")
12506 echo " "
12507 if $h_sysfile; then
12508 val="$define"
12509 echo "We'll be including <sys/file.h>." >&4
12510 else
12511 val="$undef"
12512 echo "We won't be including <sys/file.h>." >&4
12513 fi
12514 ;;
12515*)
12516 h_sysfile=false
12517 ;;
12518esac
12519set i_sysfile
12520eval $setvar
12521
12522: see if fcntl.h is there
12523val=''
12524set fcntl.h val
12525eval $inhdr
12526
12527: see if we can include fcntl.h
12528case "$val" in
12529"$define")
12530 echo " "
12531 if $h_fcntl; then
12532 val="$define"
12533 echo "We'll be including <fcntl.h>." >&4
12534 else
12535 val="$undef"
12536 if $h_sysfile; then
12537 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12538 else
12539 echo "We won't be including <fcntl.h>." >&4
12540 fi
12541 fi
12542 ;;
12543*)
12544 h_fcntl=false
12545 val="$undef"
12546 ;;
12547esac
12548set i_fcntl
12549eval $setvar
12550
4dd8f9b3
JH
12551: see if fork exists
12552set fork d_fork
12553eval $inlibc
12554
12555: see if pipe exists
12556set pipe d_pipe
12557eval $inlibc
12558
b4eb6b3d
JH
12559: check for non-blocking I/O stuff
12560case "$h_sysfile" in
a0acbdc3
JH
12561true) echo "#include <sys/file.h>" > head.c;;
12562*)
12563 case "$h_fcntl" in
12564 true) echo "#include <fcntl.h>" > head.c;;
12565 *) echo "#include <sys/fcntl.h>" > head.c;;
12566 esac
12567 ;;
b4eb6b3d
JH
12568esac
12569echo " "
12570echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12571case "$o_nonblock" in
12572'')
12573 $cat head.c > try.c
3c728e00 12574 $cat >>try.c <<EOCP
b4eb6b3d 12575#include <stdio.h>
55954f19
JH
12576#$i_stdlib I_STDLIB
12577#ifdef I_STDLIB
80b3ef99 12578#include <stdlib.h>
55954f19 12579#endif
3c728e00
JH
12580#$i_fcntl I_FCNTL
12581#ifdef I_FCNTL
12582#include <fcntl.h>
12583#endif
b4eb6b3d
JH
12584int main() {
12585#ifdef O_NONBLOCK
12586 printf("O_NONBLOCK\n");
12587 exit(0);
12588#endif
12589#ifdef O_NDELAY
12590 printf("O_NDELAY\n");
12591 exit(0);
12592#endif
12593#ifdef FNDELAY
12594 printf("FNDELAY\n");
12595 exit(0);
12596#endif
12597 exit(0);
12598}
12599EOCP
12600 set try
12601 if eval $compile_ok; then
5440bc8e 12602 o_nonblock=`$run ./try`
b4eb6b3d
JH
12603 case "$o_nonblock" in
12604 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12605 *) echo "Seems like we can use $o_nonblock.";;
12606 esac
12607 else
12608 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12609 fi
12610 ;;
12611*) echo "Using $hint value $o_nonblock.";;
12612esac
5b813a60 12613$rm_try
b4eb6b3d
JH
12614
12615echo " "
12616echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12617case "$eagain" in
12618'')
4dd8f9b3
JH
12619 case "$d_fork:$d_pipe" in
12620 define:define)
b4eb6b3d
JH
12621 $cat head.c > try.c
12622 $cat >>try.c <<EOCP
12623#include <errno.h>
12624#include <sys/types.h>
12625#include <signal.h>
5b813a60 12626#include <stdio.h>
55954f19
JH
12627#$i_stdlib I_STDLIB
12628#ifdef I_STDLIB
12629#include <stdlib.h>
12630#endif
1deb0a86
JH
12631#$i_fcntl I_FCNTL
12632#ifdef I_FCNTL
12633#include <fcntl.h>
12634#endif
b4eb6b3d
JH
12635#define MY_O_NONBLOCK $o_nonblock
12636#ifndef errno /* XXX need better Configure test */
12637extern int errno;
12638#endif
12639#$i_unistd I_UNISTD
12640#ifdef I_UNISTD
12641#include <unistd.h>
12642#endif
12643#$i_string I_STRING
12644#ifdef I_STRING
12645#include <string.h>
12646#else
12647#include <strings.h>
12648#endif
7090f861 12649$signal_t blech(int x) { exit(3); }
b4eb6b3d
JH
12650EOCP
12651 $cat >> try.c <<'EOCP'
12652int main()
12653{
12654 int pd[2];
12655 int pu[2];
12656 char buf[1];
12657 char string[100];
12658
12659 pipe(pd); /* Down: child -> parent */
12660 pipe(pu); /* Up: parent -> child */
12661 if (0 != fork()) {
12662 int ret;
12663 close(pd[1]); /* Parent reads from pd[0] */
12664 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 12665#ifdef F_SETFL
b4eb6b3d
JH
12666 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12667 exit(1);
a0acbdc3
JH
12668#else
12669 exit(4);
12670#endif
b4eb6b3d
JH
12671 signal(SIGALRM, blech);
12672 alarm(5);
12673 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
12674 exit(2);
12675 sprintf(string, "%d\n", ret);
12676 write(2, string, strlen(string));
12677 alarm(0);
12678#ifdef EAGAIN
12679 if (errno == EAGAIN) {
12680 printf("EAGAIN\n");
12681 goto ok;
12682 }
12683#endif
12684#ifdef EWOULDBLOCK
12685 if (errno == EWOULDBLOCK)
12686 printf("EWOULDBLOCK\n");
12687#endif
12688 ok:
12689 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
12690 sleep(2); /* Give it time to close our pipe */
12691 alarm(5);
12692 ret = read(pd[0], buf, 1); /* Should read EOF */
12693 alarm(0);
12694 sprintf(string, "%d\n", ret);
868439a2 12695 write(4, string, strlen(string));
b4eb6b3d
JH
12696 exit(0);
12697 }
12698
12699 close(pd[0]); /* We write to pd[1] */
12700 close(pu[1]); /* We read from pu[0] */
12701 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
12702 close(pd[1]); /* Pipe pd is now fully closed! */
12703 exit(0); /* Bye bye, thank you for playing! */
12704}
12705EOCP
12706 set try
12707 if eval $compile_ok; then
12708 echo "$startsh" >mtry
868439a2 12709 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
12710 chmod +x mtry
12711 ./mtry >/dev/null 2>&1
12712 case $? in
12713 0) eagain=`$cat try.out`;;
12714 1) echo "Could not perform non-blocking setting!";;
12715 2) echo "I did a successful read() for something that was not there!";;
12716 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 12717 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
12718 *) echo "Something terribly wrong happened during testing.";;
12719 esac
12720 rd_nodata=`$cat try.ret`
12721 echo "A read() system call with no data present returns $rd_nodata."
12722 case "$rd_nodata" in
12723 0|-1) ;;
12724 *)
12725 echo "(That's peculiar, fixing that to be -1.)"
12726 rd_nodata=-1
12727 ;;
12728 esac
12729 case "$eagain" in
12730 '')
12731 echo "Forcing errno EAGAIN on read() with no data available."
12732 eagain=EAGAIN
12733 ;;
12734 *)
12735 echo "Your read() sets errno to $eagain when no data is available."
12736 ;;
12737 esac
12738 status=`$cat try.err`
12739 case "$status" in
12740 0) echo "And it correctly returns 0 to signal EOF.";;
12741 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12742 *) echo "However, your read() returns '$status' on EOF??";;
12743 esac
12744 val="$define"
12745 if test "$status" = "$rd_nodata"; then
12746 echo "WARNING: you can't distinguish between EOF and no data!"
12747 val="$undef"
12748 fi
12749 else
12750 echo "I can't compile the test program--assuming errno EAGAIN will do."
12751 eagain=EAGAIN
12752 fi
4dd8f9b3
JH
12753 ;;
12754 *) echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12755 eagain=EAGAIN
12756 val="$define"
12757 ;;
12758 esac
b4eb6b3d
JH
12759 set d_eofnblk
12760 eval $setvar
12761 ;;
12762*)
12763 echo "Using $hint value $eagain."
12764 echo "Your read() returns $rd_nodata when no data is present."
12765 case "$d_eofnblk" in
12766 "$define") echo "And you can see EOF because read() returns 0.";;
12767 "$undef") echo "But you can't see EOF status from read() returned value.";;
12768 *)
12769 echo "(Assuming you can't see EOF status from read anyway.)"
12770 d_eofnblk=$undef
12771 ;;
12772 esac
12773 ;;
12774esac
5b813a60 12775$rm_try head.c mtry
b4eb6b3d 12776
15b61c98
JH
12777: see if _ptr and _cnt from stdio act std
12778echo " "
b4eb6b3d 12779
15b61c98
JH
12780if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12781 echo "(Looks like you have stdio.h from BSD.)"
12782 case "$stdio_ptr" in
12783 '') stdio_ptr='((fp)->_p)'
12784 ptr_lval=$define
12785 ;;
12786 *) ptr_lval=$d_stdio_ptr_lval;;
12787 esac
12788 case "$stdio_cnt" in
12789 '') stdio_cnt='((fp)->_r)'
12790 cnt_lval=$define
12791 ;;
12792 *) cnt_lval=$d_stdio_cnt_lval;;
12793 esac
12794 case "$stdio_base" in
12795 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12796 esac
12797 case "$stdio_bufsiz" in
12798 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12799 esac
12800elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12801 echo "(Looks like you have stdio.h from Linux.)"
12802 case "$stdio_ptr" in
12803 '') stdio_ptr='((fp)->_IO_read_ptr)'
12804 ptr_lval=$define
12805 ;;
12806 *) ptr_lval=$d_stdio_ptr_lval;;
12807 esac
12808 case "$stdio_cnt" in
12809 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12810 cnt_lval=$undef
12811 ;;
12812 *) cnt_lval=$d_stdio_cnt_lval;;
12813 esac
12814 case "$stdio_base" in
12815 '') stdio_base='((fp)->_IO_read_base)';;
12816 esac
12817 case "$stdio_bufsiz" in
12818 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12819 esac
12820else
12821 case "$stdio_ptr" in
12822 '') stdio_ptr='((fp)->_ptr)'
12823 ptr_lval=$define
12824 ;;
12825 *) ptr_lval=$d_stdio_ptr_lval;;
12826 esac
12827 case "$stdio_cnt" in
12828 '') stdio_cnt='((fp)->_cnt)'
12829 cnt_lval=$define
12830 ;;
12831 *) cnt_lval=$d_stdio_cnt_lval;;
12832 esac
12833 case "$stdio_base" in
12834 '') stdio_base='((fp)->_base)';;
12835 esac
12836 case "$stdio_bufsiz" in
12837 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12838 esac
12839fi
b4eb6b3d 12840
15b61c98
JH
12841: test whether _ptr and _cnt really work
12842echo "Checking how std your stdio is..." >&4
12843$cat >try.c <<EOP
12844#include <stdio.h>
55954f19
JH
12845#$i_stdlib I_STDLIB
12846#ifdef I_STDLIB
9d9004a9 12847#include <stdlib.h>
55954f19 12848#endif
15b61c98
JH
12849#define FILE_ptr(fp) $stdio_ptr
12850#define FILE_cnt(fp) $stdio_cnt
9d9004a9 12851int main() {
15b61c98
JH
12852 FILE *fp = fopen("try.c", "r");
12853 char c = getc(fp);
12854 if (
12855 18 <= FILE_cnt(fp) &&
12856 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12857 )
12858 exit(0);
12859 exit(1);
9d9004a9 12860}
15b61c98
JH
12861EOP
12862val="$undef"
12863set try
12864if eval $compile && $to try.c; then
12865 if $run ./try; then
12866 echo "Your stdio acts pretty std."
12867 val="$define"
9d9004a9 12868 else
15b61c98 12869 echo "Your stdio isn't very std."
9d9004a9 12870 fi
15b61c98
JH
12871else
12872 echo "Your stdio doesn't appear very std."
12873fi
5b813a60 12874$rm_try
15b61c98
JH
12875
12876# glibc 2.2.90 and above apparently change stdio streams so Perl's
12877# direct buffer manipulation no longer works. The Configure tests
12878# should be changed to correctly detect this, but until then,
12879# the following check should at least let perl compile and run.
12880# (This quick fix should be updated before 5.8.1.)
12881# To be defensive, reject all unknown versions, and all versions > 2.2.9.
12882# A. Dougherty, June 3, 2002.
12883case "$d_gnulibc" in
12884$define)
12885 case "$gnulibc_version" in
12886 2.[01]*) ;;
12887 2.2) ;;
12888 2.2.[0-9]) ;;
12889 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12890 val="$undef"
12891 ;;
12892 esac
9d9004a9
AD
12893 ;;
12894esac
15b61c98 12895set d_stdstdio
9d9004a9 12896eval $setvar
9d9004a9 12897
15b61c98
JH
12898: Can _ptr be used as an lvalue?
12899case "$d_stdstdio$ptr_lval" in
12900$define$define) val=$define ;;
12901*) val=$undef ;;
12902esac
12903set d_stdio_ptr_lval
12904eval $setvar
9d9004a9 12905
15b61c98
JH
12906: Can _cnt be used as an lvalue?
12907case "$d_stdstdio$cnt_lval" in
12908$define$define) val=$define ;;
12909*) val=$undef ;;
12910esac
12911set d_stdio_cnt_lval
12912eval $setvar
b4eb6b3d 12913
15b61c98
JH
12914
12915: test whether setting _ptr sets _cnt as a side effect
12916d_stdio_ptr_lval_sets_cnt="$undef"
12917d_stdio_ptr_lval_nochange_cnt="$undef"
12918case "$d_stdio_ptr_lval$d_stdstdio" in
12919$define$define)
12920 echo "Checking to see what happens if we set the stdio ptr..." >&4
12921$cat >try.c <<EOP
12922#include <stdio.h>
12923/* Can we scream? */
12924/* Eat dust sed :-) */
12925/* In the buffer space, no one can hear you scream. */
55954f19
JH
12926#$i_stdlib I_STDLIB
12927#ifdef I_STDLIB
12928#include <stdlib.h>
12929#endif
15b61c98
JH
12930#define FILE_ptr(fp) $stdio_ptr
12931#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 12932#include <sys/types.h>
b4eb6b3d 12933int main() {
15b61c98
JH
12934 FILE *fp = fopen("try.c", "r");
12935 int c;
12936 char *ptr;
12937 size_t cnt;
12938 if (!fp) {
12939 puts("Fail even to read");
12940 exit(1);
12941 }
12942 c = getc(fp); /* Read away the first # */
12943 if (c == EOF) {
12944 puts("Fail even to read");
12945 exit(1);
12946 }
12947 if (!(
12948 18 <= FILE_cnt(fp) &&
12949 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12950 )) {
12951 puts("Fail even to read");
12952 exit (1);
12953 }
12954 ptr = (char*) FILE_ptr(fp);
12955 cnt = (size_t)FILE_cnt(fp);
12956
12957 FILE_ptr(fp) += 42;
12958
12959 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12960 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12961 exit (1);
12962 }
12963 if (FILE_cnt(fp) <= 20) {
12964 printf ("Fail (<20 chars to test)");
12965 exit (1);
12966 }
12967 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12968 puts("Fail compare");
12969 exit (1);
12970 }
12971 if (cnt == FILE_cnt(fp)) {
12972 puts("Pass_unchanged");
12973 exit (0);
5b813a60 12974 }
15b61c98
JH
12975 if (FILE_cnt(fp) == (cnt - 42)) {
12976 puts("Pass_changed");
12977 exit (0);
12978 }
12979 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12980 return 1;
12981
12982}
12983EOP
12984 set try
12985 if eval $compile && $to try.c; then
12986 case `$run ./try` in
12987 Pass_changed)
12988 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
12989 d_stdio_ptr_lval_sets_cnt="$define" ;;
12990 Pass_unchanged)
12991 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12992 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12993 Fail*)
12994 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12995 *)
12996 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12997 esac
12998 else
12999 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
13000 fi
5b813a60 13001 $rm_try
15b61c98
JH
13002 ;;
13003esac
13004
13005: see if _base is also standard
13006val="$undef"
13007case "$d_stdstdio" in
13008$define)
13009 $cat >try.c <<EOP
13010#include <stdio.h>
13011#$i_stdlib I_STDLIB
13012#ifdef I_STDLIB
13013#include <stdlib.h>
13014#endif
13015#define FILE_base(fp) $stdio_base
13016#define FILE_bufsiz(fp) $stdio_bufsiz
13017int main() {
13018 FILE *fp = fopen("try.c", "r");
13019 char c = getc(fp);
13020 if (
13021 19 <= FILE_bufsiz(fp) &&
13022 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13023 )
13024 exit(0);
13025 exit(1);
13026}
13027EOP
13028 set try
13029 if eval $compile && $to try.c; then
13030 if $run ./try; then
13031 echo "And its _base field acts std."
13032 val="$define"
13033 else
13034 echo "But its _base field isn't std."
13035 fi
13036 else
13037 echo "However, it seems to be lacking the _base field."
13038 fi
5b813a60 13039 $rm_try
15b61c98
JH
13040 ;;
13041esac
13042set d_stdiobase
13043eval $setvar
13044
13045: see if fast_stdio exists
13046val="$undef"
13047case "$d_stdstdio:$d_stdio_ptr_lval" in
13048"$define:$define")
13049 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13050 *$define*)
13051 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13052 val="$define"
13053 ;;
13054 esac
13055 ;;
13056esac
13057set d_faststdio
13058eval $setvar
13059
13060
13061
13062: see if fchdir exists
13063set fchdir d_fchdir
13064eval $inlibc
13065
13066: see if fchmod exists
13067set fchmod d_fchmod
13068eval $inlibc
13069
13070: see if fchown exists
13071set fchown d_fchown
13072eval $inlibc
13073
13074: see if this is an fcntl system
13075set fcntl d_fcntl
13076eval $inlibc
13077
15b61c98 13078: See if fcntl-based locking works.
613d6c3e 13079echo " "
15b61c98
JH
13080$cat >try.c <<EOCP
13081#$i_stdlib I_STDLIB
13082#ifdef I_STDLIB
13083#include <stdlib.h>
13084#endif
13085#include <unistd.h>
13086#include <fcntl.h>
13087#include <signal.h>
7090f861 13088$signal_t blech(int x) { exit(3); }
15b61c98
JH
13089int main() {
13090#if defined(F_SETLK) && defined(F_SETLKW)
13091 struct flock flock;
13092 int retval, fd;
13093 fd = open("try.c", O_RDONLY);
13094 flock.l_type = F_RDLCK;
13095 flock.l_whence = SEEK_SET;
13096 flock.l_start = flock.l_len = 0;
13097 signal(SIGALRM, blech);
13098 alarm(10);
13099 retval = fcntl(fd, F_SETLK, &flock);
13100 close(fd);
13101 (retval < 0 ? exit(2) : exit(0));
13102#else
13103 exit(2);
13104#endif
13105}
13106EOCP
13107echo "Checking if fcntl-based file locking works... "
13108case "$d_fcntl" in
13109"$define")
13110 set try
13111 if eval $compile_ok; then
13112 if $run ./try; then
13113 echo "Yes, it seems to work."
13114 val="$define"
13115 else
13116 echo "Nope, it didn't work."
13117 val="$undef"
13118 case "$?" in
13119 3) $cat >&4 <<EOM
13120***
13121*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13122*** This is (almost) impossible.
13123*** If your NFS lock daemons are not feeling well, something like
13124*** this may happen, please investigate. Cannot continue, aborting.
13125***
13126EOM
13127 exit 1
13128 ;;
13129 esac
13130 fi
13131 else
13132 echo "I'm unable to compile the test program, so I'll assume not."
13133 val="$undef"
13134 fi
13135 ;;
13136*) val="$undef";
13137 echo "Nope, since you don't even have fcntl()."
13138 ;;
13139esac
13140set d_fcntl_can_lock
13141eval $setvar
5b813a60 13142$rm_try
15b61c98
JH
13143
13144: check for fd_set items
13145$cat <<EOM
13146
13147Checking to see how well your C compiler handles fd_set and friends ...
13148EOM
13149$cat >try.c <<EOCP
13150#$i_stdlib I_STDLIB
13151#ifdef I_STDLIB
13152#include <stdlib.h>
13153#endif
13154#$i_systime I_SYS_TIME
13155#$i_sysselct I_SYS_SELECT
13156#$d_socket HAS_SOCKET
13157#include <sys/types.h>
13158#ifdef HAS_SOCKET
13159#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13160#endif
13161#ifdef I_SYS_TIME
13162#include <sys/time.h>
13163#endif
13164#ifdef I_SYS_SELECT
13165#include <sys/select.h>
13166#endif
13167int main() {
13168 fd_set fds;
13169
13170#ifdef TRYBITS
13171 if(fds.fds_bits);
13172#endif
13173
13174#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13175 exit(0);
13176#else
13177 exit(1);
13178#endif
13179}
13180EOCP
13181set try -DTRYBITS
13182if eval $compile; then
13183 d_fds_bits="$define"
13184 d_fd_set="$define"
13185 echo "Well, your system knows about the normal fd_set typedef..." >&4
13186 if $run ./try; then
b4eb6b3d
JH
13187 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13188 d_fd_macros="$define"
13189 else
13190 $cat >&4 <<'EOM'
13191but not the normal fd_set macros! Gaaack! I'll have to cover for you.
13192EOM
13193 d_fd_macros="$undef"
13194 fi
13195else
13196 $cat <<'EOM'
13197Hmm, your compiler has some difficulty with fd_set. Checking further...
13198EOM
5440bc8e 13199 set try
b4eb6b3d
JH
13200 if eval $compile; then
13201 d_fds_bits="$undef"
13202 d_fd_set="$define"
13203 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 13204 if $run ./try; then
b4eb6b3d
JH
13205 echo "and you have the normal fd_set macros." >&4
13206 d_fd_macros="$define"
13207 else
13208 $cat <<'EOM'
13209but not the normal fd_set macros! Gross! More work for me...
13210EOM
13211 d_fd_macros="$undef"
13212 fi
13213 else
13214 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
13215 d_fd_set="$undef"
13216 d_fds_bits="$undef"
13217 d_fd_macros="$undef"
13218 fi
13219fi
5b813a60 13220$rm_try
b4eb6b3d
JH
13221
13222: see if fgetpos exists
13223set fgetpos d_fgetpos
13224eval $inlibc
13225
758a5d79
JH
13226: see if finite exists
13227set finite d_finite
13228eval $inlibc
13229
13230: see if finitel exists
13231set finitel d_finitel
13232eval $inlibc
13233
b4eb6b3d
JH
13234: see if flock exists
13235set flock d_flock
13236eval $inlibc
13237
2ef53570
JH
13238: see if prototype for flock is available
13239echo " "
13240set d_flockproto flock $i_sysfile sys/file.h
13241eval $hasproto
13242
758a5d79
JH
13243: see if fp_class exists
13244set fp_class d_fp_class
13245eval $inlibc
13246
b4eb6b3d
JH
13247: see if pathconf exists
13248set pathconf d_pathconf
13249eval $inlibc
13250
13251: see if fpathconf exists
13252set fpathconf d_fpathconf
13253eval $inlibc
13254
758a5d79
JH
13255: see if fpclass exists
13256set fpclass d_fpclass
13257eval $inlibc
13258
13259: see if fpclassify exists
13260set fpclassify d_fpclassify
13261eval $inlibc
13262
13263: see if fpclassl exists
13264set fpclassl d_fpclassl
13265eval $inlibc
13266
b4eb6b3d
JH
13267: check for fpos64_t
13268echo " "
13269echo "Checking to see if you have fpos64_t..." >&4
13270$cat >try.c <<EOCP
13271#include <stdio.h>
13272int main() { fpos64_t x = 7; }
13273EOCP
13274set try
13275if eval $compile; then
13276 val="$define"
13277 echo "You have fpos64_t."
13278else
13279 val="$undef"
13280 echo "You do not have fpos64_t."
13281 case "$fpossize" in
13282 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13283 esac
13284fi
5b813a60 13285$rm_try
b4eb6b3d
JH
13286set d_fpos64_t
13287eval $setvar
13288
13289: see if frexpl exists
13290set frexpl d_frexpl
13291eval $inlibc
13292
b4eb6b3d
JH
13293: see if this is a sys/param system
13294set sys/param.h i_sysparam
13295eval $inhdr
13296
13297: see if this is a sys/mount.h system
13298set sys/mount.h i_sysmount
13299eval $inhdr
13300
34f1896b 13301: Check for fs_data_s
b4eb6b3d
JH
13302echo " "
13303echo "Checking to see if your system supports struct fs_data..." >&4
13304set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13305eval $hasstruct
13306case "$d_fs_data_s" in
13307"$define") echo "Yes, it does." ;;
13308*) echo "No, it doesn't." ;;
13309esac
13310
13311: see if fseeko exists
13312set fseeko d_fseeko
13313eval $inlibc
13314case "$longsize" in
133158) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13316esac
13317
13318: see if fsetpos exists
13319set fsetpos d_fsetpos
13320eval $inlibc
13321
b4eb6b3d
JH
13322: see if fstatfs exists
13323set fstatfs d_fstatfs
13324eval $inlibc
13325
b4eb6b3d
JH
13326: see if statvfs exists
13327set statvfs d_statvfs
13328eval $inlibc
13329
13330: see if fstatvfs exists
13331set fstatvfs d_fstatvfs
13332eval $inlibc
13333
13334
411ab01c
JH
13335: see if fsync exists
13336set fsync d_fsync
13337eval $inlibc
13338
b4eb6b3d
JH
13339: see if ftello exists
13340set ftello d_ftello
13341eval $inlibc
13342case "$longsize" in
133438) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13344esac
13345
bff98e24 13346: check for a working futimes
613d6c3e 13347d_futimes="$undef"
bff98e24 13348echo " "
5b813a60 13349echo "Checking if you have a working futimes()" >&4
bff98e24
SP
13350$cat >try.c <<EOCP
13351#include <stdio.h>
13352#include <sys/time.h>
13353#include <errno.h>
13354#include <fcntl.h>
13355
13356int main ()
13357{
13358 int fd, rv;
13359 fd = open ("try.c", O_RDWR);
13360 if (-1 == fd) exit (1);
13361 rv = futimes (fd, NULL);
13362 exit (rv == -1 ? errno : 0);
13363}
13364EOCP
13365set try
13366if eval $compile; then
13367 `$run ./try`
13368 rc=$?
13369 case "$rc" in
5b813a60 13370 0) echo "Yes, you have" >&4
bff98e24
SP
13371 d_futimes="$define"
13372 ;;
5b813a60 13373 *) echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
bff98e24
SP
13374 ;;
13375 esac
13376else
43dddb59 13377 echo "No, it does not (probably harmless)" >&4
bff98e24 13378fi
5b813a60 13379$rm_try
dc814df1 13380
e74475c7
MHM
13381: see if ndbm.h is available
13382set ndbm.h i_ndbm
13383eval $inhdr
13384: Compatibility location for RedHat 7.1
13385set gdbm/ndbm.h i_gdbmndbm
13386eval $inhdr
13387: Compatibility location for Debian 4.0
13388set gdbm-ndbm.h i_gdbm_ndbm
13389eval $inhdr
13390
13391val="$undef"
13392if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13393 : see if dbm_open exists
13394 set dbm_open d_dbm_open
13395 eval $inlibc
13396 case "$d_dbm_open" in
13397 $undef)
13398 i_ndbm="$undef"
13399 i_gdbmndbm="$undef"
13400 i_gdbm_ndbm="$undef"
13401 echo "We won't be including <ndbm.h>"
13402 val="$undef"
13403 ;;
13404 *) val="$define"
13405 ;;
13406 esac
13407fi
13408set d_ndbm
13409eval $setvar
13410
13411ndbm_hdr_protochk='name=$1; hdr=$2;
13412eval "ihdr=\$""i_$name";
13413val="$undef";
13414if $test "$ihdr" = "$define"; then
13415 $echo "Checking if your <$hdr> uses prototypes..." >&4;
13416 case "$d_cplusplus" in
13417 $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13418 *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13419 esac;
13420 case "$val" in
13421 $define) $echo "Your <$hdr> seems to have prototypes";;
13422 *) $echo "Your <$hdr> does not seem to have prototypes";;
13423 esac;
13424fi;
13425set "d_${name}_h_uses_prototypes";
13426eval $setvar'
13427
13428set ndbm ndbm.h
13429eval $ndbm_hdr_protochk
13430set gdbmndbm gdbm/ndbm.h
13431eval $ndbm_hdr_protochk
13432set gdbm_ndbm gdbm-ndbm.h
13433eval $ndbm_hdr_protochk
13434
5086dff9
MB
13435: see if getaddrinfo exists
13436set getaddrinfo d_getaddrinfo
13437eval $inlibc
13438
b4eb6b3d
JH
13439: see if getcwd exists
13440set getcwd d_getcwd
13441eval $inlibc
13442
13443: see if getespwnam exists
13444set getespwnam d_getespwnam
13445eval $inlibc
13446
b4eb6b3d
JH
13447: see if getfsstat exists
13448set getfsstat d_getfsstat
13449eval $inlibc
13450
13451: see if getgrent exists
13452set getgrent d_getgrent
13453eval $inlibc
13454
10bc17b6
JH
13455: see if getgrent_r exists
13456set getgrent_r d_getgrent_r
13457eval $inlibc
13458case "$d_getgrent_r" in
13459"$define")
13460 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13461 case "$d_getgrent_r_proto:$usethreads" in
13462 ":define") d_getgrent_r_proto=define
a48ec845
JH
13463 set d_getgrent_r_proto getgrent_r $hdrs
13464 eval $hasproto ;;
13465 *) ;;
13466 esac
13467 case "$d_getgrent_r_proto" in
13468 define)
10bc17b6
JH
13469 case "$getgrent_r_proto" in
13470 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
61c26d18 13471 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
10bc17b6
JH
13472 esac
13473 case "$getgrent_r_proto" in
13474 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
61c26d18 13475 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
10bc17b6
JH
13476 esac
13477 case "$getgrent_r_proto" in
13478 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
61c26d18 13479 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
10bc17b6
JH
13480 esac
13481 case "$getgrent_r_proto" in
13482 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
61c26d18 13483 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
10bc17b6
JH
13484 esac
13485 case "$getgrent_r_proto" in
13486 ''|0) try='int getgrent_r(struct group*, char*, int);'
61c26d18 13487 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
10bc17b6
JH
13488 esac
13489 case "$getgrent_r_proto" in
13490 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
61c26d18 13491 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
10bc17b6
JH
13492 esac
13493 case "$getgrent_r_proto" in
90e831dc 13494 ''|0) d_getgrent_r=undef
10bc17b6 13495 getgrent_r_proto=0
a48ec845 13496 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13497 * ) case "$getgrent_r_proto" in
13498 REENTRANT_PROTO*) ;;
13499 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13500 esac
13501 echo "Prototype: $try" ;;
13502 esac
13503 ;;
c18e646a
JH
13504 *) case "$usethreads" in
13505 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13506 esac
90e831dc
SB
13507 d_getgrent_r=undef
13508 getgrent_r_proto=0
c18e646a 13509 ;;
a48ec845
JH
13510 esac
13511 ;;
10bc17b6
JH
13512*) getgrent_r_proto=0
13513 ;;
13514esac
13515
13516: see if getgrgid_r exists
13517set getgrgid_r d_getgrgid_r
13518eval $inlibc
13519case "$d_getgrgid_r" in
13520"$define")
13521 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13522 case "$d_getgrgid_r_proto:$usethreads" in
13523 ":define") d_getgrgid_r_proto=define
a48ec845
JH
13524 set d_getgrgid_r_proto getgrgid_r $hdrs
13525 eval $hasproto ;;
13526 *) ;;
13527 esac
13528 case "$d_getgrgid_r_proto" in
13529 define)
10bc17b6
JH
13530 case "$getgrgid_r_proto" in
13531 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
61c26d18 13532 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
10bc17b6
JH
13533 esac
13534 case "$getgrgid_r_proto" in
13535 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
61c26d18 13536 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
10bc17b6
JH
13537 esac
13538 case "$getgrgid_r_proto" in
13539 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
61c26d18 13540 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
10bc17b6
JH
13541 esac
13542 case "$getgrgid_r_proto" in
13543 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
61c26d18 13544 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
10bc17b6
JH
13545 esac
13546 case "$getgrgid_r_proto" in
90e831dc 13547 ''|0) d_getgrgid_r=undef
10bc17b6 13548 getgrgid_r_proto=0
a48ec845 13549 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13550 * ) case "$getgrgid_r_proto" in
13551 REENTRANT_PROTO*) ;;
13552 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13553 esac
13554 echo "Prototype: $try" ;;
13555 esac
13556 ;;
c18e646a
JH
13557 *) case "$usethreads" in
13558 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13559 esac
90e831dc
SB
13560 d_getgrgid_r=undef
13561 getgrgid_r_proto=0
c18e646a 13562 ;;
a48ec845
JH
13563 esac
13564 ;;
10bc17b6
JH
13565*) getgrgid_r_proto=0
13566 ;;
13567esac
13568
13569: see if getgrnam_r exists
13570set getgrnam_r d_getgrnam_r
13571eval $inlibc
13572case "$d_getgrnam_r" in
13573"$define")
13574 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13575 case "$d_getgrnam_r_proto:$usethreads" in
13576 ":define") d_getgrnam_r_proto=define
a48ec845
JH
13577 set d_getgrnam_r_proto getgrnam_r $hdrs
13578 eval $hasproto ;;
13579 *) ;;
13580 esac
13581 case "$d_getgrnam_r_proto" in
13582 define)
10bc17b6
JH
13583 case "$getgrnam_r_proto" in
13584 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
61c26d18 13585 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
10bc17b6
JH
13586 esac
13587 case "$getgrnam_r_proto" in
13588 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
61c26d18 13589 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
10bc17b6
JH
13590 esac
13591 case "$getgrnam_r_proto" in
13592 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
61c26d18 13593 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
10bc17b6
JH
13594 esac
13595 case "$getgrnam_r_proto" in
13596 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
61c26d18 13597 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
10bc17b6
JH
13598 esac
13599 case "$getgrnam_r_proto" in
13600 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
61c26d18 13601 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
10bc17b6
JH
13602 esac
13603 case "$getgrnam_r_proto" in
90e831dc 13604 ''|0) d_getgrnam_r=undef
10bc17b6 13605 getgrnam_r_proto=0
a48ec845 13606 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13607 * ) case "$getgrnam_r_proto" in
13608 REENTRANT_PROTO*) ;;
13609 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13610 esac
13611 echo "Prototype: $try" ;;
13612 esac
13613 ;;
c18e646a
JH
13614 *) case "$usethreads" in
13615 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13616 esac
90e831dc
SB
13617 d_getgrnam_r=undef
13618 getgrnam_r_proto=0
c18e646a 13619 ;;
a48ec845
JH
13620 esac
13621 ;;
10bc17b6
JH
13622*) getgrnam_r_proto=0
13623 ;;
13624esac
13625
b4eb6b3d
JH
13626: see if gethostbyaddr exists
13627set gethostbyaddr d_gethbyaddr
13628eval $inlibc
13629
13630: see if gethostbyname exists
13631set gethostbyname d_gethbyname
13632eval $inlibc
13633
13634: see if gethostent exists
13635set gethostent d_gethent
13636eval $inlibc
13637
13638: see how we will look up host name
13639echo " "
13640call=''
13641if set gethostname val -f d_gethname; eval $csym; $val; then
13642 echo 'gethostname() found.' >&4
13643 d_gethname="$define"
13644 call=gethostname
13645fi
13646if set uname val -f d_uname; eval $csym; $val; then
13647 if ./xenix; then
13648 $cat <<'EOM'
13649uname() was found, but you're running xenix, and older versions of xenix
13650have a broken uname(). If you don't really know whether your xenix is old
13651enough to have a broken system call, use the default answer.
13652
13653EOM
13654 dflt=y
13655 case "$d_uname" in
13656 "$define") dflt=n;;
13657 esac
13658 rp='Is your uname() broken?'
13659 . ./myread
13660 case "$ans" in
13661 n*) d_uname="$define"; call=uname;;
13662 esac
13663 else
13664 echo 'uname() found.' >&4
13665 d_uname="$define"
13666 case "$call" in
13667 '') call=uname ;;
13668 esac
13669 fi
13670fi
13671case "$d_gethname" in
13672'') d_gethname="$undef";;
13673esac
13674case "$d_uname" in
13675'') d_uname="$undef";;
13676esac
13677case "$d_uname$d_gethname" in
13678*define*)
13679 dflt=n
13680 cat <<EOM
613d6c3e 13681
b4eb6b3d
JH
13682Every now and then someone has a $call() that lies about the hostname
13683but can't be fixed for political or economic reasons. If you wish, I can
13684pretend $call() isn't there and maybe compute hostname at run-time
13685thanks to the '$phostname' command.
13686
13687EOM
13688 rp="Shall I ignore $call() from now on?"
13689 . ./myread
13690 case "$ans" in
13691 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13692 esac;;
13693esac
13694case "$phostname" in
13695'') aphostname='';;
13696*) case "$aphostname" in
13697 /*) ;;
13698 *) set X $phostname
13699 shift
13700 file=$1
13701 shift
13702 file=`./loc $file $file $pth`
13703 aphostname=`echo $file $*`
13704 ;;
13705 esac
13706 ;;
13707esac
13708case "$d_uname$d_gethname" in
13709*define*) ;;
13710*)
13711 case "$phostname" in
13712 '')
13713 echo "There will be no way for $package to get your hostname." >&4;;
13714 *)
13715 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13716 ;;
13717 esac;;
13718esac
13719case "$d_phostname" in
13720'') d_phostname="$undef";;
13721esac
13722
10bc17b6
JH
13723: see if gethostbyaddr_r exists
13724set gethostbyaddr_r d_gethostbyaddr_r
13725eval $inlibc
13726case "$d_gethostbyaddr_r" in
13727"$define")
13728 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13729 case "$d_gethostbyaddr_r_proto:$usethreads" in
13730 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
13731 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13732 eval $hasproto ;;
13733 *) ;;
13734 esac
13735 case "$d_gethostbyaddr_r_proto" in
13736 define)
10bc17b6
JH
13737 case "$gethostbyaddr_r_proto" in
13738 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13739 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
10bc17b6
JH
13740 esac
13741 case "$gethostbyaddr_r_proto" in
13742 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
61c26d18 13743 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
10bc17b6
JH
13744 esac
13745 case "$gethostbyaddr_r_proto" in
13746 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
61c26d18 13747 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
10bc17b6
JH
13748 esac
13749 case "$gethostbyaddr_r_proto" in
13750 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
61c26d18 13751 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
10bc17b6
JH
13752 esac
13753 case "$gethostbyaddr_r_proto" in
13754 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
61c26d18 13755 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
10bc17b6
JH
13756 esac
13757 case "$gethostbyaddr_r_proto" in
13758 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
61c26d18 13759 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
10bc17b6
JH
13760 esac
13761 case "$gethostbyaddr_r_proto" in
13762 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
61c26d18 13763 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
10bc17b6
JH
13764 esac
13765 case "$gethostbyaddr_r_proto" in
13766 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
61c26d18 13767 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
10bc17b6
JH
13768 esac
13769 case "$gethostbyaddr_r_proto" in
13770 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
61c26d18 13771 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
10bc17b6
JH
13772 esac
13773 case "$gethostbyaddr_r_proto" in
13774 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
61c26d18 13775 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
10bc17b6
JH
13776 esac
13777 case "$gethostbyaddr_r_proto" in
a845a0d4 13778 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13779 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
a845a0d4
JH
13780 esac
13781 case "$gethostbyaddr_r_proto" in
90e831dc 13782 ''|0) d_gethostbyaddr_r=undef
10bc17b6 13783 gethostbyaddr_r_proto=0
a48ec845 13784 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13785 * ) case "$gethostbyaddr_r_proto" in
13786 REENTRANT_PROTO*) ;;
13787 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13788 esac
13789 echo "Prototype: $try" ;;
13790 esac
13791 ;;
c18e646a
JH
13792 *) case "$usethreads" in
13793 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13794 esac
90e831dc
SB
13795 d_gethostbyaddr_r=undef
13796 gethostbyaddr_r_proto=0
c18e646a 13797 ;;
a48ec845
JH
13798 esac
13799 ;;
10bc17b6
JH
13800*) gethostbyaddr_r_proto=0
13801 ;;
13802esac
13803
13804: see if gethostbyname_r exists
13805set gethostbyname_r d_gethostbyname_r
13806eval $inlibc
13807case "$d_gethostbyname_r" in
13808"$define")
13809 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13810 case "$d_gethostbyname_r_proto:$usethreads" in
13811 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
13812 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13813 eval $hasproto ;;
13814 *) ;;
13815 esac
13816 case "$d_gethostbyname_r_proto" in
13817 define)
10bc17b6
JH
13818 case "$gethostbyname_r_proto" in
13819 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13820 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
10bc17b6
JH
13821 esac
13822 case "$gethostbyname_r_proto" in
13823 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
61c26d18 13824 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
10bc17b6
JH
13825 esac
13826 case "$gethostbyname_r_proto" in
13827 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
61c26d18 13828 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
10bc17b6
JH
13829 esac
13830 case "$gethostbyname_r_proto" in
90e831dc 13831 ''|0) d_gethostbyname_r=undef
10bc17b6 13832 gethostbyname_r_proto=0
a48ec845 13833 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13834 * ) case "$gethostbyname_r_proto" in
13835 REENTRANT_PROTO*) ;;
13836 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13837 esac
13838 echo "Prototype: $try" ;;
13839 esac
13840 ;;
c18e646a
JH
13841 *) case "$usethreads" in
13842 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13843 esac
90e831dc
SB
13844 d_gethostbyname_r=undef
13845 gethostbyname_r_proto=0
c18e646a 13846 ;;
a48ec845
JH
13847 esac
13848 ;;
10bc17b6
JH
13849*) gethostbyname_r_proto=0
13850 ;;
13851esac
13852
13853: see if gethostent_r exists
13854set gethostent_r d_gethostent_r
13855eval $inlibc
13856case "$d_gethostent_r" in
13857"$define")
13858 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13859 case "$d_gethostent_r_proto:$usethreads" in
13860 ":define") d_gethostent_r_proto=define
a48ec845
JH
13861 set d_gethostent_r_proto gethostent_r $hdrs
13862 eval $hasproto ;;
13863 *) ;;
13864 esac
13865 case "$d_gethostent_r_proto" in
13866 define)
10bc17b6
JH
13867 case "$gethostent_r_proto" in
13868 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13869 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
10bc17b6
JH
13870 esac
13871 case "$gethostent_r_proto" in
13872 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
61c26d18 13873 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
10bc17b6
JH
13874 esac
13875 case "$gethostent_r_proto" in
13876 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
61c26d18 13877 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
10bc17b6
JH
13878 esac
13879 case "$gethostent_r_proto" in
13880 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
61c26d18 13881 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
10bc17b6
JH
13882 esac
13883 case "$gethostent_r_proto" in
13884 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
61c26d18 13885 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
10bc17b6
JH
13886 esac
13887 case "$gethostent_r_proto" in
13888 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
61c26d18 13889 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
10bc17b6
JH
13890 esac
13891 case "$gethostent_r_proto" in
90e831dc 13892 ''|0) d_gethostent_r=undef
10bc17b6 13893 gethostent_r_proto=0
a48ec845 13894 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13895 * ) case "$gethostent_r_proto" in
13896 REENTRANT_PROTO*) ;;
13897 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13898 esac
13899 echo "Prototype: $try" ;;
13900 esac
13901 ;;
c18e646a
JH
13902 *) case "$usethreads" in
13903 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13904 esac
90e831dc
SB
13905 d_gethostent_r=undef
13906 gethostent_r_proto=0
c18e646a 13907 ;;
a48ec845
JH
13908 esac
13909 ;;
10bc17b6
JH
13910*) gethostent_r_proto=0
13911 ;;
13912esac
b4eb6b3d
JH
13913
13914: see if prototypes for various gethostxxx netdb.h functions are available
13915echo " "
13916set d_gethostprotos gethostent $i_netdb netdb.h
13917eval $hasproto
13918
4e0554ec
JH
13919: see if getitimer exists
13920set getitimer d_getitimer
13921eval $inlibc
13922
b4eb6b3d
JH
13923: see if getlogin exists
13924set getlogin d_getlogin
13925eval $inlibc
13926
10bc17b6
JH
13927: see if getlogin_r exists
13928set getlogin_r d_getlogin_r
13929eval $inlibc
13930case "$d_getlogin_r" in
13931"$define")
13932 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
13933 case "$d_getlogin_r_proto:$usethreads" in
13934 ":define") d_getlogin_r_proto=define
a48ec845
JH
13935 set d_getlogin_r_proto getlogin_r $hdrs
13936 eval $hasproto ;;
13937 *) ;;
13938 esac
13939 case "$d_getlogin_r_proto" in
13940 define)
10bc17b6
JH
13941 case "$getlogin_r_proto" in
13942 ''|0) try='int getlogin_r(char*, size_t);'
61c26d18 13943 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
10bc17b6
JH
13944 esac
13945 case "$getlogin_r_proto" in
13946 ''|0) try='int getlogin_r(char*, int);'
61c26d18 13947 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
10bc17b6
JH
13948 esac
13949 case "$getlogin_r_proto" in
13950 ''|0) try='char* getlogin_r(char*, size_t);'
61c26d18 13951 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
10bc17b6
JH
13952 esac
13953 case "$getlogin_r_proto" in
13954 ''|0) try='char* getlogin_r(char*, int);'
61c26d18 13955 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
10bc17b6
JH
13956 esac
13957 case "$getlogin_r_proto" in
90e831dc 13958 ''|0) d_getlogin_r=undef
10bc17b6 13959 getlogin_r_proto=0
a48ec845 13960 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13961 * ) case "$getlogin_r_proto" in
13962 REENTRANT_PROTO*) ;;
13963 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13964 esac
13965 echo "Prototype: $try" ;;
13966 esac
13967 ;;
c18e646a
JH
13968 *) case "$usethreads" in
13969 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13970 esac
90e831dc
SB
13971 d_getlogin_r=undef
13972 getlogin_r_proto=0
c18e646a 13973 ;;
a48ec845
JH
13974 esac
13975 ;;
10bc17b6
JH
13976*) getlogin_r_proto=0
13977 ;;
13978esac
13979
b4eb6b3d
JH
13980: see if getmnt exists
13981set getmnt d_getmnt
13982eval $inlibc
13983
13984: see if getmntent exists
13985set getmntent d_getmntent
13986eval $inlibc
13987
5086dff9
MB
13988: see if getnameinfo exists
13989set getnameinfo d_getnameinfo
13990eval $inlibc
13991
b4eb6b3d
JH
13992: see if getnetbyaddr exists
13993set getnetbyaddr d_getnbyaddr
13994eval $inlibc
13995
13996: see if getnetbyname exists
13997set getnetbyname d_getnbyname
13998eval $inlibc
13999
14000: see if getnetent exists
14001set getnetent d_getnent
14002eval $inlibc
14003
10bc17b6
JH
14004: see if getnetbyaddr_r exists
14005set getnetbyaddr_r d_getnetbyaddr_r
14006eval $inlibc
14007case "$d_getnetbyaddr_r" in
14008"$define")
14009 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14010 case "$d_getnetbyaddr_r_proto:$usethreads" in
14011 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
14012 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14013 eval $hasproto ;;
14014 *) ;;
14015 esac
14016 case "$d_getnetbyaddr_r_proto" in
14017 define)
10bc17b6
JH
14018 case "$getnetbyaddr_r_proto" in
14019 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14020 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
10bc17b6
JH
14021 esac
14022 case "$getnetbyaddr_r_proto" in
14023 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
61c26d18 14024 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
10bc17b6
JH
14025 esac
14026 case "$getnetbyaddr_r_proto" in
14027 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
61c26d18 14028 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
10bc17b6
JH
14029 esac
14030 case "$getnetbyaddr_r_proto" in
14031 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
61c26d18 14032 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
10bc17b6
JH
14033 esac
14034 case "$getnetbyaddr_r_proto" in
14035 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
61c26d18 14036 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
10bc17b6
JH
14037 esac
14038 case "$getnetbyaddr_r_proto" in
14039 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
61c26d18 14040 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
10bc17b6
JH
14041 esac
14042 case "$getnetbyaddr_r_proto" in
14043 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
61c26d18 14044 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
10bc17b6
JH
14045 esac
14046 case "$getnetbyaddr_r_proto" in
a845a0d4 14047 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14048 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
a845a0d4
JH
14049 esac
14050 case "$getnetbyaddr_r_proto" in
90e831dc 14051 ''|0) d_getnetbyaddr_r=undef
10bc17b6 14052 getnetbyaddr_r_proto=0
a48ec845 14053 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14054 * ) case "$getnetbyaddr_r_proto" in
14055 REENTRANT_PROTO*) ;;
14056 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14057 esac
14058 echo "Prototype: $try" ;;
14059 esac
14060 ;;
c18e646a
JH
14061 *) case "$usethreads" in
14062 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14063 esac
90e831dc
SB
14064 d_getnetbyaddr_r=undef
14065 getnetbyaddr_r_proto=0
c18e646a 14066 ;;
a48ec845
JH
14067 esac
14068 ;;
10bc17b6
JH
14069*) getnetbyaddr_r_proto=0
14070 ;;
14071esac
14072
14073: see if getnetbyname_r exists
14074set getnetbyname_r d_getnetbyname_r
14075eval $inlibc
14076case "$d_getnetbyname_r" in
14077"$define")
14078 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14079 case "$d_getnetbyname_r_proto:$usethreads" in
14080 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
14081 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14082 eval $hasproto ;;
14083 *) ;;
14084 esac
14085 case "$d_getnetbyname_r_proto" in
14086 define)
10bc17b6
JH
14087 case "$getnetbyname_r_proto" in
14088 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14089 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
10bc17b6
JH
14090 esac
14091 case "$getnetbyname_r_proto" in
14092 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
61c26d18 14093 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
10bc17b6
JH
14094 esac
14095 case "$getnetbyname_r_proto" in
14096 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
61c26d18 14097 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
10bc17b6
JH
14098 esac
14099 case "$getnetbyname_r_proto" in
14100 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
61c26d18 14101 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
10bc17b6
JH
14102 esac
14103 case "$getnetbyname_r_proto" in
90e831dc 14104 ''|0) d_getnetbyname_r=undef
10bc17b6 14105 getnetbyname_r_proto=0
a48ec845 14106 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14107 * ) case "$getnetbyname_r_proto" in
14108 REENTRANT_PROTO*) ;;
14109 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14110 esac
14111 echo "Prototype: $try" ;;
14112 esac
14113 ;;
c18e646a
JH
14114 *) case "$usethreads" in
14115 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14116 esac
90e831dc
SB
14117 d_getnetbyname_r=undef
14118 getnetbyname_r_proto=0
c18e646a 14119 ;;
a48ec845
JH
14120 esac
14121 ;;
10bc17b6
JH
14122*) getnetbyname_r_proto=0
14123 ;;
14124esac
14125
14126: see if getnetent_r exists
14127set getnetent_r d_getnetent_r
14128eval $inlibc
14129case "$d_getnetent_r" in
14130"$define")
14131 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14132 case "$d_getnetent_r_proto:$usethreads" in
14133 ":define") d_getnetent_r_proto=define
a48ec845
JH
14134 set d_getnetent_r_proto getnetent_r $hdrs
14135 eval $hasproto ;;
14136 *) ;;
14137 esac
14138 case "$d_getnetent_r_proto" in
14139 define)
10bc17b6
JH
14140 case "$getnetent_r_proto" in
14141 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14142 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
10bc17b6
JH
14143 esac
14144 case "$getnetent_r_proto" in
14145 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
61c26d18 14146 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
10bc17b6
JH
14147 esac
14148 case "$getnetent_r_proto" in
14149 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
61c26d18 14150 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
10bc17b6
JH
14151 esac
14152 case "$getnetent_r_proto" in
14153 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
61c26d18 14154 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
10bc17b6
JH
14155 esac
14156 case "$getnetent_r_proto" in
14157 ''|0) try='int getnetent_r(struct netent*, char*, int);'
61c26d18 14158 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
10bc17b6
JH
14159 esac
14160 case "$getnetent_r_proto" in
14161 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
61c26d18 14162 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
10bc17b6
JH
14163 esac
14164 case "$getnetent_r_proto" in
90e831dc 14165 ''|0) d_getnetent_r=undef
10bc17b6 14166 getnetent_r_proto=0
a48ec845 14167 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14168 * ) case "$getnetent_r_proto" in
14169 REENTRANT_PROTO*) ;;
14170 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14171 esac
14172 echo "Prototype: $try" ;;
14173 esac
14174 ;;
c18e646a
JH
14175 *) case "$usethreads" in
14176 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14177 esac
90e831dc
SB
14178 d_getnetent_r=undef
14179 getnetent_r_proto=0
c18e646a 14180 ;;
a48ec845
JH
14181 esac
14182 ;;
10bc17b6
JH
14183*) getnetent_r_proto=0
14184 ;;
14185esac
14186
b4eb6b3d
JH
14187: see if prototypes for various getnetxxx netdb.h functions are available
14188echo " "
14189set d_getnetprotos getnetent $i_netdb netdb.h
14190eval $hasproto
14191
0c0643d0
JH
14192: see if getpagesize exists
14193set getpagesize d_getpagsz
14194eval $inlibc
14195
34f1896b 14196: Optional checks for getprotobyname and getprotobynumber
b4eb6b3d
JH
14197
14198: see if getprotobyname exists
14199set getprotobyname d_getpbyname
14200eval $inlibc
14201
14202: see if getprotobynumber exists
14203set getprotobynumber d_getpbynumber
14204eval $inlibc
14205
14206: see if getprotoent exists
14207set getprotoent d_getpent
14208eval $inlibc
14209
14210: see if getpgid exists
14211set getpgid d_getpgid
14212eval $inlibc
14213
14214: see if getpgrp2 exists
14215set getpgrp2 d_getpgrp2
14216eval $inlibc
14217
14218: see if getppid exists
14219set getppid d_getppid
14220eval $inlibc
14221
14222: see if getpriority exists
14223set getpriority d_getprior
14224eval $inlibc
14225
10bc17b6
JH
14226: see if getprotobyname_r exists
14227set getprotobyname_r d_getprotobyname_r
14228eval $inlibc
14229case "$d_getprotobyname_r" in
14230"$define")
14231 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14232 case "$d_getprotobyname_r_proto:$usethreads" in
14233 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
14234 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14235 eval $hasproto ;;
14236 *) ;;
14237 esac
14238 case "$d_getprotobyname_r_proto" in
14239 define)
10bc17b6
JH
14240 case "$getprotobyname_r_proto" in
14241 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14242 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
10bc17b6
JH
14243 esac
14244 case "$getprotobyname_r_proto" in
14245 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
61c26d18 14246 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
10bc17b6
JH
14247 esac
14248 case "$getprotobyname_r_proto" in
14249 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
61c26d18 14250 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
10bc17b6
JH
14251 esac
14252 case "$getprotobyname_r_proto" in
90e831dc 14253 ''|0) d_getprotobyname_r=undef
10bc17b6 14254 getprotobyname_r_proto=0
a48ec845 14255 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14256 * ) case "$getprotobyname_r_proto" in
14257 REENTRANT_PROTO*) ;;
14258 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14259 esac
14260 echo "Prototype: $try" ;;
14261 esac
14262 ;;
c18e646a
JH
14263 *) case "$usethreads" in
14264 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14265 esac
90e831dc
SB
14266 d_getprotobyname_r=undef
14267 getprotobyname_r_proto=0
c18e646a 14268 ;;
a48ec845
JH
14269 esac
14270 ;;
10bc17b6
JH
14271*) getprotobyname_r_proto=0
14272 ;;
14273esac
14274
14275: see if getprotobynumber_r exists
14276set getprotobynumber_r d_getprotobynumber_r
14277eval $inlibc
14278case "$d_getprotobynumber_r" in
14279"$define")
14280 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14281 case "$d_getprotobynumber_r_proto:$usethreads" in
14282 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
14283 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14284 eval $hasproto ;;
14285 *) ;;
14286 esac
14287 case "$d_getprotobynumber_r_proto" in
14288 define)
10bc17b6
JH
14289 case "$getprotobynumber_r_proto" in
14290 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14291 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
10bc17b6
JH
14292 esac
14293 case "$getprotobynumber_r_proto" in
14294 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
61c26d18 14295 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
10bc17b6
JH
14296 esac
14297 case "$getprotobynumber_r_proto" in
14298 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
61c26d18 14299 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
10bc17b6
JH
14300 esac
14301 case "$getprotobynumber_r_proto" in
90e831dc 14302 ''|0) d_getprotobynumber_r=undef
10bc17b6 14303 getprotobynumber_r_proto=0
a48ec845 14304 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14305 * ) case "$getprotobynumber_r_proto" in
14306 REENTRANT_PROTO*) ;;
14307 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14308 esac
14309 echo "Prototype: $try" ;;
14310 esac
14311 ;;
c18e646a
JH
14312 *) case "$usethreads" in
14313 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14314 esac
90e831dc
SB
14315 d_getprotobynumber_r=undef
14316 getprotobynumber_r_proto=0
c18e646a 14317 ;;
a48ec845
JH
14318 esac
14319 ;;
10bc17b6
JH
14320*) getprotobynumber_r_proto=0
14321 ;;
14322esac
14323
14324: see if getprotoent_r exists
14325set getprotoent_r d_getprotoent_r
14326eval $inlibc
14327case "$d_getprotoent_r" in
14328"$define")
14329 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14330 case "$d_getprotoent_r_proto:$usethreads" in
14331 ":define") d_getprotoent_r_proto=define
a48ec845
JH
14332 set d_getprotoent_r_proto getprotoent_r $hdrs
14333 eval $hasproto ;;
14334 *) ;;
14335 esac
14336 case "$d_getprotoent_r_proto" in
14337 define)
10bc17b6
JH
14338 case "$getprotoent_r_proto" in
14339 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14340 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
10bc17b6
JH
14341 esac
14342 case "$getprotoent_r_proto" in
14343 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
61c26d18 14344 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
10bc17b6
JH
14345 esac
14346 case "$getprotoent_r_proto" in
14347 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
61c26d18 14348 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
10bc17b6
JH
14349 esac
14350 case "$getprotoent_r_proto" in
14351 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
61c26d18 14352 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
10bc17b6
JH
14353 esac
14354 case "$getprotoent_r_proto" in
90e831dc 14355 ''|0) d_getprotoent_r=undef
10bc17b6 14356 getprotoent_r_proto=0
a48ec845 14357 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14358 * ) case "$getprotoent_r_proto" in
14359 REENTRANT_PROTO*) ;;
14360 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14361 esac
14362 echo "Prototype: $try" ;;
14363 esac
14364 ;;
c18e646a
JH
14365 *) case "$usethreads" in
14366 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14367 esac
90e831dc
SB
14368 d_getprotoent_r=undef
14369 getprotoent_r_proto=0
c18e646a 14370 ;;
a48ec845
JH
14371 esac
14372 ;;
10bc17b6
JH
14373*) getprotoent_r_proto=0
14374 ;;
14375esac
14376
b4eb6b3d
JH
14377: see if prototypes for various getprotoxxx netdb.h functions are available
14378echo " "
14379set d_getprotoprotos getprotoent $i_netdb netdb.h
14380eval $hasproto
14381
14382: see if getprpwnam exists
14383set getprpwnam d_getprpwnam
14384eval $inlibc
14385
14386: see if getpwent exists
14387set getpwent d_getpwent
14388eval $inlibc
14389
10bc17b6
JH
14390: see if getpwent_r exists
14391set getpwent_r d_getpwent_r
14392eval $inlibc
14393case "$d_getpwent_r" in
14394"$define")
14395 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14396 case "$d_getpwent_r_proto:$usethreads" in
14397 ":define") d_getpwent_r_proto=define
a48ec845
JH
14398 set d_getpwent_r_proto getpwent_r $hdrs
14399 eval $hasproto ;;
14400 *) ;;
14401 esac
14402 case "$d_getpwent_r_proto" in
14403 define)
10bc17b6
JH
14404 case "$getpwent_r_proto" in
14405 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14406 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
10bc17b6
JH
14407 esac
14408 case "$getpwent_r_proto" in
14409 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
61c26d18 14410 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
10bc17b6
JH
14411 esac
14412 case "$getpwent_r_proto" in
14413 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
61c26d18 14414 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
10bc17b6
JH
14415 esac
14416 case "$getpwent_r_proto" in
14417 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
61c26d18 14418 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
10bc17b6
JH
14419 esac
14420 case "$getpwent_r_proto" in
14421 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
61c26d18 14422 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
10bc17b6
JH
14423 esac
14424 case "$getpwent_r_proto" in
14425 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
61c26d18 14426 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
10bc17b6
JH
14427 esac
14428 case "$getpwent_r_proto" in
90e831dc 14429 ''|0) d_getpwent_r=undef
10bc17b6 14430 getpwent_r_proto=0
a48ec845 14431 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14432 * ) case "$getpwent_r_proto" in
14433 REENTRANT_PROTO*) ;;
14434 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14435 esac
14436 echo "Prototype: $try" ;;
14437 esac
14438 ;;
c18e646a
JH
14439 *) case "$usethreads" in
14440 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14441 esac
90e831dc
SB
14442 d_getpwent_r=undef
14443 getpwent_r_proto=0
c18e646a 14444 ;;
a48ec845
JH
14445 esac
14446 ;;
10bc17b6
JH
14447*) getpwent_r_proto=0
14448 ;;
14449esac
14450
14451: see if getpwnam_r exists
14452set getpwnam_r d_getpwnam_r
14453eval $inlibc
14454case "$d_getpwnam_r" in
14455"$define")
14456 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14457 case "$d_getpwnam_r_proto:$usethreads" in
14458 ":define") d_getpwnam_r_proto=define
a48ec845
JH
14459 set d_getpwnam_r_proto getpwnam_r $hdrs
14460 eval $hasproto ;;
14461 *) ;;
14462 esac
14463 case "$d_getpwnam_r_proto" in
14464 define)
10bc17b6
JH
14465 case "$getpwnam_r_proto" in
14466 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14467 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
10bc17b6
JH
14468 esac
14469 case "$getpwnam_r_proto" in
14470 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
61c26d18 14471 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
10bc17b6
JH
14472 esac
14473 case "$getpwnam_r_proto" in
14474 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
61c26d18 14475 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
10bc17b6
JH
14476 esac
14477 case "$getpwnam_r_proto" in
14478 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
61c26d18 14479 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
10bc17b6
JH
14480 esac
14481 case "$getpwnam_r_proto" in
90e831dc 14482 ''|0) d_getpwnam_r=undef
10bc17b6 14483 getpwnam_r_proto=0
a48ec845 14484 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14485 * ) case "$getpwnam_r_proto" in
14486 REENTRANT_PROTO*) ;;
14487 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14488 esac
14489 echo "Prototype: $try" ;;
14490 esac
14491 ;;
c18e646a
JH
14492 *) case "$usethreads" in
14493 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14494 esac
90e831dc
SB
14495 d_getpwnam_r=undef
14496 getpwnam_r_proto=0
c18e646a 14497 ;;
a48ec845
JH
14498 esac
14499 ;;
10bc17b6
JH
14500*) getpwnam_r_proto=0
14501 ;;
14502esac
14503
14504: see if getpwuid_r exists
14505set getpwuid_r d_getpwuid_r
14506eval $inlibc
14507case "$d_getpwuid_r" in
14508"$define")
14509 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14510 case "$d_getpwuid_r_proto:$usethreads" in
14511 ":define") d_getpwuid_r_proto=define
a48ec845
JH
14512 set d_getpwuid_r_proto getpwuid_r $hdrs
14513 eval $hasproto ;;
14514 *) ;;
14515 esac
14516 case "$d_getpwuid_r_proto" in
14517 define)
10bc17b6
JH
14518 case "$getpwuid_r_proto" in
14519 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14520 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
10bc17b6
JH
14521 esac
14522 case "$getpwuid_r_proto" in
14523 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
61c26d18 14524 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
10bc17b6
JH
14525 esac
14526 case "$getpwuid_r_proto" in
14527 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
61c26d18 14528 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
10bc17b6
JH
14529 esac
14530 case "$getpwuid_r_proto" in
14531 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
61c26d18 14532 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
10bc17b6
JH
14533 esac
14534 case "$getpwuid_r_proto" in
90e831dc 14535 ''|0) d_getpwuid_r=undef
10bc17b6 14536 getpwuid_r_proto=0
a48ec845 14537 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14538 * ) case "$getpwuid_r_proto" in
14539 REENTRANT_PROTO*) ;;
14540 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14541 esac
14542 echo "Prototype: $try" ;;
14543 esac
14544 ;;
c18e646a
JH
14545 *) case "$usethreads" in
14546 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14547 esac
90e831dc
SB
14548 d_getpwuid_r=undef
14549 getpwuid_r_proto=0
c18e646a 14550 ;;
a48ec845
JH
14551 esac
14552 ;;
10bc17b6
JH
14553*) getpwuid_r_proto=0
14554 ;;
14555esac
14556
34f1896b 14557: Optional checks for getsbyname and getsbyport
b4eb6b3d
JH
14558
14559: see if getservbyname exists
14560set getservbyname d_getsbyname
14561eval $inlibc
14562
14563: see if getservbyport exists
14564set getservbyport d_getsbyport
14565eval $inlibc
14566
14567: see if getservent exists
14568set getservent d_getsent
14569eval $inlibc
14570
10bc17b6
JH
14571: see if getservbyname_r exists
14572set getservbyname_r d_getservbyname_r
14573eval $inlibc
14574case "$d_getservbyname_r" in
14575"$define")
14576 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14577 case "$d_getservbyname_r_proto:$usethreads" in
14578 ":define") d_getservbyname_r_proto=define
a48ec845
JH
14579 set d_getservbyname_r_proto getservbyname_r $hdrs
14580 eval $hasproto ;;
14581 *) ;;
14582 esac
14583 case "$d_getservbyname_r_proto" in
14584 define)
10bc17b6
JH
14585 case "$getservbyname_r_proto" in
14586 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
61c26d18 14587 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
10bc17b6
JH
14588 esac
14589 case "$getservbyname_r_proto" in
14590 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
61c26d18 14591 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
10bc17b6
JH
14592 esac
14593 case "$getservbyname_r_proto" in
14594 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
61c26d18 14595 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
10bc17b6
JH
14596 esac
14597 case "$getservbyname_r_proto" in
90e831dc 14598 ''|0) d_getservbyname_r=undef
10bc17b6 14599 getservbyname_r_proto=0
a48ec845 14600 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14601 * ) case "$getservbyname_r_proto" in
14602 REENTRANT_PROTO*) ;;
14603 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14604 esac
14605 echo "Prototype: $try" ;;
14606 esac
14607 ;;
c18e646a
JH
14608 *) case "$usethreads" in
14609 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14610 esac
90e831dc
SB
14611 d_getservbyname_r=undef
14612 getservbyname_r_proto=0
c18e646a 14613 ;;
a48ec845
JH
14614 esac
14615 ;;
10bc17b6
JH
14616*) getservbyname_r_proto=0
14617 ;;
14618esac
14619
14620: see if getservbyport_r exists
14621set getservbyport_r d_getservbyport_r
14622eval $inlibc
14623case "$d_getservbyport_r" in
14624"$define")
14625 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14626 case "$d_getservbyport_r_proto:$usethreads" in
14627 ":define") d_getservbyport_r_proto=define
a48ec845
JH
14628 set d_getservbyport_r_proto getservbyport_r $hdrs
14629 eval $hasproto ;;
14630 *) ;;
14631 esac
14632 case "$d_getservbyport_r_proto" in
14633 define)
10bc17b6
JH
14634 case "$getservbyport_r_proto" in
14635 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
61c26d18 14636 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
10bc17b6
JH
14637 esac
14638 case "$getservbyport_r_proto" in
14639 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
61c26d18 14640 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
10bc17b6
JH
14641 esac
14642 case "$getservbyport_r_proto" in
14643 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
61c26d18 14644 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
10bc17b6
JH
14645 esac
14646 case "$getservbyport_r_proto" in
90e831dc 14647 ''|0) d_getservbyport_r=undef
10bc17b6 14648 getservbyport_r_proto=0
a48ec845 14649 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14650 * ) case "$getservbyport_r_proto" in
14651 REENTRANT_PROTO*) ;;
14652 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14653 esac
14654 echo "Prototype: $try" ;;
14655 esac
14656 ;;
c18e646a
JH
14657 *) case "$usethreads" in
14658 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14659 esac
90e831dc
SB
14660 d_getservbyport_r=undef
14661 getservbyport_r_proto=0
c18e646a 14662 ;;
a48ec845
JH
14663 esac
14664 ;;
10bc17b6
JH
14665*) getservbyport_r_proto=0
14666 ;;
14667esac
14668
14669: see if getservent_r exists
14670set getservent_r d_getservent_r
14671eval $inlibc
14672case "$d_getservent_r" in
14673"$define")
14674 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14675 case "$d_getservent_r_proto:$usethreads" in
14676 ":define") d_getservent_r_proto=define
a48ec845
JH
14677 set d_getservent_r_proto getservent_r $hdrs
14678 eval $hasproto ;;
14679 *) ;;
14680 esac
14681 case "$d_getservent_r_proto" in
14682 define)
10bc17b6
JH
14683 case "$getservent_r_proto" in
14684 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
61c26d18 14685 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
10bc17b6
JH
14686 esac
14687 case "$getservent_r_proto" in
14688 ''|0) try='int getservent_r(struct servent*, char*, int);'
61c26d18 14689 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
10bc17b6
JH
14690 esac
14691 case "$getservent_r_proto" in
14692 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
61c26d18 14693 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
10bc17b6
JH
14694 esac
14695 case "$getservent_r_proto" in
14696 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
61c26d18 14697 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
10bc17b6
JH
14698 esac
14699 case "$getservent_r_proto" in
90e831dc 14700 ''|0) d_getservent_r=undef
10bc17b6 14701 getservent_r_proto=0
a48ec845 14702 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14703 * ) case "$getservent_r_proto" in
14704 REENTRANT_PROTO*) ;;
14705 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14706 esac
14707 echo "Prototype: $try" ;;
14708 esac
14709 ;;
c18e646a
JH
14710 *) case "$usethreads" in
14711 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14712 esac
90e831dc
SB
14713 d_getservent_r=undef
14714 getservent_r_proto=0
c18e646a 14715 ;;
a48ec845
JH
14716 esac
14717 ;;
10bc17b6
JH
14718*) getservent_r_proto=0
14719 ;;
14720esac
14721
b4eb6b3d
JH
14722: see if prototypes for various getservxxx netdb.h functions are available
14723echo " "
14724set d_getservprotos getservent $i_netdb netdb.h
14725eval $hasproto
14726
14727: see if getspnam exists
14728set getspnam d_getspnam
14729eval $inlibc
14730
10bc17b6
JH
14731: see if this is a shadow.h system
14732set shadow.h i_shadow
14733eval $inhdr
14734
14735: see if getspnam_r exists
14736set getspnam_r d_getspnam_r
14737eval $inlibc
14738case "$d_getspnam_r" in
14739"$define")
14740 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
14741 case "$d_getspnam_r_proto:$usethreads" in
14742 ":define") d_getspnam_r_proto=define
a48ec845
JH
14743 set d_getspnam_r_proto getspnam_r $hdrs
14744 eval $hasproto ;;
14745 *) ;;
14746 esac
14747 case "$d_getspnam_r_proto" in
14748 define)
10bc17b6
JH
14749 case "$getspnam_r_proto" in
14750 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
61c26d18 14751 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
10bc17b6
JH
14752 esac
14753 case "$getspnam_r_proto" in
14754 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
61c26d18 14755 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
10bc17b6
JH
14756 esac
14757 case "$getspnam_r_proto" in
90e831dc 14758 ''|0) d_getspnam_r=undef
10bc17b6 14759 getspnam_r_proto=0
a48ec845 14760 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14761 * ) case "$getspnam_r_proto" in
14762 REENTRANT_PROTO*) ;;
14763 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14764 esac
14765 echo "Prototype: $try" ;;
14766 esac
14767 ;;
c18e646a
JH
14768 *) case "$usethreads" in
14769 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14770 esac
90e831dc
SB
14771 d_getspnam_r=undef
14772 getspnam_r_proto=0
c18e646a 14773 ;;
a48ec845
JH
14774 esac
14775 ;;
10bc17b6
JH
14776*) getspnam_r_proto=0
14777 ;;
14778esac
14779
b4eb6b3d
JH
14780: see if gettimeofday or ftime exists
14781set gettimeofday d_gettimeod
14782eval $inlibc
14783case "$d_gettimeod" in
14784"$undef")
14785 set ftime d_ftime
14786 eval $inlibc
14787 ;;
14788*)
14789 val="$undef"; set d_ftime; eval $setvar
14790 ;;
14791esac
14792case "$d_gettimeod$d_ftime" in
14793"$undef$undef")
14794 echo " "
14795 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14796 ;;
14797esac
14798
10bc17b6
JH
14799: see if gmtime_r exists
14800set gmtime_r d_gmtime_r
14801eval $inlibc
14802case "$d_gmtime_r" in
14803"$define")
d63eadf0 14804 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14805 case "$d_gmtime_r_proto:$usethreads" in
14806 ":define") d_gmtime_r_proto=define
a48ec845
JH
14807 set d_gmtime_r_proto gmtime_r $hdrs
14808 eval $hasproto ;;
14809 *) ;;
14810 esac
14811 case "$d_gmtime_r_proto" in
14812 define)
10bc17b6
JH
14813 case "$gmtime_r_proto" in
14814 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
61c26d18 14815 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
10bc17b6
JH
14816 esac
14817 case "$gmtime_r_proto" in
14818 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
61c26d18 14819 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
10bc17b6
JH
14820 esac
14821 case "$gmtime_r_proto" in
90e831dc 14822 ''|0) d_gmtime_r=undef
10bc17b6 14823 gmtime_r_proto=0
a48ec845 14824 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14825 * ) case "$gmtime_r_proto" in
14826 REENTRANT_PROTO*) ;;
14827 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14828 esac
14829 echo "Prototype: $try" ;;
14830 esac
b4eb6b3d 14831 ;;
c18e646a
JH
14832 *) case "$usethreads" in
14833 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14834 esac
90e831dc
SB
14835 d_gmtime_r=undef
14836 gmtime_r_proto=0
c18e646a 14837 ;;
a48ec845
JH
14838 esac
14839 ;;
10bc17b6 14840*) gmtime_r_proto=0
b4eb6b3d
JH
14841 ;;
14842esac
14843
14844: see if hasmntopt exists
14845set hasmntopt d_hasmntopt
14846eval $inlibc
14847
14848: see if this is a netinet/in.h or sys/in.h system
14849set netinet/in.h i_niin sys/in.h i_sysin
14850eval $inhdr
14851
14852: see if arpa/inet.h has to be included
14853set arpa/inet.h i_arpainet
14854eval $inhdr
14855
14856: see if htonl --and friends-- exists
14857val=''
14858set htonl val
14859eval $inlibc
14860
14861: Maybe they are macros.
14862case "$val" in
14863$undef)
14864 $cat >htonl.c <<EOM
14865#include <stdio.h>
14866#include <sys/types.h>
14867#$i_niin I_NETINET_IN
14868#$i_sysin I_SYS_IN
14869#$i_arpainet I_ARPA_INET
14870#ifdef I_NETINET_IN
14871#include <netinet/in.h>
14872#endif
14873#ifdef I_SYS_IN
14874#include <sys/in.h>
14875#endif
14876#ifdef I_ARPA_INET
14877#include <arpa/inet.h>
14878#endif
14879#ifdef htonl
14880printf("Defined as a macro.");
14881#endif
14882EOM
14883 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14884 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14885 val="$define"
14886 echo "But it seems to be defined as a macro." >&4
14887 fi
14888 $rm -f htonl.?
14889 ;;
14890esac
14891set d_htonl
14892eval $setvar
14893
36adc09b
JH
14894: see if ilogbl exists
14895set ilogbl d_ilogbl
14896eval $inlibc
14897
b4eb6b3d
JH
14898: index or strchr
14899echo " "
14900if set index val -f; eval $csym; $val; then
14901 if set strchr val -f d_strchr; eval $csym; $val; then
14902 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14903 val="$define"
14904 vali="$undef"
14905 echo "strchr() found." >&4
14906 else
14907 val="$undef"
14908 vali="$define"
14909 echo "index() found." >&4
14910 fi
14911 else
14912 val="$undef"
14913 vali="$define"
8dfa8df9
JH
14914 echo "index() found." >&4
14915 fi
b4eb6b3d 14916else
8dfa8df9
JH
14917 if set strchr val -f d_strchr; eval $csym; $val; then
14918 val="$define"
14919 vali="$undef"
14920 echo "strchr() found." >&4
14921 else
14922 echo "No index() or strchr() found!" >&4
14923 val="$undef"
14924 vali="$undef"
14925 fi
b4eb6b3d 14926fi
8dfa8df9
JH
14927set d_strchr; eval $setvar
14928val="$vali"
14929set d_index; eval $setvar
14930
14931: check whether inet_aton exists
14932set inet_aton d_inetaton
14933eval $inlibc
b4eb6b3d 14934
5086dff9
MB
14935: see if inet_ntop exists
14936set inet_ntop d_inetntop
14937eval $inlibc
14938
14939: see if inet_pton exists
14940set inet_pton d_inetpton
14941eval $inlibc
14942
b4eb6b3d
JH
14943: Look for isascii
14944echo " "
36adc09b 14945$cat >isascii.c <<EOCP
b4eb6b3d
JH
14946#include <stdio.h>
14947#include <ctype.h>
55954f19
JH
14948#$i_stdlib I_STDLIB
14949#ifdef I_STDLIB
14950#include <stdlib.h>
14951#endif
b4eb6b3d
JH
14952int main() {
14953 int c = 'A';
14954 if (isascii(c))
14955 exit(0);
14956 else
14957 exit(1);
14958}
14959EOCP
14960set isascii
14961if eval $compile; then
14962 echo "isascii() found." >&4
14963 val="$define"
14964else
14965 echo "isascii() NOT found." >&4
14966 val="$undef"
14967fi
14968set d_isascii
14969eval $setvar
14970$rm -f isascii*
14971
269a7913
MB
14972: Look for isblank
14973echo " "
14974$cat >isblank.c <<'EOCP'
14975#include <stdio.h>
14976#include <ctype.h>
14977int main() {
9f791ac6 14978 int c = ' ';
269a7913
MB
14979 if (isblank(c))
14980 exit(0);
14981 else
14982 exit(1);
14983}
14984EOCP
14985if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
14986 echo "isblank() found." >&4
14987 val="$define"
14988else
14989 echo "isblank() NOT found." >&4
14990 val="$undef"
14991fi
14992set d_isblank
14993eval $setvar
14994$rm -f isblank*
14995
758a5d79
JH
14996: see if isfinite exists
14997set isfinite d_isfinite
14998eval $inlibc
14999
15000: see if isinf exists
15001set isinf d_isinf
15002eval $inlibc
15003
b4eb6b3d
JH
15004: see if isnan exists
15005set isnan d_isnan
15006eval $inlibc
15007
15008: see if isnanl exists
15009set isnanl d_isnanl
15010eval $inlibc
15011
15012: see if killpg exists
15013set killpg d_killpg
15014eval $inlibc
15015
15016: see if lchown exists
15017echo " "
15018$cat > try.c <<'EOCP'
15019/* System header to define __stub macros and hopefully few prototypes,
15020 which can conflict with char lchown(); below. */
15021#include <assert.h>
15022/* Override any gcc2 internal prototype to avoid an error. */
15023/* We use char because int might match the return type of a gcc2
15024 builtin and then its argument prototype would still apply. */
15025char lchown();
15026int main() {
15027 /* The GNU C library defines this for functions which it implements
15028 to always fail with ENOSYS. Some functions are actually named
15029 something starting with __ and the normal name is an alias. */
15030#if defined (__stub_lchown) || defined (__stub___lchown)
15031choke me
15032#else
15033lchown();
15034#endif
15035; return 0; }
15036EOCP
15037set try
15038if eval $compile; then
15039 $echo "lchown() found." >&4
15040 val="$define"
15041else
15042 $echo "lchown() NOT found." >&4
15043 val="$undef"
15044fi
15045set d_lchown
15046eval $setvar
15047
15048: See if number of significant digits in a double precision number is known
15049echo " "
15050$cat >ldbl_dig.c <<EOM
15051#$i_limits I_LIMITS
15052#$i_float I_FLOAT
15053#ifdef I_LIMITS
15054#include <limits.h>
15055#endif
15056#ifdef I_FLOAT
15057#include <float.h>
15058#endif
15059#ifdef LDBL_DIG
15060printf("Contains LDBL_DIG");
15061#endif
15062EOM
15063$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15064if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15065 echo "LDBL_DIG found." >&4
15066 val="$define"
15067else
15068 echo "LDBL_DIG NOT found." >&4
15069 val="$undef"
15070fi
15071$rm -f ldbl_dig.?
15072set d_ldbl_dig
15073eval $setvar
15074
0a0abfba
MB
15075: see if this is a math.h system
15076set math.h i_math
15077eval $inhdr
15078
613d6c3e 15079: check to see if math.h defines _LIB_VERSION
0a0abfba
MB
15080d_libm_lib_version="$undef"
15081case $i_math in
15082 $define)
0a0abfba
MB
15083 echo " "
15084 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15085 $cat >try.c <<EOCP
15086#include <unistd.h>
15087#include <math.h>
15088int main (int argc, char *argv[])
15089{
15090 printf ("%d\n", _LIB_VERSION);
15091 return (0);
15092 } /* main */
15093EOCP
15094 set try
15095 if eval $compile; then
15096 foo=`$run ./try`
15097 echo "Yes, it does ($foo)" >&4
15098 d_libm_lib_version="$define"
15099 else
4dd8f9b3 15100 echo "No, it does not (probably harmless)" >&4
0a0abfba 15101 fi
5b813a60 15102 $rm_try
0a0abfba
MB
15103 ;;
15104
15105 esac
15106
b4eb6b3d
JH
15107: see if link exists
15108set link d_link
15109eval $inlibc
15110
10bc17b6
JH
15111: see if localtime_r exists
15112set localtime_r d_localtime_r
15113eval $inlibc
15114case "$d_localtime_r" in
15115"$define")
d63eadf0 15116 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
15117 case "$d_localtime_r_proto:$usethreads" in
15118 ":define") d_localtime_r_proto=define
a48ec845
JH
15119 set d_localtime_r_proto localtime_r $hdrs
15120 eval $hasproto ;;
15121 *) ;;
15122 esac
15123 case "$d_localtime_r_proto" in
15124 define)
10bc17b6
JH
15125 case "$localtime_r_proto" in
15126 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
61c26d18 15127 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
10bc17b6
JH
15128 esac
15129 case "$localtime_r_proto" in
15130 ''|0) try='int localtime_r(const time_t*, struct tm*);'
61c26d18 15131 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
10bc17b6
JH
15132 esac
15133 case "$localtime_r_proto" in
90e831dc 15134 ''|0) d_localtime_r=undef
10bc17b6 15135 localtime_r_proto=0
a48ec845 15136 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15137 * ) case "$localtime_r_proto" in
15138 REENTRANT_PROTO*) ;;
15139 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15140 esac
15141 echo "Prototype: $try" ;;
15142 esac
15143 ;;
c18e646a
JH
15144 *) case "$usethreads" in
15145 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15146 esac
90e831dc
SB
15147 d_localtime_r=undef
15148 localtime_r_proto=0
c18e646a 15149 ;;
a48ec845
JH
15150 esac
15151 ;;
10bc17b6
JH
15152*) localtime_r_proto=0
15153 ;;
15154esac
15155
8572b25d
BH
15156: see if localtime_r calls tzset
15157case "$localtime_r_proto" in
15158REENTRANT_PROTO*)
15159 $cat >try.c <<EOCP
15160/* Does our libc's localtime_r call tzset ?
15161 * return 0 if so, 1 otherwise.
15162 */
61c26d18
MHM
15163#$i_systypes I_SYS_TYPES
15164#$i_unistd I_UNISTD
15165#$i_time I_TIME
15166#$i_stdlib I_STDLIB
15167#$i_string I_STRING
15168#$i_malloc I_MALLOC
15169#ifdef I_SYS_TYPES
15170# include <sys/types.h>
15171#endif
15172#ifdef I_UNISTD
15173# include <unistd.h>
15174#endif
15175#ifdef I_TIME
15176# include <time.h>
15177#endif
15178#ifdef I_STDLIB
15179#include <stdlib.h>
15180#endif
15181#ifdef I_STRING
15182# include <string.h>
15183#else
15184# include <strings.h>
15185#endif
15186#ifdef I_MALLOC
15187# include <malloc.h>
15188#endif
8572b25d
BH
15189int main()
15190{
15191 time_t t = time(0L);
15192 char w_tz[]="TZ" "=GMT+5",
15193 e_tz[]="TZ" "=GMT-5",
15194 *tz_e = (char*)malloc(16),
15195 *tz_w = (char*)malloc(16);
15196 struct tm tm_e, tm_w;
15197 memset(&tm_e,'\0',sizeof(struct tm));
15198 memset(&tm_w,'\0',sizeof(struct tm));
15199 strcpy(tz_e,e_tz);
15200 strcpy(tz_w,w_tz);
15201
15202 putenv(tz_e);
15203 localtime_r(&t, &tm_e);
15204
15205 putenv(tz_w);
15206 localtime_r(&t, &tm_w);
15207
15208 if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15209 return 1;
15210 return 0;
15211}
15212EOCP
15213 set try
15214 if eval $compile; then
43dddb59 15215 if $run ./try; then
8572b25d
BH
15216 d_localtime_r_needs_tzset=undef;
15217 else
15218 d_localtime_r_needs_tzset=define;
15219 fi;
15220 else
15221 d_localtime_r_needs_tzset=undef;
15222 fi;
15223 ;;
15224 *)
15225 d_localtime_r_needs_tzset=undef;
15226 ;;
15227esac
5b813a60 15228$rm_try
8572b25d 15229
b4eb6b3d
JH
15230: see if localeconv exists
15231set localeconv d_locconv
15232eval $inlibc
15233
15234: see if lockf exists
15235set lockf d_lockf
15236eval $inlibc
15237
b4eb6b3d
JH
15238: see if prototype for lseek is available
15239echo " "
4786929f 15240set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
15241eval $hasproto
15242
15243: see if lstat exists
15244set lstat d_lstat
15245eval $inlibc
15246
15247: see if madvise exists
15248set madvise d_madvise
15249eval $inlibc
15250
7dd121ae
MB
15251: see if malloc_size exists
15252set malloc_size d_malloc_size
15253eval $inlibc
15254
15255: see if malloc_size_good exists
15256set malloc_good_size d_malloc_good_size
15257eval $inlibc
15258
b4eb6b3d
JH
15259: see if mblen exists
15260set mblen d_mblen
15261eval $inlibc
15262
15263: see if mbstowcs exists
15264set mbstowcs d_mbstowcs
15265eval $inlibc
15266
15267: see if mbtowc exists
15268set mbtowc d_mbtowc
15269eval $inlibc
15270
15271: see if memchr exists
15272set memchr d_memchr
15273eval $inlibc
15274
15275: see if memcmp exists
15276set memcmp d_memcmp
15277eval $inlibc
15278
15279: see if memcpy exists
15280set memcpy d_memcpy
15281eval $inlibc
15282
15283: see if memmove exists
15284set memmove d_memmove
15285eval $inlibc
15286
15287: see if memset exists
15288set memset d_memset
15289eval $inlibc
15290
15291: see if mkdir exists
15292set mkdir d_mkdir
15293eval $inlibc
15294
15295: see if mkdtemp exists
15296set mkdtemp d_mkdtemp
15297eval $inlibc
15298
15299: see if mkfifo exists
15300set mkfifo d_mkfifo
15301eval $inlibc
15302
15303: see if mkstemp exists
15304set mkstemp d_mkstemp
15305eval $inlibc
15306
15307: see if mkstemps exists
15308set mkstemps d_mkstemps
15309eval $inlibc
15310
15311: see if mktime exists
15312set mktime d_mktime
15313eval $inlibc
15314
15315: see if this is a sys/mman.h system
15316set sys/mman.h i_sysmman
15317eval $inhdr
15318
15319: see if mmap exists
15320set mmap d_mmap
15321eval $inlibc
15322: see what shmat returns
15323: default to something harmless
15324mmaptype='void *'
15325case "$i_sysmman$d_mmap" in
15326"$define$define")
15327 $cat >mmap.c <<'END'
15328#include <sys/mman.h>
15329void *mmap();
15330END
15331 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15332 mmaptype='void *'
15333 else
15334 mmaptype='caddr_t'
15335 fi
15336 echo "and it returns ($mmaptype)." >&4
15337 ;;
15338esac
15339
15340
15341
89ce900e
JH
15342: see if sqrtl exists
15343set sqrtl d_sqrtl
15344eval $inlibc
15345
af1ff193
JH
15346: see if scalbnl exists
15347set scalbnl d_scalbnl
15348eval $inlibc
15349
89ce900e
JH
15350: see if modfl exists
15351set modfl d_modfl
15352eval $inlibc
15353
15354: see if prototype for modfl is available
15355echo " "
3a794506 15356set d_modflproto modfl $i_math math.h
89ce900e
JH
15357eval $hasproto
15358
15359d_modfl_pow32_bug="$undef"
15360
15361case "$d_longdbl$d_modfl" in
15362$define$define)
15363 $cat <<EOM
15364Checking to see whether your modfl() is okay for large values...
15365EOM
15366$cat >try.c <<EOCP
5b813a60 15367#include <math.h>
89ce900e
JH
15368#include <stdio.h>
15369EOCP
15370if $test "X$d_modflproto" != "X$define"; then
15371 $cat >>try.c <<EOCP
5b813a60 15372/* Sigh. many current glibcs provide the function, but do not prototype it. */
89ce900e
JH
15373long double modfl (long double, long double *);
15374EOCP
15375fi
15376$cat >>try.c <<EOCP
15377int main() {
15378 long double nv = 4294967303.15;
15379 long double v, w;
5b813a60 15380 v = modfl(nv, &w);
89ce900e
JH
15381#ifdef __GLIBC__
15382 printf("glibc");
15383#endif
15384 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15385 return 0;
15386}
15387EOCP
15388 case "$osname:$gccversion" in
15389 aix:) saveccflags="$ccflags"
15390 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15391 esac
15392 set try
15393 if eval $compile; then
15394 foo=`$run ./try`
15395 case "$foo" in
15396 *" 4294967303.150000 1.150000 4294967302.000000")
15397 echo >&4 "Your modfl() is broken for large values."
15398 d_modfl_pow32_bug="$define"
15399 case "$foo" in
15400 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15401 ;;
15402 esac
15403 ;;
15404 *" 4294967303.150000 0.150000 4294967303.000000")
15405 echo >&4 "Your modfl() seems okay for large values."
15406 ;;
15407 *) echo >&4 "I don't understand your modfl() at all."
15408 d_modfl="$undef"
15409 ;;
15410 esac
5b813a60 15411 $rm_try
89ce900e
JH
15412 else
15413 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15414 d_modfl="$undef"
15415 fi
15416 case "$osname:$gccversion" in
15417 aix:) ccflags="$saveccflags" ;; # restore
15418 esac
15419 ;;
15420esac
15421
15422if $test "$uselongdouble" = "$define"; then
af1ff193
JH
15423 message=""
15424 if $test "$d_sqrtl" != "$define"; then
15425 message="$message sqrtl"
15426 fi
15427 if $test "$d_modfl" != "$define"; then
89ce900e
JH
15428 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15429 echo "You have both aintl and copysignl, so I can emulate modfl."
15430 else
af1ff193 15431 message="$message modfl"
89ce900e 15432 fi
af1ff193
JH
15433 fi
15434 if $test "$d_frexpl" != "$define"; then
15435 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15436 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15437 else
15438 message="$message frexpl"
15439 fi
15440 fi
89ce900e 15441
af1ff193 15442 if $test "$message" != ""; then
89ce900e
JH
15443 $cat <<EOM >&4
15444
15445*** You requested the use of long doubles but you do not seem to have
af1ff193
JH
15446*** the following mathematical functions needed for long double support:
15447*** $message
fe63a0b4
JH
15448*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15449*** Cannot continue, aborting.
89ce900e
JH
15450
15451EOM
15452
fe63a0b4 15453 exit 1
89ce900e
JH
15454 fi
15455fi
15456
b4eb6b3d
JH
15457: see if mprotect exists
15458set mprotect d_mprotect
15459eval $inlibc
15460
15461: see if msgctl exists
15462set msgctl d_msgctl
15463eval $inlibc
15464
15465: see if msgget exists
15466set msgget d_msgget
15467eval $inlibc
15468
15469: see if msgsnd exists
15470set msgsnd d_msgsnd
15471eval $inlibc
15472
15473: see if msgrcv exists
15474set msgrcv d_msgrcv
15475eval $inlibc
15476
15477: see how much of the 'msg*(2)' library is present.
15478h_msg=true
15479echo " "
15480case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15481*"$undef"*) h_msg=false;;
15482esac
15483case "$osname" in
15484freebsd)
15485 case "`ipcs 2>&1`" in
15486 "SVID messages"*"not configured"*)
15487 echo "Your $osname does not have the msg*(2) configured." >&4
15488 h_msg=false
15489 val="$undef"
15490 set msgctl d_msgctl
15491 eval $setvar
15492 set msgget d_msgget
15493 eval $setvar
15494 set msgsnd d_msgsnd
15495 eval $setvar
15496 set msgrcv d_msgrcv
15497 eval $setvar
15498 ;;
15499 esac
15500 ;;
15501esac
15502: we could also check for sys/ipc.h ...
15503if $h_msg && $test `./findhdr sys/msg.h`; then
15504 echo "You have the full msg*(2) library." >&4
15505 val="$define"
15506else
15507 echo "You don't have the full msg*(2) library." >&4
15508 val="$undef"
15509fi
15510set d_msg
15511eval $setvar
15512
34f1896b 15513: Check for msghdr_s
4e0554ec
JH
15514echo " "
15515echo "Checking to see if your system supports struct msghdr..." >&4
15516set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15517eval $hasstruct
15518case "$d_msghdr_s" in
15519"$define") echo "Yes, it does." ;;
15520*) echo "No, it doesn't." ;;
15521esac
15522
15523
b4eb6b3d
JH
15524: see if msync exists
15525set msync d_msync
15526eval $inlibc
15527
15528: see if munmap exists
15529set munmap d_munmap
15530eval $inlibc
15531
15532: see if nice exists
15533set nice d_nice
15534eval $inlibc
15535
2765b840
JH
15536: see if this is a langinfo.h system
15537set langinfo.h i_langinfo
15538eval $inhdr
15539
15540: see if nl_langinfo exists
15541set nl_langinfo d_nl_langinfo
15542eval $inlibc
15543
1d1be0dc
NC
15544: check for volatile keyword
15545echo " "
15546echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15547$cat >try.c <<'EOCP'
76f47787 15548int main()
1d1be0dc
NC
15549{
15550 typedef struct _goo_struct goo_struct;
15551 goo_struct * volatile goo = ((goo_struct *)0);
15552 struct _goo_struct {
15553 long long_int;
15554 int reg_int;
15555 char char_var;
15556 };
15557 typedef unsigned short foo_t;
15558 char *volatile foo;
15559 volatile int bar;
15560 volatile foo_t blech;
15561 foo = foo;
15562}
15563EOCP
15564if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15565 val="$define"
15566 echo "Yup, it does."
15567else
15568 val="$undef"
15569 echo "Nope, it doesn't."
15570fi
15571set d_volatile
15572eval $setvar
5b813a60 15573$rm_try
1d1be0dc 15574
613d6c3e 15575: Check basic sizes
b4eb6b3d
JH
15576echo " "
15577$echo "Choosing the C types to be used for Perl's internal types..." >&4
15578
15579case "$use64bitint:$d_quad:$quadtype" in
15580define:define:?*)
15581 ivtype="$quadtype"
15582 uvtype="$uquadtype"
15583 ivsize=8
15584 uvsize=8
15585 ;;
15586*) ivtype="long"
15587 uvtype="unsigned long"
15588 ivsize=$longsize
15589 uvsize=$longsize
15590 ;;
15591esac
15592
15593case "$uselongdouble:$d_longdbl" in
15594define:define)
15595 nvtype="long double"
15596 nvsize=$longdblsize
15597 ;;
15598*) nvtype=double
15599 nvsize=$doublesize
15600 ;;
15601esac
15602
15603$echo "(IV will be "$ivtype", $ivsize bytes)"
15604$echo "(UV will be "$uvtype", $uvsize bytes)"
15605$echo "(NV will be "$nvtype", $nvsize bytes)"
15606
15607$cat >try.c <<EOCP
15608#$i_inttypes I_INTTYPES
15609#ifdef I_INTTYPES
15610#include <inttypes.h>
15611#endif
15612#include <stdio.h>
15613int main() {
15614#ifdef INT8
15615 int8_t i = INT8_MAX;
15616 uint8_t u = UINT8_MAX;
15617 printf("int8_t\n");
15618#endif
15619#ifdef INT16
15620 int16_t i = INT16_MAX;
15621 uint16_t i = UINT16_MAX;
15622 printf("int16_t\n");
15623#endif
15624#ifdef INT32
15625 int32_t i = INT32_MAX;
15626 uint32_t u = UINT32_MAX;
15627 printf("int32_t\n");
15628#endif
15629}
15630EOCP
15631
13187456 15632i8type="signed char"
0ab0821a
MB
15633u8type="unsigned char"
15634i8size=1
15635u8size=1
b4eb6b3d
JH
15636
15637case "$i16type" in
15638'') case "$shortsize" in
15639 2) i16type=short
15640 u16type="unsigned short"
15641 i16size=$shortsize
15642 u16size=$shortsize
15643 ;;
15644 esac
15645 ;;
15646esac
15647case "$i16type" in
15648'') set try -DINT16
15649 if eval $compile; then
5440bc8e 15650 case "`$run ./try`" in
b4eb6b3d
JH
15651 int16_t)
15652 i16type=int16_t
15653 u16type=uint16_t
15654 i16size=2
15655 u16size=2
15656 ;;
15657 esac
15658 fi
15659 ;;
15660esac
15661case "$i16type" in
15662'') if $test $shortsize -ge 2; then
15663 i16type=short
15664 u16type="unsigned short"
15665 i16size=$shortsize
15666 u16size=$shortsize
15667 fi
15668 ;;
15669esac
15670
15671case "$i32type" in
15672'') case "$longsize" in
15673 4) i32type=long
15674 u32type="unsigned long"
15675 i32size=$longsize
15676 u32size=$longsize
15677 ;;
15678 *) case "$intsize" in
15679 4) i32type=int
15680 u32type="unsigned int"
15681 i32size=$intsize
15682 u32size=$intsize
15683 ;;
15684 esac
15685 ;;
15686 esac
15687 ;;
15688esac
15689case "$i32type" in
15690'') set try -DINT32
15691 if eval $compile; then
5440bc8e 15692 case "`$run ./try`" in
b4eb6b3d
JH
15693 int32_t)
15694 i32type=int32_t
15695 u32type=uint32_t
15696 i32size=4
15697 u32size=4
15698 ;;
15699 esac
15700 fi
15701 ;;
15702esac
15703case "$i32type" in
15704'') if $test $intsize -ge 4; then
15705 i32type=int
15706 u32type="unsigned int"
15707 i32size=$intsize
15708 u32size=$intsize
15709 fi
15710 ;;
15711esac
15712
15713case "$i64type" in
15714'') case "$d_quad:$quadtype" in
15715 define:?*)
15716 i64type="$quadtype"
15717 u64type="$uquadtype"
15718 i64size=8
15719 u64size=8
15720 ;;
15721 esac
15722 ;;
15723esac
15724
1d1be0dc
NC
15725$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15726: volatile so that the compiler has to store it out to memory.
15727if test X"$d_volatile" = X"$define"; then
15728 volatile=volatile
15729fi
b4eb6b3d
JH
15730$cat <<EOP >try.c
15731#include <stdio.h>
55954f19
JH
15732#$i_stdlib I_STDLIB
15733#ifdef I_STDLIB
15734#include <stdlib.h>
15735#endif
1d1be0dc
NC
15736#include <sys/types.h>
15737#include <signal.h>
15738#ifdef SIGFPE
15739$volatile int bletched = 0;
7090f861 15740$signal_t blech(int s) { bletched = 1; }
1d1be0dc 15741#endif
b4eb6b3d
JH
15742int main() {
15743 $uvtype u = 0;
1d1be0dc 15744 $nvtype d;
b4eb6b3d
JH
15745 int n = 8 * $uvsize;
15746 int i;
1d1be0dc
NC
15747#ifdef SIGFPE
15748 signal(SIGFPE, blech);
15749#endif
15750
b4eb6b3d
JH
15751 for (i = 0; i < n; i++) {
15752 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
15753 d = ($nvtype)u;
15754 if (($uvtype)d != u)
b4eb6b3d 15755 break;
1d1be0dc
NC
15756 if (d <= 0)
15757 break;
15758 d = ($nvtype)(u - 1);
15759 if (($uvtype)d != (u - 1))
15760 break;
15761#ifdef SIGFPE
22676560 15762 if (bletched)
1d1be0dc
NC
15763 break;
15764#endif
b4eb6b3d 15765 }
efd1522b 15766 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
15767 exit(0);
15768}
15769EOP
1d1be0dc
NC
15770set try
15771
15772d_nv_preserves_uv="$undef"
15773if eval $compile; then
53133ed1 15774 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 15775fi
53133ed1 15776case "$nv_preserves_uv_bits" in
5b813a60 15777\-[1-9]*)
53133ed1
NC
15778 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15779 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 15780 d_nv_preserves_uv="$define"
b4eb6b3d 15781 ;;
53133ed1 15782[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
15783 d_nv_preserves_uv="$undef" ;;
15784*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
d6cc064f 15785 nv_preserves_uv_bits="0" ;;
b4eb6b3d 15786esac
5b813a60 15787$rm_try
1d1be0dc 15788
b68c599a
NC
15789$echo "Checking to find the largest integer value your NVs can hold..." >&4
15790: volatile so that the compiler has to store it out to memory.
15791if test X"$d_volatile" = X"$define"; then
15792 volatile=volatile
15793fi
15794$cat <<EOP >try.c
15795#include <stdio.h>
15796
15797typedef $nvtype NV;
15798
15799int
15800main() {
15801 NV value = 2;
15802 int count = 1;
15803
15804 while(count < 256) {
15805 $volatile NV up = value + 1.0;
15806 $volatile NV negated = -value;
15807 $volatile NV down = negated - 1.0;
15808 $volatile NV got_up = up - value;
15809 int up_good = got_up == 1.0;
15810 int got_down = down - negated;
15811 int down_good = got_down == -1.0;
15812
15813 if (down_good != up_good) {
15814 fprintf(stderr,
15815 "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15816 up_good, (double) got_up, down_good, (double) got_down,
15817 count, (double) value);
15818 return 1;
15819 }
15820 if (!up_good) {
15821 while (1) {
15822 if (count > 8) {
15823 count -= 8;
15824 fputs("256.0", stdout);
15825 } else {
15826 count--;
15827 fputs("2.0", stdout);
15828 }
15829 if (!count) {
15830 puts("");
15831 return 0;
15832 }
15833 fputs("*", stdout);
15834 }
15835 }
15836 value *= 2;
15837 ++count;
15838 }
15839 fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15840 count, (double) value);
15841 return 1;
15842}
15843EOP
15844set try
15845
15846nv_overflows_integers_at='0'
15847if eval $compile; then
15848 xxx="`$run ./try`"
15849 case "$?" in
15850 0)
15851 case "$xxx" in
15852 2*) cat >&4 <<EOM
15853The largest integer your NVs can preserve is equal to $xxx
15854EOM
15855 nv_overflows_integers_at="$xxx"
15856 ;;
15857 *) cat >&4 <<EOM
15858Cannot determine the largest integer value your NVs can hold, unexpected output
15859'$xxx'
15860EOM
15861 ;;
15862 esac
15863 ;;
15864 *) cat >&4 <<EOM
15865Cannot determine the largest integer value your NVs can hold
15866EOM
15867 ;;
15868 esac
15869fi
15870$rm_try
15871
f607920a
CB
15872$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15873: volatile so that the compiler has to store it out to memory.
15874if test X"$d_volatile" = X"$define"; then
15875 volatile=volatile
15876fi
15877$cat <<EOP >try.c
15878#include <stdio.h>
15879#$i_stdlib I_STDLIB
15880#ifdef I_STDLIB
15881#include <stdlib.h>
15882#endif
15883#$i_string I_STRING
15884#ifdef I_STRING
15885# include <string.h>
15886#else
15887# include <strings.h>
15888#endif
15889#include <sys/types.h>
15890#include <signal.h>
15891#ifdef SIGFPE
15892$volatile int bletched = 0;
7090f861 15893$signal_t blech(int s) { bletched = 1; }
f607920a
CB
15894#endif
15895
15896int checkit($nvtype d, char *where) {
15897 unsigned char *p = (char *)&d;
15898 unsigned char *end = p + sizeof(d);
15899 int fail = 0;
15900
15901 while (p < end)
15902 fail += *p++;
15903
15904 if (!fail)
17f6277d 15905 return 0;
f607920a
CB
15906
15907 p = (char *)&d;
15908 printf("No - %s: 0x", where);
15909 while (p < end)
15910 printf ("%02X", *p++);
15911 printf("\n");
15912 return 1;
15913}
15914
15915int main(int argc, char **argv) {
15916 $nvtype d = 0.0;
15917 int fail = 0;
15918 fail += checkit(d, "0.0");
15919
15920 /* The compiler shouldn't be assuming that bletched is 0 */
15921 d = bletched;
15922
15923 fail += checkit(d, "bleched");
15924
15925#ifdef SIGFPE
15926 signal(SIGFPE, blech);
15927#endif
15928
15929 /* Paranoia - the compiler should have no way of knowing that ANSI says
15930 that argv[argc] will always be NULL. Actually, if it did assume this it
15931 would be buggy, as this is C and main() can be called from elsewhere in
15932 the program. */
15933 d = argv[argc] ? 1 : 0;
15934
15935 if (d) {
15936 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15937 }
15938
15939 fail += checkit(d, "ternary");
15940
15941 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15942
15943 if (d != 0.0) {
15944 printf("No - memset doesn't give 0.0\n");
15945 /* This might just blow up: */
15946 printf("(gives %g)\n", d);
15947 return 1;
15948 }
5b813a60 15949
f607920a
CB
15950#ifdef SIGFPE
15951 if (bletched) {
15952 printf("No - something bleched\n");
15953 return 1;
15954 }
15955#endif
15956 if (fail) {
15957 printf("No - %d fail(s)\n", fail);
15958 return 1;
15959 }
15960 printf("Yes\n");
15961 return 0;
15962}
15963EOP
15964set try
15965
15966d_nv_zero_is_allbits_zero="$undef"
15967if eval $compile; then
15968 xxx="`$run ./try`"
15969 case "$?" in
15970 0)
15971 case "$xxx" in
15972 Yes) cat >&4 <<EOM
159730.0 is represented as all bits zero in memory
15974EOM
15975 d_nv_zero_is_allbits_zero="$define"
15976 ;;
15977 *) cat >&4 <<EOM
159780.0 is not represented as all bits zero in memory
15979EOM
15980 d_nv_zero_is_allbits_zero="$undef"
15981 ;;
15982 esac
15983 ;;
15984 *) cat >&4 <<EOM
159850.0 is not represented as all bits zero in memory
15986EOM
15987 d_nv_zero_is_allbits_zero="$undef"
15988 ;;
15989 esac
15990fi
5b813a60 15991$rm_try
b4eb6b3d
JH
15992
15993: check for off64_t
15994echo " "
15995echo "Checking to see if you have off64_t..." >&4
15996$cat >try.c <<EOCP
15997#include <sys/types.h>
15998#include <unistd.h>
15999int main() { off64_t x = 7; }
16000EOCP
16001set try
16002if eval $compile; then
16003 val="$define"
16004 echo "You have off64_t."
16005else
16006 val="$undef"
16007 echo "You do not have off64_t."
16008 case "$lseeksize" in
16009 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16010 esac
16011fi
5b813a60 16012$rm_try
b4eb6b3d
JH
16013set d_off64_t
16014eval $setvar
16015
b4eb6b3d
JH
16016: how to create joinable pthreads
16017if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16018 echo " "
5b813a60 16019 echo "Checking what constant to use for creating joinable pthreads..." >&4
b4eb6b3d
JH
16020 $cat >try.c <<'EOCP'
16021#include <pthread.h>
16022int main() {
16023 int detachstate = JOINABLE;
16024}
16025EOCP
16026 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16027 if eval $compile; then
16028 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16029 val="$undef" # Yes, undef.
16030 set d_old_pthread_create_joinable
16031 eval $setvar
16032 val=""
16033 set old_pthread_create_joinable
16034 eval $setvar
16035 else
16036 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16037 if eval $compile; then
16038 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16039 val="$define"
16040 set d_old_pthread_create_joinable
16041 eval $setvar
16042 val=PTHREAD_CREATE_UNDETACHED
16043 set old_pthread_create_joinable
16044 eval $setvar
5b813a60 16045 else
b4eb6b3d
JH
16046 set try -DJOINABLE=__UNDETACHED
16047 if eval $compile; then
16048 echo "You seem to use __UNDETACHED." >&4
16049 val="$define"
16050 set d_old_pthread_create_joinable
16051 eval $setvar
16052 val=__UNDETACHED
16053 set old_pthread_create_joinable
16054 eval $setvar
16055 else
16056 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
16057 val="$define"
16058 set d_old_pthread_create_joinable
16059 eval $setvar
16060 val=0
16061 set old_pthread_create_joinable
16062 eval $setvar
16063 fi
16064 fi
16065 fi
5b813a60 16066 $rm_try
b4eb6b3d
JH
16067else
16068 d_old_pthread_create_joinable="$undef"
16069 old_pthread_create_joinable=""
16070fi
16071
16072: see if pause exists
16073set pause d_pause
16074eval $inlibc
16075
b4eb6b3d
JH
16076: see if poll exists
16077set poll d_poll
16078eval $inlibc
16079
c796e3db
MB
16080: see if prctl exists
16081set prctl d_prctl
16082eval $inlibc
16083
16084: see if prctl supports PR_SET_NAME
16085d_prctl_set_name=$undef
16086case $d_prctl in
16087 $define)
16088 $cat >try.c <<EOM
16089#include <sys/prctl.h>
16090
16091int main (int argc, char *argv[])
16092{
16093 return (prctl (PR_SET_NAME, "Test"));
16094 } /* main */
16095EOM
16096 set try
16097 if eval $compile_ok && $run ./try; then
16098 echo "Your prctl (PR_SET_NAME, ...) works"
16099 d_prctl_set_name=$define
16100 fi
16101 $rm_try
16102 ;;
16103 esac
16104
c7aff470
NIS
16105: see if readlink exists
16106set readlink d_readlink
16107eval $inlibc
16108
613d6c3e 16109: Check if exe is symlink to abs path of executing program
c7aff470 16110echo " "
f24dbf84 16111procselfexe=''
c7aff470 16112val="$undef"
a33c94aa 16113case "$d_readlink" in
698ca84c 16114 "$define")
9e68546f
NC
16115 : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16116 : more tidy to avoid an extra level of symlink
16117 set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
698ca84c
NC
16118 while test $# -gt 0; do
16119 type=$1; try=$2
16120 shift; shift
16121 if $issymlink $try; then
16122 $ls -l $try > reflect
f24dbf84 16123 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
698ca84c
NC
16124 echo "You have $type-like $try."
16125 procselfexe='"'$try'"'
16126 val="$define"
16127 : This will break out of the loop
16128 set X; shift
c7aff470 16129 fi
698ca84c
NC
16130 fi
16131 done
a33c94aa
JH
16132 ;;
16133esac
428dc699 16134$rm -f reflect
c7aff470
NIS
16135set d_procselfexe
16136eval $setvar
16137
233e16ce
MB
16138: backward compatibility for d_hvfork
16139if test X$d_hvfork != X; then
16140 d_vfork="$d_hvfork"
16141 d_hvfork=''
16142fi
16143: see if there is a vfork
16144val=''
16145set vfork val
16146eval $inlibc
16147
16148d_pseudofork=$undef
16149
16150: Ok, but do we want to use it. vfork is reportedly unreliable in
16151: perl on Solaris 2.x, and probably elsewhere.
16152case "$val" in
16153$define)
16154 echo " "
16155 case "$usevfork" in
16156 false) dflt='n';;
16157 *) dflt='y';;
16158 esac
16159 cat <<'EOM'
16160
16161Perl can only use a vfork() that doesn't suffer from strict
16162restrictions on calling functions or modifying global data in
16163the child. For example, glibc-2.1 contains such a vfork()
16164that is unsuitable. If your system provides a proper fork()
16165call, chances are that you do NOT want perl to use vfork().
16166
16167EOM
16168 rp="Do you still want to use vfork()?"
16169 . ./myread
16170 case "$ans" in
16171 y|Y) ;;
16172 *)
16173 echo "Ok, we won't use vfork()."
16174 val="$undef"
16175 ;;
16176 esac
16177 ;;
16178esac
16179set d_vfork
16180eval $setvar
16181case "$d_vfork" in
16182$define) usevfork='true';;
16183*) usevfork='false';;
16184esac
16185
263fee3f
JH
16186: see whether the pthread_atfork exists
16187$cat >try.c <<EOP
16188#include <pthread.h>
16189#include <stdio.h>
16190int main() {
16191#ifdef PTHREAD_ATFORK
16192 pthread_atfork(NULL,NULL,NULL);
16193#endif
16194}
16195EOP
16196
d6483fcc 16197: see if pthread_atfork exists
263fee3f
JH
16198set try -DPTHREAD_ATFORK
16199if eval $compile; then
16200 val="$define"
16201else
16202 val="$undef"
16203fi
16204case "$usethreads" in
16205$define)
16206 case "$val" in
16207 $define) echo 'pthread_atfork found.' >&4 ;;
16208 *) echo 'pthread_atfork NOT found.' >&4 ;;
16209 esac
16210esac
16211set d_pthread_atfork
16212eval $setvar
d6483fcc 16213
58d975c3
JH
16214: see if pthread_attr_setscope exists
16215set pthread_attr_setscope d_pthread_attr_setscope
16216eval $inlibc
16217
b4eb6b3d
JH
16218: see whether the various POSIXish _yields exist
16219$cat >try.c <<EOP
16220#include <pthread.h>
16221#include <stdio.h>
16222int main() {
16223#ifdef SCHED_YIELD
16224 sched_yield();
16225#else
16226#ifdef PTHREAD_YIELD
16227 pthread_yield();
16228#else
16229#ifdef PTHREAD_YIELD_NULL
16230 pthread_yield(NULL);
16231#endif
16232#endif
16233#endif
16234}
16235EOP
16236: see if sched_yield exists
16237set try -DSCHED_YIELD
16238if eval $compile; then
16239 val="$define"
16240 sched_yield='sched_yield()'
16241else
16242 val="$undef"
16243fi
16244case "$usethreads" in
16245$define)
16246 case "$val" in
16247 $define) echo 'sched_yield() found.' >&4 ;;
16248 *) echo 'sched_yield() NOT found.' >&4 ;;
16249 esac
16250esac
10bc17b6
JH
16251set d_sched_yield
16252eval $setvar
b4eb6b3d 16253
10bc17b6
JH
16254: see if pthread_yield exists
16255set try -DPTHREAD_YIELD
16256if eval $compile; then
16257 val="$define"
16258 case "$sched_yield" in
16259 '') sched_yield='pthread_yield()' ;;
16260 esac
16261else
16262 set try -DPTHREAD_YIELD_NULL
16263 if eval $compile; then
16264 val="$define"
16265 case "$sched_yield" in
16266 '') sched_yield='pthread_yield(NULL)' ;;
16267 esac
16268 else
16269 val="$undef"
16270 fi
16271fi
16272case "$usethreads" in
16273$define)
16274 case "$val" in
16275 $define) echo 'pthread_yield() found.' >&4 ;;
16276 *) echo 'pthread_yield() NOT found.' >&4 ;;
16277 esac
16278 ;;
16279esac
16280set d_pthread_yield
16281eval $setvar
10bc17b6
JH
16282case "$sched_yield" in
16283'') sched_yield=undef ;;
16284esac
5b813a60 16285$rm_try
10bc17b6
JH
16286
16287: see if random_r exists
16288set random_r d_random_r
16289eval $inlibc
16290case "$d_random_r" in
16291"$define")
16292 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16293 case "$d_random_r_proto:$usethreads" in
16294 ":define") d_random_r_proto=define
a48ec845
JH
16295 set d_random_r_proto random_r $hdrs
16296 eval $hasproto ;;
16297 *) ;;
16298 esac
16299 case "$d_random_r_proto" in
16300 define)
10bc17b6
JH
16301 case "$random_r_proto" in
16302 ''|0) try='int random_r(int*, struct random_data*);'
61c26d18 16303 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
a845a0d4
JH
16304 esac
16305 case "$random_r_proto" in
16306 ''|0) try='int random_r(long*, struct random_data*);'
61c26d18 16307 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
a845a0d4
JH
16308 esac
16309 case "$random_r_proto" in
16310 ''|0) try='int random_r(struct random_data*, int32_t*);'
61c26d18 16311 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
16312 esac
16313 case "$random_r_proto" in
90e831dc 16314 ''|0) d_random_r=undef
10bc17b6 16315 random_r_proto=0
a48ec845 16316 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16317 * ) case "$random_r_proto" in
16318 REENTRANT_PROTO*) ;;
16319 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16320 esac
16321 echo "Prototype: $try" ;;
16322 esac
b4eb6b3d 16323 ;;
c18e646a
JH
16324 *) case "$usethreads" in
16325 define) echo "random_r has no prototype, not using it." >&4 ;;
16326 esac
90e831dc
SB
16327 d_random_r=undef
16328 random_r_proto=0
c18e646a 16329 ;;
a48ec845
JH
16330 esac
16331 ;;
10bc17b6 16332*) random_r_proto=0
b4eb6b3d
JH
16333 ;;
16334esac
16335
16336: see if readdir and friends exist
16337set readdir d_readdir
16338eval $inlibc
16339set seekdir d_seekdir
16340eval $inlibc
16341set telldir d_telldir
16342eval $inlibc
16343set rewinddir d_rewinddir
16344eval $inlibc
16345
10bc17b6
JH
16346: see if readdir64_r exists
16347set readdir64_r d_readdir64_r
16348eval $inlibc
16349case "$d_readdir64_r" in
16350"$define")
16351 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
16352 case "$d_readdir64_r_proto:$usethreads" in
16353 ":define") d_readdir64_r_proto=define
a48ec845
JH
16354 set d_readdir64_r_proto readdir64_r $hdrs
16355 eval $hasproto ;;
16356 *) ;;
16357 esac
16358 case "$d_readdir64_r_proto" in
16359 define)
10bc17b6
JH
16360 case "$readdir64_r_proto" in
16361 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
61c26d18 16362 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
10bc17b6
JH
16363 esac
16364 case "$readdir64_r_proto" in
16365 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
61c26d18 16366 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
10bc17b6
JH
16367 esac
16368 case "$readdir64_r_proto" in
90e831dc 16369 ''|0) d_readdir64_r=undef
10bc17b6 16370 readdir64_r_proto=0
a48ec845 16371 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16372 * ) case "$readdir64_r_proto" in
16373 REENTRANT_PROTO*) ;;
16374 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16375 esac
16376 echo "Prototype: $try" ;;
16377 esac
16378 ;;
c18e646a
JH
16379 *) case "$usethreads" in
16380 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16381 esac
90e831dc
SB
16382 d_readdir64_r=undef
16383 readdir64_r_proto=0
c18e646a 16384 ;;
a48ec845
JH
16385 esac
16386 ;;
10bc17b6
JH
16387*) readdir64_r_proto=0
16388 ;;
16389esac
16390
16391: see if readdir_r exists
16392set readdir_r d_readdir_r
16393eval $inlibc
16394case "$d_readdir_r" in
16395"$define")
16396 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
16397 case "$d_readdir_r_proto:$usethreads" in
16398 ":define") d_readdir_r_proto=define
a48ec845
JH
16399 set d_readdir_r_proto readdir_r $hdrs
16400 eval $hasproto ;;
16401 *) ;;
16402 esac
16403 case "$d_readdir_r_proto" in
16404 define)
10bc17b6
JH
16405 case "$readdir_r_proto" in
16406 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
61c26d18 16407 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
10bc17b6
JH
16408 esac
16409 case "$readdir_r_proto" in
16410 ''|0) try='int readdir_r(DIR*, struct dirent*);'
61c26d18 16411 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
10bc17b6
JH
16412 esac
16413 case "$readdir_r_proto" in
90e831dc 16414 ''|0) d_readdir_r=undef
10bc17b6 16415 readdir_r_proto=0
a48ec845 16416 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16417 * ) case "$readdir_r_proto" in
16418 REENTRANT_PROTO*) ;;
16419 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16420 esac
16421 echo "Prototype: $try" ;;
16422 esac
16423 ;;
c18e646a
JH
16424 *) case "$usethreads" in
16425 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16426 esac
90e831dc
SB
16427 d_readdir_r=undef
16428 readdir_r_proto=0
c18e646a 16429 ;;
a48ec845
JH
16430 esac
16431 ;;
10bc17b6
JH
16432*) readdir_r_proto=0
16433 ;;
16434esac
16435
4e0554ec
JH
16436: see if readv exists
16437set readv d_readv
16438eval $inlibc
16439
16440: see if recvmsg exists
16441set recvmsg d_recvmsg
16442eval $inlibc
16443
b4eb6b3d
JH
16444: see if rename exists
16445set rename d_rename
16446eval $inlibc
16447
16448: see if rmdir exists
16449set rmdir d_rmdir
16450eval $inlibc
16451
16452: see if memory.h is available.
16453val=''
16454set memory.h val
16455eval $inhdr
16456
16457: See if it conflicts with string.h
16458case "$val" in
16459$define)
16460 case "$strings" in
16461 '') ;;
16462 *)
16463 $cppstdin $cppflags $cppminus < $strings > mem.h
16464 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16465 echo " "
16466 echo "We won't be including <memory.h>."
16467 val="$undef"
16468 fi
16469 $rm -f mem.h
16470 ;;
16471 esac
16472esac
16473set i_memory
16474eval $setvar
16475
16476: can bcopy handle overlapping blocks?
b6cc3bc4 16477echo " "
b4eb6b3d 16478val="$undef"
b6cc3bc4
AD
16479case "$d_memmove" in
16480"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16481*) case "$d_bcopy" in
16482 "$define")
16483 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16484 $cat >try.c <<EOCP
b4eb6b3d
JH
16485#$i_memory I_MEMORY
16486#$i_stdlib I_STDLIB
16487#$i_string I_STRING
16488#$i_unistd I_UNISTD
16489EOCP
16490 $cat >>try.c <<'EOCP'
16491#include <stdio.h>
16492#ifdef I_MEMORY
16493# include <memory.h>
16494#endif
16495#ifdef I_STDLIB
16496# include <stdlib.h>
16497#endif
16498#ifdef I_STRING
16499# include <string.h>
16500#else
16501# include <strings.h>
16502#endif
16503#ifdef I_UNISTD
16504# include <unistd.h> /* Needed for NetBSD */
16505#endif
16506int main()
16507{
16508char buf[128], abc[128];
16509char *b;
16510int len;
16511int off;
16512int align;
16513
b6cc3bc4
AD
16514/* Copy "abcde..." string to char abc[] so that gcc doesn't
16515 try to store the string in read-only memory. */
b4eb6b3d
JH
16516bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16517
16518for (align = 7; align >= 0; align--) {
16519 for (len = 36; len; len--) {
16520 b = buf+align;
16521 bcopy(abc, b, len);
16522 for (off = 1; off <= len; off++) {
16523 bcopy(b, b+off, len);
16524 bcopy(b+off, b, len);
16525 if (bcmp(b, abc, len))
16526 exit(1);
16527 }
16528 }
16529}
16530exit(0);
16531}
16532EOCP
b6cc3bc4
AD
16533 set try
16534 if eval $compile_ok; then
43dddb59 16535 if $run ./try 2>/dev/null; then
b6cc3bc4
AD
16536 echo "Yes, it can."
16537 val="$define"
16538 else
16539 echo "It can't, sorry."
16540 fi
b4eb6b3d 16541 else
b6cc3bc4 16542 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16543 fi
b6cc3bc4
AD
16544 ;;
16545 esac
5b813a60 16546 $rm_try
b4eb6b3d
JH
16547 ;;
16548esac
b4eb6b3d
JH
16549set d_safebcpy
16550eval $setvar
16551
16552: can memcpy handle overlapping blocks?
b6cc3bc4 16553echo " "
b4eb6b3d 16554val="$undef"
b6cc3bc4
AD
16555case "$d_memmove" in
16556"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16557*) case "$d_memcpy" in
16558 "$define")
16559 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16560 $cat >try.c <<EOCP
b4eb6b3d
JH
16561#$i_memory I_MEMORY
16562#$i_stdlib I_STDLIB
16563#$i_string I_STRING
16564#$i_unistd I_UNISTD
16565EOCP
16566 $cat >>try.c <<'EOCP'
16567#include <stdio.h>
16568#ifdef I_MEMORY
16569# include <memory.h>
16570#endif
16571#ifdef I_STDLIB
16572# include <stdlib.h>
16573#endif
16574#ifdef I_STRING
16575# include <string.h>
16576#else
16577# include <strings.h>
16578#endif
16579#ifdef I_UNISTD
16580# include <unistd.h> /* Needed for NetBSD */
16581#endif
16582int main()
16583{
16584char buf[128], abc[128];
16585char *b;
16586int len;
16587int off;
16588int align;
16589
16590/* Copy "abcde..." string to char abc[] so that gcc doesn't
16591 try to store the string in read-only memory. */
16592memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16593
16594for (align = 7; align >= 0; align--) {
16595 for (len = 36; len; len--) {
16596 b = buf+align;
16597 memcpy(b, abc, len);
16598 for (off = 1; off <= len; off++) {
16599 memcpy(b+off, b, len);
16600 memcpy(b, b+off, len);
16601 if (memcmp(b, abc, len))
16602 exit(1);
16603 }
16604 }
16605}
16606exit(0);
16607}
16608EOCP
b6cc3bc4
AD
16609 set try
16610 if eval $compile_ok; then
43dddb59 16611 if $run ./try 2>/dev/null; then
b6cc3bc4
AD
16612 echo "Yes, it can."
16613 val="$define"
16614 else
16615 echo "It can't, sorry."
16616 fi
b4eb6b3d 16617 else
b6cc3bc4 16618 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16619 fi
b6cc3bc4
AD
16620 ;;
16621 esac
5b813a60 16622 $rm_try
b4eb6b3d
JH
16623 ;;
16624esac
b4eb6b3d
JH
16625set d_safemcpy
16626eval $setvar
16627
16628: can memcmp be trusted to compare relative magnitude?
16629val="$undef"
16630case "$d_memcmp" in
16631"$define")
16632 echo " "
16633 echo "Checking if your memcmp() can compare relative magnitude..." >&4
16634 $cat >try.c <<EOCP
16635#$i_memory I_MEMORY
16636#$i_stdlib I_STDLIB
16637#$i_string I_STRING
16638#$i_unistd I_UNISTD
16639EOCP
16640 $cat >>try.c <<'EOCP'
16641#include <stdio.h>
16642#ifdef I_MEMORY
16643# include <memory.h>
16644#endif
16645#ifdef I_STDLIB
36adc09b 16646# include <stdlib.h>
b4eb6b3d
JH
16647#endif
16648#ifdef I_STRING
16649# include <string.h>
16650#else
16651# include <strings.h>
16652#endif
16653#ifdef I_UNISTD
16654# include <unistd.h> /* Needed for NetBSD */
16655#endif
16656int main()
16657{
16658char a = -1;
16659char b = 0;
16660if ((a < b) && memcmp(&a, &b, 1) < 0)
16661 exit(1);
16662exit(0);
16663}
16664EOCP
16665 set try
16666 if eval $compile_ok; then
5440bc8e 16667 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
16668 echo "Yes, it can."
16669 val="$define"
16670 else
16671 echo "No, it can't (it uses signed chars)."
16672 fi
16673 else
16674 echo "(I can't compile the test program, so we'll assume not...)"
16675 fi
16676 ;;
16677esac
5b813a60 16678$rm_try
b4eb6b3d
JH
16679set d_sanemcmp
16680eval $setvar
16681
ef9f17be
JH
16682: see if prototype for sbrk is available
16683echo " "
16684set d_sbrkproto sbrk $i_unistd unistd.h
16685eval $hasproto
16686
b4eb6b3d
JH
16687: see if select exists
16688set select d_select
16689eval $inlibc
16690
16691: see if semctl exists
16692set semctl d_semctl
16693eval $inlibc
16694
16695: see if semget exists
16696set semget d_semget
16697eval $inlibc
16698
16699: see if semop exists
16700set semop d_semop
16701eval $inlibc
16702
16703: see how much of the 'sem*(2)' library is present.
16704h_sem=true
16705echo " "
16706case "$d_semctl$d_semget$d_semop" in
16707*"$undef"*) h_sem=false;;
16708esac
16709case "$osname" in
16710freebsd)
16711 case "`ipcs 2>&1`" in
16712 "SVID messages"*"not configured"*)
16713 echo "Your $osname does not have the sem*(2) configured." >&4
16714 h_sem=false
16715 val="$undef"
16716 set semctl d_semctl
16717 eval $setvar
16718 set semget d_semget
16719 eval $setvar
16720 set semop d_semop
16721 eval $setvar
16722 ;;
16723 esac
16724 ;;
16725esac
16726: we could also check for sys/ipc.h ...
16727if $h_sem && $test `./findhdr sys/sem.h`; then
16728 echo "You have the full sem*(2) library." >&4
16729 val="$define"
16730else
16731 echo "You don't have the full sem*(2) library." >&4
16732 val="$undef"
16733fi
16734set d_sem
16735eval $setvar
16736
16737: see whether sys/sem.h defines union semun
16738echo " "
16739$cat > try.c <<'END'
16740#include <sys/types.h>
16741#include <sys/ipc.h>
16742#include <sys/sem.h>
16743int main () { union semun semun; semun.buf = 0; }
16744END
16745set try
16746if eval $compile; then
16747 echo "You have union semun in <sys/sem.h>." >&4
16748 val="$define"
16749else
16750 echo "You do not have union semun in <sys/sem.h>." >&4
16751 val="$undef"
16752fi
5b813a60 16753$rm_try
b4eb6b3d
JH
16754set d_union_semun
16755eval $setvar
16756
16757: see how to do semctl IPC_STAT
16758case "$d_sem" in
16759$define)
b4eb6b3d 16760 echo " "
93451a0d 16761 $cat > tryh.h <<END
b4eb6b3d
JH
16762#ifndef S_IRUSR
16763# ifdef S_IREAD
16764# define S_IRUSR S_IREAD
16765# define S_IWUSR S_IWRITE
16766# define S_IXUSR S_IEXEC
16767# else
16768# define S_IRUSR 0400
16769# define S_IWUSR 0200
16770# define S_IXUSR 0100
16771# endif
16772# define S_IRGRP (S_IRUSR>>3)
16773# define S_IWGRP (S_IWUSR>>3)
16774# define S_IXGRP (S_IXUSR>>3)
16775# define S_IROTH (S_IRUSR>>6)
16776# define S_IWOTH (S_IWUSR>>6)
16777# define S_IXOTH (S_IXUSR>>6)
16778#endif
16779#ifndef S_IRWXU
16780# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16781# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16782# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16783#endif
16784END
2fad75a1 16785 : see whether semctl IPC_STAT can use union semun
2fad75a1
JH
16786 case "$d_semctl_semun" in
16787 '')
35918792 16788 val="$undef"
2fad75a1 16789 $cat > try.c <<END
b4eb6b3d
JH
16790#include <sys/types.h>
16791#include <sys/ipc.h>
16792#include <sys/sem.h>
16793#include <sys/stat.h>
16794#include <stdio.h>
16795#include <errno.h>
93451a0d 16796#include "tryh.h"
b4eb6b3d
JH
16797#ifndef errno
16798extern int errno;
16799#endif
16800#$d_union_semun HAS_UNION_SEMUN
16801int main() {
16802 union semun
16803#ifndef HAS_UNION_SEMUN
16804 {
16805 int val;
16806 struct semid_ds *buf;
16807 unsigned short *array;
16808 }
16809#endif
16810 arg;
16811 int sem, st;
16812
16813#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16814 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16815 if (sem > -1) {
16816 struct semid_ds argbuf;
16817 arg.buf = &argbuf;
16818# ifdef IPC_STAT
16819 st = semctl(sem, 0, IPC_STAT, arg);
16820 if (st == 0)
16821 printf("semun\n");
16822 else
16823# endif /* IPC_STAT */
16824 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16825# ifdef IPC_RMID
16826 if (semctl(sem, 0, IPC_RMID, arg) != 0)
35918792 16827# endif /* IPC_RMID */
b4eb6b3d
JH
16828 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16829 } else
16830#endif /* IPC_PRIVATE && ... */
16831 printf("semget failed: errno = %d\n", errno);
16832 return 0;
16833}
16834END
2fad75a1
JH
16835 set try
16836 if eval $compile; then
16837 xxx=`$run ./try`
16838 case "$xxx" in
16839 semun) val="$define" ;;
16840 esac
16841 fi
5b813a60 16842 $rm_try
35918792
YST
16843 set d_semctl_semun
16844 eval $setvar
2fad75a1
JH
16845 ;;
16846 esac
b4eb6b3d
JH
16847 case "$d_semctl_semun" in
16848 $define)
16849 echo "You can use union semun for semctl IPC_STAT." >&4
16850 also='also'
16851 ;;
16852 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
16853 also=''
16854 ;;
16855 esac
16856
16857 : see whether semctl IPC_STAT can use struct semid_ds pointer
2fad75a1
JH
16858 case "$d_semctl_semid_ds" in
16859 '')
35918792 16860 val="$undef"
2fad75a1 16861 $cat > try.c <<'END'
b4eb6b3d
JH
16862#include <sys/types.h>
16863#include <sys/ipc.h>
16864#include <sys/sem.h>
16865#include <sys/stat.h>
93451a0d 16866#include "tryh.h"
b4eb6b3d
JH
16867#include <stdio.h>
16868#include <errno.h>
16869#ifndef errno
16870extern int errno;
16871#endif
16872int main() {
16873 struct semid_ds arg;
16874 int sem, st;
16875
16876#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16877 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16878 if (sem > -1) {
16879# ifdef IPC_STAT
16880 st = semctl(sem, 0, IPC_STAT, &arg);
16881 if (st == 0)
16882 printf("semid_ds\n");
16883 else
16884# endif /* IPC_STAT */
16885 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16886# ifdef IPC_RMID
16887 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16888# endif /* IPC_RMID */
16889 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16890 } else
16891#endif /* IPC_PRIVATE && ... */
16892 printf("semget failed: errno = %d\n", errno);
16893
16894 return 0;
16895}
16896END
2fad75a1
JH
16897 set try
16898 if eval $compile; then
16899 xxx=`$run ./try`
16900 case "$xxx" in
16901 semid_ds) val="$define" ;;
16902 esac
16903 fi
5b813a60 16904 $rm_try
35918792
YST
16905 set d_semctl_semid_ds
16906 eval $setvar
2fad75a1
JH
16907 ;;
16908 esac
b4eb6b3d
JH
16909 case "$d_semctl_semid_ds" in
16910 $define)
16911 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16912 ;;
16913 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16914 ;;
16915 esac
b4eb6b3d
JH
16916 ;;
16917*) val="$undef"
16918
16919 # We do not have the full sem*(2) library, so assume we can not
16920 # use either.
16921
16922 set d_semctl_semun
16923 eval $setvar
16924
16925 set d_semctl_semid_ds
16926 eval $setvar
16927 ;;
16928esac
93451a0d 16929$rm_try tryh.h
b4eb6b3d 16930
4e0554ec
JH
16931: see if sendmsg exists
16932set sendmsg d_sendmsg
16933eval $inlibc
16934
b4eb6b3d
JH
16935: see if setegid exists
16936set setegid d_setegid
16937eval $inlibc
16938
16939: see if seteuid exists
16940set seteuid d_seteuid
16941eval $inlibc
16942
16943: see if setgrent exists
16944set setgrent d_setgrent
16945eval $inlibc
16946
10bc17b6
JH
16947: see if setgrent_r exists
16948set setgrent_r d_setgrent_r
16949eval $inlibc
16950case "$d_setgrent_r" in
16951"$define")
16952 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
16953 case "$d_setgrent_r_proto:$usethreads" in
16954 ":define") d_setgrent_r_proto=define
a48ec845
JH
16955 set d_setgrent_r_proto setgrent_r $hdrs
16956 eval $hasproto ;;
16957 *) ;;
16958 esac
16959 case "$d_setgrent_r_proto" in
16960 define)
10bc17b6
JH
16961 case "$setgrent_r_proto" in
16962 ''|0) try='int setgrent_r(FILE**);'
61c26d18 16963 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
10bc17b6
JH
16964 esac
16965 case "$setgrent_r_proto" in
16966 ''|0) try='void setgrent_r(FILE**);'
61c26d18 16967 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
10bc17b6
JH
16968 esac
16969 case "$setgrent_r_proto" in
90e831dc 16970 ''|0) d_setgrent_r=undef
10bc17b6 16971 setgrent_r_proto=0
a48ec845 16972 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16973 * ) case "$setgrent_r_proto" in
16974 REENTRANT_PROTO*) ;;
16975 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16976 esac
16977 echo "Prototype: $try" ;;
16978 esac
16979 ;;
c18e646a
JH
16980 *) case "$usethreads" in
16981 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16982 esac
90e831dc
SB
16983 d_setgrent_r=undef
16984 setgrent_r_proto=0
c18e646a 16985 ;;
a48ec845
JH
16986 esac
16987 ;;
10bc17b6
JH
16988*) setgrent_r_proto=0
16989 ;;
16990esac
16991
b4eb6b3d
JH
16992: see if sethostent exists
16993set sethostent d_sethent
16994eval $inlibc
16995
10bc17b6
JH
16996: see if sethostent_r exists
16997set sethostent_r d_sethostent_r
16998eval $inlibc
16999case "$d_sethostent_r" in
17000"$define")
17001 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17002 case "$d_sethostent_r_proto:$usethreads" in
17003 ":define") d_sethostent_r_proto=define
a48ec845
JH
17004 set d_sethostent_r_proto sethostent_r $hdrs
17005 eval $hasproto ;;
17006 *) ;;
17007 esac
17008 case "$d_sethostent_r_proto" in
17009 define)
10bc17b6
JH
17010 case "$sethostent_r_proto" in
17011 ''|0) try='int sethostent_r(int, struct hostent_data*);'
61c26d18 17012 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
10bc17b6
JH
17013 esac
17014 case "$sethostent_r_proto" in
17015 ''|0) try='void sethostent_r(int, struct hostent_data*);'
61c26d18 17016 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
10bc17b6
JH
17017 esac
17018 case "$sethostent_r_proto" in
90e831dc 17019 ''|0) d_sethostent_r=undef
10bc17b6 17020 sethostent_r_proto=0
a48ec845 17021 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17022 * ) case "$sethostent_r_proto" in
17023 REENTRANT_PROTO*) ;;
17024 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17025 esac
17026 echo "Prototype: $try" ;;
17027 esac
17028 ;;
c18e646a
JH
17029 *) case "$usethreads" in
17030 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17031 esac
90e831dc
SB
17032 d_sethostent_r=undef
17033 sethostent_r_proto=0
c18e646a 17034 ;;
a48ec845
JH
17035 esac
17036 ;;
10bc17b6
JH
17037*) sethostent_r_proto=0
17038 ;;
17039esac
17040
4e0554ec
JH
17041: see if setitimer exists
17042set setitimer d_setitimer
17043eval $inlibc
17044
b4eb6b3d
JH
17045: see if setlinebuf exists
17046set setlinebuf d_setlinebuf
17047eval $inlibc
17048
17049: see if setlocale exists
17050set setlocale d_setlocale
17051eval $inlibc
17052
10bc17b6
JH
17053: see if locale.h is available
17054set locale.h i_locale
17055eval $inhdr
17056
17057: see if setlocale_r exists
17058set setlocale_r d_setlocale_r
17059eval $inlibc
17060case "$d_setlocale_r" in
17061"$define")
17062 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
17063 case "$d_setlocale_r_proto:$usethreads" in
17064 ":define") d_setlocale_r_proto=define
a48ec845
JH
17065 set d_setlocale_r_proto setlocale_r $hdrs
17066 eval $hasproto ;;
17067 *) ;;
17068 esac
17069 case "$d_setlocale_r_proto" in
17070 define)
10bc17b6
JH
17071 case "$setlocale_r_proto" in
17072 ''|0) try='int setlocale_r(int, const char*, char*, int);'
61c26d18 17073 ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
10bc17b6
JH
17074 esac
17075 case "$setlocale_r_proto" in
90e831dc 17076 ''|0) d_setlocale_r=undef
10bc17b6 17077 setlocale_r_proto=0
a48ec845 17078 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17079 * ) case "$setlocale_r_proto" in
17080 REENTRANT_PROTO*) ;;
17081 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17082 esac
17083 echo "Prototype: $try" ;;
17084 esac
17085 ;;
c18e646a
JH
17086 *) case "$usethreads" in
17087 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17088 esac
90e831dc
SB
17089 d_setlocale_r=undef
17090 setlocale_r_proto=0
c18e646a 17091 ;;
a48ec845
JH
17092 esac
17093 ;;
10bc17b6
JH
17094*) setlocale_r_proto=0
17095 ;;
17096esac
17097
b4eb6b3d
JH
17098: see if setnetent exists
17099set setnetent d_setnent
17100eval $inlibc
17101
10bc17b6
JH
17102: see if setnetent_r exists
17103set setnetent_r d_setnetent_r
17104eval $inlibc
17105case "$d_setnetent_r" in
17106"$define")
17107 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17108 case "$d_setnetent_r_proto:$usethreads" in
17109 ":define") d_setnetent_r_proto=define
a48ec845
JH
17110 set d_setnetent_r_proto setnetent_r $hdrs
17111 eval $hasproto ;;
17112 *) ;;
17113 esac
17114 case "$d_setnetent_r_proto" in
17115 define)
10bc17b6
JH
17116 case "$setnetent_r_proto" in
17117 ''|0) try='int setnetent_r(int, struct netent_data*);'
61c26d18 17118 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
10bc17b6
JH
17119 esac
17120 case "$setnetent_r_proto" in
17121 ''|0) try='void setnetent_r(int, struct netent_data*);'
61c26d18 17122 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
10bc17b6
JH
17123 esac
17124 case "$setnetent_r_proto" in
90e831dc 17125 ''|0) d_setnetent_r=undef
10bc17b6 17126 setnetent_r_proto=0
a48ec845 17127 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17128 * ) case "$setnetent_r_proto" in
17129 REENTRANT_PROTO*) ;;
17130 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17131 esac
17132 echo "Prototype: $try" ;;
17133 esac
17134 ;;
c18e646a
JH
17135 *) case "$usethreads" in
17136 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17137 esac
90e831dc
SB
17138 d_setnetent_r=undef
17139 setnetent_r_proto=0
c18e646a 17140 ;;
a48ec845
JH
17141 esac
17142 ;;
10bc17b6
JH
17143*) setnetent_r_proto=0
17144 ;;
17145esac
17146
b4eb6b3d
JH
17147: see if setprotoent exists
17148set setprotoent d_setpent
17149eval $inlibc
17150
17151: see if setpgid exists
17152set setpgid d_setpgid
17153eval $inlibc
17154
17155: see if setpgrp2 exists
17156set setpgrp2 d_setpgrp2
17157eval $inlibc
17158
17159: see if setpriority exists
17160set setpriority d_setprior
17161eval $inlibc
17162
17163: see if setproctitle exists
17164set setproctitle d_setproctitle
17165eval $inlibc
17166
10bc17b6
JH
17167: see if setprotoent_r exists
17168set setprotoent_r d_setprotoent_r
17169eval $inlibc
17170case "$d_setprotoent_r" in
17171"$define")
17172 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17173 case "$d_setprotoent_r_proto:$usethreads" in
17174 ":define") d_setprotoent_r_proto=define
a48ec845
JH
17175 set d_setprotoent_r_proto setprotoent_r $hdrs
17176 eval $hasproto ;;
17177 *) ;;
17178 esac
17179 case "$d_setprotoent_r_proto" in
17180 define)
10bc17b6
JH
17181 case "$setprotoent_r_proto" in
17182 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
61c26d18 17183 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
10bc17b6
JH
17184 esac
17185 case "$setprotoent_r_proto" in
17186 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
61c26d18 17187 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
10bc17b6
JH
17188 esac
17189 case "$setprotoent_r_proto" in
90e831dc 17190 ''|0) d_setprotoent_r=undef
10bc17b6 17191 setprotoent_r_proto=0
a48ec845 17192 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17193 * ) case "$setprotoent_r_proto" in
17194 REENTRANT_PROTO*) ;;
17195 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17196 esac
17197 echo "Prototype: $try" ;;
17198 esac
17199 ;;
c18e646a
JH
17200 *) case "$usethreads" in
17201 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17202 esac
90e831dc
SB
17203 d_setprotoent_r=undef
17204 setprotoent_r_proto=0
c18e646a 17205 ;;
a48ec845
JH
17206 esac
17207 ;;
10bc17b6
JH
17208*) setprotoent_r_proto=0
17209 ;;
17210esac
17211
b4eb6b3d
JH
17212: see if setpwent exists
17213set setpwent d_setpwent
17214eval $inlibc
17215
10bc17b6
JH
17216: see if setpwent_r exists
17217set setpwent_r d_setpwent_r
17218eval $inlibc
17219case "$d_setpwent_r" in
17220"$define")
17221 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
17222 case "$d_setpwent_r_proto:$usethreads" in
17223 ":define") d_setpwent_r_proto=define
a48ec845
JH
17224 set d_setpwent_r_proto setpwent_r $hdrs
17225 eval $hasproto ;;
17226 *) ;;
17227 esac
17228 case "$d_setpwent_r_proto" in
17229 define)
10bc17b6
JH
17230 case "$setpwent_r_proto" in
17231 ''|0) try='int setpwent_r(FILE**);'
61c26d18 17232 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
10bc17b6
JH
17233 esac
17234 case "$setpwent_r_proto" in
17235 ''|0) try='void setpwent_r(FILE**);'
61c26d18 17236 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
10bc17b6
JH
17237 esac
17238 case "$setpwent_r_proto" in
90e831dc 17239 ''|0) d_setpwent_r=undef
10bc17b6 17240 setpwent_r_proto=0
a48ec845 17241 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17242 * ) case "$setpwent_r_proto" in
17243 REENTRANT_PROTO*) ;;
17244 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17245 esac
17246 echo "Prototype: $try" ;;
17247 esac
17248 ;;
c18e646a
JH
17249 *) case "$usethreads" in
17250 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17251 esac
90e831dc
SB
17252 d_setpwent_r=undef
17253 setpwent_r_proto=0
c18e646a 17254 ;;
a48ec845
JH
17255 esac
17256 ;;
10bc17b6
JH
17257*) setpwent_r_proto=0
17258 ;;
17259esac
17260
b4eb6b3d
JH
17261: see if setregid exists
17262set setregid d_setregid
17263eval $inlibc
17264set setresgid d_setresgid
17265eval $inlibc
17266
17267: see if setreuid exists
17268set setreuid d_setreuid
17269eval $inlibc
17270set setresuid d_setresuid
17271eval $inlibc
17272
17273: see if setrgid exists
17274set setrgid d_setrgid
17275eval $inlibc
17276
17277: see if setruid exists
17278set setruid d_setruid
17279eval $inlibc
17280
17281: see if setservent exists
17282set setservent d_setsent
17283eval $inlibc
17284
10bc17b6
JH
17285: see if setservent_r exists
17286set setservent_r d_setservent_r
17287eval $inlibc
17288case "$d_setservent_r" in
17289"$define")
17290 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17291 case "$d_setservent_r_proto:$usethreads" in
17292 ":define") d_setservent_r_proto=define
a48ec845
JH
17293 set d_setservent_r_proto setservent_r $hdrs
17294 eval $hasproto ;;
17295 *) ;;
17296 esac
17297 case "$d_setservent_r_proto" in
17298 define)
10bc17b6
JH
17299 case "$setservent_r_proto" in
17300 ''|0) try='int setservent_r(int, struct servent_data*);'
61c26d18 17301 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
10bc17b6
JH
17302 esac
17303 case "$setservent_r_proto" in
17304 ''|0) try='void setservent_r(int, struct servent_data*);'
61c26d18 17305 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
10bc17b6
JH
17306 esac
17307 case "$setservent_r_proto" in
90e831dc 17308 ''|0) d_setservent_r=undef
10bc17b6 17309 setservent_r_proto=0
a48ec845 17310 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17311 * ) case "$setservent_r_proto" in
17312 REENTRANT_PROTO*) ;;
17313 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17314 esac
17315 echo "Prototype: $try" ;;
17316 esac
17317 ;;
c18e646a
JH
17318 *) case "$usethreads" in
17319 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17320 esac
90e831dc
SB
17321 d_setservent_r=undef
17322 setservent_r_proto=0
c18e646a 17323 ;;
a48ec845
JH
17324 esac
17325 ;;
10bc17b6
JH
17326*) setservent_r_proto=0
17327 ;;
17328esac
17329
b4eb6b3d
JH
17330: see if setsid exists
17331set setsid d_setsid
17332eval $inlibc
17333
17334: see if setvbuf exists
17335set setvbuf d_setvbuf
17336eval $inlibc
17337
17338: see if sfio.h is available
17339set sfio.h i_sfio
17340eval $inhdr
17341
b4eb6b3d
JH
17342: see if sfio library is available
17343case "$i_sfio" in
17344$define)
17345 val=''
17346 set sfreserve val
17347 eval $inlibc
17348 ;;
17349*)
17350 val="$undef"
17351 ;;
17352esac
17353: Ok, but do we want to use it.
17354case "$val" in
17355$define)
17356 case "$usesfio" in
17357 true|$define|[yY]*) dflt='y';;
17358 *) dflt='n';;
17359 esac
17360 echo "$package can use the sfio library, but it is experimental."
b4eb6b3d
JH
17361 rp="You seem to have sfio available, do you want to try using it?"
17362 . ./myread
17363 case "$ans" in
dd35fa16 17364 y|Y) echo "Ok, turning on sfio then."
b4eb6b3d
JH
17365 val="$define"
17366 ;;
17367 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
17368 val="$undef"
b4eb6b3d
JH
17369 ;;
17370 esac
17371 ;;
17372*) case "$usesfio" in
17373 true|$define|[yY]*)
17374 echo "Sorry, cannot find sfio on this machine." >&4
17375 echo "Ignoring your setting of usesfio=$usesfio." >&4
17376 val="$undef"
17377 ;;
17378 esac
17379 ;;
17380esac
17381set d_sfio
17382eval $setvar
17383case "$d_sfio" in
17384$define) usesfio='true';;
17385*) usesfio='false';;
17386esac
3659ebf1
JH
17387case "$d_sfio" in
17388$define) ;;
17389*) : Remove sfio from list of libraries to use
7483f793
JH
17390 case "$libs" in
17391 *-lsfio*)
17392 echo "Removing unneeded -lsfio from library list" >&4
17393 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17394 shift
17395 libs="$*"
17396 echo "libs = $libs" >&4
17397 ;;
17398 esac
3659ebf1
JH
17399;;
17400esac
17401
b4eb6b3d
JH
17402
17403: see if shmctl exists
17404set shmctl d_shmctl
17405eval $inlibc
17406
17407: see if shmget exists
17408set shmget d_shmget
17409eval $inlibc
17410
17411: see if shmat exists
17412set shmat d_shmat
17413eval $inlibc
17414: see what shmat returns
17415case "$d_shmat" in
17416"$define")
17417 $cat >shmat.c <<'END'
17418#include <sys/shm.h>
17419void *shmat();
17420END
17421 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17422 shmattype='void *'
17423 else
17424 shmattype='char *'
17425 fi
17426 echo "and it returns ($shmattype)." >&4
17427 : see if a prototype for shmat is available
17428 xxx=`./findhdr sys/shm.h`
17429 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17430 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17431 val="$define"
17432 else
17433 val="$undef"
17434 fi
17435 $rm -f shmat.[co]
17436 ;;
17437*)
17438 val="$undef"
17439 ;;
17440esac
17441set d_shmatprototype
17442eval $setvar
17443
17444: see if shmdt exists
17445set shmdt d_shmdt
17446eval $inlibc
17447
17448: see how much of the 'shm*(2)' library is present.
17449h_shm=true
17450echo " "
17451case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17452*"$undef"*) h_shm=false;;
17453esac
17454case "$osname" in
17455freebsd)
17456 case "`ipcs 2>&1`" in
17457 "SVID shared memory"*"not configured"*)
17458 echo "Your $osname does not have the shm*(2) configured." >&4
17459 h_shm=false
17460 val="$undef"
17461 set shmctl d_shmctl
17462 evat $setvar
17463 set shmget d_shmget
17464 evat $setvar
17465 set shmat d_shmat
17466 evat $setvar
17467 set shmdt d_shmdt
17468 evat $setvar
17469 ;;
17470 esac
17471 ;;
17472esac
17473: we could also check for sys/ipc.h ...
17474if $h_shm && $test `./findhdr sys/shm.h`; then
17475 echo "You have the full shm*(2) library." >&4
17476 val="$define"
17477else
17478 echo "You don't have the full shm*(2) library." >&4
17479 val="$undef"
17480fi
17481set d_shm
17482eval $setvar
17483
b4eb6b3d 17484: see if we have sigaction
613d6c3e 17485echo " "
b4eb6b3d
JH
17486if set sigaction val -f d_sigaction; eval $csym; $val; then
17487 echo 'sigaction() found.' >&4
073b6de5 17488 $cat > try.c <<EOP
b4eb6b3d
JH
17489#include <stdio.h>
17490#include <sys/types.h>
17491#include <signal.h>
073b6de5
JH
17492#$i_stdlib I_STDLIB
17493#ifdef I_STDLIB
17494#include <stdlib.h>
17495#endif
b4eb6b3d
JH
17496int main()
17497{
17498 struct sigaction act, oact;
17499 act.sa_flags = 0;
17500 oact.sa_handler = 0;
17501 /* so that act and oact are used */
17502 exit(act.sa_flags == 0 && oact.sa_handler == 0);
17503}
17504EOP
17505 set try
17506 if eval $compile_ok; then
17507 val="$define"
17508 else
17509 echo "But you don't seem to have a useable struct sigaction." >&4
17510 val="$undef"
17511 fi
17512else
17513 echo 'sigaction NOT found.' >&4
17514 val="$undef"
17515fi
17516set d_sigaction; eval $setvar
5b813a60 17517$rm_try
b4eb6b3d 17518
ed140128
AD
17519: see if this is a sunmath.h system
17520set sunmath.h i_sunmath
17521eval $inhdr
17522
17523: see if signbit exists
17524$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17525$cat >try.c <<EOCP
17526#$i_math I_MATH
17527#$i_sunmath I_SUNMATH
17528#ifdef I_MATH
17529# include <math.h>
17530#endif
17531#ifdef I_SUNMATH /* Solaris special math library */
17532# include <sunmath.h>
17533#endif
17534#define NV $nvtype
17535int main(int argc, char **argv)
17536{
17537 NV x = 0.0;
17538 NV y = -0.0;
17539 if ((signbit(x) == 0) && (signbit(y) != 0))
17540 return 0;
17541 else
17542 return 1;
17543}
17544EOCP
17545val="$undef"
17546set try
17547if eval $compile; then
17548 if $run ./try; then
17549 $echo "Yes." >&4
17550 val="$define"
17551 else
17552 $echo "Signbit seems to be available, but doesn't work as I expected."
17553 $echo "I won't use it." >&4
17554 val="$undef"
17555 fi
17556else
17557 $echo "Nope." >&4
17558 dflt="$undef"
17559fi
17560set d_signbit
17561eval $setvar
5b813a60 17562$rm_try
ed140128 17563
983dbef6
JH
17564: see if sigprocmask exists
17565set sigprocmask d_sigprocmask
17566eval $inlibc
17567
b4eb6b3d
JH
17568: see if sigsetjmp exists
17569echo " "
17570case "$d_sigsetjmp" in
17571'')
c727eafa 17572 $cat >try.c <<EOP
b4eb6b3d 17573#include <setjmp.h>
d1daaddf
JH
17574#$i_stdlib I_STDLIB
17575#ifdef I_STDLIB
17576#include <stdlib.h>
17577#endif
b4eb6b3d
JH
17578sigjmp_buf env;
17579int set = 1;
17580int main()
17581{
17582 if (sigsetjmp(env,1))
17583 exit(set);
17584 set = 0;
17585 siglongjmp(env, 1);
17586 exit(1);
17587}
17588EOP
17589 set try
17590 if eval $compile; then
5440bc8e 17591 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
17592 echo "POSIX sigsetjmp found." >&4
17593 val="$define"
17594 else
17595 $cat >&4 <<EOM
17596Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17597I'll ignore them.
17598EOM
17599 val="$undef"
17600 fi
17601 else
17602 echo "sigsetjmp not found." >&4
17603 val="$undef"
17604 fi
17605 ;;
17606*) val="$d_sigsetjmp"
17607 case "$d_sigsetjmp" in
17608 $define) echo "POSIX sigsetjmp found." >&4;;
17609 $undef) echo "sigsetjmp not found." >&4;;
17610 esac
17611 ;;
17612esac
17613set d_sigsetjmp
17614eval $setvar
5b813a60 17615$rm_try
b4eb6b3d 17616
4f5da3e9
SP
17617: see if snprintf exists
17618set snprintf d_snprintf
17619eval $inlibc
17620
17621: see if vsnprintf exists
17622set vsnprintf d_vsnprintf
17623eval $inlibc
17624
2478f7a0
MB
17625case "$d_snprintf-$d_vsnprintf" in
17626"$define-$define")
17627 $cat <<EOM
17628Checking whether your snprintf() and vsnprintf() work okay...
17629EOM
17630 $cat >try.c <<'EOCP'
17631/* v?snprintf testing logic courtesy of Russ Allbery.
17632 * According to C99:
17633 * - if the buffer is too short it still must be \0-terminated
17634 * - if the buffer is too short the potentially required length
17635 * must be returned and not -1
17636 * - if the buffer is NULL the potentially required length
17637 * must be returned and not -1 or core dump
17638 */
17639#include <stdio.h>
17640#include <stdarg.h>
17641
17642char buf[2];
17643
17644int test (char *format, ...)
17645{
17646 va_list args;
17647 int count;
17648
17649 va_start (args, format);
17650 count = vsnprintf (buf, sizeof buf, format, args);
17651 va_end (args);
17652 return count;
17653}
17654
17655int main ()
17656{
17657 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17658 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17659}
17660EOCP
17661 set try
17662 if eval $compile; then
17663 `$run ./try`
17664 case "$?" in
17665 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17666 *) cat <<EOM >&4
17667Your snprintf() and snprintf() don't seem to be working okay.
17668EOM
17669 d_snprintf="$undef"
17670 d_vsnprintf="$undef"
17671 ;;
17672 esac
17673 else
17674 echo "(I can't seem to compile the test program--assuming they don't)"
17675 d_snprintf="$undef"
17676 d_vsnprintf="$undef"
17677 fi
5b813a60 17678 $rm_try
2478f7a0
MB
17679 ;;
17680esac
17681
49a78c82
JH
17682: see if sockatmark exists
17683set sockatmark d_sockatmark
17684eval $inlibc
17685
2ef53570
JH
17686: see if prototype for sockatmark is available
17687echo " "
17688set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17689eval $hasproto
17690
b4eb6b3d
JH
17691: see if socks5_init exists
17692set socks5_init d_socks5_init
17693eval $inlibc
17694
360321b3
YST
17695: see if sprintf returns the length of the string in the buffer as per ANSI
17696$echo "Checking whether sprintf returns the length of the string..." >&4
17697$cat <<EOP >try.c
17698#include <stdio.h>
17699#$i_stdlib I_STDLIB
17700#ifdef I_STDLIB
17701#include <stdlib.h>
17702#endif
17703#$i_string I_STRING
17704#ifdef I_STRING
17705# include <string.h>
17706#else
17707# include <strings.h>
17708#endif
17709#$i_math I_MATH
17710#ifdef I_MATH
17711#include <math.h>
17712#endif
17713
17714char buffer[256];
17715
17716int check (size_t expect, int test) {
17717 size_t got = strlen(buffer);
17718 if (expect == got)
17719 return 0;
17720
17721 printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17722 test, buffer);
17723 exit (test);
17724}
17725
17726int main(int argc, char **argv) {
17727 int test = 0;
17728
17729 check(sprintf(buffer, ""), ++test);
17730 check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17731 check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17732
17733 return 0;
17734}
17735EOP
17736set try
17737
360321b3
YST
17738if eval $compile; then
17739 xxx="`$run ./try`"
17740 case "$?" in
17741 0) cat >&4 <<EOM
17742sprintf returns the length of the string (as ANSI says it should)
17743EOM
17744 d_sprintf_returns_strlen="$define"
17745 ;;
17746 *) cat >&4 <<EOM
17747sprintf does not return the length of the string (how old is this system?)
17748EOM
17749 d_sprintf_returns_strlen="$undef"
17750 ;;
17751 esac
d2821e72 17752else
36a30365
JH
17753 echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17754 d_sprintf_returns_strlen="$undef"
360321b3 17755fi
5b813a60 17756$rm_try
360321b3 17757
10bc17b6
JH
17758: see if srand48_r exists
17759set srand48_r d_srand48_r
17760eval $inlibc
17761case "$d_srand48_r" in
17762"$define")
17763 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17764 case "$d_srand48_r_proto:$usethreads" in
17765 ":define") d_srand48_r_proto=define
a48ec845
JH
17766 set d_srand48_r_proto srand48_r $hdrs
17767 eval $hasproto ;;
17768 *) ;;
17769 esac
17770 case "$d_srand48_r_proto" in
17771 define)
10bc17b6
JH
17772 case "$srand48_r_proto" in
17773 ''|0) try='int srand48_r(long, struct drand48_data*);'
61c26d18 17774 ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
10bc17b6
JH
17775 esac
17776 case "$srand48_r_proto" in
90e831dc 17777 ''|0) d_srand48_r=undef
10bc17b6 17778 srand48_r_proto=0
a48ec845 17779 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17780 * ) case "$srand48_r_proto" in
17781 REENTRANT_PROTO*) ;;
17782 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17783 esac
17784 echo "Prototype: $try" ;;
17785 esac
17786 ;;
c18e646a
JH
17787 *) case "$usethreads" in
17788 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17789 esac
90e831dc
SB
17790 d_srand48_r=undef
17791 srand48_r_proto=0
c18e646a 17792 ;;
a48ec845
JH
17793 esac
17794 ;;
10bc17b6
JH
17795*) srand48_r_proto=0
17796 ;;
17797esac
17798
17799: see if srandom_r exists
17800set srandom_r d_srandom_r
17801eval $inlibc
17802case "$d_srandom_r" in
17803"$define")
17804 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17805 case "$d_srandom_r_proto:$usethreads" in
17806 ":define") d_srandom_r_proto=define
a48ec845
JH
17807 set d_srandom_r_proto srandom_r $hdrs
17808 eval $hasproto ;;
17809 *) ;;
17810 esac
17811 case "$d_srandom_r_proto" in
17812 define)
10bc17b6
JH
17813 case "$srandom_r_proto" in
17814 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
61c26d18 17815 ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
10bc17b6
JH
17816 esac
17817 case "$srandom_r_proto" in
90e831dc 17818 ''|0) d_srandom_r=undef
10bc17b6 17819 srandom_r_proto=0
a48ec845 17820 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17821 * ) case "$srandom_r_proto" in
17822 REENTRANT_PROTO*) ;;
17823 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17824 esac
17825 echo "Prototype: $try" ;;
17826 esac
17827 ;;
c18e646a
JH
17828 *) case "$usethreads" in
17829 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17830 esac
90e831dc
SB
17831 d_srandom_r=undef
17832 srandom_r_proto=0
c18e646a 17833 ;;
a48ec845
JH
17834 esac
17835 ;;
10bc17b6
JH
17836*) srandom_r_proto=0
17837 ;;
17838esac
17839
eef837ea
JH
17840: see if prototype for setresgid is available
17841echo " "
17842set d_sresgproto setresgid $i_unistd unistd.h
17843eval $hasproto
17844
640374d0
JH
17845: see if prototype for setresuid is available
17846echo " "
17847set d_sresuproto setresuid $i_unistd unistd.h
17848eval $hasproto
17849
b4eb6b3d
JH
17850: see if sys/stat.h is available
17851set sys/stat.h i_sysstat
17852eval $inhdr
17853
b4eb6b3d
JH
17854: see if stat knows about block sizes
17855echo " "
17856echo "Checking to see if your struct stat has st_blocks field..." >&4
17857set d_statblks stat st_blocks $i_sysstat sys/stat.h
17858eval $hasfield
17859
b4eb6b3d
JH
17860: see if this is a sys/vfs.h system
17861set sys/vfs.h i_sysvfs
17862eval $inhdr
17863
b4eb6b3d
JH
17864: see if this is a sys/statfs.h system
17865set sys/statfs.h i_sysstatfs
17866eval $inhdr
17867
34f1896b 17868: Check for statfs_s
b4eb6b3d
JH
17869echo " "
17870echo "Checking to see if your system supports struct statfs..." >&4
17871set 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
17872eval $hasstruct
17873case "$d_statfs_s" in
17874"$define") echo "Yes, it does." ;;
17875*) echo "No, it doesn't." ;;
17876esac
17877
17878
b4eb6b3d
JH
17879: see if struct statfs knows about f_flags
17880case "$d_statfs_s" in
34f1896b 17881define)
b4eb6b3d
JH
17882 echo " "
17883 echo "Checking to see if your struct statfs has f_flags field..." >&4
17884 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
17885 eval $hasfield
17886 ;;
17887*) val="$undef"
17888 set d_statfs_f_flags
17889 eval $setvar
17890 ;;
17891esac
17892case "$d_statfs_f_flags" in
17893"$define") echo "Yes, it does." ;;
17894*) echo "No, it doesn't." ;;
17895esac
17896
17a6c8e3
AD
17897: see what flavor, if any, of static inline is supported
17898echo " "
17899echo "Checking to see if your system supports static inline..."
17900$cat > try.c <<'EOCP'
17901#include <stdlib.h>
17902extern int f_via_a(int x);
17903extern int f_via_b(int x);
17904int main(int argc, char **argv)
17905{
17906 int y;
17907
17908 y = f_via_a(0);
17909#ifdef USE_B
17910 y = f_via_b(0);
17911#endif
17912 if (y == 42) {
17913 return EXIT_SUCCESS;
17914 }
17915 else {
17916 return EXIT_FAILURE;
17917 }
17918}
17919EOCP
17920$cat > a.c <<'EOCP'
17921static INLINE int f(int x) {
17922 int y;
17923 y = x + 42;
17924 return y;
17925}
17926
17927int f_via_a(int x)
17928{
17929 return f(x);
17930}
17931EOCP
17932$cat > b.c <<'EOCP'
17933extern int f(int x);
17934
17935int f_via_b(int x)
17936{
17937 return f(x);
17938}
17939EOCP
17940
17941# Respect a hint (or previous) value for perl_static_inline, if there is one.
17942case "$perl_static_inline" in
17943'') # Check the various possibilities, and break out on success.
17944 # For gcc, prefer __inline__, which will still permit
17945 # cflags.SH to add in -ansi.
17946 case "$gccversion" in
17947 '') xxx="inline __inline__ __inline _inline";;
17948 *) xxx="__inline__ inline __inline _inline";;
17949 esac
17950 for inline in $xxx; do
17951 set try -DINLINE=$inline a.c
17952 if eval $compile && $run ./try; then
17953 # Now make sure there is no external linkage of static
17954 # functions
17955 set try -DINLINE=$inline -DUSE_B a.c b.c
17956 if eval $compile && $run ./try; then
17957 $echo "Your compiler supports static $inline, " >&4
17958 $echo "but it also creates an external definition," >&4
17959 $echo "so I won't use it." >&4
17960 val=$undef
17961 else
17962 $echo "Your compiler supports static $inline." >&4
17963 val=$define
17964 perl_static_inline="static $inline";
17965 break;
17966 fi
17967 else
17968 $echo "Your compiler does NOT support static $inline." >&4
17969 val="$undef"
17970 fi
17971 done
17972 ;;
17973*inline*) # Some variant of inline exists.
17974 echo "Keeping your $hint value of $perl_static_inline."
17975 val=$define
17976 ;;
17977static) # No inline capabilities
17978 echo "Keeping your $hint value of $perl_static_inline."
17979 val=$undef
17980 ;;
17981*) # Unrecognized previous value -- blindly trust the supplied
17982 # value and hope it makes sense. Use old value for
17983 # d_static_inline, if there is one.
17984 echo "Keeping your $hint value of $perl_static_inline."
17985 case "$d_static_inline" in
17986 '') val=$define ;;
17987 *) val=$d_static_inline ;;
17988 esac
17989 ;;
17990esac
17991# Fallback to plain 'static' if nothing worked.
17992case "$perl_static_inline" in
17993'')
17994 perl_static_inline="static"
17995 val=$undef
17996 ;;
17997esac
17998set d_static_inline
17999eval $setvar
18000$rm -f a.[co] b.[co]
18001$rm_try
18002
613d6c3e 18003: Check stream access
b4eb6b3d
JH
18004$cat >&4 <<EOM
18005Checking how to access stdio streams by file descriptor number...
18006EOM
18007case "$stdio_stream_array" in
18008'') $cat >try.c <<EOCP
18009#include <stdio.h>
18010int main() {
18011 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18012 printf("yes\n");
18013}
18014EOCP
18015 for s in _iob __iob __sF
18016 do
18017 set try -DSTDIO_STREAM_ARRAY=$s
18018 if eval $compile; then
5440bc8e 18019 case "`$run ./try`" in
b4eb6b3d
JH
18020 yes) stdio_stream_array=$s; break ;;
18021 esac
18022 fi
18023 done
5b813a60 18024 $rm_try
b4eb6b3d
JH
18025esac
18026case "$stdio_stream_array" in
18027'') $cat >&4 <<EOM
18028I can't figure out how to access stdio streams by file descriptor number.
18029EOM
18030 d_stdio_stream_array="$undef"
18031 ;;
18032*) $cat >&4 <<EOM
18033You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18034EOM
18035 d_stdio_stream_array="$define"
18036 ;;
18037esac
18038
18039: see if strcoll exists
18040set strcoll d_strcoll
18041eval $inlibc
18042
18043: check for structure copying
18044echo " "
18045echo "Checking to see if your C compiler can copy structs..." >&4
18046$cat >try.c <<'EOCP'
76f47787 18047int main()
b4eb6b3d
JH
18048{
18049 struct blurfl {
18050 int dyick;
18051 } foo, bar;
18052
18053 foo = bar;
18054}
18055EOCP
18056if $cc -c try.c >/dev/null 2>&1 ; then
18057 val="$define"
18058 echo "Yup, it can."
18059else
18060 val="$undef"
18061 echo "Nope, it can't."
18062fi
18063set d_strctcpy
18064eval $setvar
5b813a60 18065$rm_try
b4eb6b3d
JH
18066
18067: see if strerror and/or sys_errlist[] exist
18068echo " "
18069if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18070 if set strerror val -f d_strerror; eval $csym; $val; then
18071 echo 'strerror() found.' >&4
18072 d_strerror="$define"
18073 d_strerrm='strerror(e)'
18074 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18075 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18076 d_syserrlst="$define"
18077 else
18078 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18079 d_syserrlst="$undef"
18080 fi
18081 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18082 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18083 echo 'strerror() found in string header.' >&4
18084 d_strerror="$define"
18085 d_strerrm='strerror(e)'
18086 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18087 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18088 d_syserrlst="$define"
18089 else
18090 echo "(You don't appear to have any sys_errlist[], how can this be?)"
18091 d_syserrlst="$undef"
18092 fi
18093 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18094 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18095 d_strerror="$undef"
18096 d_syserrlst="$define"
18097 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18098 else
18099 echo 'strerror() and sys_errlist[] NOT found.' >&4
18100 d_strerror="$undef"
18101 d_syserrlst="$undef"
18102 d_strerrm='"unknown"'
18103 fi
18104fi
18105
10bc17b6
JH
18106: see if strerror_r exists
18107set strerror_r d_strerror_r
18108eval $inlibc
18109case "$d_strerror_r" in
18110"$define")
18111 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
18112 case "$d_strerror_r_proto:$usethreads" in
18113 ":define") d_strerror_r_proto=define
a48ec845
JH
18114 set d_strerror_r_proto strerror_r $hdrs
18115 eval $hasproto ;;
18116 *) ;;
18117 esac
18118 case "$d_strerror_r_proto" in
18119 define)
10bc17b6
JH
18120 case "$strerror_r_proto" in
18121 ''|0) try='int strerror_r(int, char*, size_t);'
61c26d18 18122 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
10bc17b6
JH
18123 esac
18124 case "$strerror_r_proto" in
18125 ''|0) try='int strerror_r(int, char*, int);'
61c26d18 18126 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
10bc17b6
JH
18127 esac
18128 case "$strerror_r_proto" in
18129 ''|0) try='char* strerror_r(int, char*, size_t);'
61c26d18 18130 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
10bc17b6
JH
18131 esac
18132 case "$strerror_r_proto" in
90e831dc 18133 ''|0) d_strerror_r=undef
10bc17b6 18134 strerror_r_proto=0
a48ec845 18135 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18136 * ) case "$strerror_r_proto" in
18137 REENTRANT_PROTO*) ;;
18138 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18139 esac
18140 echo "Prototype: $try" ;;
18141 esac
18142 ;;
c18e646a
JH
18143 *) case "$usethreads" in
18144 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18145 esac
90e831dc
SB
18146 d_strerror_r=undef
18147 strerror_r_proto=0
c18e646a 18148 ;;
a48ec845
JH
18149 esac
18150 ;;
10bc17b6
JH
18151*) strerror_r_proto=0
18152 ;;
18153esac
18154
b3c85772
JH
18155: see if strftime exists
18156set strftime d_strftime
18157eval $inlibc
18158
08c92000
MB
18159: see if strlcat exists
18160set strlcat d_strlcat
18161eval $inlibc
18162
18163: see if strlcpy exists
18164set strlcpy d_strlcpy
18165eval $inlibc
18166
b4eb6b3d
JH
18167: see if strtod exists
18168set strtod d_strtod
18169eval $inlibc
18170
18171: see if strtol exists
18172set strtol d_strtol
18173eval $inlibc
18174
18175: see if strtold exists
18176set strtold d_strtold
18177eval $inlibc
18178
18179: see if strtoll exists
18180set strtoll d_strtoll
18181eval $inlibc
18182
18183case "$d_longlong-$d_strtoll" in
18184"$define-$define")
18185 $cat <<EOM
18186Checking whether your strtoll() works okay...
18187EOM
18188 $cat >try.c <<'EOCP'
18189#include <errno.h>
18190#ifdef __hpux
18191#define strtoll __strtoll
18192#endif
e75931a7
YST
18193#ifdef __EMX__
18194#define strtoll _strtoll
18195#endif
b4eb6b3d 18196#include <stdio.h>
613d6c3e 18197extern long long int strtoll(char *s, char **, int);
b4eb6b3d
JH
18198static int bad = 0;
18199int check(char *s, long long ell, int een) {
18200 long long gll;
18201 errno = 0;
18202 gll = strtoll(s, 0, 10);
18203 if (!((gll == ell) && (errno == een)))
18204 bad++;
18205}
18206int main() {
18207 check(" 1", 1LL, 0);
18208 check(" 0", 0LL, 0);
18209 check("-1", -1LL, 0);
18210 check("-9223372036854775808", -9223372036854775808LL, 0);
18211 check("-9223372036854775808", -9223372036854775808LL, 0);
18212 check(" 9223372036854775807", 9223372036854775807LL, 0);
18213 check("-9223372036854775808", -9223372036854775808LL, 0);
18214 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
18215 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18216 if (!bad)
18217 printf("ok\n");
18218}
18219EOCP
18220 set try
18221 if eval $compile; then
5440bc8e 18222 yyy=`$run ./try`
e75931a7 18223 case "$yyy" in
b4eb6b3d
JH
18224 ok) echo "Your strtoll() seems to be working okay." ;;
18225 *) cat <<EOM >&4
18226Your strtoll() doesn't seem to be working okay.
18227EOM
18228 d_strtoll="$undef"
18229 ;;
69eadf66 18230 esac
e75931a7
YST
18231 else
18232 echo "(I can't seem to compile the test program--assuming it doesn't)"
18233 d_strtoll="$undef"
b4eb6b3d
JH
18234 fi
18235 ;;
18236esac
18237
28e5dec8
JH
18238: see if strtoq exists
18239set strtoq d_strtoq
18240eval $inlibc
18241
b4eb6b3d
JH
18242: see if strtoul exists
18243set strtoul d_strtoul
18244eval $inlibc
18245
d0e6d399
NC
18246case "$d_strtoul" in
18247"$define")
18248 $cat <<EOM
18249Checking whether your strtoul() works okay...
18250EOM
18251 $cat >try.c <<'EOCP'
18252#include <errno.h>
18253#include <stdio.h>
613d6c3e 18254extern unsigned long int strtoul(char *s, char **, int);
d0e6d399
NC
18255static int bad = 0;
18256void check(char *s, unsigned long eul, int een) {
18257 unsigned long gul;
18258 errno = 0;
18259 gul = strtoul(s, 0, 10);
18260 if (!((gul == eul) && (errno == een)))
18261 bad++;
18262}
18263int main() {
18264 check(" 1", 1L, 0);
18265 check(" 0", 0L, 0);
18266EOCP
18267 case "$longsize" in
18268 8)
18269 $cat >>try.c <<'EOCP'
09c0d2c4
JH
18270 check("18446744073709551615", 18446744073709551615UL, 0);
18271 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 18272#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 18273 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
18274 check("-18446744073709551614", 2, 0);
18275 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
18276 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18277 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 18278#endif
d0e6d399
NC
18279EOCP
18280 ;;
18281 4)
18282 $cat >>try.c <<'EOCP'
18283 check("4294967295", 4294967295UL, 0);
18284 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 18285#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
18286 check("-1", 4294967295UL, 0);
18287 check("-4294967294", 2, 0);
18288 check("-4294967295", 1, 0);
18289 check("-4294967296", 4294967295UL, ERANGE);
18290 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 18291#endif
d0e6d399
NC
18292EOCP
18293 ;;
18294 *)
18295: Should we write these tests to be more portable by sprintf-ing
18296: ~0 and then manipulating that char string as input for strtol?
18297 ;;
18298 esac
18299 $cat >>try.c <<'EOCP'
18300 if (!bad)
18301 printf("ok\n");
18302 return 0;
18303}
18304EOCP
18305 set try
18306 if eval $compile; then
5440bc8e 18307 case "`$run ./try`" in
d0e6d399
NC
18308 ok) echo "Your strtoul() seems to be working okay." ;;
18309 *) cat <<EOM >&4
18310Your strtoul() doesn't seem to be working okay.
18311EOM
18312 d_strtoul="$undef"
18313 ;;
18314 esac
9597a80f
NC
18315 else
18316 echo "(I can't seem to compile the test program--assuming it doesn't)"
18317 d_strtoul="$undef"
d0e6d399
NC
18318 fi
18319 ;;
18320esac
18321
b4eb6b3d
JH
18322: see if strtoull exists
18323set strtoull d_strtoull
18324eval $inlibc
18325
18326case "$d_longlong-$d_strtoull" in
18327"$define-$define")
18328 $cat <<EOM
18329Checking whether your strtoull() works okay...
18330EOM
18331 $cat >try.c <<'EOCP'
18332#include <errno.h>
18333#ifdef __hpux
18334#define strtoull __strtoull
18335#endif
18336#include <stdio.h>
613d6c3e 18337extern unsigned long long int strtoull(char *s, char **, int);
b4eb6b3d
JH
18338static int bad = 0;
18339int check(char *s, long long eull, int een) {
18340 long long gull;
18341 errno = 0;
18342 gull = strtoull(s, 0, 10);
18343 if (!((gull == eull) && (errno == een)))
18344 bad++;
18345}
18346int main() {
d0e6d399
NC
18347 check(" 1", 1LL, 0);
18348 check(" 0", 0LL, 0);
18349 check("18446744073709551615", 18446744073709551615ULL, 0);
18350 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 18351#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
18352 check("-1", 18446744073709551615ULL, 0);
18353 check("-18446744073709551614", 2LL, 0);
18354 check("-18446744073709551615", 1LL, 0);
18355 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18356 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 18357#endif
b4eb6b3d
JH
18358 if (!bad)
18359 printf("ok\n");
18360}
18361EOCP
18362 set try
18363 if eval $compile; then
5440bc8e 18364 case "`$run ./try`" in
b4eb6b3d
JH
18365 ok) echo "Your strtoull() seems to be working okay." ;;
18366 *) cat <<EOM >&4
18367Your strtoull() doesn't seem to be working okay.
18368EOM
18369 d_strtoull="$undef"
18370 ;;
18371 esac
9597a80f
NC
18372 else
18373 echo "(I can't seem to compile the test program--assuming it doesn't)"
18374 d_strtoull="$undef"
b4eb6b3d
JH
18375 fi
18376 ;;
18377esac
18378
18379: see if strtouq exists
18380set strtouq d_strtouq
18381eval $inlibc
18382
d0e6d399
NC
18383case "$d_strtouq" in
18384"$define")
18385 $cat <<EOM
18386Checking whether your strtouq() works okay...
18387EOM
18388 $cat >try.c <<'EOCP'
18389#include <errno.h>
18390#include <stdio.h>
613d6c3e 18391extern unsigned long long int strtouq(char *s, char **, int);
d0e6d399
NC
18392static int bad = 0;
18393void check(char *s, unsigned long long eull, int een) {
18394 unsigned long long gull;
18395 errno = 0;
18396 gull = strtouq(s, 0, 10);
18397 if (!((gull == eull) && (errno == een)))
18398 bad++;
18399}
18400int main() {
18401 check(" 1", 1LL, 0);
18402 check(" 0", 0LL, 0);
18403 check("18446744073709551615", 18446744073709551615ULL, 0);
18404 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 18405#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
18406 check("-1", 18446744073709551615ULL, 0);
18407 check("-18446744073709551614", 2LL, 0);
18408 check("-18446744073709551615", 1LL, 0);
18409 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18410 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 18411#endif
d0e6d399
NC
18412 if (!bad)
18413 printf("ok\n");
18414 return 0;
18415}
18416EOCP
18417 set try
18418 if eval $compile; then
5440bc8e 18419 case "`$run ./try`" in
d0e6d399
NC
18420 ok) echo "Your strtouq() seems to be working okay." ;;
18421 *) cat <<EOM >&4
18422Your strtouq() doesn't seem to be working okay.
18423EOM
18424 d_strtouq="$undef"
18425 ;;
18426 esac
9597a80f
NC
18427 else
18428 echo "(I can't seem to compile the test program--assuming it doesn't)"
18429 d_strtouq="$undef"
d0e6d399
NC
18430 fi
18431 ;;
18432esac
18433
b4eb6b3d
JH
18434: see if strxfrm exists
18435set strxfrm d_strxfrm
18436eval $inlibc
18437
18438: see if symlink exists
18439set symlink d_symlink
18440eval $inlibc
18441
18442: see if syscall exists
18443set syscall d_syscall
18444eval $inlibc
18445
2ef53570
JH
18446: see if prototype for syscall is available
18447echo " "
18448set d_syscallproto syscall $i_unistd unistd.h
18449eval $hasproto
18450
b4eb6b3d
JH
18451: see if sysconf exists
18452set sysconf d_sysconf
18453eval $inlibc
18454
18455: see if system exists
18456set system d_system
18457eval $inlibc
18458
18459: see if tcgetpgrp exists
18460set tcgetpgrp d_tcgetpgrp
18461eval $inlibc
18462
18463: see if tcsetpgrp exists
18464set tcsetpgrp d_tcsetpgrp
18465eval $inlibc
18466
18467: see if prototype for telldir is available
18468echo " "
18469set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18470eval $hasproto
18471
ad493445
MB
18472: see if time exists
18473echo " "
18474if test "X$d_time" = X -o X"$timetype" = X; then
18475 if set time val -f d_time; eval $csym; $val; then
18476 echo 'time() found.' >&4
18477 val="$define"
18478 rp="What is the type returned by time() on this system?"
18479 set time_t timetype long stdio.h sys/types.h
18480 eval $typedef_ask
18481 else
18482 echo 'time() not found, hope that will do.' >&4
18483 val="$undef"
18484 timetype='int';
18485 fi
18486 set d_time
18487 eval $setvar
18488fi
18489
cbb9e8a7
MB
18490: see if timegm exists
18491set timegm d_timegm
18492eval $inlibc
18493
b4eb6b3d
JH
18494: see if this is a sys/times.h system
18495set sys/times.h i_systimes
18496eval $inhdr
18497
18498: see if times exists
18499echo " "
18500if set times val -f d_times; eval $csym; $val; then
18501 echo 'times() found.' >&4
18502 d_times="$define"
18503 inc=''
18504 case "$i_systimes" in
18505 "$define") inc='sys/times.h';;
18506 esac
18507 rp="What is the type returned by times() on this system?"
18508 set clock_t clocktype long stdio.h sys/types.h $inc
18509 eval $typedef_ask
18510else
18511 echo 'times() NOT found, hope that will do.' >&4
18512 d_times="$undef"
18513 clocktype='int'
18514fi
18515
10bc17b6
JH
18516: see if tmpnam_r exists
18517set tmpnam_r d_tmpnam_r
18518eval $inlibc
18519case "$d_tmpnam_r" in
18520"$define")
31ee0cb7 18521 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
18522 case "$d_tmpnam_r_proto:$usethreads" in
18523 ":define") d_tmpnam_r_proto=define
a48ec845
JH
18524 set d_tmpnam_r_proto tmpnam_r $hdrs
18525 eval $hasproto ;;
18526 *) ;;
18527 esac
18528 case "$d_tmpnam_r_proto" in
18529 define)
10bc17b6
JH
18530 case "$tmpnam_r_proto" in
18531 ''|0) try='char* tmpnam_r(char*);'
61c26d18 18532 ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
10bc17b6
JH
18533 esac
18534 case "$tmpnam_r_proto" in
90e831dc 18535 ''|0) d_tmpnam_r=undef
10bc17b6 18536 tmpnam_r_proto=0
a48ec845 18537 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18538 * ) case "$tmpnam_r_proto" in
18539 REENTRANT_PROTO*) ;;
18540 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18541 esac
18542 echo "Prototype: $try" ;;
18543 esac
18544 ;;
c18e646a
JH
18545 *) case "$usethreads" in
18546 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18547 esac
90e831dc
SB
18548 d_tmpnam_r=undef
18549 tmpnam_r_proto=0
c18e646a 18550 ;;
a48ec845
JH
18551 esac
18552 ;;
10bc17b6
JH
18553*) tmpnam_r_proto=0
18554 ;;
18555esac
18556
b4eb6b3d
JH
18557: see if truncate exists
18558set truncate d_truncate
18559eval $inlibc
18560
10bc17b6
JH
18561: see if ttyname_r exists
18562set ttyname_r d_ttyname_r
18563eval $inlibc
18564case "$d_ttyname_r" in
18565"$define")
18566 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
18567 case "$d_ttyname_r_proto:$usethreads" in
18568 ":define") d_ttyname_r_proto=define
a48ec845
JH
18569 set d_ttyname_r_proto ttyname_r $hdrs
18570 eval $hasproto ;;
18571 *) ;;
18572 esac
18573 case "$d_ttyname_r_proto" in
18574 define)
10bc17b6
JH
18575 case "$ttyname_r_proto" in
18576 ''|0) try='int ttyname_r(int, char*, size_t);'
61c26d18 18577 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
10bc17b6
JH
18578 esac
18579 case "$ttyname_r_proto" in
18580 ''|0) try='int ttyname_r(int, char*, int);'
61c26d18 18581 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
10bc17b6
JH
18582 esac
18583 case "$ttyname_r_proto" in
18584 ''|0) try='char* ttyname_r(int, char*, int);'
61c26d18 18585 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
10bc17b6
JH
18586 esac
18587 case "$ttyname_r_proto" in
90e831dc 18588 ''|0) d_ttyname_r=undef
10bc17b6 18589 ttyname_r_proto=0
a48ec845 18590 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18591 * ) case "$ttyname_r_proto" in
18592 REENTRANT_PROTO*) ;;
18593 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18594 esac
18595 echo "Prototype: $try" ;;
18596 esac
18597 ;;
c18e646a
JH
18598 *) case "$usethreads" in
18599 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18600 esac
90e831dc
SB
18601 d_ttyname_r=undef
18602 ttyname_r_proto=0
c18e646a 18603 ;;
a48ec845
JH
18604 esac
18605 ;;
10bc17b6
JH
18606*) ttyname_r_proto=0
18607 ;;
18608esac
18609
b4eb6b3d
JH
18610: see if tzname[] exists
18611echo " "
18612if set tzname val -a d_tzname; eval $csym; $val; then
18613 val="$define"
18614 echo 'tzname[] found.' >&4
18615else
18616 val="$undef"
18617 echo 'tzname[] NOT found.' >&4
18618fi
18619set d_tzname
18620eval $setvar
18621
613d6c3e 18622: Check if is a multiplatform env
4e0554ec
JH
18623case "$osname" in
18624next|rhapsody|darwin) multiarch="$define" ;;
18625esac
18626case "$multiarch" in
18627''|[nN]*) multiarch="$undef" ;;
18628esac
18629
24412007 18630: check for ordering of bytes in a UV
4e0554ec 18631echo " "
5440bc8e 18632case "$usecrosscompile$multiarch" in
4e0554ec
JH
18633*$define*)
18634 $cat <<EOM
18635You seem to be either cross-compiling or doing a multiarchitecture build,
18636skipping the byteorder check.
18637
18638EOM
5440bc8e 18639 byteorder='ffff'
4e0554ec
JH
18640 ;;
18641*)
18642 case "$byteorder" in
18643 '')
18644 $cat <<'EOM'
18645In the following, larger digits indicate more significance. A big-endian
18646machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18647little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18648machines may have weird orders like 3412. A Cray will report 87654321,
18649an Alpha will report 12345678. If the test program works the default is
18650probably right.
18651I'm now running the test program...
18652EOM
24412007 18653 $cat >try.c <<EOCP
4e0554ec 18654#include <stdio.h>
55954f19
JH
18655#$i_stdlib I_STDLIB
18656#ifdef I_STDLIB
18657#include <stdlib.h>
18658#endif
24412007
JH
18659#include <sys/types.h>
18660typedef $uvtype UV;
4e0554ec
JH
18661int main()
18662{
18663 int i;
18664 union {
24412007
JH
18665 UV l;
18666 char c[$uvsize];
4e0554ec
JH
18667 } u;
18668
24412007 18669 if ($uvsize > 4)
b5ded3e5 18670 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 18671 else
a4c53327 18672 u.l = (UV)0x04030201;
24412007 18673 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
18674 printf("%c", u.c[i]+'0');
18675 printf("\n");
18676 exit(0);
18677}
18678EOCP
18679 xxx_prompt=y
18680 set try
43dddb59 18681 if eval $compile && $run ./try > /dev/null; then
5440bc8e 18682 dflt=`$run ./try`
4e0554ec
JH
18683 case "$dflt" in
18684 [1-4][1-4][1-4][1-4]|12345678|87654321)
18685 echo "(The test program ran ok.)"
18686 echo "byteorder=$dflt"
18687 xxx_prompt=n
18688 ;;
18689 ????|????????) echo "(The test program ran ok.)" ;;
18690 *) echo "(The test program didn't run right for some reason.)" ;;
18691 esac
18692 else
18693 dflt='4321'
18694 cat <<'EOM'
18695(I can't seem to compile the test program. Guessing big-endian...)
18696EOM
18697 fi
18698 case "$xxx_prompt" in
18699 y)
24412007 18700 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
18701 . ./myread
18702 byteorder="$ans"
18703 ;;
18704 *) byteorder=$dflt
18705 ;;
18706 esac
18707 ;;
18708 esac
5b813a60 18709 $rm_try
4e0554ec
JH
18710 ;;
18711esac
18712
cd95ead5 18713: Checking 32bit alignedness
4e0554ec
JH
18714$cat <<EOM
18715
18716Checking to see whether you can access character data unalignedly...
18717EOM
dc7b0a4f
JH
18718case "$d_u32align" in
18719'') $cat >try.c <<EOCP
4e0554ec 18720#include <stdio.h>
d1daaddf
JH
18721#$i_stdlib I_STDLIB
18722#ifdef I_STDLIB
18723#include <stdlib.h>
18724#endif
4e0554ec 18725#define U32 $u32type
d308175a
JH
18726#define BYTEORDER 0x$byteorder
18727#define U8 $u8type
9958dc3c
JH
18728#include <signal.h>
18729#ifdef SIGBUS
7090f861 18730$signal_t bletch(int s) { exit(4); }
9958dc3c 18731#endif
4e0554ec
JH
18732int main() {
18733#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
f1c7503b
MB
18734 volatile U8 buf[8];
18735 volatile U32 *up;
4e0554ec
JH
18736 int i;
18737
18738 if (sizeof(U32) != 4) {
18739 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18740 exit(1);
18741 }
18742
18743 fflush(stdout);
18744
9958dc3c
JH
18745#ifdef SIGBUS
18746 signal(SIGBUS, bletch);
18747#endif
18748
8906a23e
JH
18749 buf[0] = 0;
18750 buf[1] = 0;
18751 buf[2] = 0;
18752 buf[3] = 1;
7eac3fd6 18753 buf[4] = 0;
8906a23e
JH
18754 buf[5] = 0;
18755 buf[6] = 0;
7eac3fd6 18756 buf[7] = 1;
8906a23e 18757
4e0554ec
JH
18758 for (i = 0; i < 4; i++) {
18759 up = (U32*)(buf + i);
18760 if (! ((*up == 1 << (8*i)) || /* big-endian */
18761 (*up == 1 << (8*(3-i))) /* little-endian */
18762 )
18763 )
18764 {
18765 printf("read failed (%x)\n", *up);
18766 exit(2);
18767 }
18768 }
18769
18770 /* write test */
18771 for (i = 0; i < 4; i++) {
18772 up = (U32*)(buf + i);
18773 *up = 0xBeef;
18774 if (*up != 0xBeef) {
18775 printf("write failed (%x)\n", *up);
18776 exit(3);
18777 }
18778 }
18779
18780 exit(0);
18781#else
18782 printf("1\n");
18783 exit(1);
18784#endif
18785 return 0;
18786}
18787EOCP
18788set try
18789if eval $compile_ok; then
d308175a 18790 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 18791 $run ./try 2>&1 >/dev/null
4e0554ec
JH
18792 case "$?" in
18793 0) cat >&4 <<EOM
18794You can access character data pretty unalignedly.
18795EOM
18796 d_u32align="$undef"
18797 ;;
18798 *) cat >&4 <<EOM
18799It seems that you must access character data in an aligned manner.
18800EOM
18801 d_u32align="$define"
18802 ;;
18803 esac
4e0554ec
JH
18804else
18805 rp='Can you access character data at unaligned addresses?'
18806 dflt='n'
18807 . ./myread
18808 case "$ans" in
18809 [yY]*) d_u32align="$undef" ;;
18810 *) d_u32align="$define" ;;
18811 esac
18812fi
5b813a60 18813$rm_try
dc7b0a4f
JH
18814;;
18815esac
4e0554ec
JH
18816
18817: see if ualarm exists
18818set ualarm d_ualarm
18819eval $inlibc
18820
b4eb6b3d
JH
18821: see if umask exists
18822set umask d_umask
18823eval $inlibc
18824
758a5d79
JH
18825: see if unordered exists
18826set unordered d_unordered
18827eval $inlibc
18828
bdf33aa7
SP
18829: see if unsetenv exists
18830set unsetenv d_unsetenv
18831eval $inlibc
18832
4e0554ec
JH
18833: see if usleep exists
18834set usleep d_usleep
18835eval $inlibc
18836
2ef53570
JH
18837: see if prototype for usleep is available
18838echo " "
18839set d_usleepproto usleep $i_unistd unistd.h
18840eval $hasproto
18841
b4eb6b3d
JH
18842: see if ustat exists
18843set ustat d_ustat
18844eval $inlibc
18845
b4eb6b3d
JH
18846: see if closedir exists
18847set closedir d_closedir
18848eval $inlibc
18849
18850case "$d_closedir" in
18851"$define")
18852 echo " "
18853 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 18854 cat > try.c <<EOM
b4eb6b3d
JH
18855#$i_dirent I_DIRENT /**/
18856#$i_sysdir I_SYS_DIR /**/
18857#$i_sysndir I_SYS_NDIR /**/
18858#$i_systypes I_SYS_TYPES /**/
18859
18860#if defined(I_SYS_TYPES)
18861#include <sys/types.h>
18862#endif
18863#if defined(I_DIRENT)
18864#include <dirent.h>
18865#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18866#include <sys/dir.h>
18867#endif
18868#else
18869#ifdef I_SYS_NDIR
18870#include <sys/ndir.h>
18871#else
18872#ifdef I_SYS_DIR
18873#ifdef hp9000s500
18874#include <ndir.h> /* may be wrong in the future */
18875#else
18876#include <sys/dir.h>
18877#endif
18878#endif
18879#endif
5b813a60 18880#endif
b4eb6b3d
JH
18881int main() { return closedir(opendir(".")); }
18882EOM
5440bc8e 18883 set try
b4eb6b3d 18884 if eval $compile_ok; then
5440bc8e 18885 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
18886 echo "Yes, it does."
18887 val="$undef"
18888 else
18889 echo "No, it doesn't."
18890 val="$define"
18891 fi
18892 else
18893 echo "(I can't seem to compile the test program--assuming it doesn't)"
18894 val="$define"
18895 fi
18896 ;;
18897*)
18898 val="$undef";
18899 ;;
18900esac
18901set d_void_closedir
18902eval $setvar
5b813a60
MB
18903$rm_try
18904
b4eb6b3d
JH
18905: see if there is a wait4
18906set wait4 d_wait4
18907eval $inlibc
18908
18909: see if waitpid exists
18910set waitpid d_waitpid
18911eval $inlibc
18912
18913: see if wcstombs exists
18914set wcstombs d_wcstombs
18915eval $inlibc
18916
18917: see if wctomb exists
18918set wctomb d_wctomb
18919eval $inlibc
18920
4e0554ec
JH
18921: see if writev exists
18922set writev d_writev
18923eval $inlibc
18924
b4eb6b3d
JH
18925: preserve RCS keywords in files with variable substitution, grrr
18926Date='$Date'
18927Id='$Id'
18928Log='$Log'
18929RCSfile='$RCSfile'
18930Revision='$Revision'
18931
b4eb6b3d
JH
18932: check for alignment requirements
18933echo " "
5440bc8e 18934case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
18935*$define*)
18936 $cat <<EOM
18937You seem to be either cross-compiling or doing a multiarchitecture build,
18938skipping the memory alignment check.
18939
18940EOM
18941 case "$alignbytes" in
18942 '') alignbytes=8 ;;
18943 esac
18944 ;;
18945*)
18946 case "$alignbytes" in
18947 '') echo "Checking alignment constraints..." >&4
18948 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18949 $cat >try.c <<'EOCP'
18950typedef long double NV;
18951EOCP
18952 else
18953 $cat >try.c <<'EOCP'
18954typedef double NV;
18955EOCP
18956 fi
18957 $cat >>try.c <<'EOCP'
18958#include <stdio.h>
18959struct foobar {
18960 char foo;
18961 NV bar;
18962} try_algn;
18963int main()
18964{
18965 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18966 return(0);
18967}
18968EOCP
18969 set try
18970 if eval $compile_ok; then
5440bc8e 18971 dflt=`$run ./try`
b4eb6b3d
JH
18972 else
18973 dflt='8'
18974 echo "(I can't seem to compile the test program...)"
18975 fi
18976 ;;
18977 *) dflt="$alignbytes"
18978 ;;
18979 esac
18980 rp="Doubles must be aligned on a how-many-byte boundary?"
18981 . ./myread
18982 alignbytes="$ans"
5b813a60 18983 $rm_try
b4eb6b3d
JH
18984 ;;
18985esac
18986
18987
18988: set the base revision
18989baserev=5.0
18990
89c1d914
MB
18991: length of character in bytes. Is always 1, otherwise it isnt C
18992: This used to be a test using sizeof
18993charsize=1
c193ef60
MB
18994
18995: Check for the number of bits in a character
18996case "$charbits" in
18997'') echo "Checking how long a character is (in bits)..." >&4
18998 $cat >try.c <<EOCP
18999#include <stdio.h>
19000int main ()
19001{
19002 int n;
19003 unsigned char c;
19004 for (c = 1, n = 0; c; c <<= 1, n++) ;
19005 printf ("%d\n", n);
19006 return (0);
19007 }
19008EOCP
19009 set try
19010 if eval $compile_ok; then
19011 dflt=`$run ./try`
19012 else
19013 dflt='8'
19014 echo "(I can't seem to compile the test program. Guessing...)"
19015 fi
19016 ;;
19017*)
19018 dflt="$charbits"
19019 ;;
19020esac
19021rp="What is the length of a character (in bits)?"
19022. ./myread
19023charbits="$ans"
19024$rm_try
19025case "$charbits" in
190268) ;;
19027*) cat >&4 << EOM
19028Your system has an unsigned character size of $charbits bits, which
19029is rather unusual (normally it is 8 bits). Perl likely will not work
19030correctly on your system, with subtle bugs in various places.
19031EOM
19032 rp='Do you really want to continue?'
19033 dflt='n'
19034 . ./myread
19035 case "$ans" in
19036 [yY]) echo >&4 "Okay, continuing." ;;
19037 *) exit 1 ;;
19038 esac
19039esac
19040
3099fc99 19041: how do we concatenate cpp tokens here?
b4eb6b3d 19042echo " "
3099fc99 19043echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
19044$cat >cpp_stuff.c <<'EOCP'
19045#define RCAT(a,b)a/**/b
19046#define ACAT(a,b)a ## b
19047RCAT(Rei,ser)
19048ACAT(Cir,cus)
19049EOCP
19050$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19051if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19052 echo "Oh! Smells like ANSI's been here." >&4
19053 echo "We can catify or stringify, separately or together!"
19054 cpp_stuff=42
19055elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19056 echo "Ah, yes! The good old days!" >&4
19057 echo "However, in the good old days we don't know how to stringify and"
19058 echo "catify at the same time."
19059 cpp_stuff=1
19060else
19061 $cat >&4 <<EOM
3099fc99
CW
19062Hmm, I don't seem to be able to concatenate tokens with your cpp.
19063You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
19064EOM
19065 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19066fi
19067$rm -f cpp_stuff.*
19068
19069: see if this is a db.h system
19070set db.h i_db
19071eval $inhdr
19072
19073case "$i_db" in
19074$define)
19075 : Check db version.
19076 echo " "
19077 echo "Checking Berkeley DB version ..." >&4
19078 $cat >try.c <<EOCP
19079#$d_const HASCONST
19080#ifndef HASCONST
19081#define const
19082#endif
19083#include <sys/types.h>
19084#include <stdio.h>
55954f19
JH
19085#$i_stdlib I_STDLIB
19086#ifdef I_STDLIB
19087#include <stdlib.h>
19088#endif
b4eb6b3d 19089#include <db.h>
640374d0 19090int main(int argc, char *argv[])
b4eb6b3d
JH
19091{
19092#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19093 int Major, Minor, Patch ;
19094 unsigned long Version ;
19095 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
19096 if (argc == 2) {
19097 printf("%d %d %d %d %d %d\n",
19098 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19099 Major, Minor, Patch);
19100 exit(0);
19101 }
19102 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
19103
19104 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19105 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19106 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19107 Major, Minor, Patch) ;
19108
19109 /* check that db.h & libdb are compatible */
19110 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 19111 printf("db.h and libdb are incompatible.\n") ;
5b813a60 19112 exit(3);
b4eb6b3d
JH
19113 }
19114
640374d0 19115 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
19116
19117 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19118 + DB_VERSION_PATCH ;
19119
19120 /* needs to be >= 2.3.4 */
19121 if (Version < 2003004) {
19122 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 19123 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
5b813a60 19124 exit(2);
b4eb6b3d
JH
19125 }
19126
19127 exit(0);
19128#else
19129#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
19130 if (argc == 2) {
19131 printf("1 0 0\n");
19132 exit(0);
19133 }
19134 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
19135 exit(0); /* DB version < 2: the coast is clear. */
19136#else
19137 exit(1); /* <db.h> not Berkeley DB? */
19138#endif
19139#endif
19140}
19141EOCP
19142 set try
5440bc8e 19143 if eval $compile_ok && $run ./try; then
b4eb6b3d 19144 echo 'Looks OK.' >&4
5440bc8e 19145 set `$run ./try 1`
640374d0
JH
19146 db_version_major=$1
19147 db_version_minor=$2
19148 db_version_patch=$3
b4eb6b3d
JH
19149 else
19150 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
19151 i_db=$undef
19152 case " $libs " in
19153 *"-ldb "*)
19154 : Remove db from list of libraries to use
19155 echo "Removing unusable -ldb from library list" >&4
19156 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19157 shift
19158 libs="$*"
19159 echo "libs = $libs" >&4
19160 ;;
19161 esac
19162 fi
5b813a60 19163 $rm_try
b4eb6b3d
JH
19164 ;;
19165esac
19166
19167case "$i_db" in
19168define)
5b813a60 19169 : Check the return type needed for hash
b4eb6b3d
JH
19170 echo " "
19171 echo "Checking return type needed for hash for Berkeley DB ..." >&4
19172 $cat >try.c <<EOCP
19173#$d_const HASCONST
19174#ifndef HASCONST
19175#define const
19176#endif
19177#include <sys/types.h>
19178#include <db.h>
19179
19180#ifndef DB_VERSION_MAJOR
19181u_int32_t hash_cb (ptr, size)
19182const void *ptr;
19183size_t size;
19184{
19185}
19186HASHINFO info;
19187int main()
19188{
19189 info.hash = hash_cb;
19190}
19191#endif
19192EOCP
19193 if $cc $ccflags -c try.c >try.out 2>&1 ; then
19194 if $contains warning try.out >>/dev/null 2>&1 ; then
19195 db_hashtype='int'
19196 else
19197 db_hashtype='u_int32_t'
19198 fi
19199 else
19200 : XXX Maybe we should just give up here.
19201 db_hashtype=u_int32_t
19202 $cat try.out >&4
19203 echo "Help: I can't seem to compile the db test program." >&4
19204 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19205 fi
5b813a60 19206 $rm_try
b4eb6b3d
JH
19207 echo "Your version of Berkeley DB uses $db_hashtype for hash."
19208 ;;
19209*) db_hashtype=u_int32_t
19210 ;;
19211esac
19212case "$i_db" in
19213define)
5b813a60 19214 : Check the return type needed for prefix
b4eb6b3d
JH
19215 echo " "
19216 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19217 cat >try.c <<EOCP
19218#$d_const HASCONST
19219#ifndef HASCONST
19220#define const
19221#endif
19222#include <sys/types.h>
19223#include <db.h>
19224
19225#ifndef DB_VERSION_MAJOR
19226size_t prefix_cb (key1, key2)
19227const DBT *key1;
19228const DBT *key2;
19229{
19230}
19231BTREEINFO info;
19232int main()
19233{
19234 info.prefix = prefix_cb;
19235}
19236#endif
19237EOCP
19238 if $cc $ccflags -c try.c >try.out 2>&1 ; then
19239 if $contains warning try.out >>/dev/null 2>&1 ; then
19240 db_prefixtype='int'
19241 else
19242 db_prefixtype='size_t'
19243 fi
19244 else
19245 db_prefixtype='size_t'
19246 : XXX Maybe we should just give up here.
19247 $cat try.out >&4
19248 echo "Help: I can't seem to compile the db test program." >&4
19249 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19250 fi
5b813a60 19251 $rm_try
b4eb6b3d
JH
19252 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19253 ;;
19254*) db_prefixtype='size_t'
19255 ;;
19256esac
19257
b4eb6b3d
JH
19258: How can we generate normalized random numbers ?
19259echo " "
19260echo "Looking for a random number function..." >&4
19261case "$randfunc" in
19262'')
19263 if set drand48 val -f; eval $csym; $val; then
19264 dflt="drand48"
19265 echo "Good, found drand48()." >&4
19266 elif set random val -f; eval $csym; $val; then
19267 dflt="random"
19268 echo "OK, found random()." >&4
19269 else
19270 dflt="rand"
19271 echo "Yick, looks like I have to use rand()." >&4
19272 fi
19273 echo " "
19274 ;;
19275*)
19276 dflt="$randfunc"
19277 ;;
19278esac
19279cont=true
19280
19281case "$ccflags" in
19282*-Dmy_rand=*|*-Dmy_srand=*)
19283 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19284 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19285 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19286 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19287 ;;
19288esac
19289
19290while $test "$cont"; do
19291 rp="Use which function to generate random numbers?"
19292 . ./myread
19293 if $test "$ans" = "$dflt"; then
19294 : null
19295 else
19296 randbits=''
19297 fi
19298 randfunc="$ans"
19299 if set $ans val -f; eval $csym; $val; then
19300 cont=''
19301 else
19302 dflt=y
19303 rp="I cannot find function $ans. Use that name anyway?"
19304 . ./myread
19305 dflt=rand
19306 case "$ans" in
19307 [yY]*) cont='';;
19308 esac
19309 fi
19310 case "$cont" in
19311 '')
19312 case "$randfunc" in
19313 drand48)
19314 drand01="drand48()"
19315 seedfunc="srand48"
19316 randbits=48
19317 randseedtype=long
19318 ;;
19319 rand|random)
19320 case "$randbits" in
19321 '')
19322echo "Checking to see how many bits your $randfunc() function produces..." >&4
19323 $cat >try.c <<EOCP
19324#$i_unistd I_UNISTD
19325#$i_stdlib I_STDLIB
19326#include <stdio.h>
19327#ifdef I_UNISTD
19328# include <unistd.h>
19329#endif
19330#ifdef I_STDLIB
19331# include <stdlib.h>
19332#endif
19333int main()
19334{
19335 register int i;
19336 register unsigned long tmp;
19337 register unsigned long max = 0L;
19338
19339 for (i = 1000; i; i--) {
19340 tmp = (unsigned long) $randfunc();
19341 if (tmp > max) max = tmp;
19342 }
19343 for (i = 0; max; i++)
19344 max /= 2;
19345 printf("%d\n",i);
19346}
19347EOCP
19348 set try
19349 if eval $compile_ok; then
19350 dflt=`try`
19351 else
19352 dflt='?'
19353 echo "(I can't seem to compile the test program...)"
19354 fi
19355 ;;
19356 *)
19357 dflt="$randbits"
19358 ;;
19359 esac
19360 rp="How many bits does your $randfunc() function produce?"
19361 . ./myread
19362 randbits="$ans"
5b813a60 19363 $rm_try
b4eb6b3d
JH
19364 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19365 seedfunc="s$randfunc"
19366 randseedtype=unsigned
19367 ;;
19368 *)
19369 dflt="31"
19370 rp="How many bits does your $randfunc() function produce?"
19371 . ./myread
19372 randbits="$ans"
19373 seedfunc="s$randfunc"
19374 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19375 if set $seedfunc val -f; eval $csym; $val; then
19376 echo "(Using $seedfunc() to seed random generator)"
19377 else
19378 echo "(Warning: no $seedfunc() to seed random generator)"
19379 seedfunc=rand
19380 fi
19381 randseedtype=unsigned
19382 ;;
19383 esac
19384 ;;
19385 esac
19386done
19387
613d6c3e 19388: Determine if this is an EBCDIC system
b4eb6b3d
JH
19389echo " "
19390echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 19391$cat >try.c <<'EOM'
b4eb6b3d
JH
19392int main()
19393{
19394 if ('M'==0xd4) return 0;
19395 return 1;
19396}
19397EOM
19398
19399val=$undef
5440bc8e 19400set try
b4eb6b3d 19401if eval $compile_ok; then
5440bc8e 19402 if $run ./try; then
b4eb6b3d
JH
19403 echo "You seem to speak EBCDIC." >&4
19404 val="$define"
19405 else
5440bc8e 19406 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
19407 fi
19408else
19409 echo "I'm unable to compile the test program." >&4
19410 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19411fi
5b813a60 19412$rm_try
b4eb6b3d
JH
19413set ebcdic
19414eval $setvar
19415
613d6c3e 19416: Check how to flush
b4eb6b3d
JH
19417echo " "
19418$cat >&4 <<EOM
19419Checking how to flush all pending stdio output...
19420EOM
19421# I only know how to find the first 32 possibly open files on SunOS.
19422# See also hints/sunos_4_1.sh and util.c --AD
19423case "$osname" in
19424sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19425esac
19426$cat >>try.c <<EOCP
19427#include <stdio.h>
55954f19
JH
19428#$i_stdlib I_STDLIB
19429#ifdef I_STDLIB
19430#include <stdlib.h>
19431#endif
b4eb6b3d
JH
19432#$i_unistd I_UNISTD
19433#ifdef I_UNISTD
19434# include <unistd.h>
19435#endif
19436#$d_sysconf HAS_SYSCONF
19437#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19438#ifdef HAS_STDIO_STREAM_ARRAY
19439# define STDIO_STREAM_ARRAY $stdio_stream_array
19440#endif
19441int main() {
5440bc8e
JH
19442 FILE* p;
19443 unlink("try.out");
19444 p = fopen("try.out", "w");
b4eb6b3d
JH
19445#ifdef TRY_FPUTC
19446 fputc('x', p);
19447#else
19448# ifdef TRY_FPRINTF
19449 fprintf(p, "x");
19450# endif
19451#endif
19452#ifdef TRY_FFLUSH_NULL
19453 fflush(NULL);
19454#endif
19455#ifdef TRY_FFLUSH_ALL
19456 {
19457 long open_max = -1;
19458# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19459 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19460# else
19461# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19462 open_max = sysconf(_SC_OPEN_MAX);
19463# else
19464# ifdef FOPEN_MAX
19465 open_max = FOPEN_MAX;
19466# else
19467# ifdef OPEN_MAX
19468 open_max = OPEN_MAX;
19469# else
19470# ifdef _NFILE
19471 open_max = _NFILE;
19472# endif
19473# endif
19474# endif
19475# endif
5b813a60 19476# endif
b4eb6b3d
JH
19477# ifdef HAS_STDIO_STREAM_ARRAY
19478 if (open_max > 0) {
19479 long i;
19480 for (i = 0; i < open_max; i++)
19481 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19482 STDIO_STREAM_ARRAY[i]._file < open_max &&
19483 STDIO_STREAM_ARRAY[i]._flag)
19484 fflush(&STDIO_STREAM_ARRAY[i]);
5b813a60 19485 }
b4eb6b3d
JH
19486 }
19487# endif
19488#endif
19489 _exit(42);
19490}
19491EOCP
19492: first we have to find out how _not_ to flush
5440bc8e 19493$to try.c
b4eb6b3d
JH
19494if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19495 output=''
19496 set try -DTRY_FPUTC
19497 if eval $compile; then
fbe73d74 19498 $run ./try 2>/dev/null
28f5ac64 19499 code="$?"
5440bc8e 19500 $from try.out
28f5ac64 19501 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19502 output=-DTRY_FPUTC
19503 fi
19504 fi
19505 case "$output" in
19506 '')
19507 set try -DTRY_FPRINTF
b4eb6b3d 19508 if eval $compile; then
fbe73d74 19509 $run ./try 2>/dev/null
28f5ac64 19510 code="$?"
5440bc8e 19511 $from try.out
28f5ac64 19512 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19513 output=-DTRY_FPRINTF
19514 fi
19515 fi
19516 ;;
19517 esac
19518fi
19519: check for fflush NULL behaviour
19520case "$fflushNULL" in
19521'') set try -DTRY_FFLUSH_NULL $output
19522 if eval $compile; then
5440bc8e 19523 $run ./try 2>/dev/null
b4eb6b3d 19524 code="$?"
5440bc8e 19525 $from try.out
b4eb6b3d
JH
19526 if $test -s try.out -a "X$code" = X42; then
19527 fflushNULL="`$cat try.out`"
19528 else
19529 if $test "X$code" != X42; then
19530 $cat >&4 <<EOM
19531(If this test failed, don't worry, we'll try another method shortly.)
19532EOM
19533 fi
19534 fi
19535 fi
2c476adc 19536 $rm -f core try.core core.try.*
b4eb6b3d
JH
19537 case "$fflushNULL" in
19538 x) $cat >&4 <<EOM
19539Your fflush(NULL) works okay for output streams.
19540Let's see if it clobbers input pipes...
19541EOM
19542# As of mid-March 2000 all versions of Solaris appear to have a stdio
19543# bug that improperly flushes the input end of pipes. So we avoid the
19544# autoflush on fork/system/exec support for now. :-(
19545$cat >tryp.c <<EOCP
19546#include <stdio.h>
19547int
19548main(int argc, char **argv)
19549{
19550 char buf[1024];
19551 int i;
19552 char *bp = buf;
19553 while (1) {
19554 while ((i = getc(stdin)) != -1
19555 && (*bp++ = i) != '\n'
19556 && bp < &buf[1024])
19557 /* DO NOTHING */ ;
19558 *bp = '\0';
19559 fprintf(stdout, "%s", buf);
19560 fflush(NULL);
19561 if (i == -1)
19562 return 0;
19563 bp = buf;
19564 }
19565}
19566EOCP
19567 fflushNULL="$define"
19568 set tryp
19569 if eval $compile; then
19570 $rm -f tryp.out
5440bc8e 19571 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
19572 if cmp tryp.c tryp.out >/dev/null 2>&1; then
19573 $cat >&4 <<EOM
19574fflush(NULL) seems to behave okay with input streams.
19575EOM
19576 fflushNULL="$define"
19577 else
19578 $cat >&4 <<EOM
19579Ouch, fflush(NULL) clobbers input pipes! We will not use it.
19580EOM
19581 fflushNULL="$undef"
19582 fi
19583 fi
19584 $rm -f core tryp.c tryp.core core.tryp.*
19585 ;;
19586 '') $cat >&4 <<EOM
19587Your fflush(NULL) isn't working (contrary to ANSI C).
19588EOM
19589 fflushNULL="$undef"
19590 ;;
19591 *) $cat >&4 <<EOM
19592Cannot figure out whether your fflush(NULL) works or not.
19593I'm assuming it doesn't (contrary to ANSI C).
19594EOM
19595 fflushNULL="$undef"
19596 ;;
19597 esac
19598 ;;
19599$define|true|[yY]*)
19600 fflushNULL="$define"
19601 ;;
19602*)
19603 fflushNULL="$undef"
19604 ;;
19605esac
19606: check explicit looping only if NULL did not work, and if the pipe
19607: bug does not show up on an explicit flush too
19608case "$fflushNULL" in
19609"$undef")
19610 $cat >tryp.c <<EOCP
19611#include <stdio.h>
19612int
19613main(int argc, char **argv)
19614{
19615 char buf[1024];
19616 int i;
19617 char *bp = buf;
19618 while (1) {
19619 while ((i = getc(stdin)) != -1
19620 && (*bp++ = i) != '\n'
19621 && bp < &buf[1024])
19622 /* DO NOTHING */ ;
19623 *bp = '\0';
19624 fprintf(stdout, "%s", buf);
19625 fflush(stdin);
19626 if (i == -1)
19627 return 0;
19628 bp = buf;
19629 }
19630}
19631EOCP
19632 set tryp
19633 if eval $compile; then
19634 $rm -f tryp.out
5440bc8e 19635 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
19636 if cmp tryp.c tryp.out >/dev/null 2>&1; then
19637 $cat >&4 <<EOM
19638Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19639EOM
19640 : now check for fflushall behaviour
19641 case "$fflushall" in
19642 '') set try -DTRY_FFLUSH_ALL $output
19643 if eval $compile; then
19644 $cat >&4 <<EOM
19645(Now testing the other method--but note that this also may fail.)
19646EOM
5440bc8e 19647 $run ./try 2>/dev/null
28f5ac64 19648 code=$?
fbe73d74 19649 $from try.out
28f5ac64 19650 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19651 fflushall="`$cat try.out`"
19652 fi
19653 fi
5b813a60 19654 $rm_try
b4eb6b3d
JH
19655 case "$fflushall" in
19656 x) $cat >&4 <<EOM
19657Whew. Flushing explicitly all the stdio streams works.
19658EOM
19659 fflushall="$define"
19660 ;;
19661 '') $cat >&4 <<EOM
19662Sigh. Flushing explicitly all the stdio streams doesn't work.
19663EOM
19664 fflushall="$undef"
19665 ;;
19666 *) $cat >&4 <<EOM
19667Cannot figure out whether flushing stdio streams explicitly works or not.
19668I'm assuming it doesn't.
19669EOM
19670 fflushall="$undef"
19671 ;;
19672 esac
19673 ;;
19674 "$define"|true|[yY]*)
19675 fflushall="$define"
19676 ;;
19677 *)
19678 fflushall="$undef"
19679 ;;
19680 esac
19681 else
19682 $cat >&4 <<EOM
19683All is futile. Even fflush(stdin) clobbers input pipes!
19684EOM
19685 fflushall="$undef"
19686 fi
19687 else
19688 fflushall="$undef"
19689 fi
19690 $rm -f core tryp.c tryp.core core.tryp.*
19691 ;;
19692*) fflushall="$undef"
19693 ;;
19694esac
19695
19696case "$fflushNULL$fflushall" in
19697undefundef)
19698 $cat <<EOM
19699OK, I give up. I cannot figure out how to flush pending stdio output.
19700We won't be flushing handles at all before fork/exec/popen.
19701EOM
19702 ;;
19703esac
34f1896b 19704$rm_try tryp
b4eb6b3d
JH
19705
19706: Store the full pathname to the ar program for use in the C program
19707: Respect a hint or command line value for full_ar.
19708case "$full_ar" in
19709'') full_ar=$ar ;;
19710esac
19711
19712: Store the full pathname to the sed program for use in the C program
19713full_sed=$sed
19714
19715: see what type gids are declared as in the kernel
19716echo " "
19717echo "Looking for the type for group ids returned by getgid()."
19718set gid_t gidtype xxx stdio.h sys/types.h
19719eval $typedef
19720case "$gidtype" in
19721xxx)
19722 xxx=`./findhdr sys/user.h`
19723 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19724 case $1 in
19725 unsigned) dflt="$1 $2" ;;
19726 *) dflt="$1" ;;
19727 esac
19728 ;;
19729*) dflt="$gidtype";;
19730esac
19731case "$gidtype" in
19732gid_t) echo "gid_t found." ;;
19733*) rp="What is the type for group ids returned by getgid()?"
19734 . ./myread
19735 gidtype="$ans"
19736 ;;
19737esac
19738
613d6c3e 19739: Check the size of GID
b4eb6b3d
JH
19740echo " "
19741case "$gidtype" in
19742*_t) zzz="$gidtype" ;;
19743*) zzz="gid" ;;
19744esac
613d6c3e 19745echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
19746cat > try.c <<EOCP
19747#include <sys/types.h>
19748#include <stdio.h>
d1daaddf
JH
19749#$i_stdlib I_STDLIB
19750#ifdef I_STDLIB
19751#include <stdlib.h>
19752#endif
b4eb6b3d
JH
19753int main() {
19754 printf("%d\n", (int)sizeof($gidtype));
19755 exit(0);
19756}
19757EOCP
19758set try
19759if eval $compile_ok; then
5440bc8e 19760 yyy=`$run ./try`
b4eb6b3d
JH
19761 case "$yyy" in
19762 '') gidsize=4
19763 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19764 ;;
19765 *) gidsize=$yyy
19766 echo "Your $zzz is $gidsize bytes long."
19767 ;;
19768 esac
19769else
19770 gidsize=4
19771 echo "(I can't compile the test program--guessing $gidsize.)" >&4
19772fi
19773
19774
613d6c3e 19775: Check if GID is signed
b4eb6b3d
JH
19776echo " "
19777case "$gidtype" in
19778*_t) zzz="$gidtype" ;;
19779*) zzz="gid" ;;
19780esac
613d6c3e 19781echo "Checking the sign of $zzz..." >&4
b4eb6b3d
JH
19782cat > try.c <<EOCP
19783#include <sys/types.h>
19784#include <stdio.h>
19785int main() {
19786 $gidtype foo = -1;
19787 if (foo < 0)
19788 printf("-1\n");
19789 else
19790 printf("1\n");
19791}
19792EOCP
19793set try
19794if eval $compile; then
5440bc8e 19795 yyy=`$run ./try`
b4eb6b3d
JH
19796 case "$yyy" in
19797 '') gidsign=1
19798 echo "(I can't execute the test program--guessing unsigned.)" >&4
19799 ;;
19800 *) gidsign=$yyy
19801 case "$gidsign" in
19802 1) echo "Your $zzz is unsigned." ;;
19803 -1) echo "Your $zzz is signed." ;;
19804 esac
19805 ;;
19806 esac
19807else
19808 gidsign=1
19809 echo "(I can't compile the test program--guessing unsigned.)" >&4
19810fi
19811
19812
613d6c3e 19813: Check 64bit sizes
b4eb6b3d
JH
19814echo " "
19815
19816if $test X"$quadtype" != X; then
19817
19818echo "Checking how to print 64-bit integers..." >&4
19819
19820if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19821 $cat >try.c <<'EOCP'
19822#include <sys/types.h>
19823#include <stdio.h>
19824int main() {
19825 int q = 12345678901;
19826 printf("%ld\n", q);
19827}
19828EOCP
19829 set try
19830 if eval $compile; then
5440bc8e 19831 yyy=`$run ./try`
b4eb6b3d
JH
19832 case "$yyy" in
19833 12345678901)
19834 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19835 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19836 echo "We will use %d."
19837 ;;
19838 esac
19839 fi
19840fi
19841
19842if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19843 $cat >try.c <<'EOCP'
19844#include <sys/types.h>
19845#include <stdio.h>
19846int main() {
19847 long q = 12345678901;
19848 printf("%ld\n", q);
19849}
19850EOCP
19851 set try
19852 if eval $compile; then
5440bc8e 19853 yyy=`$run ./try`
b4eb6b3d
JH
19854 case "$yyy" in
19855 12345678901)
19856 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19857 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19858 echo "We will use %ld."
19859 ;;
19860 esac
19861 fi
19862fi
19863
19864if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19865 $cat >try.c <<'EOCP'
19866#include <sys/types.h>
19867#include <inttypes.h>
19868#include <stdio.h>
19869int main() {
19870 int64_t q = 12345678901;
19871 printf("%" PRId64 "\n", q);
19872}
19873EOCP
19874 set try
19875 if eval $compile; then
5440bc8e 19876 yyy=`$run ./try`
b4eb6b3d
JH
19877 case "$yyy" in
19878 12345678901)
19879 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19880 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19881 echo "We will use the C9X style."
19882 ;;
19883 esac
19884 fi
19885fi
19886
2ef53570
JH
19887if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19888 $cat >try.c <<EOCP
b4eb6b3d
JH
19889#include <sys/types.h>
19890#include <stdio.h>
19891int main() {
2ef53570
JH
19892 $quadtype q = 12345678901;
19893 printf("%Ld\n", q);
b4eb6b3d
JH
19894}
19895EOCP
19896 set try
19897 if eval $compile; then
5440bc8e 19898 yyy=`$run ./try`
b4eb6b3d
JH
19899 case "$yyy" in
19900 12345678901)
2ef53570
JH
19901 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19902 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19903 echo "We will use %Ld."
b4eb6b3d
JH
19904 ;;
19905 esac
19906 fi
19907fi
19908
2ef53570
JH
19909if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19910 $cat >try.c <<'EOCP'
b4eb6b3d
JH
19911#include <sys/types.h>
19912#include <stdio.h>
19913int main() {
2ef53570
JH
19914 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19915 printf("%lld\n", q);
b4eb6b3d
JH
19916}
19917EOCP
19918 set try
19919 if eval $compile; then
5440bc8e 19920 yyy=`$run ./try`
b4eb6b3d
JH
19921 case "$yyy" in
19922 12345678901)
2ef53570
JH
19923 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19924 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19925 echo "We will use the %lld style."
b4eb6b3d
JH
19926 ;;
19927 esac
19928 fi
19929fi
19930
19931if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19932 $cat >try.c <<EOCP
19933#include <sys/types.h>
19934#include <stdio.h>
19935int main() {
19936 $quadtype q = 12345678901;
19937 printf("%qd\n", q);
19938}
19939EOCP
19940 set try
19941 if eval $compile; then
5440bc8e 19942 yyy=`$run ./try`
b4eb6b3d
JH
19943 case "$yyy" in
19944 12345678901)
19945 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19946 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19947 echo "We will use %qd."
19948 ;;
19949 esac
19950 fi
19951fi
19952
19953if $test X"$sPRId64" = X; then
19954 echo "Cannot figure out how to print 64-bit integers." >&4
19955fi
5b813a60 19956$rm_try
b4eb6b3d
JH
19957
19958fi
19959
19960case "$sPRId64" in
5b813a60
MB
19961'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19962 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
b4eb6b3d 19963 ;;
5b813a60
MB
19964*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19965 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
b4eb6b3d
JH
19966 ;;
19967esac
19968
34f1896b 19969: Check format strings for internal types
b4eb6b3d
JH
19970echo " "
19971$echo "Checking the format strings to be used for Perl's internal types..." >&4
19972
19973if $test X"$ivsize" = X8; then
19974 ivdformat="$sPRId64"
19975 uvuformat="$sPRIu64"
19976 uvoformat="$sPRIo64"
19977 uvxformat="$sPRIx64"
19978 uvXUformat="$sPRIXU64"
19979else
19980 if $test X"$ivsize" = X"$longsize"; then
19981 ivdformat='"ld"'
19982 uvuformat='"lu"'
19983 uvoformat='"lo"'
19984 uvxformat='"lx"'
19985 uvXUformat='"lX"'
19986 else
19987 if $test X"$ivsize" = X"$intsize"; then
19988 ivdformat='"d"'
19989 uvuformat='"u"'
19990 uvoformat='"o"'
19991 uvxformat='"x"'
19992 uvXUformat='"X"'
19993 else
19994 : far out
19995 if $test X"$ivsize" = X"$shortsize"; then
19996 ivdformat='"hd"'
19997 uvuformat='"hu"'
19998 uvoformat='"ho"'
19999 uvxformat='"hx"'
20000 uvXUformat='"hX"'
20001 fi
20002 fi
20003 fi
20004fi
20005
20006if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20007 nveformat="$sPRIeldbl"
20008 nvfformat="$sPRIfldbl"
20009 nvgformat="$sPRIgldbl"
20010 nvEUformat="$sPRIEUldbl"
20011 nvFUformat="$sPRIFUldbl"
20012 nvGUformat="$sPRIGUldbl"
20013else
20014 nveformat='"e"'
20015 nvfformat='"f"'
20016 nvgformat='"g"'
20017 nvEUformat='"E"'
20018 nvFUformat='"F"'
20019 nvGUformat='"G"'
20020fi
20021
20022case "$ivdformat" in
3c728e00 20023'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
20024 exit 1
20025 ;;
20026esac
20027
34f1896b 20028: Check format string for GID
b4eb6b3d
JH
20029
20030echo " "
20031$echo "Checking the format string to be used for gids..." >&4
20032
20033case "$gidsign" in
20034-1) if $test X"$gidsize" = X"$ivsize"; then
20035 gidformat="$ivdformat"
20036 else
20037 if $test X"$gidsize" = X"$longsize"; then
20038 gidformat='"ld"'
20039 else
20040 if $test X"$gidsize" = X"$intsize"; then
20041 gidformat='"d"'
20042 else
20043 if $test X"$gidsize" = X"$shortsize"; then
20044 gidformat='"hd"'
20045 fi
20046 fi
20047 fi
20048 fi
20049 ;;
20050*) if $test X"$gidsize" = X"$uvsize"; then
20051 gidformat="$uvuformat"
20052 else
20053 if $test X"$gidsize" = X"$longsize"; then
20054 gidformat='"lu"'
20055 else
20056 if $test X"$gidsize" = X"$intsize"; then
20057 gidformat='"u"'
20058 else
20059 if $test X"$gidsize" = X"$shortsize"; then
20060 gidformat='"hu"'
20061 fi
20062 fi
20063 fi
20064 fi
20065 ;;
20066esac
20067
20068: see if getgroups exists
20069set getgroups d_getgrps
20070eval $inlibc
20071
20072: see if setgroups exists
20073set setgroups d_setgrps
20074eval $inlibc
20075
b4eb6b3d
JH
20076: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20077echo " "
20078case "$d_getgrps$d_setgrps" in
20079*define*)
20080 case "$groupstype" in
20081 '') dflt="$gidtype" ;;
20082 *) dflt="$groupstype" ;;
20083 esac
20084 $cat <<EOM
20085What type of pointer is the second argument to getgroups() and setgroups()?
20086Usually this is the same as group ids, $gidtype, but not always.
20087
20088EOM
20089 rp='What type pointer is the second argument to getgroups() and setgroups()?'
20090 . ./myread
20091 groupstype="$ans"
20092 ;;
20093*) groupstype="$gidtype";;
20094esac
20095
613d6c3e 20096: MAD = Misc Attribute Definition
d620c7b3 20097
fd655d33
NC
20098if $test $patchlevel -lt 9; then
20099: MAD is not available in 5.8.x or earlier.
20100 ans=n;
20101else
20102 case "$mad" in
20103 $define|true|[yY]*) dflt='y' ;;
20104 *) dflt='n' ;;
20105 esac
20106 cat <<EOM
d620c7b3
MB
20107
20108Would you like to build with Misc Attribute Decoration? This is development
20109work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20110overhead on the interpreter.
20111
20112If this doesn't make any sense to you, just accept the default '$dflt'.
20113EOM
fd655d33
NC
20114 rp='Build Perl with MAD?'
20115 . ./myread
20116fi
d620c7b3 20117case "$ans" in
00e74f14
NC
20118y|Y) val="$define"
20119 madlyh='madly.h madly.act madly.tab'
20120 madlysrc='madly.c'
20121 madlyobj="madly$_o" ;;
20122*) val="$undef"
20123 madlyh=''
20124 madlysrc=''
20125 madlyobj='' ;;
d620c7b3
MB
20126esac
20127set mad
20128eval $setvar
20129
216dac04 20130: check whether make sets MAKE
b4eb6b3d
JH
20131echo " "
20132echo "Checking if your $make program sets \$(MAKE)..." >&4
20133case "$make_set_make" in
20134'')
20135 $sed 's/^X //' > testmake.mak << 'EOF'
20136Xall:
20137X @echo 'maketemp="$(MAKE)"'
20138EOF
20139 case "`$make -f testmake.mak 2>/dev/null`" in
20140 *maketemp=*) make_set_make='#' ;;
20141 *) make_set_make="MAKE=$make" ;;
20142 esac
20143 $rm -f testmake.mak
20144 ;;
20145esac
20146case "$make_set_make" in
20147'#') echo "Yup, it does.";;
20148*) echo "Nope, it doesn't.";;
20149esac
20150
20151: see what type is used for mode_t
20152rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20153set mode_t modetype int stdio.h sys/types.h
20154eval $typedef_ask
20155
2cc61e15
DD
20156: see if we need va_copy
20157echo " "
20158case "$i_stdarg" in
20159"$define")
20160 $cat >try.c <<EOCP
20161#include <stdarg.h>
20162#include <stdio.h>
85c8a686
DD
20163#$i_stdlib I_STDLIB
20164#ifdef I_STDLIB
20165#include <stdlib.h>
20166#endif
20167#include <signal.h>
2cc61e15
DD
20168
20169int
20170ivfprintf(FILE *f, const char *fmt, va_list *valp)
20171{
20172 return vfprintf(f, fmt, *valp);
20173}
5b813a60
MB
20174
20175int
2cc61e15
DD
20176myvfprintf(FILE *f, const char *fmt, va_list val)
20177{
20178 return ivfprintf(f, fmt, &val);
20179}
5b813a60 20180
2cc61e15 20181int
5b813a60 20182myprintf(char *fmt, ...)
2cc61e15
DD
20183{
20184 va_list val;
20185 va_start(val, fmt);
5b813a60
MB
20186 return myvfprintf(stdout, fmt, val);
20187}
2cc61e15
DD
20188
20189int
20190main(int ac, char **av)
20191{
85c8a686
DD
20192 signal(SIGSEGV, exit);
20193
5b813a60
MB
20194 myprintf("%s%cs all right, then\n", "that", '\'');
20195 exit(0);
2cc61e15
DD
20196}
20197EOCP
20198 set try
5440bc8e
JH
20199 if eval $compile && $run ./try 2>&1 >/dev/null; then
20200 case "`$run ./try`" in
2cc61e15
DD
20201 "that's all right, then")
20202 okay=yes
20203 ;;
20204 esac
20205 fi
20206 case "$okay" in
20207 yes) echo "It seems that you don't need va_copy()." >&4
20208 need_va_copy="$undef"
20209 ;;
20210 *) echo "It seems that va_copy() or similar will be needed." >&4
20211 need_va_copy="$define"
20212 ;;
20213 esac
5b813a60 20214 $rm_try
2cc61e15
DD
20215 ;;
20216*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20217 ;;
20218esac
20219
b4eb6b3d
JH
20220: see what type is used for size_t
20221rp="What is the type used for the length parameter for string functions?"
20222set size_t sizetype 'unsigned int' stdio.h sys/types.h
20223eval $typedef_ask
20224
20225: check for type of arguments to gethostbyaddr.
20226if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20227 case "$d_gethbyaddr" in
20228 $define)
20229 $cat <<EOM
20230
20231Checking to see what type of arguments are accepted by gethostbyaddr().
20232EOM
20233 hdrs="$define sys/types.h
20234 $d_socket sys/socket.h
20235 $i_niin netinet/in.h
20236 $i_netdb netdb.h
20237 $i_unistd unistd.h"
20238 : The first arg can 'char *' or 'void *'
20239 : The second arg is some of integral type
20240 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20241 for yyy in size_t long int; do
20242 case "$netdb_host_type" in
61c26d18 20243 '') try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
b4eb6b3d
JH
20244 if ./protochk "$try" $hdrs; then
20245 echo "Your system accepts $xxx for the first arg."
20246 echo "...and $yyy for the second arg."
20247 netdb_host_type="$xxx"
20248 netdb_hlen_type="$yyy"
20249 fi
20250 ;;
20251 esac
20252 done
20253 done
20254 : In case none of those worked, prompt the user.
20255 case "$netdb_host_type" in
20256 '') rp='What is the type for the 1st argument to gethostbyaddr?'
20257 dflt='char *'
20258 . ./myread
20259 netdb_host_type=$ans
20260 rp='What is the type for the 2nd argument to gethostbyaddr?'
20261 dflt="$sizetype"
20262 . ./myread
20263 netdb_hlen_type=$ans
20264 ;;
20265 esac
20266 ;;
20267 *) : no gethostbyaddr, so pick harmless defaults
20268 netdb_host_type='char *'
20269 netdb_hlen_type="$sizetype"
20270 ;;
20271 esac
20272 # Remove the "const" if needed. -- but then we'll have a
20273 # prototype clash!
20274 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20275fi
20276
20277: check for type of argument to gethostbyname.
20278if test "X$netdb_name_type" = X ; then
20279 case "$d_gethbyname" in
20280 $define)
20281 $cat <<EOM
20282
20283Checking to see what type of argument is accepted by gethostbyname().
20284EOM
20285 hdrs="$define sys/types.h
20286 $d_socket sys/socket.h
20287 $i_niin netinet/in.h
20288 $i_netdb netdb.h
20289 $i_unistd unistd.h"
20290 for xxx in "const char *" "char *"; do
20291 case "$netdb_name_type" in
61c26d18 20292 '') try="$extern_C struct hostent *gethostbyname($xxx);"
b4eb6b3d
JH
20293 if ./protochk "$try" $hdrs; then
20294 echo "Your system accepts $xxx."
20295 netdb_name_type="$xxx"
20296 fi
20297 ;;
20298 esac
20299 done
20300 : In case none of those worked, prompt the user.
20301 case "$netdb_name_type" in
20302 '') rp='What is the type for the 1st argument to gethostbyname?'
20303 dflt='char *'
20304 . ./myread
20305 netdb_name_type=$ans
20306 ;;
20307 esac
20308 ;;
20309 *) : no gethostbyname, so pick harmless default
20310 netdb_name_type='char *'
20311 ;;
20312 esac
20313fi
20314
20315: check for type of 1st argument to getnetbyaddr.
20316if test "X$netdb_net_type" = X ; then
20317 case "$d_getnbyaddr" in
20318 $define)
20319 $cat <<EOM
20320
20321Checking to see what type of 1st argument is accepted by getnetbyaddr().
20322EOM
20323 hdrs="$define sys/types.h
20324 $d_socket sys/socket.h
20325 $i_niin netinet/in.h
20326 $i_netdb netdb.h
20327 $i_unistd unistd.h"
20328 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20329 case "$netdb_net_type" in
61c26d18 20330 '') try="$extern_C struct netent *getnetbyaddr($xxx, int);"
b4eb6b3d
JH
20331 if ./protochk "$try" $hdrs; then
20332 echo "Your system accepts $xxx."
20333 netdb_net_type="$xxx"
20334 fi
20335 ;;
20336 esac
20337 done
20338 : In case none of those worked, prompt the user.
20339 case "$netdb_net_type" in
20340 '') rp='What is the type for the 1st argument to getnetbyaddr?'
20341 dflt='long'
20342 . ./myread
20343 netdb_net_type=$ans
20344 ;;
20345 esac
20346 ;;
20347 *) : no getnetbyaddr, so pick harmless default
20348 netdb_net_type='long'
20349 ;;
20350 esac
20351fi
20352: locate the preferred pager for this system
d604bb53 20353fn=f/
b4eb6b3d
JH
20354case "$pager" in
20355'')
20356 dflt=''
20357 case "$pg" in
20358 /*) dflt=$pg;;
20359 [a-zA-Z]:/*) dflt=$pg;;
20360 esac
20361 case "$more" in
20362 /*) dflt=$more;;
20363 [a-zA-Z]:/*) dflt=$more;;
20364 esac
20365 case "$less" in
20366 /*) dflt=$less;;
20367 [a-zA-Z]:/*) dflt=$less;;
20368 esac
20369 case "$dflt" in
20370 '') dflt=/usr/ucb/more;;
20371 esac
20372 ;;
d604bb53 20373*) dflt="$pager"
d604bb53
JH
20374 fn="f/($pager)"
20375 ;;
b4eb6b3d
JH
20376esac
20377echo " "
b4eb6b3d
JH
20378rp='What pager is used on your system?'
20379. ./getfile
20380pager="$ans"
20381
20382: see what type pids are declared as in the kernel
20383rp="What is the type of process ids on this system?"
20384set pid_t pidtype int stdio.h sys/types.h
20385eval $typedef_ask
20386
b4eb6b3d
JH
20387: see if ar generates random libraries by itself
20388echo " "
20389echo "Checking how to generate random libraries on your machine..." >&4
20390echo 'int bar1() { return bar2(); }' > bar1.c
20391echo 'int bar2() { return 2; }' > bar2.c
55954f19
JH
20392$cat > foo.c <<EOP
20393#$i_stdlib I_STDLIB
20394#ifdef I_STDLIB
20395#include <stdlib.h>
20396#endif
b4eb6b3d
JH
20397int main() { printf("%d\n", bar1()); exit(0); }
20398EOP
20399$cc $ccflags -c bar1.c >/dev/null 2>&1
20400$cc $ccflags -c bar2.c >/dev/null 2>&1
20401$cc $ccflags -c foo.c >/dev/null 2>&1
20402$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 20403if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 20404 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
20405 echo "$ar appears to generate random libraries itself."
20406 orderlib=false
e39a9d84
LC
20407 if [ "X$ranlib" = "X" ]; then
20408 ranlib=":"
20409 fi
88d4d47b
PC
20410elif $ar s bar$_a >/dev/null 2>&1 &&
20411 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20412 $run ./foobar >/dev/null 2>&1; then
20413 echo "a table of contents needs to be added with '$ar s'."
20414 orderlib=false
20415 ranlib="$ar s"
b4eb6b3d 20416elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 20417 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 20418 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
20419 echo "a table of contents needs to be added with '$ar ts'."
20420 orderlib=false
20421 ranlib="$ar ts"
20422else
20423 case "$ranlib" in
20424 :) ranlib='';;
20425 '')
20426 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20427 $test -f $ranlib || ranlib=''
20428 ;;
20429 esac
20430 if $test -n "$ranlib"; then
20431 echo "your system has '$ranlib'; we'll use that."
20432 orderlib=false
20433 else
20434 echo "your system doesn't seem to support random libraries"
20435 echo "so we'll use lorder and tsort to order the libraries."
20436 orderlib=true
20437 ranlib=":"
20438 fi
20439fi
88d4d47b 20440$rm -f foo* bar*
b4eb6b3d 20441
92a3ac59
MB
20442: see if this is a values.h system
20443set values.h i_values
20444eval $inhdr
20445
73e6e416 20446: Check the max offset that gmtime and localtime accept
92a3ac59 20447echo "Checking max offsets that gmtime () accepts"
81c4fd9e 20448
92a3ac59
MB
20449case $i_values in
20450 define) yyy="#include <values.h>" ;;
20451 *) yyy="" ;;
20452 esac
20453
690aedd1
MB
20454case "$sGMTIME_min/$sGMTIME_max" in
20455 0/0|/)
20456 $cat >try.c <<EOCP
81c4fd9e
MB
20457#include <sys/types.h>
20458#include <stdio.h>
20459#include <time.h>
92a3ac59 20460$yyy
81c4fd9e 20461
92a3ac59
MB
20462int i;
20463struct tm *tmp;
20464time_t pt;
20465
1b289682 20466void gm_check (time_t t, int min_year, int max_year)
92a3ac59 20467{
81c4fd9e 20468 tmp = gmtime (&t);
1b289682
MB
20469 if ( tmp == NULL ||
20470 /* Check tm_year overflow */
20471 tmp->tm_year < min_year || tmp->tm_year > max_year)
92a3ac59
MB
20472 tmp = NULL;
20473 else
20474 pt = t;
20475 } /* gm_check */
81c4fd9e 20476
92a3ac59
MB
20477int check_max ()
20478{
73e6e416
MB
20479 tmp = NULL;
20480 pt = 0;
92a3ac59 20481#ifdef MAXLONG
1b289682 20482 gm_check (MAXLONG, 69, 0x7fffffff);
92a3ac59 20483#endif
73e6e416
MB
20484 if (tmp == NULL || tmp->tm_year < 0) {
20485 for (i = 63; i >= 0; i--) {
20486 time_t x = pt | ((time_t)1 << i);
1b289682
MB
20487 if (x < 0 || x < pt) continue;
20488 gm_check (x, 69, 0x7fffffff);
73e6e416
MB
20489 }
20490 }
20491 printf ("sGMTIME_max=%ld\n", pt);
20492 return (0);
1b289682 20493 } /* check_max */
81c4fd9e 20494
92a3ac59
MB
20495int check_min ()
20496{
73e6e416
MB
20497 tmp = NULL;
20498 pt = 0;
92a3ac59 20499#ifdef MINLONG
1b289682 20500 gm_check (MINLONG, -1900, 70);
92a3ac59 20501#endif
73e6e416
MB
20502 if (tmp == NULL) {
20503 for (i = 36; i >= 0; i--) {
20504 time_t x = pt - ((time_t)1 << i);
20505 if (x > 0) continue;
1b289682 20506 gm_check (x, -1900, 70);
73e6e416
MB
20507 }
20508 }
20509 printf ("sGMTIME_min=%ld\n", pt);
20510 return (0);
20511 } /* check_min */
92a3ac59
MB
20512
20513int main (int argc, char *argv[])
20514{
73e6e416
MB
20515 fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20516 check_max ();
20517 check_min ();
20518 return (0);
20519 } /* main */
81c4fd9e 20520EOCP
690aedd1
MB
20521 set try
20522 if eval $compile; then
20523 eval `$run ./try`
20524 else
20525 echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20526 fi
20527 $rm_try
20528 ;;
20529 esac
81c4fd9e 20530
73e6e416
MB
20531echo "Checking max offsets that localtime () accepts"
20532
690aedd1
MB
20533case "$sLOCALTIME_min/$sLOCALTIME_max" in
20534 0/0|/)
20535 $cat >try.c <<EOCP
73e6e416
MB
20536#include <sys/types.h>
20537#include <stdio.h>
20538#include <time.h>
20539$yyy
20540
20541int i;
20542struct tm *tmp;
20543time_t pt;
20544
1b289682 20545void local_check (time_t t, int min_year, int max_year)
73e6e416 20546{
5bca5c48
MB
20547 if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20548 tmp = NULL;
20549 else
20550 tmp = localtime (&t);
1b289682
MB
20551 if ( tmp == NULL ||
20552 /* Check tm_year overflow */
20553 tmp->tm_year < min_year || tmp->tm_year > max_year)
73e6e416
MB
20554 tmp = NULL;
20555 else
20556 pt = t;
20557 } /* local_check */
20558
20559int check_max ()
20560{
20561 tmp = NULL;
20562 pt = 0;
20563#ifdef MAXLONG
1b289682 20564 local_check (MAXLONG, 69, 0x7fffffff);
73e6e416
MB
20565#endif
20566 if (tmp == NULL || tmp->tm_year < 0) {
20567 for (i = 63; i >= 0; i--) {
20568 time_t x = pt | ((time_t)1 << i);
1b289682
MB
20569 if (x < 0 || x < pt) continue;
20570 local_check (x, 69, 0x7fffffff);
73e6e416
MB
20571 }
20572 }
20573 printf ("sLOCALTIME_max=%ld\n", pt);
20574 return (0);
1b289682 20575 } /* check_max */
73e6e416
MB
20576
20577int check_min ()
20578{
20579 tmp = NULL;
20580 pt = 0;
20581#ifdef MINLONG
1b289682 20582 local_check (MINLONG, -1900, 70);
73e6e416
MB
20583#endif
20584 if (tmp == NULL) {
20585 for (i = 36; i >= 0; i--) {
20586 time_t x = pt - ((time_t)1 << i);
20587 if (x > 0) continue;
1b289682 20588 local_check (x, -1900, 70);
73e6e416
MB
20589 }
20590 }
20591 printf ("sLOCALTIME_min=%ld\n", pt);
20592 return (0);
20593 } /* check_min */
20594
20595int main (int argc, char *argv[])
20596{
20597 check_max ();
20598 check_min ();
20599 return (0);
20600 } /* main */
20601EOCP
690aedd1
MB
20602 set try
20603 if eval $compile; then
20604 eval `$run ./try`
20605 else
20606 echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20607 fi
20608 $rm_try
20609 ;;
20610 esac
73e6e416 20611
c0bacbef 20612: check for type of arguments to select.
b4eb6b3d
JH
20613case "$selecttype" in
20614'') case "$d_select" in
20615 $define)
20616 echo " "
20617 $cat <<EOM
20618Checking to see what type of arguments are accepted by select().
20619EOM
20620 hdrs="$define sys/types.h
c0bacbef 20621 $i_systime sys/time.h
b4eb6b3d
JH
20622 $i_sysselct sys/select.h
20623 $d_socket sys/socket.h"
20624 : The first arg can be int, unsigned, or size_t
20625 : The last arg may or may not be 'const'
20626 val=''
20627 : void pointer has been seen but using that
20628 : breaks the selectminbits test
20629 for xxx in 'fd_set *' 'int *'; do
20630 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20631 for tmo in 'struct timeval *' 'const struct timeval *'; do
20632 case "$val" in
61c26d18 20633 '') try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
b4eb6b3d
JH
20634 if ./protochk "$try" $hdrs; then
20635 echo "Your system accepts $xxx."
20636 val="$xxx"
20637 fi
20638 ;;
20639 esac
20640 done
20641 done
20642 done
20643 case "$val" in
20644 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20645 case "$d_fd_set" in
20646 $define) dflt="fd_set *" ;;
20647 *) dflt="int *" ;;
20648 esac
20649 . ./myread
20650 val=$ans
20651 ;;
20652 esac
20653 selecttype="$val"
20654 ;;
20655 *) : no select, so pick a harmless default
20656 selecttype='int *'
20657 ;;
20658 esac
20659 ;;
20660esac
20661
20662: check for the select 'width'
20663case "$selectminbits" in
e6e7e605
JH
20664'') safebits=`expr $ptrsize \* 8`
20665 case "$d_select" in
b4eb6b3d
JH
20666 $define)
20667 $cat <<EOM
20668
20669Checking to see on how many bits at a time your select() operates...
20670EOM
20671 $cat >try.c <<EOCP
20672#include <sys/types.h>
20673#$i_time I_TIME
20674#$i_systime I_SYS_TIME
20675#$i_systimek I_SYS_TIME_KERNEL
20676#ifdef I_TIME
20677# include <time.h>
20678#endif
20679#ifdef I_SYS_TIME
20680# ifdef I_SYS_TIME_KERNEL
20681# define KERNEL
20682# endif
20683# include <sys/time.h>
20684# ifdef I_SYS_TIME_KERNEL
20685# undef KERNEL
20686# endif
20687#endif
20688#$i_sysselct I_SYS_SELECT
20689#ifdef I_SYS_SELECT
20690#include <sys/select.h>
20691#endif
20692#$d_socket HAS_SOCKET
20693#ifdef HAS_SOCKET
20694# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20695#endif
20696#include <stdio.h>
d1daaddf
JH
20697#$i_stdlib I_STDLIB
20698#ifdef I_STDLIB
20699#include <stdlib.h>
20700#endif
b4eb6b3d
JH
20701$selecttype b;
20702#define S sizeof(*(b))
20703#define MINBITS 64
20704#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20705#define NBITS (NBYTES * 8)
20706int main() {
7090f861 20707 char *s = (char *)malloc(NBYTES);
b4eb6b3d
JH
20708 struct timeval t;
20709 int i;
20710 FILE* fp;
20711 int fd;
20712
e6e7e605
JH
20713 if (!s)
20714 exit(1);
b4eb6b3d
JH
20715 fclose(stdin);
20716 fp = fopen("try.c", "r");
20717 if (fp == 0)
e6e7e605 20718 exit(2);
b4eb6b3d
JH
20719 fd = fileno(fp);
20720 if (fd < 0)
e6e7e605 20721 exit(3);
b4eb6b3d
JH
20722 b = ($selecttype)s;
20723 for (i = 0; i < NBITS; i++)
20724 FD_SET(i, b);
20725 t.tv_sec = 0;
20726 t.tv_usec = 0;
20727 select(fd + 1, b, 0, 0, &t);
20728 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
e6e7e605 20729 free(s);
b4eb6b3d
JH
20730 printf("%d\n", i + 1);
20731 return 0;
20732}
20733EOCP
20734 set try
20735 if eval $compile_ok; then
5440bc8e 20736 selectminbits=`$run ./try`
b4eb6b3d
JH
20737 case "$selectminbits" in
20738 '') cat >&4 <<EOM
20739Cannot figure out on how many bits at a time your select() operates.
e6e7e605 20740I'll play safe and guess it is $safebits bits.
b4eb6b3d 20741EOM
e6e7e605
JH
20742 selectminbits=$safebits
20743 bits="$safebits bits"
b4eb6b3d
JH
20744 ;;
20745 1) bits="1 bit" ;;
20746 *) bits="$selectminbits bits" ;;
20747 esac
20748 echo "Your select() operates on $bits at a time." >&4
20749 else
20750 rp='What is the minimum number of bits your select() operates on?'
20751 case "$byteorder" in
e6e7e605
JH
20752 12345678) dflt=64 ;;
20753 1234) dflt=32 ;;
b4eb6b3d
JH
20754 *) dflt=1 ;;
20755 esac
20756 . ./myread
20757 val=$ans
20758 selectminbits="$val"
20759 fi
5b813a60 20760 $rm_try
b4eb6b3d
JH
20761 ;;
20762 *) : no select, so pick a harmless default
e6e7e605 20763 selectminbits=$safebits
b4eb6b3d
JH
20764 ;;
20765 esac
20766 ;;
20767esac
20768
20769: Trace out the files included by signal.h, then look for SIGxxx names.
b4eb6b3d
JH
20770if [ "X$fieldn" = X ]; then
20771 : Just make some guesses. We check them later.
20772 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20773else
20774 xxx=`echo '#include <signal.h>' |
20775 $cppstdin $cppminus $cppflags 2>/dev/null |
613d6c3e 20776 $grep '^[ ]*#.*include' |
776a38e3
MB
20777 $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20778 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d 20779fi
b4eb6b3d
JH
20780xxxfiles=''
20781for xx in $xxx /dev/null ; do
20782 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20783done
b4eb6b3d
JH
20784case "$xxxfiles" in
20785'') xxxfiles=`./findhdr signal.h` ;;
20786esac
20787xxx=`awk '
20788$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20789 print substr($2, 4, 20)
20790}
20791$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20792 print substr($3, 4, 20)
20793}' $xxxfiles`
20794: Append some common names just in case the awk scan failed.
20795xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20796xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20797xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20798xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20799xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20800
20801: generate a few handy files for later
55954f19 20802$cat > signal.c <<EOCP
b4eb6b3d
JH
20803#include <sys/types.h>
20804#include <signal.h>
55954f19
JH
20805#$i_stdlib I_STDLIB
20806#ifdef I_STDLIB
20807#include <stdlib.h>
20808#endif
b4eb6b3d
JH
20809#include <stdio.h>
20810int main() {
20811
20812/* Strange style to avoid deeply-nested #if/#else/#endif */
20813#ifndef NSIG
20814# ifdef _NSIG
20815# define NSIG (_NSIG)
20816# endif
20817#endif
20818
20819#ifndef NSIG
20820# ifdef SIGMAX
20821# define NSIG (SIGMAX+1)
20822# endif
20823#endif
20824
20825#ifndef NSIG
20826# ifdef SIG_MAX
20827# define NSIG (SIG_MAX+1)
20828# endif
20829#endif
20830
20831#ifndef NSIG
3609ea0d
JH
20832# ifdef _SIG_MAX
20833# define NSIG (_SIG_MAX+1)
20834# endif
20835#endif
20836
20837#ifndef NSIG
b4eb6b3d
JH
20838# ifdef MAXSIG
20839# define NSIG (MAXSIG+1)
20840# endif
20841#endif
20842
20843#ifndef NSIG
20844# ifdef MAX_SIG
20845# define NSIG (MAX_SIG+1)
20846# endif
20847#endif
20848
20849#ifndef NSIG
20850# ifdef SIGARRAYSIZE
3609ea0d 20851# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
b4eb6b3d
JH
20852# endif
20853#endif
20854
20855#ifndef NSIG
20856# ifdef _sys_nsig
20857# define NSIG (_sys_nsig) /* Solaris 2.5 */
20858# endif
20859#endif
20860
20861/* Default to some arbitrary number that's big enough to get most
20862 of the common signals.
20863*/
20864#ifndef NSIG
20865# define NSIG 50
20866#endif
20867
20868printf("NSIG %d\n", NSIG);
20869
20870#ifndef JUST_NSIG
20871
20872EOCP
20873
20874echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20875{
20876 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 20877 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
20878 printf $1; printf ");\n"
20879 printf "#endif\n"
20880}
20881END {
20882 printf "#endif /* JUST_NSIG */\n";
20883 printf "exit(0);\n}\n";
20884}
20885' >>signal.c
20886$cat >signal.awk <<'EOP'
20887BEGIN { ndups = 0 }
65197d93 20888$1 ~ /^NSIG$/ { nsig = $2 }
1ebe1ffb 20889($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
20890 if ($2 > maxsig) { maxsig = $2 }
20891 if (sig_name[$2]) {
20892 dup_name[ndups] = $1
20893 dup_num[ndups] = $2
613d6c3e 20894 ndups++
b4eb6b3d 20895 }
1ebe1ffb 20896 else {
65197d93
JH
20897 sig_name[$2] = $1
20898 sig_num[$2] = $2
b4eb6b3d
JH
20899 }
20900}
613d6c3e 20901END {
b4eb6b3d
JH
20902 if (nsig == 0) {
20903 nsig = maxsig + 1
20904 }
20905 printf("NSIG %d\n", nsig);
20906 for (n = 1; n < nsig; n++) {
20907 if (sig_name[n]) {
20908 printf("%s %d\n", sig_name[n], sig_num[n])
20909 }
20910 else {
613d6c3e 20911 printf("NUM%d %d\n", n, n)
b4eb6b3d
JH
20912 }
20913 }
20914 for (n = 0; n < ndups; n++) {
20915 printf("%s %d\n", dup_name[n], dup_num[n])
20916 }
20917}
20918EOP
20919$cat >signal_cmd <<EOS
20920$startsh
20921if $test -s signal.lst; then
20922 echo "Using your existing signal.lst file"
20923 exit 0
20924fi
20925xxx="$xxx"
20926EOS
20927$cat >>signal_cmd <<'EOS'
20928
20929set signal
20930if eval $compile_ok; then
776a38e3
MB
20931 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20932 $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20933else
20934 echo "(I can't seem be able to compile the whole test program)" >&4
20935 echo "(I'll try it in little pieces.)" >&4
20936 set signal -DJUST_NSIG
20937 if eval $compile_ok; then
5440bc8e 20938 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
20939 $cat signal.nsg
20940 else
20941 echo "I can't seem to figure out how many signals you have." >&4
20942 echo "Guessing 50." >&4
20943 echo 'NSIG 50' > signal.nsg
20944 fi
20945 : Now look at all the signal names, one at a time.
20946 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20947 $cat > signal.c <<EOCP
20948#include <sys/types.h>
20949#include <signal.h>
20950#include <stdio.h>
20951int main() {
20952printf("$xx %d\n", SIG${xx});
20953return 0;
20954}
20955EOCP
20956 set signal
20957 if eval $compile; then
20958 echo "SIG${xx} found."
5440bc8e 20959 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
20960 else
20961 echo "SIG${xx} NOT found."
20962 fi
20963 done
20964 if $test -s signal.ls1; then
20965 $cat signal.nsg signal.ls1 |
65197d93 20966 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20967 fi
20968
20969fi
20970if $test -s signal.lst; then
20971 :
20972else
20973 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20974 echo 'kill -l' >signal
20975 set X `csh -f <signal`
20976 $rm -f signal
20977 shift
20978 case $# in
20979 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20980 esac
20981 echo $@ | $tr ' ' $trnl | \
20982 $awk '{ printf "%s %d\n", $1, ++s; }
20983 END { printf "NSIG %d\n", ++s }' >signal.lst
20984fi
20985$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20986EOS
20987chmod a+x signal_cmd
20988$eunicefix signal_cmd
20989
20990: generate list of signal names
20991echo " "
20992case "$sig_name_init" in
20993'') doinit=yes ;;
20994*) case "$sig_num_init" in
20995 ''|*,*) doinit=yes ;;
20996 esac ;;
20997esac
20998case "$doinit" in
20999yes)
21000 echo "Generating a list of signal names and numbers..." >&4
21001 . ./signal_cmd
21002 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21003 sig_name=`$awk 'BEGIN { printf "ZERO " }
21004 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21005 sig_num=`$awk 'BEGIN { printf "0 " }
21006 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21007 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
21008 !/^NSIG/ { printf "\"%s\", ", $1 }
21009 END { printf "0\n" }' signal.lst`
21010 sig_num_init=`$awk 'BEGIN { printf "0, " }
21011 !/^NSIG/ { printf "%d, ", $2}
21012 END { printf "0\n"}' signal.lst`
21013 ;;
21014esac
21015echo "The following $sig_count signals are available:"
21016echo " "
21017echo $sig_name | $awk \
21018'BEGIN { linelen = 0 }
21019{
21020 for (i = 1; i <= NF; i++) {
21021 name = "SIG" $i " "
21022 linelen = linelen + length(name)
21023 if (linelen > 70) {
21024 printf "\n"
21025 linelen = length(name)
21026 }
21027 printf "%s", name
21028 }
21029 printf "\n"
21030}'
76d3c696 21031sig_size=`echo $sig_name | awk '{print NF}'`
c0bacbef 21032$rm -f signal signal.c signal.awk signal.lst signal_cmd
b4eb6b3d 21033
613d6c3e 21034: Check size of size
b4eb6b3d
JH
21035echo " "
21036case "$sizetype" in
21037*_t) zzz="$sizetype" ;;
21038*) zzz="filesize" ;;
21039esac
613d6c3e 21040echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
21041cat > try.c <<EOCP
21042#include <sys/types.h>
21043#include <stdio.h>
d1daaddf
JH
21044#$i_stdlib I_STDLIB
21045#ifdef I_STDLIB
21046#include <stdlib.h>
21047#endif
b4eb6b3d
JH
21048int main() {
21049 printf("%d\n", (int)sizeof($sizetype));
21050 exit(0);
21051}
21052EOCP
21053set try
21054if eval $compile_ok; then
5440bc8e 21055 yyy=`$run ./try`
b4eb6b3d
JH
21056 case "$yyy" in
21057 '') sizesize=4
21058 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21059 ;;
21060 *) sizesize=$yyy
21061 echo "Your $zzz size is $sizesize bytes."
21062 ;;
21063 esac
21064else
21065 sizesize=4
21066 echo "(I can't compile the test program--guessing $sizesize.)" >&4
21067fi
21068
21069
21070: check for socklen_t
21071echo " "
21072echo "Checking to see if you have socklen_t..." >&4
21073$cat >try.c <<EOCP
21074#include <sys/types.h>
21075#$d_socket HAS_SOCKET
21076#ifdef HAS_SOCKET
21077#include <sys/socket.h>
21078#endif
21079int main() { socklen_t x = 16; }
21080EOCP
21081set try
21082if eval $compile; then
21083 val="$define"
21084 echo "You have socklen_t."
21085else
21086 val="$undef"
21087 echo "You do not have socklen_t."
21088 case "$sizetype" in
21089 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21090 esac
21091fi
5b813a60 21092$rm_try
b4eb6b3d
JH
21093set d_socklen_t
21094eval $setvar
21095
a7710f8d
JH
21096: see if this is a socks.h system
21097set socks.h i_socks
21098eval $inhdr
21099
b4eb6b3d
JH
21100: check for type of the size argument to socket calls
21101case "$d_socket" in
21102"$define")
21103 $cat <<EOM
21104
21105Checking to see what type is the last argument of accept().
21106EOM
b4eb6b3d
JH
21107 yyy=''
21108 case "$d_socklen_t" in
21109 "$define") yyy="$yyy socklen_t"
21110 esac
21111 yyy="$yyy $sizetype int long unsigned"
21112 for xxx in $yyy; do
21113 case "$socksizetype" in
61c26d18 21114 '') try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
21115 case "$usesocks" in
21116 "$define")
21117 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21118 echo "Your system accepts '$xxx *' for the last argument of accept()."
21119 socksizetype="$xxx"
21120 fi
21121 ;;
21122 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
21123 echo "Your system accepts '$xxx *' for the last argument of accept()."
21124 socksizetype="$xxx"
21125 fi
21126 ;;
21127 esac
b4eb6b3d
JH
21128 ;;
21129 esac
21130 done
21131: In case none of those worked, prompt the user.
21132 case "$socksizetype" in
21133 '') rp='What is the type for socket address structure sizes?'
21134 dflt='int'
21135 . ./myread
21136 socksizetype=$ans
21137 ;;
21138 esac
21139 ;;
21140*) : no sockets, so pick relatively harmless default
21141 socksizetype='int'
21142 ;;
21143esac
21144
21145: see what type is used for signed size_t
21146set ssize_t ssizetype int stdio.h sys/types.h
21147eval $typedef
21148dflt="$ssizetype"
5440bc8e 21149$cat > try.c <<EOM
b4eb6b3d 21150#include <stdio.h>
d1daaddf
JH
21151#$i_stdlib I_STDLIB
21152#ifdef I_STDLIB
21153#include <stdlib.h>
21154#endif
b4eb6b3d
JH
21155#include <sys/types.h>
21156#define Size_t $sizetype
21157#define SSize_t $dflt
21158int main()
21159{
21160 if (sizeof(Size_t) == sizeof(SSize_t))
21161 printf("$dflt\n");
21162 else if (sizeof(Size_t) == sizeof(int))
21163 printf("int\n");
5b813a60 21164 else
b4eb6b3d
JH
21165 printf("long\n");
21166 exit(0);
21167}
21168EOM
21169echo " "
5440bc8e
JH
21170set try
21171if eval $compile_ok && $run ./try > /dev/null; then
21172 ssizetype=`$run ./try`
b4eb6b3d
JH
21173 echo "I'll be using $ssizetype for functions returning a byte count." >&4
21174else
21175 $cat >&4 <<EOM
21176Help! I can't compile and run the ssize_t test program: please enlighten me!
21177(This is probably a misconfiguration in your system or libraries, and
21178you really ought to fix it. Still, I'll try anyway.)
21179
21180I need a type that is the same size as $sizetype, but is guaranteed to
21181be signed. Common values are ssize_t, int and long.
21182
21183EOM
21184 rp="What signed type is the same size as $sizetype?"
21185 . ./myread
21186 ssizetype="$ans"
21187fi
5b813a60 21188$rm_try
b4eb6b3d 21189
668fdbe1
MB
21190: Check the size of st_ino
21191$echo " "
21192$echo "Checking the size of st_ino..." >&4
21193$cat > try.c <<EOCP
21194#include <sys/stat.h>
21195#include <stdio.h>
21196#$i_stdlib I_STDLIB
21197#ifdef I_STDLIB
21198#include <stdlib.h>
21199#endif
21200int main() {
21201 struct stat st;
21202 printf("%d\n", (int)sizeof(st.st_ino));
21203 exit(0);
21204}
21205EOCP
21206set try
21207if eval $compile_ok; then
21208 val=`$run ./try`
21209 case "$val" in
21210 '') st_ino_size=4
21211 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21212 ;;
21213 *) st_ino_size=$val
21214 $echo "Your st_ino is $st_ino_size bytes long."
21215 ;;
21216 esac
21217else
21218 st_ino_size=4
21219 $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21220fi
21221$rm_try
21222
21223: Check if st_ino is signed
21224$echo " "
21225$echo "Checking the sign of st_ino..." >&4
21226$cat > try.c <<EOCP
21227#include <sys/stat.h>
21228#include <stdio.h>
21229int main() {
21230 struct stat foo;
21231 foo.st_ino = -1;
21232 if (foo.st_ino < 0)
21233 printf("-1\n");
21234 else
21235 printf("1\n");
21236}
21237EOCP
21238set try
21239if eval $compile; then
21240 val=`$run ./try`
21241 case "$val" in
21242 '') st_ino_sign=1
21243 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21244 ;;
21245 *) st_ino_sign=$val
21246 case "$st_ino_sign" in
21247 1) $echo "Your st_ino is unsigned." ;;
21248 -1) $echo "Your st_ino is signed." ;;
21249 esac
21250 ;;
21251 esac
21252else
21253 st_ino_sign=1
21254 $echo "(I can't compile the test program--guessing unsigned.)" >&4
21255fi
21256$rm_try
21257
b4eb6b3d
JH
21258: see what type of char stdio uses.
21259echo " "
1d8eaf8c 21260echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
aa517f50 21261if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
21262 echo "Your stdio uses unsigned chars." >&4
21263 stdchar="unsigned char"
21264else
aa517f50
JH
21265 echo "Your stdio uses signed chars." >&4
21266 stdchar="char"
b4eb6b3d 21267fi
1d8eaf8c 21268$rm -f stdioh
b4eb6b3d 21269
b4eb6b3d
JH
21270: see what type uids are declared as in the kernel
21271echo " "
21272echo "Looking for the type for user ids returned by getuid()."
21273set uid_t uidtype xxx stdio.h sys/types.h
21274eval $typedef
21275case "$uidtype" in
21276xxx)
21277 xxx=`./findhdr sys/user.h`
21278 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21279 case $1 in
21280 unsigned) dflt="$1 $2" ;;
21281 *) dflt="$1" ;;
21282 esac
21283 ;;
21284*) dflt="$uidtype";;
21285esac
21286case "$uidtype" in
21287uid_t) echo "uid_t found." ;;
21288*) rp="What is the type for user ids returned by getuid()?"
21289 . ./myread
21290 uidtype="$ans"
21291 ;;
21292esac
21293
613d6c3e 21294: Check size of UID
b4eb6b3d
JH
21295echo " "
21296case "$uidtype" in
21297*_t) zzz="$uidtype" ;;
21298*) zzz="uid" ;;
21299esac
613d6c3e 21300echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
21301cat > try.c <<EOCP
21302#include <sys/types.h>
21303#include <stdio.h>
d1daaddf
JH
21304#$i_stdlib I_STDLIB
21305#ifdef I_STDLIB
21306#include <stdlib.h>
21307#endif
b4eb6b3d
JH
21308int main() {
21309 printf("%d\n", (int)sizeof($uidtype));
21310 exit(0);
21311}
21312EOCP
21313set try
21314if eval $compile_ok; then
5440bc8e 21315 yyy=`$run ./try`
b4eb6b3d
JH
21316 case "$yyy" in
21317 '') uidsize=4
21318 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21319 ;;
21320 *) uidsize=$yyy
21321 echo "Your $zzz is $uidsize bytes long."
21322 ;;
21323 esac
21324else
21325 uidsize=4
21326 echo "(I can't compile the test program--guessing $uidsize.)" >&4
21327fi
21328
613d6c3e 21329: Check if UID is signed
b4eb6b3d
JH
21330echo " "
21331case "$uidtype" in
21332*_t) zzz="$uidtype" ;;
21333*) zzz="uid" ;;
21334esac
21335echo "Checking the sign of $zzz..." >&4
21336cat > try.c <<EOCP
21337#include <sys/types.h>
21338#include <stdio.h>
21339int main() {
21340 $uidtype foo = -1;
21341 if (foo < 0)
21342 printf("-1\n");
21343 else
21344 printf("1\n");
21345}
21346EOCP
21347set try
21348if eval $compile; then
5440bc8e 21349 yyy=`$run ./try`
b4eb6b3d
JH
21350 case "$yyy" in
21351 '') uidsign=1
21352 echo "(I can't execute the test program--guessing unsigned.)" >&4
21353 ;;
21354 *) uidsign=$yyy
21355 case "$uidsign" in
21356 1) echo "Your $zzz is unsigned." ;;
21357 -1) echo "Your $zzz is signed." ;;
21358 esac
21359 ;;
21360 esac
21361else
21362 uidsign=1
21363 echo "(I can't compile the test program--guessing unsigned.)" >&4
21364fi
21365
21366
34f1896b 21367: Check format string for UID
b4eb6b3d
JH
21368echo " "
21369$echo "Checking the format string to be used for uids..." >&4
21370
21371case "$uidsign" in
21372-1) if $test X"$uidsize" = X"$ivsize"; then
21373 uidformat="$ivdformat"
21374 else
21375 if $test X"$uidsize" = X"$longsize"; then
21376 uidformat='"ld"'
21377 else
21378 if $test X"$uidsize" = X"$intsize"; then
21379 uidformat='"d"'
21380 else
21381 if $test X"$uidsize" = X"$shortsize"; then
21382 uidformat='"hd"'
21383 fi
21384 fi
21385 fi
21386 fi
21387 ;;
21388*) if $test X"$uidsize" = X"$uvsize"; then
21389 uidformat="$uvuformat"
21390 else
21391 if $test X"$uidsize" = X"$longsize"; then
21392 uidformat='"lu"'
21393 else
21394 if $test X"$uidsize" = X"$intsize"; then
21395 uidformat='"u"'
21396 else
21397 if $test X"$uidsize" = X"$shortsize"; then
21398 uidformat='"hu"'
21399 fi
21400 fi
21401 fi
21402 fi
21403 ;;
21404esac
21405
d78f9ffa
MB
21406: Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21407echo " "
21408echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21409$cat >try.c <<'EOM'
21410/* Intentionally a long probe as I'd like to sanity check that the exact
21411 approach is going to work, as thinking it will work, but only having it
21412 part working at runtime is worse than not having it. */
21413
21414#include <sys/types.h>
21415#include <sys/sysctl.h>
21416#include <sys/param.h>
21417#include <stdio.h>
21418#include <string.h>
21419#include <stdlib.h>
21420#include <unistd.h>
21421
21422int
21423main(int argc, char **argv) {
21424 char *buffer;
21425 char *argv_leaf = strrchr(argv[0], '/');
21426 char *buffer_leaf;
21427 size_t size = 0;
21428 int mib[4];
21429
21430 mib[0] = CTL_KERN;
21431 mib[1] = KERN_PROC;
21432 mib[2] = KERN_PROC_PATHNAME;
21433 mib[3] = -1;
21434
21435 if (!argv_leaf) {
21436 fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21437 return 1;
21438 }
21439
21440 if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21441 perror("sysctl");
21442 return 2;
21443 }
21444
21445 if (size < strlen(argv_leaf) + 1) {
21446 fprintf(stderr, "size %lu is too short for a path\n",
21447 (unsigned long) size);
21448 return 3;
21449 }
21450
21451 if (size > MAXPATHLEN * MAXPATHLEN) {
21452 fprintf(stderr, "size %lu is too long for a path\n",
21453 (unsigned long) size);
21454 return 4;
21455 }
21456
21457 buffer = malloc(size);
21458 if (!buffer) {
21459 perror("malloc");
21460 return 5;
21461 }
21462
21463 if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21464 perror("sysctl");
21465 return 6;
21466 }
21467
21468 if (strlen(buffer) + 1 != size) {
21469 fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21470 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21471 return 7;
21472 }
21473
21474
21475 if (*buffer != '/') {
21476 fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21477 return 8;
21478 }
21479
21480 if (strstr(buffer, "/./")) {
21481 fprintf(stderr, "Contains /./: '%s'\n", buffer);
21482 return 9;
21483 }
21484
21485 if (strstr(buffer, "/../")) {
21486 fprintf(stderr, "Contains /../: '%s'\n", buffer);
21487 return 10;
21488 }
21489
21490 buffer_leaf = strrchr(buffer, '/');
21491 if (strcmp(buffer_leaf, argv_leaf) != 0) {
21492 fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21493 return 11;
21494 }
21495
21496 free(buffer);
21497
21498 return 0;
21499}
21500EOM
21501
21502val=$undef
21503set try
21504if eval $compile_ok; then
21505 if $run ./try; then
21506 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21507 val="$define"
21508 else
21509 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21510 val="$undef"
21511 fi
21512else
21513 echo "I'm unable to compile the test program." >&4
21514 echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21515 val="$undef"
21516fi
21517$rm_try
21518set usekernprocpathname
21519eval $setvar
21520
21521: Determine if we can use _NSGetExecutablePath to find executing program
21522echo " "
21523echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21524$cat >try.c <<'EOM'
21525/* Intentionally a long probe as I'd like to sanity check that the exact
21526 approach is going to work, as thinking it will work, but only having it
21527 part working at runtime is worse than not having it. */
21528#include <mach-o/dyld.h>
21529#include <stdio.h>
21530#include <stdlib.h>
21531#include <sys/param.h>
21532#include <string.h>
21533
21534int
21535main(int argc, char **argv) {
21536 char buf[1];
21537 uint32_t size = sizeof(buf);
21538 int result;
21539 char *buffer;
21540 char *tidied;
21541 char *argv_leaf = strrchr(argv[0], '/');
21542 char *tidied_leaf;
21543
21544 if (!argv_leaf) {
21545 fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21546 return 1;
21547 }
21548
21549 _NSGetExecutablePath(buf, &size);
21550 if (size > MAXPATHLEN * MAXPATHLEN) {
21551 fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21552 (unsigned int) size);
21553 return 2;
21554 }
21555
21556 buffer = malloc(size);
21557 if (!buffer) {
21558 perror("malloc");
21559 return 3;
21560 }
21561
21562 result = _NSGetExecutablePath(buffer, &size);
21563 if (result != 0) {
21564 fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21565 result, (unsigned int) size);
21566 return 4;
21567 }
21568
21569 tidied = realpath(buffer, NULL);
21570 if (!tidied) {
21571 perror("realpath");
21572 return 5;
21573 }
21574
21575 free(buffer);
21576
21577 if (*tidied != '/') {
21578 fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21579 return 6;
21580 }
21581
21582 if (strstr(tidied, "/./")) {
21583 fprintf(stderr, "Contains /./: '%s'\n", tidied);
21584 return 7;
21585 }
21586
21587 if (strstr(tidied, "/../")) {
21588 fprintf(stderr, "Contains /../: '%s'\n", tidied);
21589 return 8;
21590 }
21591
21592 tidied_leaf = strrchr(tidied, '/');
21593 if (strcmp(tidied_leaf, argv_leaf) != 0) {
21594 fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21595 return 9;
21596 }
21597
21598 free(tidied);
21599
21600 return 0;
21601}
21602EOM
21603
21604val=$undef
21605set try
21606if eval $compile_ok; then
21607 if $run ./try; then
21608 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21609 val="$define"
21610 else
21611 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21612 fi
21613else
21614 echo "I'm unable to compile the test program." >&4
21615 echo "I'll assume no _NSGetExecutablePath here." >&4
21616fi
21617$rm_try
21618set usensgetexecutablepath
21619eval $setvar
21620
34f1896b 21621: Check if site customization support was requested
4afd418c
MB
21622case "$usesitecustomize" in
21623 $define|true|[Yy]*)
21624 usesitecustomize="$define"
21625 ;;
21626 *)
21627 usesitecustomize="$undef"
21628 ;;
21629 esac
21630
d03b3b00
MB
21631: see if prototypes support variable argument declarations
21632echo " "
21633case "$prototype$i_stdarg" in
21634$define$define)
21635 echo "It appears we'll be able to prototype varargs functions." >&4
21636 val="$define"
21637 ;;
21638*)
21639 echo "Too bad... We won't be using prototyped varargs functions..." >&4
21640 val="$undef"
21641 ;;
21642esac
21643set vaproto
21644eval $setvar
21645
3659ebf1
JH
21646: determine compiler compiler
21647case "$yacc" in
21648'')
21649 dflt=yacc;;
21650*)
21651 dflt="$yacc";;
21652esac
21653echo " "
21654comp='yacc'
3c728e00 21655if $test -f "$byacc$_exe"; then
3659ebf1
JH
21656 dflt="$byacc"
21657 comp="byacc or $comp"
21658fi
3c728e00 21659if $test -f "$bison$_exe"; then
3659ebf1
JH
21660 comp="$comp or bison -y"
21661fi
21662rp="Which compiler compiler ($comp) shall I use?"
21663. ./myread
21664yacc="$ans"
21665case "$yacc" in
21666*bis*)
21667 case "$yacc" in
21668 *-y*) ;;
21669 *)
21670 yacc="$yacc -y"
21671 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21672 ;;
21673 esac
21674 ;;
21675esac
21676
c0bacbef
MB
21677: see if this is a assert.h system
21678set assert.h i_assert
21679eval $inhdr
21680
758a5d79
JH
21681: see if this is a fp.h system
21682set fp.h i_fp
21683eval $inhdr
21684
21685: see if this is a fp_class.h system
21686set fp_class.h i_fp_class
21687eval $inhdr
21688
13cfc98d
MB
21689: see if gdbm.h is available
21690set gdbm.h t_gdbm
21691eval $inhdr
21692case "$t_gdbm" in
21693$define)
21694 : see if gdbm_open exists
21695 set gdbm_open d_gdbm_open
21696 eval $inlibc
21697 case "$d_gdbm_open" in
21698 $undef)
21699 t_gdbm="$undef"
21700 echo "We won't be including <gdbm.h>"
21701 ;;
21702 esac
21703 ;;
21704esac
21705val="$t_gdbm"
21706set i_gdbm
21707eval $setvar
21708
b2f871ed
AD
21709: see if this is a ieeefp.h system
21710case "$i_ieeefp" in
21711'' ) set ieeefp.h i_ieeefp
21712 eval $inhdr
21713 ;;
21714esac
21715
21716: see if this is a libutil.h system
21717set libutil.h i_libutil
21718eval $inhdr
21719
21720: see if mach cthreads are available
21721if test "X$usethreads" = "X$define"; then
21722 set mach/cthreads.h i_machcthr
21723 eval $inhdr
21724else
21725 i_machcthr="$undef"
21726fi
21727
21728: see if this is a mntent.h system
21729set mntent.h i_mntent
21730eval $inhdr
21731
b4eb6b3d
JH
21732: see if net/errno.h is available
21733val=''
21734set net/errno.h val
21735eval $inhdr
21736
21737: Unfortunately, it causes problems on some systems. Arrgh.
21738case "$val" in
21739$define)
21740 cat > try.c <<'EOM'
21741#include <stdio.h>
21742#include <errno.h>
21743#include <net/errno.h>
21744int func()
21745{
21746 return ENOTSOCK;
21747}
21748EOM
21749 if $cc $ccflags -c try.c >/dev/null 2>&1; then
21750 echo "We'll be including <net/errno.h>." >&4
21751 else
21752 echo "We won't be including <net/errno.h>." >&4
21753 val="$undef"
21754 fi
5b813a60 21755 $rm_try
b4eb6b3d
JH
21756 ;;
21757esac
21758set i_neterrno
21759eval $setvar
21760
21761: see if netinet/tcp.h is available
21762set netinet/tcp.h i_netinettcp
21763eval $inhdr
21764
21765: see if this is a poll.h system
21766set poll.h i_poll
21767eval $inhdr
21768
21769: see if this is a prot.h system
21770set prot.h i_prot
21771eval $inhdr
21772
613d6c3e 21773: Preprocessor symbols
b4eb6b3d 21774echo " "
ddfca5da 21775$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
b4eb6b3d
JH
21776$cat <<'EOSH' > Cppsym.know
21777a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21778AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
44c87379 21779alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
d46c9a2d
JH
21780ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21781BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
21782BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21783bull c cadmus clipper CMU COFF COMPILER_VERSION
21784concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
8b7d8421 21785CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
21786Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21787FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21788GLIBC GLIBC_MINOR
21789GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
21790H3050R H3050RX hbullx20 hcx host_mips
21791hp200 hp300 hp700 HP700 hp800 hp9000
21792hp9000s200 hp9000s300 hp9000s400 hp9000s500
21793hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21794i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 21795IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
21796INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21797LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21798LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
9c12f1e5 21799LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
b4eb6b3d
JH
21800LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21801M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21802M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21803M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21804MATH_HAS_NO_SIDE_EFFECTS
21805mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21806mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21807mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21808MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21809mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21810NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 21811news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
21812ns32016 ns32332 ns32k nsc32000
21813OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21814pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21815pc532 pdp11 PGC PIC plexus PORTAR posix
21816POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21817POSIX_C_SOURCE POSIX_SOURCE POWER
9c12f1e5 21818PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 21819riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
21820SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21821sony sony_news sonyrisc sparc sparclite spectrum
21822stardent stdc STDC_EXT stratos sun sun3 sun386
21823Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21824SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21825SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21826sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 21827TM3200 TM5400 TM5600
b4eb6b3d
JH
21828tower tower32 tower32_200 tower32_600 tower32_700
21829tower32_800 tower32_850 tss
21830u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21831ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
21832unix UNIX95 UNIX99 unixpc unos
21833USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21834USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21835USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21836USGr4 USGr4_2
44c87379 21837Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
b4eb6b3d
JH
21838XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21839XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21840z8000
21841EOSH
21842# Maybe put other stuff here too.
21843cat <<EOSH >>Cppsym.know
21844$osname
21845EOSH
21846./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21847./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21848$cat Cppsym.know > Cppsym.c
381aa1ff 21849$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
21850$rm -f Cppsym.a Cppsym.b Cppsym.c
21851cat <<EOSH > Cppsym
21852$startsh
21853if $test \$# -gt 0; then
21854 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21855 if $test -s Cppsym.got; then
21856 $rm -f Cppsym.got
21857 exit 0
21858 fi
21859 $rm -f Cppsym.got
21860 exit 1
21861else
21862 $tr " " "$trnl" | ./Cppsym.try
21863 exit 0
21864fi
21865EOSH
21866chmod +x Cppsym
21867$eunicefix Cppsym
21868cat <<EOSH > Cppsym.try
21869$startsh
21870cat <<'EOCP' > try.c
21871#include <stdio.h>
360321b3
YST
21872#if cpp_stuff == 1
21873#define STRINGIFY(a) "a"
21874#endif
21875#if cpp_stuff == 42
21876#define StGiFy(a) #a
21877#define STRINGIFY(a) StGiFy(a)
21878#endif
21879#if $cpp_stuff != 1 && $cpp_stuff != 42
21880# include "Bletch: How does this C preprocessor stringify macros?"
21881#endif
b4eb6b3d
JH
21882int main() {
21883EOCP
21884$awk \\
21885EOSH
21886cat <<'EOSH' >> Cppsym.try
21887'length($1) > 0 {
360321b3
YST
21888 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21889 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21890 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21891 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
b4eb6b3d 21892}' >> try.c
2ef53570 21893echo 'return 0;}' >> try.c
b4eb6b3d
JH
21894EOSH
21895cat <<EOSH >> Cppsym.try
21896ccflags="$ccflags"
21897case "$osname-$gccversion" in
21898irix-) ccflags="\$ccflags -woff 1178" ;;
21899os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21900esac
360321b3 21901$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
b4eb6b3d
JH
21902EOSH
21903chmod +x Cppsym.try
21904$eunicefix Cppsym.try
21905./Cppsym < Cppsym.know > Cppsym.true
ddfca5da 21906: Add in any linux cpp "predefined macros":
b6a7163e 21907case "$osname::$gccversion" in
eeb92b76 21908 *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
b6a7163e
MB
21909 tHdrH=_tmpHdr
21910 rm -f $tHdrH'.h' $tHdrH
21911 touch $tHdrH'.h'
6f5be6d1 21912 if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
b6a7163e
MB
21913 sed 's/#define[\ \ ]*//;s/[\ \ ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21914 if [ -s $tHdrH'_cppsym.real' ]; then
21915 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21916 fi
21917 fi
21918 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21919 ;;
21920esac
b4eb6b3d
JH
21921: now check the C compiler for additional symbols
21922postprocess_cc_v=''
21923case "$osname" in
21924aix) postprocess_cc_v="|$tr , ' '" ;;
21925esac
21926$cat >ccsym <<EOS
21927$startsh
21928$cat >tmp.c <<EOF
21929extern int foo;
21930EOF
21931for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21932do
21933 case "\$i" in
21934 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 21935 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
21936 esac
21937done
5b813a60 21938$rm_try
b4eb6b3d
JH
21939EOS
21940postprocess_cc_v=''
21941chmod +x ccsym
21942$eunicefix ccsym
21943./ccsym > ccsym1.raw
21944if $test -s ccsym1.raw; then
21945 $sort ccsym1.raw | $uniq >ccsym.raw
21946else
21947 mv ccsym1.raw ccsym.raw
21948fi
21949
21950$awk '/\=/ { print $0; next }
21951 { print $0"=1" }' ccsym.raw >ccsym.list
360321b3
YST
21952$comm -13 Cppsym.true ccsym.list >ccsym.own
21953$comm -12 Cppsym.true ccsym.list >ccsym.com
21954$comm -23 Cppsym.true ccsym.list >ccsym.cpp
b4eb6b3d
JH
21955also=''
21956if $test -z ccsym.raw; then
21957 echo "Your C compiler doesn't seem to define any symbols!" >&4
21958 echo " "
21959 echo "However, your C preprocessor defines the following symbols:"
21960 $cat Cppsym.true
21961 ccsymbols=''
21962 cppsymbols=`$cat Cppsym.true`
21963 cppsymbols=`echo $cppsymbols`
21964 cppccsymbols="$cppsymbols"
21965else
21966 if $test -s ccsym.com; then
21967 echo "Your C compiler and pre-processor define these symbols:"
21968 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21969 also='also '
21970 symbols='ones'
21971 cppccsymbols=`$cat ccsym.com`
21972 cppccsymbols=`echo $cppccsymbols`
21973 $test "$silent" || sleep 1
21974 fi
21975 if $test -s ccsym.cpp; then
21976 $test "$also" && echo " "
21977 echo "Your C pre-processor ${also}defines the following symbols:"
21978 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21979 also='further '
21980 cppsymbols=`$cat ccsym.cpp`
21981 cppsymbols=`echo $cppsymbols`
21982 $test "$silent" || sleep 1
21983 fi
21984 if $test -s ccsym.own; then
21985 $test "$also" && echo " "
21986 echo "Your C compiler ${also}defines the following cpp symbols:"
21987 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21988 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21989 ccsymbols=`$cat ccsym.own`
21990 ccsymbols=`echo $ccsymbols`
21991 $test "$silent" || sleep 1
21992 fi
21993fi
b4eb6b3d
JH
21994
21995: see if this is a termio system
21996val="$undef"
21997val2="$undef"
21998val3="$undef"
21999if $test `./findhdr termios.h`; then
22000 set tcsetattr i_termios
22001 eval $inlibc
22002 val3="$i_termios"
22003fi
22004echo " "
22005case "$val3" in
22006"$define") echo "You have POSIX termios.h... good!" >&4;;
22007*) if ./Cppsym pyr; then
22008 case "`/bin/universe`" in
22009 ucb) if $test `./findhdr sgtty.h`; then
22010 val2="$define"
22011 echo "<sgtty.h> found." >&4
22012 else
22013 echo "System is pyramid with BSD universe."
216dac04 22014 ./warn "<sgtty.h> not found--you could have problems."
b4eb6b3d
JH
22015 fi;;
22016 *) if $test `./findhdr termio.h`; then
22017 val="$define"
22018 echo "<termio.h> found." >&4
22019 else
22020 echo "System is pyramid with USG universe."
216dac04 22021 ./warn "<termio.h> not found--you could have problems."
b4eb6b3d
JH
22022 fi;;
22023 esac
22024 elif ./usg; then
22025 if $test `./findhdr termio.h`; then
22026 echo "<termio.h> found." >&4
22027 val="$define"
22028 elif $test `./findhdr sgtty.h`; then
22029 echo "<sgtty.h> found." >&4
22030 val2="$define"
22031 else
216dac04 22032 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
b4eb6b3d
JH
22033 fi
22034 else
22035 if $test `./findhdr sgtty.h`; then
22036 echo "<sgtty.h> found." >&4
22037 val2="$define"
22038 elif $test `./findhdr termio.h`; then
22039 echo "<termio.h> found." >&4
22040 val="$define"
22041 else
216dac04 22042 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
b4eb6b3d
JH
22043 fi
22044 fi;;
22045esac
22046set i_termio; eval $setvar
22047val=$val2; set i_sgtty; eval $setvar
22048val=$val3; set i_termios; eval $setvar
22049
bd31be4b 22050: see if stdbool is available
0dcb3d88
MB
22051: we want a real compile instead of Inhdr because some Solaris systems
22052: have stdbool.h, but it can only be used if the compiler indicates it
22053: is sufficiently c99-compliant.
22054echo " "
22055$cat >try.c <<EOCP
22056#include <stdio.h>
22057#include <stdbool.h>
22058int func(bool x)
22059{
22060 return x ? 1 : 0;
22061}
22062int main(int argc, char **argv)
22063{
22064 return func(0);
22065}
22066EOCP
22067set try
22068if eval $compile; then
22069 echo "<stdbool.h> found." >&4
22070 val="$define"
22071else
22072 echo "<stdbool.h> NOT found." >&4
22073 val="$undef"
22074fi
22075$rm_try
22076set i_stdbool
22077eval $setvar
bd31be4b 22078
b4eb6b3d
JH
22079: see if stddef is available
22080set stddef.h i_stddef
22081eval $inhdr
923fc586 22082
b4eb6b3d
JH
22083: see if sys/access.h is available
22084set sys/access.h i_sysaccess
22085eval $inhdr
22086
22087: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22088set sys/filio.h i_sysfilio
22089eval $inhdr
22090echo " "
22091if $test `./findhdr sys/ioctl.h`; then
22092 val="$define"
22093 echo '<sys/ioctl.h> found.' >&4
22094else
22095 val="$undef"
22096 if $test $i_sysfilio = "$define"; then
22097 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 22098 else
b4eb6b3d
JH
22099 $test $i_sgtty = "$define" && xxx="sgtty.h"
22100 $test $i_termio = "$define" && xxx="termio.h"
22101 $test $i_termios = "$define" && xxx="termios.h"
22102echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22103 fi
22104fi
22105set i_sysioctl
22106eval $setvar
22107
49a78c82
JH
22108: see if socket ioctl defs are in sys/sockio.h
22109echo " "
22110xxx=`./findhdr sys/sockio.h`
22111if $test "$xxx"; then
22112 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22113 val="$define"
22114 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22115 else
22116 val="$undef"
22117 echo "No socket ioctls found in <sys/sockio.h>." >&4
22118 fi
22119else
22120 val="$undef"
22121 $cat <<EOM
22122<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22123EOM
22124fi
22125set i_syssockio
22126eval $setvar
22127
b4eb6b3d
JH
22128: see if this is a syslog.h system
22129set syslog.h i_syslog
22130eval $inhdr
22131
b4eb6b3d
JH
22132: see if this is a sys/mode.h system
22133set sys/mode.h i_sysmode
22134eval $inhdr
22135
216dac04
MB
22136: see if there is a sys/poll.h file
22137set sys/poll.h i_syspoll
22138eval $inhdr
22139
b4eb6b3d
JH
22140: see if sys/resource.h has to be included
22141set sys/resource.h i_sysresrc
22142eval $inhdr
22143
22144: see if sys/security.h is available
22145set sys/security.h i_syssecrt
22146eval $inhdr
22147
22148: see if this is a sys/statvfs.h system
22149set sys/statvfs.h i_sysstatvfs
22150eval $inhdr
22151
b4eb6b3d
JH
22152: see if this is a sys/un.h system
22153set sys/un.h i_sysun
22154eval $inhdr
22155
b4eb6b3d
JH
22156: see if this is a sys/utsname.h system
22157set sys/utsname.h i_sysutsname
22158eval $inhdr
22159
22160: see if this is a syswait system
22161set sys/wait.h i_syswait
22162eval $inhdr
22163
22164: see if this is a ustat.h system
22165set ustat.h i_ustat
22166eval $inhdr
22167
22168: see if this is an utime system
22169set utime.h i_utime
22170eval $inhdr
22171
b4eb6b3d
JH
22172: see if this is a vfork system
22173case "$d_vfork" in
22174"$define")
22175 set vfork.h i_vfork
22176 eval $inhdr
22177 ;;
22178*)
22179 i_vfork="$undef"
22180 ;;
22181esac
22182
613d6c3e 22183: Check extensions
b4eb6b3d
JH
22184echo " "
22185echo "Looking for extensions..." >&4
22186: If we are using the old config.sh, known_extensions may contain
22187: old or inaccurate or duplicate values.
22188known_extensions=''
22189nonxs_extensions=''
22190: We do not use find because it might not be available.
22191: We do not just use MANIFEST because the user may have dropped
22192: some additional extensions into the source tree and expect them
22193: to be built.
22194
38fddf8b
MB
22195: Function to recursively find available extensions, ignoring DynaLoader
22196: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
4cc80fc4 22197: In 5.10.1 and later, extensions are stored in directories
88a6f4fc 22198: like File-Glob instead of the older File/Glob/.
b4eb6b3d
JH
22199find_extensions='
22200 for xxx in *; do
822a6ee0
MB
22201 case "$xxx" in
22202 DynaLoader|dynaload) ;;
22203 *)
238a6851
NC
22204 this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22205 leaf=`echo $xxx | $sed -e s/.*-//`;
dd6c21be 22206 if $test -d File; then
38fddf8b
MB
22207 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
22208 known_extensions="$known_extensions $1$this_ext";
22209 elif $test -f $xxx/Makefile.PL; then
22210 nonxs_extensions="$nonxs_extensions $1$this_ext";
22211 else
22212 if $test -d $xxx -a $# -lt 10; then
22213 set $1$xxx/ $*;
22214 cd "$xxx";
22215 eval $find_extensions;
22216 cd ..;
22217 shift;
22218 fi;
22219 fi;
dd6c21be 22220 else
86429348
NC
22221 echo " $known_extensions $nonxs_extensions" > $$.tmp;
22222 if $contains " $this_ext " $$.tmp; then
01db32e2 22223 echo >&4;
86429348
NC
22224 echo "Duplicate directories detected for extension $xxx" >&4;
22225 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22226 case "$knowitall" in
22227 "") dflt=y;;
22228 *) dflt=n;;
22229 esac;
22230 . ../UU/myread;
22231 case "$ans" in
22232 n*|N*) ;;
01db32e2
NC
22233 *) echo >&4;
22234 echo "Ok. Stopping Configure." >&4;
86429348
NC
22235 echo "Please remove the duplicate directory (eg using git clean) and then re-run Configure" >&4;
22236 exit 1;;
22237 esac;
22238 echo "Ok. You will need to correct config.sh before running make." >&4;
22239 fi;
dd6c21be
NC
22240 $ls -1 $xxx > $$.tmp;
22241 if $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22242 known_extensions="$known_extensions $this_ext";
22243 elif $contains "\.c$" $$.tmp > /dev/null 2>&1; then
22244 known_extensions="$known_extensions $this_ext";
dd6c21be
NC
22245 elif $test -d $xxx; then
22246 nonxs_extensions="$nonxs_extensions $this_ext";
22247 fi;
22248 $rm -f $$.tmp;
822a6ee0
MB
22249 fi
22250 ;;
22251 esac;
b4eb6b3d
JH
22252 done'
22253tdir=`pwd`
dd6c21be
NC
22254cd "$rsrc/cpan"
22255set X
22256shift
22257eval $find_extensions
a193a2db
NC
22258cd "$rsrc/dist"
22259set X
22260shift
22261eval $find_extensions
6904989c 22262cd "$rsrc/ext"
b4eb6b3d
JH
22263set X
22264shift
22265eval $find_extensions
38fddf8b
MB
22266if $test -d File-Glob; then
22267 : All ext/ flattened
22268else
22269 # Special case: Add in modules that nest beyond the first level.
22270 # Currently threads/shared and Hash/Util/FieldHash, since they are
22271 # not picked up by the recursive find above (and adding in general
22272 # recursive finding breaks SDBM_File/sdbm).
22273 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
22274 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
22275fi
faae14e6
MB
22276set X $known_extensions
22277shift
a32b3e13 22278known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
b4eb6b3d
JH
22279set X $nonxs_extensions
22280shift
a32b3e13 22281nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
6904989c 22282cd "$tdir"
b4eb6b3d
JH
22283
22284: Now see which are supported on this system.
22285avail_ext=''
22286for xxx in $known_extensions ; do
22287 case "$xxx" in
22288 DB_File|db_file)
22289 case "$i_db" in
22290 $define) avail_ext="$avail_ext $xxx" ;;
22291 esac
22292 ;;
22293 GDBM_File|gdbm_fil)
7c345082 22294 case "$i_gdbm" in
b4eb6b3d
JH
22295 $define) avail_ext="$avail_ext $xxx" ;;
22296 esac
22297 ;;
1d59c593 22298 I18N/Langinfo|i18n_lan)
7c345082 22299 case "$i_langinfo$d_nl_langinfo" in
4bbcc6e8
JH
22300 $define$define) avail_ext="$avail_ext $xxx" ;;
22301 esac
22302 ;;
7978b0db
JH
22303 IPC/SysV|ipc/sysv)
22304 : XXX Do we need a useipcsysv variable here
22305 case "${d_msg}${d_sem}${d_shm}" in
22306 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22307 esac
22308 ;;
b4eb6b3d 22309 NDBM_File|ndbm_fil)
7894ad66 22310 case "$d_ndbm" in
b4eb6b3d
JH
22311 $define)
22312 case "$osname-$use64bitint" in
0be9fa5d 22313 hpux-define)
b4eb6b3d
JH
22314 case "$libs" in
22315 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22316 esac
22317 ;;
22318 *) avail_ext="$avail_ext $xxx" ;;
22319 esac
22320 ;;
22321 esac
22322 ;;
7c345082 22323 ODBM_File|odbm_fil)
b4eb6b3d
JH
22324 case "${i_dbm}${i_rpcsvcdbm}" in
22325 *"${define}"*)
7978b0db
JH
22326 case "$d_cplusplus" in
22327 define) ;; # delete as a function name will not work
22328 *) case "$osname-$use64bitint" in
22329 hpux-define)
22330 case "$libs" in
22331 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22332 esac
22333 ;;
22334 *) avail_ext="$avail_ext $xxx" ;;
b4eb6b3d
JH
22335 esac
22336 ;;
b4eb6b3d
JH
22337 esac
22338 ;;
22339 esac
22340 ;;
7978b0db
JH
22341 Opcode|opcode)
22342 case "$useopcode" in
b4eb6b3d
JH
22343 true|define|y) avail_ext="$avail_ext $xxx" ;;
22344 esac
22345 ;;
7978b0db
JH
22346 POSIX|posix)
22347 case "$useposix" in
b4eb6b3d
JH
22348 true|define|y) avail_ext="$avail_ext $xxx" ;;
22349 esac
22350 ;;
22351 Socket|socket)
7c345082 22352 case "$d_socket" in
4a9f028c
JH
22353 true|$define|y)
22354 case "$osname" in
22355 beos) ;; # not unless BONE
22356 *) avail_ext="$avail_ext $xxx" ;;
22357 esac
22358 ;;
b4eb6b3d
JH
22359 esac
22360 ;;
22361 Sys/Syslog|sys/syslog)
22362 : XXX syslog requires socket
7c345082 22363 case "$d_socket" in
b4eb6b3d
JH
22364 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22365 esac
22366 ;;
22367 Thread|thread)
b00ec89b
AB
22368 case "$usethreads" in
22369 true|$define|y)
47f9f84c 22370 case "$use5005threads" in
3f30fabf 22371 $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
b00ec89b 22372 esac
b4eb6b3d
JH
22373 esac
22374 ;;
7978b0db
JH
22375 threads|threads/shared)
22376 # threads and threads::shared are special cases.
22377 # To stop people from asking "Perl 5.8.0 was supposed
22378 # to have this new fancy threads implementation but my
22379 # perl doesn't have it" and from people trying to
22380 # (re)install the threads module using CPAN.pm and
22381 # CPAN.pm then offering to reinstall Perl 5.8.0,
22382 # the threads.pm and threads/shared.pm will always be
22383 # there, croaking informatively ("you need to rebuild
22384 # all of Perl with threads, sorry") when threads haven't
22385 # been compiled in.
22386 # --jhi
22387 avail_ext="$avail_ext $xxx"
22388 ;;
aefe3e7e
NC
22389 VMS*)
22390 ;;
78ff2d7b 22391 Win32*)
b149d92d
JD
22392 case "$osname" in
22393 cygwin) avail_ext="$avail_ext $xxx" ;;
22394 esac
22395 ;;
f9b6ed1c
AD
22396 XS/APItest|xs/apitest)
22397 # This is just for testing. Skip it unless we have dynamic loading.
88e1f1a2
JV
22398
22399 case "$usedl" in
22400 $define) avail_ext="$avail_ext $xxx" ;;
22401 esac
22402 ;;
f9b6ed1c
AD
22403 XS/Typemap|xs/typemap)
22404 # This is just for testing. Skip it unless we have dynamic loading.
22405 case "$usedl" in
22406 $define) avail_ext="$avail_ext $xxx" ;;
22407 esac
22408 ;;
b4eb6b3d 22409 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
22410 ;;
22411 esac
b4eb6b3d 22412done
5f80c64f 22413
b4eb6b3d
JH
22414set X $avail_ext
22415shift
22416avail_ext="$*"
5f80c64f 22417
ef0c5be8
JH
22418case "$onlyextensions" in
22419'') ;;
22420*) keepextensions=''
cd95ead5 22421 echo "You have requested that only certain extensions be included..." >&4
ef0c5be8
JH
22422 for i in $onlyextensions; do
22423 case " $avail_ext " in
22424 *" $i "*)
22425 echo "Keeping extension $i."
22426 keepextensions="$keepextensions $i"
22427 ;;
22428 *) echo "Ignoring extension $i." ;;
22429 esac
22430 done
22431 avail_ext="$keepextensions"
22432 ;;
22433esac
22434
22435case "$noextensions" in
22436'') ;;
22437*) keepextensions=''
22438 echo "You have requested that certain extensions be ignored..." >&4
22439 for i in $avail_ext; do
c3dadc13
AD
22440 case " $noextensions " in
22441 *" $i "*) echo "Ignoring extension $i." ;;
ef0c5be8
JH
22442 *) echo "Keeping extension $i.";
22443 keepextensions="$keepextensions $i"
22444 ;;
22445 esac
22446 done
22447 avail_ext="$keepextensions"
22448 ;;
22449esac
22450
b4eb6b3d
JH
22451: Now see which nonxs extensions are supported on this system.
22452: For now assume all are.
22453nonxs_ext=''
22454for xxx in $nonxs_extensions ; do
22455 case "$xxx" in
22456 *) nonxs_ext="$nonxs_ext $xxx"
22457 ;;
22458 esac
22459done
5f80c64f 22460
b4eb6b3d
JH
22461set X $nonxs_ext
22462shift
22463nonxs_ext="$*"
22464
22465case $usedl in
22466$define)
22467 $cat <<EOM
22468A number of extensions are supplied with $package. You may choose to
22469compile these extensions for dynamic loading (the default), compile
22470them into the $package executable (static loading), or not include
22471them at all. Answer "none" to include no extensions.
22472Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
22473
22474EOM
b4eb6b3d 22475 case "$dynamic_ext" in
736accd3
YST
22476 '')
22477 : Exclude those listed in static_ext
22478 dflt=''
22479 for xxx in $avail_ext; do
22480 case " $static_ext " in
22481 *" $xxx "*) ;;
22482 *) dflt="$dflt $xxx" ;;
22483 esac
22484 done
22485 set X $dflt
22486 shift
22487 dflt="$*"
22488 ;;
b4eb6b3d
JH
22489 *) dflt="$dynamic_ext"
22490 # Perhaps we are reusing an old out-of-date config.sh.
22491 case "$hint" in
22492 previous)
22493 if test X"$dynamic_ext" != X"$avail_ext"; then
22494 $cat <<EOM
7c345082
RGS
22495NOTICE: Your previous config.sh list may be incorrect.
22496The extensions now available to you are
b4eb6b3d
JH
22497 ${avail_ext}
22498but the default list from your previous config.sh is
7c345082 22499 ${dynamic_ext}
9c839522 22500
b4eb6b3d
JH
22501EOM
22502 fi
9c839522
PM
22503 ;;
22504 esac
b4eb6b3d
JH
22505 ;;
22506 esac
5f80c64f 22507 case "$dflt" in
b4eb6b3d
JH
22508 '') dflt=none;;
22509 esac
22510 rp="What extensions do you wish to load dynamically?"
22511 . ./myread
22512 case "$ans" in
22513 none) dynamic_ext=' ' ;;
22514 *) dynamic_ext="$ans" ;;
5f80c64f 22515 esac
5f80c64f 22516
b4eb6b3d
JH
22517 case "$static_ext" in
22518 '')
22519 : Exclude those already listed in dynamic linking
22520 dflt=''
22521 for xxx in $avail_ext; do
22522 case " $dynamic_ext " in
22523 *" $xxx "*) ;;
22524 *) dflt="$dflt $xxx" ;;
22525 esac
22526 done
22527 set X $dflt
22528 shift
22529 dflt="$*"
22530 ;;
7c345082 22531 *) dflt="$static_ext"
b4eb6b3d
JH
22532 ;;
22533 esac
9c839522 22534
b4eb6b3d
JH
22535 case "$dflt" in
22536 '') dflt=none;;
22537 esac
22538 rp="What extensions do you wish to load statically?"
22539 . ./myread
22540 case "$ans" in
22541 none) static_ext=' ' ;;
22542 *) static_ext="$ans" ;;
22543 esac
22544 ;;
22545*)
22546 $cat <<EOM
7c345082
RGS
22547A number of extensions are supplied with $package. Answer "none"
22548to include no extensions.
b4eb6b3d 22549Note that DynaLoader is always built and need not be mentioned here.
9c839522 22550
b4eb6b3d
JH
22551EOM
22552 case "$static_ext" in
22553 '') dflt="$avail_ext" ;;
22554 *) dflt="$static_ext"
22555 # Perhaps we are reusing an old out-of-date config.sh.
22556 case "$hint" in
22557 previous)
22558 if test X"$static_ext" != X"$avail_ext"; then
22559 $cat <<EOM
7c345082
RGS
22560NOTICE: Your previous config.sh list may be incorrect.
22561The extensions now available to you are
b4eb6b3d
JH
22562 ${avail_ext}
22563but the default list from your previous config.sh is
7c345082 22564 ${static_ext}
5f80c64f
JH
22565
22566EOM
b4eb6b3d
JH
22567 fi
22568 ;;
22569 esac
22570 ;;
22571 esac
22572 : Exclude those that are not xs extensions
22573 case "$dflt" in
22574 '') dflt=none;;
22575 esac
22576 rp="What extensions do you wish to include?"
22577 . ./myread
22578 case "$ans" in
22579 none) static_ext=' ' ;;
22580 *) static_ext="$ans" ;;
22581 esac
22582 ;;
5f80c64f 22583esac
7c345082 22584#
f1f6834f
AD
22585# Encode is a special case. If we are building Encode as a static
22586# extension, we need to explicitly list its subextensions as well.
22587# For other nested extensions, this is handled automatically by
22588# the appropriate Makefile.PL.
22589case " $static_ext " in
22590 *" Encode "*) # Add the subextensions of Encode
d9a4b459 22591 cd "$rsrc/cpan"
f1f6834f
AD
22592 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22593 static_ext="$static_ext Encode/$xxx"
22594 done
22595 cd "$tdir"
22596 ;;
22597esac
5f80c64f 22598
b4eb6b3d
JH
22599set X $dynamic_ext $static_ext $nonxs_ext
22600shift
22601extensions="$*"
22602
93a2cd18
AD
22603# Sanity check: We require an extension suitable for use with
22604# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
22605# should show up as failures in the test suite, but it's helpful to
22606# catch them now.) The 'extensions' list is normally sorted
22607# alphabetically, so we need to accept either
22608# DB_File ... Fcntl ... IO ....
22609# or something like
22610# Fcntl ... NDBM_File ... IO ....
42fde7b2
JH
22611case " $extensions" in
22612*"_File "*" Fcntl "*" IO "*) ;; # DB_File
22613*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22614*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
7a8675bc
JH
22615*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22616 echo "WARNING: The Perl you are building will be quite crippled." >& 4
22617 ;;
22618esac
22619
9c839522
PM
22620: Remove libraries needed only for extensions
22621: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
22622: The exception is SunOS 4.x, which needs them.
22623case "${osname}X${osvers}" in
22624sunos*X4*)
22625 perllibs="$libs"
22626 ;;
22627*) case "$usedl" in
22628 $define|true|[yY]*)
a33f2d9f 22629 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
eedaba54
PM
22630 shift
22631 perllibs="$*"
22632 ;;
22633 *) perllibs="$libs"
22634 ;;
22635 esac
22636 ;;
9c839522 22637esac
5f80c64f
JH
22638
22639: Remove build directory name from cppstdin so it can be used from
22640: either the present location or the final installed location.
22641echo " "
22642: Get out of the UU directory to get correct path name.
22643cd ..
22644case "$cppstdin" in
22645`pwd`/cppstdin)
22646 echo "Stripping down cppstdin path name"
22647 cppstdin=cppstdin
22648 ;;
22649esac
22650cd UU
22651
22652: end of configuration questions
22653echo " "
22654echo "End of configuration questions."
22655echo " "
22656
22657: back to where it started
22658if test -d ../UU; then
22659 cd ..
22660fi
22661
776a38e3 22662: configuration may be unconditionally patched via a 'config.arch' file
48370efc 22663if $test -f config.arch; then
776a38e3 22664 echo "I see a config.arch file, loading it." >&4
48370efc
JH
22665 . ./config.arch
22666fi
22667
5f80c64f
JH
22668: configuration may be patched via a 'config.over' file
22669if $test -f config.over; then
22670 echo " "
22671 dflt=y
22672 rp='I see a config.over file. Do you wish to load it?'
22673 . UU/myread
22674 case "$ans" in
22675 n*) echo "OK, I'll ignore it.";;
22676 *) . ./config.over
22677 echo "Configuration override changes have been loaded."
22678 ;;
22679 esac
22680fi
22681
22682: in case they want portability, strip down executable paths
22683case "$d_portable" in
22684"$define")
22685 echo " "
22686 echo "Stripping down executable paths..." >&4
22687 for file in $loclist $trylist; do
534ac15a
JH
22688 eval temp=\$$file
22689 eval $file=`basename $temp`
5f80c64f
JH
22690 done
22691 ;;
22692esac
22693
22694: create config.sh file
22695echo " "
22696echo "Creating config.sh..." >&4
22697$spitshell <<EOT >config.sh
22698$startsh
22699#
22700# This file was produced by running the Configure script. It holds all the
22701# definitions figured out by Configure. Should you modify one of these values,
22702# do not forget to propagate your changes by running "Configure -der". You may
22703# instead choose to run each of the .SH files by yourself, or "Configure -S".
22704#
22705
22706# Package name : $package
22707# Source directory : $src
22708# Configuration time: $cf_time
22709# Configured by : $cf_by
22710# Target system : $myuname
22711
776a38e3 22712EOT
94a9a4bc 22713: Add in command line options if available
776a38e3 22714$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
94a9a4bc 22715
776a38e3
MB
22716$spitshell <<EOT >>config.sh
22717
5f80c64f
JH
22718Author='$Author'
22719Date='$Date'
22720Header='$Header'
22721Id='$Id'
22722Locker='$Locker'
22723Log='$Log'
5f80c64f
JH
22724RCSfile='$RCSfile'
22725Revision='$Revision'
22726Source='$Source'
22727State='$State'
22728_a='$_a'
22729_exe='$_exe'
22730_o='$_o'
b4eb6b3d 22731afs='$afs'
a6d26a0d 22732afsroot='$afsroot'
b4eb6b3d
JH
22733alignbytes='$alignbytes'
22734ansi2knr='$ansi2knr'
22735aphostname='$aphostname'
22736api_revision='$api_revision'
22737api_subversion='$api_subversion'
22738api_version='$api_version'
22739api_versionstring='$api_versionstring'
5f80c64f 22740ar='$ar'
b4eb6b3d
JH
22741archlib='$archlib'
22742archlibexp='$archlibexp'
22743archname64='$archname64'
22744archname='$archname'
5f80c64f 22745archobjs='$archobjs'
10bc17b6 22746asctime_r_proto='$asctime_r_proto'
5f80c64f 22747awk='$awk'
b4eb6b3d 22748baserev='$baserev'
5f80c64f 22749bash='$bash'
b4eb6b3d 22750bin='$bin'
f1ce3bf1 22751bin_ELF='$bin_ELF'
b4eb6b3d 22752binexp='$binexp'
5f80c64f
JH
22753bison='$bison'
22754byacc='$byacc'
b4eb6b3d 22755byteorder='$byteorder'
5f80c64f 22756c='$c'
b4eb6b3d 22757castflags='$castflags'
5f80c64f
JH
22758cat='$cat'
22759cc='$cc'
22760cccdlflags='$cccdlflags'
22761ccdlflags='$ccdlflags'
22762ccflags='$ccflags'
b4eb6b3d 22763ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 22764ccname='$ccname'
b4eb6b3d 22765ccsymbols='$ccsymbols'
6b356c8e 22766ccversion='$ccversion'
5f80c64f 22767cf_by='$cf_by'
b4eb6b3d 22768cf_email='$cf_email'
5f80c64f 22769cf_time='$cf_time'
c193ef60
MB
22770charbits='$charbits'
22771charsize='$charsize'
5f80c64f
JH
22772chgrp='$chgrp'
22773chmod='$chmod'
22774chown='$chown'
b4eb6b3d 22775clocktype='$clocktype'
5f80c64f
JH
22776comm='$comm'
22777compress='$compress'
22778contains='$contains'
22779cp='$cp'
22780cpio='$cpio'
22781cpp='$cpp'
b4eb6b3d
JH
22782cpp_stuff='$cpp_stuff'
22783cppccsymbols='$cppccsymbols'
5f80c64f
JH
22784cppflags='$cppflags'
22785cpplast='$cpplast'
22786cppminus='$cppminus'
22787cpprun='$cpprun'
22788cppstdin='$cppstdin'
b4eb6b3d 22789cppsymbols='$cppsymbols'
10bc17b6 22790crypt_r_proto='$crypt_r_proto'
b4eb6b3d 22791cryptlib='$cryptlib'
5f80c64f 22792csh='$csh'
10bc17b6
JH
22793ctermid_r_proto='$ctermid_r_proto'
22794ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
22795d_Gconvert='$d_Gconvert'
22796d_PRIEUldbl='$d_PRIEUldbl'
22797d_PRIFUldbl='$d_PRIFUldbl'
22798d_PRIGUldbl='$d_PRIGUldbl'
22799d_PRIXU64='$d_PRIXU64'
22800d_PRId64='$d_PRId64'
22801d_PRIeldbl='$d_PRIeldbl'
22802d_PRIfldbl='$d_PRIfldbl'
22803d_PRIgldbl='$d_PRIgldbl'
22804d_PRIi64='$d_PRIi64'
22805d_PRIo64='$d_PRIo64'
22806d_PRIu64='$d_PRIu64'
22807d_PRIx64='$d_PRIx64'
22808d_SCNfldbl='$d_SCNfldbl'
74cac757 22809d__fwalk='$d__fwalk'
b4eb6b3d
JH
22810d_access='$d_access'
22811d_accessx='$d_accessx'
55954f19 22812d_aintl='$d_aintl'
b4eb6b3d
JH
22813d_alarm='$d_alarm'
22814d_archlib='$d_archlib'
96938616 22815d_asctime64='$d_asctime64'
10bc17b6 22816d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
22817d_atolf='$d_atolf'
22818d_atoll='$d_atoll'
fcdf39cf 22819d_attribute_deprecated='$d_attribute_deprecated'
0dbb1585
AL
22820d_attribute_format='$d_attribute_format'
22821d_attribute_malloc='$d_attribute_malloc'
22822d_attribute_nonnull='$d_attribute_nonnull'
22823d_attribute_noreturn='$d_attribute_noreturn'
22824d_attribute_pure='$d_attribute_pure'
22825d_attribute_unused='$d_attribute_unused'
22826d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
b4eb6b3d
JH
22827d_bcmp='$d_bcmp'
22828d_bcopy='$d_bcopy'
5f80c64f 22829d_bsd='$d_bsd'
b4eb6b3d
JH
22830d_bsdgetpgrp='$d_bsdgetpgrp'
22831d_bsdsetpgrp='$d_bsdsetpgrp'
635aebb7
AL
22832d_builtin_choose_expr='$d_builtin_choose_expr'
22833d_builtin_expect='$d_builtin_expect'
b4eb6b3d 22834d_bzero='$d_bzero'
a2d23ec2 22835d_c99_variadic_macros='$d_c99_variadic_macros'
b4eb6b3d
JH
22836d_casti32='$d_casti32'
22837d_castneg='$d_castneg'
22838d_charvspr='$d_charvspr'
22839d_chown='$d_chown'
22840d_chroot='$d_chroot'
22841d_chsize='$d_chsize'
758a5d79 22842d_class='$d_class'
b0a2e8e6 22843d_clearenv='$d_clearenv'
b4eb6b3d 22844d_closedir='$d_closedir'
4e0554ec 22845d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 22846d_const='$d_const'
55954f19 22847d_copysignl='$d_copysignl'
666ea192 22848d_cplusplus='$d_cplusplus'
b4eb6b3d 22849d_crypt='$d_crypt'
10bc17b6 22850d_crypt_r='$d_crypt_r'
b4eb6b3d 22851d_csh='$d_csh'
13cfc98d 22852d_ctermid='$d_ctermid'
10bc17b6 22853d_ctermid_r='$d_ctermid_r'
96938616 22854d_ctime64='$d_ctime64'
10bc17b6 22855d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
22856d_cuserid='$d_cuserid'
22857d_dbl_dig='$d_dbl_dig'
2ef53570 22858d_dbminitproto='$d_dbminitproto'
96938616 22859d_difftime64='$d_difftime64'
b4eb6b3d 22860d_difftime='$d_difftime'
de52168c 22861d_dir_dd_fd='$d_dir_dd_fd'
ae0e3d3b 22862d_dirfd='$d_dirfd'
b4eb6b3d
JH
22863d_dirnamlen='$d_dirnamlen'
22864d_dlerror='$d_dlerror'
5f80c64f 22865d_dlopen='$d_dlopen'
b4eb6b3d
JH
22866d_dlsymun='$d_dlsymun'
22867d_dosuid='$d_dosuid'
10bc17b6 22868d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
22869d_drand48proto='$d_drand48proto'
22870d_dup2='$d_dup2'
22871d_eaccess='$d_eaccess'
22872d_endgrent='$d_endgrent'
10bc17b6 22873d_endgrent_r='$d_endgrent_r'
b4eb6b3d 22874d_endhent='$d_endhent'
10bc17b6 22875d_endhostent_r='$d_endhostent_r'
b4eb6b3d 22876d_endnent='$d_endnent'
10bc17b6 22877d_endnetent_r='$d_endnetent_r'
b4eb6b3d 22878d_endpent='$d_endpent'
10bc17b6 22879d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 22880d_endpwent='$d_endpwent'
10bc17b6 22881d_endpwent_r='$d_endpwent_r'
b4eb6b3d 22882d_endsent='$d_endsent'
10bc17b6 22883d_endservent_r='$d_endservent_r'
b4eb6b3d 22884d_eofnblk='$d_eofnblk'
5f80c64f 22885d_eunice='$d_eunice'
15b61c98 22886d_faststdio='$d_faststdio'
b363b713 22887d_fchdir='$d_fchdir'
b4eb6b3d
JH
22888d_fchmod='$d_fchmod'
22889d_fchown='$d_fchown'
22890d_fcntl='$d_fcntl'
9d9004a9 22891d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
22892d_fd_macros='$d_fd_macros'
22893d_fd_set='$d_fd_set'
22894d_fds_bits='$d_fds_bits'
22895d_fgetpos='$d_fgetpos'
758a5d79
JH
22896d_finite='$d_finite'
22897d_finitel='$d_finitel'
b4eb6b3d
JH
22898d_flexfnam='$d_flexfnam'
22899d_flock='$d_flock'
2ef53570 22900d_flockproto='$d_flockproto'
b4eb6b3d 22901d_fork='$d_fork'
758a5d79 22902d_fp_class='$d_fp_class'
b4eb6b3d 22903d_fpathconf='$d_fpathconf'
758a5d79
JH
22904d_fpclass='$d_fpclass'
22905d_fpclassify='$d_fpclassify'
22906d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
22907d_fpos64_t='$d_fpos64_t'
22908d_frexpl='$d_frexpl'
22909d_fs_data_s='$d_fs_data_s'
22910d_fseeko='$d_fseeko'
22911d_fsetpos='$d_fsetpos'
22912d_fstatfs='$d_fstatfs'
22913d_fstatvfs='$d_fstatvfs'
411ab01c 22914d_fsync='$d_fsync'
b4eb6b3d
JH
22915d_ftello='$d_ftello'
22916d_ftime='$d_ftime'
dc814df1 22917d_futimes='$d_futimes'
e74475c7
MHM
22918d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22919d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
5086dff9 22920d_getaddrinfo='$d_getaddrinfo'
b4eb6b3d
JH
22921d_getcwd='$d_getcwd'
22922d_getespwnam='$d_getespwnam'
22923d_getfsstat='$d_getfsstat'
22924d_getgrent='$d_getgrent'
10bc17b6
JH
22925d_getgrent_r='$d_getgrent_r'
22926d_getgrgid_r='$d_getgrgid_r'
22927d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
22928d_getgrps='$d_getgrps'
22929d_gethbyaddr='$d_gethbyaddr'
22930d_gethbyname='$d_gethbyname'
22931d_gethent='$d_gethent'
22932d_gethname='$d_gethname'
10bc17b6
JH
22933d_gethostbyaddr_r='$d_gethostbyaddr_r'
22934d_gethostbyname_r='$d_gethostbyname_r'
22935d_gethostent_r='$d_gethostent_r'
b4eb6b3d 22936d_gethostprotos='$d_gethostprotos'
4e0554ec 22937d_getitimer='$d_getitimer'
b4eb6b3d 22938d_getlogin='$d_getlogin'
10bc17b6 22939d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
22940d_getmnt='$d_getmnt'
22941d_getmntent='$d_getmntent'
5086dff9 22942d_getnameinfo='$d_getnameinfo'
b4eb6b3d
JH
22943d_getnbyaddr='$d_getnbyaddr'
22944d_getnbyname='$d_getnbyname'
22945d_getnent='$d_getnent'
10bc17b6
JH
22946d_getnetbyaddr_r='$d_getnetbyaddr_r'
22947d_getnetbyname_r='$d_getnetbyname_r'
22948d_getnetent_r='$d_getnetent_r'
b4eb6b3d 22949d_getnetprotos='$d_getnetprotos'
0c0643d0 22950d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
22951d_getpbyname='$d_getpbyname'
22952d_getpbynumber='$d_getpbynumber'
22953d_getpent='$d_getpent'
22954d_getpgid='$d_getpgid'
22955d_getpgrp2='$d_getpgrp2'
22956d_getpgrp='$d_getpgrp'
22957d_getppid='$d_getppid'
22958d_getprior='$d_getprior'
10bc17b6
JH
22959d_getprotobyname_r='$d_getprotobyname_r'
22960d_getprotobynumber_r='$d_getprotobynumber_r'
22961d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
22962d_getprotoprotos='$d_getprotoprotos'
22963d_getprpwnam='$d_getprpwnam'
22964d_getpwent='$d_getpwent'
10bc17b6
JH
22965d_getpwent_r='$d_getpwent_r'
22966d_getpwnam_r='$d_getpwnam_r'
22967d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
22968d_getsbyname='$d_getsbyname'
22969d_getsbyport='$d_getsbyport'
22970d_getsent='$d_getsent'
10bc17b6
JH
22971d_getservbyname_r='$d_getservbyname_r'
22972d_getservbyport_r='$d_getservbyport_r'
22973d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
22974d_getservprotos='$d_getservprotos'
22975d_getspnam='$d_getspnam'
10bc17b6 22976d_getspnam_r='$d_getspnam_r'
b4eb6b3d 22977d_gettimeod='$d_gettimeod'
96938616 22978d_gmtime64='$d_gmtime64'
10bc17b6 22979d_gmtime_r='$d_gmtime_r'
5f80c64f 22980d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
22981d_grpasswd='$d_grpasswd'
22982d_hasmntopt='$d_hasmntopt'
22983d_htonl='$d_htonl'
55954f19 22984d_ilogbl='$d_ilogbl'
f3f1a2d8 22985d_inc_version_list='$d_inc_version_list'
b4eb6b3d
JH
22986d_index='$d_index'
22987d_inetaton='$d_inetaton'
5086dff9
MB
22988d_inetntop='$d_inetntop'
22989d_inetpton='$d_inetpton'
b4eb6b3d 22990d_int64_t='$d_int64_t'
18126d98 22991d_ipv6_mreq='$d_ipv6_mreq'
b4eb6b3d 22992d_isascii='$d_isascii'
269a7913 22993d_isblank='$d_isblank'
758a5d79
JH
22994d_isfinite='$d_isfinite'
22995d_isinf='$d_isinf'
b4eb6b3d
JH
22996d_isnan='$d_isnan'
22997d_isnanl='$d_isnanl'
22998d_killpg='$d_killpg'
22999d_lchown='$d_lchown'
23000d_ldbl_dig='$d_ldbl_dig'
0a0abfba 23001d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 23002d_link='$d_link'
96938616 23003d_localtime64='$d_localtime64'
10bc17b6 23004d_localtime_r='$d_localtime_r'
8572b25d 23005d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
b4eb6b3d
JH
23006d_locconv='$d_locconv'
23007d_lockf='$d_lockf'
23008d_longdbl='$d_longdbl'
23009d_longlong='$d_longlong'
23010d_lseekproto='$d_lseekproto'
23011d_lstat='$d_lstat'
23012d_madvise='$d_madvise'
7dd121ae
MB
23013d_malloc_good_size='$d_malloc_good_size'
23014d_malloc_size='$d_malloc_size'
b4eb6b3d
JH
23015d_mblen='$d_mblen'
23016d_mbstowcs='$d_mbstowcs'
23017d_mbtowc='$d_mbtowc'
23018d_memchr='$d_memchr'
23019d_memcmp='$d_memcmp'
23020d_memcpy='$d_memcpy'
23021d_memmove='$d_memmove'
23022d_memset='$d_memset'
23023d_mkdir='$d_mkdir'
23024d_mkdtemp='$d_mkdtemp'
23025d_mkfifo='$d_mkfifo'
23026d_mkstemp='$d_mkstemp'
23027d_mkstemps='$d_mkstemps'
96938616 23028d_mktime64='$d_mktime64'
b4eb6b3d
JH
23029d_mktime='$d_mktime'
23030d_mmap='$d_mmap'
23031d_modfl='$d_modfl'
e67aeab1 23032d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 23033d_modflproto='$d_modflproto'
b4eb6b3d
JH
23034d_mprotect='$d_mprotect'
23035d_msg='$d_msg'
23036d_msg_ctrunc='$d_msg_ctrunc'
23037d_msg_dontroute='$d_msg_dontroute'
23038d_msg_oob='$d_msg_oob'
23039d_msg_peek='$d_msg_peek'
23040d_msg_proxy='$d_msg_proxy'
23041d_msgctl='$d_msgctl'
23042d_msgget='$d_msgget'
4e0554ec 23043d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
23044d_msgrcv='$d_msgrcv'
23045d_msgsnd='$d_msgsnd'
23046d_msync='$d_msync'
23047d_munmap='$d_munmap'
23048d_mymalloc='$d_mymalloc'
a33f2d9f 23049d_ndbm='$d_ndbm'
e74475c7 23050d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
b4eb6b3d 23051d_nice='$d_nice'
2765b840 23052d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 23053d_nv_preserves_uv='$d_nv_preserves_uv'
f607920a 23054d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
b4eb6b3d
JH
23055d_off64_t='$d_off64_t'
23056d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23057d_oldpthreads='$d_oldpthreads'
23058d_oldsock='$d_oldsock'
23059d_open3='$d_open3'
23060d_pathconf='$d_pathconf'
23061d_pause='$d_pause'
23062d_perl_otherlibdirs='$d_perl_otherlibdirs'
23063d_phostname='$d_phostname'
23064d_pipe='$d_pipe'
23065d_poll='$d_poll'
5f80c64f 23066d_portable='$d_portable'
c796e3db
MB
23067d_prctl='$d_prctl'
23068d_prctl_set_name='$d_prctl_set_name'
dcb594bc 23069d_printf_format_null='$d_printf_format_null'
c7aff470 23070d_procselfexe='$d_procselfexe'
233e16ce 23071d_pseudofork='$d_pseudofork'
d6483fcc 23072d_pthread_atfork='$d_pthread_atfork'
58d975c3 23073d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
23074d_pthread_yield='$d_pthread_yield'
23075d_pwage='$d_pwage'
23076d_pwchange='$d_pwchange'
23077d_pwclass='$d_pwclass'
23078d_pwcomment='$d_pwcomment'
23079d_pwexpire='$d_pwexpire'
23080d_pwgecos='$d_pwgecos'
23081d_pwpasswd='$d_pwpasswd'
23082d_pwquota='$d_pwquota'
23083d_qgcvt='$d_qgcvt'
23084d_quad='$d_quad'
10bc17b6
JH
23085d_random_r='$d_random_r'
23086d_readdir64_r='$d_readdir64_r'
b4eb6b3d 23087d_readdir='$d_readdir'
10bc17b6 23088d_readdir_r='$d_readdir_r'
b4eb6b3d 23089d_readlink='$d_readlink'
4e0554ec
JH
23090d_readv='$d_readv'
23091d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
23092d_rename='$d_rename'
23093d_rewinddir='$d_rewinddir'
23094d_rmdir='$d_rmdir'
23095d_safebcpy='$d_safebcpy'
23096d_safemcpy='$d_safemcpy'
23097d_sanemcmp='$d_sanemcmp'
ef9f17be 23098d_sbrkproto='$d_sbrkproto'
55954f19 23099d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
23100d_sched_yield='$d_sched_yield'
23101d_scm_rights='$d_scm_rights'
23102d_seekdir='$d_seekdir'
23103d_select='$d_select'
23104d_sem='$d_sem'
23105d_semctl='$d_semctl'
23106d_semctl_semid_ds='$d_semctl_semid_ds'
23107d_semctl_semun='$d_semctl_semun'
23108d_semget='$d_semget'
23109d_semop='$d_semop'
4e0554ec 23110d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
23111d_setegid='$d_setegid'
23112d_seteuid='$d_seteuid'
23113d_setgrent='$d_setgrent'
10bc17b6 23114d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
23115d_setgrps='$d_setgrps'
23116d_sethent='$d_sethent'
10bc17b6 23117d_sethostent_r='$d_sethostent_r'
4e0554ec 23118d_setitimer='$d_setitimer'
b4eb6b3d
JH
23119d_setlinebuf='$d_setlinebuf'
23120d_setlocale='$d_setlocale'
10bc17b6 23121d_setlocale_r='$d_setlocale_r'
b4eb6b3d 23122d_setnent='$d_setnent'
10bc17b6 23123d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
23124d_setpent='$d_setpent'
23125d_setpgid='$d_setpgid'
23126d_setpgrp2='$d_setpgrp2'
23127d_setpgrp='$d_setpgrp'
23128d_setprior='$d_setprior'
23129d_setproctitle='$d_setproctitle'
10bc17b6 23130d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 23131d_setpwent='$d_setpwent'
10bc17b6 23132d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
23133d_setregid='$d_setregid'
23134d_setresgid='$d_setresgid'
23135d_setresuid='$d_setresuid'
23136d_setreuid='$d_setreuid'
23137d_setrgid='$d_setrgid'
23138d_setruid='$d_setruid'
23139d_setsent='$d_setsent'
10bc17b6 23140d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
23141d_setsid='$d_setsid'
23142d_setvbuf='$d_setvbuf'
23143d_sfio='$d_sfio'
23144d_shm='$d_shm'
23145d_shmat='$d_shmat'
23146d_shmatprototype='$d_shmatprototype'
23147d_shmctl='$d_shmctl'
23148d_shmdt='$d_shmdt'
23149d_shmget='$d_shmget'
23150d_sigaction='$d_sigaction'
ed140128 23151d_signbit='$d_signbit'
983dbef6 23152d_sigprocmask='$d_sigprocmask'
b4eb6b3d 23153d_sigsetjmp='$d_sigsetjmp'
f53580fe 23154d_sin6_scope_id='$d_sin6_scope_id'
c95d0e17 23155d_sitearch='$d_sitearch'
4f5da3e9 23156d_snprintf='$d_snprintf'
18126d98 23157d_sockaddr_in6='$d_sockaddr_in6'
b8677e3b 23158d_sockaddr_sa_len='$d_sockaddr_sa_len'
49a78c82 23159d_sockatmark='$d_sockatmark'
2ef53570 23160d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
23161d_socket='$d_socket'
23162d_socklen_t='$d_socklen_t'
23163d_sockpair='$d_sockpair'
23164d_socks5_init='$d_socks5_init'
360321b3 23165d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
b4eb6b3d 23166d_sqrtl='$d_sqrtl'
10bc17b6
JH
23167d_srand48_r='$d_srand48_r'
23168d_srandom_r='$d_srandom_r'
eef837ea 23169d_sresgproto='$d_sresgproto'
640374d0 23170d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
23171d_statblks='$d_statblks'
23172d_statfs_f_flags='$d_statfs_f_flags'
23173d_statfs_s='$d_statfs_s'
17a6c8e3 23174d_static_inline='$d_static_inline'
b4eb6b3d
JH
23175d_statvfs='$d_statvfs'
23176d_stdio_cnt_lval='$d_stdio_cnt_lval'
23177d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
23178d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23179d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
23180d_stdio_stream_array='$d_stdio_stream_array'
23181d_stdiobase='$d_stdiobase'
23182d_stdstdio='$d_stdstdio'
23183d_strchr='$d_strchr'
23184d_strcoll='$d_strcoll'
23185d_strctcpy='$d_strctcpy'
23186d_strerrm='$d_strerrm'
23187d_strerror='$d_strerror'
10bc17b6 23188d_strerror_r='$d_strerror_r'
b3c85772 23189d_strftime='$d_strftime'
08c92000
MB
23190d_strlcat='$d_strlcat'
23191d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
23192d_strtod='$d_strtod'
23193d_strtol='$d_strtol'
23194d_strtold='$d_strtold'
23195d_strtoll='$d_strtoll'
28e5dec8 23196d_strtoq='$d_strtoq'
b4eb6b3d
JH
23197d_strtoul='$d_strtoul'
23198d_strtoull='$d_strtoull'
23199d_strtouq='$d_strtouq'
23200d_strxfrm='$d_strxfrm'
23201d_suidsafe='$d_suidsafe'
23202d_symlink='$d_symlink'
23203d_syscall='$d_syscall'
2ef53570 23204d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
23205d_sysconf='$d_sysconf'
23206d_sysernlst='$d_sysernlst'
23207d_syserrlst='$d_syserrlst'
23208d_system='$d_system'
23209d_tcgetpgrp='$d_tcgetpgrp'
23210d_tcsetpgrp='$d_tcsetpgrp'
23211d_telldir='$d_telldir'
23212d_telldirproto='$d_telldirproto'
23213d_time='$d_time'
cbb9e8a7 23214d_timegm='$d_timegm'
b4eb6b3d 23215d_times='$d_times'
14b90194
JH
23216d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23217d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 23218d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 23219d_truncate='$d_truncate'
10bc17b6 23220d_ttyname_r='$d_ttyname_r'
b4eb6b3d 23221d_tzname='$d_tzname'
4e0554ec
JH
23222d_u32align='$d_u32align'
23223d_ualarm='$d_ualarm'
b4eb6b3d
JH
23224d_umask='$d_umask'
23225d_uname='$d_uname'
23226d_union_semun='$d_union_semun'
758a5d79 23227d_unordered='$d_unordered'
bdf33aa7 23228d_unsetenv='$d_unsetenv'
4e0554ec 23229d_usleep='$d_usleep'
2ef53570 23230d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
23231d_ustat='$d_ustat'
23232d_vendorarch='$d_vendorarch'
23233d_vendorbin='$d_vendorbin'
23234d_vendorlib='$d_vendorlib'
6e1038e0 23235d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
23236d_vfork='$d_vfork'
23237d_void_closedir='$d_void_closedir'
23238d_voidsig='$d_voidsig'
23239d_voidtty='$d_voidtty'
23240d_volatile='$d_volatile'
23241d_vprintf='$d_vprintf'
4f5da3e9 23242d_vsnprintf='$d_vsnprintf'
b4eb6b3d
JH
23243d_wait4='$d_wait4'
23244d_waitpid='$d_waitpid'
23245d_wcstombs='$d_wcstombs'
23246d_wctomb='$d_wctomb'
4e0554ec 23247d_writev='$d_writev'
5f80c64f
JH
23248d_xenix='$d_xenix'
23249date='$date'
b4eb6b3d
JH
23250db_hashtype='$db_hashtype'
23251db_prefixtype='$db_prefixtype'
640374d0
JH
23252db_version_major='$db_version_major'
23253db_version_minor='$db_version_minor'
23254db_version_patch='$db_version_patch'
b4eb6b3d
JH
23255defvoidused='$defvoidused'
23256direntrytype='$direntrytype'
23257dlext='$dlext'
5f80c64f 23258dlsrc='$dlsrc'
b4eb6b3d
JH
23259doublesize='$doublesize'
23260drand01='$drand01'
10bc17b6 23261drand48_r_proto='$drand48_r_proto'
5ac1e9b2 23262dtrace='$dtrace'
b4eb6b3d
JH
23263dynamic_ext='$dynamic_ext'
23264eagain='$eagain'
23265ebcdic='$ebcdic'
5f80c64f
JH
23266echo='$echo'
23267egrep='$egrep'
23268emacs='$emacs'
10bc17b6
JH
23269endgrent_r_proto='$endgrent_r_proto'
23270endhostent_r_proto='$endhostent_r_proto'
23271endnetent_r_proto='$endnetent_r_proto'
23272endprotoent_r_proto='$endprotoent_r_proto'
23273endpwent_r_proto='$endpwent_r_proto'
23274endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
23275eunicefix='$eunicefix'
23276exe_ext='$exe_ext'
23277expr='$expr'
b4eb6b3d 23278extensions='$extensions'
61c26d18 23279extern_C='$extern_C'
6fcddf3b 23280extras='$extras'
b4eb6b3d
JH
23281fflushNULL='$fflushNULL'
23282fflushall='$fflushall'
5f80c64f
JH
23283find='$find'
23284firstmakefile='$firstmakefile'
23285flex='$flex'
b4eb6b3d
JH
23286fpossize='$fpossize'
23287fpostype='$fpostype'
23288freetype='$freetype'
5440bc8e 23289from='$from'
b4eb6b3d
JH
23290full_ar='$full_ar'
23291full_csh='$full_csh'
23292full_sed='$full_sed'
2d736872 23293gccansipedantic='$gccansipedantic'
5b463ca7 23294gccosandvers='$gccosandvers'
5f80c64f 23295gccversion='$gccversion'
10bc17b6
JH
23296getgrent_r_proto='$getgrent_r_proto'
23297getgrgid_r_proto='$getgrgid_r_proto'
23298getgrnam_r_proto='$getgrnam_r_proto'
23299gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23300gethostbyname_r_proto='$gethostbyname_r_proto'
23301gethostent_r_proto='$gethostent_r_proto'
23302getlogin_r_proto='$getlogin_r_proto'
23303getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23304getnetbyname_r_proto='$getnetbyname_r_proto'
23305getnetent_r_proto='$getnetent_r_proto'
23306getprotobyname_r_proto='$getprotobyname_r_proto'
23307getprotobynumber_r_proto='$getprotobynumber_r_proto'
23308getprotoent_r_proto='$getprotoent_r_proto'
23309getpwent_r_proto='$getpwent_r_proto'
23310getpwnam_r_proto='$getpwnam_r_proto'
23311getpwuid_r_proto='$getpwuid_r_proto'
23312getservbyname_r_proto='$getservbyname_r_proto'
23313getservbyport_r_proto='$getservbyport_r_proto'
23314getservent_r_proto='$getservent_r_proto'
23315getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
23316gidformat='$gidformat'
23317gidsign='$gidsign'
23318gidsize='$gidsize'
23319gidtype='$gidtype'
5f80c64f 23320glibpth='$glibpth'
3c728e00 23321gmake='$gmake'
10bc17b6 23322gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 23323gnulibc_version='$gnulibc_version'
5f80c64f 23324grep='$grep'
b4eb6b3d
JH
23325groupcat='$groupcat'
23326groupstype='$groupstype'
5f80c64f 23327gzip='$gzip'
b4eb6b3d
JH
23328h_fcntl='$h_fcntl'
23329h_sysfile='$h_sysfile'
5f80c64f 23330hint='$hint'
b4eb6b3d 23331hostcat='$hostcat'
6e1038e0
MB
23332html1dir='$html1dir'
23333html1direxp='$html1direxp'
23334html3dir='$html3dir'
23335html3direxp='$html3direxp'
b4eb6b3d
JH
23336i16size='$i16size'
23337i16type='$i16type'
23338i32size='$i32size'
23339i32type='$i32type'
23340i64size='$i64size'
23341i64type='$i64type'
23342i8size='$i8size'
23343i8type='$i8type'
23344i_arpainet='$i_arpainet'
2a0de2c5 23345i_assert='$i_assert'
b4eb6b3d 23346i_bsdioctl='$i_bsdioctl'
10bc17b6 23347i_crypt='$i_crypt'
b4eb6b3d
JH
23348i_db='$i_db'
23349i_dbm='$i_dbm'
23350i_dirent='$i_dirent'
5f80c64f 23351i_dld='$i_dld'
b4eb6b3d
JH
23352i_dlfcn='$i_dlfcn'
23353i_fcntl='$i_fcntl'
23354i_float='$i_float'
758a5d79
JH
23355i_fp='$i_fp'
23356i_fp_class='$i_fp_class'
b4eb6b3d 23357i_gdbm='$i_gdbm'
a33f2d9f
AD
23358i_gdbm_ndbm='$i_gdbm_ndbm'
23359i_gdbmndbm='$i_gdbmndbm'
b4eb6b3d 23360i_grp='$i_grp'
b4eb6b3d
JH
23361i_ieeefp='$i_ieeefp'
23362i_inttypes='$i_inttypes'
2765b840 23363i_langinfo='$i_langinfo'
b4eb6b3d
JH
23364i_libutil='$i_libutil'
23365i_limits='$i_limits'
23366i_locale='$i_locale'
23367i_machcthr='$i_machcthr'
23368i_malloc='$i_malloc'
1cd66f7c 23369i_mallocmalloc='$i_mallocmalloc'
b4eb6b3d
JH
23370i_math='$i_math'
23371i_memory='$i_memory'
23372i_mntent='$i_mntent'
23373i_ndbm='$i_ndbm'
23374i_netdb='$i_netdb'
23375i_neterrno='$i_neterrno'
23376i_netinettcp='$i_netinettcp'
23377i_niin='$i_niin'
23378i_poll='$i_poll'
23379i_prot='$i_prot'
23380i_pthread='$i_pthread'
23381i_pwd='$i_pwd'
23382i_rpcsvcdbm='$i_rpcsvcdbm'
23383i_sfio='$i_sfio'
23384i_sgtty='$i_sgtty'
23385i_shadow='$i_shadow'
23386i_socks='$i_socks'
23387i_stdarg='$i_stdarg'
bd31be4b 23388i_stdbool='$i_stdbool'
b4eb6b3d
JH
23389i_stddef='$i_stddef'
23390i_stdlib='$i_stdlib'
23391i_string='$i_string'
23392i_sunmath='$i_sunmath'
23393i_sysaccess='$i_sysaccess'
23394i_sysdir='$i_sysdir'
23395i_sysfile='$i_sysfile'
23396i_sysfilio='$i_sysfilio'
23397i_sysin='$i_sysin'
23398i_sysioctl='$i_sysioctl'
23399i_syslog='$i_syslog'
23400i_sysmman='$i_sysmman'
23401i_sysmode='$i_sysmode'
23402i_sysmount='$i_sysmount'
23403i_sysndir='$i_sysndir'
23404i_sysparam='$i_sysparam'
216dac04 23405i_syspoll='$i_syspoll'
b4eb6b3d
JH
23406i_sysresrc='$i_sysresrc'
23407i_syssecrt='$i_syssecrt'
23408i_sysselct='$i_sysselct'
23409i_syssockio='$i_syssockio'
23410i_sysstat='$i_sysstat'
23411i_sysstatfs='$i_sysstatfs'
23412i_sysstatvfs='$i_sysstatvfs'
23413i_systime='$i_systime'
23414i_systimek='$i_systimek'
23415i_systimes='$i_systimes'
23416i_systypes='$i_systypes'
23417i_sysuio='$i_sysuio'
23418i_sysun='$i_sysun'
23419i_sysutsname='$i_sysutsname'
23420i_sysvfs='$i_sysvfs'
23421i_syswait='$i_syswait'
23422i_termio='$i_termio'
23423i_termios='$i_termios'
23424i_time='$i_time'
23425i_unistd='$i_unistd'
23426i_ustat='$i_ustat'
23427i_utime='$i_utime'
23428i_values='$i_values'
23429i_varargs='$i_varargs'
23430i_varhdr='$i_varhdr'
23431i_vfork='$i_vfork'
5f80c64f 23432ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
23433inc_version_list='$inc_version_list'
23434inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
23435incpath='$incpath'
23436inews='$inews'
f3f1a2d8 23437initialinstalllocation='$initialinstalllocation'
b4eb6b3d
JH
23438installarchlib='$installarchlib'
23439installbin='$installbin'
6e1038e0
MB
23440installhtml1dir='$installhtml1dir'
23441installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
23442installman1dir='$installman1dir'
23443installman3dir='$installman3dir'
23444installprefix='$installprefix'
23445installprefixexp='$installprefixexp'
23446installprivlib='$installprivlib'
23447installscript='$installscript'
23448installsitearch='$installsitearch'
23449installsitebin='$installsitebin'
8d2cbf27
JH
23450installsitehtml1dir='$installsitehtml1dir'
23451installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 23452installsitelib='$installsitelib'
91e123a8
JH
23453installsiteman1dir='$installsiteman1dir'
23454installsiteman3dir='$installsiteman3dir'
6e1038e0 23455installsitescript='$installsitescript'
b4eb6b3d
JH
23456installstyle='$installstyle'
23457installusrbinperl='$installusrbinperl'
23458installvendorarch='$installvendorarch'
23459installvendorbin='$installvendorbin'
8d2cbf27
JH
23460installvendorhtml1dir='$installvendorhtml1dir'
23461installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 23462installvendorlib='$installvendorlib'
91e123a8
JH
23463installvendorman1dir='$installvendorman1dir'
23464installvendorman3dir='$installvendorman3dir'
6e1038e0 23465installvendorscript='$installvendorscript'
b4eb6b3d 23466intsize='$intsize'
4b661809 23467issymlink='$issymlink'
b4eb6b3d
JH
23468ivdformat='$ivdformat'
23469ivsize='$ivsize'
23470ivtype='$ivtype'
23471known_extensions='$known_extensions'
5f80c64f 23472ksh='$ksh'
5f80c64f
JH
23473ld='$ld'
23474lddlflags='$lddlflags'
23475ldflags='$ldflags'
b4eb6b3d
JH
23476ldflags_uselargefiles='$ldflags_uselargefiles'
23477ldlibpthname='$ldlibpthname'
5f80c64f
JH
23478less='$less'
23479lib_ext='$lib_ext'
23480libc='$libc'
b4eb6b3d 23481libperl='$libperl'
5f80c64f
JH
23482libpth='$libpth'
23483libs='$libs'
43999f95
JH
23484libsdirs='$libsdirs'
23485libsfiles='$libsfiles'
23486libsfound='$libsfound'
13b3f787 23487libspath='$libspath'
5f80c64f 23488libswanted='$libswanted'
b4eb6b3d 23489libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
23490line='$line'
23491lint='$lint'
23492lkflags='$lkflags'
23493ln='$ln'
23494lns='$lns'
10bc17b6 23495localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
23496locincpth='$locincpth'
23497loclibpth='$loclibpth'
b4eb6b3d
JH
23498longdblsize='$longdblsize'
23499longlongsize='$longlongsize'
23500longsize='$longsize'
5f80c64f
JH
23501lp='$lp'
23502lpr='$lpr'
23503ls='$ls'
b4eb6b3d
JH
23504lseeksize='$lseeksize'
23505lseektype='$lseektype'
a724edfe 23506mad='$mad'
f3f1a2d8
MB
23507madlyh='$madlyh'
23508madlyobj='$madlyobj'
23509madlysrc='$madlysrc'
5f80c64f
JH
23510mail='$mail'
23511mailx='$mailx'
23512make='$make'
23513make_set_make='$make_set_make'
b4eb6b3d
JH
23514mallocobj='$mallocobj'
23515mallocsrc='$mallocsrc'
23516malloctype='$malloctype'
23517man1dir='$man1dir'
23518man1direxp='$man1direxp'
23519man1ext='$man1ext'
23520man3dir='$man3dir'
23521man3direxp='$man3direxp'
23522man3ext='$man3ext'
5f80c64f 23523mips_type='$mips_type'
5129fff4 23524mistrustnm='$mistrustnm'
5f80c64f 23525mkdir='$mkdir'
b4eb6b3d
JH
23526mmaptype='$mmaptype'
23527modetype='$modetype'
5f80c64f 23528more='$more'
b4eb6b3d 23529multiarch='$multiarch'
5f80c64f 23530mv='$mv'
b4eb6b3d
JH
23531myarchname='$myarchname'
23532mydomain='$mydomain'
23533myhostname='$myhostname'
5f80c64f
JH
23534myuname='$myuname'
23535n='$n'
2cc61e15 23536need_va_copy='$need_va_copy'
b4eb6b3d
JH
23537netdb_hlen_type='$netdb_hlen_type'
23538netdb_host_type='$netdb_host_type'
23539netdb_name_type='$netdb_name_type'
23540netdb_net_type='$netdb_net_type'
5f80c64f
JH
23541nm='$nm'
23542nm_opt='$nm_opt'
23543nm_so_opt='$nm_so_opt'
b4eb6b3d 23544nonxs_ext='$nonxs_ext'
5f80c64f 23545nroff='$nroff'
b4eb6b3d
JH
23546nvEUformat='$nvEUformat'
23547nvFUformat='$nvFUformat'
23548nvGUformat='$nvGUformat'
b68c599a 23549nv_overflows_integers_at='$nv_overflows_integers_at'
53133ed1 23550nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
23551nveformat='$nveformat'
23552nvfformat='$nvfformat'
23553nvgformat='$nvgformat'
23554nvsize='$nvsize'
23555nvtype='$nvtype'
23556o_nonblock='$o_nonblock'
5f80c64f 23557obj_ext='$obj_ext'
b4eb6b3d 23558old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 23559optimize='$optimize'
b4eb6b3d 23560orderlib='$orderlib'
5f80c64f
JH
23561osname='$osname'
23562osvers='$osvers'
b4eb6b3d 23563otherlibdirs='$otherlibdirs'
5f80c64f 23564package='$package'
b4eb6b3d
JH
23565pager='$pager'
23566passcat='$passcat'
23567patchlevel='$patchlevel'
5f80c64f 23568path_sep='$path_sep'
b4eb6b3d 23569perl5='$perl5'
5f80c64f 23570perl='$perl'
151e6568 23571perl_patchlevel='$perl_patchlevel'
17a6c8e3 23572perl_static_inline='$perl_static_inline'
b4eb6b3d 23573perladmin='$perladmin'
9c839522 23574perllibs='$perllibs'
91f55cc7 23575perlpath='$perlpath'
5f80c64f 23576pg='$pg'
b4eb6b3d
JH
23577phostname='$phostname'
23578pidtype='$pidtype'
5f80c64f
JH
23579plibpth='$plibpth'
23580pmake='$pmake'
23581pr='$pr'
b4eb6b3d
JH
23582prefix='$prefix'
23583prefixexp='$prefixexp'
23584privlib='$privlib'
23585privlibexp='$privlibexp'
f24dbf84 23586procselfexe='$procselfexe'
b4eb6b3d
JH
23587prototype='$prototype'
23588ptrsize='$ptrsize'
23589quadkind='$quadkind'
23590quadtype='$quadtype'
23591randbits='$randbits'
23592randfunc='$randfunc'
10bc17b6 23593random_r_proto='$random_r_proto'
b4eb6b3d
JH
23594randseedtype='$randseedtype'
23595ranlib='$ranlib'
23596rd_nodata='$rd_nodata'
10bc17b6
JH
23597readdir64_r_proto='$readdir64_r_proto'
23598readdir_r_proto='$readdir_r_proto'
b4eb6b3d 23599revision='$revision'
5f80c64f 23600rm='$rm'
5b813a60 23601rm_try='$rm_try'
5f80c64f 23602rmail='$rmail'
5440bc8e 23603run='$run'
5f80c64f 23604runnm='$runnm'
81c4fd9e
MB
23605sGMTIME_max='$sGMTIME_max'
23606sGMTIME_min='$sGMTIME_min'
73e6e416
MB
23607sLOCALTIME_max='$sLOCALTIME_max'
23608sLOCALTIME_min='$sLOCALTIME_min'
b4eb6b3d
JH
23609sPRIEUldbl='$sPRIEUldbl'
23610sPRIFUldbl='$sPRIFUldbl'
23611sPRIGUldbl='$sPRIGUldbl'
23612sPRIXU64='$sPRIXU64'
23613sPRId64='$sPRId64'
23614sPRIeldbl='$sPRIeldbl'
23615sPRIfldbl='$sPRIfldbl'
23616sPRIgldbl='$sPRIgldbl'
23617sPRIi64='$sPRIi64'
23618sPRIo64='$sPRIo64'
23619sPRIu64='$sPRIu64'
23620sPRIx64='$sPRIx64'
23621sSCNfldbl='$sSCNfldbl'
23622sched_yield='$sched_yield'
23623scriptdir='$scriptdir'
23624scriptdirexp='$scriptdirexp'
5f80c64f 23625sed='$sed'
b4eb6b3d
JH
23626seedfunc='$seedfunc'
23627selectminbits='$selectminbits'
23628selecttype='$selecttype'
5f80c64f 23629sendmail='$sendmail'
10bc17b6
JH
23630setgrent_r_proto='$setgrent_r_proto'
23631sethostent_r_proto='$sethostent_r_proto'
23632setlocale_r_proto='$setlocale_r_proto'
23633setnetent_r_proto='$setnetent_r_proto'
23634setprotoent_r_proto='$setprotoent_r_proto'
23635setpwent_r_proto='$setpwent_r_proto'
23636setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
23637sh='$sh'
23638shar='$shar'
23639sharpbang='$sharpbang'
b4eb6b3d
JH
23640shmattype='$shmattype'
23641shortsize='$shortsize'
23642shrpenv='$shrpenv'
5f80c64f 23643shsharp='$shsharp'
b4eb6b3d
JH
23644sig_count='$sig_count'
23645sig_name='$sig_name'
23646sig_name_init='$sig_name_init'
23647sig_num='$sig_num'
23648sig_num_init='$sig_num_init'
76d3c696 23649sig_size='$sig_size'
b4eb6b3d
JH
23650signal_t='$signal_t'
23651sitearch='$sitearch'
23652sitearchexp='$sitearchexp'
23653sitebin='$sitebin'
23654sitebinexp='$sitebinexp'
8d2cbf27
JH
23655sitehtml1dir='$sitehtml1dir'
23656sitehtml1direxp='$sitehtml1direxp'
23657sitehtml3dir='$sitehtml3dir'
23658sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
23659sitelib='$sitelib'
23660sitelib_stem='$sitelib_stem'
23661sitelibexp='$sitelibexp'
91e123a8
JH
23662siteman1dir='$siteman1dir'
23663siteman1direxp='$siteman1direxp'
23664siteman3dir='$siteman3dir'
23665siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
23666siteprefix='$siteprefix'
23667siteprefixexp='$siteprefixexp'
6e1038e0
MB
23668sitescript='$sitescript'
23669sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
23670sizesize='$sizesize'
23671sizetype='$sizetype'
5f80c64f
JH
23672sleep='$sleep'
23673smail='$smail'
5f80c64f 23674so='$so'
b4eb6b3d
JH
23675sockethdr='$sockethdr'
23676socketlib='$socketlib'
23677socksizetype='$socksizetype'
5f80c64f
JH
23678sort='$sort'
23679spackage='$spackage'
23680spitshell='$spitshell'
10bc17b6
JH
23681srand48_r_proto='$srand48_r_proto'
23682srandom_r_proto='$srandom_r_proto'
5f80c64f 23683src='$src'
b4eb6b3d 23684ssizetype='$ssizetype'
668fdbe1
MB
23685st_ino_sign='$st_ino_sign'
23686st_ino_size='$st_ino_size'
b4eb6b3d 23687startperl='$startperl'
5f80c64f 23688startsh='$startsh'
b4eb6b3d
JH
23689static_ext='$static_ext'
23690stdchar='$stdchar'
23691stdio_base='$stdio_base'
23692stdio_bufsiz='$stdio_bufsiz'
23693stdio_cnt='$stdio_cnt'
23694stdio_filbuf='$stdio_filbuf'
23695stdio_ptr='$stdio_ptr'
23696stdio_stream_array='$stdio_stream_array'
10bc17b6 23697strerror_r_proto='$strerror_r_proto'
b4eb6b3d 23698strings='$strings'
5f80c64f 23699submit='$submit'
b4eb6b3d
JH
23700subversion='$subversion'
23701sysman='$sysman'
5f80c64f
JH
23702tail='$tail'
23703tar='$tar'
5440bc8e 23704targetarch='$targetarch'
5f80c64f
JH
23705tbl='$tbl'
23706tee='$tee'
23707test='$test'
b4eb6b3d
JH
23708timeincl='$timeincl'
23709timetype='$timetype'
10bc17b6 23710tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 23711to='$to'
5f80c64f
JH
23712touch='$touch'
23713tr='$tr'
23714trnl='$trnl'
23715troff='$troff'
10bc17b6 23716ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
23717u16size='$u16size'
23718u16type='$u16type'
23719u32size='$u32size'
23720u32type='$u32type'
23721u64size='$u64size'
23722u64type='$u64type'
23723u8size='$u8size'
23724u8type='$u8type'
23725uidformat='$uidformat'
23726uidsign='$uidsign'
23727uidsize='$uidsize'
23728uidtype='$uidtype'
5f80c64f
JH
23729uname='$uname'
23730uniq='$uniq'
b4eb6b3d
JH
23731uquadtype='$uquadtype'
23732use5005threads='$use5005threads'
23733use64bitall='$use64bitall'
23734use64bitint='$use64bitint'
5440bc8e 23735usecrosscompile='$usecrosscompile'
1be1b388 23736usedevel='$usedevel'
5f80c64f 23737usedl='$usedl'
5ac1e9b2 23738usedtrace='$usedtrace'
15b61c98 23739usefaststdio='$usefaststdio'
b4eb6b3d 23740useithreads='$useithreads'
2982a345 23741usekernprocpathname='$usekernprocpathname'
b4eb6b3d
JH
23742uselargefiles='$uselargefiles'
23743uselongdouble='$uselongdouble'
19a100ff 23744usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
23745usemorebits='$usemorebits'
23746usemultiplicity='$usemultiplicity'
23747usemymalloc='$usemymalloc'
5f80c64f 23748usenm='$usenm'
ae60cb46 23749usensgetexecutablepath='$usensgetexecutablepath'
b4eb6b3d
JH
23750useopcode='$useopcode'
23751useperlio='$useperlio'
23752useposix='$useposix'
9514c62b 23753usereentrant='$usereentrant'
d51aaa9d 23754userelocatableinc='$userelocatableinc'
b4eb6b3d
JH
23755usesfio='$usesfio'
23756useshrplib='$useshrplib'
5f106f9c 23757usesitecustomize='$usesitecustomize'
29209bc5 23758usesocks='$usesocks'
b4eb6b3d
JH
23759usethreads='$usethreads'
23760usevendorprefix='$usevendorprefix'
23761usevfork='$usevfork'
5f80c64f
JH
23762usrinc='$usrinc'
23763uuname='$uuname'
b4eb6b3d
JH
23764uvXUformat='$uvXUformat'
23765uvoformat='$uvoformat'
23766uvsize='$uvsize'
23767uvtype='$uvtype'
23768uvuformat='$uvuformat'
23769uvxformat='$uvxformat'
d03b3b00 23770vaproto='$vaproto'
b4eb6b3d
JH
23771vendorarch='$vendorarch'
23772vendorarchexp='$vendorarchexp'
23773vendorbin='$vendorbin'
23774vendorbinexp='$vendorbinexp'
8d2cbf27
JH
23775vendorhtml1dir='$vendorhtml1dir'
23776vendorhtml1direxp='$vendorhtml1direxp'
23777vendorhtml3dir='$vendorhtml3dir'
23778vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
23779vendorlib='$vendorlib'
23780vendorlib_stem='$vendorlib_stem'
23781vendorlibexp='$vendorlibexp'
91e123a8
JH
23782vendorman1dir='$vendorman1dir'
23783vendorman1direxp='$vendorman1direxp'
23784vendorman3dir='$vendorman3dir'
23785vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
23786vendorprefix='$vendorprefix'
23787vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
23788vendorscript='$vendorscript'
23789vendorscriptexp='$vendorscriptexp'
b4eb6b3d 23790version='$version'
861eb78d 23791version_patchlevel_string='$version_patchlevel_string'
d56c5707 23792versiononly='$versiononly'
5f80c64f 23793vi='$vi'
b4eb6b3d 23794voidflags='$voidflags'
5f80c64f 23795xlibpth='$xlibpth'
3659ebf1
JH
23796yacc='$yacc'
23797yaccflags='$yaccflags'
5f80c64f
JH
23798zcat='$zcat'
23799zip='$zip'
23800EOT
23801
5f80c64f
JH
23802: add special variables
23803$test -f $src/patchlevel.h && \
d9421656 23804awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
0f04e85f 23805echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
a02608de 23806echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
23807
23808: propagate old symbols
23809if $test -f UU/config.sh; then
381aa1ff 23810 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
776a38e3
MB
23811 $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23812 config.sh config.sh UU/oldconfig.sh |\
23813 $sort | $uniq -u >UU/oldsyms
dd35fa16 23814 set X `$cat UU/oldsyms`
5f80c64f
JH
23815 shift
23816 case $# in
23817 0) ;;
23818 *)
dd35fa16 23819 $cat <<EOM
5f80c64f
JH
23820Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23821EOM
776a38e3 23822 echo ": Variables propagated from previous config.sh file." >>config.sh
dd35fa16 23823 for sym in `$cat UU/oldsyms`; do
5f80c64f
JH
23824 echo " Propagating $hint variable "'$'"$sym..."
23825 eval 'tmp="$'"${sym}"'"'
23826 echo "$tmp" | \
23827 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23828 done
23829 ;;
23830 esac
23831fi
23832
23833: Finish up by extracting the .SH files
23834case "$alldone" in
23835exit)
23836 $rm -rf UU
24ccb310 23837 echo "Extraction done."
5f80c64f
JH
23838 exit 0
23839 ;;
23840cont)
23841 ;;
23842'')
23843 dflt=''
23844 nostick=true
23845 $cat <<EOM
23846
23847If you'd like to make any changes to the config.sh file before I begin
23848to configure things, do it as a shell escape now (e.g. !vi config.sh).
23849
23850EOM
23851 rp="Press return or use a shell escape to edit config.sh:"
23852 . UU/myread
23853 nostick=''
23854 case "$ans" in
23855 '') ;;
23856 *) : in case they cannot read
23857 sh 1>&4 -c "$ans";;
23858 esac
23859 ;;
23860esac
23861
23862: if this fails, just run all the .SH files by hand
23863. ./config.sh
23864
23865echo " "
23866exec 1>&4
a43e8593 23867pwd=`pwd`
5f80c64f 23868. ./UU/extract
6904989c 23869cd "$pwd"
5f80c64f
JH
23870
23871if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23872 dflt=y
23873 case "$silent" in
23874 true) ;;
23875 *)
23876 $cat <<EOM
23877
23878Now you need to generate make dependencies by running "$make depend".
23879You might prefer to run it in background: "$make depend > makedepend.out &"
23880It can take a while, so you might not want to run it right now.
23881
23882EOM
23883 ;;
23884 esac
23885 rp="Run $make depend now?"
23886 . UU/myread
23887 case "$ans" in
23888 y*)
3d5d58b1 23889 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
23890 ;;
23891 *)
23892 echo "You must run '$make depend' then '$make'."
23893 ;;
23894 esac
23895elif test -f [Mm]akefile; then
23896 echo " "
23897 echo "Now you must run a $make."
23898else
24ccb310 23899 echo "Configure done."
5f80c64f
JH
23900fi
23901
23902if $test -f Policy.sh; then
23903 $cat <<EOM
23904
23905If you compile $package on a different machine or from a different object
23906directory, copy the Policy.sh file from this object directory to the
23907new one before you run Configure -- this will help you with most of
23908the policy defaults.
23909
23910EOM
23911fi
23912if $test -f config.msg; then
23913 echo "Hmm. I also noted the following information while running:"
23914 echo " "
23915 $cat config.msg >&4
23916 $rm -f config.msg
23917fi
23918$rm -f kit*isdone ark*isdone
23919$rm -rf UU
23920
23921: End of Configure
23922